author | Claus Gittinger <cg@exept.de> |
Wed, 27 Jan 2016 19:23:31 +0100 | |
changeset 19121 | 4b8d83dceb98 |
parent 19117 | e0cde133ba64 |
child 19127 | 940613fe6659 |
child 19187 | 7730a271c529 |
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 |
|
23 |
IsSharedLibraryComponent IsSTScript DebuggingStandAlone LogDoits |
|
24 |
LoadBinaries RealSystemPath ResourcePath SourcePath BinaryPath |
|
25 |
FileInPath PackagePath BinaryDirName ResourceDirName |
|
26 |
SourceDirName BitmapDirName PackageDirName FileInDirName |
|
27 |
ChangeFileName ImageStartTime ImageRestartTime DemoMode |
|
28 |
SaveEmergencyImage SpecialObjectArray CallbackSignal |
|
29 |
ClassesFailedToInitialize HasNoConsole IgnoreHalt |
|
30 |
PackageToPathMapping IgnoreAssertions' |
|
31 |
poolDictionaries:'' |
|
32 |
category:'System-Support' |
|
1 | 33 |
! |
34 |
||
13415 | 35 |
Smalltalk comment:'' |
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
36 |
! |
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
37 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
38 |
!Smalltalk class methodsFor:'documentation'! |
70 | 39 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
40 |
copyright |
617 | 41 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
42 |
COPYRIGHT (c) 1988 by Claus Gittinger |
18668 | 43 |
All Rights Reserved |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
44 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
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
|
49 |
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
|
50 |
hereby transferred. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
51 |
" |
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 |
documentation |
70 | 55 |
" |
56 |
This is one of the central classes in the system; |
|
57 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
58 |
Also global variables are (conceptionally) kept here. |
70 | 59 |
|
60 |
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
|
61 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
62 |
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
|
63 |
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
|
64 |
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
|
65 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
66 |
|
70 | 67 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
68 |
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
|
69 |
to inherit more collection stuff ... |
70 | 70 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
71 |
|
1286 | 72 |
[Instance variables:] |
18668 | 73 |
none - all handling is done in the VM |
1286 | 74 |
|
75 |
[Class variables:] |
|
76 |
||
18668 | 77 |
StartBlocks <Collection> blocks to be executed in a separate process after |
78 |
everything has been initialized. These blocks will |
|
79 |
be deleted after execution and therefore not be |
|
80 |
executed after an image restart. Initial processes |
|
81 |
(such as the Launcher) are usually started here. |
|
82 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
83 |
via #addStartBlock during early initialization. |
|
84 |
||
85 |
ImageStartBlocks |
|
86 |
<Collection> blocks to be executed in a separate process after |
|
87 |
everything has been initialized. These blocks will be |
|
88 |
executed after an image restart. |
|
89 |
These blocks are usually added by smalltalk_r.rc etc. |
|
90 |
||
91 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
92 |
left. Not currently used (GNU-ST compatibility). |
|
93 |
||
94 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
95 |
Set to a default here, but typically changed from some |
|
96 |
startup.rc file |
|
97 |
||
98 |
PackagePath <Collection> path to search for package. |
|
99 |
This is going to replace the above systemPath, and a classes |
|
100 |
resources will eventually searched in its package directory. |
|
101 |
This list defines the path, where packages are searched for, |
|
102 |
initially this is something like /opt/smalltalk/packages. |
|
103 |
Set to a default here, but typically changed from some |
|
104 |
startup.rc file |
|
105 |
||
106 |
StartupClass <Class> class and selector, where the system starts up |
|
107 |
StartupSelector <Symbol> (right after VM initialization) |
|
108 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
109 |
the image will come up there. |
|
110 |
Allows for customized images to be generated from a standard ST/X. |
|
111 |
StandAlone programs also set those during initialization. |
|
112 |
||
113 |
CommandLine <String> Unix (OS-) command line |
|
114 |
||
115 |
CommandName <String> the command (i.e. argv[0]) |
|
116 |
||
117 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
118 |
CommandName has been stripped off. |
|
119 |
(initially set by the VM) |
|
120 |
||
121 |
SilentLoading <Boolean> OBSOLETE: |
|
122 |
suppresses messages during fileIn and in compiler |
|
123 |
(can be set to true from a customized main.c) |
|
124 |
||
125 |
VerboseLoading <Boolean> generate messages during fileIn and in compiler |
|
126 |
(can be set to true from a customized main.c) |
|
127 |
||
128 |
Initializing <Boolean> true while (re-)initializing |
|
129 |
Controls the behavior of certain error |
|
130 |
reporters (for example: suppress dialogBoxes) |
|
131 |
while the system is not yet fit for full operation. |
|
132 |
||
133 |
StandAlone <Boolean> true, if this is a standalone app; |
|
134 |
if true the process scheduler watches for |
|
135 |
which processes are still running, and |
|
136 |
exits ST/X, when the last non-background |
|
137 |
and non-system process exits. |
|
138 |
Can be set in an application-specific startup script, |
|
139 |
or, for standAlone programs, by C-code during initialization. |
|
140 |
||
141 |
HeadlessOperation if true, a non-existing Display connection |
|
142 |
<Boolean> will NOT lead to an error-exit during startup. |
|
143 |
Default is false. |
|
144 |
Can be set in an application-specific startup script, |
|
145 |
or, for standAlone programs, by C-code during initialization. |
|
146 |
||
147 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
148 |
file. Default is false, since the changes file |
|
149 |
may become huge if every tiny doIt is saved there ... |
|
150 |
||
151 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
152 |
file, if present. If false, this is always suppressed. |
|
153 |
||
154 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
155 |
is saved, if the main Display looses its |
|
156 |
connection. This is useful if you have a |
|
157 |
flaky display connection (serial line) |
|
158 |
and want to have your stuff saved automatically |
|
159 |
in case of a broken connection. |
|
160 |
||
161 |
IgnoreAssertions <Boolean> if true, assertions are ignored (i.e. no errors reported). |
|
162 |
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
|
163 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
164 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
165 |
|
18668 | 166 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
167 |
||
168 |
CachedAbbreviations |
|
169 |
<Dictionary> className to filename mappings |
|
170 |
||
171 |
RealSystemPath <Collection> cached collection of directories along the path |
|
172 |
which really exist. Caching avoids long checks |
|
173 |
for existing directories on broken NFS volumes. |
|
174 |
||
175 |
SourcePath <Collection> cached names of really existing directories |
|
176 |
These are remembered, as in NFS systems, |
|
177 |
ResourcePath the time to lookup files may become long |
|
178 |
BinaryPath (especially, if some directories are on machines |
|
179 |
FileInPath which are not up ...). |
|
180 |
Therefore, the set of really |
|
181 |
existing directories is cached when the SystemPath |
|
182 |
is walked the first time. |
|
183 |
A consequence is that you have to invoke |
|
184 |
flushSystemPath, when you create any of those |
|
185 |
directories while running |
|
186 |
(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
|
187 |
|
1286 | 188 |
|
189 |
[author:] |
|
18668 | 190 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
191 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
192 |
[see also:] |
18668 | 193 |
ObjectMemory |
194 |
StandaloneStartup |
|
195 |
GetOpt |
|
196 |
ReadEvalPrintLoop |
|
70 | 197 |
" |
8945 | 198 |
! |
199 |
||
200 |
readme_resources |
|
201 |
" |
|
202 |
What is a resource file: |
|
18668 | 203 |
resource files contain language transformation and sometimes |
204 |
UI-look specifics such as icons etc. |
|
8945 | 205 |
|
206 |
Where are resources stored in the image: |
|
18668 | 207 |
Resource files are only read on demand (i.e. when needed) and only read once |
208 |
i.e. they are cached in the image). |
|
209 |
The cached data is held in a per-class class-instVar named 'ClassResources'. |
|
210 |
With only a few exceptions, the only classes which need resources are the GUI |
|
211 |
classes under the SimpleView hierarchy. |
|
8945 | 212 |
|
213 |
How does the system find resources: |
|
18668 | 214 |
The idea is that the system-provided resource files can be overwritten |
215 |
by the user or an application configuration. |
|
216 |
This works via a hierarchy of directories where resources are searched for, |
|
217 |
with the systems standard resource-files being at the end of that chain. |
|
218 |
||
219 |
When searching for a resource file for class X, the following files are searched |
|
220 |
in order: |
|
221 |
{ResourcePath} / resources / X.rs |
|
222 |
{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
223 |
{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
8945 | 224 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
225 |
! ! |
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 |
!Smalltalk class methodsFor:'initialization'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
228 |
|
11057 | 229 |
basicInitializeSystem |
16180 | 230 |
"initialize all other classes. |
16655 | 231 |
This one is the very first entry into the smalltalk world |
232 |
[with error handling, via the initializeSystem], |
|
233 |
right after startup, usually immediately followed by Smalltalk>>start. |
|
234 |
||
11057 | 235 |
Notice: |
18668 | 236 |
this is NOT called when an image is restarted; in this |
237 |
case the show starts in Smalltalk>>restart." |
|
11057 | 238 |
|
13771 | 239 |
Compiler := ByteCodeCompiler. |
240 |
Compiler isNil ifTrue:[ |
|
18668 | 241 |
" |
242 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
243 |
this allows at least immediate evaluations for runtime systems without compiler |
|
244 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
245 |
" |
|
246 |
Compiler := Parser |
|
16164 | 247 |
]. |
13771 | 248 |
|
11057 | 249 |
"/ |
250 |
"/ start catching SIGSEGV and SIGBUS |
|
251 |
"/ |
|
252 |
OperatingSystem enableHardSignalInterrupts. |
|
253 |
||
254 |
self initGlobalsFromEnvironment. |
|
255 |
||
256 |
"/ |
|
257 |
"/ sorry - there are some, which MUST be initialized before .. |
|
258 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
259 |
"/ |
|
15265 | 260 |
SmallInteger initialize. |
11057 | 261 |
Object initialize. |
18283 | 262 |
UninterpretedBytes initialize. |
16691 | 263 |
OperatingSystem initialize. |
11057 | 264 |
Stream initialize. |
265 |
PositionableStream initialize. |
|
266 |
Filename initialize. |
|
267 |
ObjectMemory initialize. |
|
268 |
ExternalStream initialize. |
|
12745
e944659a6a52
changed: #basicInitializeSystem
Claus Gittinger <cg@exept.de>
parents:
12744
diff
changeset
|
269 |
ProcessorScheduler initialize. |
11057 | 270 |
|
271 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
272 |
||
273 |
"/ |
|
274 |
"/ sorry, path must be set before ... |
|
275 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
276 |
"/ |
|
17534 | 277 |
"/ but, on OSX we need the CharacterEncoder to be initialized |
278 |
CharacterEncoder initialize. |
|
11057 | 279 |
self initSystemPath. |
280 |
||
281 |
"/ |
|
14427 | 282 |
"/ in case, someone needs the objectFileLoader early |
283 |
"/ |
|
16675 | 284 |
ObjectFileLoader notNil ifTrue:[ |
18668 | 285 |
ObjectFileLoader initialize. |
16675 | 286 |
]. |
14427 | 287 |
|
288 |
"/ |
|
11057 | 289 |
"/ now, finally, initialize all other classes |
290 |
"/ |
|
291 |
self initializeModules. |
|
292 |
||
293 |
ImageStartTime := Timestamp now. |
|
294 |
||
295 |
self initInterrupts. |
|
296 |
self initUserPreferences. |
|
297 |
||
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
298 |
"/ 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
|
299 |
"/ 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
|
300 |
"/ required for some apps, for example to show the menu correctly (see launcher's help menu) |
16675 | 301 |
ApplicationModel notNil ifTrue:[ |
18668 | 302 |
ApplicationModel flushAllClassResources. |
16675 | 303 |
]. |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
304 |
|
11057 | 305 |
"/ |
306 |
"/ give classes a chance to perform 2nd-level initialization |
|
307 |
"/ now, we are certain, that all other classes have been initialized |
|
308 |
"/ (especially: streams and signals can now be used) |
|
309 |
"/ |
|
310 |
ObjectMemory changed:#initialized. |
|
311 |
||
312 |
"Modified: / 08-01-1997 / 19:58:12 / stefan" |
|
313 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
14427 | 314 |
"Modified: / 24-10-2012 / 18:45:15 / sr" |
11057 | 315 |
! |
316 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
317 |
initGlobalsFromEnvironment |
617 | 318 |
"setup globals from the shell-environment" |
319 |
||
320 |
|envString i langString terrString| |
|
321 |
||
5406 | 322 |
StandAlone isNil ifTrue:[ |
18668 | 323 |
StandAlone := false. |
5406 | 324 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
325 |
HeadlessOperation isNil ifTrue:[ |
18668 | 326 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
327 |
]. |
5406 | 328 |
|
617 | 329 |
" |
330 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 331 |
valid are for example: |
18668 | 332 |
en_en / en |
333 |
en_us |
|
334 |
en_gb |
|
335 |
de_de / de |
|
336 |
de_at (for Austria) |
|
5846 | 337 |
" |
338 |
||
339 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
340 |
LanguageTerritory := #us. |
617 | 341 |
|
5846 | 342 |
|
343 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
18668 | 344 |
language ISO-639 Language code |
345 |
territory ISO-3166 Contry code" |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
346 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
347 |
envString := OperatingSystem getLanguage. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
348 |
envString size > 0 ifTrue:[ |
18668 | 349 |
i := envString indexOf:$@. |
350 |
(i ~~ 0) ifTrue:[ |
|
351 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
352 |
envString := envString copyTo:(i - 1). |
|
353 |
] ifFalse:[ |
|
354 |
LanguageModifier := nil. |
|
355 |
]. |
|
356 |
i := envString indexOf:$.. |
|
357 |
(i ~~ 0) ifTrue:[ |
|
358 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
359 |
envString := envString copyTo:(i - 1). |
|
360 |
] ifFalse:[ |
|
361 |
LanguageCodeset := #'iso8859-1'. |
|
362 |
]. |
|
363 |
i := envString indexOf:$_. |
|
364 |
(i == 0) ifTrue:[ |
|
365 |
langString := envString. |
|
366 |
terrString := envString |
|
367 |
] ifFalse:[ |
|
368 |
langString := envString copyTo:(i - 1). |
|
369 |
terrString := envString copyFrom:(i + 1) |
|
370 |
]. |
|
371 |
langString := langString asLowercase. |
|
372 |
terrString := terrString asLowercase. |
|
373 |
(langString = 'c' or:[terrString = 'c']) ifTrue:[ |
|
374 |
('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR. |
|
375 |
] ifFalse:[ |
|
376 |
Language := langString asSymbol. |
|
377 |
LanguageTerritory := terrString asSymbol |
|
378 |
] |
|
617 | 379 |
]. |
380 |
||
381 |
" |
|
382 |
Smalltalk initGlobalsFromEnvironment |
|
383 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
384 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
385 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
386 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
387 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
388 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
389 |
"initialize interrupts" |
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 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
392 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
393 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
394 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
395 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
396 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
397 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
398 |
|
14805 | 399 |
OperatingSystem isOSXlike ifTrue:[ |
18668 | 400 |
"/ OSX sends SIGABRT for NSExceptions |
401 |
OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException. |
|
402 |
OperatingSystem enableAbortInterrupts. |
|
14805 | 403 |
]. |
404 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
405 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
406 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
407 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
408 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
409 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
410 |
! |
617 | 411 |
|
412 |
initStandardStreams |
|
413 |
"initialize some well-known streams" |
|
414 |
||
415 |
Stdout := NonPositionableExternalStream forStdout. |
|
416 |
Stderr := NonPositionableExternalStream forStderr. |
|
417 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
418 |
PrinterStream notNil ifTrue:[ |
18668 | 419 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
420 |
]. |
617 | 421 |
Transcript := Stderr |
422 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
423 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
424 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
425 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
426 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
427 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 428 |
! |
429 |
||
430 |
initStandardTools |
|
10646 | 431 |
"predefine some tools which we might need later |
617 | 432 |
- if the view-classes exist, |
433 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
434 |
||
435 |
Display notNil ifTrue:[ |
|
18668 | 436 |
InspectorView notNil ifTrue:[ |
437 |
Inspector := InspectorView |
|
438 |
]. |
|
439 |
DebugView notNil ifTrue:[ |
|
440 |
Debugger := DebugView |
|
441 |
]. |
|
442 |
"/ Display initialize |
|
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
443 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
444 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
445 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
446 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
447 |
ObjectMemory |
18668 | 448 |
nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal) |
449 |
asAbsoluteFilename pathName |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
450 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
451 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
452 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
453 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
454 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
455 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
456 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
457 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
458 |
initSystemPath |
617 | 459 |
"setup path where system files are searched for. |
460 |
the default path is set to: |
|
18868 | 461 |
. |
462 |
<directory of exe> (WIN32 only) |
|
463 |
$HOME (if defined) |
|
464 |
$HOME/.smalltalk (if defined & existing) |
|
465 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
466 |
$STX_LIBDIR (if defined & existing) |
|
467 |
$STX_TOPDIR (if defined & existing) |
|
468 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
|
469 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
|
470 |
<standard places> |
|
9021 | 471 |
|
472 |
standard places (unix): |
|
18868 | 473 |
/opt/smalltalk/<release> (if existing) |
474 |
/opt/smalltalk (if existing) |
|
475 |
/usr/local/lib/smalltalk (if existing) |
|
476 |
/usr/lib/smalltalk (if existing) |
|
477 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
478 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
479 |
win32: |
18868 | 480 |
\programs\exept\smalltalk (if existing) |
481 |
\programs\smalltalk (if existing) |
|
482 |
\smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
483 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
484 |
vms: |
18868 | 485 |
$stx:lib (if existing) |
486 |
$stx:root (if existing) |
|
617 | 487 |
|
488 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
489 |
startup file; add expressions such as: |
|
18868 | 490 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
491 |
or: |
|
492 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
493 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
494 |
However, smalltalk.rc itself must be found along the above path. |
617 | 495 |
" |
496 |
||
2928 | 497 |
ChangeFileName := 'changes'. |
498 |
OperatingSystem isVMSlike ifTrue:[ |
|
18868 | 499 |
BitmapDirName := 'bitmaps.dir'. |
500 |
BinaryDirName := 'binary.dir'. |
|
501 |
SourceDirName := 'source.dir'. |
|
502 |
ResourceDirName := 'resources.dir'. |
|
503 |
FileInDirName := 'filein.dir'. |
|
504 |
PackageDirName := 'packages.dir'. |
|
2928 | 505 |
] ifFalse:[ |
18868 | 506 |
BitmapDirName := 'bitmaps'. |
507 |
BinaryDirName := 'binary'. |
|
508 |
SourceDirName := 'source'. |
|
509 |
ResourceDirName := 'resources'. |
|
510 |
FileInDirName := 'fileIn'. |
|
511 |
PackageDirName := 'packages'. |
|
16234 | 512 |
]. |
513 |
||
514 |
SystemPath isEmptyOrNil ifTrue:[ |
|
18868 | 515 |
SystemPath := OperatingSystem defaultSystemPath. |
516 |
self flushPathCaches |
|
16234 | 517 |
]. |
518 |
||
519 |
PackagePath isEmptyOrNil ifTrue:[ |
|
18868 | 520 |
PackagePath := OperatingSystem defaultPackagePath. |
521 |
]. |
|
522 |
self addWorkspaceDirectoryToPackagePath. |
|
617 | 523 |
|
524 |
" |
|
525 |
Smalltalk initSystemPath |
|
526 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
527 |
|
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
528 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
529 |
OperatingSystem defaultPackagePath |
617 | 530 |
" |
5139 | 531 |
|
5145 | 532 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
533 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
534 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
535 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
536 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
537 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
538 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
539 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
540 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
541 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
542 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
543 |
! |
617 | 544 |
|
7526 | 545 |
initializeClass:aClass |
546 |
"sent from VM via #initializeModules" |
|
547 |
||
7527 | 548 |
Error handle:[:ex | |
18668 | 549 |
ObjectMemory printStackBacktrace. |
550 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
551 |
ClassesFailedToInitialize := IdentitySet new. |
|
552 |
]. |
|
553 |
ClassesFailedToInitialize add:aClass. |
|
554 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
555 |
ex suspendedContext fullPrintAll. |
|
556 |
'------------------------------------------------' errorPrintCR. |
|
557 |
((DebuggingStandAlone == true) or:[ Smalltalk commandLineArguments includes:'--debug']) ifTrue:[ |
|
558 |
ex reject |
|
559 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
560 |
] do:[ |
18668 | 561 |
aClass initialize |
13675 | 562 |
]. |
563 |
||
564 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
565 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
566 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
567 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
568 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
569 |
send #initialize to all classes. |
16180 | 570 |
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
|
571 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
572 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
573 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
18668 | 574 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
575 |
ClassesFailedToInitialize := nil. |
|
576 |
self initializeModulesOnce. |
|
577 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
578 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
579 |
] |
|
10122 | 580 |
]. |
581 |
||
582 |
ProjectDefinition initializeAllProjectDefinitions. |
|
583 |
||
584 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 585 |
! |
586 |
||
7563 | 587 |
initializeModulesOnce |
588 |
"perform module specific initialization and |
|
589 |
send #initialize to all classes. |
|
7527 | 590 |
Notice: this is not called when an image is restarted" |
4963 | 591 |
|
617 | 592 |
%{ |
18349 | 593 |
#ifdef __SCHTEAM__ |
594 |
STClass.initializeAllClasses(__c__); |
|
595 |
return __c__._RETURN_self(); |
|
596 |
#else |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
597 |
__init_registered_modules__(3); |
4963 | 598 |
|
1481 | 599 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 600 |
RETURN (self); |
18349 | 601 |
#endif /* not SCHTEAM */ |
5410 | 602 |
%}. |
603 |
^ self primitiveFailed |
|
617 | 604 |
! |
605 |
||
7563 | 606 |
initializeSystem |
16655 | 607 |
"initialize all classes; setup dispatcher processes etc. |
3499 | 608 |
This one is the very first entry into the smalltalk world, |
16655 | 609 |
right after startup, usually immediately followed by Smalltalk>>start. |
610 |
Here, a few specific initializations are done, then the actual initialization is |
|
611 |
done inside an error handler in basicInitializeSystem. |
|
10071 | 612 |
Notice: |
18669 | 613 |
this is called by the VM's main entry. You will not find senders from Smalltalk. |
18385 | 614 |
Also Notice: |
18669 | 615 |
this is NOT called when an image is restarted; |
616 |
in this case the show starts in Smalltalk>>restart." |
|
211 | 617 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
618 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
619 |
|
12861 | 620 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
621 |
|
3499 | 622 |
Initializing := true. |
623 |
AbstractOperatingSystem initializeConcreteClass. |
|
624 |
||
18307
c1d97d109f88
also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents:
18293
diff
changeset
|
625 |
CommandLineArguments isEmptyOrNil ifTrue:[ |
18669 | 626 |
CommandLineArguments := #('stx') asOrderedCollection. |
5400 | 627 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
628 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
629 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 630 |
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
|
631 |
|
18669 | 632 |
SilentLoading := false. |
633 |
VerboseLoading := false. |
|
634 |
VerboseStartup := false. |
|
635 |
Verbose := false. |
|
636 |
self initializeVerboseFlags. |
|
348 | 637 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
638 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
639 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
640 |
StandAlone ifTrue:[ |
18669 | 641 |
InfoPrinting := false. |
642 |
ObjectMemory infoPrinting:false. |
|
643 |
IgnoreAssertions := true. |
|
644 |
||
645 |
idx := CommandLineArguments indexOf:'--debug'. |
|
646 |
idx ~~ 0 ifTrue:[ |
|
647 |
DebuggingStandAlone := true. |
|
648 |
]. |
|
649 |
DebuggingStandAlone ifTrue:[ |
|
650 |
Inspector := MiniInspector. |
|
651 |
Debugger := MiniDebugger. |
|
652 |
IgnoreAssertions := false. |
|
653 |
]. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
654 |
] ifFalse:[ |
18669 | 655 |
"/ |
656 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
657 |
"/ to handle things. |
|
658 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
659 |
"/ |
|
660 |
Inspector := MiniInspector. |
|
661 |
Debugger := MiniDebugger. |
|
662 |
IgnoreAssertions := false. |
|
14432 | 663 |
]. |
664 |
||
11057 | 665 |
Error handle:[:ex | |
18669 | 666 |
StandAlone ifTrue:[ |
667 |
DebuggingStandAlone ifFalse:[ |
|
668 |
'Startup Error - use "--debug" command line argument for more info' errorPrintCR. |
|
669 |
Smalltalk exit:1. |
|
670 |
]. |
|
671 |
'Smalltalk [error]: Error during early initialization:' errorPrintCR. |
|
672 |
thisContext fullPrintAll. |
|
673 |
]. |
|
674 |
ex reject. |
|
11057 | 675 |
] do:[ |
18669 | 676 |
self basicInitializeSystem |
14432 | 677 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
678 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
679 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
680 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
681 |
|
18669 | 682 |
initializeVerboseFlags |
683 |
|idx| |
|
684 |
||
685 |
(idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[ |
|
686 |
SilentLoading := true. |
|
687 |
CommandLineArguments removeIndex:idx |
|
688 |
]. |
|
689 |
(idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[ |
|
690 |
VerboseLoading := true. |
|
691 |
CommandLineArguments removeIndex:idx |
|
692 |
]. |
|
693 |
(idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[ |
|
694 |
VerboseLoading := true. |
|
695 |
VerboseStartup := true. |
|
696 |
CommandLineArguments removeIndex:idx |
|
697 |
]. |
|
698 |
(idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[ |
|
699 |
Verbose := true. |
|
700 |
VerboseLoading := true. |
|
701 |
VerboseStartup := true. |
|
702 |
CommandLineArguments removeIndex:idx |
|
703 |
]. |
|
704 |
! |
|
705 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
706 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
707 |
"this returns true, if the system is properly initialized; |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
708 |
i.e. false during startup. |
15980 | 709 |
Especially, the whole display/viewing stuff and process escheduling |
710 |
is not working correctly until initialized." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
711 |
|
18251
9b7f8e531a16
isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents:
18248
diff
changeset
|
712 |
Initializing isNil ifTrue:[^ false]. "/ if called very early |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
713 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
714 |
! |
1 | 715 |
|
7563 | 716 |
reinitStandardStreams |
717 |
"reinitialize some well-known streams. |
|
718 |
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
|
719 |
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
|
720 |
(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
|
721 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
722 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 723 |
! ! |
724 |
||
16593 | 725 |
!Smalltalk class methodsFor:'Compatibility-GNU'! |
726 |
||
727 |
system:command |
|
728 |
"GNU-Smalltalk compatibility: execute an OS command" |
|
729 |
||
730 |
OperatingSystem executeCommand:command |
|
731 |
||
732 |
" |
|
733 |
Smalltalk system:'ls' |
|
734 |
" |
|
735 |
! ! |
|
736 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
737 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
738 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
739 |
beep |
17343 | 740 |
"output an audible beep or bell" |
741 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
742 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
743 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
744 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
745 |
garbageCollect |
15009 | 746 |
"for Squeak compatibility" |
747 |
||
748 |
ObjectMemory garbageCollect |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
749 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
750 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
751 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
752 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
753 |
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
|
754 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
755 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
756 |
ObjectMemory scavenge. |
15009 | 757 |
^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
758 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
759 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
760 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
761 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
762 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
763 |
|
10844 | 764 |
platformName |
765 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
766 |
||
767 |
^ OperatingSystem platformName asUppercaseFirst |
|
768 |
||
769 |
" |
|
770 |
Smalltalk platformName -> 'Win32' |
|
771 |
" |
|
772 |
! |
|
773 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
774 |
registerExternalObject: anObject |
7563 | 775 |
"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
|
776 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
777 |
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
|
778 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
779 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
780 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
781 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
782 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
783 |
objects isNil ifTrue:[ |
18668 | 784 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
785 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
786 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
787 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
788 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
789 |
1 to: objects size do: [:i | |
18668 | 790 |
obj := objects at: i. |
791 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
|
792 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
|
793 |
firstEmptyIndex := i |
|
794 |
] |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
795 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
796 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
797 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
798 |
firstEmptyIndex = 0 ifTrue: [ |
18668 | 799 |
sz := objects size. |
800 |
newObjects := objects species new: sz + 20. "grow linearly" |
|
801 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
|
802 |
firstEmptyIndex := sz + 1. |
|
803 |
SpecialObjectArray := newObjects. |
|
804 |
objects := newObjects |
|
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
805 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
806 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
807 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
808 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
809 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
810 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
811 |
|
12358 | 812 |
removeClassNamed: aName |
17576 | 813 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
814 |
Also needed by the refactory browser. |
|
815 |
If anything untoward happens, report it in the Transcript." |
|
12358 | 816 |
|
817 |
| oldClass | |
|
818 |
||
819 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
18668 | 820 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
821 |
^ self |
|
12358 | 822 |
]. |
823 |
oldClass removeFromSystem |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
824 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
825 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
826 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
827 |
|
7563 | 828 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
829 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 830 |
|
831 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 832 |
! |
833 |
||
16459 | 834 |
declareConstant:constantName poolName:poolNameArg value:value |
835 |
"visualAge compatible pool variable declaration. |
|
16562 | 836 |
called when a V'age application is filed in |
16459 | 837 |
(or one of its changes is accepted via the change browser)" |
838 |
||
839 |
|ns poolName pool| |
|
840 |
||
841 |
"/ when coming from the change-browser, |
|
842 |
"/ a namespace override may be given... |
|
843 |
ns := Class nameSpaceQuerySignal query. |
|
844 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 845 |
poolName := poolNameArg asSymbol |
16459 | 846 |
] ifFalse:[ |
18668 | 847 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 848 |
]. |
9090 | 849 |
pool := self classNamed:poolName. |
850 |
pool declareConstant:constantName value:value |
|
851 |
! |
|
852 |
||
16459 | 853 |
declarePoolDictionary:poolDictionaryNameArg |
854 |
"visualAge compatible pool declaration. |
|
16562 | 855 |
called when a V'age application is filed in |
16459 | 856 |
(or one of its changes is accepted via the change browser)" |
857 |
||
858 |
|ns poolName| |
|
859 |
||
860 |
poolName := poolDictionaryNameArg asSymbol. |
|
861 |
||
862 |
"/ "/ when coming from the change-browser, |
|
863 |
"/ "/ a namespace override may be given... |
|
864 |
"/ ns := Class nameSpaceQuerySignal query. |
|
865 |
"/ (ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
866 |
"/ poolName := poolDictionaryNameArg asSymbol |
|
867 |
"/ ] ifFalse:[ |
|
868 |
"/ poolName := (ns name,'::',poolDictionaryNameArg) asSymbol |
|
869 |
"/ ]. |
|
870 |
^ SharedPool subclass:(poolName asSymbol) |
|
18668 | 871 |
instanceVariableNames:'' |
872 |
classVariableNames:'' |
|
873 |
poolDictionaries:'' |
|
874 |
category:'* VAST Pools' |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
875 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
876 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
877 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
878 |
|
16459 | 879 |
declareVariable:varName poolName:poolNameArg |
880 |
"visualAge compatible pool declaration. |
|
16562 | 881 |
called when a V'age application is filed in |
16459 | 882 |
(or one of its changes is accepted via the change browser)" |
883 |
||
884 |
|ns poolName pool| |
|
885 |
||
886 |
"/ when coming from the change-browser, |
|
887 |
"/ a namespace override may be given... |
|
888 |
ns := Class nameSpaceQuerySignal query. |
|
889 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 890 |
poolName := poolNameArg asSymbol |
16459 | 891 |
] ifFalse:[ |
18668 | 892 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 893 |
]. |
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
894 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
895 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
896 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
897 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
898 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
899 |
|
7295 | 900 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
901 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
902 |
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
|
903 |
^ self |
18668 | 904 |
defineClass:nameSymbol |
905 |
superclass:superclass |
|
906 |
indexedType:indexed |
|
907 |
private:private |
|
908 |
instanceVariableNames:instVars |
|
909 |
classInstanceVariableNames:classInstVars |
|
910 |
imports:imports |
|
911 |
category:category |
|
912 |
attributes:nil |
|
12033 | 913 |
! |
914 |
||
7563 | 915 |
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
|
916 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
917 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
918 |
indexed == #none ifTrue:[ |
18668 | 919 |
newClass := superclass |
920 |
subclass:nameSymbol |
|
921 |
instanceVariableNames:instVars |
|
922 |
classVariableNames:'' |
|
923 |
poolDictionaries:'' |
|
924 |
category:category |
|
925 |
inEnvironment:self. |
|
926 |
classInstVars size > 0 ifTrue:[ |
|
927 |
newClass class instanceVariableNames:classInstVars. |
|
928 |
]. |
|
929 |
^ newClass |
|
6851 | 930 |
]. |
931 |
self shouldImplement. |
|
12033 | 932 |
! |
933 |
||
934 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
935 |
|newNameSpace| |
|
936 |
||
937 |
private ifTrue:[self halt]. "/ what to do ? |
|
938 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
939 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
940 |
newNameSpace setCategory:category. |
12033 | 941 |
^ newNameSpace |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
942 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
943 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
944 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
945 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
946 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
947 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
948 |
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
|
949 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
950 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
951 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
952 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
953 |
val := self at:aKey ifAbsent:nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
954 |
val isNil ifTrue:[^ nil]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
955 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
956 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
957 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
958 |
! |
3083 | 959 |
|
7563 | 960 |
associationAt:aKey ifAbsent:exceptionBlock |
961 |
"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
|
962 |
from exceptionBlock, if no such key is present. |
14973 | 963 |
Since ST/X's Smalltalk as no real dictionary, this is simulated here. |
964 |
Warning: this is a comatibility interface only, with a different semantic as |
|
18668 | 965 |
the original ST80 implementation. The returned assoc is created on the fly, |
966 |
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
|
967 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
968 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
969 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
970 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
971 |
val isNil ifTrue:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
972 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
973 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
974 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
975 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
976 |
|
7563 | 977 |
at:aKey |
10071 | 978 |
"retrieve the value stored under aKey, a symbol. |
979 |
Return nil if not present |
|
1956 | 980 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 981 |
|
16831 | 982 |
aKey class == Symbol ifFalse:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
983 |
|
453 | 984 |
%{ /* NOCONTEXT */ |
18287 | 985 |
#ifdef __SCHTEAM__ |
986 |
{ |
|
18668 | 987 |
STSymbol keySymbol = aKey.asSTSymbol(); |
988 |
STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol); |
|
989 |
||
990 |
return context._RETURN( val == null ? Nil : val ); |
|
18287 | 991 |
} |
992 |
/* NOT REACHED */ |
|
993 |
#else |
|
453 | 994 |
RETURN ( __GLOBAL_GET(aKey) ); |
18287 | 995 |
#endif |
5406 | 996 |
%}. |
5410 | 997 |
^ self primitiveFailed |
453 | 998 |
! |
999 |
||
7563 | 1000 |
at:aKey ifAbsent:aBlock |
1001 |
"retrieve the value stored at aKey. |
|
7565 | 1002 |
If there is nothing stored under this key, return the value of |
1003 |
the evaluation of aBlock." |
|
453 | 1004 |
|
1005 |
(self includesKey:aKey) ifTrue:[ |
|
18668 | 1006 |
^ self at:aKey |
453 | 1007 |
]. |
1008 |
^ aBlock value |
|
1009 |
||
1010 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1011 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1012 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1013 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1014 |
! |
453 | 1015 |
|
15068 | 1016 |
at:aKey ifAbsentPut:aBlock |
1017 |
"return the element indexed by aKey if present, |
|
1018 |
if not present, store the result of evaluating valueBlock |
|
1019 |
under aKey and return it." |
|
1020 |
||
1021 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
|
1022 |
||
1023 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
1024 |
! |
|
1025 |
||
7563 | 1026 |
at:aKey ifPresent:aBlock |
1027 |
"try to retrieve the value stored at aKey. |
|
1028 |
If there is nothing stored under this key, do nothing. |
|
4870 | 1029 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
1030 |
||
13883 | 1031 |
|val| |
1032 |
||
4870 | 1033 |
(self includesKey:aKey) ifTrue:[ |
18668 | 1034 |
(val := self at:aKey) notNil ifTrue:[ |
1035 |
^ aBlock value:val |
|
1036 |
] |
|
4870 | 1037 |
]. |
1038 |
^ nil |
|
1039 |
||
1040 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1041 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1042 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1043 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1044 |
|
13883 | 1045 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1046 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1047 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1048 |
at:aKey put:aValue |
7563 | 1049 |
"store the argument aValue under aKey, a symbol. |
1050 |
Return aValue (sigh)." |
|
453 | 1051 |
|
1052 |
|oldValue| |
|
1053 |
||
1054 |
%{ |
|
18287 | 1055 |
#ifdef __SCHTEAM__ |
1056 |
{ |
|
18668 | 1057 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1058 |
oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue); |
|
18287 | 1059 |
} |
1060 |
#else |
|
453 | 1061 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
18287 | 1062 |
#endif |
453 | 1063 |
%}. |
1064 |
CachedClasses notNil ifTrue:[ |
|
18668 | 1065 |
oldValue isBehavior ifTrue:[ |
1066 |
oldValue name == aKey ifTrue:[ |
|
1067 |
CachedClasses remove:oldValue ifAbsent:[] |
|
1068 |
] |
|
1069 |
]. |
|
1070 |
aValue isBehavior ifTrue:[ |
|
1071 |
aValue name == aKey ifTrue:[ |
|
1072 |
CachedClasses add:aValue |
|
1073 |
] ifFalse:[ |
|
1074 |
CachedClasses := nil |
|
1075 |
] |
|
1076 |
]. |
|
453 | 1077 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1078 |
^ aValue. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1079 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1080 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1081 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1082 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1083 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1084 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1085 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1086 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1087 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1088 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1089 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1090 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1091 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1092 |
%{ /* NOCONTEXT */ |
18287 | 1093 |
#ifdef __SCHTEAM__ |
1094 |
STSymbol keySymbol = aKey.asSTSymbol(); |
|
18668 | 1095 |
return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False); |
18287 | 1096 |
/* NOT REACHED */ |
1097 |
#else |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1098 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
18287 | 1099 |
#endif |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1100 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1101 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1102 |
! |
453 | 1103 |
|
7563 | 1104 |
keyAtValue:anObject |
1105 |
"return the symbol under which anObject is stored - or nil" |
|
453 | 1106 |
|
1107 |
self keysDo:[:aKey | |
|
18668 | 1108 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1109 |
]. |
1110 |
^ nil |
|
1111 |
||
1112 |
"Smalltalk keyAtValue:Object" |
|
1113 |
! |
|
1114 |
||
7563 | 1115 |
keys |
1116 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1117 |
||
1118 |
|keys| |
|
453 | 1119 |
|
1120 |
keys := IdentitySet new. |
|
1121 |
self keysDo:[:k | keys add:k]. |
|
1122 |
^ keys |
|
617 | 1123 |
! |
1124 |
||
7563 | 1125 |
removeKey:aKey |
1126 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1127 |
WARNING: |
18668 | 1128 |
this is somewhat dangerous: conceptionally, the association is removed, |
1129 |
to which machine & byte compiled code refers if it accesses a global. |
|
1130 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
1131 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
1132 |
value. (which is correct) |
|
1133 |
However, if that global is later reintroduced, a new association will be created and |
|
1134 |
the new global now referenced via the new association. |
|
1135 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
1136 |
(this is questionable). |
|
1137 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 1138 |
|
1139 |
CachedClasses := nil. |
|
1140 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1141 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1142 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1143 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1144 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1145 |
|
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 |
|
10538 | 1148 |
startBlocks |
1149 |
^ StartBlocks |
|
1150 |
! |
|
1151 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1152 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1153 |
"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
|
1154 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1155 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1156 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1157 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1158 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1159 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1160 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1161 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1162 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1163 |
|
13540 | 1164 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1165 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1166 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1167 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1168 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1169 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1170 |
"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
|
1171 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1172 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1173 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1174 |
" |
10071 | 1175 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1176 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1177 |
! |
617 | 1178 |
|
7563 | 1179 |
browseAllSelect:aBlock |
1180 |
"{ Pragma: +optSpace }" |
|
1181 |
||
1182 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1183 |
|
6020 | 1184 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 1185 |
|
1186 |
" |
|
1187 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1188 |
" |
|
1189 |
! |
|
1190 |
||
7563 | 1191 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1192 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1193 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1194 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1195 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1196 |
ChangesBrowser notNil ifTrue:[ |
18668 | 1197 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1198 |
] ifFalse:[ |
18668 | 1199 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1200 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1201 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1202 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1203 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1204 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1205 |
! |
453 | 1206 |
|
7563 | 1207 |
browseClass:aClass |
1208 |
"{ Pragma: +optSpace }" |
|
1209 |
||
11375 | 1210 |
"startup a browser on aClass. |
11150 | 1211 |
The broser will only show that class (i.e. be a singleClass-browser). |
1212 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1213 |
|
1214 |
UserPreferences systemBrowserClass browseClass:aClass |
|
1215 |
||
1216 |
" |
|
10071 | 1217 |
Smalltalk browseClass:Array |
6970 | 1218 |
" |
1219 |
! |
|
1220 |
||
7563 | 1221 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1222 |
"{ Pragma: +optSpace }" |
|
6819 | 1223 |
|
1224 |
"startup a browser for all methods implementing a message matching" |
|
1225 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1226 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1227 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1228 |
" |
10071 | 1229 |
Smalltalk browseImplementorsOf:#'at:put:' |
1230 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1231 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1232 |
! |
6819 | 1233 |
|
7563 | 1234 |
browseImplementorsOf:aSelectorSymbol |
1235 |
"{ Pragma: +optSpace }" |
|
1236 |
||
1237 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1238 |
|
6020 | 1239 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 1240 |
|
1241 |
" |
|
10071 | 1242 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1243 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1244 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1245 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1246 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1247 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1248 |
|
11150 | 1249 |
"startup a full browser showing aClass. |
1250 |
The browser will be a full browser with aClass initially selekted. |
|
1251 |
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
|
1252 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1253 |
UserPreferences systemBrowserClass openInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1254 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1255 |
" |
10071 | 1256 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1257 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1258 |
! |
6970 | 1259 |
|
7563 | 1260 |
browseInClass:aClass selector:selector |
1261 |
"{ Pragma: +optSpace }" |
|
1262 |
||
11150 | 1263 |
"startup a full browser showing aClass>>selector. |
1264 |
The browser will be a full browser with aClass initially selekted. |
|
1265 |
See browseClass: for a singleClass browser, which shows only a single class." |
|
6970 | 1266 |
|
1267 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
1268 |
||
1269 |
" |
|
1270 |
Smalltalk browseInClass:Array selector:#at: |
|
1271 |
" |
|
453 | 1272 |
! ! |
1273 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1274 |
!Smalltalk class methodsFor:'class management'! |
453 | 1275 |
|
18732 | 1276 |
basicRemoveClass:aClass |
1277 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1278 |
we have to flush the caches since these methods are now void. |
|
1279 |
Also, class variables of aClass are removed." |
|
1280 |
||
1281 |
|sym cSym names oldName oldNameSym actualName wrongName| |
|
1282 |
||
1283 |
aClass isNil ifTrue:[^ self]. |
|
1284 |
||
1285 |
oldName := aClass name. |
|
1286 |
sym := oldNameSym := oldName asSymbol. |
|
1287 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
1288 |
"check other name ..." |
|
1289 |
(self includes:aClass) ifFalse:[ |
|
1290 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1291 |
^ self |
|
1292 |
]. |
|
1293 |
" |
|
1294 |
the class has changed its name - without telling me ... |
|
1295 |
what should be done in this case ? |
|
1296 |
" |
|
1297 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1298 |
' has changed its name' errorPrintCR. |
|
1299 |
||
1300 |
"/ |
|
1301 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1302 |
"/ |
|
1303 |
actualName := self keyAtValue:aClass. |
|
1304 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1305 |
sym := actualName asSymbol. |
|
1306 |
oldName := actualName asString. |
|
1307 |
wrongName := true. |
|
1308 |
]. |
|
1309 |
||
1310 |
self at:sym put:nil. "nil it out for compiled accesses" |
|
1311 |
||
1312 |
"/ |
|
1313 |
"/ see comment in removeKey: on why we dont remove it here |
|
1314 |
"/ |
|
1315 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
|
1316 |
"/ still compiled code references." |
|
1317 |
||
1318 |
"remove private classes" |
|
1319 |
||
1320 |
aClass privateClassesSorted do:[:somePrivateClass | |
|
1321 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
|
1322 |
]. |
|
1323 |
||
1324 |
"remove class variables" |
|
1325 |
||
1326 |
names := aClass classVariableString asCollectionOfWords. |
|
1327 |
names do:[:name | |
|
1328 |
cSym := aClass globalKeyForClassVar:name. |
|
1329 |
self at:cSym asSymbol put:nil. |
|
1330 |
||
1331 |
"/ |
|
1332 |
"/ see comment in removeKey: on why we dont remove it here |
|
1333 |
"/ |
|
1334 |
"/ self removeKey:cSym |
|
1335 |
]. |
|
1336 |
||
1337 |
||
1338 |
"/ actually could get along with less flushing |
|
1339 |
"/ (entries for aClass and subclasses only) |
|
1340 |
"/ but we have to delay this, until we have the set of subclasses |
|
1341 |
"/ at hand - for now, searching for all subclasses is way more |
|
1342 |
"/ expensive then cache flushing. |
|
1343 |
"/ |
|
1344 |
"/ aClass allSubclassesDo:[:aSubclass | |
|
1345 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
|
1346 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
|
1347 |
"/ ]. |
|
1348 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
|
1349 |
"/ ObjectMemory flushMethodCacheFor:aClass |
|
1350 |
||
1351 |
ObjectMemory flushInlineCaches. |
|
1352 |
ObjectMemory flushMethodCache. |
|
1353 |
||
1354 |
aClass addChangeRecordForClassRemove. |
|
1355 |
self changed:#classRemove with:aClass. |
|
1356 |
||
1357 |
aClass setCategory:#'* removed *'. |
|
1358 |
||
1359 |
"/ self flushCachedClasses. |
|
1360 |
"/ Class flushSubclassInfo. |
|
1361 |
self flushCachedClass:aClass. |
|
1362 |
Class flushSubclassInfoFor:aClass superclass. |
|
1363 |
Class flushSubclassInfoFor:aClass. |
|
1364 |
||
1365 |
wrongName == true ifTrue:[ |
|
1366 |
"/ |
|
1367 |
"/ an alias (i.e. removing a compatibility name) |
|
1368 |
"/ |
|
1369 |
"/ check if there are more refs to it ... |
|
1370 |
[self includes:aClass] whileTrue:[ |
|
1371 |
actualName := self keyAtValue:aClass. |
|
1372 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1373 |
, ' - remove that binding too.') infoPrintCR. |
|
1374 |
self at:actualName put:nil. |
|
1375 |
]. |
|
1376 |
]. |
|
1377 |
||
1378 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
1379 |
! |
|
1380 |
||
7563 | 1381 |
changeCategoryOf:aClass to:newCategory |
1382 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1383 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1384 |
|
8405 | 1385 |
|ns oldCategory| |
1386 |
||
1387 |
oldCategory := aClass category. |
|
1388 |
oldCategory ~= newCategory ifTrue:[ |
|
18668 | 1389 |
aClass category:(newCategory withoutSeparators asSymbol). |
1390 |
||
1391 |
"notify change of category" |
|
1392 |
ns := aClass environment ? self. |
|
1393 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1394 |
ns ~~ self ifTrue:[ |
|
1395 |
self changed:#organization with:(aClass -> oldCategory). |
|
1396 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1397 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1398 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1399 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1400 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1401 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1402 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1403 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1404 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1405 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1406 |
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
|
1407 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1408 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1409 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1410 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1411 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1412 |
CachedClasses notNil ifTrue:[ |
18668 | 1413 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1414 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1415 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1416 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1417 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1418 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1419 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1420 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1421 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1422 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1423 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1424 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1425 |
removeClass:aClass |
7563 | 1426 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1427 |
we have to flush the caches since these methods are now void. |
18732 | 1428 |
Also, class variables of aClass are removed. |
1429 |
Recompile accessors to aClass." |
|
1430 |
||
1431 |
|oldNameSym ns ons| |
|
1432 |
||
1433 |
oldNameSym := aClass name asSymbol. |
|
4781 | 1434 |
ns := aClass nameSpace. |
1435 |
aClass topOwningClass notNil ifTrue:[ |
|
18732 | 1436 |
ons := aClass topOwningClass nameSpace |
1437 |
]. |
|
1438 |
||
1439 |
self basicRemoveClass:aClass. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1440 |
|
4781 | 1441 |
ns ~~ Smalltalk ifTrue:[ |
18732 | 1442 |
ons notNil ifTrue:[ |
1443 |
ClassBuilder |
|
1444 |
recompileGlobalAccessorsTo:oldNameSym |
|
1445 |
in:ons |
|
1446 |
except:nil |
|
1447 |
]. |
|
1448 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1449 |
ClassBuilder |
|
1450 |
recompileGlobalAccessorsTo:oldNameSym |
|
1451 |
in:ns |
|
1452 |
except:nil |
|
1453 |
]. |
|
1454 |
]. |
|
1455 |
! |
|
1456 |
||
1457 |
removeClasses:aCollectionOfClasses |
|
1458 |
"remove aCollectionOfClasses from the smalltalk dictionary; |
|
1459 |
we have to flush the caches since these methods are now void. |
|
1460 |
Also, class variables of aClass are removed. |
|
1461 |
Recompile accessors to the classes - after all classes in the collection have been removed." |
|
1462 |
||
1463 |
|tuples| |
|
1464 |
||
1465 |
tuples := aCollectionOfClasses collect:[:eachClass| |
|
1466 |
Array |
|
1467 |
with:eachClass name asSymbol |
|
1468 |
with:eachClass nameSpace |
|
1469 |
with:( |
|
1470 |
eachClass topOwningClass notNil ifTrue:[ |
|
1471 |
eachClass topOwningClass nameSpace |
|
1472 |
] ifFalse:[nil]) |
|
1473 |
]. |
|
1474 |
||
1475 |
aCollectionOfClasses do:[:eachClass| |
|
1476 |
self basicRemoveClass:eachClass. |
|
1477 |
]. |
|
1478 |
||
1479 |
tuples do:[:eachClssymNsOnsTuple| |
|
1480 |
|oldNameSym ns ons| |
|
1481 |
||
1482 |
oldNameSym := eachClssymNsOnsTuple at:1. |
|
1483 |
ns := eachClssymNsOnsTuple at:2. |
|
1484 |
ons := eachClssymNsOnsTuple at:3. |
|
1485 |
||
1486 |
ns ~~ Smalltalk ifTrue:[ |
|
1487 |
ons notNil ifTrue:[ |
|
1488 |
ClassBuilder |
|
1489 |
recompileGlobalAccessorsTo:oldNameSym |
|
1490 |
in:ons |
|
1491 |
except:nil |
|
1492 |
]. |
|
1493 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1494 |
ClassBuilder |
|
1495 |
recompileGlobalAccessorsTo:oldNameSym |
|
1496 |
in:ns |
|
1497 |
except:nil |
|
1498 |
]. |
|
1499 |
] |
|
1500 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1501 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1502 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1503 |
renameClass:aClass to:newName |
7563 | 1504 |
"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
|
1505 |
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
|
1506 |
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
|
1507 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1508 |
|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
|
1509 |
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
|
1510 |
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
|
1511 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1512 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1513 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1514 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1515 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1516 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1517 |
[i2 ~~ 0] whileTrue:[ |
18668 | 1518 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1519 |
i2 ~~ 0 ifTrue:[ |
|
1520 |
nm := newName copyFrom:i1 to:i2-1. |
|
1521 |
ns isNameSpace ifTrue:[ |
|
1522 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1523 |
subns isNil ifTrue:[ |
|
1524 |
self error:'Nonexisting namespace: ',nm. |
|
1525 |
^ nil. |
|
1526 |
]. |
|
1527 |
] ifFalse:[ |
|
1528 |
subns := ns privateClassesAt:nm asSymbol. |
|
1529 |
subns isNil ifTrue:[ |
|
1530 |
self error:'Cannot create a namespace below a class' |
|
1531 |
] |
|
1532 |
]. |
|
1533 |
ns := subns. |
|
1534 |
i1 := i2 + 2. |
|
1535 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1536 |
]. |
617 | 1537 |
|
1538 |
oldName := aClass name. |
|
6734 | 1539 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1540 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1541 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1542 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1543 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1544 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1545 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
18668 | 1546 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1547 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1548 |
]. |
617 | 1549 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1550 |
"/ rename the class |
617 | 1551 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1552 |
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
|
1553 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1554 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1555 |
ns isNameSpace ifFalse:[ |
18668 | 1556 |
aClass isPrivate ifTrue:[ |
1557 |
aClass class setOwningClass:ns. |
|
1558 |
] ifFalse:[ |
|
1559 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1560 |
oldMetaclass := aClass class. |
|
1561 |
newMetaclass := PrivateMetaclass new. |
|
1562 |
newMetaclass flags:(oldMetaclass flags). |
|
1563 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1564 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1565 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1566 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1567 |
newMetaclass setSoleInstance:aClass. |
|
1568 |
newMetaclass setOwningClass:ns. |
|
1569 |
||
1570 |
aClass changeClassTo:newMetaclass. |
|
1571 |
ObjectMemory flushCaches. |
|
1572 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1573 |
] ifTrue:[ |
18668 | 1574 |
aClass isPrivate ifTrue:[ |
1575 |
newCategory := aClass topOwningClass category. |
|
1576 |
||
1577 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1578 |
oldMetaclass := aClass class. |
|
1579 |
||
1580 |
newMetaclass := Metaclass new. |
|
1581 |
newMetaclass flags:(oldMetaclass flags). |
|
1582 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1583 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1584 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1585 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1586 |
newMetaclass setSoleInstance:aClass. |
|
1587 |
||
1588 |
aClass category:newCategory. |
|
1589 |
aClass changeClassTo:newMetaclass. |
|
1590 |
ObjectMemory flushCaches. |
|
1591 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1592 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1593 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1594 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1595 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1596 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1597 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1598 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1599 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1600 |
"/ see comment in #removeKey: on why we dont remove it it here |
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1601 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1602 |
"/ self removeKey:oldSym. |
617 | 1603 |
self at:newSym put:aClass. |
1604 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1605 |
"/ 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
|
1606 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1607 |
oldNameToNewName := IdentityDictionary new. |
617 | 1608 |
|
1609 |
names := aClass classVariableString asCollectionOfWords. |
|
1610 |
names do:[:name | |
|
18668 | 1611 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1612 |
value := self at:oldCVSym. |
|
1613 |
self at:oldCVSym put:nil. |
|
1614 |
||
1615 |
"/ |
|
1616 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1617 |
"/ |
|
1618 |
"/ self removeKey:cSym. |
|
1619 |
||
1620 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1621 |
self at:newCVSym put:value. |
|
1622 |
||
1623 |
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
|
1624 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1625 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1626 |
"/ 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
|
1627 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1628 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
18668 | 1629 |
aClass withAllSubclasses do:[:aSubClass | |
1630 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1631 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1632 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1633 |
]. |
|
1634 |
]. |
|
1635 |
||
1636 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1637 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1638 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1639 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1640 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1641 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1642 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1643 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1644 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1645 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1646 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1647 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1648 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1649 |
"/ ] |
617 | 1650 |
]. |
1651 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1652 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1653 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1654 |
"/ 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
|
1655 |
aClass setEnvironment:nil. |
6734 | 1656 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1657 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1658 |
privateClasses size > 0 ifTrue:[ |
18668 | 1659 |
"/ must rename privateClasses as well |
1660 |
Class withoutUpdatingChangesDo:[ |
|
1661 |
privateClasses do:[:aPrivateClass | |
|
1662 |
self renameClass:aPrivateClass |
|
1663 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1664 |
||
1665 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1666 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1667 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1668 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1669 |
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
|
1670 |
"/ ClassBuilder |
10071 | 1671 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1672 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1673 |
"/ except:nil. |
18668 | 1674 |
] |
1675 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1676 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1677 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1678 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1679 |
|
18668 | 1680 |
"/ all those referencing the class from the old nameSpace |
1681 |
"/ must be recompiled ... |
|
1682 |
"/ (to now access the global from smalltalk) |
|
1683 |
||
1684 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1685 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1686 |
||
1687 |
ClassBuilder |
|
1688 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1689 |
in:oldNameSpace |
|
1690 |
except:nil. |
|
1691 |
]. |
|
1692 |
||
1693 |
"/ all referencing the class in the new namespace |
|
1694 |
"/ as well; to now access the new class. |
|
1695 |
||
1696 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1697 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1698 |
||
1699 |
ClassBuilder |
|
1700 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1701 |
in:newNameSpace |
|
1702 |
except:nil. |
|
1703 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1704 |
] ifFalse:[ |
18668 | 1705 |
"/ all references to a global with my new name in my owning class |
1706 |
"/ must now be redirected to myself. |
|
1707 |
||
1708 |
aClass isPrivate ifTrue:[ |
|
1709 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1710 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1711 |
||
1712 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1713 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1714 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1715 |
||
1716 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1717 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1718 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1719 |
||
1720 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1721 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1722 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1723 |
||
1724 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1725 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1726 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1727 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1728 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1729 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1730 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1731 |
"/ 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
|
1732 |
aClass allSubclassesDo:[:subClass | |
18668 | 1733 |
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
|
1734 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1735 |
"/ 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
|
1736 |
aClass subclassesDo:[:subClass | |
18668 | 1737 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1738 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1739 |
self changed:#definition. |
14611 | 1740 |
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
|
1741 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1742 |
"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
|
1743 |
"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
|
1744 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1745 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1746 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1747 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1748 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1749 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1750 |
"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
|
1751 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1752 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1753 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1754 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1755 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1756 |
|
10952 | 1757 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1758 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1759 |
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
|
1760 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1761 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1762 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1763 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1764 |
! |
453 | 1765 |
|
7563 | 1766 |
shallowCopy |
1767 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1768 |
|
1769 |
^ self |
|
1410 | 1770 |
|
1771 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1772 |
! |
1773 |
||
7563 | 1774 |
simpleDeepCopy |
1775 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1776 |
|
1777 |
^ self |
|
1410 | 1778 |
|
1779 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1780 |
! ! |
1781 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1782 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1783 |
|
7563 | 1784 |
compileTrace:aBoolean |
1785 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1786 |
%{ |
1787 |
extern char __compileTrace__; |
|
1788 |
||
1789 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1790 |
%} |
|
1791 |
" |
|
1792 |
Smalltalk compileTrace:true |
|
1793 |
Smalltalk compileTrace:false |
|
1794 |
" |
|
1795 |
! |
|
1796 |
||
7563 | 1797 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1798 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1799 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1800 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1801 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1802 |
WARNING: this method is for debugging only |
18668 | 1803 |
it will be removed without notice." |
453 | 1804 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1805 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1806 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1807 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1808 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1809 |
! |
453 | 1810 |
|
7563 | 1811 |
exitWithCoreDump |
1812 |
"{ Pragma: +optSpace }" |
|
1813 |
||
1814 |
"abort program and dump core" |
|
1815 |
||
1816 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1817 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1818 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1819 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1820 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1821 |
" |
617 | 1822 |
! |
1823 |
||
7563 | 1824 |
fatalAbort |
1825 |
"{ Pragma: +optSpace }" |
|
1826 |
||
1827 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1828 |
(You may turn off the stack print with debugPrinting:false)" |
18287 | 1829 |
|
1830 |
self fatalAbort:'fatalAbort' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1831 |
! |
617 | 1832 |
|
7563 | 1833 |
fatalAbort:aMessage |
1834 |
"{ Pragma: +optSpace }" |
|
1835 |
||
1836 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1837 |
(You may turn off the stack print with debugPrinting:false)" |
1838 |
||
1839 |
%{ |
|
18287 | 1840 |
#ifdef __SCHTEAM__ |
1841 |
STMain.fatalAbort( aMessage ); |
|
1842 |
/* NOT REACHED */ |
|
1843 |
#else |
|
617 | 1844 |
char *msg; |
1845 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1846 |
if (__isStringLike(aMessage)) |
18668 | 1847 |
msg = (char *) __stringVal(aMessage); |
617 | 1848 |
else |
18668 | 1849 |
msg = "fatalAbort"; |
617 | 1850 |
|
1851 |
__fatal0(__context, msg); |
|
1852 |
/* NEVER RETURNS */ |
|
18287 | 1853 |
#endif |
5410 | 1854 |
%}. |
1855 |
^ self primitiveFailed |
|
5441 | 1856 |
! |
1857 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1858 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1859 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1860 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1861 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1862 |
IgnoreHalt isNil ifTrue:[ |
18668 | 1863 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1864 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1865 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1866 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1867 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1868 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1869 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1870 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1871 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1872 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1873 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1874 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1875 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1876 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1877 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1878 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1879 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1880 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1881 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1882 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1883 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1884 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1885 |
|
18329 | 1886 |
verbose |
1887 |
^ Verbose |
|
1888 |
! |
|
1889 |
||
1890 |
verbose:aBoolean |
|
1891 |
Verbose := aBoolean |
|
1892 |
! |
|
1893 |
||
7563 | 1894 |
vmInstructionTrace:aBoolean |
13947 | 1895 |
self halt:'not yet implemented' |
1896 |
||
1897 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 1898 |
! ! |
1899 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1900 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 1901 |
|
453 | 1902 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1903 |
"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
|
1904 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1905 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1906 |
|
1907 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1908 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1909 |
" |
7563 | 1910 |
! |
1911 |
||
1912 |
allClassCategories |
|
1913 |
"return a set of all class categories in the system" |
|
1914 |
||
1915 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1916 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1917 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1918 |
Smalltalk allClassesDo:[:cls | |
18668 | 1919 |
|category| |
1920 |
||
1921 |
category := cls category. |
|
1922 |
category notNil ifTrue:[ |
|
1923 |
allCategories add:category. |
|
1924 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1925 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1926 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1927 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1928 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1929 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1930 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1931 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1932 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1933 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1934 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1935 |
|
7563 | 1936 |
allClassesAndMetaclassesDo:aBlock |
1937 |
"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
|
1938 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1939 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1940 |
|
12861 | 1941 |
already := IdentitySet new:NumberOfClassesHint*2. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1942 |
self allClassesDo:[:eachClass | |
18668 | 1943 |
|cls| |
1944 |
||
1945 |
cls := eachClass theNonMetaclass. |
|
1946 |
(already includes:cls) ifFalse:[ |
|
1947 |
aBlock value:cls. |
|
1948 |
already add:cls. |
|
1949 |
]. |
|
1950 |
cls := cls class. |
|
1951 |
(already includes:cls) ifFalse:[ |
|
1952 |
aBlock value:cls. |
|
1953 |
already add:cls. |
|
1954 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1955 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1956 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1957 |
|
7563 | 1958 |
allClassesDo:aBlock |
1959 |
"evaluate the argument, aBlock for all classes in the system." |
|
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1960 |
|
5765 | 1961 |
self allClasses do:aBlock |
453 | 1962 |
|
1963 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1964 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1965 |
" |
1966 |
! |
|
1967 |
||
9506 | 1968 |
allClassesForWhich:filter |
10071 | 1969 |
"return a collection with all classes in the system, |
9506 | 1970 |
for which filter evaluates to true." |
1971 |
||
1972 |
|collectedClasses| |
|
1973 |
||
1974 |
collectedClasses := OrderedCollection new. |
|
1975 |
self allClassesForWhich:filter do:[:cls | |
|
18668 | 1976 |
collectedClasses add:cls |
9506 | 1977 |
]. |
1978 |
^ collectedClasses |
|
1979 |
||
1980 |
" |
|
10071 | 1981 |
Smalltalk |
18668 | 1982 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 1983 |
" |
1984 |
||
1985 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
1986 |
! |
|
1987 |
||
9292 | 1988 |
allClassesForWhich:filter do:aBlock |
1989 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true." |
|
1990 |
||
1991 |
self allClassesDo:[:cls | |
|
18668 | 1992 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 1993 |
]. |
1994 |
||
1995 |
" |
|
1996 |
Smalltalk |
|
18668 | 1997 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
1998 |
do:[:aClass | Transcript showCR:aClass name] |
|
9292 | 1999 |
" |
2000 |
! |
|
2001 |
||
7563 | 2002 |
allClassesInCategory:aCategory |
2003 |
"return a collection of for all classes in aCategory; |
|
1299 | 2004 |
The order of the classes is not defined." |
2005 |
||
9506 | 2006 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2007 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2008 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2009 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2010 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2011 |
|
9506 | 2012 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2013 |
! |
1299 | 2014 |
|
7563 | 2015 |
allClassesInCategory:aCategory do:aBlock |
2016 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 2017 |
The order of the classes is not defined." |
2018 |
||
2019 |
aCategory notNil ifTrue:[ |
|
18668 | 2020 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 2021 |
] |
2022 |
||
2023 |
" |
|
9490 | 2024 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
2025 |
" |
|
2026 |
||
2027 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2028 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2029 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2030 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 2031 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 2032 |
superclasses come first - then subclasses" |
2033 |
||
2034 |
|classes| |
|
2035 |
||
2036 |
aCategory notNil ifTrue:[ |
|
18668 | 2037 |
classes := OrderedCollection new. |
2038 |
self allClassesInCategory:aCategory do:[:aClass | |
|
2039 |
classes add:aClass |
|
2040 |
]. |
|
2041 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
2042 |
classes do:aBlock |
|
453 | 2043 |
] |
2044 |
||
2045 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2046 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 2047 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2048 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2049 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2050 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2051 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2052 |
allClassesInOrderDo:aBlock |
7563 | 2053 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 2054 |
Evaluation order is by inheritance: superclasses come first." |
2055 |
||
2056 |
|already| |
|
2057 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2058 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2059 |
self allClassesDo:[:eachClass | |
18668 | 2060 |
(already includes:eachClass) ifFalse:[ |
2061 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
2062 |
(already includes:eachSuperClass) ifFalse:[ |
|
2063 |
already add:eachSuperClass. |
|
2064 |
aBlock value:eachSuperClass. |
|
2065 |
]. |
|
2066 |
]. |
|
2067 |
already add:eachClass. |
|
2068 |
aBlock value:eachClass. |
|
2069 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2070 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2071 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2072 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2073 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 2074 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2075 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2076 |
|
9506 | 2077 |
allClassesInPackage:aPackageID |
2078 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 2079 |
The order of the classes is not defined. |
2080 |
The returned collection may include private classes" |
|
9506 | 2081 |
|
2082 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
2083 |
||
2084 |
" |
|
10071 | 2085 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 2086 |
" |
2087 |
||
2088 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 2089 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 2090 |
! |
2091 |
||
9490 | 2092 |
allClassesInPackage:aPackageID do:aBlock |
2093 |
"evaluate the argument, aBlock for all classes a package; |
|
2094 |
The order of the classes is not defined." |
|
2095 |
||
2096 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
2097 |
||
2098 |
" |
|
10071 | 2099 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 2100 |
" |
2101 |
||
2102 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
2103 |
! |
|
2104 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2105 |
allKeysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2106 |
"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
|
2107 |
|
17385 | 2108 |
self keysDo:aBlock |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2109 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2110 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2111 |
allMethodCategories |
12298 | 2112 |
"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
|
2113 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2114 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2115 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2116 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2117 |
Smalltalk allClassesDo:[:cls | |
18668 | 2118 |
allCategories addAll:cls categories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2119 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2120 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2121 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2122 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2123 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2124 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2125 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2126 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
2127 |
|
9259 | 2128 |
allMethodsDo:aBlock |
12298 | 2129 |
"enumerate all methods in all classes" |
12000 | 2130 |
|
9259 | 2131 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2132 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2133 |
aBlock value:mthd |
|
2134 |
] |
|
12298 | 2135 |
]. |
2136 |
! |
|
2137 |
||
14933 | 2138 |
allMethodsForWhich:aBlock |
2139 |
"return a collection of methods for which aBlock returns true" |
|
2140 |
||
2141 |
|coll| |
|
2142 |
||
2143 |
coll := OrderedCollection new. |
|
2144 |
Smalltalk allClassesDo:[:eachClass | |
|
18668 | 2145 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2146 |
(aBlock value:mthd) ifTrue:[ |
|
2147 |
coll add:mthd |
|
2148 |
]. |
|
2149 |
] |
|
14933 | 2150 |
]. |
2151 |
^ coll |
|
2152 |
! |
|
2153 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2154 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2155 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2156 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2157 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2158 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2159 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2160 |
aTwoArgBlock value:mthd value:sel |
|
2161 |
] |
|
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2162 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2163 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2164 |
|
7563 | 2165 |
associationsDo:aBlock |
10071 | 2166 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 2167 |
in the Smalltalk dictionary" |
2168 |
||
2169 |
self keysDo:[:aKey | |
|
18668 | 2170 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2171 |
] |
2172 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2173 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2174 |
! |
2175 |
||
7563 | 2176 |
basicKeys |
2177 |
"for rel > 5 only" |
|
2178 |
||
18349 | 2179 |
%{ |
2180 |
#ifdef __SCHTEAM__ |
|
18668 | 2181 |
STObject[] keys = STSmalltalkEnvironment.GetKeyVector(); |
18349 | 2182 |
return __c__._RETURN( new STVector(keys) ); |
2183 |
#endif |
|
2184 |
%}. |
|
7563 | 2185 |
self primitiveFailed |
2186 |
! |
|
2187 |
||
2188 |
do:aBlock |
|
2189 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2190 |
|
2191 |
|work| |
|
2192 |
||
2193 |
%{ /* 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
|
2194 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2195 |
RETURN (self); |
2196 |
%}. |
|
2197 |
self keysDo:[:aKey | |
|
18668 | 2198 |
aBlock value:(self at:aKey) |
5406 | 2199 |
] |
617 | 2200 |
! |
2201 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2202 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2203 |
"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
|
2204 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2205 |
self keysDo:[:aKey | |
18668 | 2206 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2207 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2208 |
! |
617 | 2209 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2210 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2211 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2212 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2213 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2214 |
self keysAndValuesDo:[:eachKey :eachValue | |
18668 | 2215 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
2216 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
2217 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2218 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2219 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2220 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2221 |
" |
10071 | 2222 |
Smalltalk |
18668 | 2223 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
2224 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2225 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2226 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2227 |
|
7563 | 2228 |
keysDo:aBlock |
2229 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2230 |
|work| |
2231 |
||
2232 |
%{ /* 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
|
2233 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2234 |
RETURN (self); |
2235 |
%}. |
|
2236 |
self basicKeys do:[:aKey | |
|
18668 | 2237 |
aBlock value:aKey |
5406 | 2238 |
] |
453 | 2239 |
! ! |
2240 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2241 |
!Smalltalk class methodsFor:'message control'! |
453 | 2242 |
|
7563 | 2243 |
silentLoading |
12408 | 2244 |
"returns the Silentloading class variable, which globally controls if compilation |
2245 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2246 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2247 |
^ SilentLoading ? false |
7563 | 2248 |
! |
2249 |
||
2250 |
silentLoading:aBoolean |
|
2251 |
"{ Pragma: +optSpace }" |
|
2252 |
||
2253 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2254 |
messages (especially during fileIn) onto the transcript. |
453 | 2255 |
You can save a snapshot with this flag set to true, which makes |
2256 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2257 |
||
2258 |
|prev| |
|
2259 |
||
2260 |
prev := SilentLoading. |
|
2261 |
SilentLoading := aBoolean. |
|
2262 |
^ prev |
|
12409 | 2263 |
! |
2264 |
||
2265 |
silentlyLoadingDo:aBlock |
|
2266 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2267 |
are shown on the transcript" |
|
2268 |
||
2269 |
|sav| |
|
2270 |
||
2271 |
sav := SilentLoading. |
|
2272 |
SilentLoading := true. |
|
2273 |
aBlock ensure:[ SilentLoading := sav ]. |
|
453 | 2274 |
! ! |
2275 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2276 |
!Smalltalk class methodsFor:'misc accessing'! |
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 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2279 |
"set/clear the headlessOperation flag." |
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 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2282 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2283 |
|
10231 | 2284 |
beSTScript:aBoolean |
2285 |
"set/clear the isSTScript flag." |
|
2286 |
||
2287 |
IsSTScript := aBoolean |
|
2288 |
||
2289 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2290 |
! |
|
2291 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2292 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2293 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2294 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2295 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2296 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2297 |
|
18197 | 2298 |
|
12250 | 2299 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2300 |
||
17324 | 2301 |
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2302 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
2303 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
|
2304 |
Answer true, if the load succeeded, false if it failed" |
|
2305 |
||
2306 |
|packageDirOrNil "shLibName" |
|
2307 |
binaryClassLibraryFilename projectDefinitionFilename projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
|
2308 |
loadOK "exePath" errorInInitialize| |
|
2309 |
||
2310 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
18668 | 2311 |
packageDirOrNil := packageDirOrStringOrNil asFilename. |
17324 | 2312 |
]. |
2313 |
VerboseLoading ifTrue:[ |
|
18668 | 2314 |
silent := false |
17324 | 2315 |
] ifFalse:[ |
18668 | 2316 |
silent := (SilentLoading or:[ StandAlone ]) or:[ InfoPrinting not ]. |
17324 | 2317 |
]. |
2318 |
||
2319 |
"For now: have to read the project definition first!! |
|
2320 |
The class library may contain subclasses of classes in prerequisite packages - |
|
2321 |
so the prerequisite packages have to be loaded first" |
|
2322 |
"normally there is a project definiton, use that one to pull in the rest" |
|
2323 |
||
2324 |
"maybe, it is already in the image" |
|
2325 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2326 |
(projectDefinitionClass notNil and:[projectDefinitionClass supportedOnPlatform not]) ifTrue:[ |
|
18668 | 2327 |
^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'. |
17324 | 2328 |
]. |
2329 |
||
2330 |
"Is there a shared library (.dll or .so) ?" |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2331 |
binaryClassLibraryFilename := ObjectFileLoader |
18668 | 2332 |
binaryClassFilenameForPackage:aPackageString |
2333 |
inDirectory:packageDirOrNil. |
|
17324 | 2334 |
|
2335 |
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[ |
|
18668 | 2336 |
|loadErrorOccurred| |
2337 |
||
2338 |
loadErrorOccurred := false. |
|
2339 |
ObjectFileLoader objectFileLoadErrorNotification handle:[:ex | |
|
2340 |
loadErrorOccurred := true. |
|
2341 |
ex proceedWith:true. |
|
2342 |
] do:[ |
|
2343 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
|
2344 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2345 |
]. |
|
2346 |
(loadOK and:[loadErrorOccurred not]) ifTrue:[ |
|
2347 |
silent ifFalse:[ |
|
2348 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from binary classLib file: ' , binaryClassLibraryFilename pathName). |
|
2349 |
]. |
|
2350 |
"now, all compiled classes have been loaded. |
|
2351 |
keep classes in the package which are autoloaded as autoloaded." |
|
2352 |
^ true |
|
2353 |
]. |
|
2354 |
||
2355 |
loadErrorOccurred ifTrue:[ |
|
2356 |
self breakPoint:#cg. |
|
2357 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2358 |
projectDefinitionClass notNil ifTrue:[ |
|
2359 |
projectDefinitionClass supportedOnPlatform ifTrue:[ |
|
2360 |
"/ load prerequisites... |
|
2361 |
projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2362 |
self breakPoint:#cg. |
|
2363 |
]. |
|
2364 |
]. |
|
2365 |
]. |
|
17324 | 2366 |
]. |
2367 |
packageDirOrNil isNil ifTrue:[ |
|
18668 | 2368 |
^ PackageNotFoundError raiseRequestWith:aPackageString. |
17324 | 2369 |
]. |
2370 |
||
2371 |
"fallback - go through the project definition" |
|
2372 |
projectDefinitionClass isNil ifTrue:[ |
|
18668 | 2373 |
projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString. |
2374 |
"/ try to load the project definition class |
|
2375 |
projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'. |
|
2376 |
projectDefinitionFilename exists ifFalse:[ |
|
2377 |
projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2378 |
]. |
|
2379 |
projectDefinitionFilename exists ifTrue:[ |
|
2380 |
Class withoutUpdatingChangesDo:[ |
|
2381 |
Smalltalk silentlyLoadingDo:[ |
|
2382 |
Error handle:[:ex | |
|
2383 |
"/ catch error during initialization; |
|
2384 |
ex suspendedContext withAllSendersDo:[:sender | |
|
2385 |
sender selector == #initialize ifTrue:[ |
|
2386 |
sender receiver isBehavior ifTrue:[ |
|
2387 |
sender receiver name = projectDefinitionClassName ifTrue:[ |
|
2388 |
errorInInitialize := true |
|
2389 |
] |
|
2390 |
] |
|
2391 |
] |
|
2392 |
]. |
|
2393 |
errorInInitialize ifFalse:[ ex reject ]. |
|
2394 |
] do:[ |
|
2395 |
projectDefinitionFilename fileIn. |
|
2396 |
]. |
|
2397 |
]. |
|
2398 |
]. |
|
2399 |
errorInInitialize ifTrue:[ |
|
2400 |
Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'. |
|
2401 |
]. |
|
2402 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2403 |
]. |
|
17324 | 2404 |
]. |
2405 |
projectDefinitionClass notNil ifTrue:[ |
|
18668 | 2406 |
projectDefinitionClass autoload. |
2407 |
projectDefinitionClass supportedOnPlatform ifFalse:[ |
|
2408 |
^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'. |
|
2409 |
]. |
|
2410 |
projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2411 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2412 |
errorInInitialize ifTrue:[ |
|
2413 |
Transcript showCR:('Smalltalk [info]: retrying #initialize'). |
|
2414 |
projectDefinitionClass initialize. |
|
2415 |
]. |
|
2416 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2417 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2418 |
]. |
|
2419 |
^ true. |
|
17324 | 2420 |
]. |
2421 |
||
2422 |
"/ source files-file loading no longer supported |
|
2423 |
"/ however, allow for autoload-stub loaded |
|
2424 |
doLoadAsAutoloaded ifTrue:[ |
|
18668 | 2425 |
self |
2426 |
recursiveInstallAutoloadedClassesFrom:packageDirOrNil |
|
2427 |
rememberIn:(Set new) |
|
2428 |
maxLevels:2 |
|
2429 |
noAutoload:false |
|
2430 |
packageTop:packageDirOrNil |
|
2431 |
showSplashInLevels:0. |
|
2432 |
^ true |
|
17324 | 2433 |
]. |
2434 |
||
2435 |
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'. |
|
2436 |
||
2437 |
" |
|
2438 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2439 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2440 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2441 |
" |
|
2442 |
||
2443 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
|
2444 |
! |
|
2445 |
||
12250 | 2446 |
loadExtensionsForPackage:aPackageId |
13415 | 2447 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2448 |
|
13415 | 2449 |
extensionsLoaded := false. |
18924 | 2450 |
ProgrammingLanguage allDo:[:programmingLanguage| |
2451 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage) |
|
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2452 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2453 |
^ extensionsLoaded |
13415 | 2454 |
|
2455 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2456 |
"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
|
2457 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2458 |
! |
2459 |
||
18924 | 2460 |
loadExtensionsForPackage:aPackageId language: programmingLanguage |
13771 | 2461 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2462 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2463 |
|
18924 | 2464 |
programmingLanguage supportsExtensionMethods ifFalse:[^false]. |
13415 | 2465 |
|
12250 | 2466 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2467 |
packageDirName := self getPackageFileName:packageDirName. |
|
2468 |
||
2469 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
18924 | 2470 |
(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[ |
2471 |
^ true. |
|
2472 |
]. |
|
2473 |
packageDirName := nil. "do not try again" |
|
12250 | 2474 |
]. |
2475 |
||
2476 |
" |
|
2477 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2478 |
" |
|
15958 | 2479 |
(Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[ |
18924 | 2480 |
mgr := AbstractSourceCodeManager managerForPackage: aPackageId |
15958 | 2481 |
]. |
12250 | 2482 |
mgr notNil ifTrue:[ |
18924 | 2483 |
extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix. |
2484 |
||
2485 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2486 |
projectDefinition notNil ifTrue:[ |
|
2487 |
mod := aPackageId asPackageId module. |
|
2488 |
dir := aPackageId asPackageId directory. |
|
2489 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2490 |
extensionsRevisionString notNil ifTrue:[ |
|
2491 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2492 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2493 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[ |
|
2494 |
"JV@2011-10-23: following condition is never satisfied for |
|
2495 |
filed-in packages. The whole scheme of extensionVersion_XXX |
|
2496 |
works ONLY for compiled packages as it depends on fact, that |
|
2497 |
extension Init() routine is called AFTER all classes are inited, |
|
2498 |
therefore the extensionVersion_XXX methods from extensions.st |
|
2499 |
overwrites methods coming from package definition class. All this |
|
2500 |
is so tricky and error prone, that we have to come up with better |
|
2501 |
solution!!" |
|
2502 |
packageDirName notNil ifTrue:[ |
|
2503 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
|
2504 |
] ifFalse:[ |
|
2505 |
^ false |
|
2506 |
] |
|
2507 |
] |
|
2508 |
] |
|
2509 |
]. |
|
2510 |
SourceCodeManagerError handle:[:ex | |
|
2511 |
] do:[ |
|
2512 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2513 |
]. |
|
2514 |
]. |
|
2515 |
inStream isNil ifTrue:[ |
|
2516 |
SourceCodeManagerError handle:[:ex | |
|
2517 |
] do:[ |
|
2518 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2519 |
]. |
|
2520 |
]. |
|
2521 |
inStream notNil ifTrue:[ |
|
2522 |
Class withoutUpdatingChangeSetDo:[ |
|
2523 |
inStream fileIn. |
|
2524 |
]. |
|
2525 |
inStream close. |
|
2526 |
VerboseLoading ifTrue:[ |
|
2527 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2528 |
]. |
|
2529 |
^ true |
|
2530 |
] |
|
12250 | 2531 |
]. |
2532 |
||
2533 |
packageDirName notNil ifTrue:[ |
|
18924 | 2534 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
12250 | 2535 |
]. |
2536 |
^ false |
|
2537 |
||
13415 | 2538 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2539 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2540 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
15958 | 2541 |
"Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2542 |
! |
2543 |
||
2544 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2545 |
| extensionsLoaded | |
18924 | 2546 |
|
13415 | 2547 |
extensionsLoaded := false. |
18924 | 2548 |
ProgrammingLanguage allDo:[:programmingLanguage| |
2549 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage) |
|
2550 |
]. |
|
2551 |
^ extensionsLoaded |
|
13415 | 2552 |
|
2553 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2554 |
! |
|
2555 |
||
2556 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2557 |
|packageDir f| |
2558 |
||
2559 |
packageDir := packageDirOrString asFilename. |
|
2560 |
||
13415 | 2561 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2562 |
f exists ifTrue:[ |
18668 | 2563 |
Class withoutUpdatingChangeSetDo:[ |
2564 |
f fileIn. |
|
2565 |
]. |
|
2566 |
VerboseLoading ifTrue:[ |
|
2567 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2568 |
]. |
|
2569 |
^ true |
|
15958 | 2570 |
]. |
2571 |
^ true"/false |
|
13415 | 2572 |
|
2573 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2574 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
15958 | 2575 |
"Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2576 |
! |
2577 |
||
14589 | 2578 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2579 |
"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
|
2580 |
Return true on success, false otherwise." |
12782 | 2581 |
|
14589 | 2582 |
|packageId packageString packageDir def sourceCodeManager| |
2583 |
||
17588 | 2584 |
packageString := aPackageStringArg. |
2585 |
||
2586 |
"/ a little convenience: so you can stx packages with loadPackage:'goodies/soap' |
|
2587 |
(packageString includes:$:) ifFalse:[ |
|
18668 | 2588 |
packageString := 'stx:',packageString. |
17588 | 2589 |
]. |
12782 | 2590 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2591 |
"if I am here, so must my package" |
14892 | 2592 |
packageString = self package ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2593 |
|
17588 | 2594 |
packageId := aPackageStringArg asPackageId. |
2595 |
||
12782 | 2596 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2597 |
def := packageId projectDefinitionClass. |
14833 | 2598 |
(def notNil and:[def isLoaded]) ifTrue:[ |
18668 | 2599 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2600 |
^ true. |
|
14589 | 2601 |
]. |
2602 |
||
2603 |
packageDir := self packageDirectoryForPackageId:packageId. |
|
16144 | 2604 |
|
2605 |
[ |
|
18668 | 2606 |
self |
2607 |
loadPackage:packageString |
|
2608 |
fromDirectory:packageDir |
|
2609 |
asAutoloaded:doLoadAsAutoloaded. |
|
16144 | 2610 |
] on:PackageLoadError do:[:ex| |
18668 | 2611 |
AbstractSourceCodeManager notNil ifTrue:[ |
2612 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString. |
|
2613 |
sourceCodeManager notNil ifTrue:[ |
|
2614 |
^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded |
|
2615 |
]. |
|
2616 |
]. |
|
2617 |
ex reject. |
|
16144 | 2618 |
]. |
2619 |
||
2620 |
^ true |
|
12782 | 2621 |
|
2622 |
" |
|
2623 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2624 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2625 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2626 |
" |
|
2627 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2628 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2629 |
! |
2630 |
||
12250 | 2631 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2632 |
"load all source files found in aDirectory and treat them like |
|
2633 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2634 |
Experimental." |
|
2635 |
||
2636 |
|p t new anyFail repeatCount| |
|
2637 |
||
2638 |
"/ problem: dependencies. |
|
2639 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2640 |
||
2641 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
18668 | 2642 |
|any| |
2643 |
||
2644 |
repeatCount := 0. |
|
2645 |
[ |
|
2646 |
repeatCount := repeatCount + 1. |
|
2647 |
anyFail := false. |
|
2648 |
aDirectory directoryContents do:[:file | |
|
2649 |
|fn| |
|
2650 |
||
2651 |
fn := aDirectory / file. |
|
2652 |
(fn hasSuffix:'st') ifTrue:[ |
|
2653 |
Metaclass confirmationQuerySignal answer:false |
|
2654 |
do:[ |
|
2655 |
Error |
|
2656 |
handle:[:ex | |
|
2657 |
anyFail := true |
|
2658 |
] |
|
2659 |
do:[ |
|
2660 |
(self fileIn:fn) ifFalse:[ |
|
2661 |
anyFail := true |
|
2662 |
] ifTrue:[ |
|
2663 |
any := true. |
|
2664 |
] |
|
2665 |
] |
|
2666 |
] |
|
2667 |
] |
|
2668 |
]. |
|
2669 |
any ifFalse:[ |
|
2670 |
^ false "/ no file found |
|
2671 |
] |
|
2672 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
12250 | 2673 |
]. |
2674 |
||
2675 |
new := (p := Project projectWithId:packageId) isNil. |
|
2676 |
new ifTrue:[ p := Project new]. |
|
2677 |
||
2678 |
p name:packageId. |
|
2679 |
p directory:aDirectory. |
|
2680 |
p package:packageId. |
|
2681 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2682 |
p repositoryModule:(t first). |
|
2683 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2684 |
p isLoaded:true. |
|
2685 |
||
2686 |
new ifTrue:[Project addLoadedProject:p]. |
|
16144 | 2687 |
anyFail ifTrue:[ |
18668 | 2688 |
^ PackageLoadError raiseRequestWith:packageId. |
16144 | 2689 |
]. |
2690 |
^ true |
|
12250 | 2691 |
! |
2692 |
||
2693 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2694 |
"load a package from a compiled classLib. |
|
2695 |
Experimental." |
|
2696 |
||
2697 |
|p t new| |
|
2698 |
||
2699 |
(self fileIn:aFilename) ifFalse:[ |
|
18668 | 2700 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2701 |
^ false. |
|
2702 |
] |
|
12250 | 2703 |
]. |
2704 |
||
2705 |
new := (p := Project projectWithId:packageId) isNil. |
|
2706 |
new ifTrue:[ p := Project new]. |
|
2707 |
||
2708 |
p name:packageId. |
|
2709 |
p directory:aFilename directory. |
|
2710 |
p package:packageId. |
|
2711 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2712 |
p repositoryModule:(t first). |
|
2713 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2714 |
p isLoaded:true. |
|
2715 |
||
2716 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2717 |
|
12250 | 2718 |
^ true |
2719 |
! |
|
2720 |
||
12782 | 2721 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2722 |
"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
|
2723 |
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
|
2724 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2725 |
|
17324 | 2726 |
|ret| |
2727 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2728 |
PackageLoadInProgressQuery |
18668 | 2729 |
answerNotifyLoading:aPackageString asSymbol |
2730 |
do:[ |
|
2731 |
ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
|
2732 |
]. |
|
17324 | 2733 |
^ ret |
17350 | 2734 |
|
2735 |
" |
|
2736 |
Smalltalk loadPackage:'stx:goodies/communication' |
|
2737 |
" |
|
12782 | 2738 |
! |
2739 |
||
12250 | 2740 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2741 |
<resource: #obsolete> |
12250 | 2742 |
"load a package from a loadAll - loader script. |
2743 |
Experimental." |
|
2744 |
||
2745 |
|p t new| |
|
2746 |
||
2747 |
Metaclass confirmationQuerySignal answer:false |
|
2748 |
do:[ |
|
18668 | 2749 |
(self fileIn:aFilename) ifFalse:[ |
2750 |
self warn:'Failed to load the package ', packageId printString. |
|
2751 |
^ false. |
|
2752 |
] |
|
12250 | 2753 |
]. |
2754 |
||
2755 |
new := (p := Project projectWithId:packageId) isNil. |
|
2756 |
new ifTrue:[ p := Project new]. |
|
2757 |
||
2758 |
p name:packageId. |
|
2759 |
p directory:aFilename directory. |
|
2760 |
p package:packageId. |
|
2761 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2762 |
p repositoryModule:(t first). |
|
2763 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2764 |
p isLoaded:true. |
|
2765 |
||
2766 |
new ifTrue:[Project addLoadedProject:p]. |
|
2767 |
^ true |
|
2768 |
! |
|
2769 |
||
2770 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
2771 |
"load a package from a .zip delivery file. |
|
2772 |
Experimental." |
|
2773 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
2774 |
^ PackageLoadError |
18668 | 2775 |
raiseRequestWith:aPackageId |
2776 |
errorString:' - package loading from zip is not yet implemented'. |
|
12250 | 2777 |
! |
2778 |
||
2779 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2780 |
<resource: #obsolete> |
12250 | 2781 |
|abbrevFile packageDir| |
2782 |
||
2783 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
2784 |
packageDir isNil ifTrue:[^ false]. |
|
2785 |
||
2786 |
"/ abbrev.stc ? |
|
12377 | 2787 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2788 |
abbrevFile exists ifFalse:[^ false]. |
2789 |
||
2790 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2791 |
||
2792 |
doLoadAsAutoloaded ifFalse:[ |
|
18668 | 2793 |
"/ force autoloading... |
2794 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 2795 |
]. |
2796 |
||
2797 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2798 |
VerboseLoading ifTrue:[ |
18668 | 2799 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 2800 |
]. |
2801 |
^ true |
|
2802 |
||
13814 | 2803 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 2804 |
! ! |
2805 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2806 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2807 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2808 |
allClasses |
7563 | 2809 |
"return an unordered collection of all classes in the system. |
10071 | 2810 |
Only globally anchored classes are returned |
453 | 2811 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2812 |
||
2813 |
|classes| |
|
2814 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2815 |
"/ you may wonder, what this while is for, here ... |
453 | 2816 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 2817 |
"/ another view (background fileIn), while building up the |
453 | 2818 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
2819 |
"/ other process in the meanwhile. |
|
2820 |
"/ If that happens, we restart the set-building here |
|
2821 |
"/ |
|
2822 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
18668 | 2823 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
2824 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
2825 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
2826 |
"/ sigh - would like to skip over aliases |
|
2827 |
"/ but this cannot be done simply by comparing |
|
2828 |
"/ the classes name against the store-key |
|
2829 |
"/ i.e. cannot do: |
|
2830 |
"/ anObject name == sym ifTrue:[ |
|
2831 |
"/ classes add:anObject |
|
2832 |
"/ ] |
|
2833 |
"/ because that would lead to ignore all java |
|
2834 |
"/ classes, which are stored under a different |
|
2835 |
"/ key. |
|
2836 |
||
2837 |
(eachGlobal name == eachName |
|
2838 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
2839 |
classes add:eachGlobal |
|
2840 |
]. |
|
2841 |
] |
|
2842 |
]. |
|
2843 |
NumberOfClassesHint := classes size. |
|
453 | 2844 |
]. |
2845 |
^ classes |
|
2846 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2847 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2848 |
CachedClasses := nil. |
453 | 2849 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2850 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2851 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2852 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2853 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 2854 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2855 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2856 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2857 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2858 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2859 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2860 |
"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
|
2861 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2862 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2863 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2864 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2865 |
self allClassesDo:[:eachClass | |
18668 | 2866 |
classes add:(eachClass theNonMetaclass). |
2867 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2868 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2869 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2870 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2871 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2872 |
allClassesWithAllPrivateClasses |
7563 | 2873 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2874 |
Only globally anchored classes are returned; Namespaces are not included. |
4642 | 2875 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2876 |
||
10071 | 2877 |
^ self allClasses select:[:aClass | |
18668 | 2878 |
|owner| |
2879 |
||
2880 |
(aClass isRealNameSpace not) |
|
2881 |
and:[ |
|
2882 |
owner := aClass topOwningClass. |
|
2883 |
(owner ? aClass) nameSpace == Smalltalk |
|
2884 |
] |
|
4642 | 2885 |
] |
2886 |
||
2887 |
" |
|
2888 |
Smalltalk allClassesWithAllPrivateClasses |
|
2889 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2890 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2891 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 2892 |
! |
2893 |
||
15068 | 2894 |
allExtensions |
2895 |
"return a collection of all extension methods (methods added from another package)" |
|
2896 |
||
2897 |
|methods| |
|
2898 |
||
2899 |
methods := OrderedCollection new. |
|
2900 |
self allClassesDo:[:eachClass | |
|
18668 | 2901 |
|classPackage| |
2902 |
||
2903 |
classPackage := eachClass package. |
|
2904 |
eachClass instAndClassMethodsDo:[:mthd | |
|
2905 |
mthd package ~= classPackage ifTrue:[ methods add:mthd ]. |
|
2906 |
]. |
|
15068 | 2907 |
]. |
2908 |
^ methods |
|
2909 |
||
2910 |
" |
|
2911 |
Smalltalk allExtensions |
|
2912 |
" |
|
2913 |
! |
|
2914 |
||
11153 | 2915 |
allExtensionsForPackage:aProjectID |
14890 | 2916 |
"return a collection of all extension methods for a given projectID" |
2917 |
||
11153 | 2918 |
|methods| |
2919 |
||
2920 |
methods := OrderedCollection new. |
|
2921 |
self allClassesDo:[:eachClass | |
|
18668 | 2922 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 2923 |
]. |
2924 |
^ methods |
|
2925 |
! |
|
2926 |
||
9227 | 2927 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2928 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2929 |
|
9227 | 2930 |
|implementors| |
2931 |
||
2932 |
implementors := OrderedCollection new. |
|
2933 |
self allClassesDo:[:cls | |
|
18668 | 2934 |
(cls includesSelector:aSelector) ifTrue:[ |
2935 |
implementors add:cls. |
|
2936 |
]. |
|
2937 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
2938 |
implementors add:cls class. |
|
2939 |
]. |
|
9227 | 2940 |
]. |
2941 |
^ implementors |
|
2942 |
||
2943 |
" |
|
10071 | 2944 |
Smalltalk allImplementorsOf:#isNil |
2945 |
(Smalltalk allImplementorsOf:#add:) size |
|
9227 | 2946 |
" |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2947 |
|
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2948 |
"Modified: / 07-05-2010 / 10:56:09 / cg" |
9227 | 2949 |
! |
2950 |
||
12376 | 2951 |
allLoadedProjectIDs |
2952 |
||
2953 |
^ self allProjectsIdsIncludingUnloadedClasses: false |
|
2954 |
||
2955 |
||
2956 |
" |
|
2957 |
Smalltalk allLoadedProjectIDs |
|
2958 |
" |
|
2959 |
! |
|
2960 |
||
9254 | 2961 |
allProjectIDs |
12376 | 2962 |
|
2963 |
^ self allProjectsIdsIncludingUnloadedClasses: true |
|
2964 |
||
2965 |
||
2966 |
" |
|
2967 |
Smalltalk allProjectIDs |
|
2968 |
" |
|
2969 |
! |
|
2970 |
||
2971 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
2972 |
"Returns all projects ids. |
|
2973 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
2974 |
" |
|
2975 |
||
9254 | 2976 |
|allProjects| |
2977 |
||
2978 |
allProjects := Set new. |
|
2979 |
self allClassesDo:[:eachClass | |
|
18668 | 2980 |
|cls pkg| |
2981 |
||
2982 |
eachClass isRealNameSpace ifFalse:[ |
|
2983 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
|
2984 |
cls := eachClass theNonMetaclass. |
|
2985 |
cls isPrivate ifTrue:[ |
|
2986 |
cls := cls topOwningClass |
|
2987 |
]. |
|
2988 |
pkg := cls package. |
|
2989 |
pkg size > 0 ifTrue:[ |
|
2990 |
allProjects add:pkg. |
|
2991 |
] ifFalse:[ |
|
2992 |
"/ for now, nameSpaces are not in any package; |
|
2993 |
"/ this might change. Then, 0-sized packages are |
|
2994 |
"/ illegal, and the following should be enabled. |
|
2995 |
"/ self halt |
|
2996 |
]. |
|
2997 |
cls isJavaClass ifFalse:[ |
|
2998 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
2999 |
allProjects add:mthd package asSymbol. |
|
3000 |
]. |
|
3001 |
]. |
|
3002 |
]. |
|
3003 |
]. |
|
9254 | 3004 |
]. |
3005 |
allProjects := allProjects asOrderedCollection sort. |
|
3006 |
^ allProjects |
|
3007 |
||
3008 |
" |
|
12376 | 3009 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
3010 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 3011 |
" |
3012 |
! |
|
3013 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3014 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3015 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3016 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3017 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3018 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3019 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3020 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3021 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3022 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3023 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3024 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3025 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3026 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3027 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3028 |
"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
|
3029 |
2 entries: 1st: the best (longest) match |
18668 | 3030 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3031 |
|
9508 | 3032 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3033 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3034 |
" |
10071 | 3035 |
Smalltalk classCategoryCompletion:'Sys' |
3036 |
Smalltalk classCategoryCompletion:'System' |
|
3037 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3038 |
" |
9508 | 3039 |
|
3040 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3041 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3042 |
|
8570 | 3043 |
classNamed:aString |
3044 |
"return the class with name aString, or nil if absent. |
|
3045 |
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
|
3046 |
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
|
3047 |
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
|
3048 |
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
|
3049 |
|
10127 | 3050 |
|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
|
3051 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3052 |
"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
|
3053 |
But be careful, to not invent new symbols ..." |
453 | 3054 |
sym := aString asSymbolIfInterned. |
3055 |
sym notNil ifTrue:[ |
|
18668 | 3056 |
cls := self at:sym ifAbsent:nil. |
3057 |
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
|
3058 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3059 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
3060 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3061 |
nonMeta := self classNamed:(aString copyButLast:6). |
3062 |
nonMeta notNil ifTrue:[ |
|
3063 |
^ nonMeta theMetaclass |
|
3064 |
]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3065 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3066 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3067 |
"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
|
3068 |
cls isNil ifTrue:[ |
18668 | 3069 |
idx := aString indexOfSubCollection:'::'. |
3070 |
idx ~~ 0 ifTrue:[ |
|
3071 |
prefix := aString copyTo:idx-1. |
|
3072 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
3073 |
nsNameSymbol notNil ifTrue:[ |
|
3074 |
rest := aString copyFrom:idx+2. |
|
3075 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
3076 |
"namespace may be the owner of a private class. |
|
3077 |
NameSpaces and Behaviors have the same protocol" |
|
3078 |
[namespace isBehavior] whileTrue:[ |
|
3079 |
idx := rest indexOfSubCollection:'::'. |
|
3080 |
idx ~~ 0 ifTrue:[ |
|
3081 |
prefix := rest copyTo:idx-1. |
|
3082 |
rest := rest copyFrom:idx+2. |
|
3083 |
"this does an implicit autoload if required" |
|
3084 |
namespace := namespace privateClassesAt:prefix. |
|
3085 |
] ifFalse:[ |
|
3086 |
namespace isLoaded ifTrue:[ |
|
3087 |
cls := namespace privateClassesAt:rest. |
|
3088 |
cls isBehavior ifTrue:[^ cls]. |
|
3089 |
]. |
|
3090 |
namespace := nil. "force exit of loop" |
|
3091 |
]. |
|
3092 |
]. |
|
3093 |
]. |
|
3094 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3095 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3096 |
|
453 | 3097 |
^ nil |
3098 |
||
3099 |
" |
|
10071 | 3100 |
Smalltalk classNamed:'Object' |
3101 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3102 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3103 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
3104 |
Smalltalk classNamed:'fooBar' |
|
3105 |
Smalltalk classNamed:'true' |
|
3106 |
Smalltalk classNamed:'Object class' |
|
3107 |
Smalltalk classNamed:'Metaclass' |
|
3108 |
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
|
3109 |
Smalltalk classNamed:'Array class' |
453 | 3110 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3111 |
|
9468 | 3112 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3113 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3114 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3115 |
"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
|
3116 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3117 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3118 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3119 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3120 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3121 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3122 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3123 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3124 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3125 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3126 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3127 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3128 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3129 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3130 |
2 entries: 1st: the best (longest) match |
18668 | 3131 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3132 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3133 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3134 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3135 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3136 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3137 |
"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
|
3138 |
2 entries: 1st: the best (longest) match |
18668 | 3139 |
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
|
3140 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3141 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3142 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3143 |
" |
10071 | 3144 |
Smalltalk classnameCompletion:'Arr' |
3145 |
Smalltalk classnameCompletion:'Arra' |
|
3146 |
Smalltalk classnameCompletion:'arra' |
|
3147 |
Smalltalk classnameCompletion:'*rray' |
|
3148 |
||
3149 |
Smalltalk classnameCompletion:'Arr cl' |
|
3150 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3151 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3152 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3153 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3154 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3155 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3156 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3157 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3158 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3159 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3160 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3161 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3162 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3163 |
"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
|
3164 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3165 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3166 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3167 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3168 |
"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
|
3169 |
2 entries: 1st: the best (longest) match |
18668 | 3170 |
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
|
3171 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3172 |
^ 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
|
3173 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3174 |
" |
10071 | 3175 |
Smalltalk globalnameCompletion:'Arr' |
3176 |
Smalltalk globalnameCompletion:'Arra' |
|
3177 |
Smalltalk globalnameCompletion:'arra' |
|
3178 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3179 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3180 |
|
9508 | 3181 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3182 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3183 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3184 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3185 |
globalnameCompletion:aPartialGlobalName |
7563 | 3186 |
"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
|
3187 |
2 entries: 1st: the best (longest) match |
18668 | 3188 |
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
|
3189 |
|
8358 | 3190 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3191 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3192 |
^ 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
|
3193 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3194 |
" |
10071 | 3195 |
Smalltalk globalnameCompletion:'Arr' |
3196 |
Smalltalk globalnameCompletion:'Arra' |
|
3197 |
Smalltalk globalnameCompletion:'arra' |
|
3198 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3199 |
" |
3200 |
||
9508 | 3201 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3202 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3203 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3204 |
|
13771 | 3205 |
hasClassNamed:aString |
3206 |
Symbol |
|
18668 | 3207 |
hasInterned:aString |
3208 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3209 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3210 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3211 |
"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
|
3212 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3213 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3214 |
|
9290 | 3215 |
hasNameSpaces |
3216 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3217 |
the namespace display in a browser (PocketSmalltalk)" |
|
3218 |
||
3219 |
^ true |
|
3220 |
! |
|
3221 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3222 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3223 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3224 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3225 |
|
9290 | 3226 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3227 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3228 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3229 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3230 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3231 |
"for now return false |
10999 | 3232 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3233 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3234 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3235 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3236 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3237 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3238 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3239 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3240 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3241 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3242 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3243 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3244 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3245 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3246 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3247 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3248 |
|
14987 | 3249 |
includesIdentical:something |
3250 |
"this should come from Collection. |
|
3251 |
will change the inheritance - Smalltalk is actually a collection" |
|
3252 |
||
3253 |
self do:[:element | element == something ifTrue:[^ true]]. |
|
3254 |
^ false |
|
3255 |
! |
|
3256 |
||
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3257 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3258 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3259 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3260 |
"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
|
3261 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3262 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3263 |
isNameSpace |
9227 | 3264 |
"return true, if the receiver is a nameSpace." |
3265 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3266 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3267 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3268 |
"Created: 11.10.1996 / 18:10:43 / cg" |
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 |
|
10169 | 3271 |
isRealNameSpace |
3272 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3273 |
||
3274 |
^ false |
|
3275 |
||
3276 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3277 |
! |
|
3278 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3279 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3280 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3281 |
! |
7563 | 3282 |
|
3283 |
isTopLevelNamespace |
|
3284 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3285 |
|
7432 | 3286 |
<resource:#obsolete> |
3287 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3288 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3289 |
^ true |
3290 |
||
3291 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3292 |
! |
|
3293 |
||
9081 | 3294 |
keyIsClassVariableNameKey:aKey |
3295 |
|i| |
|
3296 |
||
3297 |
i := aKey lastIndexOf:$:. |
|
3298 |
i ~~ 0 ifTrue:[ |
|
18668 | 3299 |
i > 1 ifTrue:[ |
3300 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
3301 |
^ true. |
|
3302 |
]. |
|
3303 |
]. |
|
9081 | 3304 |
]. |
3305 |
^ false. |
|
3306 |
||
3307 |
" |
|
10071 | 3308 |
self keyIsClassVariableNameKey:'foo::bar' |
3309 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3310 |
self keyIsClassVariableNameKey:':bar' |
|
3311 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3312 |
" |
3313 |
! |
|
3314 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3315 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3316 |
"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
|
3317 |
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
|
3318 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3319 |
|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
|
3320 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3321 |
"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
|
3322 |
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
|
3323 |
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
|
3324 |
sym notNil ifTrue:[ |
18668 | 3325 |
cls := self at:sym ifAbsent:nil. |
3326 |
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
|
3327 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3328 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3329 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3330 |
nonMeta := self loadedClassNamed:(aString copyButLast:6). |
3331 |
nonMeta notNil ifTrue:[ |
|
3332 |
^ nonMeta theMetaclass |
|
3333 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3334 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3335 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3336 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3337 |
" |
10071 | 3338 |
Smalltalk loadedClassNamed:'Object' |
3339 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3340 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3341 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3342 |
Smalltalk loadedClassNamed:'fooBar' |
|
3343 |
Smalltalk loadedClassNamed:'true' |
|
3344 |
Smalltalk loadedClassNamed:'Object class' |
|
3345 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3346 |
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
|
3347 |
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
|
3348 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3349 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3350 |
|
7563 | 3351 |
methodProtocolCompletion:aPartialProtocolName |
3352 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3353 |
2 entries: 1st: the best (longest) match |
18668 | 3354 |
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
|
3355 |
|
9508 | 3356 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
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 |
" |
10071 | 3359 |
Smalltalk methodProtocolCompletion:'doc' |
3360 |
Smalltalk methodProtocolCompletion:'docu' |
|
3361 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3362 |
" |
9508 | 3363 |
|
3364 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3365 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3366 |
|
7563 | 3367 |
numberOfGlobals |
3368 |
"return the number of global variables in the system" |
|
3369 |
||
3370 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3371 |
|
3372 |
tally := 0. |
|
3373 |
self do:[:obj | tally := tally + 1]. |
|
3374 |
^ tally |
|
3375 |
||
3376 |
"Smalltalk numberOfGlobals" |
|
3377 |
! |
|
3378 |
||
7563 | 3379 |
referencesAny:aCollection |
3380 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3381 |
|
3382 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3383 |
aCollection do:[:anObject | |
3384 |
(key == anObject) ifTrue:[^ true]. |
|
3385 |
(val == anObject ) ifTrue:[^ true]. |
|
3386 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3387 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3388 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3389 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3390 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3391 |
! |
3260 | 3392 |
|
7563 | 3393 |
referencesDerivedInstanceOf:aClass |
3394 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3395 |
|
3396 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3397 |
(key isKindOf:aClass) ifTrue:[^ true]. |
3398 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 3399 |
]. |
3400 |
^ super referencesDerivedInstanceOf:aClass |
|
3401 |
! |
|
3402 |
||
7563 | 3403 |
referencesInstanceOf:aClass |
3404 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3405 |
|
3406 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3407 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
3408 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 3409 |
]. |
3410 |
^ super referencesInstanceOf:aClass |
|
3411 |
! |
|
3412 |
||
7563 | 3413 |
referencesObject:anObject |
3414 |
"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
|
3415 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3416 |
self keysAndValuesDo:[:key :val | |
18668 | 3417 |
(key == anObject) ifTrue:[^ true]. |
3418 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3419 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3420 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3421 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3422 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3423 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3424 |
|
15766 | 3425 |
resolveName:aName inClass:aClass |
7563 | 3426 |
"resolve aName as if compiled within aClass; |
3026 | 3427 |
i.e. if it has a private class with this name, return it; |
3428 |
if aName is known within the classes namespace, return that. |
|
3429 |
Otherwise, return a global with that name. |
|
3430 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3431 |
to resolve a global by name." |
|
3432 |
||
15766 | 3433 |
|nameUsed sym cls ns| |
3434 |
||
3435 |
aName isNil ifTrue:[^ nil]. |
|
3436 |
aName isBehavior ifTrue:[^ aName]. "/ already resolved |
|
3437 |
nameUsed := aName. |
|
3438 |
||
3439 |
(nameUsed startsWith:'Smalltalk::') ifTrue:[ |
|
18668 | 3440 |
nameUsed := nameUsed copyFrom:12. |
3441 |
^ self at:(nameUsed asSymbol) ifAbsent:nil. |
|
15766 | 3442 |
]. |
3443 |
||
3444 |
sym := nameUsed asSymbol. |
|
3026 | 3445 |
|
3446 |
cls := aClass privateClassesAt:sym. |
|
3447 |
cls notNil ifTrue:[^ cls]. |
|
3448 |
||
3449 |
ns := aClass nameSpace. |
|
3450 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
18668 | 3451 |
ns isNameSpace ifTrue:[ |
3452 |
cls := ns at:sym ifAbsent:nil. |
|
3453 |
] ifFalse:[ |
|
3454 |
cls := ns privateClassesAt:sym |
|
3455 |
]. |
|
3456 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 3457 |
]. |
3026 | 3458 |
^ self at:sym ifAbsent:nil. |
4356 | 3459 |
|
3460 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3461 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3462 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3463 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3464 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3465 |
2 entries: 1st: the longest match |
18668 | 3466 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3467 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3468 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3469 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3470 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3471 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3472 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3473 |
2 entries: 1st: the longest match |
18668 | 3474 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3475 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3476 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3477 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3478 |
" |
10071 | 3479 |
Smalltalk selectorCompletion:'at:p' |
3480 |
Smalltalk selectorCompletion:'nextP' |
|
3481 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3482 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3483 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3484 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3485 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 3486 |
! ! |
3487 |
||
4431 | 3488 |
!Smalltalk class methodsFor:'queries-system'! |
3489 |
||
7563 | 3490 |
dialectName |
8736 | 3491 |
^ #SmalltalkX |
7563 | 3492 |
|
3493 |
" |
|
3494 |
Smalltalk dialectName |
|
3495 |
" |
|
3496 |
! |
|
3497 |
||
3498 |
dialectReleaseVersion |
|
7348 | 3499 |
^ self versionString |
3500 |
||
3501 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3502 |
Smalltalk dialectReleaseVersion |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3503 |
" |
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 |
|
15958 | 3506 |
isAmber |
15980 | 3507 |
"is this an Amber Smalltalk system ? |
3508 |
Return false here - this may be useful to write portable |
|
15958 | 3509 |
applications - add #isAmber to your Amber Smalltalk, |
3510 |
returning true there." |
|
3511 |
||
3512 |
^ false |
|
3513 |
||
3514 |
"Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3515 |
! |
|
3516 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3517 |
isDolphinSmalltalk |
16803 | 3518 |
"is this a Dolphin Smalltalk system ? |
15980 | 3519 |
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
|
3520 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3521 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3522 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3523 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3524 |
! |
4970 | 3525 |
|
15958 | 3526 |
isGemStone |
15980 | 3527 |
"is this a GemStone Smalltalk system ? |
3528 |
Return false here - this may be useful to write portable |
|
15958 | 3529 |
applications - add #isGemStone to your GemStone/S, |
3530 |
returning true there." |
|
3531 |
||
3532 |
^ false |
|
3533 |
||
3534 |
"Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3535 |
! |
|
3536 |
||
3537 |
isPharo |
|
15980 | 3538 |
"is this a Pharo Smalltalk system ? |
3539 |
Return false here - this may be useful to write portable |
|
15958 | 3540 |
applications - add #isPharo to your Pharo, |
3541 |
returning true there." |
|
3542 |
||
3543 |
^ false |
|
3544 |
||
3545 |
"Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3546 |
! |
|
3547 |
||
7563 | 3548 |
isSmalltalkMT |
15980 | 3549 |
"is this a Smalltalk-MT system ? |
3550 |
Return false here - this may be useful to write portable |
|
7563 | 3551 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
4970 | 3552 |
returning true there." |
3553 |
||
3554 |
^ false |
|
3555 |
! |
|
3556 |
||
7563 | 3557 |
isSmalltalkV |
15980 | 3558 |
"is this a Smalltalk/V system ? |
3559 |
Return false here - this may be useful to write portable |
|
7563 | 3560 |
applications - add #isSmalltalkV to your smalltalkV, |
4431 | 3561 |
returning true there." |
3562 |
||
3563 |
^ false |
|
3564 |
! |
|
3565 |
||
7563 | 3566 |
isSmalltalkX |
16803 | 3567 |
"is this a Smalltalk/X system ? |
15980 | 3568 |
Return true here - this may be useful to write portable |
7563 | 3569 |
applications - add #isSmalltalkX to your other smalltalks, |
4431 | 3570 |
returning false there." |
3571 |
||
3572 |
^ true |
|
3573 |
! |
|
3574 |
||
7563 | 3575 |
isSqueak |
15980 | 3576 |
"is this a SqueakSmalltalk system ? |
3577 |
Return false here - this may be useful to write portable |
|
7563 | 3578 |
applications - add #isSqueak to your squeak, |
4431 | 3579 |
returning true there." |
3580 |
||
3581 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3582 |
! |
4431 | 3583 |
|
16013 | 3584 |
isSqueakLike |
3585 |
"is this a Squeak, Pharo, Cuis or similar Smalltalk system ? |
|
3586 |
Return false here - this may be useful to write portable |
|
3587 |
applications - add #isSqueakLike to your squeak, pharo,... |
|
3588 |
returning true there." |
|
3589 |
||
3590 |
^ false |
|
3591 |
! |
|
3592 |
||
7563 | 3593 |
isVisualAge |
15980 | 3594 |
"is this a VisualAge Smalltalk system ? |
3595 |
Return false here - this may be useful to write portable |
|
7563 | 3596 |
applications - add #isVisualAge to your visualAge, |
4431 | 3597 |
returning true there." |
3598 |
||
3599 |
^ false |
|
3600 |
! |
|
3601 |
||
17369 | 3602 |
isVisualSmalltalkEnterprise |
16843 | 3603 |
"is this a VSE Smalltalk system ? |
3604 |
Return false here - this may be useful to write portable |
|
3605 |
applications - add #isVisualSmallalkEnterprise to your VSE, |
|
3606 |
returning true there." |
|
3607 |
||
3608 |
^ false |
|
3609 |
! |
|
3610 |
||
7563 | 3611 |
isVisualWorks |
15980 | 3612 |
"is this a VisualWorks Smalltalk system ? |
3613 |
Return false here - this may be useful to write portable |
|
7563 | 3614 |
applications - add #isVisualWorks to your visualWorks, |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3615 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3616 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3617 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3618 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3619 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3620 |
!Smalltalk class methodsFor:'startup'! |
1 | 3621 |
|
9032 | 3622 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3623 |
"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
|
3624 |
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
|
3625 |
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
|
3626 |
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
|
3627 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3628 |
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
|
3629 |
|
9032 | 3630 |
|windowIDString numericWindowID windowID params idx process| |
3631 |
||
3632 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3633 |
windowIDString := CommandLineArguments at:idx+1. |
|
3634 |
numericWindowID := Integer fromString:windowIDString. |
|
3635 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3636 |
||
3637 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3638 |
idx ~~ 0 ifTrue:[ |
|
18668 | 3639 |
params := Dictionary new. |
3640 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
3641 |
params at:key put:value. |
|
3642 |
]. |
|
9032 | 3643 |
]. |
3644 |
||
3645 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3646 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3647 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3648 |
||
3649 |
process := [ |
|
18668 | 3650 |
PluginSupport |
3651 |
startInBrowserWithWindowID:windowID |
|
3652 |
parameters:params. |
|
9032 | 3653 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3654 |
process priority:(Processor userSchedulingPriority). |
9032 | 3655 |
process name:'browser start handler'. |
3656 |
process beGroupLeader. |
|
3657 |
process resume. |
|
3658 |
process := nil. |
|
3659 |
||
3660 |
Processor dispatchLoop. |
|
3661 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3662 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3663 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3664 |
! |
3665 |
||
7563 | 3666 |
displayInitializationDone |
3667 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3668 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3669 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3670 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3671 |
|
13893 | 3672 |
executeStartBlocks |
3673 |
|startBlocks| |
|
3674 |
||
3675 |
startBlocks := self startBlocks. |
|
3676 |
startBlocks notNil ifTrue:[ |
|
18668 | 3677 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
3678 |
startBlocks do:[:aBlock| |
|
3679 |
Error handle:[:ex | |
|
3680 |
InfoPrinting == true ifTrue:[ |
|
3681 |
'Smalltalk [warning]: error caught in startBlock: ' infoPrint. |
|
3682 |
ex description infoPrintCR. |
|
3683 |
ex infoPrintCR. |
|
3684 |
thisContext fullPrintAll. |
|
3685 |
]. |
|
3686 |
] do: aBlock |
|
3687 |
]. |
|
3688 |
startBlocks removeAll. |
|
13893 | 3689 |
]. |
3690 |
||
3691 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
3692 |
! |
|
3693 |
||
11375 | 3694 |
hideSplashWindow |
3695 |
%{ |
|
3696 |
#ifdef WIN32 |
|
3697 |
extern void __win32_hideSplashScreen(); |
|
3698 |
||
3699 |
__win32_hideSplashScreen(); |
|
3700 |
#endif |
|
3701 |
%} |
|
3702 |
! |
|
3703 |
||
7563 | 3704 |
mainStartup:graphicalMode |
3705 |
"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
|
3706 |
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
|
3707 |
|
9012 | 3708 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3709 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3710 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3711 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3712 |
|
10644 | 3713 |
graphicalMode ifTrue:[ |
18668 | 3714 |
Display isNil ifTrue:[ |
3715 |
(StartupClass notNil |
|
3716 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3717 |
self openDisplay. |
|
3718 |
]. |
|
3719 |
]. |
|
10644 | 3720 |
]. |
3721 |
||
10645 | 3722 |
StandAlone ifFalse:[ |
18668 | 3723 |
" |
3724 |
enable the graphical debugger/inspector |
|
3725 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3726 |
" |
|
3727 |
self initStandardTools. |
|
10645 | 3728 |
]. |
3729 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3730 |
" |
10071 | 3731 |
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
|
3732 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3733 |
Display notNil ifTrue:[ |
18668 | 3734 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
3735 |
SaveEmergencyImage == true ifTrue:[ |
|
3736 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
3737 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
3738 |
]. |
|
3739 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
3740 |
self exit:11. |
|
3741 |
]. |
|
3742 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3743 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3744 |
|
9016 | 3745 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 3746 |
IsPlugin := (idx ~~ 0). |
3747 |
IsPlugin ifTrue:[ |
|
18668 | 3748 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
3749 |
self browserWindowStartup. |
|
3750 |
"/ not reached |
|
9012 | 3751 |
]. |
3752 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3753 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3754 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3755 |
"/ 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
|
3756 |
"/ 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
|
3757 |
"/ 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
|
3758 |
"/ 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
|
3759 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3760 |
process := [ |
18668 | 3761 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
3762 |
StartBlocks notNil ifTrue:[ |
|
3763 |
self executeStartBlocks. |
|
3764 |
StartBlocks := nil. |
|
3765 |
]. |
|
3766 |
ImageStartBlocks notNil ifTrue:[ |
|
3767 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
|
3768 |
ImageStartBlocks do:[:aBlock| |
|
3769 |
aBlock value |
|
3770 |
]. |
|
3771 |
]. |
|
3772 |
StandAlone ifFalse:[ |
|
3773 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
3774 |
thisIsARestart ifTrue:[ |
|
3775 |
Transcript cr. |
|
3776 |
Transcript showCR:('Smalltalk restarted from:' |
|
3777 |
, imageName |
|
3778 |
, ' (saved ' |
|
3779 |
, ObjectMemory imageSaveTime printString |
|
3780 |
, ')' ). |
|
3781 |
] ifFalse:[ |
|
3782 |
Transcript showCR:(self hello). |
|
3783 |
Transcript showCR:(self copyrightString). |
|
3784 |
]. |
|
3785 |
Transcript cr. |
|
3786 |
]. |
|
3787 |
||
3788 |
DemoMode==true ifTrue:[ |
|
3789 |
Transcript showCR:'*** Restricted use: ***'. |
|
3790 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
3791 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
3792 |
Transcript showCR:'*** for more details. ***'. |
|
3793 |
Transcript cr. |
|
3794 |
]. |
|
3795 |
]. |
|
3796 |
||
3797 |
thisIsARestart ifTrue:[ |
|
3798 |
"/ |
|
3799 |
"/ the final late notification - users can now assume that |
|
3800 |
"/ views, forms etc. have been recreated. |
|
3801 |
||
3802 |
ObjectMemory changed:#returnFromSnapshot. |
|
3803 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
3804 |
|
7040 | 3805 |
] newProcess. |
3806 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3807 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3808 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3809 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3810 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3811 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
3812 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
3813 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
3814 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
3815 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3816 |
"/ 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
|
3817 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3818 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3819 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
18668 | 3820 |
" |
3821 |
allow more customization by reading an image specific rc-file |
|
3822 |
" |
|
3823 |
thisIsARestart ifTrue:[ |
|
3824 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
3825 |
imageName := imageName copyButLast:4 |
|
3826 |
]. |
|
3827 |
self fileIn:(imageName , '.rc') |
|
3828 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3829 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3830 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3831 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3832 |
"/ ]. |
2086 | 3833 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3834 |
|
18668 | 3835 |
process := [ |
3836 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
3837 |
StandAlone ifTrue:[ |
|
3838 |
AbortOperationRequest handle:[:ex | |
|
3839 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
3840 |
OperatingSystem exit:1 |
|
3841 |
] do:[ |
|
3842 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
3843 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
3844 |
] |
|
3845 |
] ifFalse:[ |
|
3846 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
3847 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
3848 |
]. |
|
3849 |
||
3850 |
"/ |
|
3851 |
"/ non-GUI apps exit after the startup; |
|
3852 |
"/ assume that GUI apps have created & opened some view ... |
|
3853 |
"/ |
|
3854 |
Display isNil ifTrue:[ |
|
3855 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
3856 |
Smalltalk exit:11. |
|
3857 |
]. |
|
16666 | 3858 |
"/ "/ |
3859 |
"/ "/ GUI apps exit after the last user process has finished |
|
3860 |
"/ "/ |
|
3861 |
"/ Display exitOnLastClose:true. |
|
3862 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
|
18668 | 3863 |
] newProcess. |
3864 |
process priority:(Processor userSchedulingPriority). |
|
3865 |
process name:'main'. |
|
3866 |
process beGroupLeader. |
|
3867 |
process resume. |
|
3868 |
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
|
3869 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3870 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3871 |
StandAlone ifTrue:[ |
18668 | 3872 |
Display notNil ifTrue:[ |
3873 |
FlyByHelp notNil ifTrue:[ |
|
3874 |
FlyByHelp start |
|
3875 |
]. |
|
3876 |
]. |
|
16211 | 3877 |
]. |
3878 |
||
3879 |
Display notNil ifTrue:[ |
|
18668 | 3880 |
Display exitOnLastClose:true. |
16211 | 3881 |
]. |
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3882 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3883 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3884 |
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
|
3885 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3886 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3887 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3888 |
or:[HeadlessOperation |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3889 |
or:[StandAlone]]]) ifTrue:[ |
18668 | 3890 |
Processor exitWhenNoMoreUserProcesses:true. |
3891 |
Processor dispatchLoop. |
|
3892 |
"done - the last process finished" |
|
3893 |
'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
|
3894 |
] ifFalse:[ |
18668 | 3895 |
StandAlone ifFalse:[ |
3896 |
self readEvalPrint |
|
3897 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3898 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3899 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3900 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3901 |
|
13526 | 3902 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
3903 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
13893 | 3904 |
"Modified: / 07-01-2012 / 12:59:23 / cg" |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3905 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3906 |
|
10641 | 3907 |
openDisplay |
3908 |
"try to open a display connection. |
|
3909 |
If so, also read display- and keyboard.rc" |
|
3910 |
||
13385 | 3911 |
|commandName| |
3912 |
||
3913 |
commandName := Smalltalk commandName. |
|
3914 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 3915 |
|
10641 | 3916 |
Display isNil ifTrue:[ |
18668 | 3917 |
Screen notNil ifTrue:[ |
3918 |
[ |
|
3919 |
Screen openDefaultDisplay:nil. |
|
3920 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
3921 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
|
3922 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
|
3923 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
3924 |
HeadlessOperation == true ifFalse:[ |
|
3925 |
OperatingSystem exit:1. |
|
3926 |
]. |
|
3927 |
]. |
|
3928 |
||
3929 |
Display notNil ifTrue:[ |
|
3930 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
3931 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
3932 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
3933 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
3934 |
] |
|
3935 |
] |
|
3936 |
]. |
|
3937 |
] |
|
10641 | 3938 |
] |
3939 |
||
3940 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
3941 |
! |
|
3942 |
||
3943 |
readEvalPrint |
|
3944 |
"{ Pragma: +optSpace }" |
|
3945 |
||
16090 | 3946 |
Transcript showCR:(self hello). |
3947 |
Transcript showCR:(self copyrightString). |
|
3948 |
Transcript cr. |
|
3949 |
Transcript showCR:'Read-eval-print loop; exit with "#exit"; help with "?"'. |
|
3950 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
3951 |
ReadEvalPrintLoop new |
18668 | 3952 |
prompt:'ST> '; |
3953 |
doChunkFormat:false; |
|
3954 |
error:Stderr; |
|
3955 |
readEvalPrintLoop |
|
10641 | 3956 |
|
3957 |
"Modified: / 07-12-2006 / 17:35:19 / cg" |
|
3958 |
! |
|
3959 |
||
3960 |
restart |
|
3961 |
"startup after an image has been loaded; |
|
18385 | 3962 |
This is called by the VM's main entry - you should not find senders from Smalltalk. |
3963 |
||
10641 | 3964 |
there are three change-notifications made to dependents of ObjectMemory, |
3965 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
3966 |
||
3967 |
#earlySystemInstallation is sent for ST80 compatibility |
|
3968 |
||
3969 |
#earlyRestart is send first, nothing has been setup yet. |
|
18668 | 3970 |
(should be used to flush all device dependent entries) |
10641 | 3971 |
|
3972 |
#restarted is send right after. |
|
18668 | 3973 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 3974 |
|
3975 |
#returnFromSnapshot is sent last |
|
18668 | 3976 |
(should be used to restart processes, reOpen Streams which cannot |
3977 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
3978 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 3979 |
" |
3980 |
||
3981 |
|deb insp transcript idx| |
|
3982 |
||
3983 |
"/ |
|
3984 |
"/ when we arrive here, all objects from our previous life |
|
3985 |
"/ have been reloaded - however, some may still contain invalid device |
|
3986 |
"/ handles, display information etc. |
|
3987 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
3988 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
3989 |
"/ the previous classes. |
|
3990 |
||
3991 |
Initializing := true. |
|
3992 |
AbstractOperatingSystem initializeConcreteClass. |
|
3993 |
||
3994 |
ImageRestartTime := Timestamp now. |
|
3995 |
||
3996 |
CommandLine := CommandLineArguments copy. |
|
3997 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
3998 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
3999 |
||
4000 |
idx := CommandLineArguments indexOf:'-q'. |
|
4001 |
idx == 0 ifTrue:[ |
|
18668 | 4002 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 4003 |
]. |
4004 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4005 |
Object infoPrinting:false. |
4006 |
ObjectMemory infoPrinting:false. |
|
4007 |
CommandLineArguments removeAtIndex:idx. |
|
16269 | 4008 |
]. |
4009 |
||
10641 | 4010 |
"/ start catching SIGSEGV and SIGBUS |
4011 |
OperatingSystem enableHardSignalInterrupts. |
|
4012 |
||
4013 |
"/ reinit Filename |
|
4014 |
Filename reinitialize. |
|
4015 |
||
4016 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
4017 |
self flushPathCaches. |
|
15334 | 4018 |
self reinitializePackagePath. |
10641 | 4019 |
|
4020 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
4021 |
"/ after that, we can write to stderr. |
|
4022 |
self reinitStandardStreams. |
|
4023 |
||
4024 |
"/ redirect Transcript to Stderr during startup |
|
4025 |
transcript := Transcript. |
|
4026 |
Transcript := Stderr. |
|
4027 |
||
4028 |
"/ temporary switch back to dumb interface - |
|
4029 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
4030 |
insp := Inspector. |
|
4031 |
deb := Debugger. |
|
4032 |
deb notNil ifTrue:[ |
|
18668 | 4033 |
deb reinitialize |
10641 | 4034 |
]. |
4035 |
Inspector := MiniInspector. |
|
4036 |
Debugger := MiniDebugger. |
|
4037 |
||
4038 |
"/ reload any dynamically loaded objects. |
|
4039 |
"/ this must be done before doing anything else below, |
|
4040 |
"/ because the Processor may restart processes which use |
|
4041 |
"/ this code. |
|
4042 |
"/ Also, a dynamic object might be registered as dependent of |
|
4043 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
4044 |
||
4045 |
ObjectFileLoader notNil ifTrue:[ |
|
18668 | 4046 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
16269 | 4047 |
]. |
4048 |
||
10641 | 4049 |
"/ invalidate all display connections. |
4050 |
"/ This is required to avoid trouble if someone accesses |
|
4051 |
"/ a display during early startup. |
|
4052 |
Screen notNil ifTrue:[ |
|
18668 | 4053 |
Screen allScreens do:[:eachDisplay | |
4054 |
eachDisplay invalidateConnection. |
|
4055 |
]. |
|
10641 | 4056 |
]. |
4057 |
||
4058 |
ObjectMemory changed:#earlySystemInstallation. |
|
4059 |
||
4060 |
"/ reinitialize the Processor - restartable processes |
|
4061 |
"/ are now restarted here (but not yet scheduled). |
|
4062 |
Processor reinitialize. |
|
4063 |
||
4064 |
"/ flush device handles & recreate OS resources (if possible) |
|
4065 |
"/ (mostly view/GC/color & font stuff) |
|
4066 |
ObjectMemory |
|
18668 | 4067 |
changed:#earlyRestart; changed:#restarted. |
16269 | 4068 |
|
10641 | 4069 |
"/ start catching SIGINT and SIGQUIT |
4070 |
OperatingSystem enableUserInterrupts. |
|
4071 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 4072 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 4073 |
|
4074 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
4075 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
4076 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
4077 |
idx == 0 ifTrue:[ |
|
18668 | 4078 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 4079 |
]. |
4080 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4081 |
CommandLineArguments removeAtIndex:idx. |
10641 | 4082 |
] ifFalse:[ |
18668 | 4083 |
CallbackSignal := QuerySignal new. |
4084 |
[ |
|
4085 |
Class withoutUpdatingChangesDo:[ |
|
4086 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
4087 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
4088 |
self fileIn:'smalltalk_r.rc' |
|
4089 |
]. |
|
4090 |
] |
|
4091 |
] on:CallbackSignal do:[:ex| |
|
4092 |
"/ now, display and view-stuff works; |
|
4093 |
"/ back to the previous debugging interface |
|
4094 |
Inspector := insp. |
|
4095 |
Debugger := deb. |
|
4096 |
||
4097 |
"/ reinstall Transcript, if not changed during restart. |
|
4098 |
"/ if there was no Transcript, go to stderr |
|
4099 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4100 |
Transcript := transcript. |
|
4101 |
]. |
|
4102 |
Initializing := false. |
|
4103 |
ex proceed. |
|
4104 |
]. |
|
4105 |
CallbackSignal := nil. |
|
10641 | 4106 |
]. |
4107 |
||
4108 |
"/ reinitialization (restart) of Display is normally performed |
|
4109 |
"/ in the restart script. If this has not been run for some reason, |
|
4110 |
"/ do in now. |
|
4111 |
Initializing ifTrue:[ |
|
18668 | 4112 |
Display notNil ifTrue:[ |
4113 |
[ |
|
4114 |
Display reinitializeFor:Screen defaultDisplayName. |
|
4115 |
] on:Screen deviceOpenErrorSignal do:[ |
|
4116 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
4117 |
Screen defaultDisplayName errorPrintCR. |
|
4118 |
OperatingSystem exit:1. |
|
4119 |
]. |
|
4120 |
]. |
|
4121 |
"/ now, display and view-stuff works; |
|
4122 |
"/ back to the previous debugging interface |
|
4123 |
||
4124 |
Inspector := insp. |
|
4125 |
Debugger := deb. |
|
4126 |
||
4127 |
"/ reinstall Transcript, if not changed during restart. |
|
4128 |
"/ if there was no Transcript, go to stderr |
|
4129 |
||
4130 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4131 |
Transcript := transcript. |
|
4132 |
]. |
|
4133 |
Initializing := false. |
|
10641 | 4134 |
]. |
4135 |
Screen notNil ifTrue:[ |
|
18668 | 4136 |
"clean up leftover screens (and views) that haven't been reopened. |
4137 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
4138 |
Screen allScreens copy do:[:eachDisplay | |
|
4139 |
eachDisplay isOpen ifFalse:[ |
|
4140 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
4141 |
eachDisplay errorPrintCR. |
|
4142 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
4143 |
] |
|
4144 |
]. |
|
10641 | 4145 |
]. |
4146 |
||
4147 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 4148 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
18668 | 4149 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4150 |
]. |
10641 | 4151 |
self mainStartup:true |
4152 |
||
13526 | 4153 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
4154 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 4155 |
! |
4156 |
||
11399 | 4157 |
showSplashMessage:aString |
4158 |
"put the message into the splash screen (if there is one). |
|
4159 |
Use this for messages during startup" |
|
4160 |
||
4161 |
self showSplashMessage:aString color:nil. |
|
4162 |
! |
|
4163 |
||
11388 | 4164 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 4165 |
"put the message into the splash screen (if there is one)." |
4166 |
||
11388 | 4167 |
%{ |
4168 |
#ifdef WIN32 |
|
4169 |
extern void __win32_splashMessage(); |
|
4170 |
char *msg = (char *)0; |
|
4171 |
int clr = 0; |
|
4172 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4173 |
if (__isStringLike(aMessageStringOrNil)) { |
18668 | 4174 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4175 |
} |
4176 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
18668 | 4177 |
clr = __intVal(rgbValueOrNil); |
4178 |
__win32_splashMessageColor(clr); |
|
11388 | 4179 |
} |
4180 |
__win32_splashMessage(msg); |
|
4181 |
#endif |
|
4182 |
%} |
|
4183 |
! |
|
4184 |
||
4185 |
splashInfo:aString |
|
11389 | 4186 |
"like infoPrintCR, |
4187 |
but in addition put the message into the splash screen (if there is one). |
|
4188 |
Use this for info messages during startup" |
|
4189 |
||
12883 | 4190 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4191 |
self showSplashMessage:aString color:nil. |
4192 |
! |
|
4193 |
||
7563 | 4194 |
start |
4195 |
"main startup, if there is a Display, initialize it |
|
4196 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
617 | 4197 |
|
15872 | 4198 |
|idx graphicalMode arg didReadRCFile keepSplashWindow| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4199 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4200 |
graphicalMode := true. |
617 | 4201 |
Initializing := true. |
4202 |
||
15872 | 4203 |
keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]. |
4204 |
"/ now done AFTER reading smalltalk.rc |
|
4205 |
"/ keepSplashWindow ifFalse:[ |
|
4206 |
"/ self hideSplashWindow. "/ if there is one, it's now time to hide it |
|
4207 |
"/ ]. |
|
13526 | 4208 |
|
617 | 4209 |
" |
4210 |
while reading patches- and rc-file, do not add things into change-file |
|
4211 |
" |
|
4212 |
Class withoutUpdatingChangesDo:[ |
|
18669 | 4213 |
|commandFile defaultRC prevCatchSetting |
4214 |
isEval isPrint isFilter isRepl idxFileArg process| |
|
4215 |
||
4216 |
isEval := isPrint := isFilter := isRepl := false. |
|
4217 |
didReadRCFile := false. |
|
4218 |
||
4219 |
StandAlone ifFalse:[ |
|
4220 |
self initializeVerboseFlags. |
|
4221 |
||
4222 |
"/ |
|
4223 |
"/ look for any '-q', '-e', '-l' or '-f' command line arguments |
|
4224 |
"/ and handle them; |
|
4225 |
"/ read startup and patches file |
|
4226 |
"/ |
|
4227 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4228 |
isRepl := (idx ~~ 0). |
|
4229 |
||
4230 |
idx := CommandLineArguments indexOfAny:#('-q' '--silent'). |
|
4231 |
idx ~~ 0 ifTrue:[ |
|
4232 |
Object infoPrinting:false. |
|
4233 |
ObjectMemory infoPrinting:false. |
|
4234 |
CommandLineArguments removeAtIndex:idx. |
|
4235 |
SilentLoading := true. |
|
4236 |
]. |
|
4237 |
||
4238 |
[ |
|
4239 |
idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath'). |
|
4240 |
idx ~~ 0 |
|
4241 |
] whileTrue:[ |
|
4242 |
arg := CommandLineArguments at:idx + 1. |
|
4243 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4244 |
self packagePath addLast:arg. |
|
4245 |
VerboseStartup == true ifTrue:[ |
|
4246 |
('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR. |
|
4247 |
]. |
|
4248 |
]. |
|
4249 |
||
4250 |
[ |
|
4251 |
idx := CommandLineArguments indexOfAny:#('-l' '--load'). |
|
4252 |
idx ~~ 0 |
|
4253 |
] whileTrue:[ |
|
4254 |
arg := CommandLineArguments at:idx + 1. |
|
4255 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4256 |
arg asFilename exists ifTrue:[ |
|
4257 |
Smalltalk fileIn:arg |
|
4258 |
] ifFalse:[ |
|
4259 |
Smalltalk loadPackage:arg |
|
4260 |
]. |
|
4261 |
]. |
|
4262 |
||
4263 |
"/ look for a '-e filename' or '--execute filename' argument |
|
4264 |
"/ this will force fileIn of filename only, no standard startup. |
|
4265 |
||
4266 |
idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script'). |
|
4267 |
idx ~~ 0 ifTrue:[ |
|
4268 |
SilentLoading := true. |
|
4269 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4270 |
||
4271 |
CommandLineArguments |
|
4272 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4273 |
||
4274 |
self startSchedulerAndBackgroundCollector. |
|
4275 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4276 |
Initializing := false. |
|
4277 |
||
4278 |
process := [ |
|
4279 |
VerboseStartup == true ifTrue:[ |
|
4280 |
('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR. |
|
4281 |
]. |
|
4282 |
UserInterrupt handle:[:ex | |
|
4283 |
self exit:128+(OperatingSystem sigINT). |
|
4284 |
] do:[ |
|
4285 |
arg = '-' ifTrue:[ |
|
4286 |
self fileInStream:Stdin |
|
4287 |
lazy:nil |
|
4288 |
silent:nil |
|
4289 |
logged:false |
|
4290 |
addPath:nil |
|
4291 |
] ifFalse:[ |
|
4292 |
IsSTScript := true. |
|
4293 |
self fileIn:arg. |
|
4294 |
]. |
|
4295 |
]. |
|
4296 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4297 |
"/ then do not exit |
|
4298 |
Display notNil ifTrue:[ |
|
4299 |
Display exitOnLastClose:true. |
|
4300 |
Display checkForEndOfDispatch. |
|
4301 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4302 |
] ifFalse:[ |
|
4303 |
self exit. |
|
4304 |
]. |
|
4305 |
] newProcess. |
|
4306 |
process priority:(Processor userSchedulingPriority). |
|
4307 |
process name:'main'. |
|
4308 |
process beGroupLeader. |
|
4309 |
process resume. |
|
4310 |
||
4311 |
Processor dispatchLoop. |
|
4312 |
self exit |
|
4313 |
]. |
|
4314 |
||
4315 |
"look for a '-f filename' or '--file filename' argument |
|
4316 |
if scripting, this is loaded before -P, -E or -R action. |
|
4317 |
if not scripting, this will force evaluation of filename instead of smalltalk.rc" |
|
4318 |
idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file'). |
|
4319 |
(idxFileArg ~~ 0) ifTrue:[ |
|
4320 |
commandFile := CommandLineArguments at:idxFileArg+1. |
|
4321 |
CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg. |
|
4322 |
]. |
|
4323 |
||
4324 |
"/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation) |
|
4325 |
"/ or -F/--filter or a '--repl' argument |
|
4326 |
"/ E, P and F this will force evaluation of expr only, no standard startup |
|
4327 |
"/ repl go into an interactive loop. |
|
4328 |
idx := CommandLineArguments indexOfAny:#('-E' '--eval'). |
|
4329 |
(isEval := (idx ~~ 0)) ifFalse:[ |
|
4330 |
idx := CommandLineArguments indexOfAny:#('-P' '--print'). |
|
4331 |
(isPrint := (idx ~~ 0)) ifFalse:[ |
|
4332 |
idx := CommandLineArguments indexOfAny:#('-F' '--filter'). |
|
4333 |
(isFilter := (idx ~~ 0)) ifFalse:[ |
|
4334 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
4335 |
isRepl := (idx ~~ 0) |
|
4336 |
]. |
|
4337 |
]. |
|
4338 |
]. |
|
4339 |
||
4340 |
(isEval | isPrint | isFilter | isRepl) ifTrue:[ |
|
4341 |
isRepl ifFalse:[ |
|
4342 |
CommandLineArguments size <= idx ifTrue:[ |
|
4343 |
'stx: missing argument after -E/-P/-F' errorPrintCR. |
|
4344 |
self exit:1. |
|
4345 |
]. |
|
4346 |
arg := CommandLineArguments at:idx + 1. |
|
4347 |
CommandLineArguments removeAtIndex:idx+1. |
|
4348 |
]. |
|
4349 |
CommandLineArguments removeAtIndex:idx. |
|
4350 |
||
4351 |
self startSchedulerAndBackgroundCollector. |
|
4352 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4353 |
Initializing := false. |
|
4354 |
||
4355 |
"/ enable this, so we can provide $1..$n in the script |
|
4356 |
ParserFlags allowDollarInIdentifier:true. |
|
4357 |
ParserFlags warnDollarInIdentifier:false. |
|
4358 |
||
4359 |
"/ add bindings for arguments |
|
4360 |
CommandLineArguments doWithIndex:[:arg :i | |
|
4361 |
Workspace workspaceVariableAt:('_$',i printString) put:arg. |
|
4362 |
]. |
|
4363 |
||
4364 |
"/ all of the above allow for a -f file to be loaded before any other action |
|
4365 |
(commandFile notNil) ifTrue:[ |
|
4366 |
VerboseStartup == true ifTrue:[ |
|
4367 |
('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR. |
|
4368 |
]. |
|
4369 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4370 |
('Smalltalk [error]: "', commandFile, '" not found.') errorPrintCR. |
|
4371 |
OperatingSystem exit:1. |
|
4372 |
] |
|
4373 |
]. |
|
4374 |
||
4375 |
isRepl ifTrue:[ |
|
4376 |
self readEvalPrint. |
|
4377 |
self exit. |
|
4378 |
]. |
|
4379 |
||
4380 |
process := [ |
|
4381 |
VerboseStartup == true ifTrue:[ |
|
4382 |
('Smalltalk [info]: executing expression: "', arg, '".') infoPrintCR. |
|
4383 |
]. |
|
4384 |
UserInterrupt handle:[:ex | |
|
4385 |
self exit:128+(OperatingSystem sigINT). |
|
4386 |
] do:[ |
|
4387 |
isFilter ifTrue:[ |
|
4388 |
"/ --filter - apply code to each input line. |
|
4389 |
"/ compile code only once |
|
4390 |
Compiler |
|
4391 |
compile:'doIt:line ',arg |
|
4392 |
forClass:String |
|
4393 |
notifying:(EvalScriptingErrorHandler new source:arg). |
|
4394 |
||
4395 |
[Stdin atEnd] whileFalse:[ |
|
4396 |
|line| |
|
4397 |
||
4398 |
line := Stdin nextLine. |
|
4399 |
line doIt:line. |
|
4400 |
]. |
|
4401 |
] ifFalse:[ |
|
4402 |
"/ --print or --eval |
|
4403 |
|rslt| |
|
4404 |
||
4405 |
rslt := Parser new |
|
4406 |
evaluate:arg |
|
4407 |
notifying:(EvalScriptingErrorHandler new source:arg) |
|
4408 |
compile:true. |
|
4409 |
isPrint ifTrue:[ |
|
4410 |
rslt printCR. |
|
4411 |
]. |
|
4412 |
]. |
|
4413 |
]. |
|
4414 |
||
4415 |
"/ after the script, if Screen has been opened and there are any open windows, |
|
4416 |
"/ then do not exit |
|
4417 |
Display notNil ifTrue:[ |
|
4418 |
Display exitOnLastClose:true. |
|
4419 |
Display checkForEndOfDispatch. |
|
4420 |
Processor exitWhenNoMoreUserProcesses:true. |
|
4421 |
VerboseStartup == true ifTrue:[ |
|
4422 |
('Smalltalk [info]: display opened.') infoPrintCR. |
|
4423 |
]. |
|
4424 |
] ifFalse:[ |
|
4425 |
VerboseStartup == true ifTrue:[ |
|
4426 |
('Smalltalk [info]: no display - exit after script.') infoPrintCR. |
|
4427 |
]. |
|
4428 |
self exit. |
|
4429 |
]. |
|
4430 |
] newProcess. |
|
4431 |
process priority:(Processor userSchedulingPriority). |
|
4432 |
process name:'main'. |
|
4433 |
process beGroupLeader. |
|
4434 |
process resume. |
|
4435 |
||
4436 |
Processor dispatchLoop. |
|
4437 |
VerboseStartup == true ifTrue:[ |
|
4438 |
('Smalltalk [info]: exit normally.') infoPrintCR. |
|
4439 |
]. |
|
4440 |
self exit |
|
4441 |
]. |
|
4442 |
]. |
|
4443 |
||
4444 |
commandFile notNil ifTrue:[ |
|
4445 |
SilentLoading := true. "/ suppress the hello & copyright messages |
|
4446 |
self addStartBlock: |
|
4447 |
[ |
|
4448 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4449 |
('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4450 |
OperatingSystem exit:1. |
|
4451 |
]. |
|
4452 |
]. |
|
16091 | 4453 |
|
4454 |
"/ self startSchedulerAndBackgroundCollector. |
|
4455 |
"/ keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4456 |
"/ Initializing := false. |
|
4457 |
"/ |
|
4458 |
"/ (self secureFileIn:commandFile) ifFalse:[ |
|
4459 |
"/ ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4460 |
"/ OperatingSystem exit:1. |
|
4461 |
"/ ]. |
|
18669 | 4462 |
] ifFalse:[ |
4463 |
"/ look for <command>.rc |
|
4464 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4465 |
||
4466 |
commandFile := self commandName asFilename withSuffix:'rc'. |
|
4467 |
(didReadRCFile := commandFile exists and:[self secureFileIn:commandFile]) ifFalse:[ |
|
4468 |
StandAlone ifFalse:[ |
|
4469 |
defaultRC := 'smalltalk.rc' "/asFilename |
|
4470 |
] ifTrue:[ |
|
4471 |
defaultRC := 'stxapp.rc' "/asFilename |
|
4472 |
]. |
|
4473 |
"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to |
|
4474 |
to be started with different working directory than stx/projects/smalltalk !!!!!!" |
|
4475 |
||
4476 |
"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4477 |
didReadRCFile := (self getSystemFileName:defaultRC) notNil |
|
4478 |
and:[self secureFileIn:defaultRC]. |
|
4479 |
didReadRCFile ifFalse:[ |
|
4480 |
StandAlone ifFalse:[ |
|
4481 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4482 |
graphicalMode := false. |
|
4483 |
] |
|
4484 |
] |
|
4485 |
]. |
|
4486 |
||
4487 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4488 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4489 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4490 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4491 |
||
4492 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4493 |
didReadRCFile ifFalse:[ |
|
4494 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4495 |
||
4496 |
"/ |
|
4497 |
"/ No RC file found; |
|
4498 |
"/ Setup more default stuff |
|
4499 |
"/ |
|
4500 |
StandAlone ifFalse:[ |
|
4501 |
"/ its a smalltalk - proceed in interpreter. |
|
4502 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4503 |
graphicalMode := false. |
|
4504 |
]. |
|
4505 |
||
4506 |
"/ setup more defaults... |
|
13537 | 4507 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
4508 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
18669 | 4509 |
self addStartBlock:[ |
4510 |
self startSchedulerAndBackgroundCollector |
|
4511 |
]. |
|
4512 |
]. |
|
4513 |
]. |
|
4514 |
(CommandLineArguments includes:'--scripting') ifTrue:[ |
|
4515 |
self addStartBlock:[ |
|
4516 |
StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments. |
|
4517 |
]. |
|
4518 |
]. |
|
617 | 4519 |
]. |
4520 |
||
10644 | 4521 |
HeadlessOperation ifTrue:[ |
18669 | 4522 |
graphicalMode := false. |
15872 | 4523 |
]. |
4524 |
||
4525 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4526 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4527 |
|
15872 | 4528 |
"Modified: / 17-12-2013 / 16:44:40 / cg" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4529 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4530 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4531 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4532 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4533 |
Processor supportDynamicPriorities:true. |
13537 | 4534 |
|
4535 |
ObjectMemory startBackgroundCollectorAt:5. |
|
4536 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4537 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4538 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4539 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4540 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4541 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4542 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4543 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4544 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4545 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4546 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4547 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4548 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4549 |
p := |
18668 | 4550 |
[ |
4551 |
self executeStartBlocks. |
|
4552 |
] newProcess. |
|
12022 | 4553 |
|
4554 |
p |
|
18668 | 4555 |
priority:(Processor userSchedulingPriority); |
4556 |
name:'start block handler'; |
|
4557 |
beGroupLeader; |
|
4558 |
resume. |
|
13892 | 4559 |
|
13893 | 4560 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 4561 |
! ! |
4562 |
||
13947 | 4563 |
!Smalltalk class methodsFor:'startup and exit'! |
4564 |
||
4565 |
addExitBlock:aBlock |
|
4566 |
"{ Pragma: +optSpace }" |
|
4567 |
||
4568 |
"add a block to be executed when Smalltalk finishes. |
|
4569 |
This feature is currently not used anywhere - but could be useful for |
|
4570 |
cleanup in stand alone applications. |
|
4571 |
||
4572 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
4573 |
#aboutToQuit." |
|
4574 |
||
4575 |
ExitBlocks isNil ifTrue:[ |
|
18668 | 4576 |
ExitBlocks := OrderedCollection with:aBlock |
13947 | 4577 |
] ifFalse:[ |
18668 | 4578 |
ExitBlocks add:aBlock |
13947 | 4579 |
] |
4580 |
! |
|
4581 |
||
4582 |
addImageStartBlock:aBlock |
|
4583 |
"{ Pragma: +optSpace }" |
|
4584 |
||
4585 |
"add a blocks to be executed in a separate process after |
|
4586 |
everything has been initialized. |
|
4587 |
These blocks will be executed after an image restart." |
|
4588 |
||
4589 |
ImageStartBlocks isNil ifTrue:[ |
|
18668 | 4590 |
ImageStartBlocks := OrderedCollection with:aBlock |
13947 | 4591 |
] ifFalse:[ |
18668 | 4592 |
ImageStartBlocks add:aBlock |
13947 | 4593 |
] |
4594 |
||
4595 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
4596 |
! |
|
4597 |
||
4598 |
addStartBlock:aBlock |
|
15980 | 4599 |
"to be called ONLY during very early startup (before the process scheduler |
4600 |
is started) to add a block to be executed in a separate process after |
|
4601 |
everything has been initialized. |
|
4602 |
Used to allow a startup script (which is executed BEFORE the scheduler and |
|
4603 |
UI display is startup up) to add actions which require those subsystems to |
|
4604 |
be operating. |
|
4605 |
These blocks will be executed only once and not be executed after an image restart. |
|
13947 | 4606 |
Initial processes such as the launcher are usually started here |
15980 | 4607 |
(see smalltalk.rc / private.rc). |
4608 |
ONLY to be called from such an rc file." |
|
13947 | 4609 |
|
4610 |
"{ Pragma: +optSpace }" |
|
4611 |
||
15980 | 4612 |
"/ to protect against "mis-users" of this mehtod... |
4613 |
Initializing ifFalse:[ |
|
18668 | 4614 |
aBlock value |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
4615 |
] ifTrue:[ |
18668 | 4616 |
StartBlocks isNil ifTrue:[ |
4617 |
StartBlocks := OrderedCollection with:aBlock |
|
4618 |
] ifFalse:[ |
|
4619 |
StartBlocks add:aBlock |
|
4620 |
] |
|
15980 | 4621 |
]. |
13947 | 4622 |
|
4623 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
4624 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
4625 |
! |
|
4626 |
||
4627 |
exit |
|
4628 |
"{ Pragma: +optSpace }" |
|
4629 |
||
4630 |
"finish the Smalltalk system" |
|
4631 |
||
4632 |
self exit:0 |
|
4633 |
"not reached" |
|
4634 |
||
4635 |
"Be careful evaluating this |
|
4636 |
Smalltalk exit |
|
4637 |
" |
|
4638 |
! |
|
4639 |
||
4640 |
exit:statusInteger |
|
4641 |
"{ Pragma: +optSpace }" |
|
4642 |
||
4643 |
"finish the Smalltalk system" |
|
4644 |
||
4645 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
4646 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
4647 |
ExitBlocks notNil ifTrue:[ |
|
18668 | 4648 |
ExitBlocks do:[:aBlock | |
4649 |
aBlock value |
|
4650 |
] |
|
13947 | 4651 |
]. |
4652 |
OperatingSystem exit:statusInteger |
|
4653 |
"not reached" |
|
4654 |
||
4655 |
"Be careful evaluating this |
|
4656 |
Smalltalk exit:1 |
|
4657 |
" |
|
19014 | 4658 |
! |
4659 |
||
4660 |
exitOrError:exitCode |
|
4661 |
"exit only if running as standalone application. |
|
4662 |
Raise an error in the development system. |
|
4663 |
Useful for testing standalone apps which should not kill |
|
4664 |
your development system." |
|
4665 |
||
4666 |
self isStandAloneApp ifTrue:[ |
|
4667 |
self exit:exitCode. |
|
4668 |
]. |
|
4669 |
self error:'standalone smalltalk would exit here with exit code: ', exitCode printString. |
|
4670 |
||
4671 |
" |
|
4672 |
self exitOrError:0 |
|
4673 |
" |
|
13947 | 4674 |
! ! |
4675 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4676 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 4677 |
|
10641 | 4678 |
commandLine |
4679 |
"return the full command line arguments (with which ST/X was started)" |
|
4680 |
||
4681 |
^ CommandLine |
|
4682 |
||
4683 |
" |
|
4684 |
Smalltalk commandLine |
|
4685 |
" |
|
4686 |
||
4687 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
4688 |
! |
|
4689 |
||
4690 |
commandLineArgumentNamed:aString |
|
16110 | 4691 |
"extract a named argument from the command line arguments. |
4692 |
This searches for the given string in the command line and returns the next argument after it." |
|
10641 | 4693 |
|
4694 |
|args index| |
|
4695 |
||
4696 |
args := self commandLineArguments. |
|
4697 |
index := args indexOf:aString. |
|
4698 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
18668 | 4699 |
^ args at:index+1 |
10641 | 4700 |
]. |
4701 |
^ nil. |
|
4702 |
||
4703 |
" |
|
4704 |
self commandLineArgumentNamed:'-display' |
|
4705 |
" |
|
4706 |
! |
|
4707 |
||
4708 |
commandLineArguments |
|
4709 |
"return the user command line arguments; |
|
4710 |
This is a collection of strings (separated command line words), |
|
4711 |
from which the internal startup arguments have already been removed. |
|
4712 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
4713 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
4714 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
4715 |
||
4716 |
^ CommandLineArguments |
|
4717 |
||
4718 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
4719 |
! |
|
4720 |
||
4721 |
commandName |
|
4722 |
"return the excutables name - this is normally 'stx', |
|
4723 |
but can be something else for standAlone apps." |
|
4724 |
||
4725 |
^ CommandName. |
|
4726 |
||
4727 |
" |
|
4728 |
Smalltalk commandName |
|
4729 |
" |
|
4730 |
||
4731 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
4732 |
! |
|
4733 |
||
4734 |
hasNoConsole |
|
4735 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
4736 |
i.e. there should be no writing to stdout/stderr" |
|
4737 |
||
4738 |
^ HasNoConsole ? false |
|
4739 |
||
4740 |
" |
|
10071 | 4741 |
Smalltalk hasNoConsole |
9054 | 4742 |
" |
4743 |
! |
|
4744 |
||
17435 | 4745 |
ignoreAssertions |
4746 |
"return true, if assertions are to be ignored (i.e. not executed). |
|
4747 |
This is false by default in an IDE (i.e. full smalltalk), |
|
4748 |
but can be set to true for standAlone applications |
|
4749 |
(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
|
4750 |
However, it may make the app a little faster, if assertions are compatational |
17435 | 4751 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
4752 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
4753 |
^ IgnoreAssertions ? false |
17435 | 4754 |
! |
4755 |
||
17438 | 4756 |
ignoreAssertions:aBoolean |
4757 |
"set to true, if assertions are to be ignored (i.e. not executed). |
|
4758 |
This is false by default in an IDE (i.e. full smalltalk), |
|
4759 |
but can be set to true for standAlone applications |
|
4760 |
(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
|
4761 |
However, it may make the app a little faster, if assertions are compatational |
17438 | 4762 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
4763 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
4764 |
IgnoreAssertions := aBoolean |
17438 | 4765 |
! |
4766 |
||
10641 | 4767 |
isHeadless |
4768 |
"return true, if this is a headless application |
|
4769 |
i.e. no default Display connection is required/used" |
|
4770 |
||
4771 |
^ HeadlessOperation ? false |
|
4772 |
||
4773 |
" |
|
10071 | 4774 |
Smalltalk isHeadless |
9029 | 4775 |
" |
4776 |
! |
|
4777 |
||
10641 | 4778 |
isPlugin |
4779 |
"return true, if this is a plugin application |
|
4780 |
i.e. running in a browserWindow" |
|
4781 |
||
4782 |
^ IsPlugin ? false |
|
4783 |
||
4784 |
" |
|
10071 | 4785 |
Smalltalk isPlugin |
9029 | 4786 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4787 |
! |
4957 | 4788 |
|
10641 | 4789 |
isSTScript |
4790 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
4791 |
||
4792 |
^ IsSTScript ? false |
|
4793 |
||
4794 |
" |
|
4795 |
Smalltalk isSTScript |
|
4796 |
" |
|
4797 |
||
4798 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
4799 |
! |
|
4800 |
||
4801 |
isSharedLibraryComponent |
|
4802 |
"return true, if this is a shared library component of another application |
|
4803 |
i.e. a dll within another app." |
|
4804 |
||
4805 |
^ IsSharedLibraryComponent ? false |
|
4806 |
||
4807 |
" |
|
4808 |
Smalltalk isSharedLibraryComponent |
|
4809 |
" |
|
4810 |
||
4811 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
4812 |
! |
|
4813 |
||
4814 |
isSmalltalkDevelopmentSystem |
|
4815 |
"return true, if this is a real smalltalk system |
|
17421 | 4816 |
i.e. NOT a stripped or a linked standAlone application (such as the webServer) |
10641 | 4817 |
and NOT a plugIn (i.e. running in a browser) |
4818 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
17421 | 4819 |
This is used to determine, whether debugging is possible/desired or not." |
10641 | 4820 |
|
4821 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
4822 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
4823 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 4824 |
^ self isStandAloneApp not. |
10641 | 4825 |
|
4826 |
" |
|
4827 |
Smalltalk isSmalltalkDevelopmentSystem |
|
4828 |
" |
|
4829 |
||
4830 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
4831 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
15565 | 4832 |
"Modified (comment): / 27-07-2013 / 15:36:20 / cg" |
10641 | 4833 |
! |
4834 |
||
4835 |
isStandAloneApp |
|
4836 |
"return true, if this is a standAlone application |
|
4837 |
i.e. a stripped & linked application (such as the webServer) |
|
4838 |
in contrast to a full smalltalk (development) system." |
|
4839 |
||
4840 |
^ StandAlone ? false |
|
4841 |
||
4842 |
" |
|
10071 | 4843 |
Smalltalk isStandAloneApp |
9029 | 4844 |
" |
617 | 4845 |
! |
4846 |
||
13947 | 4847 |
isStandAloneDebug |
4848 |
"return true, if this is a standAlone application which |
|
4849 |
was started with the -debug option." |
|
4850 |
||
4851 |
^ DebuggingStandAlone ? false |
|
4852 |
||
4853 |
" |
|
4854 |
Smalltalk isStandAloneDebug |
|
4855 |
" |
|
4856 |
||
4857 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
4858 |
! |
|
4859 |
||
10641 | 4860 |
startupArguments |
4861 |
"return the arguments passed to StartupClass when stx gets started. |
|
4862 |
Usually these are nil, |
|
4863 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
4864 |
a simple way to configure and create stand-alone applications" |
|
4865 |
||
4866 |
^ StartupArguments |
|
4867 |
||
4868 |
" |
|
10071 | 4869 |
Smalltalk startupArguments |
9029 | 4870 |
" |
7563 | 4871 |
! |
4872 |
||
10641 | 4873 |
startupClass |
4874 |
"return the class, that will get the start message when smalltalk |
|
4875 |
starts and its non-nil. Usually this is nil, |
|
4876 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
4877 |
a simple way to configure and create stand-alone applications" |
|
4878 |
||
4879 |
^ StartupClass |
|
4880 |
||
4881 |
" |
|
10071 | 4882 |
Smalltalk startupClass |
9029 | 4883 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4884 |
! |
8570 | 4885 |
|
10641 | 4886 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
4887 |
"{ Pragma: +optSpace }" |
|
4888 |
||
4889 |
"set the class, selector and arguments to be performed when smalltalk |
|
4890 |
starts. Setting those before saving a snapshot, will make the saved |
|
4891 |
image come up executing your application (instead of the normal mainloop)" |
|
4892 |
||
4893 |
StartupClass := aClass. |
|
4894 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4895 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4896 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4897 |
|
10641 | 4898 |
startupSelector |
4899 |
"return the selector, that will be sent to StartupClass. |
|
4900 |
Usually this is nil, |
|
4901 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
4902 |
a simple way to configure and create stand-alone applications" |
|
4903 |
||
4904 |
^ StartupSelector |
|
4905 |
||
4906 |
" |
|
10071 | 4907 |
Smalltalk startupSelector |
9029 | 4908 |
" |
10641 | 4909 |
! |
4910 |
||
4911 |
wasStartedFromImage |
|
4912 |
"return true, if this smalltalk was started from an image, |
|
4913 |
as opposed to a fresh and clean startup" |
|
4914 |
||
4915 |
^ ImageRestartTime notNil |
|
4916 |
||
4917 |
" |
|
4918 |
Smalltalk wasStartedFromImage |
|
4919 |
" |
|
70 | 4920 |
! ! |
4921 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4922 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 4923 |
|
10641 | 4924 |
language |
4925 |
"return the language setting" |
|
4926 |
||
4927 |
^ Language |
|
4928 |
||
4929 |
" |
|
4930 |
Smalltalk language |
|
4931 |
" |
|
4932 |
||
4933 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
4934 |
! |
|
4935 |
||
4936 |
language:aLanguageSymbol |
|
10991 | 4937 |
"set the language - send out change notifications" |
10641 | 4938 |
|
18733 | 4939 |
aLanguageSymbol ~= Language ifTrue:[ |
4940 |
Language := aLanguageSymbol asSymbol. |
|
4941 |
self changed:#Language |
|
4942 |
]. |
|
10641 | 4943 |
|
4944 |
" |
|
4945 |
Smalltalk language:#de |
|
4946 |
" |
|
4947 |
||
4948 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
4949 |
! |
|
4950 |
||
4951 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 4952 |
"set the language & territory - send out change notifications" |
10641 | 4953 |
|
18733 | 4954 |
((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[ |
4955 |
Language := aLanguageSymbol asSymbol. |
|
4956 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
4957 |
self changed:#Language |
|
4958 |
]. |
|
10641 | 4959 |
|
4960 |
" |
|
4961 |
Smalltalk language:#de territory:#de |
|
4962 |
" |
|
4963 |
||
4964 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
4965 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
4966 |
! |
|
4967 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4968 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4969 |
"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
|
4970 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4971 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4972 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4973 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4974 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4975 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4976 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4977 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4978 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4979 |
|
10641 | 4980 |
languageTerritory |
4981 |
"return the language territory setting" |
|
7563 | 4982 |
|
4983 |
^ LanguageTerritory |
|
4984 |
! |
|
4985 |
||
10641 | 4986 |
languageTerritory:aTerritorySymbol |
10991 | 4987 |
"set the language territory - send out change notifications" |
10641 | 4988 |
|
18924 | 4989 |
aTerritorySymbol ~= LanguageTerritory ifTrue:[ |
4990 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
4991 |
self changed:#LanguageTerritory |
|
4992 |
]. |
|
4993 |
||
10641 | 4994 |
" |
4995 |
Time now |
|
4996 |
||
4997 |
Smalltalk languageTerritory:#us. |
|
4998 |
Time now |
|
4999 |
||
5000 |
Smalltalk languageTerritory:#de. |
|
5001 |
Time now |
|
5002 |
" |
|
5003 |
||
5004 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
5005 |
! |
|
5006 |
||
5007 |
setLanguage:aLanguageSymbol |
|
10991 | 5008 |
"set the language without change notification" |
10641 | 5009 |
|
5010 |
Language := aLanguageSymbol. |
|
10991 | 5011 |
! |
5012 |
||
5013 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
5014 |
"set the language & territory - no change notification" |
|
5015 |
||
5016 |
Language := aLanguageSymbol asSymbol. |
|
5017 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 5018 |
! ! |
5019 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5020 |
!Smalltalk class methodsFor:'system management'! |
70 | 5021 |
|
10641 | 5022 |
compressSources |
5023 |
"{ Pragma: +optSpace }" |
|
5024 |
||
5025 |
"compress the sources file, and remove all method source strings |
|
5026 |
from the system and replace them by refs to a string in the source file. |
|
5027 |
This is a bit different in ST/X than in other smalltalks, |
|
5028 |
since we use per-class sourcefiles for the compiled classes, |
|
5029 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
5030 |
incremental compiled methods. |
|
5031 |
Therefore, only those sources which are not coming from compiled |
|
5032 |
methods are put into the 'st.src' file - all others are untouched. |
|
5033 |
This is being automated - so dont care for now." |
|
5034 |
||
5035 |
|newStream table source pos fileName| |
|
5036 |
||
5037 |
" |
|
5038 |
first, find all methods which contain either a string-ref |
|
5039 |
or an external string in the 'st.src' file |
|
5040 |
" |
|
5041 |
newStream := 'src.tmp' asFilename writeStream. |
|
5042 |
||
5043 |
table := IdentityDictionary new:100. |
|
5044 |
||
5045 |
Method allSubInstancesDo:[:aMethod | |
|
18668 | 5046 |
source := nil. |
5047 |
aMethod sourcePosition notNil ifTrue:[ |
|
5048 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
5049 |
source := aMethod source. |
|
5050 |
] |
|
5051 |
] ifFalse:[ |
|
5052 |
source := aMethod source |
|
5053 |
]. |
|
5054 |
||
5055 |
source notNil ifTrue:[ |
|
5056 |
pos := newStream position + 1. |
|
5057 |
newStream nextChunkPut:source. |
|
5058 |
||
5059 |
" |
|
5060 |
dont change the methods info - maybe some write error |
|
5061 |
occurs later, in that case we abort and leave everything |
|
5062 |
untouched. |
|
5063 |
" |
|
5064 |
table at:aMethod put:pos |
|
5065 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5066 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5067 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5068 |
newStream syncData; close. |
10641 | 5069 |
|
5070 |
" |
|
5071 |
now, rename the new source file, |
|
5072 |
" |
|
5073 |
fileName := (ObjectMemory nameForSources). |
|
5074 |
'src.tmp' asFilename renameTo:fileName. |
|
5075 |
||
5076 |
"good - now go over all changed methods, and change their |
|
5077 |
source reference" |
|
5078 |
||
5079 |
table keysAndValuesDo:[:aMethod :pos | |
|
18668 | 5080 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5081 |
"/ aMethod printCR. |
5082 |
]. |
|
5083 |
||
5084 |
" |
|
5085 |
Smalltalk compressSources |
|
5086 |
" |
|
5087 |
||
5088 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5089 |
! |
|
5090 |
||
5091 |
generateSingleSourceFile |
|
5092 |
"{ Pragma: +optSpace }" |
|
5093 |
||
5094 |
"generate the sources file, and remove all method source strings |
|
5095 |
from the system and replace them by refs to a string in the source file. |
|
5096 |
This makes the image independent from the per-class source files |
|
5097 |
and makes transportation of endUser applications easier, since |
|
5098 |
only 3 files (executable, image and sourceFile) need to be |
|
5099 |
transported." |
|
5100 |
||
5101 |
|newStream table source pos fileName| |
|
5102 |
||
5103 |
newStream := 'src.tmp' asFilename writeStream. |
|
5104 |
||
5105 |
table := IdentityDictionary new:100. |
|
5106 |
||
5107 |
Method allSubInstancesDo:[:aMethod | |
|
18668 | 5108 |
source := aMethod source. |
5109 |
source notNil ifTrue:[ |
|
5110 |
pos := newStream position + 1. |
|
5111 |
newStream nextChunkPut:source. |
|
5112 |
||
5113 |
" |
|
5114 |
dont change the methods info - maybe some write error |
|
5115 |
occurs later, in that case we abort and leave everything |
|
5116 |
untouched. |
|
5117 |
" |
|
5118 |
table at:aMethod put:pos |
|
5119 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5120 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5121 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5122 |
newStream syncData; close. |
10641 | 5123 |
|
5124 |
" |
|
5125 |
now, rename the new source file, |
|
5126 |
" |
|
5127 |
fileName := (ObjectMemory nameForSources). |
|
5128 |
'src.tmp' asFilename renameTo:fileName. |
|
5129 |
||
5130 |
"good - now go over all changed methods, and change their |
|
5131 |
source reference" |
|
5132 |
||
5133 |
table keysAndValuesDo:[:aMethod :pos | |
|
18668 | 5134 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5135 |
"/ aMethod printCR. |
5136 |
]. |
|
5137 |
||
5138 |
" |
|
5139 |
Smalltalk generateSingleSourceFile |
|
5140 |
" |
|
5141 |
||
5142 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5143 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
5144 |
! |
|
5145 |
||
15596 | 5146 |
installAutoloadedClassFromSourceFile:aFilename |
5147 |
"install aFilename (which must be a smalltalk source file) as autoloaded class |
|
5148 |
(extract the class definition chunk from the file and create an autoloaded |
|
5149 |
class stub for it)" |
|
5150 |
||
5151 |
|chunks filename| |
|
5152 |
||
5153 |
filename := aFilename asFilename. |
|
5154 |
||
5155 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
18668 | 5156 |
^ self |
15596 | 5157 |
] do:[ |
18668 | 5158 |
filename readingFileDo:[:s| |
5159 |
chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not]. |
|
5160 |
]. |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5161 |
]. |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5162 |
|
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5163 |
chunks |
18668 | 5164 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5165 |
thenDo:[:eachClassChunk | |
|
5166 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName" |
|
5167 |
]. |
|
15596 | 5168 |
|
5169 |
"Created: / 01-08-2013 / 16:57:26 / cg" |
|
5170 |
! |
|
5171 |
||
10641 | 5172 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
5173 |
"create & install an autoload stub for a class named: clsName, |
|
5174 |
to be loaded from package. |
|
5175 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5176 |
(otherwise, the newest revision will be loaded" |
|
5177 |
||
5178 |
^ self |
|
18668 | 5179 |
installAutoloadedClassNamed:clsName |
5180 |
category:cat |
|
5181 |
package:package |
|
5182 |
revision:revisionOrNil |
|
5183 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5184 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5185 |
|
10641 | 5186 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
5187 |
"create & install an autoload stub for a class named: clsName, |
|
5188 |
to be loaded from package. |
|
5189 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5190 |
(otherwise, the newest revision will be loaded" |
|
5191 |
||
5192 |
|clsSym cls| |
|
5193 |
||
5194 |
clsSym := clsName asSymbol. |
|
5195 |
||
5196 |
"/ install if not already compiled-in |
|
5197 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
18668 | 5198 |
Autoload subclass:clsSym |
5199 |
instanceVariableNames:'' |
|
5200 |
classVariableNames:'' |
|
5201 |
poolDictionaries:'' |
|
5202 |
category:cat |
|
5203 |
inEnvironment:Smalltalk. |
|
5204 |
||
5205 |
cls := self at:clsSym. |
|
5206 |
cls isNil ifTrue:[ |
|
5207 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
5208 |
] ifFalse:[ |
|
5209 |
cls package:package asSymbol. |
|
5210 |
revisionOrNil notNil ifTrue:[ |
|
5211 |
cls setBinaryRevision:revisionOrNil |
|
5212 |
] |
|
5213 |
] |
|
10641 | 5214 |
] ifFalse:[ |
18668 | 5215 |
"/ class already present - however, if unloaded, check for category/package change |
5216 |
cls isLoaded ifFalse:[ |
|
5217 |
package ~= cls package ifTrue:[ |
|
5218 |
cls withoutUpdatingChangesDo:[ |
|
5219 |
cls package:package asSymbol. |
|
5220 |
]. |
|
5221 |
]. |
|
5222 |
cat ~= cls category ifTrue:[ |
|
5223 |
cls withoutUpdatingChangesDo:[ |
|
5224 |
cls category:cat. |
|
5225 |
]. |
|
5226 |
]. |
|
5227 |
]. |
|
10641 | 5228 |
]. |
5229 |
^ cls. |
|
5230 |
||
5231 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
5232 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
5233 |
|
10641 | 5234 |
! |
5235 |
||
5236 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5237 |
"scan all packages and install all classes found there as |
10641 | 5238 |
autoloaded. This takes some time ..." |
5239 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5240 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5241 |
|
17588 | 5242 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
18668 | 5243 |
dirsConsulted := Set new. |
5244 |
||
5245 |
"/ along the package-path |
|
5246 |
self packagePath do:[:eachPathComponent | |
|
5247 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
|
5248 |
self |
|
5249 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
|
5250 |
rememberIn:dirsConsulted |
|
5251 |
maxLevels:15 |
|
5252 |
noAutoload:false |
|
5253 |
packageTop:eachPathComponent |
|
5254 |
showSplashInLevels:2. |
|
5255 |
] |
|
5256 |
]. |
|
5257 |
self splashInfo:nil. |
|
17548 | 5258 |
]. |
10641 | 5259 |
|
5260 |
" |
|
5261 |
Smalltalk installAutoloadedClasses |
|
5262 |
" |
|
5263 |
||
5264 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
5265 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
5266 |
! |
|
5267 |
||
5268 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
5269 |
"read the given abbreviation file; install all classes found there as |
|
5270 |
autoloaded. This takes some time ..." |
|
5271 |
||
5272 |
|f s| |
|
5273 |
||
5274 |
f := self getSystemFileName:anAbbrevFilePath. |
|
5275 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
5276 |
||
5277 |
f notNil ifTrue:[ |
|
18668 | 5278 |
f := f asFilename. |
5279 |
f isDirectory ifTrue:[ |
|
5280 |
f := f construct:'abbrev.stc' |
|
5281 |
]. |
|
5282 |
[ |
|
5283 |
s := f readStream. |
|
5284 |
self installAutoloadedClassesFromStream:s. |
|
5285 |
s close. |
|
5286 |
] on:FileStream openErrorSignal |
|
5287 |
do:[:ex| "do nothing"]. |
|
10641 | 5288 |
] |
5289 |
||
5290 |
" |
|
5291 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
5292 |
" |
|
5293 |
||
5294 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
5295 |
! |
|
5296 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5297 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5298 |
aFilename readingFileDo:[:abbrevStream | |
18668 | 5299 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5300 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5301 |
|
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5302 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5303 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5304 |
|
10641 | 5305 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5306 |
"read the given abbreviation file; |
|
5307 |
install all classes found there as autoloaded, and also update the |
|
5308 |
abbreviation (className-to-fileName mapping) table. |
|
5309 |
This takes some time ..." |
|
5310 |
||
5311 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
5312 |
||
5313 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
18668 | 5314 |
abbrevFileName := anAbbrevFileStream pathName. |
5315 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 5316 |
]. |
5317 |
||
5318 |
"/ yes, create any required nameSpace, without asking user. |
|
5319 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
5320 |
||
18668 | 5321 |
[anAbbrevFileStream atEnd] whileFalse:[ |
5322 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
5323 |
"Skip empty lines and comments" |
|
5324 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
5325 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 5326 |
"/ words := line asCollectionOfWords. |
5327 |
||
18668 | 5328 |
words := OrderedCollection new. |
5329 |
s2 := l readStream. |
|
5330 |
[s2 atEnd] whileFalse:[ |
|
5331 |
s2 skipSeparators. |
|
5332 |
s2 peek == $' ifTrue:[ |
|
5333 |
s2 next. |
|
5334 |
w := s2 upTo:$'. |
|
5335 |
s2 skipSeparators. |
|
5336 |
] ifFalse:[ |
|
5337 |
w := s2 upToSeparator |
|
5338 |
]. |
|
5339 |
words add:w |
|
5340 |
]. |
|
5341 |
words size < 3 ifTrue:[ |
|
5342 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
5343 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
5344 |
' (in ''' errorPrint. |
|
5345 |
anAbbrevFileStream pathName errorPrint. |
|
5346 |
''')' errorPrint |
|
5347 |
]. |
|
5348 |
': ' errorPrint. l errorPrintCR |
|
5349 |
] ifFalse:[ |
|
5350 |
clsName := (words at:1) asSymbol. |
|
5351 |
abbrev := (words at:2). |
|
5352 |
package := (words at:3) asSymbol. |
|
5353 |
cat := words at:4 ifAbsent:nil. |
|
5354 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
5355 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
5356 |
||
5357 |
(cat size == 0) ifTrue:[ |
|
5358 |
cat := 'autoloaded' |
|
5359 |
]. |
|
5360 |
||
5361 |
"/ on the fly, update the abbreviations |
|
5362 |
self setFilename:abbrev forClass:clsName package:package. |
|
5363 |
||
5364 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
5365 |
||
5366 |
cls := self |
|
5367 |
installAutoloadedClassNamed:clsName |
|
5368 |
category:cat |
|
5369 |
package:package |
|
5370 |
revision:nil |
|
5371 |
numClassInstVars:numClassInstVars. |
|
10641 | 5372 |
|
5373 |
"/ info notNil ifTrue:[ |
|
5374 |
"/ cls setComment:info. |
|
5375 |
"/ ]. |
|
18668 | 5376 |
] |
5377 |
] |
|
5378 |
] |
|
4458 | 5379 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5380 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5381 |
|
10641 | 5382 |
loadBinaries |
5383 |
"return true, if binaries should be loaded into the system, |
|
5384 |
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
|
5385 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5386 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5387 |
! |
3044 | 5388 |
|
10641 | 5389 |
loadBinaries:aBoolean |
5390 |
"{ Pragma: +optSpace }" |
|
5391 |
||
5392 |
"turn on/off loading of binary objects" |
|
5393 |
||
5394 |
aBoolean ifTrue:[ |
|
18668 | 5395 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
5396 |
LoadBinaries := true. |
|
5397 |
^ self |
|
5398 |
]. |
|
5399 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
10641 | 5400 |
]. |
5401 |
LoadBinaries := false |
|
5402 |
||
5403 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
5404 |
! |
|
5405 |
||
5406 |
logDoits |
|
5407 |
"return true if doits should go into the changes file |
|
5408 |
as well as changes - by default, this is off, since |
|
5409 |
it can blow up the changes file enormously ... |
|
5410 |
" |
|
5411 |
||
5412 |
^ LogDoits |
|
5413 |
||
5414 |
" |
|
5415 |
LogDoits := false |
|
3044 | 5416 |
LogDoits := true |
5417 |
" |
|
5418 |
! |
|
5419 |
||
10641 | 5420 |
logDoits:aBoolean |
5421 |
"{ Pragma: +optSpace }" |
|
5422 |
||
5423 |
"turn on/off logging of doits in the changes file. |
|
5424 |
By default, this is off, since it can blow up the |
|
5425 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5426 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5427 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5428 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5429 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5430 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5431 |
|
10641 | 5432 |
makeBytecodeMethods |
5433 |
"{ Pragma: +optSpace }" |
|
5434 |
||
5435 |
"walk over all methods and make each a bytecode method |
|
5436 |
iff it does not contain primitive C code. |
|
5437 |
Experimental and not yet used." |
|
5438 |
||
5439 |
Method allSubInstancesDo:[:aMethod | |
|
18707 | 5440 |
|newMethod| |
5441 |
||
5442 |
aMethod hasPrimitiveCode ifFalse:[ |
|
5443 |
"/ aMethod errorPrintCR. |
|
5444 |
newMethod := aMethod asByteCodeMethod. |
|
5445 |
newMethod ~~ aMethod ifTrue:[ |
|
5446 |
newMethod isNil ifTrue:[ |
|
5447 |
'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR. |
|
5448 |
] ifFalse:[ |
|
5449 |
aMethod becomeSameAs:newMethod |
|
5450 |
]. |
|
5451 |
] |
|
5452 |
]. |
|
10641 | 5453 |
]. |
5454 |
||
5455 |
" |
|
5456 |
Smalltalk makeBytecodeMethods |
|
5457 |
" |
|
5458 |
||
5459 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5460 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
5461 |
! |
|
5462 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5463 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5464 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5465 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5466 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5467 |
|dirsConsulted| |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5468 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5469 |
dirsConsulted := Set new. |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5470 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5471 |
self |
18707 | 5472 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
5473 |
rememberIn:dirsConsulted |
|
5474 |
maxLevels:15 |
|
5475 |
noAutoload:false |
|
5476 |
packageTop:nil |
|
5477 |
showSplashInLevels:-1. |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5478 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5479 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5480 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5481 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5482 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5483 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5484 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5485 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5486 |
|
10641 | 5487 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5488 |
"read all abbrev.stc files from and under aDirectory |
|
5489 |
and install autoloaded classes. |
|
15783 | 5490 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
5491 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
5492 |
named AUTOLOAD. |
|
5493 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
10641 | 5494 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
5495 |
||
11391 | 5496 |
self |
18668 | 5497 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
5498 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
5499 |
showSplashInLevels:0. |
|
11391 | 5500 |
|
5501 |
" |
|
5502 |
Smalltalk installAutoloadedClasses |
|
5503 |
" |
|
5504 |
||
5505 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
5506 |
! |
|
5507 |
||
12022 | 5508 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 5509 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5510 |
showSplashInLevels:showSplashInLevels |
|
5511 |
"read all abbrev.stc files from and under aDirectory |
|
5512 |
and install autoloaded classes. |
|
15783 | 5513 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
5514 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
5515 |
named AUTOLOAD. |
|
5516 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
11391 | 5517 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
5518 |
||
15783 | 5519 |
|dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC| |
10641 | 5520 |
|
5521 |
dir := aDirectory asFilename. |
|
15958 | 5522 |
|
5523 |
"/ Care for non-existent directories" |
|
5524 |
dir exists ifFalse:[ ^ self ]. |
|
5525 |
||
15783 | 5526 |
dirName := dir physicalPathName. "take care of symbolic links" |
11392 | 5527 |
|
5528 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
19117 | 5529 |
^ self |
10641 | 5530 |
]. |
5531 |
||
12377 | 5532 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
19117 | 5533 |
^ self. |
10641 | 5534 |
]. |
12377 | 5535 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
19117 | 5536 |
^ self. |
10641 | 5537 |
]. |
11392 | 5538 |
|
15783 | 5539 |
maxLevels == 0 ifTrue:[ |
19117 | 5540 |
Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName). |
5541 |
^ self |
|
15783 | 5542 |
]. |
5543 |
||
5544 |
dirsConsulted add:dirName. |
|
10641 | 5545 |
noAutoloadHere := noAutoloadIn. |
5546 |
noAutoloadHere ifFalse:[ |
|
19117 | 5547 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
5548 |
noAutoloadHere := true. |
|
5549 |
]. |
|
10641 | 5550 |
] ifTrue:[ |
19117 | 5551 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
5552 |
noAutoloadHere := false. |
|
5553 |
]. |
|
10641 | 5554 |
]. |
5555 |
||
11393 | 5556 |
showSplashInLevels >= 0 ifTrue:[ |
19117 | 5557 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
5558 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 5559 |
]. |
5560 |
||
10641 | 5561 |
"/ |
5562 |
"/ suppress installation as autoloaded in this and everything |
|
5563 |
"/ below; however, still traverse the directories to find packages ... |
|
5564 |
"/ |
|
15596 | 5565 |
haveAbbrevDotSTC := false. |
10641 | 5566 |
noAutoloadHere ifFalse:[ |
19117 | 5567 |
[ |
5568 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
5569 |
haveAbbrevDotSTC := true. |
|
5570 |
] on:FileStream openErrorSignal |
|
5571 |
do:[:ex| |
|
5572 |
"ignore this file" |
|
5573 |
]. |
|
10641 | 5574 |
]. |
5575 |
||
5576 |
[ |
|
19117 | 5577 |
directoryContents := dir directoryContents. |
10641 | 5578 |
] on:FileStream openErrorSignal do:[:ex| |
19117 | 5579 |
"non-accessible directory: we are done" |
5580 |
^ self |
|
16199 | 5581 |
]. |
5582 |
||
5583 |
directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set. |
|
10641 | 5584 |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5585 |
directoryContents removeAllFoundIn:#( |
19117 | 5586 |
'objbc' 'objvc' 'objmingw' |
5587 |
'doc' |
|
5588 |
'CVS' |
|
5589 |
'bitmaps' |
|
5590 |
'resources' |
|
5591 |
'source' |
|
5592 |
'not_delivered' |
|
5593 |
'not_ported' |
|
5594 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5595 |
dir baseName = 'stx' ifTrue:[ |
19117 | 5596 |
directoryContents removeAllFoundIn:#( |
5597 |
'configurations' |
|
5598 |
'include' |
|
5599 |
'rules' |
|
5600 |
'stc' |
|
5601 |
'support' |
|
5602 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5603 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5604 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5605 |
directoryContents do:[:eachFilenameString | |
19117 | 5606 |
|f| |
5607 |
||
5608 |
f := dir / eachFilenameString. |
|
5609 |
f isDirectory ifTrue:[ |
|
5610 |
self |
|
5611 |
recursiveInstallAutoloadedClassesFrom:f |
|
5612 |
rememberIn:dirsConsulted |
|
5613 |
maxLevels:maxLevels-1 |
|
5614 |
noAutoload:noAutoloadHere |
|
5615 |
packageTop:packageTopPath |
|
5616 |
showSplashInLevels:showSplashInLevels - 1. |
|
5617 |
] ifFalse:[ |
|
5618 |
(noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[ |
|
5619 |
f suffix = 'st' ifTrue:[ |
|
5620 |
[ |
|
5621 |
self installAutoloadedClassFromSourceFile:f. |
|
5622 |
f directory baseName = 'libbasic' ifTrue:[self halt]. |
|
5623 |
] on:FileStream openErrorSignal do:[:ex| |
|
5624 |
"ignore this file, but write a warning" |
|
5625 |
Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description). |
|
5626 |
]. |
|
5627 |
] |
|
5628 |
]. |
|
5629 |
] |
|
10641 | 5630 |
]. |
5631 |
||
11393 | 5632 |
showSplashInLevels >= 0 ifTrue:[ |
19117 | 5633 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
5634 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 5635 |
]. |
5636 |
||
10641 | 5637 |
" |
5638 |
Smalltalk installAutoloadedClasses |
|
5639 |
" |
|
5640 |
||
15596 | 5641 |
"Modified: / 01-08-2013 / 16:57:49 / cg" |
10641 | 5642 |
! |
5643 |
||
5644 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5645 |
"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
|
5646 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5647 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5648 |
|
10641 | 5649 |
|toAdd| |
5650 |
||
5651 |
toAdd := OrderedCollection new. |
|
5652 |
self keysAndValuesDo:[:key :val | |
|
18668 | 5653 |
(key == anObject) ifTrue:[ |
5654 |
self shouldImplement. |
|
5655 |
]. |
|
5656 |
(val == anObject ) ifTrue:[ |
|
5657 |
toAdd add:(key -> newRef) |
|
5658 |
]. |
|
10641 | 5659 |
]. |
5660 |
toAdd do:[:each | |
|
18668 | 5661 |
self at:(each key) put:(each value) |
10641 | 5662 |
]. |
5663 |
! |
|
5664 |
||
5665 |
saveEmergencyImage:aBoolean |
|
5666 |
"set/clear the flag which controls if ST/X should save an |
|
5667 |
emergency image in case of a broken display connection. |
|
5668 |
The default is true. |
|
5669 |
This may be useful, if you work with an unsecure display |
|
5670 |
(serial line), and want to have a chance of proceeding after |
|
5671 |
a crash. In multiheaded applications, this only affects |
|
5672 |
crashes of the master Display connection (the initial connection); |
|
5673 |
errors on other displays are reported to the views and treated |
|
5674 |
like window destroy from the windowManager." |
|
5675 |
||
5676 |
SaveEmergencyImage := aBoolean |
|
5677 |
||
5678 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
5679 |
! |
|
5680 |
||
5681 |
systemOrganization |
|
5682 |
"for partial ST80 compatibility; |
|
5683 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
5684 |
keeps track of class-categories, while all classes return a classOrganizer |
|
5685 |
from #organization, which keeps track of method categories of that class. |
|
5686 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
5687 |
To make a workaround possible, use #systemOrganization when porting |
|
5688 |
VW apps to ST/X to get the class-categories. |
|
5689 |
Read the documentation in SystemOrganizer for more info." |
|
5690 |
||
5691 |
^ SystemOrganizer for:nil |
|
5692 |
||
5693 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
5694 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5695 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5696 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5697 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5698 |
|
10641 | 5699 |
fileIn:aFileName |
5700 |
"read in the named file - look for it in some standard places; |
|
5701 |
return true if ok, false if failed. |
|
5702 |
This method can load almost anything which makes sense: |
|
18668 | 5703 |
.st - source files |
5704 |
.cls - binary smalltalk bytecode files |
|
5705 |
.so - binary compiled machine code class libraries |
|
5706 |
[.class - java bytecode -- soon to come]" |
|
10641 | 5707 |
|
5708 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
5709 |
||
5710 |
" |
|
5711 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
5712 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
5713 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
5714 |
" |
|
5715 |
||
5716 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
5717 |
! |
|
5718 |
||
5719 |
fileIn:aFileName inPackage:aPackageID |
|
5720 |
"read in the named file in a packages directory." |
|
5721 |
||
5722 |
|dir| |
|
5723 |
||
5724 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
5725 |
dir isNil ifTrue:[^ false]. |
|
5726 |
||
5727 |
dir := dir asFilename. |
|
5728 |
^ (self fileIn:(dir construct:aFileName)) |
|
5729 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5730 |
! |
|
5731 |
||
5732 |
fileIn:aFileName lazy:lazy |
|
5733 |
"read in the named file - look for it in some standard places; |
|
5734 |
return true if ok, false if failed. |
|
5735 |
If lazy is true, no code is generated for methods, instead stubs |
|
5736 |
are created which compile themself when first executed. This allows |
|
5737 |
for much faster fileIn (but slows down the first execution later). |
|
5738 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5739 |
code which is known to be syntactically correct." |
|
5740 |
||
5741 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
5742 |
||
5743 |
" |
|
5744 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
5745 |
" |
|
5746 |
||
5747 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
5748 |
! |
|
5749 |
||
5750 |
fileIn:aFileName lazy:lazy silent:silent |
|
5751 |
"read in the named file - look for it in some standard places; |
|
5752 |
return true if ok, false if failed. |
|
5753 |
If lazy is true, no code is generated for methods, instead stubs |
|
5754 |
are created which compile themself when first executed. This allows |
|
5755 |
for much faster fileIn (but slows down the first execution later). |
|
5756 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5757 |
code which is known to be syntactically correct. |
|
5758 |
If silent is true, no compiler messages are output to the transcript. |
|
5759 |
Giving nil for silent/lazy will use the current settings." |
|
5760 |
||
5761 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
5762 |
||
5763 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
5764 |
! |
|
5765 |
||
5766 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
5767 |
"read in the named file - look for it in some standard places; |
|
5768 |
return true if ok, false if failed. |
|
5769 |
If lazy is true, no code is generated for methods, instead stubs |
|
5770 |
are created which compile themself when first executed. This allows |
|
5771 |
for much faster fileIn (but slows down the first execution later). |
|
5772 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5773 |
code which is known to be syntactically correct. |
|
5774 |
If silent is true, no compiler messages are output to the transcript. |
|
5775 |
Giving nil for silent/lazy will use the current settings. |
|
5776 |
This method can load almost anything which makes sense: |
|
18668 | 5777 |
.st - source files |
5778 |
.cls - binary smalltalk bytecode files |
|
5779 |
.so - binary compiled machine code class libraries |
|
5780 |
[.class - java bytecode -- soon to come]" |
|
15594 | 5781 |
|
15665 | 5782 |
|fileNameString inStream path morePath bos| |
10641 | 5783 |
|
5784 |
fileNameString := aFileNameOrString asString. |
|
5785 |
||
5786 |
" |
|
5787 |
an object or shared object ? |
|
5788 |
" |
|
5789 |
(ObjectFileLoader notNil |
|
5790 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
18668 | 5791 |
"/ LoadBinaries ifFalse:[^ false]. |
5792 |
path := self getBinaryFileName:fileNameString. |
|
5793 |
path isNil ifTrue:[ |
|
5794 |
path := self getSystemFileName:fileNameString. |
|
5795 |
]. |
|
5796 |
path isNil ifTrue:[^ false]. |
|
5797 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
15594 | 5798 |
]. |
5799 |
||
5800 |
inStream := self systemFileStreamFor:fileNameString. |
|
5801 |
inStream isNil ifTrue:[^ false]. |
|
10641 | 5802 |
|
5803 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
18668 | 5804 |
BinaryObjectStorage notNil ifTrue:[ |
5805 |
[ |
|
5806 |
inStream binary. |
|
5807 |
bos := BinaryObjectStorage onOld:inStream. |
|
5808 |
bos next. |
|
5809 |
] ensure:[ |
|
5810 |
bos close. |
|
5811 |
]. |
|
5812 |
^ true |
|
5813 |
]. |
|
5814 |
^ false |
|
15594 | 5815 |
]. |
10641 | 5816 |
|
5817 |
(fileNameString includes:$/) ifTrue:[ |
|
18668 | 5818 |
"/ temporarily prepend the file's directory |
5819 |
"/ to the searchPath. |
|
5820 |
"/ This allows fileIn-driver files to refer to local |
|
5821 |
"/ files via a relative path, and drivers to fileIn other |
|
5822 |
"/ drivers ... |
|
5823 |
morePath := inStream pathName asFilename directoryName. |
|
15594 | 5824 |
]. |
15665 | 5825 |
^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath |
15594 | 5826 |
|
5827 |
" |
|
5828 |
Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true |
|
5829 |
Smalltalk fileIn:'keyboard.rc' |
|
10641 | 5830 |
" |
5831 |
||
5832 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
5833 |
! |
|
5834 |
||
5835 |
fileIn:aFileName logged:logged |
|
5836 |
"read in the named file - look for it in some standard places; |
|
5837 |
return true if ok, false if failed. |
|
5838 |
The argument logged controls, if the changefile is to be updated." |
|
5839 |
||
5840 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
5841 |
||
5842 |
" |
|
5843 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
5844 |
" |
|
5845 |
! |
|
5846 |
||
5847 |
fileIn:aFileName silent:silent |
|
5848 |
"read in the named file - look for it in some standard places; |
|
5849 |
return true if ok, false if failed. |
|
5850 |
If silent is true, no compiler messages are output to the transcript." |
|
5851 |
||
5852 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
5853 |
||
5854 |
" |
|
5855 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
5856 |
" |
|
5857 |
||
5858 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
5859 |
! |
|
5860 |
||
5861 |
fileInChanges |
|
5862 |
"read in the last changes file - bringing the system to the state it |
|
5863 |
had when left the last time. |
|
5864 |
WARNING: this method is rubbish: it should only read things after the |
|
18668 | 5865 |
last '**snapshot**' - entry |
5866 |
(instead of the complete changes file)." |
|
10641 | 5867 |
|
5868 |
" |
|
5869 |
do NOT update the changes file now ... |
|
5870 |
" |
|
5871 |
self fileIn:ChangeFileName logged:false |
|
5872 |
||
5873 |
" |
|
10071 | 5874 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5875 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5876 |
! |
1 | 5877 |
|
10641 | 5878 |
fileInClass:aClassName |
5879 |
"find a source/object file for aClassName and -if found - load it. |
|
5880 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5881 |
finally source file (.st) in that order. |
|
5882 |
The file is first searched for using the class name, then the abbreviated name." |
|
5883 |
||
5884 |
^ self |
|
18668 | 5885 |
fileInClass:aClassName |
5886 |
package:nil |
|
5887 |
initialize:true |
|
5888 |
lazy:false |
|
5889 |
silent:nil |
|
10641 | 5890 |
|
5891 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
5892 |
! |
|
5893 |
||
5894 |
fileInClass:aClassName fromObject:aFileName |
|
5895 |
"read in the named object file and dynamic-link it into the system |
|
5896 |
- look for it in some standard places. |
|
5897 |
Only install the named class from this object file. |
|
5898 |
Return true if ok, false if failed." |
|
5899 |
||
5900 |
|path ok| |
|
5901 |
||
5902 |
" |
|
5903 |
check if the dynamic loader class is in |
|
5904 |
" |
|
5905 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
5906 |
||
5907 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
5908 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
5909 |
ok ifTrue:[ |
|
18668 | 5910 |
VerboseLoading ifTrue:[ |
5911 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
5912 |
] |
|
10641 | 5913 |
]. |
5914 |
^ ok |
|
5915 |
||
5916 |
" |
|
5917 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
5918 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
5919 |
" |
|
5920 |
||
13814 | 5921 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 5922 |
! |
5923 |
||
5924 |
fileInClass:aClassName initialize:doInit |
|
5925 |
"find a source/object file for aClassName and -if found - load it. |
|
5926 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5927 |
finally source file (.st) in that order. |
|
5928 |
The file is first searched for using the class name, then the abbreviated name." |
|
5929 |
||
5930 |
^ self |
|
18668 | 5931 |
fileInClass:aClassName |
5932 |
package:nil |
|
5933 |
initialize:doInit |
|
5934 |
lazy:false |
|
5935 |
silent:nil |
|
10641 | 5936 |
|
5937 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
5938 |
! |
|
5939 |
||
5940 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
5941 |
"find a source/object file for aClassName and -if found - load it. |
|
5942 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5943 |
finally source file (.st) in that order. |
|
5944 |
The file is first searched for using the class name, then the abbreviated name." |
|
5945 |
||
5946 |
^ self |
|
18668 | 5947 |
fileInClass:aClassName |
5948 |
package:nil |
|
5949 |
initialize:doInit |
|
5950 |
lazy:loadLazy |
|
5951 |
silent:nil |
|
10641 | 5952 |
|
5953 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
5954 |
! |
|
5955 |
||
5956 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
5957 |
"find a source/object file for aClassName and -if found - load it. |
|
5958 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
5959 |
finally source file (.st), in that order. |
|
5960 |
The file is first searched for using the class name, then the abbreviated name. |
|
5961 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
5962 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
5963 |
should not send notes to the transcript; it can be true, false or nil, where |
|
5964 |
nil uses the value from SilentLoading." |
|
5965 |
||
5966 |
^ self |
|
18668 | 5967 |
fileInClass:aClassName |
5968 |
package:nil |
|
5969 |
initialize:doInit |
|
5970 |
lazy:loadLazy |
|
5971 |
silent:beSilent |
|
10641 | 5972 |
|
5973 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
5974 |
! |
|
5975 |
||
5976 |
fileInClass:aClassName package:package |
|
5977 |
"find a source/object file for aClassName and -if found - load it. |
|
5978 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5979 |
finally source file (.st) in that order. |
|
5980 |
The file is first searched for using the class name, then the abbreviated name." |
|
5981 |
||
5982 |
^ self |
|
18668 | 5983 |
fileInClass:aClassName |
5984 |
package:package |
|
5985 |
initialize:true |
|
5986 |
lazy:false |
|
5987 |
silent:nil |
|
10641 | 5988 |
|
5989 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
5990 |
! |
|
5991 |
||
10999 | 5992 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 5993 |
"find a source/object file for aClassName and -if found - load it. |
5994 |
This is the workhorse for autoloading. |
|
10999 | 5995 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 5996 |
finally source file (.st), in that order. |
5997 |
The file is first searched for using the class name, then the abbreviated name. |
|
5998 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
5999 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
6000 |
should not send notes to the transcript; it can be true, false or nil, where |
|
6001 |
nil uses the value from SilentLoading." |
|
6002 |
||
10999 | 6003 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
10641 | 6004 |
filenameToSet packageDir packageFile bos| |
6005 |
||
17588 | 6006 |
ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ |
17582 | 6007 |
|
18668 | 6008 |
wasLazy := Compiler compileLazy:loadLazy. |
6009 |
beSilent notNil ifTrue:[ |
|
6010 |
wasSilent := self silentLoading:beSilent. |
|
6011 |
]. |
|
6012 |
||
6013 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
6014 |
(classFileName = aClassName) ifTrue:[ |
|
6015 |
"/ no abbrev.stc translation for className |
|
6016 |
(aClassName includes:$:) ifTrue:[ |
|
6017 |
"/ a nameSpace name |
|
6018 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
6019 |
]. |
|
6020 |
]. |
|
6021 |
||
6022 |
classFileName asFilename isAbsolute ifTrue:[ |
|
6023 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
|
6024 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
6025 |
] ifFalse:[ |
|
6026 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
6027 |
] |
|
6028 |
] ifFalse:[ |
|
6029 |
classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. |
|
6030 |
[ |
|
6031 |
Class withoutUpdatingChangesDo:[ |
|
6032 |
|zarFn zar entry| |
|
6033 |
||
6034 |
ok := false. |
|
6035 |
||
6036 |
package notNil ifTrue:[ |
|
6037 |
packageDir := package asPackageId packageDirectory. |
|
6038 |
"/ packageDir := package asString. |
|
6039 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
6040 |
packageDir isNil ifTrue:[ |
|
6041 |
packageDir := self packageDirectoryForPackageId:package |
|
6042 |
]. |
|
6043 |
packageDir notNil ifTrue:[ |
|
6044 |
packageDir := packageDir asFilename. |
|
6045 |
]. |
|
6046 |
]. |
|
6047 |
||
6048 |
Class packageQuerySignal answer:package do:[ |
|
6049 |
" |
|
6050 |
then, if dynamic linking is available, |
|
6051 |
" |
|
6052 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
6053 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
|
6054 |
" |
|
6055 |
first look for a class packages shared binary in binary/xxx.o |
|
6056 |
" |
|
6057 |
libName := self libraryFileNameOfClass:aClassName. |
|
6058 |
libName notNil ifTrue:[ |
|
6059 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
|
6060 |
ifFalse:[ |
|
6061 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6062 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
6063 |
] |
|
6064 |
]. |
|
6065 |
]. |
|
6066 |
" |
|
6067 |
then, look for a shared binary in binary/xxx.o |
|
6068 |
" |
|
6069 |
ok ifFalse:[ |
|
6070 |
(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) |
|
6071 |
ifFalse:[ |
|
6072 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6073 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
6074 |
]. |
|
6075 |
ok ifFalse:[ |
|
6076 |
alternativeClassFileName notNil ifTrue:[ |
|
6077 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
|
6078 |
ifFalse:[ |
|
6079 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6080 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
6081 |
] |
|
6082 |
] |
|
6083 |
]. |
|
6084 |
]. |
|
6085 |
]. |
|
6086 |
]. |
|
6087 |
]. |
|
6088 |
||
6089 |
" |
|
6090 |
if that did not work, look for a compiled-bytecode file ... |
|
6091 |
" |
|
6092 |
ok ifFalse:[ |
|
6093 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
6094 |
ifFalse:[ |
|
6095 |
alternativeClassFileName notNil ifTrue:[ |
|
6096 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
6097 |
] |
|
6098 |
] |
|
6099 |
]. |
|
6100 |
" |
|
6101 |
if that did not work, and the classes package is known, |
|
6102 |
look for an st-cls file |
|
6103 |
in a package subdir of the source-directory ... |
|
6104 |
" |
|
6105 |
ok ifFalse:[ |
|
6106 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
6107 |
packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). |
|
6108 |
packageFile isNil ifTrue:[ |
|
6109 |
packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. |
|
6110 |
]. |
|
6111 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
6112 |
ifFalse:[ |
|
6113 |
alternativeClassFileName notNil ifTrue:[ |
|
6114 |
packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6115 |
packageFile isNil ifTrue:[ |
|
6116 |
packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6117 |
]. |
|
6118 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
6119 |
] |
|
6120 |
]. |
|
6121 |
||
6122 |
zarFn := self getPackageFileName:(packageDir / 'classes.zip'). |
|
6123 |
zarFn notNil ifTrue:[ |
|
6124 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6125 |
zar notNil ifTrue:[ |
|
6126 |
entry := zar extract:(classFileName , '.cls'). |
|
6127 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6128 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
6129 |
]. |
|
6130 |
entry notNil ifTrue:[ |
|
6131 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
6132 |
bos next. |
|
6133 |
bos close. |
|
6134 |
ok := true |
|
6135 |
]. |
|
6136 |
] |
|
6137 |
] |
|
6138 |
] |
|
6139 |
]. |
|
6140 |
||
6141 |
" |
|
6142 |
if that did not work, look for an st-source file ... |
|
6143 |
" |
|
6144 |
ok ifFalse:[ |
|
6145 |
filenameToSet := classFileName. |
|
6146 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6147 |
ifFalse:[ |
|
6148 |
alternativeClassFileName notNil ifTrue:[ |
|
6149 |
filenameToSet := alternativeClassFileName. |
|
6150 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6151 |
]. |
|
6152 |
ok ifFalse:[ |
|
6153 |
" |
|
6154 |
... and in the standard source-directory |
|
6155 |
" |
|
6156 |
filenameToSet := 'source' asFilename / classFileName. |
|
6157 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6158 |
ifFalse:[ |
|
6159 |
alternativeClassFileName notNil ifTrue:[ |
|
6160 |
filenameToSet := 'source' asFilename / alternativeClassFileName. |
|
6161 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6162 |
] |
|
6163 |
] |
|
6164 |
] |
|
6165 |
]. |
|
6166 |
" |
|
6167 |
if that did not work, and the classes package is known, |
|
6168 |
look for an st-source file |
|
6169 |
in a package subdir of the source-directory ... |
|
6170 |
" |
|
6171 |
ok ifFalse:[ |
|
6172 |
packageDir notNil ifTrue:[ |
|
6173 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). |
|
6174 |
packageFile isNil ifTrue:[ |
|
6175 |
packageFile := (packageDir / 'source' / classFileName). |
|
6176 |
]. |
|
6177 |
filenameToSet := packageFile. |
|
6178 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6179 |
ifFalse:[ |
|
6180 |
alternativeClassFileName notNil ifTrue:[ |
|
6181 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). |
|
6182 |
packageFile isNil ifTrue:[ |
|
6183 |
packageFile := (packageDir / 'source' / alternativeClassFileName). |
|
6184 |
]. |
|
6185 |
filenameToSet := packageFile. |
|
6186 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6187 |
]. |
|
6188 |
ok ifFalse:[ |
|
6189 |
packageFile := self getPackageSourceFileName:(packageDir / classFileName). |
|
6190 |
packageFile isNil ifTrue:[ |
|
6191 |
packageFile := (packageDir / classFileName). |
|
6192 |
]. |
|
6193 |
filenameToSet := packageFile. |
|
6194 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6195 |
ifFalse:[ |
|
6196 |
alternativeClassFileName notNil ifTrue:[ |
|
6197 |
packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). |
|
6198 |
packageFile isNil ifTrue:[ |
|
6199 |
packageFile := packageDir / alternativeClassFileName. |
|
6200 |
]. |
|
6201 |
filenameToSet := packageFile. |
|
6202 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6203 |
]. |
|
6204 |
ok ifFalse:[ |
|
6205 |
" |
|
6206 |
... and in the standard source-directory |
|
6207 |
" |
|
6208 |
filenameToSet := 'source' asFilename / packageDir / classFileName. |
|
6209 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6210 |
ifFalse:[ |
|
6211 |
alternativeClassFileName notNil ifTrue:[ |
|
6212 |
filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. |
|
6213 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6214 |
] |
|
6215 |
] |
|
6216 |
] |
|
6217 |
]. |
|
6218 |
]. |
|
6219 |
]. |
|
6220 |
] |
|
6221 |
]. |
|
6222 |
" |
|
6223 |
if that did not work, and the classes package is known, |
|
6224 |
look for a zipArchive containing a class entry. |
|
6225 |
" |
|
6226 |
ok ifFalse:[ |
|
6227 |
packageDir notNil ifTrue:[ |
|
6228 |
zarFn := self getPackageFileName:(packageDir / 'source.zip'). |
|
6229 |
zarFn isNil ifTrue:[ |
|
6230 |
zarFn := packageDir withSuffix:'zip'. |
|
6231 |
zarFn := self getSourceFileName:zarFn. |
|
6232 |
]. |
|
6233 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
|
6234 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6235 |
zar notNil ifTrue:[ |
|
6236 |
entry := zar extract:(classFileName , '.st'). |
|
6237 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6238 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
6239 |
]. |
|
6240 |
entry notNil ifTrue:[ |
|
6241 |
filenameToSet := zarFn. |
|
6242 |
ok := self |
|
6243 |
fileInStream:(entry asString readStream) |
|
6244 |
lazy:loadLazy |
|
6245 |
silent:beSilent |
|
6246 |
logged:false |
|
6247 |
addPath:nil |
|
6248 |
]. |
|
6249 |
] |
|
6250 |
] |
|
6251 |
] |
|
6252 |
]. |
|
6253 |
||
6254 |
" |
|
6255 |
if that did not work, |
|
6256 |
look for a zipArchive containing a class entry. |
|
6257 |
" |
|
6258 |
ok ifFalse:[ |
|
6259 |
zarFn := self getSourceFileName:'source.zip'. |
|
6260 |
zarFn notNil ifTrue:[ |
|
6261 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6262 |
zar notNil ifTrue:[ |
|
6263 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
6264 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6265 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
6266 |
]. |
|
6267 |
entry notNil ifTrue:[ |
|
6268 |
filenameToSet := zarFn. |
|
6269 |
ok := self |
|
6270 |
fileInStream:(entry asString readStream) |
|
6271 |
lazy:loadLazy |
|
6272 |
silent:beSilent |
|
6273 |
logged:false |
|
6274 |
addPath:nil |
|
6275 |
]. |
|
6276 |
] |
|
6277 |
] |
|
6278 |
]. |
|
6279 |
ok ifFalse:[ |
|
6280 |
" |
|
6281 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
6282 |
" |
|
6283 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
6284 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
|
6285 |
inStream notNil ifTrue:[ |
|
6286 |
filenameToSet := nil. |
|
6287 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
6288 |
] |
|
6289 |
]. |
|
6290 |
]. |
|
6291 |
]. |
|
6292 |
] |
|
6293 |
]. |
|
6294 |
] ensure:[ |
|
6295 |
Compiler compileLazy:wasLazy. |
|
6296 |
wasSilent notNil ifTrue:[ |
|
6297 |
self silentLoading:wasSilent |
|
6298 |
] |
|
6299 |
]. |
|
6300 |
]. |
|
6301 |
||
6302 |
ok ifTrue:[ |
|
6303 |
newClass := self at:(aClassName asSymbol). |
|
6304 |
newClass notNil ifTrue:[ |
|
6305 |
"set the classes name - but do not change if already set" |
|
6306 |
filenameToSet notNil ifTrue:[ |
|
6307 |
newClass getClassFilename isNil ifTrue:[ |
|
6308 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
6309 |
]. |
|
6310 |
]. |
|
6311 |
||
6312 |
doInit ifTrue:[ |
|
6313 |
newClass initialize |
|
6314 |
] |
|
6315 |
] |
|
6316 |
]. |
|
10641 | 6317 |
]. |
6318 |
||
6319 |
^ newClass |
|
6320 |
||
13415 | 6321 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
6322 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
6323 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 6324 |
! |
6325 |
||
6326 |
fileInClassLibrary:aClassLibraryName |
|
6327 |
"find an object file containing a binary class library in some standard places |
|
6328 |
and load it. This install all of its contained classes. |
|
6329 |
Return true if ok, false if not. |
|
6330 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6331 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6332 |
make the caller independent of the underlying operatingSystem." |
|
10641 | 6333 |
|
6334 |
|path fn| |
|
6335 |
||
16144 | 6336 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6337 |
^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'. |
16144 | 6338 |
]. |
10641 | 6339 |
|
6340 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6341 |
fn := fn pathName. |
|
6342 |
||
6343 |
path := self getBinaryFileName:fn. |
|
6344 |
path isNil ifTrue:[ |
|
18668 | 6345 |
path := self getSystemFileName:fn. |
16144 | 6346 |
]. |
6347 |
path isNil ifTrue:[ |
|
18668 | 6348 |
^ PackageNotFoundError raiseRequestWith:aClassLibraryName. |
16144 | 6349 |
]. |
6350 |
||
6351 |
(ObjectFileLoader loadObjectFile:path) isNil ifTrue:[ |
|
18668 | 6352 |
^ PackageLoadError raiseRequestWith:aClassLibraryName. |
16144 | 6353 |
]. |
6354 |
^ true. |
|
6355 |
||
10641 | 6356 |
|
6357 |
" |
|
6358 |
Smalltalk fileInClassLibrary:'libtable' |
|
6359 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6360 |
" |
|
6361 |
||
6362 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
6363 |
! |
|
6364 |
||
6365 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
6366 |
"find an object file containing a binary class library in some standard places |
|
6367 |
and load it. This installs all of its contained classes. |
|
6368 |
Return true if ok, false if not. |
|
6369 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6370 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6371 |
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
|
6372 |
|
11690 | 6373 |
|baseName handle libraryFilename packagePath| |
10641 | 6374 |
|
16144 | 6375 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6376 |
^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader' |
16144 | 6377 |
]. |
10641 | 6378 |
|
6379 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6380 |
baseName exists ifTrue:[ |
|
18668 | 6381 |
"/ load local file first... |
6382 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6383 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6384 |
handle isNil ifTrue:[ |
18668 | 6385 |
packagePath := self getPackageDirectoryForPackage:packageID. |
6386 |
packagePath isNil ifTrue:[ |
|
6387 |
^ PackageNotFoundError raiseRequestWith:packageID. |
|
6388 |
]. |
|
6389 |
packagePath := packagePath asFilename. |
|
6390 |
libraryFilename := packagePath / baseName. |
|
6391 |
libraryFilename exists ifFalse:[ |
|
6392 |
libraryFilename := nil. |
|
6393 |
#('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir | |
|
6394 |
"in windows, with Borland compiler, DLLs in development environment are under objbc; |
|
6395 |
with MSVC, they are under objvc" |
|
6396 |
libraryFilename isNil ifTrue:[ |
|
6397 |
libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName. |
|
6398 |
libraryFilename exists ifFalse:[ libraryFilename := nil ] |
|
6399 |
]. |
|
6400 |
]. |
|
6401 |
]. |
|
6402 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
6403 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
6404 |
]. |
|
16144 | 6405 |
]. |
6406 |
||
6407 |
handle isNil ifTrue:[ |
|
18668 | 6408 |
^ PackageNotFoundError raiseRequestWith:packageID. |
16144 | 6409 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6410 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6411 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6412 |
"/ ]. |
16144 | 6413 |
^ true. |
10641 | 6414 |
|
6415 |
" |
|
6416 |
Smalltalk fileInClassLibrary:'libtable' |
|
6417 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6418 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
6419 |
" |
|
6420 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
6421 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
10641 | 6422 |
! |
6423 |
||
15073 | 6424 |
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent |
18560 | 6425 |
"Try all available programming languages for a matching suffix" |
13415 | 6426 |
|
15073 | 6427 |
|filename| |
6428 |
||
6429 |
filename := filenameArg asFilename. |
|
18668 | 6430 |
"/ 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
|
6431 |
"/ | f | |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6432 |
"/ |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6433 |
"/ "/ cg: changed: did try all languages to load (eg. wether suffix matched or not. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6434 |
"/ "/ 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
|
6435 |
"/ (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
|
6436 |
"/ (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
|
6437 |
"/ ^ true |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6438 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6439 |
"/ ] |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6440 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6441 |
"/ 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
|
6442 |
ProgrammingLanguage allDo:[:lang| | f | |
18668 | 6443 |
f := (filename hasSuffix:lang sourceFileSuffix) |
6444 |
ifTrue:[filename] |
|
6445 |
ifFalse:[filename addSuffix:lang sourceFileSuffix]. |
|
6446 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
6447 |
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
|
6448 |
]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6449 |
|
15073 | 6450 |
^ false |
13415 | 6451 |
|
6452 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
6453 |
! |
|
6454 |
||
10641 | 6455 |
fileInStream:streamArg |
6456 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
6457 |
! |
|
6458 |
||
6459 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
6460 |
"read sourceCode from aStream; |
|
6461 |
return true if ok, false if failed. |
|
6462 |
If lazy is true, no code is generated for methods, instead stubs |
|
6463 |
are created which compile themself when first executed. This allows |
|
6464 |
for much faster fileIn (but slows down the first execution later). |
|
6465 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6466 |
code which is known to be syntactically correct. |
|
6467 |
If silent is true, no compiler messages are output to the transcript. |
|
6468 |
Giving nil for silent/lazy will use the current settings. |
|
6469 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
6470 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
6471 |
using a relative path." |
|
6472 |
||
11427 | 6473 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 6474 |
|
6475 |
inStream := streamArg. |
|
6476 |
inStream isNil ifTrue:[^ false]. |
|
15665 | 6477 |
inStream := LineNumberReadStream on:inStream. |
12611
38d61d374d89
care for nonPositionable stream (stdin) in fileIn
Claus Gittinger <cg@exept.de>
parents:
12557
diff
changeset
|
6478 |
inStream := EncodedStream isNil |
18669 | 6479 |
ifTrue:[ inStream ] |
6480 |
ifFalse:[ EncodedStream decodedStreamFor:inStream ]. |
|
10641 | 6481 |
|
6482 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
6483 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
6484 |
morePath notNil ifTrue:[ |
|
18669 | 6485 |
oldSystemPath := SystemPath copy. |
6486 |
SystemPath addFirst:morePath. |
|
6487 |
oldRealPath := RealSystemPath. |
|
6488 |
RealSystemPath := nil. |
|
6489 |
]. |
|
6490 |
||
10641 | 6491 |
[ |
18669 | 6492 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
6493 |
"JV: Changed to give ProgrammingLanguage to choose |
|
6494 |
proper reader" |
|
6495 |
(ProgrammingLanguage forStream: inStream) fileInStream: inStream |
|
6496 |
] |
|
10641 | 6497 |
] ensure:[ |
18669 | 6498 |
morePath notNil ifTrue:[ |
6499 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
6500 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
6501 |
SystemPath := oldSystemPath. |
|
6502 |
RealSystemPath := oldRealPath. |
|
6503 |
] ifFalse:[ |
|
6504 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
6505 |
SystemPath remove:morePath ifAbsent:[]. |
|
6506 |
]. |
|
6507 |
RealSystemPath := nil. |
|
6508 |
]. |
|
6509 |
]. |
|
6510 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
6511 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
6512 |
inStream close |
|
10641 | 6513 |
]. |
6514 |
^ true |
|
6515 |
||
6516 |
" |
|
6517 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
6518 |
" |
|
6519 |
||
13415 | 6520 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
6521 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 6522 |
! |
6523 |
||
6524 |
isClassLibraryLoaded:name |
|
6525 |
"return true, if a particular class library is already loaded" |
|
6526 |
||
6527 |
ObjectMemory |
|
18668 | 6528 |
binaryModuleInfo |
6529 |
do:[:entry | |
|
6530 |
entry type == #classLibrary ifTrue:[ |
|
6531 |
entry libraryName = name ifTrue:[ |
|
6532 |
^ true "/ already loaded |
|
6533 |
] |
|
6534 |
]. |
|
6535 |
]. |
|
10641 | 6536 |
|
6537 |
^ false |
|
6538 |
||
6539 |
" |
|
6540 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
6541 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
6542 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
6543 |
" |
|
6544 |
||
6545 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
6546 |
! |
|
6547 |
||
6548 |
loadClassLibraryIfAbsent:name |
|
6549 |
"dynamically load a classLibrary, if not already loaded |
|
6550 |
and the system supports dynamic loading. |
|
6551 |
Return true, if the library is loaded, false if not. |
|
6552 |
This entry is called without system specific filename |
|
6553 |
extensions - it is portable among different architectures |
|
6554 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
6555 |
are be present ..." |
|
6556 |
||
6557 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
6558 |
^ self fileInClassLibrary:name |
|
6559 |
||
6560 |
" |
|
6561 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
6562 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
6563 |
" |
|
6564 |
||
6565 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
6566 |
! |
|
6567 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6568 |
secureFileIn:aFileName |
10641 | 6569 |
"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
|
6570 |
Catch various errors during fileIn. |
13000 | 6571 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6572 |
|
10641 | 6573 |
|retVal| |
6574 |
||
16025 | 6575 |
Parser isNil ifTrue:[^ false]. "/ for small stand alone apps. |
10641 | 6576 |
retVal := false. |
16025 | 6577 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6578 |
(SignalSet |
18668 | 6579 |
with:AbortOperationRequest |
6580 |
with:TerminateProcessRequest |
|
6581 |
with:Parser parseErrorSignal) |
|
6582 |
handle:[:ex | ex return ] |
|
6583 |
do:[ retVal := self fileIn:aFileName ]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6584 |
^ retVal |
10641 | 6585 |
! |
6586 |
||
6587 |
silentFileIn:aFilename |
|
6588 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
6589 |
Main use is during startup." |
|
6590 |
||
13353 | 6591 |
self silentlyLoadingDo:[ |
18668 | 6592 |
self fileIn:aFilename |
13353 | 6593 |
]. |
3044 | 6594 |
! ! |
6595 |
||
6596 |
!Smalltalk class methodsFor:'system management-files'! |
|
6597 |
||
18868 | 6598 |
addWorkspaceDirectoryToPackagePath |
6599 |
"{ Pragma: +optSpace }" |
|
6600 |
||
6601 |
|workspaceDirectory| |
|
6602 |
||
6603 |
(workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[ |
|
6604 |
(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[ |
|
6605 |
PackagePath addFirst:workspaceDirectory |
|
6606 |
] |
|
6607 |
]. |
|
6608 |
! |
|
6609 |
||
10641 | 6610 |
bitmapFileStreamFor:aFileName |
6611 |
"search aFileName in some standard places; |
|
6612 |
return a readonly fileStream or nil if not found. |
|
6613 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
6614 |
Notice: this does not look in the package-specific bitmaps directories." |
|
6615 |
||
6616 |
|aString| |
|
6617 |
||
6618 |
aString := self getBitmapFileName:aFileName. |
|
6619 |
aString notNil ifTrue:[ |
|
18668 | 6620 |
^ aString asFilename readStreamOrNil |
10641 | 6621 |
]. |
6622 |
^ nil |
|
6623 |
! |
|
6624 |
||
6625 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
6626 |
"backward compatibility: |
|
6627 |
search aFileName in some standard places: |
|
6628 |
first in the redefinable bitmaps path, |
|
6629 |
then in the classes own package directory if existing. |
|
6630 |
Return an image or nil." |
|
6631 |
||
6632 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
6633 |
||
6634 |
" |
|
6635 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
6636 |
" |
|
6637 |
! |
|
6638 |
||
6639 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
6640 |
"backward compatibility: |
|
6641 |
search aFileName in some standard places: |
|
6642 |
first in the redefinable bitmaps path, |
|
6643 |
then in the package directory if existing. |
|
6644 |
Return an image or nil." |
|
6645 |
||
6646 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
6647 |
||
6648 |
" |
|
6649 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6650 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6651 |
" |
|
6652 |
! |
|
6653 |
||
6654 |
classNameForFile:aFileName |
|
6655 |
"return the className which corresponds to an abbreviated fileName, |
|
6656 |
or nil if no special translation applies. The given filename arg may |
|
6657 |
include a '.st' suffix (but no other)." |
|
6658 |
||
6659 |
|fn| |
|
6660 |
||
6661 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
18668 | 6662 |
fn := aFileName copyButLast:3 |
10641 | 6663 |
] ifFalse:[ |
18668 | 6664 |
fn := aFileName |
10641 | 6665 |
]. |
6666 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
6667 |
||
6668 |
" |
|
6669 |
Smalltalk classNameForFile:'DrawObj' |
|
6670 |
Smalltalk classNameForFile:'DrawObj.st' |
|
6671 |
Smalltalk classNameForFile:'ArrColl.st' |
|
6672 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
6673 |
" |
|
6674 |
||
6675 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
6676 |
! |
|
6677 |
||
6678 |
constructPathFor:aDirectoryName |
|
6679 |
"search for aDirectory in SystemPath; |
|
6680 |
return a collection of pathes which include that directory." |
|
6681 |
||
6682 |
^ self realSystemPath select:[:dirName | |
|
18668 | 6683 |
|fullPath| |
6684 |
||
6685 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
6686 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
6687 |
fullPath isDirectory and:[fullPath isReadable] |
|
10641 | 6688 |
]. |
6689 |
! |
|
6690 |
||
6691 |
fileInFileStreamFor:aFileName |
|
6692 |
"obsolete |
|
6693 |
search aFileName in some standard places; |
|
6694 |
return a readonly fileStream or nil if not found. |
|
6695 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
6696 |
||
6697 |
|aString| |
|
6698 |
||
6699 |
aString := self getFileInFileName:aFileName. |
|
6700 |
aString notNil ifTrue:[ |
|
18668 | 6701 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6702 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6703 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6704 |
! |
7758 | 6705 |
|
12022 | 6706 |
fileNameForClass:aClassOrClassName |
6707 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
6708 |
- only the base name (without directory part) and without suffix." |
|
6709 |
||
15958 | 6710 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg | |
12022 | 6711 |
|
12301 | 6712 |
"/ This was added as an extension of libsvn - should be no longer needed |
15958 | 6713 |
"/ JV@2012-09-25: but it actually is. The problem is that class filename |
6714 |
"/ is stored in the class itself and used to generate abbrev.stc and |
|
6715 |
"/ prerequisites in makefiles. But if you renamed such a stc-compiled class, |
|
6716 |
"/ the filename remains the same, but SVN __ALWAYS__ keep container name |
|
6717 |
"/ and class name in sync. Therefore build files gets messed up. Indeed, this |
|
6718 |
"/ should be fixed in code that files-out the package and generates build files. |
|
6719 |
"/ Certainly a hack, but do not remove this until fixed elsewhere |
|
6720 |
||
6721 |
compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'. |
|
6722 |
(compatQuery notNil |
|
6723 |
and:[compatQuery isLoaded |
|
18668 | 6724 |
and:[compatQuery query not]]) ifTrue:[ |
6725 |
nm := aClassOrClassName isBehavior |
|
6726 |
ifTrue:[aClassOrClassName name] |
|
6727 |
ifFalse:[aClassOrClassName]. |
|
6728 |
nm := nm copyReplaceAll:$: with:$_ ifNone:nm. |
|
6729 |
^nm |
|
15958 | 6730 |
]. |
6731 |
||
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
6732 |
"/ 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
|
6733 |
"/ 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
|
6734 |
"/ 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
|
6735 |
"/ of classes OUTSIDE filed-out package when generating makefile dependencies. |
15958 | 6736 |
compatQuery := Smalltalk classNamed: 'SCMCompatModeQuery'. |
6737 |
(compatQuery notNil |
|
6738 |
and:[compatQuery isLoaded |
|
18668 | 6739 |
and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[ |
6740 |
| compatPkgs | |
|
6741 |
"/ Originally libscm could only fileout one package at time so |
|
6742 |
"/ the query answered one package name. However, to support nested |
|
6743 |
"/ packages, libscm is being rewritten to commit multiple packages |
|
6744 |
"/ at once, so query answers a collection of packages. The code below |
|
6745 |
"/ makes sure it works for both. |
|
6746 |
compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ]. |
|
6747 |
nm := aClassOrClassName isBehavior |
|
6748 |
ifTrue:[aClassOrClassName name] |
|
6749 |
ifFalse:[aClassOrClassName]. |
|
6750 |
cls := Smalltalk at: nm asSymbol. |
|
6751 |
(cls notNil and:[compatPkgs includes: cls package]) ifTrue:[ |
|
6752 |
nm := nm copyReplaceAll:$: with:$_. |
|
6753 |
^nm |
|
6754 |
]. |
|
15958 | 6755 |
]. |
12301 | 6756 |
|
12022 | 6757 |
aClassOrClassName isBehavior ifTrue:[ |
18668 | 6758 |
cls := aClassOrClassName. |
12022 | 6759 |
] ifFalse:[ |
18668 | 6760 |
cls := Smalltalk classNamed:aClassOrClassName. |
6761 |
cls isNil ifTrue:[ |
|
6762 |
nameWithPrefix := aClassOrClassName. |
|
6763 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
6764 |
]. |
|
12022 | 6765 |
]. |
6766 |
||
6767 |
cls notNil ifTrue:[ |
|
18668 | 6768 |
nonMetaclass := cls theNonMetaclass. |
6769 |
nm := nonMetaclass getClassFilename. |
|
6770 |
nm isNil ifTrue:[ |
|
6771 |
|revisionInfo| |
|
6772 |
||
6773 |
(revisionInfo := cls revisionInfo) notNil ifTrue:[ |
|
6774 |
nm := revisionInfo fileName. |
|
6775 |
]. |
|
6776 |
]. |
|
6777 |
nm notNil ifTrue:[ |
|
6778 |
^ nm asFilename withoutSuffix baseName |
|
6779 |
]. |
|
6780 |
nameWithPrefix := nonMetaclass name. |
|
6781 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
|
12022 | 6782 |
]. |
6783 |
||
6784 |
CachedAbbreviations notNil ifTrue:[ |
|
18668 | 6785 |
nameWithPrefix := nameWithPrefix asSymbol. |
6786 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
|
6787 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
|
6788 |
]. |
|
6789 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
|
6790 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
|
6791 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
|
6792 |
]. |
|
12022 | 6793 |
]. |
6794 |
||
6795 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
6796 |
||
6797 |
" |
|
6798 |
Smalltalk fileNameForClass:#Complex |
|
6799 |
Smalltalk fileNameForClass:'SmallInteger' |
|
6800 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
6801 |
Smalltalk fileNameForClass:'Launcher' |
|
6802 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
6803 |
||
6804 |
Smalltalk fileNameForClass:HTML::Encoder |
|
6805 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
6806 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
6807 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
6808 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
6809 |
" |
|
6810 |
||
6811 |
"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
|
6812 |
"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
|
6813 |
"Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12022 | 6814 |
! |
6815 |
||
10641 | 6816 |
filenameAbbreviations |
6817 |
"return a dictionary containing the classname-to-filename |
|
6818 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
6819 |
to 14 chars)" |
|
6820 |
||
6821 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 6822 |
self readAbbreviations |
10641 | 6823 |
]. |
6824 |
^ CachedAbbreviations |
|
6825 |
||
6826 |
"flush with: |
|
6827 |
||
6828 |
CachedAbbreviations := nil |
|
6829 |
" |
|
6830 |
" |
|
6831 |
Smalltalk filenameAbbreviations |
|
6832 |
" |
|
6833 |
! |
|
6834 |
||
13368 | 6835 |
findPackageDirectoryForPackage:aPackage |
6836 |
"find a packages directory along a number of standard places" |
|
6837 |
||
6838 |
|relDir| |
|
6839 |
||
6840 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
6841 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
6842 |
||
6843 |
^ Smalltalk getPackageFileName:relDir. |
|
6844 |
||
6845 |
" |
|
6846 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
6847 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
6848 |
" |
|
6849 |
! |
|
6850 |
||
10641 | 6851 |
flushPathCaches |
6852 |
"{ Pragma: +optSpace }" |
|
6853 |
||
6854 |
"forget pathCaches - these are collections containing valid directory names, |
|
6855 |
where system files (resource, bitmaps etc.) are found. |
|
6856 |
A flush is only required, if a new system directory has been created while |
|
6857 |
the system is active, and those files should override the others |
|
6858 |
(for example, if you created a private resource directory)" |
|
6859 |
||
6860 |
RealSystemPath := ResourcePath := SourcePath := |
|
15332 | 6861 |
BinaryPath := FileInPath := nil. |
6862 |
||
10641 | 6863 |
" |
6864 |
Smalltalk flushPathCaches |
|
6865 |
" |
|
6866 |
! |
|
6867 |
||
6868 |
getBinaryFileName:aFileName |
|
6869 |
"obsolete |
|
6870 |
search aFileName in some standard places |
|
6871 |
(subdirectories named 'binary' in SystemPath); |
|
6872 |
return the absolute filename or nil if none is found." |
|
6873 |
||
6874 |
BinaryPath isNil ifTrue:[ |
|
18668 | 6875 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 6876 |
]. |
6877 |
||
6878 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
6879 |
||
6880 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
6881 |
! |
|
6882 |
||
6883 |
getBitmapFileName:aFileName |
|
6884 |
"for backward compatibility: |
|
6885 |
search aFileName in some standard places |
|
6886 |
(subdirectories named 'bitmaps' in SystemPath); |
|
6887 |
Return the pathName or nil if none is found." |
|
6888 |
||
6889 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
6890 |
||
6891 |
" |
|
6892 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
6893 |
" |
|
6894 |
||
6895 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
6896 |
! |
|
6897 |
||
6898 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
6899 |
"for backward compatibility. |
|
6900 |
search aFileName in some standard places: |
|
6901 |
first in the redefinable bitmaps path, |
|
6902 |
then in the package directory if existing. |
|
6903 |
Return a path or nil. |
|
6904 |
Search order is: |
|
18668 | 6905 |
bitmaps/<pkg>/file |
6906 |
resources/<pkg>/bitmaps/file |
|
6907 |
<pkg>/bitmaps/file |
|
10641 | 6908 |
" |
6909 |
||
6910 |
|f dir packageDir pF| |
|
6911 |
||
15225 | 6912 |
f := aFileName asString withoutPrefix:'bitmaps/'. |
10641 | 6913 |
|
6914 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 6915 |
"/ this will be an error in the future |
10641 | 6916 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
6917 |
"/ self halt. |
|
6918 |
||
18668 | 6919 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
6920 |
pF notNil ifTrue:[ |
|
6921 |
^ pF. |
|
6922 |
]. |
|
6923 |
f ~= aFileName ifTrue:[ |
|
6924 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
6925 |
pF notNil ifTrue:[ |
|
6926 |
^ pF. |
|
6927 |
]. |
|
6928 |
]. |
|
6929 |
^ nil |
|
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6930 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6931 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6932 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6933 |
dir notNil ifTrue:[ |
18668 | 6934 |
pF := dir asFilename / f. |
6935 |
pF exists ifTrue:[ |
|
6936 |
^ pF. |
|
6937 |
]. |
|
6938 |
pF := dir asFilename / 'bitmaps' /f. |
|
6939 |
pF exists ifTrue:[ |
|
6940 |
^ pF. |
|
6941 |
]. |
|
10641 | 6942 |
]. |
6943 |
||
6944 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
6945 |
||
6946 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
6947 |
pF notNil ifTrue:[ |
|
18668 | 6948 |
^ pF. |
10641 | 6949 |
]. |
6950 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
6951 |
pF notNil ifTrue:[ |
|
18668 | 6952 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6953 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6954 |
|
10641 | 6955 |
^ nil |
6956 |
||
6957 |
" |
|
6958 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6959 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6960 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
6961 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
6962 |
" |
|
6963 |
||
6964 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
6965 |
! |
|
6966 |
||
6967 |
getFileInFileName:aFileName |
|
6968 |
"obsolete |
|
6969 |
search aFileName in some standard places |
|
6970 |
(subdirectories named 'fileIn' in SystemPath); |
|
6971 |
return the absolute filename or nil if none is found." |
|
6972 |
||
6973 |
FileInPath isNil ifTrue:[ |
|
18668 | 6974 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 6975 |
]. |
6976 |
||
6977 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
6978 |
||
6979 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
6980 |
! |
|
6981 |
||
6982 |
getPackageDirectoryForPackage:aPackageID |
|
6983 |
"search for a particular package; return its directory, or nil. |
|
6984 |
Stand alone applications might get nil, if there are only binaries installed." |
|
6985 |
||
19121 | 6986 |
|packageId checkForPackageDirectory module packageSubDirectory| |
6987 |
||
6988 |
packageId := aPackageID asPackageId. |
|
6989 |
module := packageId module. |
|
6990 |
packageSubDirectory := packageId directory. |
|
10641 | 6991 |
|
6992 |
checkForPackageDirectory := |
|
19121 | 6993 |
[:moduleDir | |
6994 |
|packageDir| |
|
6995 |
||
6996 |
moduleDir isDirectory ifTrue:[ |
|
6997 |
packageDir := moduleDir / packageSubDirectory. |
|
6998 |
packageDir isDirectory ifTrue:[ |
|
6999 |
^ packageDir |
|
7000 |
] |
|
7001 |
]. |
|
7002 |
]. |
|
10641 | 7003 |
|
7004 |
self packagePath do:[:aPath | |
|
19121 | 7005 |
|moduleDir| |
7006 |
||
7007 |
moduleDir := aPath asFilename / module. |
|
7008 |
checkForPackageDirectory value:moduleDir. |
|
10641 | 7009 |
]. |
7010 |
||
7011 |
^ nil |
|
7012 |
||
7013 |
" |
|
7014 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
7015 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
7016 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
7017 |
" |
|
7018 |
||
7019 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
7020 |
! |
|
7021 |
||
7022 |
getPackageFileName:aFileName |
|
7023 |
"search aFileName in some standard places |
|
7024 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
7025 |
return the absolute filename or nil if none is found." |
|
7026 |
||
7027 |
|f| |
|
7028 |
||
7029 |
"/ search along packagePath ... |
|
7030 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
7031 |
f isNil ifTrue:[ |
|
18668 | 7032 |
"/ search under packages-directory along systemPath ... |
7033 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
7034 |
"/ kludge - allow for stx-directory to be named differently |
|
7035 |
f isNil ifTrue:[ |
|
7036 |
(aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[ |
|
7037 |
f := '..' asFilename / '..' / (aFileName copyFrom:5). |
|
7038 |
] |
|
7039 |
]. |
|
10641 | 7040 |
]. |
7041 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
18668 | 7042 |
^ f pathName |
7758 | 7043 |
]. |
7044 |
^ nil |
|
10641 | 7045 |
|
7046 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7047 |
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
|
7048 |
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
|
7049 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
10641 | 7050 |
" |
7051 |
! |
|
7052 |
||
15074 | 7053 |
getPackageSourceFileName:filenameWithoutSuffixArg |
13415 | 7054 |
"search aFileName in some standard places and try all available languages" |
7055 |
||
15074 | 7056 |
|filenameWithoutSuffix| |
7057 |
||
7058 |
filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename. |
|
7059 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7060 |
ProgrammingLanguage |
18668 | 7061 |
allDo:[:lang | |
7062 |
|file| |
|
7063 |
||
7064 |
file := self |
|
7065 |
getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix). |
|
7066 |
file notNil ifTrue:[ ^ file ] |
|
7067 |
]. |
|
15074 | 7068 |
^ nil |
13415 | 7069 |
|
7070 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7071 |
! |
|
7072 |
||
10641 | 7073 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7074 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7075 |
|
10641 | 7076 |
"search aFileName in some standard places |
7077 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7078 |
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
|
7079 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7080 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7081 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 7082 |
^ self getResourceFileName:aFileName forPackage:nil |
7083 |
||
7084 |
" |
|
7085 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
7086 |
" |
|
7087 |
||
7088 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
7089 |
! |
|
7090 |
||
7091 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
7092 |
"search aFileName in some standard places |
|
7093 |
(subdirectories named 'resource' in SystemPath); |
|
7094 |
and in aClasses package directory. |
|
7095 |
Return the absolute filename or nil if none is found." |
|
7096 |
||
7097 |
|pkgOrNil| |
|
7098 |
||
7099 |
aClassOrNil notNil ifTrue:[ |
|
18668 | 7100 |
pkgOrNil := aClassOrNil package. |
10641 | 7101 |
]. |
7102 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
7103 |
||
7104 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7105 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 7106 |
" |
7107 |
! |
|
7108 |
||
7109 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
7110 |
"search aFileName in some standard places |
|
7111 |
(subdirectories named 'resource' in SystemPath); |
|
7112 |
and in a packages directory. |
|
7113 |
Return the absolute filename or nil if none is found. |
|
7114 |
Search order is: |
|
18668 | 7115 |
resources/<pkg>/file |
7116 |
<pkg>/resources/file |
|
10641 | 7117 |
" |
7118 |
||
7119 |
|pF f dir packageDir| |
|
7120 |
||
15225 | 7121 |
f := aFileName asString withoutPrefix:'resources/'. |
10641 | 7122 |
|
7123 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7124 |
"/ this will be an error in the future |
10641 | 7125 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
7126 |
"/ self halt. |
|
7127 |
||
18668 | 7128 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
7129 |
pF notNil ifTrue:[ |
|
7130 |
^ pF. |
|
7131 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7132 |
"/ 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
|
7133 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7134 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7135 |
"/ ]. |
18668 | 7136 |
f ~= aFileName ifTrue:[ |
7137 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
|
7138 |
pF notNil ifTrue:[ |
|
7139 |
^ pF. |
|
7140 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7141 |
"/ 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
|
7142 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7143 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7144 |
"/ ]. |
18668 | 7145 |
]. |
7146 |
^ nil |
|
10641 | 7147 |
]. |
7148 |
||
7149 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7150 |
||
7151 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
|
7152 |
pF notNil ifTrue:[ |
|
18668 | 7153 |
^ pF. |
10641 | 7154 |
]. |
7155 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7156 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 7157 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
7158 |
dir notNil ifTrue:[ |
|
18668 | 7159 |
dir := dir asFilename. |
7160 |
||
7161 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7162 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 7163 |
|
18668 | 7164 |
"resolve something like: 'ASN/definition.asn1'" |
7165 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
|
12377 | 7166 |
]. |
7167 |
||
10641 | 7168 |
^ nil |
7169 |
||
7170 |
" |
|
7171 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
7172 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7173 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7174 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 7175 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
7176 |
" |
|
7177 |
||
7178 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
7179 |
! |
|
7180 |
||
7181 |
getSourceFileName:aFileName |
|
7182 |
"search aFileName in some standard places |
|
7183 |
(subdirectories named 'source' in SystemPath); |
|
7184 |
return the absolute filename or nil if none is found. |
|
7185 |
This is used to find a sourceFile for a methods source, |
|
7186 |
if no sourceCodeManager is available." |
|
7187 |
||
7188 |
|f| |
|
7189 |
||
7190 |
SourcePath isNil ifTrue:[ |
|
18668 | 7191 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 7192 |
]. |
7193 |
||
7194 |
"/ first, try a source subdir along the path. |
|
7195 |
SourcePath notNil ifTrue:[ |
|
18668 | 7196 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 7197 |
]. |
7198 |
f isNil ifTrue:[ |
|
18668 | 7199 |
"/ then, try it itself along the path. |
7200 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
10641 | 7201 |
]. |
7202 |
^ f |
|
7203 |
||
7204 |
" |
|
7205 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
7206 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
7207 |
" |
|
7208 |
||
7209 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
7210 |
! |
|
7211 |
||
7212 |
getSystemFileName:aFileNameOrString |
|
7213 |
"search aFileNameOrString in some standard places; |
|
7214 |
return the absolute filename or nil if none is found. |
|
7215 |
see comment in Smalltalk>>initSystemPath. |
|
7216 |
This should be used to access resources such as bitmaps, doc-files, |
|
7217 |
and other help files. |
|
7218 |
" |
|
7219 |
||
7220 |
"credits for this method go to Markus ...." |
|
7221 |
||
7222 |
|fn nameString| |
|
7223 |
||
7224 |
fn := aFileNameOrString asFilename. |
|
7225 |
nameString := fn name. |
|
7226 |
fn isAbsolute ifTrue:[ |
|
18668 | 7227 |
"dont use path for absolute file names" |
7228 |
||
7229 |
^ nameString |
|
10641 | 7230 |
]. |
7231 |
||
7232 |
self realSystemPath do:[:dirName | |
|
18668 | 7233 |
|realName| |
7234 |
||
7235 |
realName := dirName asFilename / nameString. |
|
7236 |
"/ |
|
7237 |
"/ here, we also return true if its a directory |
|
7238 |
"/ (Even if unreadable). |
|
7239 |
"/ It could be that the file itself is still readable. |
|
7240 |
"/ |
|
7241 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
7242 |
^ realName name |
|
7243 |
] |
|
10641 | 7244 |
]. |
7245 |
^ nil |
|
7246 |
||
7247 |
" |
|
7248 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
7249 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
7250 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
7251 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
7252 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
7253 |
" |
|
7254 |
||
7255 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
7256 |
! |
|
7257 |
||
7258 |
imageFromFileNamed:aFileName forClass:aClass |
|
7259 |
"search aFileName in some standard places: |
|
7260 |
first in the redefinable bitmaps path, then in the classes |
|
7261 |
own package directory if existing. |
|
7262 |
Return an image or nil." |
|
7263 |
||
7264 |
|classPackage img| |
|
7265 |
||
7266 |
classPackage := aClass package. |
|
7267 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
7268 |
img isNil ifTrue:[ |
|
18668 | 7269 |
"/ try under the goodies package ... |
7270 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
7271 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
7272 |
] |
|
10641 | 7273 |
]. |
7274 |
^ img |
|
7275 |
||
7276 |
" |
|
7277 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7278 |
" |
|
7279 |
! |
|
7280 |
||
7281 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
7282 |
"search aFileName in some standard places: |
|
7283 |
first in the redefinable bitmaps path, |
|
7284 |
then in the package directory if existing. |
|
7285 |
Return an image or nil. |
|
7286 |
Search order is: |
|
18668 | 7287 |
bitmaps/<pkg>/file |
7288 |
resources/<pkg>/bitmaps/file |
|
7289 |
<pkg>/bitmaps/file |
|
10641 | 7290 |
" |
7291 |
||
7292 |
|path| |
|
7293 |
||
7294 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
7295 |
path notNil ifTrue:[ |
|
18668 | 7296 |
^ Image fromFile:path. |
10641 | 7297 |
]. |
7298 |
^ nil |
|
7299 |
||
7300 |
" |
|
7301 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7302 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7303 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7304 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7305 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
7306 |
" |
|
7307 |
||
7308 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
7309 |
! |
|
7310 |
||
7311 |
libraryFileNameOfClass:aClassOrClassName |
|
7312 |
"for a given class, return the name of a classLibrary which contains |
|
7313 |
binary code for it. |
|
7314 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
7315 |
for an entry for aClassOrClassName. |
|
7316 |
Search for the className in the first col, and return the value found in |
|
7317 |
the 2nd col. |
|
7318 |
Return nil if no entry is found. |
|
7319 |
||
7320 |
A nil returns means that this class is either built-in or not present |
|
7321 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
7322 |
Otherwise, the returned name is the classLibrary object of that class. |
|
7323 |
The classes code can be loaded from that file if binary loading is supported." |
|
7324 |
||
7325 |
|aStream line words n aClassName| |
|
7326 |
||
7327 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 7328 |
aClassName := aClassOrClassName name |
10641 | 7329 |
] ifFalse:[ |
18668 | 7330 |
aClassName := aClassOrClassName |
10641 | 7331 |
]. |
7332 |
aClassName := aClassName asString. |
|
7333 |
||
7334 |
#('include/liblist.stc') "/ filenames |
|
7335 |
with:#(2) "/ column |
|
7336 |
do:[:fileName :col | |
|
7337 |
||
18668 | 7338 |
aStream := self systemFileStreamFor:fileName. |
7339 |
aStream notNil ifTrue:[ |
|
7340 |
[aStream atEnd] whileFalse:[ |
|
7341 |
line := aStream nextLine. |
|
7342 |
line notNil ifTrue:[ |
|
7343 |
(line startsWith:'#') ifFalse:[ |
|
7344 |
words := line asCollectionOfWords. |
|
7345 |
(n := words size) > 1 ifTrue:[ |
|
7346 |
(words at:1) = aClassName ifTrue:[ |
|
7347 |
n >= col ifTrue:[ |
|
7348 |
aStream close. |
|
7349 |
^ (words at:col) withoutSeparators |
|
7350 |
] |
|
7351 |
] |
|
7352 |
] |
|
7353 |
] |
|
7354 |
] |
|
7355 |
]. |
|
7356 |
aStream close |
|
7357 |
]. |
|
10641 | 7358 |
]. |
7359 |
||
7360 |
^ nil |
|
7361 |
||
7362 |
" |
|
7363 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
7364 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
7365 |
" |
|
7366 |
||
7367 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
7368 |
! |
|
7369 |
||
7370 |
packagePath |
|
15781 | 7371 |
"return a collection of additional directory names, where smalltalk |
10641 | 7372 |
looks for package directories. |
7373 |
Notice, that directories named 'packages' under the systemPath are |
|
7374 |
always consulted - even if not in the packagePath" |
|
7375 |
||
7376 |
^ PackagePath |
|
7377 |
||
7378 |
" |
|
7379 |
Smalltalk packagePath |
|
7380 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
7381 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
7382 |
" |
|
7383 |
! |
|
7384 |
||
7385 |
packagePath:aPath |
|
7386 |
"set the packagePath; |
|
7387 |
a collection of additional directorynames, where smalltalk |
|
7388 |
looks for package directories. |
|
7389 |
Notice, that directories named 'packages' under the systemPath are |
|
7390 |
always consulted - even if not in the packagePath" |
|
7391 |
||
7392 |
PackagePath := aPath asOrderedCollection |
|
7393 |
||
7394 |
" |
|
7395 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
7396 |
" |
|
7397 |
! |
|
7398 |
||
7399 |
projectDirectoryForClass:aClass |
|
7400 |
"given a class, return the path to its package directory; |
|
7401 |
nil if not found." |
|
7402 |
||
7403 |
|pkg| |
|
7404 |
||
7405 |
pkg := aClass package. |
|
7406 |
pkg isNil ifTrue:[^ nil]. |
|
7407 |
||
7408 |
^ self projectDirectoryForPackage:pkg. |
|
7409 |
||
7410 |
" |
|
7411 |
Smalltalk projectDirectoryForClass:Array |
|
7412 |
Smalltalk projectDirectoryForClass:View |
|
7413 |
" |
|
7414 |
! |
|
7415 |
||
7416 |
projectDirectoryForPackage:aPackage |
|
7417 |
"given a packageID, return the path to its package directory; |
|
7418 |
nil if not found." |
|
7419 |
||
7420 |
|prj prjDir| |
|
7421 |
||
16642 | 7422 |
^ aPackage asPackageId packageDirectory. |
7423 |
||
10641 | 7424 |
"/ there might be a package specific resource directory ... |
7425 |
"/ in the directory, from which the project was loaded |
|
7426 |
prj := Project projectWithId:aPackage. |
|
7427 |
prj notNil ifTrue:[ |
|
18668 | 7428 |
prjDir := prj directory. |
10641 | 7429 |
]. |
7430 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
18668 | 7431 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 7432 |
]. |
7433 |
^ prjDir |
|
7434 |
||
7435 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7436 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
10641 | 7437 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7438 |
Smalltalk projectDirectoryForPackage:'stx' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7439 |
Smalltalk projectDirectoryForPackage:'bosch' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7440 |
Smalltalk projectDirectoryForPackage:'bosch:foo' |
10641 | 7441 |
" |
7442 |
||
7443 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
7444 |
! |
|
7445 |
||
7446 |
readAbbreviations |
|
7447 |
"read classname to filename mappings from include/abbrev.stc. |
|
7448 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
7449 |
||
7450 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
7451 |
||
7452 |
CachedAbbreviations := IdentityDictionary new. |
|
7453 |
self installAutoloadedClasses. |
|
7454 |
^ CachedAbbreviations. |
|
7455 |
||
7456 |
" |
|
7457 |
Smalltalk readAbbreviations |
|
7458 |
" |
|
7459 |
||
7460 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
7461 |
! |
|
7462 |
||
7463 |
readAbbreviationsFromStream:aStream |
|
7464 |
"read classname to filename mappings from aStream. |
|
7465 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
7466 |
||
11375 | 7467 |
self |
18668 | 7468 |
withAbbreviationsFromStream:aStream |
7469 |
do:[:className :abbrev :pkg | |
|
7470 |
self setFilename:abbrev forClass:className package:pkg. |
|
7471 |
]. |
|
10641 | 7472 |
|
7473 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
7474 |
! |
|
7475 |
||
7476 |
realSystemPath |
|
16642 | 7477 |
"return the realSystemPath - that's the directory names from |
10641 | 7478 |
SystemPath which exist and are readable" |
7479 |
||
7480 |
|nP| |
|
7481 |
||
7482 |
RealSystemPath isNil ifTrue:[ |
|
18668 | 7483 |
OperatingSystem isVMSlike ifTrue:[ |
7484 |
"/ temporary kludge: since we cannot currently |
|
7485 |
"/ check for existence of a name like 'volume:', |
|
7486 |
"/ leave those in the Path without a check. |
|
7487 |
RealSystemPath := SystemPath select:[:dirName | |f| |
|
7488 |
f := dirName asFilename. |
|
7489 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
|
7490 |
] |
|
7491 |
] ifFalse:[ |
|
7492 |
RealSystemPath := SystemPath |
|
7493 |
select:[:eachDirectoryName | |f| |
|
7494 |
f := eachDirectoryName asFilename. |
|
7495 |
(f isDirectory) and:[f isReadable] |
|
7496 |
] thenCollect:[:eachDirectoryName| |
|
7497 |
eachDirectoryName asFilename pathName. |
|
7498 |
]. |
|
7499 |
||
7500 |
"/ remove duplicates (but keep order) |
|
7501 |
nP := OrderedCollection new. |
|
7502 |
RealSystemPath do:[:p | |
|
7503 |
(nP includes:p) ifFalse:[ |
|
7504 |
nP add:p |
|
7505 |
] |
|
7506 |
]. |
|
7507 |
(nP includes:'.') ifFalse:[ |
|
7508 |
nP add:'.' |
|
7509 |
]. |
|
7510 |
RealSystemPath := nP. |
|
7511 |
]. |
|
617 | 7512 |
]. |
7513 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7514 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7515 |
|
10641 | 7516 |
recursiveReadAllAbbreviationsFrom:aDirectory |
7517 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
7518 |
! |
|
7519 |
||
7520 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
7521 |
"read all abbreviations from and under aDirectory." |
|
7522 |
||
7523 |
|abbrevStream dir directoryContents| |
|
7524 |
||
7525 |
maxLevels == 0 ifTrue:[ |
|
7526 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
19117 | 7527 |
^ self |
10641 | 7528 |
]. |
7529 |
||
7530 |
dir := aDirectory asFilename. |
|
7531 |
dir exists ifFalse:[^ self]. |
|
7532 |
||
7533 |
[ |
|
19117 | 7534 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
7535 |
self readAbbreviationsFromStream:abbrevStream. |
|
7536 |
abbrevStream close. |
|
10641 | 7537 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
7538 |
||
7539 |
[ |
|
19117 | 7540 |
directoryContents := dir directoryContents. |
10641 | 7541 |
] on:FileStream openErrorSignal do:[:ex| |
19117 | 7542 |
"non-accessible directory: we are done" |
7543 |
^ self |
|
10641 | 7544 |
]. |
7545 |
||
7546 |
directoryContents do:[:aFilename | |
|
19117 | 7547 |
|f| |
7548 |
||
7549 |
(#( |
|
7550 |
'doc' |
|
7551 |
'CVS' |
|
7552 |
'bitmaps' |
|
7553 |
'resources' |
|
7554 |
'source' |
|
7555 |
) includes:aFilename) ifFalse:[ |
|
7556 |
f := dir / aFilename. |
|
7557 |
f isDirectory ifTrue:[ |
|
7558 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
7559 |
] |
|
7560 |
]. |
|
4458 | 7561 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7562 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7563 |
|
15334 | 7564 |
reinitializePackagePath |
7565 |
"{ Pragma: +optSpace }" |
|
18868 | 7566 |
|
15334 | 7567 |
PackagePath notNil ifTrue:[ |
18868 | 7568 |
PackagePath := PackagePath select:[:p | p asFilename exists]. |
15334 | 7569 |
]. |
7570 |
PackagePath isEmptyOrNil ifTrue:[ |
|
18868 | 7571 |
PackagePath := OperatingSystem defaultPackagePath |
7572 |
]. |
|
7573 |
self addWorkspaceDirectoryToPackagePath. |
|
15334 | 7574 |
! |
7575 |
||
13368 | 7576 |
relativePackagePathForPackage:aPackage |
7577 |
|path| |
|
7578 |
||
7579 |
PackageToPathMapping notNil ifTrue:[ |
|
18668 | 7580 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
7581 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
13370 | 7582 |
]. |
7583 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 7584 |
|
7585 |
" |
|
7586 |
PackageToPathMapping := Dictionary new. |
|
7587 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
7588 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
7589 |
||
7590 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
7591 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
7592 |
" |
|
7593 |
! |
|
7594 |
||
10641 | 7595 |
resourceDirectoryForPackage:aPackage |
7596 |
"given a packageID, return the path to its resource directory; |
|
7597 |
nil if not found." |
|
7598 |
||
7599 |
|prjDir rsrcDir| |
|
7600 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
7601 |
aPackage notNil ifTrue:[ |
18668 | 7602 |
prjDir := self projectDirectoryForPackage:aPackage. |
7603 |
||
7604 |
(prjDir notNil |
|
7605 |
and:[(prjDir := prjDir asFilename) exists |
|
7606 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
|
7607 |
^ rsrcDir |
|
7608 |
]. |
|
7609 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
|
7610 |
rsrcDir notNil ifTrue:[ |
|
7611 |
^ rsrcDir asFilename |
|
7612 |
]. |
|
10641 | 7613 |
]. |
7614 |
^ nil |
|
7615 |
||
7616 |
" |
|
7617 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
7618 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
7619 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
7620 |
" |
|
7621 |
! |
|
7622 |
||
7623 |
resourceFileStreamFor:aFileName |
|
7624 |
"search aFileName in some standard places; |
|
7625 |
return a readonly fileStream or nil if not found. |
|
7626 |
Searches in subdirectories named 'resource' in SystemPath" |
|
7627 |
||
7628 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
7629 |
! |
|
7630 |
||
7631 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
7632 |
"search aFileName in some standard places and in the classes |
|
7633 |
package-resource directory. |
|
7634 |
Return a readonly fileStream or nil if not found. |
|
7635 |
Searches in subdirectories named 'resource' in SystemPath" |
|
7636 |
||
7637 |
|aString| |
|
7638 |
||
7639 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
7640 |
aString notNil ifTrue:[ |
|
18668 | 7641 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7642 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7643 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7644 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7645 |
|
10641 | 7646 |
searchPath:aPath for:aFileName in:aDirName |
7647 |
"search aPath for a subdirectory named aDirectory with a file |
|
7648 |
named aFileName" |
|
7649 |
||
7650 |
|f| |
|
7651 |
||
7652 |
((f := aFileName asFilename) isAbsolute |
|
7653 |
or:[f isExplicitRelative]) ifTrue:[ |
|
18668 | 7654 |
"/ |
7655 |
"/ dont use path for absolute or explicit .-relative file names |
|
7656 |
"/ |
|
7657 |
^ aFileName |
|
10641 | 7658 |
]. |
7659 |
||
7660 |
aPath notNil ifTrue:[ |
|
18668 | 7661 |
aPath do:[:dirName | |
7662 |
|realName dir| |
|
7663 |
||
7664 |
dir := dirName asFilename. |
|
7665 |
aDirName notNil ifTrue:[ |
|
7666 |
realName := dir / aDirName / aFileName. |
|
7667 |
] ifFalse:[ |
|
7668 |
realName := dir / aFileName. |
|
7669 |
]. |
|
7670 |
(realName isReadable) ifTrue:[ |
|
7671 |
^ realName name |
|
7672 |
] |
|
7673 |
]. |
|
11108 | 7674 |
]. |
7675 |
||
7676 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 7677 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 7678 |
"/ (realName isReadable) ifTrue:[ |
7679 |
"/ ^ realName name |
|
7680 |
"/ ]. |
|
10641 | 7681 |
^ nil. |
7682 |
||
7683 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
7684 |
! |
|
7685 |
||
7686 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
7687 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
7688 |
||
7689 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 7690 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 7691 |
]. |
7692 |
||
7693 |
abbrevs := CachedAbbreviations. |
|
7694 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
18668 | 7695 |
classNameSymbol := aClassNameString asSymbol. |
7696 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
7697 |
oldAbbrev notNil ifTrue:[ |
|
7698 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
7699 |
oldAbbrev asFilename isAbsolute |
|
7700 |
ifTrue:[ oldPath := oldAbbrev ] |
|
7701 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
7702 |
aFileNameString asFilename isAbsolute |
|
7703 |
ifTrue:[ newPath := aFileNameString ] |
|
7704 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
7705 |
||
7706 |
oldPath ~= newPath ifTrue:[ |
|
7707 |
StandAlone ifFalse:[ |
|
7708 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
7709 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
7710 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
7711 |
] |
|
7712 |
] |
|
7713 |
]. |
|
7714 |
"overwrite old abbreviation with new one, |
|
7715 |
to allow fixing of bad abbrev files" |
|
7716 |
]. |
|
7717 |
||
7718 |
cls := self classNamed:aFileNameString. |
|
7719 |
cls notNil ifTrue:[ |
|
7720 |
cls name ~= aClassNameString ifTrue:[ |
|
7721 |
"/ ok, there is a class named after this abbrev ... |
|
7722 |
"/ this is only a conflict, if the other class has no |
|
7723 |
"/ abbreviation (or the same). |
|
7724 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
7725 |
cls isNameSpace ifFalse:[ |
|
7726 |
aPackageNameString = cls package ifTrue:[ |
|
7727 |
StandAlone ifFalse:[ |
|
7728 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
7729 |
' in package ' , aPackageNameString) infoPrintCR. |
|
7730 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
7731 |
, ')') infoPrintCR |
|
7732 |
] |
|
7733 |
] |
|
7734 |
] |
|
7735 |
] |
|
7736 |
] |
|
7737 |
]. |
|
7738 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
7739 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7740 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7741 |
|
10641 | 7742 |
sourceDirectoryNameOfClass:aClassOrClassName |
7743 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
7744 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
7745 |
for an entry for aClassOrClassName. |
|
7746 |
Search for the className in the first col, and return the value found in |
|
7747 |
the 3rd col. |
|
7748 |
Return nil if no entry is found." |
|
7749 |
||
7750 |
|aStream line words n aClassName| |
|
7751 |
||
7752 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 7753 |
aClassName := aClassOrClassName name |
10641 | 7754 |
] ifFalse:[ |
18668 | 7755 |
aClassName := aClassOrClassName |
10641 | 7756 |
]. |
7757 |
aClassName := aClassName asString. |
|
7758 |
||
7759 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
7760 |
with:#(3 2) "/ column |
|
7761 |
do:[:fileName :col | |
|
7762 |
||
18668 | 7763 |
aStream := self systemFileStreamFor:fileName. |
7764 |
aStream notNil ifTrue:[ |
|
7765 |
[aStream atEnd] whileFalse:[ |
|
7766 |
line := aStream nextLine. |
|
7767 |
line notNil ifTrue:[ |
|
7768 |
(line startsWith:'#') ifFalse:[ |
|
7769 |
words := line asCollectionOfWords. |
|
7770 |
(n := words size) > 1 ifTrue:[ |
|
7771 |
(words at:1) = aClassName ifTrue:[ |
|
7772 |
n >= col ifTrue:[ |
|
7773 |
aStream close. |
|
7774 |
^ (words at:col) withoutSeparators |
|
7775 |
] |
|
7776 |
] |
|
7777 |
] |
|
7778 |
] |
|
7779 |
] |
|
7780 |
]. |
|
7781 |
aStream close |
|
7782 |
]. |
|
10641 | 7783 |
]. |
7784 |
||
7785 |
^ nil |
|
7786 |
||
7787 |
" |
|
7788 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
7789 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
7790 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
7791 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
7792 |
" |
|
7793 |
||
7794 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
7795 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
7796 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
7797 |
! |
|
7798 |
||
7799 |
sourceFileStreamFor:aFileName |
|
7800 |
"search aFileName in some standard places; |
|
7801 |
return a readonly fileStream or nil if not found. |
|
7802 |
Searches in subdirectories named 'source' in SystemPath" |
|
7803 |
||
7804 |
|aString| |
|
7805 |
||
7806 |
aString := self getSourceFileName:aFileName. |
|
7807 |
aString notNil ifTrue:[ |
|
18668 | 7808 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7809 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7810 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7811 |
! |
7758 | 7812 |
|
10641 | 7813 |
systemFileStreamFor:aFileName |
7814 |
"search aFileName in some standard places; |
|
7815 |
return a readonly fileStream or nil if not found. |
|
7816 |
see comment in Smalltalk>>initSystemPath" |
|
7817 |
||
7818 |
|aString| |
|
7819 |
||
7820 |
aString := self getSystemFileName:aFileName. |
|
7821 |
aString notNil ifTrue:[ |
|
18668 | 7822 |
^ aString asFilename readStreamOrNil |
617 | 7823 |
]. |
7824 |
^ nil |
|
7825 |
! |
|
7826 |
||
10641 | 7827 |
systemPath |
7828 |
"return a collection of directorynames, where smalltalk |
|
7829 |
looks for system files |
|
7830 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
7831 |
see comment in Smalltalk>>initSystemPath." |
|
7832 |
||
7833 |
^ SystemPath |
|
7834 |
||
7835 |
" |
|
7836 |
Smalltalk systemPath |
|
7837 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
7838 |
" |
|
7839 |
! |
|
7840 |
||
7841 |
systemPath:aPath |
|
7842 |
"set the collection of directorynames, where smalltalk |
|
7843 |
looks for system files |
|
7844 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
7845 |
see comment in Smalltalk>>initSystemPath." |
|
7846 |
||
7847 |
SystemPath := aPath. |
|
7848 |
self flushPathCaches |
|
7849 |
||
7850 |
" |
|
7851 |
Smalltalk systemPath |
|
7852 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7853 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7854 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7855 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7856 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7857 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7858 |
Evaluate aBlock for each tuple: |
18668 | 7859 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7860 |
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
|
7861 |
|
13415 | 7862 |
|line lineNo words nm abbrev pkg category size s w| |
7863 |
||
7864 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7865 |
[aStream atEnd] whileFalse:[ |
18668 | 7866 |
line := aStream nextLine. |
7867 |
lineNo := lineNo + 1. |
|
7868 |
line notEmptyOrNil ifTrue:[ |
|
7869 |
(line startsWith:'#') ifFalse:[ |
|
7870 |
||
7871 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7872 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7873 |
|
18668 | 7874 |
words := OrderedCollection new. |
7875 |
s := line readStream. |
|
7876 |
[s atEnd] whileFalse:[ |
|
7877 |
s skipSeparators. |
|
7878 |
s peek == $' ifTrue:[ |
|
7879 |
s next. |
|
7880 |
w := s upTo:$'. |
|
7881 |
s skipSeparators. |
|
7882 |
] ifFalse:[ |
|
7883 |
w := s upToSeparator |
|
7884 |
]. |
|
7885 |
words add:w |
|
7886 |
]. |
|
7887 |
words size >= 3 ifTrue:[ |
|
7888 |
nm := (words at:1) withoutSeparators. |
|
7889 |
abbrev := (words at:2) withoutSeparators. |
|
7890 |
pkg := (words at:3) withoutSeparators. |
|
7891 |
aBlock argumentCount = 3 ifTrue:[ |
|
7892 |
aBlock value:nm value:abbrev value:pkg. |
|
7893 |
] ifFalse:[ |
|
7894 |
words size >= 4 ifTrue:[ |
|
7895 |
category := words at:4. |
|
7896 |
]. |
|
7897 |
words size = 5 ifTrue:[ |
|
7898 |
size := (words at:5) asNumber |
|
7899 |
]. |
|
7900 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
7901 |
] |
|
7902 |
] ifFalse:[ |
|
7903 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
7904 |
] |
|
7905 |
] |
|
7906 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
7907 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
7908 |
|
13415 | 7909 |
"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
|
7910 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7911 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7912 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7913 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7914 |
|
16159 | 7915 |
isPackageLoaded:aPackageIdOrPackage |
7916 |
|projectDefinition| |
|
7917 |
||
7918 |
projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass. |
|
16161 | 7919 |
^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]] |
16159 | 7920 |
|
7921 |
" |
|
7922 |
Smalltalk isPackageLoaded:'stx:goodies/persistency' |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7923 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint' |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7924 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling' |
16159 | 7925 |
" |
7926 |
! |
|
7927 |
||
10641 | 7928 |
loadPackage:aPackageIdOrPackage |
12250 | 7929 |
"make certain, that some particular package is loaded into the system. |
7930 |
Return true if loaded, false otherwise." |
|
11668 | 7931 |
|
7932 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
7933 |
||
7934 |
" |
|
7935 |
Smalltalk loadPackage:'stx:libbasic' |
|
7936 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7937 |
Smalltalk loadPackage:'cg:cparser' |
|
7938 |
Smalltalk loadPackage:'cg:rose' |
|
7939 |
" |
|
7940 |
! |
|
7941 |
||
10641 | 7942 |
packageDirectoryForPackageId:aPackageId |
12250 | 7943 |
"used by classes to find the location of their resource- and bitmap directories. |
7944 |
||
7945 |
Notice that the directory structure is different between the development |
|
7946 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
7947 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
7948 |
At runtime, Smalltalk knows about the systemPath setting." |
|
7949 |
||
10641 | 7950 |
|packageDirName packageDir| |
7951 |
||
14589 | 7952 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
10641 | 7953 |
|
7954 |
packageDir := self getPackageFileName:packageDirName. |
|
7955 |
packageDir isNil ifTrue:[ |
|
18668 | 7956 |
^ nil. |
10641 | 7957 |
]. |
7958 |
^ packageDir asFilename |
|
7959 |
||
7960 |
" |
|
11375 | 7961 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 7962 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
7963 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
7964 |
" |
|
12250 | 7965 |
! |
7966 |
||
18794 | 7967 |
requirePackage:aPackageIdOrPackage |
7968 |
"make certain, that some particular package is loaded into the system. |
|
7969 |
Return true if loaded, false otherwise. |
|
7970 |
Just an alias which is easier to remember" |
|
7971 |
||
7972 |
^ self loadPackage:aPackageIdOrPackage |
|
7973 |
||
7974 |
" |
|
7975 |
Smalltalk loadPackage:'stx:libbasic' |
|
7976 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7977 |
Smalltalk loadPackage:'cg:cparser' |
|
7978 |
Smalltalk loadPackage:'cg:rose' |
|
7979 |
" |
|
7980 |
! |
|
7981 |
||
12250 | 7982 |
unloadPackage:aPackageIdOrPackage |
7983 |
|projectDefinition| |
|
7984 |
||
7985 |
projectDefinition := aPackageIdOrPackage. |
|
7986 |
projectDefinition isProjectDefinition ifFalse:[ |
|
18668 | 7987 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
7988 |
projectDefinition isNil ifTrue:[ |
|
7989 |
'Smalltalk [info] trying to unload non-existing package: ' infoPrint. aPackageIdOrPackage infoPrintCR. |
|
7990 |
^ self. |
|
7991 |
]. |
|
12250 | 7992 |
]. |
7993 |
projectDefinition unloadPackage. |
|
7994 |
||
7995 |
" |
|
7996 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7997 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
7998 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7999 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8000 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8001 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8002 |
|
10641 | 8003 |
clearUndeclaredVariables |
8004 |
"remove all undeclared variables" |
|
8005 |
||
8006 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
18668 | 8007 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 8008 |
]. |
8009 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8010 |
Smalltalk removeKey:#Undeclared. |
10641 | 8011 |
! |
8012 |
||
8013 |
undeclaredPrefix |
|
8014 |
"the prefix used for undeclared variables" |
|
8015 |
||
8016 |
^ 'Undeclared:::' |
|
8017 |
||
8018 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 8019 |
! ! |
8020 |
||
8021 |
!Smalltalk class methodsFor:'time-versions'! |
|
8022 |
||
10641 | 8023 |
configuration |
8024 |
"{ Pragma: +optSpace }" |
|
8025 |
||
8026 |
"for developers only: return the configuration, with which |
|
8027 |
this smalltalk was compiled." |
|
8028 |
||
8029 |
%{ /* NOCONTEXT */ |
|
8030 |
extern char *__getConfigurationString(); |
|
8031 |
||
8032 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
8033 |
%}. |
|
8034 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
8035 |
||
8036 |
" |
|
10071 | 8037 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8038 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8039 |
! |
453 | 8040 |
|
10641 | 8041 |
copyrightString |
8042 |
"{ Pragma: +optSpace }" |
|
8043 |
||
8044 |
"return a copyright string" |
|
8045 |
||
8046 |
%{ /* NOCONTEXT */ |
|
8047 |
#ifndef __getCopyrightString |
|
8048 |
extern OBJ __getCopyrightString(); |
|
8049 |
#endif |
|
8050 |
||
8051 |
RETURN (__getCopyrightString()); |
|
8052 |
%}. |
|
8053 |
^ self primitiveFailed |
|
8054 |
||
8055 |
" |
|
7758 | 8056 |
Smalltalk copyrightString |
8057 |
" |
|
8058 |
! |
|
8059 |
||
10641 | 8060 |
distributorString |
8061 |
"{ Pragma: +optSpace }" |
|
8062 |
||
8063 |
"return a string describing the distributor of this software" |
|
8064 |
||
8065 |
%{ /* NOCONTEXT */ |
|
8066 |
#ifndef __getDistributorString |
|
8067 |
extern OBJ __getDistributorString(); |
|
8068 |
#endif |
|
8069 |
||
8070 |
RETURN (__getDistributorString()); |
|
8071 |
%}. |
|
8072 |
^ 'eXept Software AG, Germany' |
|
8073 |
||
8074 |
" |
|
8075 |
Smalltalk distributorString |
|
8076 |
" |
|
8077 |
! |
|
8078 |
||
8079 |
expirationTime |
|
8080 |
"{ Pragma: +optSpace }" |
|
8081 |
||
8082 |
"for developers only: return the time when the system will expire. |
|
8083 |
after this time it will not run any longer. |
|
8084 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
8085 |
||
8086 |
|exp| |
|
8087 |
||
8088 |
%{ |
|
8089 |
extern unsigned int __getExpirationTime(); |
|
8090 |
||
8091 |
exp = __MKUINT(__getExpirationTime()); |
|
8092 |
%}. |
|
8093 |
exp == 0 ifTrue:[ |
|
18668 | 8094 |
^ nil |
10641 | 8095 |
]. |
8096 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
8097 |
||
8098 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8099 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8100 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8101 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8102 |
|
10641 | 8103 |
fullVersionString |
8104 |
"{ Pragma: +optSpace }" |
|
8105 |
||
8106 |
"return a full version string" |
|
8107 |
||
8108 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
|
8109 |
||
8110 |
" |
|
8111 |
Smalltalk fullVersionString |
|
8112 |
" |
|
8113 |
||
8114 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
8115 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
8116 |
! |
|
8117 |
||
8118 |
hello |
|
8119 |
"{ Pragma: +optSpace }" |
|
8120 |
||
8121 |
"return a greeting string" |
|
8122 |
||
8123 |
"stupid: this should come from a resource file ... |
|
18924 | 8124 |
but I don't use it here, to allow mini-systems without |
10641 | 8125 |
Resource-stuff." |
8126 |
||
8127 |
|proto lang| |
|
8128 |
||
8129 |
lang := Language. |
|
8130 |
(lang == #de) ifTrue:[ |
|
18924 | 8131 |
proto := 'Willkommen bei %1 (Version %2 von %3)' |
10641 | 8132 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
18924 | 8133 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
10641 | 8134 |
] ifFalse:[ (lang == #it) ifTrue:[ |
18924 | 8135 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
10641 | 8136 |
] ifFalse:[ (lang == #es) ifTrue:[ |
18924 | 8137 |
proto := 'Hola, bienvenida a %1 (version %2 de %3)' |
8138 |
] ifFalse:[ (lang == #pt) ifTrue:[ |
|
8139 |
proto := 'Olá!!, mem-vindo a %1 (version %2 de %3)' |
|
10641 | 8140 |
] ifFalse:[ (lang == #no) ifTrue:[ |
18924 | 8141 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
10641 | 8142 |
]]]]]]. |
8143 |
||
8144 |
"/ ... more needed here ... |
|
8145 |
||
8146 |
proto isNil ifTrue:[ |
|
18924 | 8147 |
proto := 'Hello World - welcome to %1 version %2 of %3'. |
10641 | 8148 |
]. |
8149 |
||
8150 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
18924 | 8151 |
with:(self versionString) |
8152 |
with:(self versionDate) |
|
10641 | 8153 |
|
8154 |
" |
|
8155 |
Smalltalk language:#us. |
|
8156 |
Smalltalk hello |
|
8157 |
||
8158 |
Smalltalk language:#de. |
|
8159 |
Smalltalk hello |
|
8160 |
||
8161 |
Smalltalk language:#no. |
|
8162 |
Smalltalk hello |
|
8163 |
||
8164 |
Transcript showCR:(Smalltalk hello) |
|
8165 |
Stdout showCR:(Smalltalk hello) |
|
8166 |
" |
|
8167 |
||
8168 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
8169 |
! |
|
8170 |
||
8171 |
imageRestartTime |
|
8172 |
"return a timestamp for the moment when this image was restarted. |
|
8173 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
8174 |
||
8175 |
^ ImageRestartTime |
|
8176 |
||
8177 |
" |
|
8178 |
Smalltalk imageStartTime |
|
8179 |
Smalltalk imageRestartTime |
|
8180 |
" |
|
8181 |
||
8182 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
8183 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
8184 |
! |
|
8185 |
||
8186 |
imageSaveTime |
|
8187 |
"{ Pragma: +optSpace }" |
|
8188 |
||
8189 |
"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
|
8190 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8191 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8192 |
! |
7758 | 8193 |
|
10641 | 8194 |
imageStartTime |
8195 |
"{ Pragma: +optSpace }" |
|
8196 |
||
8197 |
"return a timestamp for the moment when this system started the first time |
|
8198 |
(i.e. the first initial start without an image)" |
|
8199 |
||
8200 |
^ ImageStartTime |
|
8201 |
||
8202 |
" |
|
8203 |
Smalltalk imageStartTime |
|
8204 |
Smalltalk imageRestartTime |
|
8205 |
" |
|
8206 |
||
8207 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
8208 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
8209 |
! |
|
8210 |
||
8211 |
majorVersionNr |
|
8212 |
"{ Pragma: +optSpace }" |
|
8213 |
||
8214 |
"return the major version number. |
|
8215 |
This is only incremented for very fundamental changes, |
|
8216 |
which make old object files totally incompatible |
|
8217 |
(for example, if the layout/representation of fundamental |
|
8218 |
classes changes). |
|
8219 |
||
8220 |
ST/X revision Naming is: |
|
18668 | 8221 |
<major>.<minor>.<revision>.<release>" |
10641 | 8222 |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
8223 |
^ 6 |
10641 | 8224 |
|
8225 |
" |
|
8226 |
Smalltalk majorVersionNr |
|
8227 |
" |
|
8228 |
||
8229 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
|
8230 |
! |
|
8231 |
||
8232 |
minorVersionNr |
|
8233 |
"{ Pragma: +optSpace }" |
|
8234 |
||
8235 |
"return the minor version number. |
|
8236 |
This is incremented for changes which make some old object |
|
8237 |
files incompatible, or the protocol changes such that some |
|
8238 |
classes need rework. |
|
8239 |
||
8240 |
ST/X revision Naming is: |
|
18668 | 8241 |
<major>.<minor>.<revision>.<release>" |
13489 | 8242 |
|
8243 |
^ 2 |
|
10641 | 8244 |
|
8245 |
" |
|
8246 |
Smalltalk minorVersionNr |
|
8247 |
" |
|
8248 |
||
8249 |
"Modified: / 16-08-2006 / 09:37:25 / cg" |
|
8250 |
! |
|
8251 |
||
8252 |
releaseIdentification |
|
8253 |
"{ Pragma: +optSpace }" |
|
8254 |
||
8255 |
"for developers only: return the release |
|
8256 |
(to further identify the version in case of errors)" |
|
8257 |
||
8258 |
%{ /* NOCONTEXT */ |
|
8259 |
extern OBJ __getRel(); |
|
8260 |
||
8261 |
RETURN (__getRel()); |
|
8262 |
%}. |
|
8263 |
^ 'ST/X_experimental' |
|
8264 |
||
8265 |
" |
|
8266 |
Smalltalk releaseIdentification |
|
8267 |
" |
|
8268 |
! |
|
8269 |
||
8270 |
releaseNr |
|
8271 |
"{ Pragma: +optSpace }" |
|
8272 |
||
14542 | 8273 |
"return the release number. |
8274 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 8275 |
|
8276 |
ST/X revision Naming is: |
|
18668 | 8277 |
<major>.<minor>.<revision>.<release>" |
14529 | 8278 |
|
8279 |
|releaseNumber| |
|
8280 |
||
8281 |
releaseNumber := Smalltalk versionBuildNumber. |
|
8282 |
releaseNumber isEmpty ifTrue:[ |
|
18668 | 8283 |
^ 0. |
14529 | 8284 |
]. |
8285 |
^ releaseNumber |
|
10641 | 8286 |
|
8287 |
" |
|
8288 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
8289 |
Smalltalk versionString |
10641 | 8290 |
" |
8291 |
||
8292 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
8293 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
8294 |
! |
|
8295 |
||
8296 |
revisionNr |
|
8297 |
"{ Pragma: +optSpace }" |
|
8298 |
||
8299 |
"return the revision number. |
|
8300 |
Incremented for releases which fix bugs/add features |
|
8301 |
and represent a stable workable version which got published |
|
8302 |
to the outside world. |
|
8303 |
||
8304 |
ST/X revision Naming is: |
|
18668 | 8305 |
<major>.<minor>.<revision>.<release>" |
16944 | 8306 |
|
8307 |
^ 5 |
|
10641 | 8308 |
|
8309 |
" |
|
8310 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
8311 |
Smalltalk hello string |
13014 | 8312 |
" |
8313 |
||
14210 | 8314 |
"Modified: / 18-07-2012 / 19:09:42 / cg" |
14898 | 8315 |
"Modified: / 19-03-2013 / 10:48:59 / az" |
10641 | 8316 |
! |
8317 |
||
8318 |
timeStamp |
|
8319 |
"return a string useful for timestamping a file. |
|
8320 |
The returned string is padded with spaces for a constant |
|
8321 |
length (to avoid changing a files size in fileOut with unchanged |
|
8322 |
class)." |
|
8323 |
||
8324 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
8325 |
! |
|
8326 |
||
8327 |
timeStamp:aStream |
|
8328 |
"write a string useful for timestamping a file onto aStream. |
|
8329 |
ST80 compatibility" |
|
8330 |
||
8331 |
aStream nextPutAll:(self timeStamp). |
|
8332 |
||
8333 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
8334 |
! |
|
8335 |
||
8336 |
timeStampString |
|
8337 |
"return a string useful for timestamping a file." |
|
8338 |
||
8339 |
|dateString| |
|
8340 |
||
8341 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
8342 |
||
8343 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
8344 |
, dateString , ' at ' , Time now printString |
|
7758 | 8345 |
) |
8346 |
! |
|
8347 |
||
14529 | 8348 |
versionBuildNumber |
8349 |
"{ Pragma: +optSpace }" |
|
8350 |
||
8351 |
"return the executables build number - that's the jenkins build #. |
|
8352 |
Empty if not built by jenkins" |
|
8353 |
||
8354 |
%{ /* NOCONTEXT */ |
|
8355 |
extern char *__getBuildNumberString(); |
|
8356 |
||
8357 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
8358 |
%}. |
|
8359 |
^ '' |
|
8360 |
||
8361 |
" |
|
8362 |
Smalltalk versionBuildNumber |
|
8363 |
" |
|
8364 |
! |
|
8365 |
||
10641 | 8366 |
versionDate |
8367 |
"{ Pragma: +optSpace }" |
|
8368 |
||
14522 | 8369 |
"return the executables build date - that's the date when the smalltalk |
10641 | 8370 |
executable was built" |
8371 |
||
8372 |
%{ /* NOCONTEXT */ |
|
8373 |
extern char *__getBuildDateString(); |
|
8374 |
||
8375 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
8376 |
%}. |
|
8377 |
^ 'today' |
|
8378 |
||
8379 |
" |
|
10071 | 8380 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8381 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8382 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8383 |
|
10641 | 8384 |
versionString |
8385 |
"{ Pragma: +optSpace }" |
|
8386 |
||
8387 |
"return the version string" |
|
8388 |
||
8389 |
^ (self majorVersionNr printString , |
|
8390 |
'.', |
|
8391 |
self minorVersionNr printString , |
|
8392 |
'.', |
|
14529 | 8393 |
self revisionNr printString, |
8394 |
'.', |
|
8395 |
self releaseNr printString) |
|
13771 | 8396 |
|
10641 | 8397 |
|
8398 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8399 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8400 |
" |
10641 | 8401 |
! |
8402 |
||
8403 |
vmMajorVersionNr |
|
8404 |
"{ Pragma: +optSpace }" |
|
8405 |
||
8406 |
"return the VMs major version number." |
|
8407 |
%{ |
|
8408 |
RETURN (__mkSmallInteger(4)); |
|
8409 |
%}. |
|
8410 |
^ 4 |
|
8411 |
||
8412 |
" |
|
8413 |
Smalltalk vmMajorVersionNr |
|
8414 |
" |
|
2 | 8415 |
! ! |
453 | 8416 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
8417 |
!Smalltalk class methodsFor:'documentation'! |
630 | 8418 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
8419 |
version |
18560 | 8420 |
^ '$Header$' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
8421 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
8422 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
8423 |
version_CVS |
18560 | 8424 |
^ '$Header$' |
13415 | 8425 |
! |
8426 |
||
8427 |
version_SVN |
|
15225 | 8428 |
^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
630 | 8429 |
! ! |
18669 | 8430 |