author | Jan Vrany <jan.vrany@labware.com> |
Tue, 01 Jun 2021 20:19:13 +0100 | |
branch | jv |
changeset 25424 | 51bd8a6b196f |
parent 25403 | 52e52279a507 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
23107 | 3 |
COPYRIGHT (c) 2009-2011 Jan Vrany |
4 |
COPYRIGHT (c) 2015-2018 Jan Vrany |
|
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
5 |
COPYRIGHT (c) 2020 LabWare |
18668 | 6 |
All Rights Reserved |
1 | 7 |
|
8 |
This software is furnished under a license and may be used |
|
9 |
only in accordance with the terms of that license and with the |
|
10 |
inclusion of the above copyright notice. This software may not |
|
11 |
be provided or otherwise made available to, or used by, any |
|
12 |
other person. No title to or ownership of the software is |
|
13 |
hereby transferred. |
|
14 |
" |
|
5363 | 15 |
"{ Package: 'stx:libbasic' }" |
16 |
||
17279 | 17 |
"{ NameSpace: Smalltalk }" |
18 |
||
1 | 19 |
Object subclass:#Smalltalk |
18668 | 20 |
instanceVariableNames:'' |
21 |
classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses |
|
22 |
NumberOfClassesHint SystemPath StartupClass StartupSelector |
|
23 |
StartupArguments CommandLine CommandName CommandLineArguments |
|
24 |
CachedAbbreviations VerboseStartup VerboseLoading Verbose |
|
25 |
SilentLoading Initializing StandAlone HeadlessOperation IsPlugin |
|
20831 | 26 |
IsSharedLibraryComponent IsSTScript IsRepl DebuggingStandAlone |
21020 | 27 |
Silent Debugging LogDoits LoadBinaries RealSystemPath |
28 |
ResourcePath SourcePath BinaryPath FileInPath PackagePath |
|
29 |
BinaryDirName ResourceDirName SourceDirName BitmapDirName |
|
30 |
PackageDirName FileInDirName ChangeFileName ImageStartTime |
|
31 |
ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray |
|
32 |
CallbackSignal ClassesFailedToInitialize HasNoConsole IgnoreHalt |
|
20615 | 33 |
PackageToPathMapping IgnoreAssertions LanguageModifier |
34 |
LanguageCodeset' |
|
18668 | 35 |
poolDictionaries:'' |
36 |
category:'System-Support' |
|
1 | 37 |
! |
38 |
||
20832 | 39 |
Smalltalk comment:'' |
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
40 |
! |
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
41 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
42 |
!Smalltalk class methodsFor:'documentation'! |
70 | 43 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
44 |
copyright |
617 | 45 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
46 |
COPYRIGHT (c) 1988 by Claus Gittinger |
23107 | 47 |
COPYRIGHT (c) 2009-2011 Jan Vrany |
48 |
COPYRIGHT (c) 2015-2018 Jan Vrany |
|
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
49 |
COPYRIGHT (c) 2020 LabWare |
18668 | 50 |
All Rights Reserved |
8583
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 |
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
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
hereby transferred. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
58 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
59 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
60 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
61 |
documentation |
70 | 62 |
" |
63 |
This is one of the central classes in the system; |
|
64 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
65 |
Also global variables are (conceptionally) kept here. |
70 | 66 |
|
67 |
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
|
68 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
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
|
72 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
73 |
|
70 | 74 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
75 |
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
|
76 |
to inherit more collection stuff ... |
70 | 77 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
78 |
|
1286 | 79 |
[Instance variables:] |
18668 | 80 |
none - all handling is done in the VM |
1286 | 81 |
|
82 |
[Class variables:] |
|
83 |
||
18668 | 84 |
StartBlocks <Collection> blocks to be executed in a separate process after |
85 |
everything has been initialized. These blocks will |
|
86 |
be deleted after execution and therefore not be |
|
87 |
executed after an image restart. Initial processes |
|
88 |
(such as the Launcher) are usually started here. |
|
89 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
90 |
via #addStartBlock during early initialization. |
|
91 |
||
92 |
ImageStartBlocks |
|
93 |
<Collection> blocks to be executed in a separate process after |
|
94 |
everything has been initialized. These blocks will be |
|
95 |
executed after an image restart. |
|
96 |
These blocks are usually added by smalltalk_r.rc etc. |
|
97 |
||
98 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
99 |
left. Not currently used (GNU-ST compatibility). |
|
100 |
||
101 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
102 |
Set to a default here, but typically changed from some |
|
103 |
startup.rc file |
|
104 |
||
105 |
PackagePath <Collection> path to search for package. |
|
106 |
This is going to replace the above systemPath, and a classes |
|
107 |
resources will eventually searched in its package directory. |
|
108 |
This list defines the path, where packages are searched for, |
|
109 |
initially this is something like /opt/smalltalk/packages. |
|
110 |
Set to a default here, but typically changed from some |
|
111 |
startup.rc file |
|
112 |
||
113 |
StartupClass <Class> class and selector, where the system starts up |
|
114 |
StartupSelector <Symbol> (right after VM initialization) |
|
115 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
116 |
the image will come up there. |
|
117 |
Allows for customized images to be generated from a standard ST/X. |
|
118 |
StandAlone programs also set those during initialization. |
|
119 |
||
120 |
CommandLine <String> Unix (OS-) command line |
|
121 |
||
122 |
CommandName <String> the command (i.e. argv[0]) |
|
123 |
||
124 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
125 |
CommandName has been stripped off. |
|
126 |
(initially set by the VM) |
|
127 |
||
128 |
SilentLoading <Boolean> OBSOLETE: |
|
129 |
suppresses messages during fileIn and in compiler |
|
130 |
(can be set to true from a customized main.c) |
|
131 |
||
132 |
VerboseLoading <Boolean> generate messages during fileIn and in compiler |
|
133 |
(can be set to true from a customized main.c) |
|
134 |
||
135 |
Initializing <Boolean> true while (re-)initializing |
|
136 |
Controls the behavior of certain error |
|
137 |
reporters (for example: suppress dialogBoxes) |
|
138 |
while the system is not yet fit for full operation. |
|
139 |
||
140 |
StandAlone <Boolean> true, if this is a standalone app; |
|
141 |
if true the process scheduler watches for |
|
142 |
which processes are still running, and |
|
143 |
exits ST/X, when the last non-background |
|
144 |
and non-system process exits. |
|
145 |
Can be set in an application-specific startup script, |
|
146 |
or, for standAlone programs, by C-code during initialization. |
|
147 |
||
148 |
HeadlessOperation if true, a non-existing Display connection |
|
149 |
<Boolean> will NOT lead to an error-exit during startup. |
|
150 |
Default is false. |
|
151 |
Can be set in an application-specific startup script, |
|
152 |
or, for standAlone programs, by C-code during initialization. |
|
153 |
||
154 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
155 |
file. Default is false, since the changes file |
|
156 |
may become huge if every tiny doIt is saved there ... |
|
157 |
||
158 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
159 |
file, if present. If false, this is always suppressed. |
|
160 |
||
161 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
162 |
is saved, if the main Display looses its |
|
163 |
connection. This is useful if you have a |
|
164 |
flaky display connection (serial line) |
|
165 |
and want to have your stuff saved automatically |
|
166 |
in case of a broken connection. |
|
167 |
||
168 |
IgnoreAssertions <Boolean> if true, assertions are ignored (i.e. no errors reported). |
|
169 |
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
|
170 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
171 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
172 |
|
18668 | 173 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
174 |
||
175 |
CachedAbbreviations |
|
176 |
<Dictionary> className to filename mappings |
|
177 |
||
178 |
RealSystemPath <Collection> cached collection of directories along the path |
|
179 |
which really exist. Caching avoids long checks |
|
180 |
for existing directories on broken NFS volumes. |
|
181 |
||
182 |
SourcePath <Collection> cached names of really existing directories |
|
183 |
These are remembered, as in NFS systems, |
|
184 |
ResourcePath the time to lookup files may become long |
|
185 |
BinaryPath (especially, if some directories are on machines |
|
186 |
FileInPath which are not up ...). |
|
187 |
Therefore, the set of really |
|
188 |
existing directories is cached when the SystemPath |
|
189 |
is walked the first time. |
|
190 |
A consequence is that you have to invoke |
|
191 |
flushSystemPath, when you create any of those |
|
192 |
directories while running |
|
193 |
(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
|
194 |
|
1286 | 195 |
|
196 |
[author:] |
|
18668 | 197 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
198 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
199 |
[see also:] |
18668 | 200 |
ObjectMemory |
201 |
StandaloneStartup |
|
202 |
GetOpt |
|
203 |
ReadEvalPrintLoop |
|
70 | 204 |
" |
8945 | 205 |
! |
206 |
||
207 |
readme_resources |
|
208 |
" |
|
209 |
What is a resource file: |
|
18668 | 210 |
resource files contain language transformation and sometimes |
211 |
UI-look specifics such as icons etc. |
|
8945 | 212 |
|
213 |
Where are resources stored in the image: |
|
18668 | 214 |
Resource files are only read on demand (i.e. when needed) and only read once |
215 |
i.e. they are cached in the image). |
|
216 |
The cached data is held in a per-class class-instVar named 'ClassResources'. |
|
217 |
With only a few exceptions, the only classes which need resources are the GUI |
|
218 |
classes under the SimpleView hierarchy. |
|
8945 | 219 |
|
220 |
How does the system find resources: |
|
18668 | 221 |
The idea is that the system-provided resource files can be overwritten |
222 |
by the user or an application configuration. |
|
223 |
This works via a hierarchy of directories where resources are searched for, |
|
224 |
with the systems standard resource-files being at the end of that chain. |
|
225 |
||
226 |
When searching for a resource file for class X, the following files are searched |
|
227 |
in order: |
|
228 |
{ResourcePath} / resources / X.rs |
|
229 |
{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
230 |
{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs |
|
8945 | 231 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
232 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
233 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
234 |
!Smalltalk class methodsFor:'initialization'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
235 |
|
11057 | 236 |
basicInitializeSystem |
16180 | 237 |
"initialize all other classes. |
16655 | 238 |
This one is the very first entry into the smalltalk world |
239 |
[with error handling, via the initializeSystem], |
|
240 |
right after startup, usually immediately followed by Smalltalk>>start. |
|
241 |
||
11057 | 242 |
Notice: |
19992 | 243 |
this is NOT called when an image is restarted; in this |
244 |
case the show starts in Smalltalk>>restart." |
|
245 |
||
246 |
OrderedCollection initialize. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
247 |
|
20615 | 248 |
Smalltalk at:#Compiler put:ByteCodeCompiler. |
13771 | 249 |
Compiler isNil ifTrue:[ |
19992 | 250 |
" |
251 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
252 |
this allows at least immediate evaluations for runtime systems without compiler |
|
253 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
254 |
" |
|
20615 | 255 |
Smalltalk at:#Compiler put:Parser |
16164 | 256 |
]. |
13771 | 257 |
|
11057 | 258 |
"/ |
259 |
"/ start catching SIGSEGV and SIGBUS |
|
260 |
"/ |
|
261 |
OperatingSystem enableHardSignalInterrupts. |
|
262 |
||
263 |
self initGlobalsFromEnvironment. |
|
264 |
||
265 |
"/ |
|
266 |
"/ sorry - there are some, which MUST be initialized before .. |
|
267 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
268 |
"/ |
|
15265 | 269 |
SmallInteger initialize. |
11057 | 270 |
Object initialize. |
18283 | 271 |
UninterpretedBytes initialize. |
16691 | 272 |
OperatingSystem initialize. |
11057 | 273 |
Stream initialize. |
274 |
PositionableStream initialize. |
|
275 |
Filename initialize. |
|
276 |
ObjectMemory initialize. |
|
277 |
ExternalStream initialize. |
|
12745
e944659a6a52
changed: #basicInitializeSystem
Claus Gittinger <cg@exept.de>
parents:
12744
diff
changeset
|
278 |
ProcessorScheduler initialize. |
11057 | 279 |
|
280 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
281 |
||
282 |
"/ |
|
283 |
"/ sorry, path must be set before ... |
|
284 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
285 |
"/ |
|
17534 | 286 |
"/ but, on OSX we need the CharacterEncoder to be initialized |
287 |
CharacterEncoder initialize. |
|
11057 | 288 |
self initSystemPath. |
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
289 |
self initPackagePath. |
11057 | 290 |
|
291 |
"/ |
|
14427 | 292 |
"/ in case, someone needs the objectFileLoader early |
293 |
"/ |
|
16675 | 294 |
ObjectFileLoader notNil ifTrue:[ |
19992 | 295 |
ObjectFileLoader initialize. |
16675 | 296 |
]. |
14427 | 297 |
|
298 |
"/ |
|
11057 | 299 |
"/ now, finally, initialize all other classes |
300 |
"/ |
|
301 |
self initializeModules. |
|
302 |
||
303 |
ImageStartTime := Timestamp now. |
|
304 |
||
305 |
self initInterrupts. |
|
306 |
self initUserPreferences. |
|
307 |
||
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
308 |
"/ 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
|
309 |
"/ 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
|
310 |
"/ required for some apps, for example to show the menu correctly (see launcher's help menu) |
16675 | 311 |
ApplicationModel notNil ifTrue:[ |
19992 | 312 |
ApplicationModel flushAllClassResources. |
16675 | 313 |
]. |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
314 |
|
11057 | 315 |
"/ |
316 |
"/ give classes a chance to perform 2nd-level initialization |
|
317 |
"/ now, we are certain, that all other classes have been initialized |
|
318 |
"/ (especially: streams and signals can now be used) |
|
319 |
"/ |
|
320 |
ObjectMemory changed:#initialized. |
|
321 |
||
322 |
"Modified: / 08-01-1997 / 19:58:12 / stefan" |
|
323 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
14427 | 324 |
"Modified: / 24-10-2012 / 18:45:15 / sr" |
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
325 |
"Modified: / 25-06-2016 / 16:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11057 | 326 |
! |
327 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
328 |
initGlobalsFromEnvironment |
617 | 329 |
"setup globals from the shell-environment" |
330 |
||
5406 | 331 |
StandAlone isNil ifTrue:[ |
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
332 |
StandAlone := false. |
5406 | 333 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
334 |
HeadlessOperation isNil ifTrue:[ |
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
335 |
HeadlessOperation := false. |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
336 |
]. |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
337 |
|
617 | 338 |
" |
339 |
Smalltalk initGlobalsFromEnvironment |
|
340 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
341 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
342 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
23093
9c9fa5a584bb
Issue #80: remove initialization of `Language` and `LanguageTerritory` globals.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23092
diff
changeset
|
343 |
"Modified: / 21-11-2017 / 21:29:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
344 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
345 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
346 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
347 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
348 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
349 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
350 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
351 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
352 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
353 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
354 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
355 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
356 |
|
14805 | 357 |
OperatingSystem isOSXlike ifTrue:[ |
18668 | 358 |
"/ OSX sends SIGABRT for NSExceptions |
359 |
OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException. |
|
360 |
OperatingSystem enableAbortInterrupts. |
|
14805 | 361 |
]. |
362 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
363 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
364 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
365 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
366 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
367 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
368 |
! |
617 | 369 |
|
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
370 |
initPackagePath |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
371 |
"Initialize package path" |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
372 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
373 |
PackagePath := OperatingSystem defaultPackagePath. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
374 |
self addWorkspaceDirectoryToPackagePath. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
375 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
376 |
"Created: / 25-06-2016 / 16:35:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
377 |
! |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
378 |
|
617 | 379 |
initStandardStreams |
380 |
"initialize some well-known streams" |
|
381 |
||
382 |
Stdout := NonPositionableExternalStream forStdout. |
|
383 |
Stderr := NonPositionableExternalStream forStderr. |
|
384 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
385 |
PrinterStream notNil ifTrue:[ |
18668 | 386 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
387 |
]. |
617 | 388 |
Transcript := Stderr |
389 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
390 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
391 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
392 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
393 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
394 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 395 |
! |
396 |
||
397 |
initStandardTools |
|
10646 | 398 |
"predefine some tools which we might need later |
617 | 399 |
- if the view-classes exist, |
400 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
401 |
||
402 |
Display notNil ifTrue:[ |
|
18668 | 403 |
InspectorView notNil ifTrue:[ |
404 |
Inspector := InspectorView |
|
405 |
]. |
|
406 |
DebugView notNil ifTrue:[ |
|
407 |
Debugger := DebugView |
|
408 |
]. |
|
409 |
"/ Display initialize |
|
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
410 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
411 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
412 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
413 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
414 |
ObjectMemory |
18668 | 415 |
nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal) |
416 |
asAbsoluteFilename pathName |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
417 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
418 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
419 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
420 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
421 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
422 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
423 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
424 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
425 |
initSystemPath |
617 | 426 |
"setup path where system files are searched for. |
427 |
the default path is set to: |
|
18868 | 428 |
. |
429 |
<directory of exe> (WIN32 only) |
|
430 |
$HOME (if defined) |
|
431 |
$HOME/.smalltalk (if defined & existing) |
|
432 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
433 |
$STX_LIBDIR (if defined & existing) |
|
434 |
$STX_TOPDIR (if defined & existing) |
|
435 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
|
436 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
|
437 |
<standard places> |
|
9021 | 438 |
|
439 |
standard places (unix): |
|
18868 | 440 |
/opt/smalltalk/<release> (if existing) |
441 |
/opt/smalltalk (if existing) |
|
442 |
/usr/local/lib/smalltalk (if existing) |
|
443 |
/usr/lib/smalltalk (if existing) |
|
444 |
/lib/smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
445 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
446 |
win32: |
18868 | 447 |
\programs\exept\smalltalk (if existing) |
448 |
\programs\smalltalk (if existing) |
|
449 |
\smalltalk (if existing) |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
450 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
451 |
vms: |
18868 | 452 |
$stx:lib (if existing) |
453 |
$stx:root (if existing) |
|
617 | 454 |
|
455 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
456 |
startup file; add expressions such as: |
|
18868 | 457 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
458 |
or: |
|
459 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
460 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
461 |
However, smalltalk.rc itself must be found along the above path. |
617 | 462 |
" |
463 |
||
2928 | 464 |
ChangeFileName := 'changes'. |
465 |
OperatingSystem isVMSlike ifTrue:[ |
|
18868 | 466 |
BitmapDirName := 'bitmaps.dir'. |
467 |
BinaryDirName := 'binary.dir'. |
|
468 |
SourceDirName := 'source.dir'. |
|
469 |
ResourceDirName := 'resources.dir'. |
|
470 |
FileInDirName := 'filein.dir'. |
|
471 |
PackageDirName := 'packages.dir'. |
|
2928 | 472 |
] ifFalse:[ |
18868 | 473 |
BitmapDirName := 'bitmaps'. |
474 |
BinaryDirName := 'binary'. |
|
475 |
SourceDirName := 'source'. |
|
476 |
ResourceDirName := 'resources'. |
|
477 |
FileInDirName := 'fileIn'. |
|
478 |
PackageDirName := 'packages'. |
|
16234 | 479 |
]. |
480 |
||
481 |
SystemPath isEmptyOrNil ifTrue:[ |
|
18868 | 482 |
SystemPath := OperatingSystem defaultSystemPath. |
483 |
self flushPathCaches |
|
16234 | 484 |
]. |
485 |
||
486 |
PackagePath isEmptyOrNil ifTrue:[ |
|
18868 | 487 |
PackagePath := OperatingSystem defaultPackagePath. |
488 |
]. |
|
489 |
self addWorkspaceDirectoryToPackagePath. |
|
20663 | 490 |
self addIdeTopDirectoryToPackagePath. |
617 | 491 |
|
492 |
" |
|
493 |
Smalltalk initSystemPath |
|
494 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
495 |
|
20640 | 496 |
SystemPath := nil. |
497 |
PackagePath := nil. |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
498 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
499 |
OperatingSystem defaultPackagePath |
617 | 500 |
" |
5139 | 501 |
|
5145 | 502 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
503 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
504 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
505 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
506 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
507 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
508 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
509 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
510 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
511 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
512 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
513 |
! |
617 | 514 |
|
7526 | 515 |
initializeClass:aClass |
516 |
"sent from VM via #initializeModules" |
|
517 |
||
7527 | 518 |
Error handle:[:ex | |
19427 | 519 |
ObjectMemory printStackBacktrace. |
520 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
521 |
ClassesFailedToInitialize := IdentitySet new. |
|
522 |
]. |
|
523 |
ClassesFailedToInitialize add:aClass. |
|
524 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
525 |
ex suspendedContext fullPrintAll. |
|
526 |
'------------------------------------------------' errorPrintCR. |
|
527 |
(Debugging == true) ifTrue:[ |
|
528 |
ex reject |
|
529 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
530 |
] do:[ |
19427 | 531 |
aClass initialize |
13675 | 532 |
]. |
533 |
||
534 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
535 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
536 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
537 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
538 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
539 |
send #initialize to all classes. |
16180 | 540 |
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
|
541 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
542 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
543 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
18668 | 544 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
545 |
ClassesFailedToInitialize := nil. |
|
546 |
self initializeModulesOnce. |
|
547 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
|
548 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
|
549 |
] |
|
10122 | 550 |
]. |
551 |
||
552 |
ProjectDefinition initializeAllProjectDefinitions. |
|
553 |
||
554 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 555 |
! |
556 |
||
7563 | 557 |
initializeModulesOnce |
558 |
"perform module specific initialization and |
|
559 |
send #initialize to all classes. |
|
7527 | 560 |
Notice: this is not called when an image is restarted" |
4963 | 561 |
|
617 | 562 |
%{ |
18349 | 563 |
#ifdef __SCHTEAM__ |
564 |
STClass.initializeAllClasses(__c__); |
|
565 |
return __c__._RETURN_self(); |
|
566 |
#else |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
567 |
__init_registered_modules__(3); |
4963 | 568 |
|
1481 | 569 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 570 |
RETURN (self); |
18349 | 571 |
#endif /* not SCHTEAM */ |
5410 | 572 |
%}. |
573 |
^ self primitiveFailed |
|
617 | 574 |
! |
575 |
||
7563 | 576 |
initializeSystem |
16655 | 577 |
"initialize all classes; setup dispatcher processes etc. |
3499 | 578 |
This one is the very first entry into the smalltalk world, |
16655 | 579 |
right after startup, usually immediately followed by Smalltalk>>start. |
580 |
Here, a few specific initializations are done, then the actual initialization is |
|
581 |
done inside an error handler in basicInitializeSystem. |
|
10071 | 582 |
Notice: |
18669 | 583 |
this is called by the VM's main entry. You will not find senders from Smalltalk. |
18385 | 584 |
Also Notice: |
18669 | 585 |
this is NOT called when an image is restarted; |
586 |
in this case the show starts in Smalltalk>>restart." |
|
211 | 587 |
|
19510 | 588 |
|idx shellArgs| |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
589 |
|
12861 | 590 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
591 |
|
3499 | 592 |
Initializing := true. |
593 |
AbstractOperatingSystem initializeConcreteClass. |
|
594 |
||
18307
c1d97d109f88
also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents:
18293
diff
changeset
|
595 |
CommandLineArguments isEmptyOrNil ifTrue:[ |
18669 | 596 |
CommandLineArguments := #('stx') asOrderedCollection. |
5400 | 597 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
598 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
599 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 600 |
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
|
601 |
|
21021 | 602 |
SilentLoading := Silent := false. |
603 |
VerboseLoading := VerboseStartup := Verbose := false. |
|
19427 | 604 |
DebuggingStandAlone := Debugging := false. |
19510 | 605 |
|
606 |
"/ if no argument was given, look for an environment variable named |
|
607 |
"/ STX_DEFAULT_ARGS. If set, take that. |
|
608 |
"/ if any argument was given, unless a --noShellArgs argument is given, |
|
609 |
"/ slice in the value from "STX_MORE_ARGS" at the beginning. |
|
610 |
"/ |
|
611 |
"/ These allow for args like "--quick --infoPrint" to be automatically prepended |
|
19511 | 612 |
idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs'). |
19510 | 613 |
(idx ~~ 0) ifTrue:[ |
614 |
CommandLineArguments removeIndex:idx. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
615 |
] ifFalse:[ |
19510 | 616 |
CommandLineArguments isEmpty ifTrue:[ |
617 |
shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'. |
|
618 |
shellArgs notEmptyOrNil ifTrue:[ |
|
619 |
shellArgs := shellArgs asCollectionOfWords. |
|
620 |
CommandLineArguments addAll:shellArgs. |
|
621 |
]. |
|
622 |
] ifFalse:[ |
|
623 |
"/ prepend shell environment args from "STX_ARGS" |
|
624 |
shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'. |
|
625 |
shellArgs notEmptyOrNil ifTrue:[ |
|
626 |
shellArgs := shellArgs asCollectionOfWords. |
|
627 |
CommandLineArguments addAllFirst:shellArgs. |
|
628 |
]. |
|
629 |
]. |
|
630 |
]. |
|
631 |
||
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
632 |
self initializeVerboseFlags. |
14432 | 633 |
|
11057 | 634 |
Error handle:[:ex | |
18669 | 635 |
StandAlone ifTrue:[ |
636 |
DebuggingStandAlone ifFalse:[ |
|
637 |
'Startup Error - use "--debug" command line argument for more info' errorPrintCR. |
|
638 |
Smalltalk exit:1. |
|
639 |
]. |
|
640 |
'Smalltalk [error]: Error during early initialization:' errorPrintCR. |
|
641 |
thisContext fullPrintAll. |
|
642 |
]. |
|
643 |
ex reject. |
|
11057 | 644 |
] do:[ |
18669 | 645 |
self basicInitializeSystem |
14432 | 646 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
647 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
648 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
649 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
650 |
|
18669 | 651 |
initializeVerboseFlags |
652 |
|idx| |
|
653 |
||
21021 | 654 |
StandAlone ifTrue:[ |
655 |
InfoPrinting := false. |
|
656 |
ObjectMemory infoPrinting:false. |
|
657 |
IgnoreAssertions := true. |
|
658 |
] ifFalse:[ |
|
659 |
IgnoreAssertions := false. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
660 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
661 |
|
19430 | 662 |
(idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[ |
663 |
IgnoreHalt := true. |
|
664 |
CommandLineArguments removeIndex:idx |
|
665 |
]. |
|
20855 | 666 |
(idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[ |
667 |
IgnoreHalt := false. |
|
668 |
CommandLineArguments removeIndex:idx |
|
669 |
]. |
|
670 |
(idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[ |
|
671 |
IgnoreAssertions := true. |
|
672 |
CommandLineArguments removeIndex:idx |
|
673 |
]. |
|
674 |
(idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[ |
|
675 |
IgnoreAssertions := false. |
|
676 |
CommandLineArguments removeIndex:idx |
|
677 |
]. |
|
18669 | 678 |
(idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[ |
679 |
SilentLoading := true. |
|
680 |
CommandLineArguments removeIndex:idx |
|
681 |
]. |
|
682 |
(idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[ |
|
683 |
VerboseLoading := true. |
|
684 |
CommandLineArguments removeIndex:idx |
|
685 |
]. |
|
686 |
(idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[ |
|
687 |
VerboseLoading := true. |
|
688 |
VerboseStartup := true. |
|
689 |
CommandLineArguments removeIndex:idx |
|
690 |
]. |
|
20855 | 691 |
|
692 |
"/ reinterpret those, in case given after the VM options. |
|
693 |
(idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[ |
|
694 |
ObjectMemory debugPrinting:true. |
|
695 |
CommandLineArguments removeIndex:idx |
|
696 |
]. |
|
697 |
(idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[ |
|
698 |
ObjectMemory infoPrinting:true. |
|
699 |
CommandLineArguments removeIndex:idx |
|
700 |
]. |
|
701 |
||
18669 | 702 |
(idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[ |
20878 | 703 |
Object infoPrinting:true. |
18669 | 704 |
Verbose := true. |
705 |
VerboseLoading := true. |
|
706 |
VerboseStartup := true. |
|
20876 | 707 |
Logger notNil ifTrue:[ |
708 |
Logger loggingThreshold: Logger severityALL. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
709 |
]. |
21020 | 710 |
CommandLineArguments removeIndex:idx. |
711 |
]. |
|
712 |
||
713 |
Silent := false. |
|
714 |
(idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[ |
|
715 |
CommandLineArguments removeIndex:idx. |
|
716 |
Silent := SilentLoading := true. |
|
717 |
Object infoPrinting:false. |
|
718 |
ObjectMemory infoPrinting:false. |
|
719 |
ObjectMemory debugPrinting:false. |
|
720 |
Verbose := VerboseLoading := VerboseStartup := false. |
|
721 |
Logger notNil ifTrue:[ |
|
722 |
Logger loggingThreshold: Logger severityNONE |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
723 |
]. |
18669 | 724 |
]. |
21021 | 725 |
|
726 |
idx := CommandLineArguments indexOf:'--debug'. |
|
727 |
Debugging := (idx ~~ 0). |
|
728 |
||
729 |
StandAlone ifTrue:[ |
|
730 |
DebuggingStandAlone := Debugging. |
|
731 |
DebuggingStandAlone ifTrue:[ |
|
732 |
Inspector := MiniInspector. |
|
733 |
Debugger := MiniDebugger. |
|
734 |
IgnoreAssertions := false. |
|
735 |
]. |
|
736 |
] ifFalse:[ |
|
737 |
"/ |
|
738 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
739 |
"/ to handle things. |
|
740 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
741 |
"/ |
|
742 |
Inspector := MiniInspector. |
|
743 |
Debugger := MiniDebugger. |
|
744 |
]. |
|
18669 | 745 |
! |
746 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
747 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
748 |
"this returns true, if the system is properly initialized; |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
749 |
i.e. false during startup. |
15980 | 750 |
Especially, the whole display/viewing stuff and process escheduling |
751 |
is not working correctly until initialized." |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
752 |
|
18251
9b7f8e531a16
isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents:
18248
diff
changeset
|
753 |
Initializing isNil ifTrue:[^ false]. "/ if called very early |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
754 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
755 |
! |
1 | 756 |
|
19612
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
757 |
isInitializing |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
758 |
"Return true if the system is currently initializing,; |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
759 |
i.e. true during startup and image restart, false during |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
760 |
normal work. |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
761 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
762 |
Especially, the whole display/viewing stuff and process scheduling |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
763 |
is not working correctly while initializing." |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
764 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
765 |
Initializing isNil ifTrue:[^ true]. "/ if called very early |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
766 |
^ Initializing |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
767 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
768 |
"Created: / 20-04-2016 / 08:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
769 |
! |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
770 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
771 |
isRestarting |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
772 |
"Return true if the system is currently restarting from |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
773 |
a snapshot, i.e., when performing Smalltalk-level actions |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
774 |
after snapin (such as recreate windows, bitmaps and so on). |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
775 |
Return false during normal work. |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
776 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
777 |
Especially, the whole display/viewing stuff and process scheduling |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
778 |
is not working correctly while restarting." |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
779 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
780 |
^ self isInitializing and:[ ImageRestartTime notNil ]. |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
781 |
|
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
782 |
"Created: / 20-04-2016 / 08:23:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
783 |
! |
54a90f2491b1
Added Smalltalk>>isInitializing and Smalltalk>>isRestarting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19610
diff
changeset
|
784 |
|
7563 | 785 |
reinitStandardStreams |
786 |
"reinitialize some well-known streams. |
|
787 |
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
|
788 |
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
|
789 |
(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
|
790 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
791 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 792 |
! ! |
793 |
||
16593 | 794 |
!Smalltalk class methodsFor:'Compatibility-GNU'! |
795 |
||
796 |
system:command |
|
797 |
"GNU-Smalltalk compatibility: execute an OS command" |
|
798 |
||
799 |
OperatingSystem executeCommand:command |
|
800 |
||
801 |
" |
|
802 |
Smalltalk system:'ls' |
|
803 |
" |
|
804 |
! ! |
|
805 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
806 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
807 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
808 |
beep |
17343 | 809 |
"output an audible beep or bell" |
810 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
811 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
812 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
813 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
814 |
garbageCollect |
15009 | 815 |
"for Squeak compatibility" |
816 |
||
817 |
ObjectMemory garbageCollect |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
818 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
819 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
820 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
821 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
822 |
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
|
823 |
newSpace + freeListSpace is returned." |
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 |
ObjectMemory scavenge. |
15009 | 826 |
^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
827 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
828 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
829 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
830 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
831 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
832 |
|
10844 | 833 |
platformName |
834 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
835 |
||
836 |
^ OperatingSystem platformName asUppercaseFirst |
|
837 |
||
838 |
" |
|
839 |
Smalltalk platformName -> 'Win32' |
|
840 |
" |
|
841 |
! |
|
842 |
||
12358 | 843 |
removeClassNamed: aName |
17576 | 844 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
845 |
Also needed by the refactory browser. |
|
846 |
If anything untoward happens, report it in the Transcript." |
|
12358 | 847 |
|
848 |
| oldClass | |
|
849 |
||
850 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
18668 | 851 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
852 |
^ self |
|
12358 | 853 |
]. |
854 |
oldClass removeFromSystem |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
855 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
856 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
857 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
858 |
|
7563 | 859 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
860 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 861 |
|
862 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 863 |
! |
864 |
||
16459 | 865 |
declareConstant:constantName poolName:poolNameArg value:value |
866 |
"visualAge compatible pool variable declaration. |
|
16562 | 867 |
called when a V'age application is filed in |
16459 | 868 |
(or one of its changes is accepted via the change browser)" |
869 |
||
870 |
|ns poolName pool| |
|
871 |
||
872 |
"/ when coming from the change-browser, |
|
873 |
"/ a namespace override may be given... |
|
874 |
ns := Class nameSpaceQuerySignal query. |
|
875 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 876 |
poolName := poolNameArg asSymbol |
16459 | 877 |
] ifFalse:[ |
18668 | 878 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 879 |
]. |
9090 | 880 |
pool := self classNamed:poolName. |
881 |
pool declareConstant:constantName value:value |
|
882 |
! |
|
883 |
||
16459 | 884 |
declarePoolDictionary:poolDictionaryNameArg |
885 |
"visualAge compatible pool declaration. |
|
16562 | 886 |
called when a V'age application is filed in |
16459 | 887 |
(or one of its changes is accepted via the change browser)" |
888 |
||
889 |
|ns poolName| |
|
890 |
||
891 |
poolName := poolDictionaryNameArg asSymbol. |
|
892 |
||
893 |
"/ "/ when coming from the change-browser, |
|
894 |
"/ "/ a namespace override may be given... |
|
895 |
"/ ns := Class nameSpaceQuerySignal query. |
|
896 |
"/ (ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
897 |
"/ poolName := poolDictionaryNameArg asSymbol |
|
898 |
"/ ] ifFalse:[ |
|
899 |
"/ poolName := (ns name,'::',poolDictionaryNameArg) asSymbol |
|
900 |
"/ ]. |
|
901 |
^ SharedPool subclass:(poolName asSymbol) |
|
18668 | 902 |
instanceVariableNames:'' |
903 |
classVariableNames:'' |
|
904 |
poolDictionaries:'' |
|
905 |
category:'* VAST Pools' |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
906 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
907 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
908 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
909 |
|
16459 | 910 |
declareVariable:varName poolName:poolNameArg |
911 |
"visualAge compatible pool declaration. |
|
16562 | 912 |
called when a V'age application is filed in |
16459 | 913 |
(or one of its changes is accepted via the change browser)" |
914 |
||
915 |
|ns poolName pool| |
|
916 |
||
917 |
"/ when coming from the change-browser, |
|
918 |
"/ a namespace override may be given... |
|
919 |
ns := Class nameSpaceQuerySignal query. |
|
920 |
(ns isNil or:[ns == Smalltalk]) ifTrue:[ |
|
18668 | 921 |
poolName := poolNameArg asSymbol |
16459 | 922 |
] ifFalse:[ |
18668 | 923 |
poolName := (ns name,'::',poolNameArg) asSymbol |
16459 | 924 |
]. |
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
925 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
926 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
927 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
928 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
929 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
930 |
|
20755 | 931 |
!Smalltalk class methodsFor:'Compatibility-VW'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
932 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
933 |
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
|
934 |
^ self |
18668 | 935 |
defineClass:nameSymbol |
936 |
superclass:superclass |
|
937 |
indexedType:indexed |
|
938 |
private:private |
|
939 |
instanceVariableNames:instVars |
|
940 |
classInstanceVariableNames:classInstVars |
|
941 |
imports:imports |
|
942 |
category:category |
|
943 |
attributes:nil |
|
12033 | 944 |
! |
945 |
||
7563 | 946 |
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
|
947 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
948 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
949 |
indexed == #none ifTrue:[ |
18668 | 950 |
newClass := superclass |
951 |
subclass:nameSymbol |
|
952 |
instanceVariableNames:instVars |
|
953 |
classVariableNames:'' |
|
954 |
poolDictionaries:'' |
|
955 |
category:category |
|
956 |
inEnvironment:self. |
|
957 |
classInstVars size > 0 ifTrue:[ |
|
958 |
newClass class instanceVariableNames:classInstVars. |
|
959 |
]. |
|
960 |
^ newClass |
|
6851 | 961 |
]. |
962 |
self shouldImplement. |
|
12033 | 963 |
! |
964 |
||
965 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
966 |
|newNameSpace| |
|
967 |
||
968 |
private ifTrue:[self halt]. "/ what to do ? |
|
969 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
970 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
971 |
newNameSpace setCategory:category. |
12033 | 972 |
^ newNameSpace |
20755 | 973 |
! |
974 |
||
975 |
dialectName |
|
976 |
^ #SmalltalkX |
|
977 |
||
978 |
" |
|
979 |
Smalltalk dialectName |
|
980 |
" |
|
981 |
! |
|
982 |
||
983 |
dialectReleaseVersion |
|
984 |
^ self versionString |
|
985 |
||
986 |
" |
|
987 |
Smalltalk dialectReleaseVersion |
|
988 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
989 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
990 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
991 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
992 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
993 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
994 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
995 |
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
|
996 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
997 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
998 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
999 |
|
20161 | 1000 |
val := self at:aKey ifAbsent:[^ nil]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1001 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1002 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1003 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1004 |
! |
3083 | 1005 |
|
7563 | 1006 |
associationAt:aKey ifAbsent:exceptionBlock |
1007 |
"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
|
1008 |
from exceptionBlock, if no such key is present. |
14973 | 1009 |
Since ST/X's Smalltalk as no real dictionary, this is simulated here. |
20161 | 1010 |
Warning: this is a compatibility interface only, with a different semantic as |
1011 |
the original ST80 implementation. The returned assoc is created on the fly, |
|
1012 |
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
|
1013 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1014 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1015 |
|
20161 | 1016 |
val := self at:aKey ifAbsent:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1017 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1018 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1019 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1020 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
1021 |
|
7563 | 1022 |
at:aKey |
10071 | 1023 |
"retrieve the value stored under aKey, a symbol. |
1024 |
Return nil if not present |
|
1956 | 1025 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 1026 |
|
16831 | 1027 |
aKey class == Symbol ifFalse:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
1028 |
|
453 | 1029 |
%{ /* NOCONTEXT */ |
18287 | 1030 |
#ifdef __SCHTEAM__ |
1031 |
{ |
|
18668 | 1032 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1033 |
STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol); |
|
1034 |
||
1035 |
return context._RETURN( val == null ? Nil : val ); |
|
18287 | 1036 |
} |
1037 |
/* NOT REACHED */ |
|
1038 |
#else |
|
453 | 1039 |
RETURN ( __GLOBAL_GET(aKey) ); |
18287 | 1040 |
#endif |
5406 | 1041 |
%}. |
5410 | 1042 |
^ self primitiveFailed |
453 | 1043 |
! |
1044 |
||
7563 | 1045 |
at:aKey ifAbsent:aBlock |
1046 |
"retrieve the value stored at aKey. |
|
7565 | 1047 |
If there is nothing stored under this key, return the value of |
1048 |
the evaluation of aBlock." |
|
453 | 1049 |
|
20161 | 1050 |
|val| |
1051 |
||
1052 |
val := self at:aKey. |
|
1053 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
1054 |
^ val |
|
453 | 1055 |
]. |
1056 |
^ aBlock value |
|
1057 |
||
1058 |
" |
|
20161 | 1059 |
Smalltalk removeKey:#fooBar. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1060 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1061 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1062 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1063 |
! |
453 | 1064 |
|
15068 | 1065 |
at:aKey ifAbsentPut:aBlock |
1066 |
"return the element indexed by aKey if present, |
|
1067 |
if not present, store the result of evaluating valueBlock |
|
1068 |
under aKey and return it." |
|
1069 |
||
1070 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
|
1071 |
||
1072 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
1073 |
! |
|
1074 |
||
7563 | 1075 |
at:aKey ifPresent:aBlock |
1076 |
"try to retrieve the value stored at aKey. |
|
1077 |
If there is nothing stored under this key, do nothing. |
|
4870 | 1078 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
1079 |
||
13883 | 1080 |
|val| |
1081 |
||
20161 | 1082 |
val := self at:aKey. |
1083 |
(val notNil or:[self includesKey:aKey]) ifTrue:[ |
|
1084 |
^ aBlock value:val. |
|
4870 | 1085 |
]. |
1086 |
^ nil |
|
1087 |
||
1088 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1089 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1090 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
20161 | 1091 |
|
1092 |
Smalltalk at:#fooBar put:nil. |
|
1093 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1094 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1095 |
|
13883 | 1096 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1097 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1098 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1099 |
at:aKey put:aValue |
7563 | 1100 |
"store the argument aValue under aKey, a symbol. |
1101 |
Return aValue (sigh)." |
|
453 | 1102 |
|
1103 |
|oldValue| |
|
1104 |
||
1105 |
%{ |
|
18287 | 1106 |
#ifdef __SCHTEAM__ |
1107 |
{ |
|
18668 | 1108 |
STSymbol keySymbol = aKey.asSTSymbol(); |
1109 |
oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue); |
|
18287 | 1110 |
} |
1111 |
#else |
|
453 | 1112 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
18287 | 1113 |
#endif |
453 | 1114 |
%}. |
1115 |
CachedClasses notNil ifTrue:[ |
|
18668 | 1116 |
oldValue isBehavior ifTrue:[ |
1117 |
oldValue name == aKey ifTrue:[ |
|
1118 |
CachedClasses remove:oldValue ifAbsent:[] |
|
1119 |
] |
|
1120 |
]. |
|
1121 |
aValue isBehavior ifTrue:[ |
|
1122 |
aValue name == aKey ifTrue:[ |
|
1123 |
CachedClasses add:aValue |
|
1124 |
] ifFalse:[ |
|
1125 |
CachedClasses := nil |
|
1126 |
] |
|
1127 |
]. |
|
453 | 1128 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
1129 |
^ aValue. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1130 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1131 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1132 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1133 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1134 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1135 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1136 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1137 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1138 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1139 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1140 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1141 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1142 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1143 |
%{ /* NOCONTEXT */ |
18287 | 1144 |
#ifdef __SCHTEAM__ |
1145 |
STSymbol keySymbol = aKey.asSTSymbol(); |
|
18668 | 1146 |
return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False); |
18287 | 1147 |
/* NOT REACHED */ |
1148 |
#else |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1149 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
18287 | 1150 |
#endif |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1151 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1152 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1153 |
! |
453 | 1154 |
|
7563 | 1155 |
keyAtValue:anObject |
1156 |
"return the symbol under which anObject is stored - or nil" |
|
453 | 1157 |
|
1158 |
self keysDo:[:aKey | |
|
18668 | 1159 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1160 |
]. |
1161 |
^ nil |
|
1162 |
||
1163 |
"Smalltalk keyAtValue:Object" |
|
1164 |
! |
|
1165 |
||
7563 | 1166 |
keys |
1167 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1168 |
||
1169 |
|keys| |
|
453 | 1170 |
|
23099
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
1171 |
keys := IdentitySet new: self size. |
453 | 1172 |
self keysDo:[:k | keys add:k]. |
1173 |
^ keys |
|
617 | 1174 |
! |
1175 |
||
7563 | 1176 |
removeKey:aKey |
1177 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1178 |
WARNING: |
18668 | 1179 |
this is somewhat dangerous: conceptionally, the association is removed, |
1180 |
to which machine & byte compiled code refers if it accesses a global. |
|
1181 |
If there are still global accesses in some literalArray or from machine-compiled code, |
|
1182 |
it continues to reference the globals value via that obsolete association and gets a nil |
|
1183 |
value. (which is correct) |
|
1184 |
However, if that global is later reintroduced, a new association will be created and |
|
1185 |
the new global now referenced via the new association. |
|
1186 |
The old accesses will still see nil, although the globals value is actually non-nil |
|
1187 |
(this is questionable). |
|
1188 |
To avoid this problem, the #removeClass: method never removed the key." |
|
617 | 1189 |
|
1190 |
CachedClasses := nil. |
|
1191 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1192 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1193 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1194 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1195 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1196 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1197 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1198 |
|
10538 | 1199 |
startBlocks |
1200 |
^ StartBlocks |
|
1201 |
! |
|
1202 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1203 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1204 |
"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
|
1205 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1206 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1207 |
|
23099
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
1208 |
values := OrderedCollection new: self size. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1209 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1210 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1211 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1212 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1213 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1214 |
|
13540 | 1215 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1216 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1217 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1218 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1219 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1220 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1221 |
"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
|
1222 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1223 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1224 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1225 |
" |
10071 | 1226 |
Smalltalk browseAllCallsOn:#at:put: |
8583
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 |
! |
617 | 1229 |
|
7563 | 1230 |
browseAllSelect:aBlock |
1231 |
"{ Pragma: +optSpace }" |
|
1232 |
||
1233 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1234 |
|
6020 | 1235 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 1236 |
|
1237 |
" |
|
1238 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1239 |
" |
|
1240 |
! |
|
1241 |
||
7563 | 1242 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1243 |
"{ Pragma: +optSpace }" |
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 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1246 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1247 |
ChangesBrowser notNil ifTrue:[ |
18668 | 1248 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1249 |
] ifFalse:[ |
18668 | 1250 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1251 |
] |
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 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1254 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1255 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1256 |
! |
453 | 1257 |
|
7563 | 1258 |
browseClass:aClass |
1259 |
"{ Pragma: +optSpace }" |
|
1260 |
||
11375 | 1261 |
"startup a browser on aClass. |
11150 | 1262 |
The broser will only show that class (i.e. be a singleClass-browser). |
1263 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1264 |
|
1265 |
UserPreferences systemBrowserClass browseClass:aClass |
|
1266 |
||
1267 |
" |
|
10071 | 1268 |
Smalltalk browseClass:Array |
6970 | 1269 |
" |
1270 |
! |
|
1271 |
||
7563 | 1272 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1273 |
"{ Pragma: +optSpace }" |
|
6819 | 1274 |
|
1275 |
"startup a browser for all methods implementing a message matching" |
|
1276 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1277 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1278 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1279 |
" |
10071 | 1280 |
Smalltalk browseImplementorsOf:#'at:put:' |
1281 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1282 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1283 |
! |
6819 | 1284 |
|
7563 | 1285 |
browseImplementorsOf:aSelectorSymbol |
1286 |
"{ Pragma: +optSpace }" |
|
1287 |
||
1288 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1289 |
|
6020 | 1290 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 1291 |
|
1292 |
" |
|
10071 | 1293 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1294 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1295 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1296 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1297 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1298 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1299 |
|
11150 | 1300 |
"startup a full browser showing aClass. |
20207 | 1301 |
The browser will be a full browser with aClass initially selected. |
11150 | 1302 |
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
|
1303 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1304 |
UserPreferences systemBrowserClass openInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1305 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1306 |
" |
10071 | 1307 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1308 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1309 |
! |
6970 | 1310 |
|
7563 | 1311 |
browseInClass:aClass selector:selector |
1312 |
"{ Pragma: +optSpace }" |
|
1313 |
||
11150 | 1314 |
"startup a full browser showing aClass>>selector. |
20207 | 1315 |
The browser will be a full browser with aClass initially selected. |
11150 | 1316 |
See browseClass: for a singleClass browser, which shows only a single class." |
6970 | 1317 |
|
1318 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
1319 |
||
1320 |
" |
|
1321 |
Smalltalk browseInClass:Array selector:#at: |
|
1322 |
" |
|
453 | 1323 |
! ! |
1324 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1325 |
!Smalltalk class methodsFor:'class management'! |
453 | 1326 |
|
18732 | 1327 |
basicRemoveClass:aClass |
1328 |
"remove the argument, aClass from the smalltalk dictionary; |
|
1329 |
we have to flush the caches since these methods are now void. |
|
1330 |
Also, class variables of aClass are removed." |
|
1331 |
||
1332 |
|sym cSym names oldName oldNameSym actualName wrongName| |
|
1333 |
||
1334 |
aClass isNil ifTrue:[^ self]. |
|
1335 |
||
1336 |
oldName := aClass name. |
|
1337 |
sym := oldNameSym := oldName asSymbol. |
|
1338 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
1339 |
"check other name ..." |
|
1340 |
(self includes:aClass) ifFalse:[ |
|
1341 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
|
1342 |
^ self |
|
1343 |
]. |
|
1344 |
" |
|
1345 |
the class has changed its name - without telling me ... |
|
1346 |
what should be done in this case ? |
|
1347 |
" |
|
1348 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
|
1349 |
' has changed its name' errorPrintCR. |
|
1350 |
||
1351 |
"/ |
|
1352 |
"/ might be an alias (i.e. removing a compatibility name) |
|
1353 |
"/ |
|
1354 |
actualName := self keyAtValue:aClass. |
|
1355 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
|
1356 |
sym := actualName asSymbol. |
|
1357 |
oldName := actualName asString. |
|
1358 |
wrongName := true. |
|
1359 |
]. |
|
1360 |
||
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
1361 |
aClass isBuiltInClass ifTrue:[ |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
1362 |
self error: 'Cannot remove builtin class!!'. |
18737 | 1363 |
]. |
18732 | 1364 |
self at:sym put:nil. "nil it out for compiled accesses" |
1365 |
||
1366 |
"/ |
|
20811 | 1367 |
"/ see comment in removeKey: on why we don't remove it here |
18732 | 1368 |
"/ |
1369 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
|
1370 |
"/ still compiled code references." |
|
1371 |
||
1372 |
"remove private classes" |
|
1373 |
||
1374 |
aClass privateClassesSorted do:[:somePrivateClass | |
|
1375 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
|
1376 |
]. |
|
1377 |
||
1378 |
"remove class variables" |
|
1379 |
||
1380 |
names := aClass classVariableString asCollectionOfWords. |
|
1381 |
names do:[:name | |
|
1382 |
cSym := aClass globalKeyForClassVar:name. |
|
1383 |
self at:cSym asSymbol put:nil. |
|
1384 |
||
1385 |
"/ |
|
1386 |
"/ see comment in removeKey: on why we dont remove it here |
|
1387 |
"/ |
|
1388 |
"/ self removeKey:cSym |
|
1389 |
]. |
|
1390 |
||
1391 |
||
1392 |
"/ actually could get along with less flushing |
|
1393 |
"/ (entries for aClass and subclasses only) |
|
1394 |
"/ but we have to delay this, until we have the set of subclasses |
|
1395 |
"/ at hand - for now, searching for all subclasses is way more |
|
1396 |
"/ expensive then cache flushing. |
|
1397 |
"/ |
|
1398 |
"/ aClass allSubclassesDo:[:aSubclass | |
|
1399 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
|
1400 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
|
1401 |
"/ ]. |
|
1402 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
|
1403 |
"/ ObjectMemory flushMethodCacheFor:aClass |
|
1404 |
||
1405 |
ObjectMemory flushInlineCaches. |
|
1406 |
ObjectMemory flushMethodCache. |
|
1407 |
||
1408 |
aClass addChangeRecordForClassRemove. |
|
1409 |
self changed:#classRemove with:aClass. |
|
1410 |
||
1411 |
aClass setCategory:#'* removed *'. |
|
1412 |
||
1413 |
"/ self flushCachedClasses. |
|
1414 |
"/ Class flushSubclassInfo. |
|
1415 |
self flushCachedClass:aClass. |
|
1416 |
Class flushSubclassInfoFor:aClass superclass. |
|
1417 |
Class flushSubclassInfoFor:aClass. |
|
1418 |
||
1419 |
wrongName == true ifTrue:[ |
|
1420 |
"/ |
|
1421 |
"/ an alias (i.e. removing a compatibility name) |
|
1422 |
"/ |
|
1423 |
"/ check if there are more refs to it ... |
|
1424 |
[self includes:aClass] whileTrue:[ |
|
1425 |
actualName := self keyAtValue:aClass. |
|
1426 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
|
1427 |
, ' - remove that binding too.') infoPrintCR. |
|
1428 |
self at:actualName put:nil. |
|
1429 |
]. |
|
1430 |
]. |
|
1431 |
||
1432 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
1433 |
! |
|
1434 |
||
7563 | 1435 |
changeCategoryOf:aClass to:newCategory |
1436 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1437 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1438 |
|
8405 | 1439 |
|ns oldCategory| |
1440 |
||
1441 |
oldCategory := aClass category. |
|
1442 |
oldCategory ~= newCategory ifTrue:[ |
|
18668 | 1443 |
aClass category:(newCategory withoutSeparators asSymbol). |
1444 |
||
1445 |
"notify change of category" |
|
1446 |
ns := aClass environment ? self. |
|
1447 |
ns changed:#organization with:(aClass -> oldCategory). |
|
1448 |
ns ~~ self ifTrue:[ |
|
1449 |
self changed:#organization with:(aClass -> oldCategory). |
|
1450 |
] |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1451 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1452 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1453 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1454 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1455 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1456 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1457 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1458 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1459 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1460 |
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
|
1461 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1462 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1463 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1464 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1465 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1466 |
CachedClasses notNil ifTrue:[ |
18668 | 1467 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1468 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1469 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1470 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1471 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1472 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1473 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1474 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1475 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1476 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1477 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1478 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1479 |
removeClass:aClass |
7563 | 1480 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1481 |
we have to flush the caches since these methods are now void. |
18732 | 1482 |
Also, class variables of aClass are removed. |
1483 |
Recompile accessors to aClass." |
|
1484 |
||
1485 |
|oldNameSym ns ons| |
|
1486 |
||
1487 |
oldNameSym := aClass name asSymbol. |
|
4781 | 1488 |
ns := aClass nameSpace. |
1489 |
aClass topOwningClass notNil ifTrue:[ |
|
18732 | 1490 |
ons := aClass topOwningClass nameSpace |
1491 |
]. |
|
1492 |
||
1493 |
self basicRemoveClass:aClass. |
|
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1494 |
|
4781 | 1495 |
ns ~~ Smalltalk ifTrue:[ |
18732 | 1496 |
ons notNil ifTrue:[ |
1497 |
ClassBuilder |
|
1498 |
recompileGlobalAccessorsTo:oldNameSym |
|
1499 |
in:ons |
|
1500 |
except:nil |
|
1501 |
]. |
|
1502 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1503 |
ClassBuilder |
|
1504 |
recompileGlobalAccessorsTo:oldNameSym |
|
1505 |
in:ns |
|
1506 |
except:nil |
|
1507 |
]. |
|
1508 |
]. |
|
1509 |
! |
|
1510 |
||
1511 |
removeClasses:aCollectionOfClasses |
|
1512 |
"remove aCollectionOfClasses from the smalltalk dictionary; |
|
1513 |
we have to flush the caches since these methods are now void. |
|
1514 |
Also, class variables of aClass are removed. |
|
1515 |
Recompile accessors to the classes - after all classes in the collection have been removed." |
|
1516 |
||
1517 |
|tuples| |
|
1518 |
||
1519 |
tuples := aCollectionOfClasses collect:[:eachClass| |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
1520 |
Array |
18732 | 1521 |
with:eachClass name asSymbol |
1522 |
with:eachClass nameSpace |
|
1523 |
with:( |
|
1524 |
eachClass topOwningClass notNil ifTrue:[ |
|
1525 |
eachClass topOwningClass nameSpace |
|
1526 |
] ifFalse:[nil]) |
|
1527 |
]. |
|
1528 |
||
1529 |
aCollectionOfClasses do:[:eachClass| |
|
1530 |
self basicRemoveClass:eachClass. |
|
1531 |
]. |
|
1532 |
||
1533 |
tuples do:[:eachClssymNsOnsTuple| |
|
1534 |
|oldNameSym ns ons| |
|
1535 |
||
1536 |
oldNameSym := eachClssymNsOnsTuple at:1. |
|
1537 |
ns := eachClssymNsOnsTuple at:2. |
|
1538 |
ons := eachClssymNsOnsTuple at:3. |
|
1539 |
||
1540 |
ns ~~ Smalltalk ifTrue:[ |
|
1541 |
ons notNil ifTrue:[ |
|
1542 |
ClassBuilder |
|
1543 |
recompileGlobalAccessorsTo:oldNameSym |
|
1544 |
in:ons |
|
1545 |
except:nil |
|
1546 |
]. |
|
1547 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
|
1548 |
ClassBuilder |
|
1549 |
recompileGlobalAccessorsTo:oldNameSym |
|
1550 |
in:ns |
|
1551 |
except:nil |
|
1552 |
]. |
|
1553 |
] |
|
1554 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1555 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1556 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1557 |
renameClass:aClass to:newName |
7563 | 1558 |
"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
|
1559 |
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
|
1560 |
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
|
1561 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1562 |
|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
|
1563 |
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
|
1564 |
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
|
1565 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1566 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1567 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1568 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1569 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1570 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1571 |
[i2 ~~ 0] whileTrue:[ |
20811 | 1572 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1573 |
i2 ~~ 0 ifTrue:[ |
|
1574 |
nm := newName copyFrom:i1 to:i2-1. |
|
1575 |
ns isNameSpace ifTrue:[ |
|
1576 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1577 |
subns isNil ifTrue:[ |
|
1578 |
self error:'Nonexisting namespace: ',nm. |
|
1579 |
^ nil. |
|
1580 |
]. |
|
1581 |
] ifFalse:[ |
|
1582 |
subns := ns privateClassesAt:nm asSymbol. |
|
1583 |
subns isNil ifTrue:[ |
|
1584 |
self error:'Cannot create a namespace below a class' |
|
1585 |
] |
|
1586 |
]. |
|
1587 |
ns := subns. |
|
1588 |
i1 := i2 + 2. |
|
1589 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1590 |
]. |
617 | 1591 |
|
1592 |
oldName := aClass name. |
|
6734 | 1593 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1594 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1595 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1596 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1597 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1598 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1599 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
20811 | 1600 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1601 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1602 |
]. |
617 | 1603 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1604 |
"/ rename the class |
617 | 1605 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1606 |
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
|
1607 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1608 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1609 |
ns isNameSpace ifFalse:[ |
20811 | 1610 |
aClass isPrivate ifTrue:[ |
1611 |
aClass class setOwningClass:ns. |
|
1612 |
] ifFalse:[ |
|
1613 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1614 |
oldMetaclass := aClass class. |
|
1615 |
newMetaclass := PrivateMetaclass new. |
|
1616 |
newMetaclass flags:(oldMetaclass flags). |
|
1617 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1618 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1619 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1620 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1621 |
newMetaclass setSoleInstance:aClass. |
|
1622 |
newMetaclass setOwningClass:ns. |
|
1623 |
||
1624 |
aClass changeClassTo:newMetaclass. |
|
1625 |
ObjectMemory flushCaches. |
|
1626 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1627 |
] ifTrue:[ |
20811 | 1628 |
aClass isPrivate ifTrue:[ |
1629 |
newCategory := aClass topOwningClass category. |
|
1630 |
||
1631 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1632 |
oldMetaclass := aClass class. |
|
1633 |
||
1634 |
newMetaclass := Metaclass new. |
|
1635 |
newMetaclass flags:(oldMetaclass flags). |
|
1636 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1637 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1638 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1639 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1640 |
newMetaclass setSoleInstance:aClass. |
|
1641 |
||
1642 |
aClass category:newCategory. |
|
1643 |
aClass changeClassTo:newMetaclass. |
|
1644 |
ObjectMemory flushCaches. |
|
1645 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1646 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1647 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1648 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1649 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1650 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1651 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1652 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1653 |
"/ |
20811 | 1654 |
"/ see comment in #removeKey: on why we don't remove it it here |
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1655 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1656 |
"/ self removeKey:oldSym. |
617 | 1657 |
self at:newSym put:aClass. |
1658 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1659 |
"/ 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
|
1660 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1661 |
oldNameToNewName := IdentityDictionary new. |
617 | 1662 |
|
1663 |
names := aClass classVariableString asCollectionOfWords. |
|
1664 |
names do:[:name | |
|
20811 | 1665 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1666 |
value := self at:oldCVSym. |
|
1667 |
self at:oldCVSym put:nil. |
|
1668 |
||
1669 |
"/ |
|
1670 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1671 |
"/ |
|
1672 |
"/ self removeKey:cSym. |
|
1673 |
||
1674 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1675 |
self at:newCVSym put:value. |
|
1676 |
||
1677 |
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
|
1678 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1679 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1680 |
"/ 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
|
1681 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1682 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
20811 | 1683 |
aClass withAllSubclasses do:[:aSubClass | |
1684 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1685 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1686 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1687 |
]. |
|
1688 |
]. |
|
1689 |
||
1690 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1691 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1692 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1693 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1694 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1695 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1696 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1697 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1698 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1699 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1700 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1701 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1702 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1703 |
"/ ] |
617 | 1704 |
]. |
1705 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1706 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1707 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1708 |
"/ 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
|
1709 |
aClass setEnvironment:nil. |
6734 | 1710 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1711 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1712 |
privateClasses size > 0 ifTrue:[ |
20811 | 1713 |
"/ must rename privateClasses as well |
1714 |
Class withoutUpdatingChangesDo:[ |
|
1715 |
privateClasses do:[:aPrivateClass | |
|
1716 |
self renameClass:aPrivateClass |
|
1717 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1718 |
||
1719 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1720 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1721 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1722 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1723 |
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
|
1724 |
"/ ClassBuilder |
10071 | 1725 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1726 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1727 |
"/ except:nil. |
20811 | 1728 |
] |
1729 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1730 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1731 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1732 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1733 |
|
20811 | 1734 |
"/ all those referencing the class from the old nameSpace |
1735 |
"/ must be recompiled ... |
|
1736 |
"/ (to now access the global from smalltalk) |
|
1737 |
||
1738 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1739 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1740 |
||
1741 |
ClassBuilder |
|
1742 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1743 |
in:oldNameSpace |
|
1744 |
except:nil. |
|
1745 |
]. |
|
1746 |
||
1747 |
"/ all referencing the class in the new namespace |
|
1748 |
"/ as well; to now access the new class. |
|
1749 |
||
1750 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1751 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1752 |
||
1753 |
ClassBuilder |
|
1754 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1755 |
in:newNameSpace |
|
1756 |
except:nil. |
|
1757 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1758 |
] ifFalse:[ |
20811 | 1759 |
"/ all references to a global with my new name in my owning class |
1760 |
"/ must now be redirected to myself. |
|
1761 |
||
1762 |
aClass isPrivate ifTrue:[ |
|
1763 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1764 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1765 |
||
1766 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1767 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1768 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1769 |
||
1770 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1771 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1772 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1773 |
||
1774 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1775 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1776 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1777 |
||
1778 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1779 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1780 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1781 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1782 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1783 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1784 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1785 |
"/ 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
|
1786 |
aClass allSubclassesDo:[:subClass | |
20811 | 1787 |
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
|
1788 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1789 |
"/ 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
|
1790 |
aClass subclassesDo:[:subClass | |
20811 | 1791 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1792 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1793 |
self changed:#definition. |
14611 | 1794 |
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
|
1795 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1796 |
"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
|
1797 |
"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
|
1798 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1801 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1802 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1803 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1804 |
"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
|
1805 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1806 |
^ self |
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 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1809 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1810 |
|
10952 | 1811 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1812 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1813 |
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
|
1814 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1815 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1816 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1817 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1818 |
! |
453 | 1819 |
|
7563 | 1820 |
shallowCopy |
1821 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1822 |
|
1823 |
^ self |
|
1410 | 1824 |
|
1825 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1826 |
! |
1827 |
||
7563 | 1828 |
simpleDeepCopy |
1829 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1830 |
|
1831 |
^ self |
|
1410 | 1832 |
|
1833 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1834 |
! ! |
1835 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1836 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1837 |
|
7563 | 1838 |
compileTrace:aBoolean |
1839 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1840 |
%{ |
1841 |
extern char __compileTrace__; |
|
1842 |
||
1843 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1844 |
%} |
|
1845 |
" |
|
1846 |
Smalltalk compileTrace:true |
|
1847 |
Smalltalk compileTrace:false |
|
1848 |
" |
|
1849 |
! |
|
1850 |
||
7563 | 1851 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1852 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1853 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1854 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1855 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1856 |
WARNING: this method is for debugging only |
18668 | 1857 |
it will be removed without notice." |
453 | 1858 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1859 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1860 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1861 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1862 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1863 |
! |
453 | 1864 |
|
7563 | 1865 |
exitWithCoreDump |
1866 |
"{ Pragma: +optSpace }" |
|
1867 |
||
20755 | 1868 |
"abort the program and dump core" |
7563 | 1869 |
|
1870 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1871 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1872 |
|
20755 | 1873 |
"Be careful evaluating this: |
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1874 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1875 |
" |
617 | 1876 |
! |
1877 |
||
7563 | 1878 |
fatalAbort |
1879 |
"{ Pragma: +optSpace }" |
|
1880 |
||
1881 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1882 |
(You may turn off the stack print with debugPrinting:false)" |
18287 | 1883 |
|
1884 |
self fatalAbort:'fatalAbort' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1885 |
! |
617 | 1886 |
|
7563 | 1887 |
fatalAbort:aMessage |
1888 |
"{ Pragma: +optSpace }" |
|
1889 |
||
1890 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1891 |
(You may turn off the stack print with debugPrinting:false)" |
1892 |
||
1893 |
%{ |
|
18287 | 1894 |
#ifdef __SCHTEAM__ |
1895 |
STMain.fatalAbort( aMessage ); |
|
1896 |
/* NOT REACHED */ |
|
1897 |
#else |
|
617 | 1898 |
char *msg; |
1899 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1900 |
if (__isStringLike(aMessage)) |
18668 | 1901 |
msg = (char *) __stringVal(aMessage); |
617 | 1902 |
else |
18668 | 1903 |
msg = "fatalAbort"; |
617 | 1904 |
|
1905 |
__fatal0(__context, msg); |
|
1906 |
/* NEVER RETURNS */ |
|
18287 | 1907 |
#endif |
5410 | 1908 |
%}. |
1909 |
^ self primitiveFailed |
|
5441 | 1910 |
! |
1911 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1912 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1913 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1914 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1915 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1916 |
IgnoreHalt isNil ifTrue:[ |
18668 | 1917 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1918 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1919 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1920 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1921 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1922 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1923 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1924 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1925 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1926 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1927 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1928 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1929 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1930 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1931 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1932 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1933 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1934 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1935 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1936 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1937 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1938 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1939 |
|
18329 | 1940 |
verbose |
1941 |
^ Verbose |
|
1942 |
! |
|
1943 |
||
1944 |
verbose:aBoolean |
|
1945 |
Verbose := aBoolean |
|
1946 |
! |
|
1947 |
||
7563 | 1948 |
vmInstructionTrace:aBoolean |
13947 | 1949 |
self halt:'not yet implemented' |
1950 |
||
1951 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 1952 |
! ! |
1953 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1954 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 1955 |
|
453 | 1956 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1957 |
"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
|
1958 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1959 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1960 |
|
1961 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1962 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1963 |
" |
7563 | 1964 |
! |
1965 |
||
1966 |
allClassCategories |
|
1967 |
"return a set of all class categories in the system" |
|
1968 |
||
1969 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1970 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1971 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1972 |
Smalltalk allClassesDo:[:cls | |
18668 | 1973 |
|category| |
1974 |
||
1975 |
category := cls category. |
|
1976 |
category notNil ifTrue:[ |
|
1977 |
allCategories add:category. |
|
1978 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1979 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1980 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1981 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1982 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1983 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1984 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1985 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1986 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1987 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1988 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1989 |
|
7563 | 1990 |
allClassesAndMetaclassesDo:aBlock |
1991 |
"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
|
1992 |
|
21108 | 1993 |
|already numClassesHintTimes2| |
1994 |
||
1995 |
numClassesHintTimes2 := NumberOfClassesHint*2. |
|
1996 |
already := IdentitySet new:numClassesHintTimes2. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1997 |
self allClassesDo:[:eachClass | |
21109 | 1998 |
|theNonMeta theMeta| |
1999 |
||
2000 |
theNonMeta := eachClass theNonMetaclass. |
|
2001 |
(already includes:theNonMeta) ifFalse:[ |
|
2002 |
aBlock value:theNonMeta. |
|
2003 |
already add:theNonMeta. |
|
20556 | 2004 |
]. |
21109 | 2005 |
theMeta := theNonMeta class. |
2006 |
(already includes:theMeta) ifFalse:[ |
|
2007 |
aBlock value:theMeta. |
|
2008 |
already add:theMeta. |
|
20556 | 2009 |
]. |
21108 | 2010 |
already size > numClassesHintTimes2 ifTrue:[ |
2011 |
NumberOfClassesHint := (already size // 2) + 10 |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2012 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2013 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2014 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
2015 |
|
7563 | 2016 |
allClassesDo:aBlock |
2017 |
"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
|
2018 |
|
5765 | 2019 |
self allClasses do:aBlock |
453 | 2020 |
|
2021 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2022 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 2023 |
" |
2024 |
! |
|
2025 |
||
9506 | 2026 |
allClassesForWhich:filter |
10071 | 2027 |
"return a collection with all classes in the system, |
9506 | 2028 |
for which filter evaluates to true." |
2029 |
||
2030 |
|collectedClasses| |
|
2031 |
||
2032 |
collectedClasses := OrderedCollection new. |
|
2033 |
self allClassesForWhich:filter do:[:cls | |
|
18668 | 2034 |
collectedClasses add:cls |
9506 | 2035 |
]. |
2036 |
^ collectedClasses |
|
2037 |
||
2038 |
" |
|
10071 | 2039 |
Smalltalk |
18668 | 2040 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 2041 |
" |
2042 |
||
2043 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
2044 |
! |
|
2045 |
||
9292 | 2046 |
allClassesForWhich:filter do:aBlock |
2047 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true." |
|
2048 |
||
2049 |
self allClassesDo:[:cls | |
|
18668 | 2050 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 2051 |
]. |
2052 |
||
2053 |
" |
|
2054 |
Smalltalk |
|
18668 | 2055 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
2056 |
do:[:aClass | Transcript showCR:aClass name] |
|
9292 | 2057 |
" |
2058 |
! |
|
2059 |
||
7563 | 2060 |
allClassesInCategory:aCategory |
2061 |
"return a collection of for all classes in aCategory; |
|
1299 | 2062 |
The order of the classes is not defined." |
2063 |
||
9506 | 2064 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2065 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2066 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2067 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2068 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2069 |
|
9506 | 2070 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2071 |
! |
1299 | 2072 |
|
7563 | 2073 |
allClassesInCategory:aCategory do:aBlock |
2074 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 2075 |
The order of the classes is not defined." |
2076 |
||
2077 |
aCategory notNil ifTrue:[ |
|
18668 | 2078 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 2079 |
] |
2080 |
||
2081 |
" |
|
9490 | 2082 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
2083 |
" |
|
2084 |
||
2085 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2086 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2087 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2088 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 2089 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 2090 |
superclasses come first - then subclasses" |
2091 |
||
2092 |
|classes| |
|
2093 |
||
2094 |
aCategory notNil ifTrue:[ |
|
18668 | 2095 |
classes := OrderedCollection new. |
2096 |
self allClassesInCategory:aCategory do:[:aClass | |
|
2097 |
classes add:aClass |
|
2098 |
]. |
|
2099 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
2100 |
classes do:aBlock |
|
453 | 2101 |
] |
2102 |
||
2103 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2104 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 2105 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2106 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
2107 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2108 |
! |
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 |
allClassesInOrderDo:aBlock |
7563 | 2111 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 2112 |
Evaluation order is by inheritance: superclasses come first." |
2113 |
||
2114 |
|already| |
|
2115 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2116 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2117 |
self allClassesDo:[:eachClass | |
18668 | 2118 |
(already includes:eachClass) ifFalse:[ |
2119 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
|
2120 |
(already includes:eachSuperClass) ifFalse:[ |
|
2121 |
already add:eachSuperClass. |
|
2122 |
aBlock value:eachSuperClass. |
|
2123 |
]. |
|
2124 |
]. |
|
2125 |
already add:eachClass. |
|
2126 |
aBlock value:eachClass. |
|
2127 |
] |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2128 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2129 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2130 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2131 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 2132 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2133 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2134 |
|
9506 | 2135 |
allClassesInPackage:aPackageID |
2136 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 2137 |
The order of the classes is not defined. |
2138 |
The returned collection may include private classes" |
|
9506 | 2139 |
|
2140 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
2141 |
||
2142 |
" |
|
10071 | 2143 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 2144 |
" |
2145 |
||
2146 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 2147 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 2148 |
! |
2149 |
||
9490 | 2150 |
allClassesInPackage:aPackageID do:aBlock |
2151 |
"evaluate the argument, aBlock for all classes a package; |
|
2152 |
The order of the classes is not defined." |
|
2153 |
||
2154 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
2155 |
||
2156 |
" |
|
10071 | 2157 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 2158 |
" |
2159 |
||
2160 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
2161 |
! |
|
2162 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2163 |
allKeysDo:aBlock |
20988 | 2164 |
<resource: #obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2165 |
"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
|
2166 |
|
21265 | 2167 |
self obsoleteMethodWarning:'please use #keysDo:'. |
17385 | 2168 |
self keysDo:aBlock |
21265 | 2169 |
|
2170 |
"Modified: / 20-01-2017 / 17:52:40 / stefan" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2171 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2172 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2173 |
allMethodCategories |
12298 | 2174 |
"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
|
2175 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2176 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2177 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2178 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2179 |
Smalltalk allClassesDo:[:cls | |
18668 | 2180 |
allCategories addAll:cls categories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2181 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2182 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2183 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2184 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2185 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2186 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2187 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2188 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
2189 |
|
9259 | 2190 |
allMethodsDo:aBlock |
12298 | 2191 |
"enumerate all methods in all classes" |
12000 | 2192 |
|
9259 | 2193 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2194 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2195 |
aBlock value:mthd |
|
2196 |
] |
|
12298 | 2197 |
]. |
2198 |
! |
|
2199 |
||
14933 | 2200 |
allMethodsForWhich:aBlock |
2201 |
"return a collection of methods for which aBlock returns true" |
|
2202 |
||
2203 |
|coll| |
|
2204 |
||
2205 |
coll := OrderedCollection new. |
|
2206 |
Smalltalk allClassesDo:[:eachClass | |
|
18668 | 2207 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2208 |
(aBlock value:mthd) ifTrue:[ |
|
2209 |
coll add:mthd |
|
2210 |
]. |
|
2211 |
] |
|
14933 | 2212 |
]. |
2213 |
^ coll |
|
2214 |
! |
|
2215 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2216 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2217 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
2218 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2219 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2220 |
Smalltalk allClassesDo:[:eachClass | |
18668 | 2221 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
2222 |
aTwoArgBlock value:mthd value:sel |
|
2223 |
] |
|
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2224 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2225 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
2226 |
|
7563 | 2227 |
associationsDo:aBlock |
10071 | 2228 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 2229 |
in the Smalltalk dictionary" |
2230 |
||
2231 |
self keysDo:[:aKey | |
|
18668 | 2232 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2233 |
] |
2234 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2235 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2236 |
! |
2237 |
||
7563 | 2238 |
basicKeys |
2239 |
"for rel > 5 only" |
|
2240 |
||
18349 | 2241 |
%{ |
2242 |
#ifdef __SCHTEAM__ |
|
18668 | 2243 |
STObject[] keys = STSmalltalkEnvironment.GetKeyVector(); |
18349 | 2244 |
return __c__._RETURN( new STVector(keys) ); |
2245 |
#endif |
|
2246 |
%}. |
|
7563 | 2247 |
self primitiveFailed |
2248 |
! |
|
2249 |
||
2250 |
do:aBlock |
|
2251 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2252 |
|
2253 |
|work| |
|
2254 |
||
2255 |
%{ /* 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
|
2256 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2257 |
RETURN (self); |
2258 |
%}. |
|
2259 |
self keysDo:[:aKey | |
|
18668 | 2260 |
aBlock value:(self at:aKey) |
5406 | 2261 |
] |
617 | 2262 |
! |
2263 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2264 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2265 |
"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
|
2266 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2267 |
self keysDo:[:aKey | |
18668 | 2268 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2269 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2270 |
! |
617 | 2271 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2272 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2273 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2274 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2275 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2276 |
self keysAndValuesDo:[:eachKey :eachValue | |
18668 | 2277 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
2278 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
|
2279 |
]. |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2280 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2281 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2282 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2283 |
" |
10071 | 2284 |
Smalltalk |
18668 | 2285 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
2286 |
thenCollect:[:nm :val | nm] |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2287 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2288 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2289 |
|
7563 | 2290 |
keysDo:aBlock |
2291 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2292 |
|work| |
2293 |
||
2294 |
%{ /* 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
|
2295 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2296 |
RETURN (self); |
2297 |
%}. |
|
2298 |
self basicKeys do:[:aKey | |
|
18668 | 2299 |
aBlock value:aKey |
5406 | 2300 |
] |
453 | 2301 |
! ! |
2302 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2303 |
!Smalltalk class methodsFor:'message control'! |
453 | 2304 |
|
7563 | 2305 |
silentLoading |
12408 | 2306 |
"returns the Silentloading class variable, which globally controls if compilation |
2307 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2308 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2309 |
^ SilentLoading ? false |
7563 | 2310 |
! |
2311 |
||
2312 |
silentLoading:aBoolean |
|
2313 |
"{ Pragma: +optSpace }" |
|
2314 |
||
2315 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2316 |
messages (especially during fileIn) onto the transcript. |
453 | 2317 |
You can save a snapshot with this flag set to true, which makes |
2318 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2319 |
||
2320 |
|prev| |
|
2321 |
||
2322 |
prev := SilentLoading. |
|
2323 |
SilentLoading := aBoolean. |
|
2324 |
^ prev |
|
12409 | 2325 |
! |
2326 |
||
2327 |
silentlyLoadingDo:aBlock |
|
2328 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2329 |
are shown on the transcript" |
|
2330 |
||
2331 |
|sav| |
|
2332 |
||
20719 | 2333 |
Smalltalk verbose ifTrue:[ |
2334 |
aBlock value. |
|
2335 |
^ self. |
|
2336 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2337 |
|
12409 | 2338 |
sav := SilentLoading. |
2339 |
SilentLoading := true. |
|
2340 |
aBlock ensure:[ SilentLoading := sav ]. |
|
453 | 2341 |
! ! |
2342 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2343 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2344 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2345 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2346 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2347 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2348 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2349 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2350 |
|
10231 | 2351 |
beSTScript:aBoolean |
2352 |
"set/clear the isSTScript flag." |
|
2353 |
||
2354 |
IsSTScript := aBoolean |
|
2355 |
||
2356 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2357 |
! |
|
2358 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2359 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2360 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2361 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2362 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2363 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2364 |
|
18197 | 2365 |
|
12250 | 2366 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2367 |
||
17324 | 2368 |
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2369 |
"load a package referenced by aPackageString - a string like 'stx:libbasic'. |
|
2370 |
The package is either located in packageDirOrStringOrNil, or in the current directory (if nil). |
|
2371 |
Answer true, if the load succeeded, false if it failed" |
|
2372 |
||
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2373 |
|packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename |
19589 | 2374 |
projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
2375 |
loadOK errorInInitialize| |
|
17324 | 2376 |
|
2377 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
19589 | 2378 |
packageDirOrNil := packageDirOrStringOrNil asFilename. |
2379 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2380 |
silent := VerboseLoading not |
19589 | 2381 |
and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]]. |
17324 | 2382 |
|
2383 |
"For now: have to read the project definition first!! |
|
2384 |
The class library may contain subclasses of classes in prerequisite packages - |
|
19589 | 2385 |
so the prerequisite packages have to be loaded first. |
2386 |
Normally there is a project definiton, use that one to pull in the rest" |
|
17324 | 2387 |
|
2388 |
"maybe, it is already in the image" |
|
2389 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
19906 | 2390 |
projectDefinitionClass notNil ifTrue:[ |
2391 |
projectDefinitionClass checkForLoad. |
|
17324 | 2392 |
]. |
2393 |
||
2394 |
"Is there a shared library (.dll or .so) ?" |
|
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2395 |
binaryClassLibraryFilename := ObjectFileLoader |
19589 | 2396 |
binaryClassFilenameForPackage:aPackageString |
2397 |
inDirectory:packageDirOrNil. |
|
17324 | 2398 |
|
2399 |
(binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[ |
|
19589 | 2400 |
|loadErrorOccurred| |
2401 |
||
2402 |
loadErrorOccurred := false. |
|
2403 |
ObjectFileLoader objectFileLoadErrorNotification handle:[:ex | |
|
2404 |
loadErrorOccurred := true. |
|
2405 |
ex proceedWith:true. |
|
2406 |
] do:[ |
|
2407 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
|
2408 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2409 |
]. |
|
2410 |
(loadOK and:[loadErrorOccurred not]) ifTrue:[ |
|
2411 |
"now, all compiled classes have been loaded. |
|
2412 |
keep classes in the package which are autoloaded as autoloaded." |
|
2413 |
^ true |
|
2414 |
]. |
|
2415 |
||
2416 |
loadErrorOccurred ifTrue:[ |
|
2417 |
self breakPoint:#cg. |
|
2418 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2419 |
projectDefinitionClass notNil ifTrue:[ |
|
19907 | 2420 |
projectDefinitionClass |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2421 |
checkForLoad; |
19907 | 2422 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
19589 | 2423 |
]. |
2424 |
]. |
|
17324 | 2425 |
]. |
2426 |
packageDirOrNil isNil ifTrue:[ |
|
19589 | 2427 |
^ PackageNotFoundError raiseRequestWith:aPackageString. |
17324 | 2428 |
]. |
2429 |
||
2430 |
"fallback - go through the project definition" |
|
2431 |
projectDefinitionClass isNil ifTrue:[ |
|
19589 | 2432 |
projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString. |
2433 |
"/ try to load the project definition class |
|
2434 |
projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'. |
|
2435 |
projectDefinitionFilename exists ifFalse:[ |
|
2436 |
projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2437 |
]. |
|
2438 |
projectDefinitionFilename exists ifTrue:[ |
|
2439 |
Class withoutUpdatingChangesDo:[ |
|
2440 |
Smalltalk silentlyLoadingDo:[ |
|
2441 |
Error handle:[:ex | |
|
2442 |
"/ catch error during initialization; |
|
2443 |
ex suspendedContext withAllSendersDo:[:sender | |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2444 |
(sender selector == #initialize |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2445 |
and:[sender receiver isBehavior |
19589 | 2446 |
and:[sender receiver name = projectDefinitionClassName]] |
2447 |
) ifTrue:[ |
|
2448 |
errorInInitialize := true |
|
2449 |
]. |
|
2450 |
]. |
|
2451 |
errorInInitialize ifFalse:[ ex reject ]. |
|
2452 |
] do:[ |
|
2453 |
projectDefinitionFilename fileIn. |
|
2454 |
]. |
|
2455 |
]. |
|
2456 |
]. |
|
2457 |
errorInInitialize ifTrue:[ |
|
2458 |
Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'. |
|
2459 |
]. |
|
2460 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2461 |
]. |
|
17324 | 2462 |
]. |
2463 |
projectDefinitionClass notNil ifTrue:[ |
|
19906 | 2464 |
projectDefinitionClass |
2465 |
autoload; |
|
2466 |
checkForLoad; |
|
2467 |
loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2468 |
||
19589 | 2469 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
2470 |
errorInInitialize ifTrue:[ |
|
2471 |
Transcript showCR:('Smalltalk [info]: retrying #initialize'). |
|
2472 |
projectDefinitionClass initialize. |
|
2473 |
]. |
|
2474 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2475 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2476 |
]. |
|
2477 |
^ true. |
|
17324 | 2478 |
]. |
2479 |
||
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2480 |
"/ Is it a Tonel package? |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2481 |
"/ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2482 |
"/ Note: Tonel is also handled in loadPackage:isAutoloaded: but we *have* to handle |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2483 |
"/ it here for (rare) case where Tonel repository has no 'source' directory, i.e., |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2484 |
"/ packages are directly in the root of the repository. In this case, |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2485 |
"/ `Smalltalk packageDirectoryForPackage:` would return non-nil value and we end up |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2486 |
"/ here instead of falling back to Tonel code in loadPackage:isAutoloaded:. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2487 |
(ConfigurableFeatures includesFeature: #Tonel) ifTrue: [ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2488 |
| repoPath | |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2489 |
|
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2490 |
repoPath := (Smalltalk at: #TonelRepository) discover: packageDirOrStringOrNil. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2491 |
(self loadPackage: aPackageString fromTonelRepository: repoPath) ifTrue:[ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2492 |
^ true. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2493 |
]. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2494 |
]. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2495 |
|
17324 | 2496 |
"/ source files-file loading no longer supported |
2497 |
"/ however, allow for autoload-stub loaded |
|
2498 |
doLoadAsAutoloaded ifTrue:[ |
|
19589 | 2499 |
self |
2500 |
recursiveInstallAutoloadedClassesFrom:packageDirOrNil |
|
2501 |
rememberIn:Set new |
|
2502 |
maxLevels:2 |
|
2503 |
noAutoload:false |
|
2504 |
packageTop:packageDirOrNil |
|
2505 |
showSplashInLevels:0. |
|
2506 |
^ true |
|
17324 | 2507 |
]. |
2508 |
||
2509 |
^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'. |
|
2510 |
||
2511 |
" |
|
2512 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2513 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2514 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2515 |
" |
|
2516 |
||
2517 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
|
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2518 |
"Modified: / 31-08-2020 / 17:04:39 / Jan Vrany <jan.vrany@labware.com>" |
17324 | 2519 |
! |
2520 |
||
12250 | 2521 |
loadExtensionsForPackage:aPackageId |
13415 | 2522 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2523 |
|
13415 | 2524 |
extensionsLoaded := false. |
18924 | 2525 |
ProgrammingLanguage allDo:[:programmingLanguage| |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2526 |
"/ evaluating or here - want all extensions to be loaded |
18924 | 2527 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage) |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2528 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2529 |
^ extensionsLoaded |
13415 | 2530 |
|
2531 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2532 |
"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
|
2533 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2534 |
! |
2535 |
||
18924 | 2536 |
loadExtensionsForPackage:aPackageId language: programmingLanguage |
13771 | 2537 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2538 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2539 |
|
18924 | 2540 |
programmingLanguage supportsExtensionMethods ifFalse:[^false]. |
13415 | 2541 |
|
12250 | 2542 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2543 |
packageDirName := self getPackageFileName:packageDirName. |
|
2544 |
||
2545 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
18924 | 2546 |
(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[ |
2547 |
^ true. |
|
2548 |
]. |
|
2549 |
packageDirName := nil. "do not try again" |
|
12250 | 2550 |
]. |
2551 |
||
2552 |
" |
|
2553 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2554 |
" |
|
15958 | 2555 |
(Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[ |
18924 | 2556 |
mgr := AbstractSourceCodeManager managerForPackage: aPackageId |
15958 | 2557 |
]. |
12250 | 2558 |
mgr notNil ifTrue:[ |
18924 | 2559 |
extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix. |
2560 |
||
2561 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2562 |
projectDefinition notNil ifTrue:[ |
|
2563 |
mod := aPackageId asPackageId module. |
|
2564 |
dir := aPackageId asPackageId directory. |
|
2565 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2566 |
extensionsRevisionString notNil ifTrue:[ |
|
2567 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2568 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2569 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[ |
|
2570 |
"JV@2011-10-23: following condition is never satisfied for |
|
2571 |
filed-in packages. The whole scheme of extensionVersion_XXX |
|
2572 |
works ONLY for compiled packages as it depends on fact, that |
|
2573 |
extension Init() routine is called AFTER all classes are inited, |
|
2574 |
therefore the extensionVersion_XXX methods from extensions.st |
|
2575 |
overwrites methods coming from package definition class. All this |
|
2576 |
is so tricky and error prone, that we have to come up with better |
|
2577 |
solution!!" |
|
2578 |
packageDirName notNil ifTrue:[ |
|
2579 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
|
2580 |
] ifFalse:[ |
|
2581 |
^ false |
|
2582 |
] |
|
2583 |
] |
|
2584 |
] |
|
2585 |
]. |
|
2586 |
SourceCodeManagerError handle:[:ex | |
|
2587 |
] do:[ |
|
2588 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2589 |
]. |
|
2590 |
]. |
|
2591 |
inStream isNil ifTrue:[ |
|
2592 |
SourceCodeManagerError handle:[:ex | |
|
2593 |
] do:[ |
|
2594 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2595 |
]. |
|
2596 |
]. |
|
2597 |
inStream notNil ifTrue:[ |
|
2598 |
Class withoutUpdatingChangeSetDo:[ |
|
2599 |
inStream fileIn. |
|
2600 |
]. |
|
2601 |
inStream close. |
|
2602 |
VerboseLoading ifTrue:[ |
|
2603 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2604 |
]. |
|
2605 |
^ true |
|
2606 |
] |
|
12250 | 2607 |
]. |
2608 |
||
2609 |
packageDirName notNil ifTrue:[ |
|
18924 | 2610 |
^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage |
12250 | 2611 |
]. |
2612 |
^ false |
|
2613 |
||
13415 | 2614 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2615 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2616 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
15958 | 2617 |
"Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2618 |
! |
2619 |
||
2620 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2621 |
| extensionsLoaded | |
18924 | 2622 |
|
13415 | 2623 |
extensionsLoaded := false. |
18924 | 2624 |
ProgrammingLanguage allDo:[:programmingLanguage| |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2625 |
"/ evaluating or here - want all extensions to be loaded |
18924 | 2626 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage) |
2627 |
]. |
|
2628 |
^ extensionsLoaded |
|
13415 | 2629 |
|
2630 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2631 |
! |
|
2632 |
||
2633 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2634 |
|packageDir f| |
2635 |
||
2636 |
packageDir := packageDirOrString asFilename. |
|
2637 |
||
13415 | 2638 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2639 |
f exists ifTrue:[ |
18668 | 2640 |
Class withoutUpdatingChangeSetDo:[ |
2641 |
f fileIn. |
|
2642 |
]. |
|
2643 |
VerboseLoading ifTrue:[ |
|
2644 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2645 |
]. |
|
2646 |
^ true |
|
15958 | 2647 |
]. |
2648 |
^ true"/false |
|
13415 | 2649 |
|
2650 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2651 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
15958 | 2652 |
"Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2653 |
! |
2654 |
||
14589 | 2655 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2656 |
"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
|
2657 |
Return true on success, false otherwise." |
12782 | 2658 |
|
14589 | 2659 |
|packageId packageString packageDir def sourceCodeManager| |
2660 |
||
17588 | 2661 |
packageString := aPackageStringArg. |
2662 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2663 |
"if I am here, so must my package" |
14892 | 2664 |
packageString = self package ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2665 |
|
17588 | 2666 |
packageId := aPackageStringArg asPackageId. |
2667 |
||
12782 | 2668 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2669 |
def := packageId projectDefinitionClass. |
14833 | 2670 |
(def notNil and:[def isLoaded]) ifTrue:[ |
19919 | 2671 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2672 |
^ true. |
|
14589 | 2673 |
]. |
2674 |
||
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2675 |
packageDir := self getPackageDirectoryForPackage:packageId. |
16144 | 2676 |
|
2677 |
[ |
|
19919 | 2678 |
self |
2679 |
loadPackage:packageString |
|
2680 |
fromDirectory:packageDir |
|
2681 |
asAutoloaded:doLoadAsAutoloaded. |
|
16144 | 2682 |
] on:PackageLoadError do:[:ex| |
19919 | 2683 |
ex creator ~~ PackageNotCompatibleError ifTrue:[ |
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2684 |
"/ Support for Tonel |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2685 |
(ConfigurableFeatures includesFeature: #Tonel) ifTrue: [ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2686 |
| repoPath | |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2687 |
|
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2688 |
repoPath := (Smalltalk at: #TonelRepository) discoverPackage: packageString. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2689 |
(self loadPackage: packageString fromTonelRepository: repoPath) ifTrue:[ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2690 |
^ true. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2691 |
]. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2692 |
]. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2693 |
|
19919 | 2694 |
AbstractSourceCodeManager notNil ifTrue:[ |
2695 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString. |
|
2696 |
sourceCodeManager notNil ifTrue:[ |
|
21188 | 2697 |
PackageLoadError handle:[:ex2 | |
2698 |
ex reject |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
2699 |
] do:[ |
21188 | 2700 |
^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded |
2701 |
]. |
|
19919 | 2702 |
]. |
2703 |
]. |
|
2704 |
]. |
|
2705 |
ex reject. |
|
16144 | 2706 |
]. |
2707 |
||
2708 |
^ true |
|
12782 | 2709 |
|
2710 |
" |
|
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2711 |
Smalltalk loadPackage:'stx:libbasic' |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2712 |
Smalltalk loadPackage:'stx:goodies/persistency' |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2713 |
Smalltalk loadPackage:'exept:ctypes' |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2714 |
Smalltalk loadPackage:'MachineArithmetic' |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2715 |
Smalltalk loadPackage:'Bogus' |
12782 | 2716 |
" |
2717 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2718 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2719 |
"Modified: / 28-06-2016 / 07:52:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2720 |
"Modified: / 31-08-2020 / 17:02:56 / Jan Vrany <jan.vrany@labware.com>" |
12782 | 2721 |
! |
2722 |
||
12250 | 2723 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2724 |
"load all source files found in aDirectory and treat them like |
|
2725 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2726 |
Experimental." |
|
2727 |
||
2728 |
|p t new anyFail repeatCount| |
|
2729 |
||
2730 |
"/ problem: dependencies. |
|
2731 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2732 |
||
2733 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
18668 | 2734 |
|any| |
2735 |
||
2736 |
repeatCount := 0. |
|
2737 |
[ |
|
2738 |
repeatCount := repeatCount + 1. |
|
2739 |
anyFail := false. |
|
2740 |
aDirectory directoryContents do:[:file | |
|
2741 |
|fn| |
|
2742 |
||
2743 |
fn := aDirectory / file. |
|
2744 |
(fn hasSuffix:'st') ifTrue:[ |
|
2745 |
Metaclass confirmationQuerySignal answer:false |
|
2746 |
do:[ |
|
2747 |
Error |
|
2748 |
handle:[:ex | |
|
2749 |
anyFail := true |
|
2750 |
] |
|
2751 |
do:[ |
|
2752 |
(self fileIn:fn) ifFalse:[ |
|
2753 |
anyFail := true |
|
2754 |
] ifTrue:[ |
|
2755 |
any := true. |
|
2756 |
] |
|
2757 |
] |
|
2758 |
] |
|
2759 |
] |
|
2760 |
]. |
|
2761 |
any ifFalse:[ |
|
2762 |
^ false "/ no file found |
|
2763 |
] |
|
2764 |
] doWhile:[anyFail and:[repeatCount<2]]. |
|
12250 | 2765 |
]. |
2766 |
||
2767 |
new := (p := Project projectWithId:packageId) isNil. |
|
2768 |
new ifTrue:[ p := Project new]. |
|
2769 |
||
2770 |
p name:packageId. |
|
2771 |
p directory:aDirectory. |
|
2772 |
p package:packageId. |
|
2773 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2774 |
p repositoryModule:(t first). |
|
2775 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2776 |
p isLoaded:true. |
|
2777 |
||
2778 |
new ifTrue:[Project addLoadedProject:p]. |
|
16144 | 2779 |
anyFail ifTrue:[ |
18668 | 2780 |
^ PackageLoadError raiseRequestWith:packageId. |
16144 | 2781 |
]. |
2782 |
^ true |
|
12250 | 2783 |
! |
2784 |
||
2785 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2786 |
"load a package from a compiled classLib. |
|
2787 |
Experimental." |
|
2788 |
||
2789 |
|p t new| |
|
2790 |
||
2791 |
(self fileIn:aFilename) ifFalse:[ |
|
18668 | 2792 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2793 |
^ false. |
|
2794 |
] |
|
12250 | 2795 |
]. |
2796 |
||
2797 |
new := (p := Project projectWithId:packageId) isNil. |
|
2798 |
new ifTrue:[ p := Project new]. |
|
2799 |
||
2800 |
p name:packageId. |
|
2801 |
p directory:aFilename directory. |
|
2802 |
p package:packageId. |
|
2803 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2804 |
p repositoryModule:(t first). |
|
2805 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2806 |
p isLoaded:true. |
|
2807 |
||
2808 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2809 |
|
12250 | 2810 |
^ true |
2811 |
! |
|
2812 |
||
12782 | 2813 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2814 |
"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
|
2815 |
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
|
2816 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2817 |
|
17324 | 2818 |
|ret| |
2819 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
2820 |
PackageLoadInProgressQuery |
18668 | 2821 |
answerNotifyLoading:aPackageString asSymbol |
2822 |
do:[ |
|
2823 |
ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
|
2824 |
]. |
|
17324 | 2825 |
^ ret |
17350 | 2826 |
|
2827 |
" |
|
2828 |
Smalltalk loadPackage:'stx:goodies/communication' |
|
2829 |
" |
|
12782 | 2830 |
! |
2831 |
||
12250 | 2832 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2833 |
<resource: #obsolete> |
12250 | 2834 |
"load a package from a loadAll - loader script. |
2835 |
Experimental." |
|
2836 |
||
2837 |
|p t new| |
|
2838 |
||
2839 |
Metaclass confirmationQuerySignal answer:false |
|
2840 |
do:[ |
|
18668 | 2841 |
(self fileIn:aFilename) ifFalse:[ |
2842 |
self warn:'Failed to load the package ', packageId printString. |
|
2843 |
^ false. |
|
2844 |
] |
|
12250 | 2845 |
]. |
2846 |
||
2847 |
new := (p := Project projectWithId:packageId) isNil. |
|
2848 |
new ifTrue:[ p := Project new]. |
|
2849 |
||
2850 |
p name:packageId. |
|
2851 |
p directory:aFilename directory. |
|
2852 |
p package:packageId. |
|
2853 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2854 |
p repositoryModule:(t first). |
|
2855 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2856 |
p isLoaded:true. |
|
2857 |
||
2858 |
new ifTrue:[Project addLoadedProject:p]. |
|
2859 |
^ true |
|
2860 |
! |
|
2861 |
||
25402
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2862 |
loadPackage:packageString fromTonelRepository: repoPath |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2863 |
"Load package from Tonel repository. Return true if |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2864 |
package was loaded, false otherwise. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2865 |
|
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2866 |
If an error occurs during loading, throw a `PackageLoadError` |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2867 |
wrapping original exception. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2868 |
" |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2869 |
repoPath notNil ifTrue: [ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2870 |
| repo version | |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2871 |
|
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2872 |
repo := TonelRepository directory: repoPath. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2873 |
[ |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2874 |
version := repo loadVersionFromFileNamed: packageString. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2875 |
version load. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2876 |
^ true |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2877 |
] on: Error do: [:ex | |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2878 |
PackageLoadError |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2879 |
raiseRequestWith: ex |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2880 |
errorString: ('Failed to load %1: %2' bindWith: packageString with: ex description). |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2881 |
^ false |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2882 |
]. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2883 |
]. |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2884 |
^ false |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2885 |
|
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2886 |
"Created: / 31-08-2020 / 16:57:58 / Jan Vrany <jan.vrany@labware.com>" |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2887 |
! |
bed2e464c354
Add support for loading packages from Tonel repositories
Jan Vrany <jan.vrany@labware.com>
parents:
25401
diff
changeset
|
2888 |
|
12250 | 2889 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
2890 |
"load a package from a .zip delivery file. |
|
2891 |
Experimental." |
|
2892 |
||
19906 | 2893 |
PackageLoadError |
2894 |
raiseWith:aPackageId |
|
2895 |
errorString:' - package loading from zip is not yet implemented'. |
|
12250 | 2896 |
! |
2897 |
||
2898 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2899 |
<resource: #obsolete> |
12250 | 2900 |
|abbrevFile packageDir| |
2901 |
||
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2902 |
packageDir := self getPackageDirectoryForPackage:aPackageId. |
12250 | 2903 |
packageDir isNil ifTrue:[^ false]. |
2904 |
||
2905 |
"/ abbrev.stc ? |
|
12377 | 2906 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2907 |
abbrevFile exists ifFalse:[^ false]. |
2908 |
||
2909 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2910 |
||
2911 |
doLoadAsAutoloaded ifFalse:[ |
|
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2912 |
"/ force autoloading... |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2913 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
12250 | 2914 |
]. |
2915 |
||
2916 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2917 |
VerboseLoading ifTrue:[ |
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2918 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 2919 |
]. |
2920 |
^ true |
|
2921 |
||
13814 | 2922 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
2923 |
"Modified: / 28-06-2016 / 07:52:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 2924 |
! ! |
2925 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2926 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2927 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2928 |
allClasses |
7563 | 2929 |
"return an unordered collection of all classes in the system. |
10071 | 2930 |
Only globally anchored classes are returned |
20122 | 2931 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances)" |
453 | 2932 |
|
2933 |
|classes| |
|
2934 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2935 |
"/ you may wonder, what this while is for, here ... |
453 | 2936 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 2937 |
"/ another view (background fileIn), while building up the |
453 | 2938 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
2939 |
"/ other process in the meanwhile. |
|
2940 |
"/ If that happens, we restart the set-building here |
|
2941 |
"/ |
|
2942 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
20122 | 2943 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
2944 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
2945 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
2946 |
"/ sigh - would like to skip over aliases |
|
2947 |
"/ but this cannot be done simply by comparing |
|
2948 |
"/ the classes name against the store-key |
|
2949 |
"/ i.e. cannot do: |
|
2950 |
"/ anObject name == sym ifTrue:[ |
|
2951 |
"/ classes add:anObject |
|
2952 |
"/ ] |
|
2953 |
"/ because that would lead to ignore all java |
|
2954 |
"/ classes, which are stored under a different |
|
2955 |
"/ key. |
|
2956 |
||
2957 |
(eachGlobal name == eachName |
|
2958 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
2959 |
classes add:eachGlobal |
|
2960 |
]. |
|
2961 |
] |
|
2962 |
]. |
|
2963 |
NumberOfClassesHint := classes size. |
|
453 | 2964 |
]. |
2965 |
^ classes |
|
2966 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2967 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2968 |
CachedClasses := nil. |
453 | 2969 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2970 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2971 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2972 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2973 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 2974 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2975 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2976 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2977 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2978 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2979 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2980 |
"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
|
2981 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2982 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2983 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2984 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2985 |
self allClassesDo:[:eachClass | |
18668 | 2986 |
classes add:(eachClass theNonMetaclass). |
2987 |
classes add:(eachClass theMetaclass). |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2988 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2989 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2990 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2991 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2992 |
allClassesWithAllPrivateClasses |
7563 | 2993 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2994 |
Only globally anchored classes are returned; Namespaces are not included. |
20122 | 2995 |
(i.e. anonymous ones have to be acquired by Behavior allSubInstances)" |
4642 | 2996 |
|
10071 | 2997 |
^ self allClasses select:[:aClass | |
20122 | 2998 |
|owner| |
2999 |
||
3000 |
(aClass isRealNameSpace not) |
|
3001 |
and:[ |
|
3002 |
owner := aClass topOwningClass. |
|
3003 |
(owner ? aClass) nameSpace == Smalltalk |
|
3004 |
] |
|
4642 | 3005 |
] |
3006 |
||
3007 |
" |
|
3008 |
Smalltalk allClassesWithAllPrivateClasses |
|
3009 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3010 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
3011 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 3012 |
! |
3013 |
||
15068 | 3014 |
allExtensions |
3015 |
"return a collection of all extension methods (methods added from another package)" |
|
3016 |
||
3017 |
|methods| |
|
3018 |
||
3019 |
methods := OrderedCollection new. |
|
3020 |
self allClassesDo:[:eachClass | |
|
18668 | 3021 |
|classPackage| |
3022 |
||
3023 |
classPackage := eachClass package. |
|
3024 |
eachClass instAndClassMethodsDo:[:mthd | |
|
3025 |
mthd package ~= classPackage ifTrue:[ methods add:mthd ]. |
|
3026 |
]. |
|
15068 | 3027 |
]. |
3028 |
^ methods |
|
3029 |
||
3030 |
" |
|
3031 |
Smalltalk allExtensions |
|
3032 |
" |
|
3033 |
! |
|
3034 |
||
11153 | 3035 |
allExtensionsForPackage:aProjectID |
14890 | 3036 |
"return a collection of all extension methods for a given projectID" |
3037 |
||
11153 | 3038 |
|methods| |
3039 |
||
3040 |
methods := OrderedCollection new. |
|
3041 |
self allClassesDo:[:eachClass | |
|
18668 | 3042 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 3043 |
]. |
3044 |
^ methods |
|
3045 |
! |
|
3046 |
||
9227 | 3047 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3048 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
3049 |
|
9227 | 3050 |
|implementors| |
3051 |
||
3052 |
implementors := OrderedCollection new. |
|
19681 | 3053 |
self allImplementorsOf:aSelector do:[:cls | implementors add:cls]. |
3054 |
^ implementors |
|
3055 |
||
3056 |
" |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3057 |
Smalltalk allImplementorsOf:#isNil |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3058 |
(Smalltalk allImplementorsOf:#add:) size |
19681 | 3059 |
" |
3060 |
||
3061 |
"Modified: / 30-04-2016 / 17:37:39 / cg" |
|
3062 |
! |
|
3063 |
||
3064 |
allImplementorsOf:aSelector do:aBlock |
|
3065 |
"enumerate all classes which implement the given selector" |
|
3066 |
||
9227 | 3067 |
self allClassesDo:[:cls | |
19681 | 3068 |
(cls includesSelector:aSelector) ifTrue:[ |
3069 |
aBlock value:cls. |
|
3070 |
]. |
|
3071 |
(cls class includesSelector:aSelector) ifTrue:[ |
|
3072 |
aBlock value:cls class. |
|
3073 |
]. |
|
3074 |
]. |
|
3075 |
||
3076 |
" |
|
3077 |
Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls] |
|
3078 |
Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls] |
|
3079 |
" |
|
3080 |
||
3081 |
"Created: / 30-04-2016 / 17:36:45 / cg" |
|
9227 | 3082 |
! |
3083 |
||
19475 | 3084 |
allLoadedPackageIDs |
3085 |
||
3086 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
3087 |
||
3088 |
||
3089 |
" |
|
3090 |
Smalltalk allLoadedPackageIDs |
|
3091 |
" |
|
3092 |
! |
|
3093 |
||
12376 | 3094 |
allLoadedProjectIDs |
19475 | 3095 |
<resource: #obsolete> |
3096 |
self obsoleteMethodWarning:'use allLoadedPackageIDs'. |
|
3097 |
^ self allPackageIdsIncludingUnloadedClasses: false |
|
12376 | 3098 |
|
3099 |
||
3100 |
" |
|
3101 |
Smalltalk allLoadedProjectIDs |
|
3102 |
" |
|
3103 |
! |
|
3104 |
||
19475 | 3105 |
allPackageIDs |
3106 |
||
3107 |
^ self allPackageIdsIncludingUnloadedClasses: true |
|
3108 |
||
3109 |
" |
|
3110 |
Smalltalk allPackageIDs |
|
3111 |
" |
|
3112 |
! |
|
3113 |
||
3114 |
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
3115 |
"Returns all package ids. |
|
3116 |
Excludes packages coming from unloaded classes if includeUnloadedClasses is false. |
|
3117 |
" |
|
3118 |
||
3119 |
|allProjects| |
|
3120 |
||
3121 |
allProjects := Set new. |
|
3122 |
self allClassesDo:[:eachClass | |
|
3123 |
|cls pkg| |
|
3124 |
||
3125 |
eachClass isRealNameSpace ifFalse:[ |
|
3126 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
|
3127 |
cls := eachClass theNonMetaclass. |
|
3128 |
cls isPrivate ifTrue:[ |
|
3129 |
cls := cls topOwningClass |
|
3130 |
]. |
|
3131 |
pkg := cls package. |
|
3132 |
pkg size > 0 ifTrue:[ |
|
3133 |
allProjects add:pkg. |
|
3134 |
] ifFalse:[ |
|
3135 |
"/ for now, nameSpaces are not in any package; |
|
3136 |
"/ this might change. Then, 0-sized packages are |
|
3137 |
"/ illegal, and the following should be enabled. |
|
3138 |
"/ self halt |
|
3139 |
]. |
|
3140 |
cls isJavaClass ifFalse:[ |
|
3141 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
|
19478 | 3142 |
| package packageAsSymbol | |
3143 |
||
3144 |
package := mthd package. |
|
3145 |
packageAsSymbol := package asSymbol. |
|
3146 |
allProjects add: packageAsSymbol |
|
19475 | 3147 |
]. |
3148 |
]. |
|
3149 |
]. |
|
3150 |
]. |
|
3151 |
]. |
|
3152 |
allProjects := allProjects asOrderedCollection sort. |
|
3153 |
^ allProjects |
|
3154 |
||
3155 |
" |
|
3156 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
|
3157 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
3158 |
" |
|
3159 |
! |
|
3160 |
||
9254 | 3161 |
allProjectIDs |
19475 | 3162 |
<resource: #obsolete> |
3163 |
self obsoleteMethodWarning:'use allPackageIDs'. |
|
3164 |
^ self allPackageIDs |
|
12376 | 3165 |
|
3166 |
" |
|
3167 |
Smalltalk allProjectIDs |
|
3168 |
" |
|
3169 |
! |
|
3170 |
||
3171 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
19475 | 3172 |
<resource: #obsolete> |
12376 | 3173 |
"Returns all projects ids. |
3174 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
3175 |
" |
|
3176 |
||
19475 | 3177 |
self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'. |
3178 |
^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
9254 | 3179 |
|
3180 |
" |
|
12376 | 3181 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
3182 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 3183 |
" |
3184 |
! |
|
3185 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3186 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3187 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3188 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3189 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3190 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3191 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3192 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3193 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3194 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3195 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3196 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3197 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3198 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3199 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3200 |
"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
|
3201 |
2 entries: 1st: the best (longest) match |
18668 | 3202 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3203 |
|
9508 | 3204 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3205 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3206 |
" |
10071 | 3207 |
Smalltalk classCategoryCompletion:'Sys' |
3208 |
Smalltalk classCategoryCompletion:'System' |
|
3209 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3210 |
" |
9508 | 3211 |
|
3212 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3213 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3214 |
|
8570 | 3215 |
classNamed:aString |
3216 |
"return the class with name aString, or nil if absent. |
|
3217 |
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
|
3218 |
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
|
3219 |
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
|
3220 |
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
|
3221 |
|
10127 | 3222 |
|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
|
3223 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3224 |
"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
|
3225 |
But be careful, to not invent new symbols ..." |
453 | 3226 |
sym := aString asSymbolIfInterned. |
3227 |
sym notNil ifTrue:[ |
|
20161 | 3228 |
cls := self at:sym ifAbsent:nil. |
3229 |
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
|
3230 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3231 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
3232 |
(aString endsWith:' class') ifTrue:[ |
20161 | 3233 |
nonMeta := self classNamed:(aString copyButLast:6). |
3234 |
nonMeta notNil ifTrue:[ |
|
3235 |
^ nonMeta theMetaclass |
|
3236 |
]. |
|
3237 |
^ nil. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3238 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3239 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3240 |
"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
|
3241 |
cls isNil ifTrue:[ |
20161 | 3242 |
idx := aString indexOfSubCollection:'::'. |
3243 |
idx ~~ 0 ifTrue:[ |
|
3244 |
prefix := aString copyTo:idx-1. |
|
3245 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
3246 |
nsNameSymbol notNil ifTrue:[ |
|
3247 |
rest := aString copyFrom:idx+2. |
|
3248 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
3249 |
"namespace may be the owner of a private class. |
|
3250 |
NameSpaces and Behaviors have the same protocol" |
|
3251 |
[namespace isBehavior] whileTrue:[ |
|
3252 |
idx := rest indexOfSubCollection:'::'. |
|
3253 |
idx ~~ 0 ifTrue:[ |
|
3254 |
prefix := rest copyTo:idx-1. |
|
3255 |
rest := rest copyFrom:idx+2. |
|
3256 |
"this does an implicit autoload if required" |
|
3257 |
namespace := namespace privateClassesAt:prefix. |
|
3258 |
] ifFalse:[ |
|
3259 |
namespace isLoaded ifTrue:[ |
|
3260 |
cls := namespace privateClassesAt:rest. |
|
3261 |
cls isBehavior ifTrue:[^ cls]. |
|
3262 |
]. |
|
3263 |
namespace := nil. "force exit of loop" |
|
3264 |
]. |
|
3265 |
]. |
|
3266 |
]. |
|
3267 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3268 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3269 |
|
453 | 3270 |
^ nil |
3271 |
||
3272 |
" |
|
10071 | 3273 |
Smalltalk classNamed:'Object' |
3274 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3275 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3276 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
3277 |
Smalltalk classNamed:'fooBar' |
|
3278 |
Smalltalk classNamed:'true' |
|
3279 |
Smalltalk classNamed:'Object class' |
|
3280 |
Smalltalk classNamed:'Metaclass' |
|
3281 |
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
|
3282 |
Smalltalk classNamed:'Array class' |
453 | 3283 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3284 |
|
9468 | 3285 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3286 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3287 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3288 |
"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
|
3289 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3290 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3291 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3292 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3293 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3294 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3295 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3296 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3297 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3298 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3299 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3300 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3301 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3302 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3303 |
2 entries: 1st: the best (longest) match |
18668 | 3304 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3305 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3306 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3307 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3308 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3309 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3310 |
"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
|
3311 |
2 entries: 1st: the best (longest) match |
18668 | 3312 |
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
|
3313 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3314 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3315 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3316 |
" |
10071 | 3317 |
Smalltalk classnameCompletion:'Arr' |
3318 |
Smalltalk classnameCompletion:'Arra' |
|
3319 |
Smalltalk classnameCompletion:'arra' |
|
3320 |
Smalltalk classnameCompletion:'*rray' |
|
3321 |
||
3322 |
Smalltalk classnameCompletion:'Arr cl' |
|
3323 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3324 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3325 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3326 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3327 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3328 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3329 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3330 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3331 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3332 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3333 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3334 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3335 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3336 |
"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
|
3337 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3338 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3339 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3340 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3341 |
"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
|
3342 |
2 entries: 1st: the best (longest) match |
18668 | 3343 |
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
|
3344 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3345 |
^ 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
|
3346 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3347 |
" |
10071 | 3348 |
Smalltalk globalnameCompletion:'Arr' |
3349 |
Smalltalk globalnameCompletion:'Arra' |
|
3350 |
Smalltalk globalnameCompletion:'arra' |
|
3351 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3352 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3353 |
|
9508 | 3354 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3355 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3356 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3357 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3358 |
globalnameCompletion:aPartialGlobalName |
7563 | 3359 |
"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
|
3360 |
2 entries: 1st: the best (longest) match |
18668 | 3361 |
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
|
3362 |
|
8358 | 3363 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3364 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3365 |
^ 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
|
3366 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3367 |
" |
10071 | 3368 |
Smalltalk globalnameCompletion:'Arr' |
3369 |
Smalltalk globalnameCompletion:'Arra' |
|
3370 |
Smalltalk globalnameCompletion:'arra' |
|
3371 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3372 |
" |
3373 |
||
9508 | 3374 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3375 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3376 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3377 |
|
13771 | 3378 |
hasClassNamed:aString |
3379 |
Symbol |
|
18668 | 3380 |
hasInterned:aString |
3381 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3382 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3383 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3384 |
"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
|
3385 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3386 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3387 |
|
9290 | 3388 |
hasNameSpaces |
3389 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3390 |
the namespace display in a browser (PocketSmalltalk)" |
|
3391 |
||
3392 |
^ true |
|
3393 |
! |
|
3394 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3395 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3396 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3397 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3398 |
|
9290 | 3399 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3400 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3401 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3402 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3403 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3404 |
"for now return false |
10999 | 3405 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3406 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3407 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3408 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3409 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3410 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3411 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3412 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3413 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3414 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3415 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3416 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3417 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3418 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3419 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3420 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3421 |
|
14987 | 3422 |
includesIdentical:something |
3423 |
"this should come from Collection. |
|
3424 |
will change the inheritance - Smalltalk is actually a collection" |
|
3425 |
||
3426 |
self do:[:element | element == something ifTrue:[^ true]]. |
|
3427 |
^ false |
|
3428 |
! |
|
3429 |
||
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3430 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3431 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3432 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3433 |
"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
|
3434 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3435 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3436 |
isNameSpace |
9227 | 3437 |
"return true, if the receiver is a nameSpace." |
3438 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3439 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3440 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3441 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3442 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3443 |
|
10169 | 3444 |
isRealNameSpace |
3445 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3446 |
||
3447 |
^ false |
|
3448 |
||
3449 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3450 |
! |
|
3451 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3452 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3453 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3454 |
! |
7563 | 3455 |
|
3456 |
isTopLevelNamespace |
|
3457 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3458 |
|
7432 | 3459 |
<resource:#obsolete> |
3460 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3461 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3462 |
^ true |
3463 |
||
3464 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3465 |
! |
|
3466 |
||
9081 | 3467 |
keyIsClassVariableNameKey:aKey |
3468 |
|i| |
|
3469 |
||
3470 |
i := aKey lastIndexOf:$:. |
|
3471 |
i ~~ 0 ifTrue:[ |
|
18668 | 3472 |
i > 1 ifTrue:[ |
3473 |
(aKey at:(i-1)) == $: ifFalse:[ |
|
3474 |
^ true. |
|
3475 |
]. |
|
3476 |
]. |
|
9081 | 3477 |
]. |
3478 |
^ false. |
|
3479 |
||
3480 |
" |
|
10071 | 3481 |
self keyIsClassVariableNameKey:'foo::bar' |
3482 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3483 |
self keyIsClassVariableNameKey:':bar' |
|
3484 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3485 |
" |
3486 |
! |
|
3487 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3488 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3489 |
"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
|
3490 |
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
|
3491 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3492 |
|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
|
3493 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3494 |
"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
|
3495 |
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
|
3496 |
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
|
3497 |
sym notNil ifTrue:[ |
18668 | 3498 |
cls := self at:sym ifAbsent:nil. |
3499 |
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
|
3500 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3501 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3502 |
(aString endsWith:' class') ifTrue:[ |
18668 | 3503 |
nonMeta := self loadedClassNamed:(aString copyButLast:6). |
3504 |
nonMeta notNil ifTrue:[ |
|
3505 |
^ nonMeta theMetaclass |
|
3506 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3507 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3508 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3509 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3510 |
" |
10071 | 3511 |
Smalltalk loadedClassNamed:'Object' |
3512 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3513 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3514 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3515 |
Smalltalk loadedClassNamed:'fooBar' |
|
3516 |
Smalltalk loadedClassNamed:'true' |
|
3517 |
Smalltalk loadedClassNamed:'Object class' |
|
3518 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3519 |
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
|
3520 |
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
|
3521 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3522 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3523 |
|
7563 | 3524 |
methodProtocolCompletion:aPartialProtocolName |
3525 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3526 |
2 entries: 1st: the best (longest) match |
18668 | 3527 |
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
|
3528 |
|
9508 | 3529 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3530 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3531 |
" |
10071 | 3532 |
Smalltalk methodProtocolCompletion:'doc' |
3533 |
Smalltalk methodProtocolCompletion:'docu' |
|
3534 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3535 |
" |
9508 | 3536 |
|
3537 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3538 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3539 |
|
7563 | 3540 |
numberOfGlobals |
3541 |
"return the number of global variables in the system" |
|
3542 |
||
3543 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3544 |
|
3545 |
tally := 0. |
|
3546 |
self do:[:obj | tally := tally + 1]. |
|
3547 |
^ tally |
|
3548 |
||
3549 |
"Smalltalk numberOfGlobals" |
|
3550 |
! |
|
3551 |
||
7563 | 3552 |
referencesAny:aCollection |
3553 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3554 |
|
3555 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3556 |
aCollection do:[:anObject | |
3557 |
(key == anObject) ifTrue:[^ true]. |
|
3558 |
(val == anObject ) ifTrue:[^ true]. |
|
3559 |
] |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3560 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3561 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3562 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3563 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3564 |
! |
3260 | 3565 |
|
7563 | 3566 |
referencesDerivedInstanceOf:aClass |
3567 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3568 |
|
3569 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3570 |
(key isKindOf:aClass) ifTrue:[^ true]. |
3571 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
617 | 3572 |
]. |
3573 |
^ super referencesDerivedInstanceOf:aClass |
|
3574 |
! |
|
3575 |
||
7563 | 3576 |
referencesInstanceOf:aClass |
3577 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3578 |
|
3579 |
self keysAndValuesDo:[:key :val | |
|
18668 | 3580 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
3581 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
617 | 3582 |
]. |
3583 |
^ super referencesInstanceOf:aClass |
|
3584 |
! |
|
3585 |
||
7563 | 3586 |
referencesObject:anObject |
3587 |
"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
|
3588 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3589 |
self keysAndValuesDo:[:key :val | |
18668 | 3590 |
(key == anObject) ifTrue:[^ true]. |
3591 |
(val == anObject ) ifTrue:[^ true]. |
|
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3592 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3593 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3594 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3595 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3596 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3597 |
|
15766 | 3598 |
resolveName:aName inClass:aClass |
7563 | 3599 |
"resolve aName as if compiled within aClass; |
3026 | 3600 |
i.e. if it has a private class with this name, return it; |
3601 |
if aName is known within the classes namespace, return that. |
|
3602 |
Otherwise, return a global with that name. |
|
3603 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3604 |
to resolve a global by name." |
|
3605 |
||
15766 | 3606 |
|nameUsed sym cls ns| |
3607 |
||
3608 |
aName isNil ifTrue:[^ nil]. |
|
3609 |
aName isBehavior ifTrue:[^ aName]. "/ already resolved |
|
3610 |
nameUsed := aName. |
|
3611 |
||
3612 |
(nameUsed startsWith:'Smalltalk::') ifTrue:[ |
|
18668 | 3613 |
nameUsed := nameUsed copyFrom:12. |
3614 |
^ self at:(nameUsed asSymbol) ifAbsent:nil. |
|
15766 | 3615 |
]. |
3616 |
||
3617 |
sym := nameUsed asSymbol. |
|
3026 | 3618 |
|
3619 |
cls := aClass privateClassesAt:sym. |
|
3620 |
cls notNil ifTrue:[^ cls]. |
|
3621 |
||
3622 |
ns := aClass nameSpace. |
|
3623 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
18668 | 3624 |
ns isNameSpace ifTrue:[ |
3625 |
cls := ns at:sym ifAbsent:nil. |
|
3626 |
] ifFalse:[ |
|
3627 |
cls := ns privateClassesAt:sym |
|
3628 |
]. |
|
3629 |
cls notNil ifTrue:[^ cls]. |
|
3025 | 3630 |
]. |
3026 | 3631 |
^ self at:sym ifAbsent:nil. |
4356 | 3632 |
|
3633 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3634 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3635 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3636 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3637 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3638 |
2 entries: 1st: the longest match |
18668 | 3639 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3640 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3641 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3642 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3643 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3644 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3645 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3646 |
2 entries: 1st: the longest match |
18668 | 3647 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3648 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3649 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3650 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3651 |
" |
10071 | 3652 |
Smalltalk selectorCompletion:'at:p' |
3653 |
Smalltalk selectorCompletion:'nextP' |
|
3654 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3655 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3656 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3657 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3658 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
19681 | 3659 |
! |
3660 |
||
23099
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3661 |
size |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3662 |
"Return the number of globals" |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3663 |
|
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3664 |
%{ /* NOCONTEXT */ |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3665 |
return ( __MKINT( __GLOBALS_SIZE() ) ); |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3666 |
%}. |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3667 |
self primitiveFailed. |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3668 |
|
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3669 |
"Created: / 03-07-2017 / 21:47:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3670 |
! |
0cdcdf123327
Reintroduced `Smalltalk class>>size`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23098
diff
changeset
|
3671 |
|
19681 | 3672 |
someImplementorOf:aSelector |
3673 |
"return any class, which implement the given selector. Nil if there is none. |
|
3674 |
(useful to search, if there is one at all)" |
|
3675 |
||
3676 |
self allImplementorsOf:aSelector do:[:cls | ^ cls]. |
|
3677 |
^ nil. |
|
3678 |
||
3679 |
" |
|
3680 |
Smalltalk someImplementorOf:#isNil |
|
3681 |
Smalltalk someImplementorOf:#add: |
|
3682 |
" |
|
3683 |
||
3684 |
"Created: / 30-04-2016 / 17:39:19 / cg" |
|
453 | 3685 |
! ! |
3686 |
||
4431 | 3687 |
!Smalltalk class methodsFor:'queries-system'! |
3688 |
||
15958 | 3689 |
isAmber |
15980 | 3690 |
"is this an Amber Smalltalk system ? |
3691 |
Return false here - this may be useful to write portable |
|
15958 | 3692 |
applications - add #isAmber to your Amber Smalltalk, |
3693 |
returning true there." |
|
3694 |
||
3695 |
^ false |
|
3696 |
||
3697 |
"Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3698 |
! |
|
3699 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3700 |
isDolphinSmalltalk |
16803 | 3701 |
"is this a Dolphin Smalltalk system ? |
15980 | 3702 |
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
|
3703 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3704 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3705 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3706 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3707 |
! |
4970 | 3708 |
|
15958 | 3709 |
isGemStone |
15980 | 3710 |
"is this a GemStone Smalltalk system ? |
3711 |
Return false here - this may be useful to write portable |
|
15958 | 3712 |
applications - add #isGemStone to your GemStone/S, |
3713 |
returning true there." |
|
3714 |
||
3715 |
^ false |
|
3716 |
||
3717 |
"Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3718 |
! |
|
3719 |
||
3720 |
isPharo |
|
15980 | 3721 |
"is this a Pharo Smalltalk system ? |
3722 |
Return false here - this may be useful to write portable |
|
15958 | 3723 |
applications - add #isPharo to your Pharo, |
3724 |
returning true there." |
|
3725 |
||
3726 |
^ false |
|
3727 |
||
3728 |
"Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3729 |
! |
|
3730 |
||
7563 | 3731 |
isSmalltalkMT |
15980 | 3732 |
"is this a Smalltalk-MT system ? |
3733 |
Return false here - this may be useful to write portable |
|
7563 | 3734 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
4970 | 3735 |
returning true there." |
3736 |
||
3737 |
^ false |
|
3738 |
! |
|
3739 |
||
7563 | 3740 |
isSmalltalkV |
15980 | 3741 |
"is this a Smalltalk/V system ? |
3742 |
Return false here - this may be useful to write portable |
|
7563 | 3743 |
applications - add #isSmalltalkV to your smalltalkV, |
4431 | 3744 |
returning true there." |
3745 |
||
3746 |
^ false |
|
3747 |
! |
|
3748 |
||
7563 | 3749 |
isSmalltalkX |
16803 | 3750 |
"is this a Smalltalk/X system ? |
15980 | 3751 |
Return true here - this may be useful to write portable |
7563 | 3752 |
applications - add #isSmalltalkX to your other smalltalks, |
4431 | 3753 |
returning false there." |
3754 |
||
3755 |
^ true |
|
3756 |
! |
|
3757 |
||
7563 | 3758 |
isSqueak |
15980 | 3759 |
"is this a SqueakSmalltalk system ? |
3760 |
Return false here - this may be useful to write portable |
|
7563 | 3761 |
applications - add #isSqueak to your squeak, |
4431 | 3762 |
returning true there." |
3763 |
||
3764 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3765 |
! |
4431 | 3766 |
|
16013 | 3767 |
isSqueakLike |
3768 |
"is this a Squeak, Pharo, Cuis or similar Smalltalk system ? |
|
3769 |
Return false here - this may be useful to write portable |
|
3770 |
applications - add #isSqueakLike to your squeak, pharo,... |
|
3771 |
returning true there." |
|
3772 |
||
3773 |
^ false |
|
3774 |
! |
|
3775 |
||
7563 | 3776 |
isVisualAge |
15980 | 3777 |
"is this a VisualAge Smalltalk system ? |
3778 |
Return false here - this may be useful to write portable |
|
7563 | 3779 |
applications - add #isVisualAge to your visualAge, |
4431 | 3780 |
returning true there." |
3781 |
||
3782 |
^ false |
|
3783 |
! |
|
3784 |
||
17369 | 3785 |
isVisualSmalltalkEnterprise |
16843 | 3786 |
"is this a VSE Smalltalk system ? |
3787 |
Return false here - this may be useful to write portable |
|
3788 |
applications - add #isVisualSmallalkEnterprise to your VSE, |
|
3789 |
returning true there." |
|
3790 |
||
3791 |
^ false |
|
3792 |
! |
|
3793 |
||
7563 | 3794 |
isVisualWorks |
15980 | 3795 |
"is this a VisualWorks Smalltalk system ? |
3796 |
Return false here - this may be useful to write portable |
|
7563 | 3797 |
applications - add #isVisualWorks to your visualWorks, |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3798 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3799 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3800 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3801 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3802 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3803 |
!Smalltalk class methodsFor:'startup'! |
1 | 3804 |
|
9032 | 3805 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3806 |
"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
|
3807 |
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
|
3808 |
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
|
3809 |
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
|
3810 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3811 |
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
|
3812 |
|
9032 | 3813 |
|windowIDString numericWindowID windowID params idx process| |
3814 |
||
3815 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3816 |
windowIDString := CommandLineArguments at:idx+1. |
|
3817 |
numericWindowID := Integer fromString:windowIDString. |
|
3818 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3819 |
||
3820 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3821 |
idx ~~ 0 ifTrue:[ |
|
18668 | 3822 |
params := Dictionary new. |
3823 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
|
3824 |
params at:key put:value. |
|
3825 |
]. |
|
9032 | 3826 |
]. |
3827 |
||
3828 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3829 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3830 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3831 |
||
3832 |
process := [ |
|
18668 | 3833 |
PluginSupport |
3834 |
startInBrowserWithWindowID:windowID |
|
3835 |
parameters:params. |
|
9032 | 3836 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3837 |
process priority:(Processor userSchedulingPriority). |
9032 | 3838 |
process name:'browser start handler'. |
3839 |
process beGroupLeader. |
|
3840 |
process resume. |
|
3841 |
process := nil. |
|
3842 |
||
3843 |
Processor dispatchLoop. |
|
3844 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3845 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3846 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3847 |
! |
3848 |
||
20856 | 3849 |
defineCommandLineAsWorkspaceVariablesForScripts |
3850 |
"/ enable this, so we can provide _$1.._$n in the script |
|
20858 | 3851 |
ParserFlags allowUnderscoreInIdentifier:true. |
20856 | 3852 |
ParserFlags allowDollarInIdentifier:true. |
3853 |
ParserFlags warnDollarInIdentifier:false. |
|
20858 | 3854 |
ParserFlags warnUnderscoreInIdentifier:false. |
20859 | 3855 |
ParserFlags allowOldStyleAssignment:false. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3856 |
|
20856 | 3857 |
"/ add bindings for arguments |
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3858 |
Workspace notNil ifTrue:[ |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3859 |
Workspace workspaceVariableAt:('_$0') put:CommandName. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3860 |
Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3861 |
Workspace workspaceVariableAt:('_$$') put:CommandLineArguments. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3862 |
CommandLineArguments doWithIndex:[:arg :i | |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3863 |
Workspace workspaceVariableAt:('_$',i printString) put:arg. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3864 |
]. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
3865 |
]. |
20856 | 3866 |
! |
3867 |
||
7563 | 3868 |
displayInitializationDone |
3869 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3870 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3871 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3872 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3873 |
|
13893 | 3874 |
executeStartBlocks |
3875 |
|startBlocks| |
|
3876 |
||
3877 |
startBlocks := self startBlocks. |
|
3878 |
startBlocks notNil ifTrue:[ |
|
21290
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3879 |
Logger info: 'Executing start blocks'. |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3880 |
startBlocks copy do:[:aBlock| |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3881 |
startBlocks remove: aBlock. |
21290
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3882 |
aBlock on: Error do:[:ex | |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3883 |
Logger error: 'Error when executing start block: %1' with: ex description. |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3884 |
InfoPrinting == true ifTrue:[ |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3885 |
ex description infoPrintCR. |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3886 |
ex infoPrintCR. |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3887 |
thisContext fullPrintAll. |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3888 |
]. |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3889 |
] |
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3890 |
]. |
13893 | 3891 |
]. |
3892 |
||
3893 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
21290
1e7175049bbc
Cleanuo in `Smalltalk >> #executeStartBlocks`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
21249
diff
changeset
|
3894 |
"Modified: / 18-01-2017 / 22:45:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13893 | 3895 |
! |
3896 |
||
11375 | 3897 |
hideSplashWindow |
3898 |
%{ |
|
3899 |
#ifdef WIN32 |
|
3900 |
extern void __win32_hideSplashScreen(); |
|
3901 |
||
3902 |
__win32_hideSplashScreen(); |
|
3903 |
#endif |
|
3904 |
%} |
|
3905 |
! |
|
3906 |
||
20720 | 3907 |
lateOpenDisplay |
20737 | 3908 |
"this is called when a view is opened without a display being already opened." |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3909 |
|
20720 | 3910 |
Smalltalk openDisplay. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3911 |
Display notNil ifTrue:[ |
20831 | 3912 |
IsRepl ifFalse:[ |
3913 |
Display exitOnLastClose:true. |
|
3914 |
]. |
|
20827 | 3915 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
3916 |
]. |
20720 | 3917 |
! |
3918 |
||
7563 | 3919 |
mainStartup:graphicalMode |
3920 |
"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
|
3921 |
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
|
3922 |
|
9012 | 3923 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3924 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3925 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3926 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3927 |
|
19788 | 3928 |
true "graphicalMode" ifTrue:[ |
3929 |
Display isNil ifTrue:[ |
|
3930 |
(StartupClass notNil |
|
3931 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3932 |
self openDisplay. |
|
3933 |
]. |
|
3934 |
]. |
|
10644 | 3935 |
]. |
3936 |
||
10645 | 3937 |
StandAlone ifFalse:[ |
19788 | 3938 |
" |
3939 |
enable the graphical debugger/inspector |
|
3940 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3941 |
" |
|
3942 |
self initStandardTools. |
|
10645 | 3943 |
]. |
3944 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3945 |
" |
10071 | 3946 |
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
|
3947 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3948 |
Display notNil ifTrue:[ |
19788 | 3949 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
3950 |
SaveEmergencyImage == true ifTrue:[ |
|
3951 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
3952 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
3953 |
]. |
|
3954 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
3955 |
self exit:11. |
|
3956 |
]. |
|
3957 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3958 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3959 |
|
9016 | 3960 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 3961 |
IsPlugin := (idx ~~ 0). |
3962 |
IsPlugin ifTrue:[ |
|
19788 | 3963 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
3964 |
self browserWindowStartup. |
|
3965 |
"/ not reached |
|
9012 | 3966 |
]. |
3967 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3968 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3969 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3970 |
"/ 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
|
3971 |
"/ 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
|
3972 |
"/ 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
|
3973 |
"/ 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
|
3974 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3975 |
process := [ |
19788 | 3976 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
3977 |
StartBlocks notNil ifTrue:[ |
|
3978 |
self executeStartBlocks. |
|
3979 |
StartBlocks := nil. |
|
3980 |
]. |
|
3981 |
ImageStartBlocks notNil ifTrue:[ |
|
3982 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
|
3983 |
ImageStartBlocks do:[:aBlock| |
|
3984 |
aBlock value |
|
3985 |
]. |
|
3986 |
]. |
|
3987 |
StandAlone ifFalse:[ |
|
3988 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
3989 |
thisIsARestart ifTrue:[ |
|
3990 |
Transcript cr. |
|
3991 |
Transcript showCR:('Smalltalk restarted from:' |
|
3992 |
, imageName |
|
3993 |
, ' (saved ' |
|
3994 |
, ObjectMemory imageSaveTime printString |
|
3995 |
, ')' ). |
|
3996 |
] ifFalse:[ |
|
3997 |
Transcript showCR:(self hello). |
|
3998 |
Transcript showCR:(self copyrightString). |
|
3999 |
]. |
|
4000 |
Transcript cr. |
|
4001 |
]. |
|
4002 |
||
4003 |
DemoMode==true ifTrue:[ |
|
4004 |
Transcript showCR:'*** Restricted use: ***'. |
|
4005 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
4006 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
4007 |
Transcript showCR:'*** for more details. ***'. |
|
4008 |
Transcript cr. |
|
4009 |
]. |
|
4010 |
]. |
|
4011 |
||
4012 |
thisIsARestart ifTrue:[ |
|
4013 |
"/ |
|
4014 |
"/ the final late notification - users can now assume that |
|
4015 |
"/ views, forms etc. have been recreated. |
|
4016 |
||
4017 |
ObjectMemory changed:#returnFromSnapshot. |
|
4018 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
4019 |
|
7040 | 4020 |
] newProcess. |
4021 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
4022 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4023 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4024 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4025 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
4026 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4027 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4028 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
4029 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
4030 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4031 |
"/ start a process, which evaluates the startupClass>>startupSelector |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4032 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4033 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4034 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
19788 | 4035 |
" |
4036 |
allow more customization by reading an image specific rc-file |
|
4037 |
" |
|
4038 |
thisIsARestart ifTrue:[ |
|
4039 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
4040 |
imageName := imageName copyButLast:4 |
|
4041 |
]. |
|
4042 |
self fileIn:(imageName , '.rc') |
|
4043 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4044 |
|
20746 | 4045 |
Display notNil ifTrue:[ |
4046 |
Display exitOnLastClose:true. |
|
4047 |
]. |
|
4048 |
Processor exitWhenNoMoreUserProcesses:true. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4049 |
|
19788 | 4050 |
process := [ |
4051 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
4052 |
StandAlone ifTrue:[ |
|
4053 |
AbortOperationRequest handle:[:ex | |
|
4054 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
4055 |
OperatingSystem exit:1 |
|
4056 |
] do:[ |
|
4057 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
4058 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4059 |
] |
|
4060 |
] ifFalse:[ |
|
4061 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
4062 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
4063 |
]. |
|
4064 |
||
4065 |
"/ |
|
4066 |
"/ non-GUI apps exit after the startup; |
|
4067 |
"/ assume that GUI apps have created & opened some view ... |
|
4068 |
"/ |
|
4069 |
Display isNil ifTrue:[ |
|
4070 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
4071 |
Smalltalk exit:11. |
|
4072 |
]. |
|
16666 | 4073 |
"/ "/ |
4074 |
"/ "/ GUI apps exit after the last user process has finished |
|
4075 |
"/ "/ |
|
4076 |
"/ Display exitOnLastClose:true. |
|
20746 | 4077 |
Processor exitWhenNoMoreUserProcesses:true. |
19788 | 4078 |
] newProcess. |
4079 |
process priority:(Processor userSchedulingPriority). |
|
4080 |
process name:'main'. |
|
4081 |
process beGroupLeader. |
|
4082 |
process resume. |
|
4083 |
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
|
4084 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4085 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4086 |
StandAlone ifTrue:[ |
19788 | 4087 |
Display notNil ifTrue:[ |
4088 |
FlyByHelp notNil ifTrue:[ |
|
4089 |
FlyByHelp start |
|
4090 |
]. |
|
4091 |
]. |
|
16211 | 4092 |
]. |
4093 |
||
20746 | 4094 |
"/ Display notNil ifTrue:[ |
4095 |
"/ Display exitOnLastClose:true. |
|
4096 |
"/ ]. |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4097 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4098 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4099 |
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
|
4100 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4101 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4102 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
4103 |
or:[HeadlessOperation |
20827 | 4104 |
or:[StandAlone]]] |
4105 |
) ifTrue:[ |
|
19788 | 4106 |
Processor exitWhenNoMoreUserProcesses:true. |
4107 |
Processor dispatchLoop. |
|
4108 |
"done - the last process finished" |
|
4109 |
'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
|
4110 |
] ifFalse:[ |
19788 | 4111 |
StandAlone ifFalse:[ |
20832 | 4112 |
self readEvalPrintLoop |
19788 | 4113 |
] |
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4114 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4115 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4116 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
4117 |
|
13526 | 4118 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
4119 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
13893 | 4120 |
"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
|
4121 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4122 |
|
10641 | 4123 |
openDisplay |
4124 |
"try to open a display connection. |
|
4125 |
If so, also read display- and keyboard.rc" |
|
4126 |
||
13385 | 4127 |
|commandName| |
4128 |
||
4129 |
commandName := Smalltalk commandName. |
|
4130 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 4131 |
|
10641 | 4132 |
Display isNil ifTrue:[ |
18668 | 4133 |
Screen notNil ifTrue:[ |
4134 |
[ |
|
4135 |
Screen openDefaultDisplay:nil. |
|
4136 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
19984 | 4137 |
"do not use #errorPrintCR, it is no error, when an app supports display and no display. |
4138 |
in case shell exec 'app --version' we do not want this error string as part of the output" |
|
4139 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR. |
|
4140 |
"/ ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
|
18668 | 4141 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
4142 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
4143 |
HeadlessOperation == true ifFalse:[ |
|
4144 |
OperatingSystem exit:1. |
|
4145 |
]. |
|
4146 |
]. |
|
4147 |
||
4148 |
Display notNil ifTrue:[ |
|
4149 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
4150 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
4151 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
4152 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
4153 |
] |
|
4154 |
] |
|
4155 |
]. |
|
4156 |
] |
|
10641 | 4157 |
] |
4158 |
||
4159 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
4160 |
! |
|
4161 |
||
20757 | 4162 |
providingDisplayDo:aBlock |
4163 |
"/ provide a Display, if needed |
|
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4164 |
(Smalltalk at:#Screen) notNil ifTrue:[ |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4165 |
(Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex | |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4166 |
Display isNil ifTrue:[ self lateOpenDisplay ]. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4167 |
ex proceedWith:Display. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4168 |
] do:aBlock |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4169 |
] ifFalse:[ |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4170 |
aBlock value |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
4171 |
] |
20757 | 4172 |
! |
4173 |
||
20832 | 4174 |
readEvalPrintLoop |
4175 |
"say hello, then go into a read-eval-print loop" |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4176 |
|
10641 | 4177 |
"{ Pragma: +optSpace }" |
4178 |
||
16090 | 4179 |
Transcript showCR:(self hello). |
4180 |
Transcript showCR:(self copyrightString). |
|
4181 |
Transcript cr. |
|
4182 |
Transcript showCR:'Read-eval-print loop; exit with "#exit"; help with "?"'. |
|
4183 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
4184 |
ReadEvalPrintLoop new |
20832 | 4185 |
prompt:'ST> '; |
4186 |
doChunkFormat:false; |
|
4187 |
error:Stderr; |
|
4188 |
readEvalPrintLoop |
|
10641 | 4189 |
|
4190 |
"Modified: / 07-12-2006 / 17:35:19 / cg" |
|
4191 |
! |
|
4192 |
||
4193 |
restart |
|
4194 |
"startup after an image has been loaded; |
|
18385 | 4195 |
This is called by the VM's main entry - you should not find senders from Smalltalk. |
4196 |
||
10641 | 4197 |
there are three change-notifications made to dependents of ObjectMemory, |
4198 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
4199 |
||
4200 |
#earlySystemInstallation is sent for ST80 compatibility |
|
4201 |
||
4202 |
#earlyRestart is send first, nothing has been setup yet. |
|
18668 | 4203 |
(should be used to flush all device dependent entries) |
10641 | 4204 |
|
4205 |
#restarted is send right after. |
|
18668 | 4206 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 4207 |
|
4208 |
#returnFromSnapshot is sent last |
|
18668 | 4209 |
(should be used to restart processes, reOpen Streams which cannot |
4210 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
4211 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 4212 |
" |
4213 |
||
4214 |
|deb insp transcript idx| |
|
4215 |
||
4216 |
"/ |
|
4217 |
"/ when we arrive here, all objects from our previous life |
|
4218 |
"/ have been reloaded - however, some may still contain invalid device |
|
4219 |
"/ handles, display information etc. |
|
4220 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
4221 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
4222 |
"/ the previous classes. |
|
4223 |
||
4224 |
Initializing := true. |
|
4225 |
AbstractOperatingSystem initializeConcreteClass. |
|
4226 |
||
4227 |
ImageRestartTime := Timestamp now. |
|
4228 |
||
4229 |
CommandLine := CommandLineArguments copy. |
|
4230 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
4231 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
4232 |
||
4233 |
idx := CommandLineArguments indexOf:'-q'. |
|
4234 |
idx == 0 ifTrue:[ |
|
18668 | 4235 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 4236 |
]. |
4237 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4238 |
Object infoPrinting:false. |
4239 |
ObjectMemory infoPrinting:false. |
|
4240 |
CommandLineArguments removeAtIndex:idx. |
|
16269 | 4241 |
]. |
4242 |
||
10641 | 4243 |
"/ start catching SIGSEGV and SIGBUS |
4244 |
OperatingSystem enableHardSignalInterrupts. |
|
4245 |
||
4246 |
"/ reinit Filename |
|
4247 |
Filename reinitialize. |
|
4248 |
||
4249 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
4250 |
self flushPathCaches. |
|
15334 | 4251 |
self reinitializePackagePath. |
10641 | 4252 |
|
4253 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
4254 |
"/ after that, we can write to stderr. |
|
4255 |
self reinitStandardStreams. |
|
4256 |
||
4257 |
"/ redirect Transcript to Stderr during startup |
|
4258 |
transcript := Transcript. |
|
4259 |
Transcript := Stderr. |
|
4260 |
||
4261 |
"/ temporary switch back to dumb interface - |
|
4262 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
4263 |
insp := Inspector. |
|
4264 |
deb := Debugger. |
|
4265 |
deb notNil ifTrue:[ |
|
18668 | 4266 |
deb reinitialize |
10641 | 4267 |
]. |
4268 |
Inspector := MiniInspector. |
|
4269 |
Debugger := MiniDebugger. |
|
4270 |
||
4271 |
"/ reload any dynamically loaded objects. |
|
4272 |
"/ this must be done before doing anything else below, |
|
4273 |
"/ because the Processor may restart processes which use |
|
4274 |
"/ this code. |
|
4275 |
"/ Also, a dynamic object might be registered as dependent of |
|
4276 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
4277 |
||
4278 |
ObjectFileLoader notNil ifTrue:[ |
|
18668 | 4279 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
16269 | 4280 |
]. |
4281 |
||
10641 | 4282 |
"/ invalidate all display connections. |
4283 |
"/ This is required to avoid trouble if someone accesses |
|
4284 |
"/ a display during early startup. |
|
4285 |
Screen notNil ifTrue:[ |
|
18668 | 4286 |
Screen allScreens do:[:eachDisplay | |
4287 |
eachDisplay invalidateConnection. |
|
4288 |
]. |
|
10641 | 4289 |
]. |
4290 |
||
4291 |
ObjectMemory changed:#earlySystemInstallation. |
|
4292 |
||
4293 |
"/ reinitialize the Processor - restartable processes |
|
4294 |
"/ are now restarted here (but not yet scheduled). |
|
4295 |
Processor reinitialize. |
|
4296 |
||
4297 |
"/ flush device handles & recreate OS resources (if possible) |
|
4298 |
"/ (mostly view/GC/color & font stuff) |
|
4299 |
ObjectMemory |
|
18668 | 4300 |
changed:#earlyRestart; changed:#restarted. |
16269 | 4301 |
|
10641 | 4302 |
"/ start catching SIGINT and SIGQUIT |
4303 |
OperatingSystem enableUserInterrupts. |
|
4304 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 4305 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 4306 |
|
4307 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
4308 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
4309 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
4310 |
idx == 0 ifTrue:[ |
|
18668 | 4311 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 4312 |
]. |
4313 |
idx ~~ 0 ifTrue:[ |
|
18668 | 4314 |
CommandLineArguments removeAtIndex:idx. |
10641 | 4315 |
] ifFalse:[ |
18668 | 4316 |
CallbackSignal := QuerySignal new. |
4317 |
[ |
|
4318 |
Class withoutUpdatingChangesDo:[ |
|
4319 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
4320 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
4321 |
self fileIn:'smalltalk_r.rc' |
|
4322 |
]. |
|
4323 |
] |
|
4324 |
] on:CallbackSignal do:[:ex| |
|
4325 |
"/ now, display and view-stuff works; |
|
4326 |
"/ back to the previous debugging interface |
|
4327 |
Inspector := insp. |
|
4328 |
Debugger := deb. |
|
4329 |
||
4330 |
"/ reinstall Transcript, if not changed during restart. |
|
4331 |
"/ if there was no Transcript, go to stderr |
|
4332 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4333 |
Transcript := transcript. |
|
4334 |
]. |
|
4335 |
Initializing := false. |
|
4336 |
ex proceed. |
|
4337 |
]. |
|
4338 |
CallbackSignal := nil. |
|
10641 | 4339 |
]. |
4340 |
||
4341 |
"/ reinitialization (restart) of Display is normally performed |
|
4342 |
"/ in the restart script. If this has not been run for some reason, |
|
4343 |
"/ do in now. |
|
4344 |
Initializing ifTrue:[ |
|
18668 | 4345 |
Display notNil ifTrue:[ |
4346 |
[ |
|
4347 |
Display reinitializeFor:Screen defaultDisplayName. |
|
4348 |
] on:Screen deviceOpenErrorSignal do:[ |
|
4349 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
4350 |
Screen defaultDisplayName errorPrintCR. |
|
4351 |
OperatingSystem exit:1. |
|
4352 |
]. |
|
4353 |
]. |
|
4354 |
"/ now, display and view-stuff works; |
|
4355 |
"/ back to the previous debugging interface |
|
4356 |
||
4357 |
Inspector := insp. |
|
4358 |
Debugger := deb. |
|
4359 |
||
4360 |
"/ reinstall Transcript, if not changed during restart. |
|
4361 |
"/ if there was no Transcript, go to stderr |
|
4362 |
||
4363 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
4364 |
Transcript := transcript. |
|
4365 |
]. |
|
4366 |
Initializing := false. |
|
10641 | 4367 |
]. |
4368 |
Screen notNil ifTrue:[ |
|
18668 | 4369 |
"clean up leftover screens (and views) that haven't been reopened. |
4370 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
4371 |
Screen allScreens copy do:[:eachDisplay | |
|
4372 |
eachDisplay isOpen ifFalse:[ |
|
4373 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
4374 |
eachDisplay errorPrintCR. |
|
4375 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
4376 |
] |
|
4377 |
]. |
|
10641 | 4378 |
]. |
4379 |
||
4380 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 4381 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
18668 | 4382 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4383 |
]. |
10641 | 4384 |
self mainStartup:true |
4385 |
||
13526 | 4386 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
4387 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 4388 |
! |
4389 |
||
11399 | 4390 |
showSplashMessage:aString |
4391 |
"put the message into the splash screen (if there is one). |
|
4392 |
Use this for messages during startup" |
|
4393 |
||
4394 |
self showSplashMessage:aString color:nil. |
|
4395 |
! |
|
4396 |
||
11388 | 4397 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 4398 |
"put the message into the splash screen (if there is one)." |
4399 |
||
11388 | 4400 |
%{ |
4401 |
#ifdef WIN32 |
|
4402 |
extern void __win32_splashMessage(); |
|
4403 |
char *msg = (char *)0; |
|
4404 |
int clr = 0; |
|
4405 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4406 |
if (__isStringLike(aMessageStringOrNil)) { |
18668 | 4407 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4408 |
} |
4409 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
18668 | 4410 |
clr = __intVal(rgbValueOrNil); |
4411 |
__win32_splashMessageColor(clr); |
|
11388 | 4412 |
} |
4413 |
__win32_splashMessage(msg); |
|
4414 |
#endif |
|
4415 |
%} |
|
4416 |
! |
|
4417 |
||
4418 |
splashInfo:aString |
|
11389 | 4419 |
"like infoPrintCR, |
4420 |
but in addition put the message into the splash screen (if there is one). |
|
4421 |
Use this for info messages during startup" |
|
4422 |
||
12883 | 4423 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4424 |
self showSplashMessage:aString color:nil. |
4425 |
! |
|
4426 |
||
7563 | 4427 |
start |
20831 | 4428 |
"low level entry from the VM's main. |
4429 |
After initializeSystem, this is the very first real entry into the Smalltalk world. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4430 |
Analyzes the command line and checks what to do |
20831 | 4431 |
(i.e. script/repl/eval or full blown IDE). |
4432 |
Also handles --load and various debug options. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4433 |
Caveat: |
21020 | 4434 |
this has become too complicated and desperately needs a rewrite. |
4435 |
||
4436 |
Also: |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4437 |
Be very careful when changing things here; |
21020 | 4438 |
especially be careful to ensure that the scripting options are robust against any |
4439 |
missing packages; so the error handlers should not depend on any stream, logger etc. features. |
|
4440 |
" |
|
617 | 4441 |
|
15872 | 4442 |
|idx graphicalMode arg didReadRCFile keepSplashWindow| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4443 |
|
19597 | 4444 |
graphicalMode := Smalltalk isSmalltalkDevelopmentSystem. |
617 | 4445 |
Initializing := true. |
4446 |
||
15872 | 4447 |
keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]. |
13526 | 4448 |
|
21016 | 4449 |
idx := CommandLineArguments indexOf:'--debug'. |
4450 |
(idx ~~ 0) ifTrue:[ |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4451 |
CommandLineArguments removeAtIndex:idx. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4452 |
]. |
21016 | 4453 |
|
617 | 4454 |
" |
4455 |
while reading patches- and rc-file, do not add things into change-file |
|
4456 |
" |
|
4457 |
Class withoutUpdatingChangesDo:[ |
|
20714 | 4458 |
|commandFiles rcFile defaultRC prevCatchSetting |
20715 | 4459 |
isEval isPrint isFilter isRepl isRunMain idxFileArg process| |
4460 |
||
4461 |
isEval := isPrint := isFilter := isRepl := isRunMain := false. |
|
18669 | 4462 |
didReadRCFile := false. |
4463 |
||
4464 |
StandAlone ifFalse:[ |
|
21021 | 4465 |
"/ self initializeVerboseFlags. |
20878 | 4466 |
|
18669 | 4467 |
"/ |
4468 |
"/ look for any '-q', '-e', '-l' or '-f' command line arguments |
|
4469 |
"/ and handle them; |
|
4470 |
"/ read startup and patches file |
|
4471 |
"/ |
|
4472 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
20831 | 4473 |
isRepl := IsRepl := (idx ~~ 0). |
18669 | 4474 |
|
4475 |
idx := CommandLineArguments indexOfAny:#('-q' '--silent'). |
|
4476 |
idx ~~ 0 ifTrue:[ |
|
4477 |
Object infoPrinting:false. |
|
4478 |
ObjectMemory infoPrinting:false. |
|
4479 |
CommandLineArguments removeAtIndex:idx. |
|
4480 |
SilentLoading := true. |
|
4481 |
]. |
|
4482 |
||
4483 |
[ |
|
25403
52e52279a507
Handle `--package-path` option in `Smalltalk >> #start`
Jan Vrany <jan.vrany@labware.com>
parents:
25402
diff
changeset
|
4484 |
idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath' '--package-path'). |
18669 | 4485 |
idx ~~ 0 |
4486 |
] whileTrue:[ |
|
4487 |
arg := CommandLineArguments at:idx + 1. |
|
4488 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
25403
52e52279a507
Handle `--package-path` option in `Smalltalk >> #start`
Jan Vrany <jan.vrany@labware.com>
parents:
25402
diff
changeset
|
4489 |
(arg asCollectionOfSubstringsSeparatedByAny:',;:') do:[:each | |
52e52279a507
Handle `--package-path` option in `Smalltalk >> #start`
Jan Vrany <jan.vrany@labware.com>
parents:
25402
diff
changeset
|
4490 |
self packagePath addFirst:each. |
20880 | 4491 |
VerboseStartup ifTrue:[ |
20853 | 4492 |
('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR. |
4493 |
]. |
|
18669 | 4494 |
]. |
4495 |
]. |
|
4496 |
||
4497 |
[ |
|
4498 |
idx := CommandLineArguments indexOfAny:#('-l' '--load'). |
|
4499 |
idx ~~ 0 |
|
4500 |
] whileTrue:[ |
|
4501 |
arg := CommandLineArguments at:idx + 1. |
|
4502 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
20719 | 4503 |
Smalltalk silentlyLoadingDo:[ |
20853 | 4504 |
(arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each | |
4505 |
each asFilename exists ifTrue:[ |
|
20880 | 4506 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
20853 | 4507 |
('Smalltalk [info]: loading file: "', each, '".') infoPrintCR. |
4508 |
]. |
|
4509 |
Smalltalk fileIn:each |
|
4510 |
] ifFalse:[ |
|
20880 | 4511 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
20853 | 4512 |
('Smalltalk [info]: loading package: "', each, '".') infoPrintCR. |
4513 |
]. |
|
4514 |
Smalltalk loadPackage:each |
|
4515 |
]. |
|
20719 | 4516 |
]. |
18669 | 4517 |
]. |
4518 |
]. |
|
4519 |
||
20715 | 4520 |
"/ look for a '-e filename' or '--execute filename' or '--script filename' argument |
18669 | 4521 |
"/ this will force fileIn of filename only, no standard startup. |
4522 |
||
4523 |
idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script'). |
|
4524 |
idx ~~ 0 ifTrue:[ |
|
4525 |
SilentLoading := true. |
|
4526 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4527 |
||
4528 |
CommandLineArguments |
|
4529 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4530 |
||
4531 |
self startSchedulerAndBackgroundCollector. |
|
4532 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4533 |
Initializing := false. |
|
4534 |
||
4535 |
process := [ |
|
20867 | 4536 |
Processor exitWhenNoMoreUserProcesses:true. |
4537 |
||
20856 | 4538 |
"/ set workspace variables |
4539 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4540 |
|
20757 | 4541 |
"/ provide a Display, if needed |
4542 |
self providingDisplayDo:[ |
|
20880 | 4543 |
VerboseStartup ifTrue:[ |
20757 | 4544 |
('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR. |
4545 |
]. |
|
20854 | 4546 |
NoHandlerError handle:[:ex | |
21018 | 4547 |
Debugging == true ifTrue:[ |
21019 | 4548 |
MiniDebugger enterException:ex. |
21018 | 4549 |
] ifFalse:[ |
21020 | 4550 |
Silent ifFalse:[ |
4551 |
'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR. |
|
4552 |
]. |
|
20854 | 4553 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
4554 |
ex suspendedContext fullPrintAll. |
|
4555 |
]. |
|
20880 | 4556 |
self exit:1. |
20854 | 4557 |
]. |
20880 | 4558 |
self exit:1. |
4559 |
"/ ex reject. |
|
20757 | 4560 |
] do:[ |
20854 | 4561 |
UserInterrupt handle:[:ex | |
4562 |
Debugging == true ifTrue:[ |
|
4563 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4564 |
"/ thisContext fullPrintAll. |
|
21019 | 4565 |
MiniDebugger enterException:ex. |
20854 | 4566 |
ex proceed. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4567 |
]. |
21020 | 4568 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
20854 | 4569 |
self exit:128+(OperatingSystem sigINT). |
4570 |
] do:[ |
|
4571 |
arg = '-' ifTrue:[ |
|
4572 |
self fileInStream:Stdin |
|
4573 |
lazy:nil |
|
4574 |
silent:nil |
|
4575 |
logged:false |
|
4576 |
addPath:nil |
|
4577 |
] ifFalse:[ |
|
4578 |
IsSTScript := true. |
|
4579 |
Smalltalk silentlyLoadingDo:[ |
|
4580 |
self fileIn:arg. |
|
4581 |
]. |
|
20757 | 4582 |
]. |
20719 | 4583 |
]. |
18669 | 4584 |
]. |
4585 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4586 |
|
18669 | 4587 |
"/ after the script, if Screen has been opened and there are any open windows, |
4588 |
"/ then do not exit |
|
20758 | 4589 |
false ifTrue:[ |
18669 | 4590 |
Display notNil ifTrue:[ |
20737 | 4591 |
Processor exitWhenNoMoreUserProcesses:true. |
20746 | 4592 |
"/ Display exitOnLastClose:true. |
4593 |
"/ Display checkForEndOfDispatch. |
|
18669 | 4594 |
] ifFalse:[ |
4595 |
self exit. |
|
4596 |
]. |
|
20758 | 4597 |
]. |
18669 | 4598 |
] newProcess. |
4599 |
process priority:(Processor userSchedulingPriority). |
|
4600 |
process name:'main'. |
|
4601 |
process beGroupLeader. |
|
4602 |
process resume. |
|
4603 |
||
4604 |
Processor dispatchLoop. |
|
4605 |
self exit |
|
4606 |
]. |
|
4607 |
||
4608 |
"look for a '-f filename' or '--file filename' argument |
|
20715 | 4609 |
if scripting, these are loaded before -P, -E or -R action. |
18669 | 4610 |
if not scripting, this will force evaluation of filename instead of smalltalk.rc" |
20714 | 4611 |
[ |
4612 |
idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file'). |
|
4613 |
(idxFileArg ~~ 0) |
|
4614 |
] whileTrue:[ |
|
4615 |
commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ]. |
|
4616 |
commandFiles add:(CommandLineArguments at:idxFileArg+1). |
|
18669 | 4617 |
CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg. |
4618 |
]. |
|
4619 |
||
4620 |
"/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation) |
|
4621 |
"/ or -F/--filter or a '--repl' argument |
|
4622 |
"/ E, P and F this will force evaluation of expr only, no standard startup |
|
4623 |
"/ repl go into an interactive loop. |
|
4624 |
idx := CommandLineArguments indexOfAny:#('-E' '--eval'). |
|
4625 |
(isEval := (idx ~~ 0)) ifFalse:[ |
|
4626 |
idx := CommandLineArguments indexOfAny:#('-P' '--print'). |
|
4627 |
(isPrint := (idx ~~ 0)) ifFalse:[ |
|
4628 |
idx := CommandLineArguments indexOfAny:#('-F' '--filter'). |
|
4629 |
(isFilter := (idx ~~ 0)) ifFalse:[ |
|
4630 |
idx := CommandLineArguments indexOfAny:#('-R' '--repl'). |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4631 |
(isRepl := (idx ~~ 0)) ifFalse:[ |
20716 | 4632 |
idx := CommandLineArguments indexOfAny:#('--run'). |
20715 | 4633 |
isRunMain := (idx ~~ 0) |
4634 |
]. |
|
18669 | 4635 |
]. |
4636 |
]. |
|
4637 |
]. |
|
4638 |
||
20715 | 4639 |
(isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[ |
21010 | 4640 |
|args| |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4641 |
|
21011 | 4642 |
VerboseStartup ifTrue:[ |
4643 |
('Smalltalk [info]: eval/filter/print or repl') infoPrintCR. |
|
4644 |
]. |
|
18669 | 4645 |
isRepl ifFalse:[ |
4646 |
CommandLineArguments size <= idx ifTrue:[ |
|
20717 | 4647 |
StandAlone := true. |
20715 | 4648 |
self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'. |
18669 | 4649 |
]. |
21010 | 4650 |
isFilter ifTrue:[ |
4651 |
args := CommandLineArguments copyFrom:idx + 1. |
|
4652 |
CommandLineArguments removeFromIndex:idx+1. |
|
21011 | 4653 |
VerboseStartup ifTrue:[ |
4654 |
('Smalltalk [info]: filter expression(s): ') infoPrint. |
|
4655 |
args infoPrintCR. |
|
4656 |
]. |
|
21010 | 4657 |
] ifFalse:[ |
4658 |
arg := CommandLineArguments at:idx + 1. |
|
4659 |
CommandLineArguments removeAtIndex:idx+1. |
|
21011 | 4660 |
VerboseStartup ifTrue:[ |
4661 |
('Smalltalk [info]: eval expression: ') infoPrint. |
|
4662 |
arg infoPrintCR. |
|
4663 |
]. |
|
21010 | 4664 |
]. |
18669 | 4665 |
]. |
4666 |
CommandLineArguments removeAtIndex:idx. |
|
4667 |
||
4668 |
self startSchedulerAndBackgroundCollector. |
|
21015 | 4669 |
|
18669 | 4670 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
4671 |
Initializing := false. |
|
4672 |
||
20856 | 4673 |
"/ set workspace variables |
4674 |
self defineCommandLineAsWorkspaceVariablesForScripts. |
|
18669 | 4675 |
|
4676 |
"/ all of the above allow for a -f file to be loaded before any other action |
|
20714 | 4677 |
(commandFiles notEmptyOrNil) ifTrue:[ |
4678 |
commandFiles do:[:commandFile | |
|
20880 | 4679 |
(VerboseStartup | VerboseLoading) ifTrue:[ |
20714 | 4680 |
('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR. |
4681 |
]. |
|
20719 | 4682 |
Smalltalk silentlyLoadingDo:[ |
4683 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4684 |
StandAlone := true. |
|
4685 |
self exitWithErrorMessage:('"', commandFile, '" not found.'). |
|
4686 |
] |
|
20714 | 4687 |
] |
18669 | 4688 |
] |
4689 |
]. |
|
4690 |
||
20772 | 4691 |
isRepl ifFalse:[ |
4692 |
Debugging == true ifFalse:[ |
|
4693 |
"/ remove the Debugger |
|
4694 |
Debugger := nil. |
|
4695 |
]. |
|
20761 | 4696 |
]. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4697 |
|
18669 | 4698 |
process := [ |
20757 | 4699 |
self providingDisplayDo:[ |
20772 | 4700 |
isRepl ifTrue:[ |
20830 | 4701 |
Processor exitWhenNoMoreUserProcesses:false. |
20829 | 4702 |
Processor activeProcess name:'repl'. |
20832 | 4703 |
self readEvalPrintLoop. |
20772 | 4704 |
self exit. |
4705 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4706 |
|
20868 | 4707 |
Processor exitWhenNoMoreUserProcesses:true. |
20772 | 4708 |
|
20765 | 4709 |
NoHandlerError handle:[:ex | |
21018 | 4710 |
Debugging == true ifTrue:[ |
21019 | 4711 |
MiniDebugger enterException:ex. |
21018 | 4712 |
] ifFalse:[ |
21020 | 4713 |
Silent ifFalse:[ |
4714 |
'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4715 |
]. |
20767 | 4716 |
(VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[ |
20766 | 4717 |
ex suspendedContext fullPrintAll. |
20765 | 4718 |
]. |
20880 | 4719 |
self exit:1. |
20765 | 4720 |
]. |
20880 | 4721 |
self exit:1. |
4722 |
"/ ex reject. |
|
20757 | 4723 |
] do:[ |
20765 | 4724 |
UserInterrupt handle:[:ex | |
4725 |
Debugging == true ifTrue:[ |
|
4726 |
'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR. |
|
4727 |
"/ thisContext fullPrintAll. |
|
21019 | 4728 |
MiniDebugger enterException:ex. |
20765 | 4729 |
ex proceed. |
21020 | 4730 |
]. |
4731 |
Silent ifFalse:[ 'user interrupt.' errorPrintCR ]. |
|
20765 | 4732 |
self exit:128+(OperatingSystem sigINT). |
4733 |
] do:[ |
|
21010 | 4734 |
|filterCode filterStart filterEnd| |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4735 |
|
20765 | 4736 |
isFilter ifTrue:[ |
4737 |
"/ --filter - apply code to each input line. |
|
4738 |
"/ compile code only once |
|
21010 | 4739 |
(args size == 1) ifTrue:[ |
21015 | 4740 |
VerboseStartup ifTrue:[ |
4741 |
'Smalltalk [info]: filter 1-arg' infoPrintCR. |
|
4742 |
]. |
|
21010 | 4743 |
filterCode := args at:1. |
4744 |
] ifFalse:[ |
|
4745 |
(args size == 3) ifTrue:[ |
|
21015 | 4746 |
VerboseStartup ifTrue:[ |
4747 |
'Smalltalk [info]: filter 3-arg' infoPrintCR. |
|
4748 |
]. |
|
21010 | 4749 |
filterStart := args at:1. |
4750 |
filterCode := args at:2. |
|
4751 |
filterEnd := args at:3. |
|
4752 |
] ifFalse:[ |
|
4753 |
StandAlone := true. |
|
4754 |
self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)' |
|
4755 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4756 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4757 |
filterStart notEmptyOrNil ifTrue:[ |
21015 | 4758 |
VerboseStartup ifTrue:[ |
4759 |
('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR. |
|
4760 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4761 |
Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart) |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4762 |
]. |
21011 | 4763 |
VerboseStartup ifTrue:[ |
4764 |
('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR. |
|
4765 |
]. |
|
4766 |
Compiler |
|
21013 | 4767 |
compile:'doIt:line ',filterCode |
21011 | 4768 |
forClass:String |
4769 |
notifying:(EvalScriptingErrorHandler new source:filterCode). |
|
4770 |
||
4771 |
[Stdin atEnd] whileFalse:[ |
|
4772 |
|line| |
|
4773 |
||
4774 |
line := Stdin nextLine. |
|
4775 |
line doIt:line. |
|
20757 | 4776 |
]. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4777 |
filterEnd notEmptyOrNil ifTrue:[ |
21011 | 4778 |
VerboseStartup ifTrue:[ |
4779 |
('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR. |
|
4780 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4781 |
Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd) |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4782 |
]. |
20757 | 4783 |
] ifFalse:[ |
20765 | 4784 |
(isPrint | isEval) ifTrue:[ |
4785 |
"/ --print or --eval |
|
4786 |
|rslt| |
|
4787 |
||
4788 |
rslt := Parser new |
|
4789 |
evaluate:arg |
|
4790 |
notifying:(EvalScriptingErrorHandler new source:arg) |
|
4791 |
compile:true. |
|
4792 |
isPrint ifTrue:[ |
|
4793 |
rslt printCR. |
|
4794 |
]. |
|
4795 |
] ifFalse:[ |
|
4796 |
"/ --run <className> |
|
4797 |
|className class| |
|
4798 |
||
4799 |
className := arg. |
|
4800 |
class := Smalltalk classNamed:className. |
|
4801 |
class isNil ifTrue:[ |
|
4802 |
StandAlone := true. |
|
4803 |
self exitWithErrorMessage:'no such class: "', className, '".' |
|
4804 |
]. |
|
4805 |
(class respondsTo:#main:) ifTrue:[ |
|
4806 |
class main:CommandLineArguments. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4807 |
] ifFalse:[ |
20765 | 4808 |
(class respondsTo:#main) ifTrue:[ |
4809 |
class main. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4810 |
] ifFalse:[ |
20765 | 4811 |
(class respondsTo:#start) ifTrue:[ |
4812 |
class start. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4813 |
] ifFalse:[ |
20765 | 4814 |
StandAlone := true. |
4815 |
self exitWithErrorMessage:'class has no "main:", "main" or "start" method.' |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4816 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4817 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4818 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4819 |
]. |
20765 | 4820 |
]. |
20757 | 4821 |
]. |
18669 | 4822 |
]. |
4823 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4824 |
|
18669 | 4825 |
"/ after the script, if Screen has been opened and there are any open windows, |
4826 |
"/ then do not exit |
|
20758 | 4827 |
false ifTrue:[ |
18669 | 4828 |
Display notNil ifTrue:[ |
20743 | 4829 |
Processor exitWhenNoMoreUserProcesses:true. |
20746 | 4830 |
"/ Display exitOnLastClose:true. |
4831 |
"/ Display checkForEndOfDispatch. |
|
20880 | 4832 |
VerboseStartup ifTrue:[ |
18669 | 4833 |
('Smalltalk [info]: display opened.') infoPrintCR. |
4834 |
]. |
|
4835 |
] ifFalse:[ |
|
20880 | 4836 |
VerboseStartup ifTrue:[ |
18669 | 4837 |
('Smalltalk [info]: no display - exit after script.') infoPrintCR. |
4838 |
]. |
|
4839 |
self exit. |
|
4840 |
]. |
|
20758 | 4841 |
]. |
20880 | 4842 |
VerboseStartup ifTrue:[ |
20828 | 4843 |
('Smalltalk [info]: script/repl/eval finished.') infoPrintCR. |
4844 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4845 |
|
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
4846 |
] newProcess. |
18669 | 4847 |
process priority:(Processor userSchedulingPriority). |
4848 |
process name:'main'. |
|
4849 |
process beGroupLeader. |
|
4850 |
process resume. |
|
4851 |
||
4852 |
Processor dispatchLoop. |
|
20880 | 4853 |
VerboseStartup ifTrue:[ |
18669 | 4854 |
('Smalltalk [info]: exit normally.') infoPrintCR. |
4855 |
]. |
|
4856 |
self exit |
|
4857 |
]. |
|
4858 |
]. |
|
4859 |
||
20714 | 4860 |
commandFiles notNil ifTrue:[ |
18669 | 4861 |
SilentLoading := true. "/ suppress the hello & copyright messages |
4862 |
self addStartBlock: |
|
4863 |
[ |
|
20714 | 4864 |
commandFiles do:[:commandFile | |
4865 |
(self secureFileIn:commandFile) ifFalse:[ |
|
20715 | 4866 |
self exitWithErrorMessage:('startup file "', commandFile, '" not found.'). |
20714 | 4867 |
]. |
18669 | 4868 |
]. |
4869 |
]. |
|
16091 | 4870 |
|
4871 |
"/ self startSchedulerAndBackgroundCollector. |
|
4872 |
"/ keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4873 |
"/ Initializing := false. |
|
4874 |
"/ |
|
4875 |
"/ (self secureFileIn:commandFile) ifFalse:[ |
|
4876 |
"/ ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4877 |
"/ OperatingSystem exit:1. |
|
4878 |
"/ ]. |
|
18669 | 4879 |
] ifFalse:[ |
4880 |
"/ look for <command>.rc |
|
4881 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4882 |
||
20714 | 4883 |
rcFile := self commandName asFilename withSuffix:'rc'. |
4884 |
(didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[ |
|
18669 | 4885 |
StandAlone ifFalse:[ |
4886 |
defaultRC := 'smalltalk.rc' "/asFilename |
|
4887 |
] ifTrue:[ |
|
4888 |
defaultRC := 'stxapp.rc' "/asFilename |
|
4889 |
]. |
|
4890 |
"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to |
|
4891 |
to be started with different working directory than stx/projects/smalltalk !!!!!!" |
|
4892 |
||
4893 |
"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4894 |
didReadRCFile := (self getSystemFileName:defaultRC) notNil |
|
4895 |
and:[self secureFileIn:defaultRC]. |
|
4896 |
didReadRCFile ifFalse:[ |
|
4897 |
StandAlone ifFalse:[ |
|
4898 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4899 |
graphicalMode := false. |
|
4900 |
] |
|
4901 |
] |
|
4902 |
]. |
|
4903 |
||
4904 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4905 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4906 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4907 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4908 |
||
4909 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
4910 |
didReadRCFile ifFalse:[ |
|
4911 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4912 |
||
4913 |
"/ |
|
4914 |
"/ No RC file found; |
|
4915 |
"/ Setup more default stuff |
|
4916 |
"/ |
|
4917 |
StandAlone ifFalse:[ |
|
4918 |
"/ its a smalltalk - proceed in interpreter. |
|
4919 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4920 |
graphicalMode := false. |
|
4921 |
]. |
|
4922 |
||
4923 |
"/ setup more defaults... |
|
13537 | 4924 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
4925 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
18669 | 4926 |
self addStartBlock:[ |
4927 |
self startSchedulerAndBackgroundCollector |
|
4928 |
]. |
|
4929 |
]. |
|
4930 |
]. |
|
4931 |
(CommandLineArguments includes:'--scripting') ifTrue:[ |
|
4932 |
self addStartBlock:[ |
|
4933 |
StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments. |
|
4934 |
]. |
|
4935 |
]. |
|
617 | 4936 |
]. |
4937 |
||
10644 | 4938 |
HeadlessOperation ifTrue:[ |
18669 | 4939 |
graphicalMode := false. |
15872 | 4940 |
]. |
4941 |
||
4942 |
keepSplashWindow ifFalse:[ self hideSplashWindow ]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4943 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4944 |
|
15872 | 4945 |
"Modified: / 17-12-2013 / 16:44:40 / cg" |
25403
52e52279a507
Handle `--package-path` option in `Smalltalk >> #start`
Jan Vrany <jan.vrany@labware.com>
parents:
25402
diff
changeset
|
4946 |
"Modified: / 12-11-2020 / 08:30:49 / Jan Vrany <jan.vrany@labware.com>" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4947 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4948 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4949 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4950 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4951 |
Processor supportDynamicPriorities:true. |
13537 | 4952 |
|
4953 |
ObjectMemory startBackgroundCollectorAt:5. |
|
4954 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4955 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4956 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4957 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4958 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4959 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4960 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4961 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4962 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4963 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4964 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4965 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4966 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4967 |
p := |
18668 | 4968 |
[ |
4969 |
self executeStartBlocks. |
|
4970 |
] newProcess. |
|
12022 | 4971 |
|
4972 |
p |
|
18668 | 4973 |
priority:(Processor userSchedulingPriority); |
4974 |
name:'start block handler'; |
|
4975 |
beGroupLeader; |
|
4976 |
resume. |
|
13892 | 4977 |
|
13893 | 4978 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 4979 |
! ! |
4980 |
||
13947 | 4981 |
!Smalltalk class methodsFor:'startup and exit'! |
4982 |
||
4983 |
addExitBlock:aBlock |
|
4984 |
"{ Pragma: +optSpace }" |
|
4985 |
||
4986 |
"add a block to be executed when Smalltalk finishes. |
|
4987 |
This feature is currently not used anywhere - but could be useful for |
|
4988 |
cleanup in stand alone applications. |
|
4989 |
||
4990 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
4991 |
#aboutToQuit." |
|
4992 |
||
4993 |
ExitBlocks isNil ifTrue:[ |
|
18668 | 4994 |
ExitBlocks := OrderedCollection with:aBlock |
13947 | 4995 |
] ifFalse:[ |
18668 | 4996 |
ExitBlocks add:aBlock |
13947 | 4997 |
] |
4998 |
! |
|
4999 |
||
5000 |
addImageStartBlock:aBlock |
|
5001 |
"{ Pragma: +optSpace }" |
|
5002 |
||
5003 |
"add a blocks to be executed in a separate process after |
|
5004 |
everything has been initialized. |
|
5005 |
These blocks will be executed after an image restart." |
|
5006 |
||
5007 |
ImageStartBlocks isNil ifTrue:[ |
|
18668 | 5008 |
ImageStartBlocks := OrderedCollection with:aBlock |
13947 | 5009 |
] ifFalse:[ |
18668 | 5010 |
ImageStartBlocks add:aBlock |
13947 | 5011 |
] |
5012 |
||
5013 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
5014 |
! |
|
5015 |
||
5016 |
addStartBlock:aBlock |
|
15980 | 5017 |
"to be called ONLY during very early startup (before the process scheduler |
5018 |
is started) to add a block to be executed in a separate process after |
|
5019 |
everything has been initialized. |
|
5020 |
Used to allow a startup script (which is executed BEFORE the scheduler and |
|
5021 |
UI display is startup up) to add actions which require those subsystems to |
|
5022 |
be operating. |
|
5023 |
These blocks will be executed only once and not be executed after an image restart. |
|
13947 | 5024 |
Initial processes such as the launcher are usually started here |
15980 | 5025 |
(see smalltalk.rc / private.rc). |
5026 |
ONLY to be called from such an rc file." |
|
13947 | 5027 |
|
5028 |
"{ Pragma: +optSpace }" |
|
5029 |
||
15980 | 5030 |
"/ to protect against "mis-users" of this mehtod... |
5031 |
Initializing ifFalse:[ |
|
18668 | 5032 |
aBlock value |
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5033 |
] ifTrue:[ |
18668 | 5034 |
StartBlocks isNil ifTrue:[ |
5035 |
StartBlocks := OrderedCollection with:aBlock |
|
5036 |
] ifFalse:[ |
|
5037 |
StartBlocks add:aBlock |
|
5038 |
] |
|
15980 | 5039 |
]. |
13947 | 5040 |
|
5041 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
5042 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
5043 |
! |
|
5044 |
||
5045 |
exit |
|
5046 |
"{ Pragma: +optSpace }" |
|
5047 |
||
5048 |
"finish the Smalltalk system" |
|
5049 |
||
5050 |
self exit:0 |
|
5051 |
"not reached" |
|
5052 |
||
5053 |
"Be careful evaluating this |
|
5054 |
Smalltalk exit |
|
5055 |
" |
|
5056 |
! |
|
5057 |
||
5058 |
exit:statusInteger |
|
5059 |
"{ Pragma: +optSpace }" |
|
5060 |
||
5061 |
"finish the Smalltalk system" |
|
5062 |
||
5063 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
5064 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
5065 |
ExitBlocks notNil ifTrue:[ |
|
18668 | 5066 |
ExitBlocks do:[:aBlock | |
5067 |
aBlock value |
|
5068 |
] |
|
13947 | 5069 |
]. |
5070 |
OperatingSystem exit:statusInteger |
|
5071 |
"not reached" |
|
5072 |
||
5073 |
"Be careful evaluating this |
|
5074 |
Smalltalk exit:1 |
|
5075 |
" |
|
19014 | 5076 |
! |
5077 |
||
19958 | 5078 |
exitIfStandalone |
5079 |
"if this is a standalone application, exit. |
|
5080 |
Otherwise give a warning and abort. |
|
5081 |
Call this in your code instead of Smalltalk exit, |
|
5082 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5083 |
||
5084 |
"{ Pragma: +optSpace }" |
|
5085 |
||
5086 |
self exitIfStandalone:0 |
|
5087 |
||
5088 |
"Created: / 06-06-2016 / 14:56:49 / cg" |
|
5089 |
! |
|
5090 |
||
5091 |
exitIfStandalone:statusInteger |
|
5092 |
"if this is a standalone application, exit. |
|
5093 |
Otherwise give a warning and abort. |
|
5094 |
Call this in your code instead of Smalltalk exit, |
|
5095 |
so the code can be tested in the IDE without danger of shuttong down ST/X" |
|
5096 |
||
5097 |
"{ Pragma: +optSpace }" |
|
5098 |
||
5099 |
Smalltalk isStandAloneApp ifTrue:[ |
|
5100 |
self exit:statusInteger |
|
5101 |
] ifFalse:[ |
|
20572 | 5102 |
self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'. |
20565 | 5103 |
AbortOperationRequest raise. |
19958 | 5104 |
] |
5105 |
||
5106 |
" |
|
5107 |
Smalltalk exitIfStandalone:1 |
|
5108 |
" |
|
5109 |
||
5110 |
"Created: / 06-06-2016 / 14:56:00 / cg" |
|
5111 |
! |
|
5112 |
||
19014 | 5113 |
exitOrError:exitCode |
5114 |
"exit only if running as standalone application. |
|
5115 |
Raise an error in the development system. |
|
5116 |
Useful for testing standalone apps which should not kill |
|
5117 |
your development system." |
|
5118 |
||
5119 |
self isStandAloneApp ifTrue:[ |
|
5120 |
self exit:exitCode. |
|
5121 |
]. |
|
5122 |
self error:'standalone smalltalk would exit here with exit code: ', exitCode printString. |
|
5123 |
||
5124 |
" |
|
5125 |
self exitOrError:0 |
|
5126 |
" |
|
20715 | 5127 |
! |
5128 |
||
5129 |
exitWithErrorMessage:msg |
|
5130 |
('Smalltalk [error]: ',msg) errorPrintCR. |
|
5131 |
self exitOrError:1 |
|
13947 | 5132 |
! ! |
5133 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5134 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 5135 |
|
10641 | 5136 |
commandLine |
5137 |
"return the full command line arguments (with which ST/X was started)" |
|
5138 |
||
5139 |
^ CommandLine |
|
5140 |
||
5141 |
" |
|
5142 |
Smalltalk commandLine |
|
5143 |
" |
|
5144 |
||
5145 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
5146 |
! |
|
5147 |
||
5148 |
commandLineArgumentNamed:aString |
|
16110 | 5149 |
"extract a named argument from the command line arguments. |
5150 |
This searches for the given string in the command line and returns the next argument after it." |
|
10641 | 5151 |
|
5152 |
|args index| |
|
5153 |
||
5154 |
args := self commandLineArguments. |
|
5155 |
index := args indexOf:aString. |
|
5156 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
18668 | 5157 |
^ args at:index+1 |
10641 | 5158 |
]. |
5159 |
^ nil. |
|
5160 |
||
5161 |
" |
|
5162 |
self commandLineArgumentNamed:'-display' |
|
5163 |
" |
|
5164 |
! |
|
5165 |
||
5166 |
commandLineArguments |
|
5167 |
"return the user command line arguments; |
|
5168 |
This is a collection of strings (separated command line words), |
|
5169 |
from which the internal startup arguments have already been removed. |
|
5170 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
5171 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
5172 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
5173 |
||
5174 |
^ CommandLineArguments |
|
5175 |
||
5176 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
5177 |
! |
|
5178 |
||
5179 |
commandName |
|
5180 |
"return the excutables name - this is normally 'stx', |
|
5181 |
but can be something else for standAlone apps." |
|
5182 |
||
5183 |
^ CommandName. |
|
5184 |
||
5185 |
" |
|
5186 |
Smalltalk commandName |
|
5187 |
" |
|
5188 |
||
5189 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
5190 |
! |
|
5191 |
||
5192 |
hasNoConsole |
|
5193 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
5194 |
i.e. there should be no writing to stdout/stderr" |
|
5195 |
||
5196 |
^ HasNoConsole ? false |
|
5197 |
||
5198 |
" |
|
10071 | 5199 |
Smalltalk hasNoConsole |
9054 | 5200 |
" |
5201 |
! |
|
5202 |
||
17435 | 5203 |
ignoreAssertions |
5204 |
"return true, if assertions are to be ignored (i.e. not executed). |
|
5205 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5206 |
but can be set to true for standAlone applications |
|
5207 |
(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
|
5208 |
However, it may make the app a little faster, if assertions are compatational |
17435 | 5209 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5210 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5211 |
^ IgnoreAssertions ? false |
17435 | 5212 |
! |
5213 |
||
17438 | 5214 |
ignoreAssertions:aBoolean |
5215 |
"set to true, if assertions are to be ignored (i.e. not executed). |
|
5216 |
This is false by default in an IDE (i.e. full smalltalk), |
|
5217 |
but can be set to true for standAlone applications |
|
5218 |
(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
|
5219 |
However, it may make the app a little faster, if assertions are compatational |
17438 | 5220 |
expensive, as they are skipped (the stc compiler is generatig code which skips those)." |
5221 |
||
17439
1928276a394c
added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents:
17438
diff
changeset
|
5222 |
IgnoreAssertions := aBoolean |
17438 | 5223 |
! |
5224 |
||
25401 | 5225 |
isDebuggableApp |
5226 |
"return true, if we want to see a Debugger, MiniDebugger or extended debugging output |
|
5227 |
in some situations." |
|
5228 |
||
5229 |
^ self isStandAloneApp not or:[self isStandAloneDebug]. |
|
5230 |
||
5231 |
" |
|
5232 |
Smalltalk isDebuggableApp |
|
5233 |
" |
|
5234 |
||
5235 |
"Created: / 19-04-2018 / 10:30:17 / stefan" |
|
5236 |
! |
|
5237 |
||
10641 | 5238 |
isHeadless |
5239 |
"return true, if this is a headless application |
|
5240 |
i.e. no default Display connection is required/used" |
|
5241 |
||
5242 |
^ HeadlessOperation ? false |
|
5243 |
||
5244 |
" |
|
10071 | 5245 |
Smalltalk isHeadless |
9029 | 5246 |
" |
5247 |
! |
|
5248 |
||
10641 | 5249 |
isPlugin |
5250 |
"return true, if this is a plugin application |
|
5251 |
i.e. running in a browserWindow" |
|
5252 |
||
5253 |
^ IsPlugin ? false |
|
5254 |
||
5255 |
" |
|
10071 | 5256 |
Smalltalk isPlugin |
9029 | 5257 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5258 |
! |
4957 | 5259 |
|
10641 | 5260 |
isSTScript |
5261 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
5262 |
||
5263 |
^ IsSTScript ? false |
|
5264 |
||
5265 |
" |
|
5266 |
Smalltalk isSTScript |
|
5267 |
" |
|
5268 |
||
5269 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
5270 |
! |
|
5271 |
||
5272 |
isSharedLibraryComponent |
|
5273 |
"return true, if this is a shared library component of another application |
|
5274 |
i.e. a dll within another app." |
|
5275 |
||
5276 |
^ IsSharedLibraryComponent ? false |
|
5277 |
||
5278 |
" |
|
5279 |
Smalltalk isSharedLibraryComponent |
|
5280 |
" |
|
5281 |
||
5282 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
5283 |
! |
|
5284 |
||
5285 |
isSmalltalkDevelopmentSystem |
|
5286 |
"return true, if this is a real smalltalk system |
|
17421 | 5287 |
i.e. NOT a stripped or a linked standAlone application (such as the webServer) |
10641 | 5288 |
and NOT a plugIn (i.e. running in a browser) |
5289 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
17421 | 5290 |
This is used to determine, whether debugging is possible/desired or not." |
10641 | 5291 |
|
5292 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
5293 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
5294 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 5295 |
^ self isStandAloneApp not. |
10641 | 5296 |
|
5297 |
" |
|
5298 |
Smalltalk isSmalltalkDevelopmentSystem |
|
5299 |
" |
|
5300 |
||
5301 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
5302 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
15565 | 5303 |
"Modified (comment): / 27-07-2013 / 15:36:20 / cg" |
10641 | 5304 |
! |
5305 |
||
5306 |
isStandAloneApp |
|
5307 |
"return true, if this is a standAlone application |
|
5308 |
i.e. a stripped & linked application (such as the webServer) |
|
5309 |
in contrast to a full smalltalk (development) system." |
|
5310 |
||
5311 |
^ StandAlone ? false |
|
5312 |
||
5313 |
" |
|
10071 | 5314 |
Smalltalk isStandAloneApp |
9029 | 5315 |
" |
617 | 5316 |
! |
5317 |
||
13947 | 5318 |
isStandAloneDebug |
5319 |
"return true, if this is a standAlone application which |
|
5320 |
was started with the -debug option." |
|
5321 |
||
5322 |
^ DebuggingStandAlone ? false |
|
5323 |
||
5324 |
" |
|
5325 |
Smalltalk isStandAloneDebug |
|
5326 |
" |
|
5327 |
||
5328 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
5329 |
! |
|
5330 |
||
10641 | 5331 |
startupArguments |
5332 |
"return the arguments passed to StartupClass when stx gets started. |
|
5333 |
Usually these are nil, |
|
5334 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5335 |
a simple way to configure and create stand-alone applications" |
|
5336 |
||
5337 |
^ StartupArguments |
|
5338 |
||
5339 |
" |
|
10071 | 5340 |
Smalltalk startupArguments |
9029 | 5341 |
" |
7563 | 5342 |
! |
5343 |
||
10641 | 5344 |
startupClass |
5345 |
"return the class, that will get the start message when smalltalk |
|
5346 |
starts and its non-nil. Usually this is nil, |
|
5347 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
5348 |
a simple way to configure and create stand-alone applications" |
|
5349 |
||
5350 |
^ StartupClass |
|
5351 |
||
5352 |
" |
|
10071 | 5353 |
Smalltalk startupClass |
9029 | 5354 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5355 |
! |
8570 | 5356 |
|
10641 | 5357 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
5358 |
"{ Pragma: +optSpace }" |
|
5359 |
||
5360 |
"set the class, selector and arguments to be performed when smalltalk |
|
5361 |
starts. Setting those before saving a snapshot, will make the saved |
|
5362 |
image come up executing your application (instead of the normal mainloop)" |
|
5363 |
||
5364 |
StartupClass := aClass. |
|
5365 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5366 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5367 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5368 |
|
10641 | 5369 |
startupSelector |
5370 |
"return the selector, that will be sent to StartupClass. |
|
5371 |
Usually this is nil, |
|
5372 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
5373 |
a simple way to configure and create stand-alone applications" |
|
5374 |
||
5375 |
^ StartupSelector |
|
5376 |
||
5377 |
" |
|
10071 | 5378 |
Smalltalk startupSelector |
9029 | 5379 |
" |
10641 | 5380 |
! |
5381 |
||
5382 |
wasStartedFromImage |
|
5383 |
"return true, if this smalltalk was started from an image, |
|
5384 |
as opposed to a fresh and clean startup" |
|
5385 |
||
5386 |
^ ImageRestartTime notNil |
|
5387 |
||
5388 |
" |
|
5389 |
Smalltalk wasStartedFromImage |
|
5390 |
" |
|
70 | 5391 |
! ! |
5392 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5393 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 5394 |
|
10641 | 5395 |
language |
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5396 |
^ UserPreferences current language |
10641 | 5397 |
|
5398 |
" |
|
5399 |
Smalltalk language |
|
5400 |
" |
|
5401 |
||
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5402 |
"Modified: / 26-04-1996 / 17:10:05 / cg" |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5403 |
"Modified: / 20-11-2017 / 14:12:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 5404 |
! |
5405 |
||
5406 |
language:aLanguageSymbol |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5407 |
<resource: #obsolete> |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5408 |
|
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5409 |
self obsoleteFeatureWarning:'Use `UserPreferences current language: ...`' |
10641 | 5410 |
|
5411 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5412 |
"Modified: / 20-11-2017 / 14:10:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 5413 |
! |
5414 |
||
5415 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5416 |
<resource: #obsolete> |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5417 |
|
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5418 |
self obsoleteFeatureWarning:'Use `UserPreferences current language: ...; languageTerritory:`' . |
10641 | 5419 |
|
5420 |
" |
|
5421 |
Smalltalk language:#de territory:#de |
|
5422 |
" |
|
5423 |
||
5424 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
5425 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5426 |
"Modified: / 20-11-2017 / 14:11:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 5427 |
! |
5428 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5429 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5430 |
"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
|
5431 |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5432 |
^ self language , '-' , self languageTerritory |
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5433 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5434 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5435 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5436 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5437 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5438 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5439 |
"Modified (comment): / 20-11-2017 / 14:13:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5440 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
5441 |
|
20615 | 5442 |
languageCodeset |
5443 |
^ LanguageCodeset |
|
5444 |
! |
|
5445 |
||
5446 |
languageModifier |
|
5447 |
^ LanguageModifier |
|
5448 |
! |
|
5449 |
||
10641 | 5450 |
languageTerritory |
5451 |
"return the language territory setting" |
|
7563 | 5452 |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5453 |
^ UserPreferences current languageTerritory |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5454 |
|
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5455 |
"Modified: / 20-11-2017 / 14:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7563 | 5456 |
! |
5457 |
||
10641 | 5458 |
languageTerritory:aTerritorySymbol |
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5459 |
<resource: #obsolete> |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5460 |
|
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5461 |
self obsoleteFeatureWarning:'Use `UserPreferences current languageTerritory: ...`' . |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
5462 |
|
10641 | 5463 |
" |
5464 |
Time now |
|
5465 |
||
5466 |
Smalltalk languageTerritory:#us. |
|
5467 |
Time now |
|
5468 |
||
5469 |
Smalltalk languageTerritory:#de. |
|
5470 |
Time now |
|
5471 |
" |
|
5472 |
||
5473 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5474 |
"Modified: / 20-11-2017 / 14:12:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 5475 |
! |
5476 |
||
5477 |
setLanguage:aLanguageSymbol |
|
23092
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5478 |
<resource: #obsolete> |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5479 |
self obsoleteFeatureWarning |
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5480 |
|
5d343af8922a
Issue #80: keep language settings in `UserPreferences`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23087
diff
changeset
|
5481 |
"Modified: / 20-11-2017 / 14:16:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10991 | 5482 |
! |
5483 |
||
5484 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
23093
9c9fa5a584bb
Issue #80: remove initialization of `Language` and `LanguageTerritory` globals.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23092
diff
changeset
|
5485 |
<resource: #obsolete> |
9c9fa5a584bb
Issue #80: remove initialization of `Language` and `LanguageTerritory` globals.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23092
diff
changeset
|
5486 |
self obsoleteFeatureWarning. |
9c9fa5a584bb
Issue #80: remove initialization of `Language` and `LanguageTerritory` globals.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23092
diff
changeset
|
5487 |
|
9c9fa5a584bb
Issue #80: remove initialization of `Language` and `LanguageTerritory` globals.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23092
diff
changeset
|
5488 |
"Modified (format): / 28-11-2017 / 00:03:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1069 | 5489 |
! ! |
5490 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
5491 |
!Smalltalk class methodsFor:'system management'! |
70 | 5492 |
|
10641 | 5493 |
compressSources |
5494 |
"{ Pragma: +optSpace }" |
|
5495 |
||
5496 |
"compress the sources file, and remove all method source strings |
|
5497 |
from the system and replace them by refs to a string in the source file. |
|
5498 |
This is a bit different in ST/X than in other smalltalks, |
|
5499 |
since we use per-class sourcefiles for the compiled classes, |
|
5500 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
5501 |
incremental compiled methods. |
|
5502 |
Therefore, only those sources which are not coming from compiled |
|
5503 |
methods are put into the 'st.src' file - all others are untouched. |
|
20811 | 5504 |
This is being automated - so don't care for now." |
10641 | 5505 |
|
5506 |
|newStream table source pos fileName| |
|
5507 |
||
5508 |
" |
|
5509 |
first, find all methods which contain either a string-ref |
|
5510 |
or an external string in the 'st.src' file |
|
5511 |
" |
|
5512 |
newStream := 'src.tmp' asFilename writeStream. |
|
5513 |
||
5514 |
table := IdentityDictionary new:100. |
|
5515 |
||
5516 |
Method allSubInstancesDo:[:aMethod | |
|
20811 | 5517 |
source := nil. |
5518 |
aMethod sourcePosition notNil ifTrue:[ |
|
5519 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
5520 |
source := aMethod source. |
|
5521 |
] |
|
5522 |
] ifFalse:[ |
|
5523 |
source := aMethod source |
|
5524 |
]. |
|
5525 |
||
5526 |
source notNil ifTrue:[ |
|
5527 |
pos := newStream position + 1. |
|
5528 |
newStream nextChunkPut:source. |
|
5529 |
||
5530 |
" |
|
5531 |
dont change the methods info - maybe some write error |
|
5532 |
occurs later, in that case we abort and leave everything |
|
5533 |
untouched. |
|
5534 |
" |
|
5535 |
table at:aMethod put:pos |
|
5536 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5537 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5538 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5539 |
newStream syncData; close. |
10641 | 5540 |
|
5541 |
" |
|
5542 |
now, rename the new source file, |
|
5543 |
" |
|
5544 |
fileName := (ObjectMemory nameForSources). |
|
5545 |
'src.tmp' asFilename renameTo:fileName. |
|
5546 |
||
5547 |
"good - now go over all changed methods, and change their |
|
5548 |
source reference" |
|
5549 |
||
5550 |
table keysAndValuesDo:[:aMethod :pos | |
|
20811 | 5551 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5552 |
"/ aMethod printCR. |
5553 |
]. |
|
5554 |
||
5555 |
" |
|
5556 |
Smalltalk compressSources |
|
5557 |
" |
|
5558 |
||
5559 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5560 |
! |
|
5561 |
||
5562 |
generateSingleSourceFile |
|
5563 |
"{ Pragma: +optSpace }" |
|
5564 |
||
5565 |
"generate the sources file, and remove all method source strings |
|
5566 |
from the system and replace them by refs to a string in the source file. |
|
5567 |
This makes the image independent from the per-class source files |
|
5568 |
and makes transportation of endUser applications easier, since |
|
5569 |
only 3 files (executable, image and sourceFile) need to be |
|
5570 |
transported." |
|
5571 |
||
5572 |
|newStream table source pos fileName| |
|
5573 |
||
5574 |
newStream := 'src.tmp' asFilename writeStream. |
|
5575 |
||
5576 |
table := IdentityDictionary new:100. |
|
5577 |
||
5578 |
Method allSubInstancesDo:[:aMethod | |
|
20811 | 5579 |
source := aMethod source. |
5580 |
source notNil ifTrue:[ |
|
5581 |
pos := newStream position + 1. |
|
5582 |
newStream nextChunkPut:source. |
|
5583 |
||
5584 |
" |
|
5585 |
don't change the methods info - maybe some write error |
|
5586 |
occurs later, in that case we abort and leave everything |
|
5587 |
untouched. |
|
5588 |
" |
|
5589 |
table at:aMethod put:pos |
|
5590 |
] |
|
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5591 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5592 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
5593 |
newStream syncData; close. |
10641 | 5594 |
|
5595 |
" |
|
5596 |
now, rename the new source file, |
|
5597 |
" |
|
5598 |
fileName := (ObjectMemory nameForSources). |
|
5599 |
'src.tmp' asFilename renameTo:fileName. |
|
5600 |
||
5601 |
"good - now go over all changed methods, and change their |
|
5602 |
source reference" |
|
5603 |
||
5604 |
table keysAndValuesDo:[:aMethod :pos | |
|
20811 | 5605 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 5606 |
"/ aMethod printCR. |
5607 |
]. |
|
5608 |
||
5609 |
" |
|
5610 |
Smalltalk generateSingleSourceFile |
|
5611 |
" |
|
5612 |
||
5613 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5614 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
5615 |
! |
|
5616 |
||
15596 | 5617 |
installAutoloadedClassFromSourceFile:aFilename |
5618 |
"install aFilename (which must be a smalltalk source file) as autoloaded class |
|
5619 |
(extract the class definition chunk from the file and create an autoloaded |
|
5620 |
class stub for it)" |
|
5621 |
||
5622 |
|chunks filename| |
|
5623 |
||
5624 |
filename := aFilename asFilename. |
|
5625 |
||
5626 |
ChangeSet::InvalidChangeChunkError handle:[:ex | |
|
18668 | 5627 |
^ self |
15596 | 5628 |
] do:[ |
18668 | 5629 |
filename readingFileDo:[:s| |
5630 |
chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not]. |
|
5631 |
]. |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5632 |
]. |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5633 |
|
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
5634 |
chunks |
18668 | 5635 |
select:[:eachChunk | eachChunk isClassDefinitionChange] |
5636 |
thenDo:[:eachClassChunk | |
|
5637 |
eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName" |
|
5638 |
]. |
|
15596 | 5639 |
|
5640 |
"Created: / 01-08-2013 / 16:57:26 / cg" |
|
5641 |
! |
|
5642 |
||
10641 | 5643 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
5644 |
"create & install an autoload stub for a class named: clsName, |
|
5645 |
to be loaded from package. |
|
5646 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5647 |
(otherwise, the newest revision will be loaded" |
|
5648 |
||
5649 |
^ self |
|
18668 | 5650 |
installAutoloadedClassNamed:clsName |
5651 |
category:cat |
|
5652 |
package:package |
|
5653 |
revision:revisionOrNil |
|
5654 |
numClassInstVars:nil. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5655 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5656 |
|
10641 | 5657 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
5658 |
"create & install an autoload stub for a class named: clsName, |
|
5659 |
to be loaded from package. |
|
5660 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
5661 |
(otherwise, the newest revision will be loaded" |
|
5662 |
||
5663 |
|clsSym cls| |
|
5664 |
||
5665 |
clsSym := clsName asSymbol. |
|
5666 |
||
5667 |
"/ install if not already compiled-in |
|
5668 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
18668 | 5669 |
Autoload subclass:clsSym |
5670 |
instanceVariableNames:'' |
|
5671 |
classVariableNames:'' |
|
5672 |
poolDictionaries:'' |
|
5673 |
category:cat |
|
5674 |
inEnvironment:Smalltalk. |
|
5675 |
||
5676 |
cls := self at:clsSym. |
|
5677 |
cls isNil ifTrue:[ |
|
5678 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
|
5679 |
] ifFalse:[ |
|
5680 |
cls package:package asSymbol. |
|
5681 |
revisionOrNil notNil ifTrue:[ |
|
5682 |
cls setBinaryRevision:revisionOrNil |
|
5683 |
] |
|
5684 |
] |
|
10641 | 5685 |
] ifFalse:[ |
18668 | 5686 |
"/ class already present - however, if unloaded, check for category/package change |
5687 |
cls isLoaded ifFalse:[ |
|
5688 |
package ~= cls package ifTrue:[ |
|
5689 |
cls withoutUpdatingChangesDo:[ |
|
5690 |
cls package:package asSymbol. |
|
5691 |
]. |
|
5692 |
]. |
|
5693 |
cat ~= cls category ifTrue:[ |
|
5694 |
cls withoutUpdatingChangesDo:[ |
|
5695 |
cls category:cat. |
|
5696 |
]. |
|
5697 |
]. |
|
5698 |
]. |
|
10641 | 5699 |
]. |
5700 |
^ cls. |
|
5701 |
||
5702 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
5703 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
5704 |
|
10641 | 5705 |
! |
5706 |
||
5707 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5708 |
"scan all packages and install all classes found there as |
10641 | 5709 |
autoloaded. This takes some time ..." |
5710 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5711 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
5712 |
|
17588 | 5713 |
LoadInProgressQuery answerNotifyLoadingDo:[ |
18668 | 5714 |
dirsConsulted := Set new. |
5715 |
||
5716 |
"/ along the package-path |
|
5717 |
self packagePath do:[:eachPathComponent | |
|
5718 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
|
5719 |
self |
|
5720 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
|
5721 |
rememberIn:dirsConsulted |
|
5722 |
maxLevels:15 |
|
5723 |
noAutoload:false |
|
5724 |
packageTop:eachPathComponent |
|
5725 |
showSplashInLevels:2. |
|
5726 |
] |
|
5727 |
]. |
|
5728 |
self splashInfo:nil. |
|
17548 | 5729 |
]. |
10641 | 5730 |
|
5731 |
" |
|
5732 |
Smalltalk installAutoloadedClasses |
|
5733 |
" |
|
5734 |
||
5735 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
5736 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
5737 |
! |
|
5738 |
||
5739 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
5740 |
"read the given abbreviation file; install all classes found there as |
|
5741 |
autoloaded. This takes some time ..." |
|
5742 |
||
5743 |
|f s| |
|
5744 |
||
5745 |
f := self getSystemFileName:anAbbrevFilePath. |
|
5746 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
5747 |
||
5748 |
f notNil ifTrue:[ |
|
19911 | 5749 |
f := f asFilename. |
5750 |
f isDirectory ifTrue:[ |
|
5751 |
f := f construct:'abbrev.stc' |
|
5752 |
]. |
|
5753 |
[ |
|
5754 |
s := f readStream. |
|
5755 |
self installAutoloadedClassesFromStream:s. |
|
5756 |
s close. |
|
5757 |
] on:FileStream openErrorSignal |
|
5758 |
do:[:ex| "do nothing"]. |
|
10641 | 5759 |
] |
5760 |
||
5761 |
" |
|
5762 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
19911 | 5763 |
Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc' |
10641 | 5764 |
" |
5765 |
||
5766 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
5767 |
! |
|
5768 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5769 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5770 |
aFilename readingFileDo:[:abbrevStream | |
19911 | 5771 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5772 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5773 |
|
19911 | 5774 |
" |
5775 |
self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename) |
|
5776 |
" |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
5777 |
|
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5778 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5779 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5780 |
|
10641 | 5781 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
5782 |
"read the given abbreviation file; |
|
5783 |
install all classes found there as autoloaded, and also update the |
|
5784 |
abbreviation (className-to-fileName mapping) table. |
|
5785 |
This takes some time ..." |
|
5786 |
||
5787 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
5788 |
||
5789 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
19911 | 5790 |
abbrevFileName := anAbbrevFileStream pathName. |
5791 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 5792 |
]. |
5793 |
||
5794 |
"/ yes, create any required nameSpace, without asking user. |
|
5795 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
5796 |
||
19911 | 5797 |
[anAbbrevFileStream atEnd] whileFalse:[ |
5798 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
5799 |
"Skip empty lines and comments" |
|
5800 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
5801 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 5802 |
"/ words := line asCollectionOfWords. |
5803 |
||
19911 | 5804 |
words := OrderedCollection new. |
5805 |
s2 := l readStream. |
|
5806 |
[s2 atEnd] whileFalse:[ |
|
5807 |
s2 skipSeparators. |
|
5808 |
s2 peek == $' ifTrue:[ |
|
5809 |
s2 next. |
|
5810 |
w := s2 upTo:$'. |
|
5811 |
s2 skipSeparators. |
|
5812 |
] ifFalse:[ |
|
5813 |
w := s2 upToSeparator |
|
5814 |
]. |
|
5815 |
words add:w |
|
5816 |
]. |
|
5817 |
words size < 3 ifTrue:[ |
|
5818 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
5819 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
5820 |
' (in ''' errorPrint. |
|
5821 |
anAbbrevFileStream pathName errorPrint. |
|
5822 |
''')' errorPrint |
|
5823 |
]. |
|
5824 |
': ' errorPrint. l errorPrintCR |
|
5825 |
] ifFalse:[ |
|
5826 |
clsName := (words at:1) asSymbol. |
|
5827 |
abbrev := (words at:2). |
|
5828 |
package := (words at:3) asSymbol. |
|
5829 |
cat := words at:4 ifAbsent:nil. |
|
5830 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
5831 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
5832 |
||
5833 |
(cat size == 0) ifTrue:[ |
|
5834 |
cat := 'autoloaded' |
|
5835 |
]. |
|
5836 |
||
5837 |
"/ on the fly, update the abbreviations |
|
5838 |
self setFilename:abbrev forClass:clsName package:package. |
|
5839 |
||
5840 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
5841 |
||
5842 |
cls := self |
|
5843 |
installAutoloadedClassNamed:clsName |
|
5844 |
category:cat |
|
5845 |
package:package |
|
5846 |
revision:nil |
|
5847 |
numClassInstVars:numClassInstVars. |
|
10641 | 5848 |
|
5849 |
"/ info notNil ifTrue:[ |
|
5850 |
"/ cls setComment:info. |
|
5851 |
"/ ]. |
|
19911 | 5852 |
] |
5853 |
] |
|
5854 |
] |
|
4458 | 5855 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5856 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5857 |
|
10641 | 5858 |
loadBinaries |
5859 |
"return true, if binaries should be loaded into the system, |
|
5860 |
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
|
5861 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5862 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5863 |
! |
3044 | 5864 |
|
10641 | 5865 |
loadBinaries:aBoolean |
5866 |
"{ Pragma: +optSpace }" |
|
5867 |
||
5868 |
"turn on/off loading of binary objects" |
|
5869 |
||
5870 |
aBoolean ifTrue:[ |
|
18668 | 5871 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
5872 |
LoadBinaries := true. |
|
5873 |
^ self |
|
5874 |
]. |
|
5875 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
|
10641 | 5876 |
]. |
5877 |
LoadBinaries := false |
|
5878 |
||
5879 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
5880 |
! |
|
5881 |
||
5882 |
logDoits |
|
5883 |
"return true if doits should go into the changes file |
|
5884 |
as well as changes - by default, this is off, since |
|
5885 |
it can blow up the changes file enormously ... |
|
5886 |
" |
|
5887 |
||
5888 |
^ LogDoits |
|
5889 |
||
5890 |
" |
|
5891 |
LogDoits := false |
|
3044 | 5892 |
LogDoits := true |
5893 |
" |
|
5894 |
! |
|
5895 |
||
10641 | 5896 |
logDoits:aBoolean |
5897 |
"{ Pragma: +optSpace }" |
|
5898 |
||
5899 |
"turn on/off logging of doits in the changes file. |
|
5900 |
By default, this is off, since it can blow up the |
|
5901 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5902 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5903 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5904 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5905 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5906 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5907 |
|
10641 | 5908 |
makeBytecodeMethods |
5909 |
"{ Pragma: +optSpace }" |
|
5910 |
||
5911 |
"walk over all methods and make each a bytecode method |
|
5912 |
iff it does not contain primitive C code. |
|
5913 |
Experimental and not yet used." |
|
5914 |
||
5915 |
Method allSubInstancesDo:[:aMethod | |
|
18707 | 5916 |
|newMethod| |
5917 |
||
5918 |
aMethod hasPrimitiveCode ifFalse:[ |
|
5919 |
"/ aMethod errorPrintCR. |
|
5920 |
newMethod := aMethod asByteCodeMethod. |
|
5921 |
newMethod ~~ aMethod ifTrue:[ |
|
5922 |
newMethod isNil ifTrue:[ |
|
5923 |
'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR. |
|
5924 |
] ifFalse:[ |
|
5925 |
aMethod becomeSameAs:newMethod |
|
5926 |
]. |
|
5927 |
] |
|
5928 |
]. |
|
10641 | 5929 |
]. |
5930 |
||
5931 |
" |
|
5932 |
Smalltalk makeBytecodeMethods |
|
5933 |
" |
|
5934 |
||
5935 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5936 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
5937 |
! |
|
5938 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5939 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5940 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5941 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5942 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5943 |
|dirsConsulted| |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5944 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5945 |
dirsConsulted := Set new. |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5946 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5947 |
self |
18707 | 5948 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
5949 |
rememberIn:dirsConsulted |
|
5950 |
maxLevels:15 |
|
5951 |
noAutoload:false |
|
5952 |
packageTop:nil |
|
5953 |
showSplashInLevels:-1. |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5954 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5955 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5956 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5957 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5958 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5959 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5960 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5961 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5962 |
|
10641 | 5963 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5964 |
"read all abbrev.stc files from and under aDirectory |
|
5965 |
and install autoloaded classes. |
|
15783 | 5966 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
5967 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
5968 |
named AUTOLOAD. |
|
5969 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
10641 | 5970 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
5971 |
||
11391 | 5972 |
self |
18668 | 5973 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
5974 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
5975 |
showSplashInLevels:0. |
|
11391 | 5976 |
|
5977 |
" |
|
5978 |
Smalltalk installAutoloadedClasses |
|
5979 |
" |
|
5980 |
||
5981 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
5982 |
! |
|
5983 |
||
12022 | 5984 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 5985 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5986 |
showSplashInLevels:showSplashInLevels |
|
5987 |
"read all abbrev.stc files from and under aDirectory |
|
5988 |
and install autoloaded classes. |
|
15783 | 5989 |
If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded, |
5990 |
but classes in subdirectories are installed, if the subdirectory contains a file |
|
5991 |
named AUTOLOAD. |
|
5992 |
If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded. |
|
11391 | 5993 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
5994 |
||
15783 | 5995 |
|dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC| |
10641 | 5996 |
|
5997 |
dir := aDirectory asFilename. |
|
15958 | 5998 |
|
5999 |
"/ Care for non-existent directories" |
|
6000 |
dir exists ifFalse:[ ^ self ]. |
|
6001 |
||
15783 | 6002 |
dirName := dir physicalPathName. "take care of symbolic links" |
11392 | 6003 |
|
6004 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
19117 | 6005 |
^ self |
10641 | 6006 |
]. |
6007 |
||
12377 | 6008 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
19117 | 6009 |
^ self. |
10641 | 6010 |
]. |
12377 | 6011 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
19117 | 6012 |
^ self. |
10641 | 6013 |
]. |
11392 | 6014 |
|
15783 | 6015 |
maxLevels == 0 ifTrue:[ |
19117 | 6016 |
Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName). |
6017 |
^ self |
|
15783 | 6018 |
]. |
6019 |
||
6020 |
dirsConsulted add:dirName. |
|
10641 | 6021 |
noAutoloadHere := noAutoloadIn. |
6022 |
noAutoloadHere ifFalse:[ |
|
19117 | 6023 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
6024 |
noAutoloadHere := true. |
|
6025 |
]. |
|
10641 | 6026 |
] ifTrue:[ |
19117 | 6027 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
6028 |
noAutoloadHere := false. |
|
6029 |
]. |
|
10641 | 6030 |
]. |
6031 |
||
11393 | 6032 |
showSplashInLevels >= 0 ifTrue:[ |
19117 | 6033 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
6034 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6035 |
]. |
6036 |
||
10641 | 6037 |
"/ |
6038 |
"/ suppress installation as autoloaded in this and everything |
|
6039 |
"/ below; however, still traverse the directories to find packages ... |
|
6040 |
"/ |
|
15596 | 6041 |
haveAbbrevDotSTC := false. |
10641 | 6042 |
noAutoloadHere ifFalse:[ |
19117 | 6043 |
[ |
6044 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
6045 |
haveAbbrevDotSTC := true. |
|
6046 |
] on:FileStream openErrorSignal |
|
6047 |
do:[:ex| |
|
6048 |
"ignore this file" |
|
6049 |
]. |
|
10641 | 6050 |
]. |
6051 |
||
6052 |
[ |
|
19117 | 6053 |
directoryContents := dir directoryContents. |
10641 | 6054 |
] on:FileStream openErrorSignal do:[:ex| |
19117 | 6055 |
"non-accessible directory: we are done" |
6056 |
^ self |
|
16199 | 6057 |
]. |
6058 |
||
6059 |
directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set. |
|
10641 | 6060 |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6061 |
directoryContents removeAllFoundIn:#( |
19117 | 6062 |
'objbc' 'objvc' 'objmingw' |
6063 |
'doc' |
|
6064 |
'CVS' |
|
6065 |
'bitmaps' |
|
6066 |
'resources' |
|
6067 |
'source' |
|
6068 |
'not_delivered' |
|
6069 |
'not_ported' |
|
6070 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6071 |
dir baseName = 'stx' ifTrue:[ |
19117 | 6072 |
directoryContents removeAllFoundIn:#( |
6073 |
'configurations' |
|
6074 |
'include' |
|
6075 |
'rules' |
|
6076 |
'stc' |
|
6077 |
'support' |
|
6078 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6079 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6080 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
6081 |
directoryContents do:[:eachFilenameString | |
19117 | 6082 |
|f| |
6083 |
||
6084 |
f := dir / eachFilenameString. |
|
6085 |
f isDirectory ifTrue:[ |
|
6086 |
self |
|
6087 |
recursiveInstallAutoloadedClassesFrom:f |
|
6088 |
rememberIn:dirsConsulted |
|
6089 |
maxLevels:maxLevels-1 |
|
6090 |
noAutoload:noAutoloadHere |
|
6091 |
packageTop:packageTopPath |
|
6092 |
showSplashInLevels:showSplashInLevels - 1. |
|
6093 |
] ifFalse:[ |
|
6094 |
(noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[ |
|
6095 |
f suffix = 'st' ifTrue:[ |
|
6096 |
[ |
|
6097 |
self installAutoloadedClassFromSourceFile:f. |
|
6098 |
f directory baseName = 'libbasic' ifTrue:[self halt]. |
|
6099 |
] on:FileStream openErrorSignal do:[:ex| |
|
6100 |
"ignore this file, but write a warning" |
|
6101 |
Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description). |
|
6102 |
]. |
|
6103 |
] |
|
6104 |
]. |
|
6105 |
] |
|
10641 | 6106 |
]. |
6107 |
||
11393 | 6108 |
showSplashInLevels >= 0 ifTrue:[ |
19117 | 6109 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
6110 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 6111 |
]. |
6112 |
||
10641 | 6113 |
" |
6114 |
Smalltalk installAutoloadedClasses |
|
6115 |
" |
|
6116 |
||
15596 | 6117 |
"Modified: / 01-08-2013 / 16:57:49 / cg" |
10641 | 6118 |
! |
6119 |
||
6120 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6121 |
"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
|
6122 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6123 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
6124 |
|
10641 | 6125 |
|toAdd| |
6126 |
||
6127 |
toAdd := OrderedCollection new. |
|
6128 |
self keysAndValuesDo:[:key :val | |
|
18668 | 6129 |
(key == anObject) ifTrue:[ |
6130 |
self shouldImplement. |
|
6131 |
]. |
|
6132 |
(val == anObject ) ifTrue:[ |
|
6133 |
toAdd add:(key -> newRef) |
|
6134 |
]. |
|
10641 | 6135 |
]. |
6136 |
toAdd do:[:each | |
|
18668 | 6137 |
self at:(each key) put:(each value) |
10641 | 6138 |
]. |
6139 |
! |
|
6140 |
||
6141 |
saveEmergencyImage:aBoolean |
|
6142 |
"set/clear the flag which controls if ST/X should save an |
|
6143 |
emergency image in case of a broken display connection. |
|
6144 |
The default is true. |
|
6145 |
This may be useful, if you work with an unsecure display |
|
6146 |
(serial line), and want to have a chance of proceeding after |
|
6147 |
a crash. In multiheaded applications, this only affects |
|
6148 |
crashes of the master Display connection (the initial connection); |
|
6149 |
errors on other displays are reported to the views and treated |
|
6150 |
like window destroy from the windowManager." |
|
6151 |
||
6152 |
SaveEmergencyImage := aBoolean |
|
6153 |
||
6154 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
6155 |
! |
|
6156 |
||
6157 |
systemOrganization |
|
6158 |
"for partial ST80 compatibility; |
|
6159 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
6160 |
keeps track of class-categories, while all classes return a classOrganizer |
|
6161 |
from #organization, which keeps track of method categories of that class. |
|
6162 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
6163 |
To make a workaround possible, use #systemOrganization when porting |
|
6164 |
VW apps to ST/X to get the class-categories. |
|
6165 |
Read the documentation in SystemOrganizer for more info." |
|
6166 |
||
6167 |
^ SystemOrganizer for:nil |
|
6168 |
||
6169 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
6170 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6171 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6172 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6173 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6174 |
|
10641 | 6175 |
fileIn:aFileName |
6176 |
"read in the named file - look for it in some standard places; |
|
6177 |
return true if ok, false if failed. |
|
6178 |
This method can load almost anything which makes sense: |
|
18668 | 6179 |
.st - source files |
6180 |
.cls - binary smalltalk bytecode files |
|
6181 |
.so - binary compiled machine code class libraries |
|
6182 |
[.class - java bytecode -- soon to come]" |
|
10641 | 6183 |
|
6184 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
6185 |
||
6186 |
" |
|
6187 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
6188 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
6189 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
6190 |
" |
|
6191 |
||
6192 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
6193 |
! |
|
6194 |
||
6195 |
fileIn:aFileName inPackage:aPackageID |
|
6196 |
"read in the named file in a packages directory." |
|
6197 |
||
6198 |
|dir| |
|
6199 |
||
6200 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
6201 |
dir isNil ifTrue:[^ false]. |
|
6202 |
||
6203 |
dir := dir asFilename. |
|
6204 |
^ (self fileIn:(dir construct:aFileName)) |
|
6205 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
6206 |
! |
|
6207 |
||
6208 |
fileIn:aFileName lazy:lazy |
|
6209 |
"read in the named file - look for it in some standard places; |
|
6210 |
return true if ok, false if failed. |
|
6211 |
If lazy is true, no code is generated for methods, instead stubs |
|
6212 |
are created which compile themself when first executed. This allows |
|
6213 |
for much faster fileIn (but slows down the first execution later). |
|
6214 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6215 |
code which is known to be syntactically correct." |
|
6216 |
||
6217 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
6218 |
||
6219 |
" |
|
6220 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
6221 |
" |
|
6222 |
||
6223 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6224 |
! |
|
6225 |
||
6226 |
fileIn:aFileName lazy:lazy silent:silent |
|
6227 |
"read in the named file - look for it in some standard places; |
|
6228 |
return true if ok, false if failed. |
|
6229 |
If lazy is true, no code is generated for methods, instead stubs |
|
6230 |
are created which compile themself when first executed. This allows |
|
6231 |
for much faster fileIn (but slows down the first execution later). |
|
6232 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6233 |
code which is known to be syntactically correct. |
|
6234 |
If silent is true, no compiler messages are output to the transcript. |
|
6235 |
Giving nil for silent/lazy will use the current settings." |
|
6236 |
||
6237 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
6238 |
||
6239 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
6240 |
! |
|
6241 |
||
6242 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
6243 |
"read in the named file - look for it in some standard places; |
|
6244 |
return true if ok, false if failed. |
|
6245 |
If lazy is true, no code is generated for methods, instead stubs |
|
6246 |
are created which compile themself when first executed. This allows |
|
6247 |
for much faster fileIn (but slows down the first execution later). |
|
6248 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6249 |
code which is known to be syntactically correct. |
|
6250 |
If silent is true, no compiler messages are output to the transcript. |
|
6251 |
Giving nil for silent/lazy will use the current settings. |
|
6252 |
This method can load almost anything which makes sense: |
|
18668 | 6253 |
.st - source files |
6254 |
.cls - binary smalltalk bytecode files |
|
6255 |
.so - binary compiled machine code class libraries |
|
6256 |
[.class - java bytecode -- soon to come]" |
|
15594 | 6257 |
|
15665 | 6258 |
|fileNameString inStream path morePath bos| |
10641 | 6259 |
|
6260 |
fileNameString := aFileNameOrString asString. |
|
6261 |
||
6262 |
" |
|
6263 |
an object or shared object ? |
|
6264 |
" |
|
6265 |
(ObjectFileLoader notNil |
|
6266 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
18668 | 6267 |
"/ LoadBinaries ifFalse:[^ false]. |
6268 |
path := self getBinaryFileName:fileNameString. |
|
6269 |
path isNil ifTrue:[ |
|
6270 |
path := self getSystemFileName:fileNameString. |
|
6271 |
]. |
|
6272 |
path isNil ifTrue:[^ false]. |
|
6273 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
15594 | 6274 |
]. |
6275 |
||
6276 |
inStream := self systemFileStreamFor:fileNameString. |
|
6277 |
inStream isNil ifTrue:[^ false]. |
|
10641 | 6278 |
|
6279 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
18668 | 6280 |
BinaryObjectStorage notNil ifTrue:[ |
6281 |
[ |
|
6282 |
inStream binary. |
|
6283 |
bos := BinaryObjectStorage onOld:inStream. |
|
6284 |
bos next. |
|
6285 |
] ensure:[ |
|
6286 |
bos close. |
|
6287 |
]. |
|
6288 |
^ true |
|
6289 |
]. |
|
6290 |
^ false |
|
15594 | 6291 |
]. |
10641 | 6292 |
|
6293 |
(fileNameString includes:$/) ifTrue:[ |
|
18668 | 6294 |
"/ temporarily prepend the file's directory |
6295 |
"/ to the searchPath. |
|
6296 |
"/ This allows fileIn-driver files to refer to local |
|
6297 |
"/ files via a relative path, and drivers to fileIn other |
|
6298 |
"/ drivers ... |
|
6299 |
morePath := inStream pathName asFilename directoryName. |
|
15594 | 6300 |
]. |
15665 | 6301 |
^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath |
15594 | 6302 |
|
6303 |
" |
|
6304 |
Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true |
|
6305 |
Smalltalk fileIn:'keyboard.rc' |
|
10641 | 6306 |
" |
6307 |
||
6308 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
6309 |
! |
|
6310 |
||
6311 |
fileIn:aFileName logged:logged |
|
6312 |
"read in the named file - look for it in some standard places; |
|
6313 |
return true if ok, false if failed. |
|
6314 |
The argument logged controls, if the changefile is to be updated." |
|
6315 |
||
6316 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
6317 |
||
6318 |
" |
|
6319 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
6320 |
" |
|
6321 |
! |
|
6322 |
||
6323 |
fileIn:aFileName silent:silent |
|
6324 |
"read in the named file - look for it in some standard places; |
|
6325 |
return true if ok, false if failed. |
|
6326 |
If silent is true, no compiler messages are output to the transcript." |
|
6327 |
||
6328 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
6329 |
||
6330 |
" |
|
6331 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
6332 |
" |
|
6333 |
||
6334 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
6335 |
! |
|
6336 |
||
6337 |
fileInChanges |
|
6338 |
"read in the last changes file - bringing the system to the state it |
|
6339 |
had when left the last time. |
|
6340 |
WARNING: this method is rubbish: it should only read things after the |
|
18668 | 6341 |
last '**snapshot**' - entry |
6342 |
(instead of the complete changes file)." |
|
10641 | 6343 |
|
6344 |
" |
|
6345 |
do NOT update the changes file now ... |
|
6346 |
" |
|
6347 |
self fileIn:ChangeFileName logged:false |
|
6348 |
||
6349 |
" |
|
10071 | 6350 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6351 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6352 |
! |
1 | 6353 |
|
10641 | 6354 |
fileInClass:aClassName |
6355 |
"find a source/object file for aClassName and -if found - load it. |
|
6356 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6357 |
finally source file (.st) in that order. |
|
6358 |
The file is first searched for using the class name, then the abbreviated name." |
|
6359 |
||
6360 |
^ self |
|
18668 | 6361 |
fileInClass:aClassName |
6362 |
package:nil |
|
6363 |
initialize:true |
|
6364 |
lazy:false |
|
6365 |
silent:nil |
|
10641 | 6366 |
|
6367 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
6368 |
! |
|
6369 |
||
6370 |
fileInClass:aClassName fromObject:aFileName |
|
6371 |
"read in the named object file and dynamic-link it into the system |
|
6372 |
- look for it in some standard places. |
|
6373 |
Only install the named class from this object file. |
|
6374 |
Return true if ok, false if failed." |
|
6375 |
||
6376 |
|path ok| |
|
6377 |
||
6378 |
" |
|
6379 |
check if the dynamic loader class is in |
|
6380 |
" |
|
6381 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
6382 |
||
6383 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
6384 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
6385 |
ok ifTrue:[ |
|
18668 | 6386 |
VerboseLoading ifTrue:[ |
6387 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
6388 |
] |
|
10641 | 6389 |
]. |
6390 |
^ ok |
|
6391 |
||
6392 |
" |
|
6393 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
6394 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
6395 |
" |
|
6396 |
||
13814 | 6397 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 6398 |
! |
6399 |
||
6400 |
fileInClass:aClassName initialize:doInit |
|
6401 |
"find a source/object file for aClassName and -if found - load it. |
|
6402 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6403 |
finally source file (.st) in that order. |
|
6404 |
The file is first searched for using the class name, then the abbreviated name." |
|
6405 |
||
6406 |
^ self |
|
18668 | 6407 |
fileInClass:aClassName |
6408 |
package:nil |
|
6409 |
initialize:doInit |
|
6410 |
lazy:false |
|
6411 |
silent:nil |
|
10641 | 6412 |
|
6413 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
6414 |
! |
|
6415 |
||
6416 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
6417 |
"find a source/object file for aClassName and -if found - load it. |
|
6418 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6419 |
finally source file (.st) in that order. |
|
6420 |
The file is first searched for using the class name, then the abbreviated name." |
|
6421 |
||
6422 |
^ self |
|
18668 | 6423 |
fileInClass:aClassName |
6424 |
package:nil |
|
6425 |
initialize:doInit |
|
6426 |
lazy:loadLazy |
|
6427 |
silent:nil |
|
10641 | 6428 |
|
6429 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
6430 |
! |
|
6431 |
||
6432 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
6433 |
"find a source/object file for aClassName and -if found - load it. |
|
6434 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
6435 |
finally source file (.st), in that order. |
|
6436 |
The file is first searched for using the class name, then the abbreviated name. |
|
6437 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6438 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6439 |
should not send notes to the transcript; it can be true, false or nil, where |
6440 |
nil uses the value from SilentLoading." |
|
6441 |
||
6442 |
^ self |
|
19867 | 6443 |
fileInClass:aClassName |
6444 |
package:nil |
|
6445 |
initialize:doInit |
|
6446 |
lazy:loadLazy |
|
6447 |
silent:beSilent |
|
10641 | 6448 |
|
6449 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
6450 |
! |
|
6451 |
||
6452 |
fileInClass:aClassName package:package |
|
6453 |
"find a source/object file for aClassName and -if found - load it. |
|
6454 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
6455 |
finally source file (.st) in that order. |
|
6456 |
The file is first searched for using the class name, then the abbreviated name." |
|
6457 |
||
6458 |
^ self |
|
18668 | 6459 |
fileInClass:aClassName |
6460 |
package:package |
|
6461 |
initialize:true |
|
6462 |
lazy:false |
|
6463 |
silent:nil |
|
10641 | 6464 |
|
6465 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
6466 |
! |
|
6467 |
||
10999 | 6468 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 6469 |
"find a source/object file for aClassName and -if found - load it. |
6470 |
This is the workhorse for autoloading. |
|
10999 | 6471 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 6472 |
finally source file (.st), in that order. |
6473 |
The file is first searched for using the class name, then the abbreviated name. |
|
6474 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
19867 | 6475 |
load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler |
10641 | 6476 |
should not send notes to the transcript; it can be true, false or nil, where |
6477 |
nil uses the value from SilentLoading." |
|
6478 |
||
10999 | 6479 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
10641 | 6480 |
filenameToSet packageDir packageFile bos| |
6481 |
||
17588 | 6482 |
ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[ |
17582 | 6483 |
|
19867 | 6484 |
wasLazy := Compiler compileLazy:loadLazy. |
6485 |
beSilent notNil ifTrue:[ |
|
6486 |
wasSilent := self silentLoading:beSilent. |
|
6487 |
]. |
|
6488 |
||
6489 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
6490 |
(classFileName = aClassName) ifTrue:[ |
|
6491 |
"/ no abbrev.stc translation for className |
|
6492 |
(aClassName includes:$:) ifTrue:[ |
|
6493 |
"/ a nameSpace name |
|
6494 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
6495 |
]. |
|
6496 |
]. |
|
6497 |
||
6498 |
classFileName asFilename isAbsolute ifTrue:[ |
|
6499 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
|
6500 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
6501 |
] ifFalse:[ |
|
6502 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
6503 |
] |
|
6504 |
] ifFalse:[ |
|
6505 |
classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName. |
|
6506 |
[ |
|
6507 |
Class withoutUpdatingChangesDo:[ |
|
6508 |
|zarFn zar entry| |
|
6509 |
||
6510 |
ok := false. |
|
6511 |
||
6512 |
package notNil ifTrue:[ |
|
6513 |
packageDir := package asPackageId packageDirectory. |
|
6514 |
"/ packageDir := package asString. |
|
6515 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
6516 |
packageDir isNil ifTrue:[ |
|
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
6517 |
packageDir := self getPackageDirectoryForPackage:package |
19867 | 6518 |
]. |
6519 |
packageDir notNil ifTrue:[ |
|
6520 |
packageDir := packageDir asFilename. |
|
6521 |
]. |
|
6522 |
]. |
|
6523 |
||
6524 |
Class packageQuerySignal answer:package do:[ |
|
6525 |
" |
|
6526 |
then, if dynamic linking is available, |
|
6527 |
" |
|
6528 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
6529 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
|
6530 |
" |
|
6531 |
first look for a class packages shared binary in binary/xxx.o |
|
6532 |
" |
|
6533 |
libName := self libraryFileNameOfClass:aClassName. |
|
6534 |
libName notNil ifTrue:[ |
|
6535 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
|
6536 |
ifFalse:[ |
|
6537 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6538 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
6539 |
] |
|
6540 |
]. |
|
6541 |
]. |
|
6542 |
" |
|
6543 |
then, look for a shared binary in binary/xxx.o |
|
6544 |
" |
|
6545 |
ok ifFalse:[ |
|
6546 |
(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) |
|
6547 |
ifFalse:[ |
|
6548 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6549 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
6550 |
]. |
|
6551 |
ok ifFalse:[ |
|
6552 |
alternativeClassFileName notNil ifTrue:[ |
|
6553 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
|
6554 |
ifFalse:[ |
|
6555 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
6556 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
6557 |
] |
|
6558 |
] |
|
6559 |
]. |
|
6560 |
]. |
|
6561 |
]. |
|
6562 |
]. |
|
6563 |
]. |
|
6564 |
||
6565 |
" |
|
6566 |
if that did not work, look for a compiled-bytecode file ... |
|
6567 |
" |
|
6568 |
ok ifFalse:[ |
|
6569 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
6570 |
ifFalse:[ |
|
6571 |
alternativeClassFileName notNil ifTrue:[ |
|
6572 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
6573 |
] |
|
6574 |
] |
|
6575 |
]. |
|
6576 |
" |
|
6577 |
if that did not work, and the classes package is known, |
|
6578 |
look for an st-cls file |
|
6579 |
in a package subdir of the source-directory ... |
|
6580 |
" |
|
6581 |
ok ifFalse:[ |
|
6582 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
6583 |
packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls'). |
|
6584 |
packageFile isNil ifTrue:[ |
|
6585 |
packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'. |
|
6586 |
]. |
|
6587 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
6588 |
ifFalse:[ |
|
6589 |
alternativeClassFileName notNil ifTrue:[ |
|
6590 |
packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6591 |
packageFile isNil ifTrue:[ |
|
6592 |
packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls'). |
|
6593 |
]. |
|
6594 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
6595 |
] |
|
6596 |
]. |
|
6597 |
||
6598 |
zarFn := self getPackageFileName:(packageDir / 'classes.zip'). |
|
6599 |
zarFn notNil ifTrue:[ |
|
6600 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6601 |
zar notNil ifTrue:[ |
|
6602 |
entry := zar extract:(classFileName , '.cls'). |
|
6603 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6604 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
6605 |
]. |
|
6606 |
entry notNil ifTrue:[ |
|
6607 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
6608 |
bos next. |
|
6609 |
bos close. |
|
6610 |
ok := true |
|
6611 |
]. |
|
6612 |
] |
|
6613 |
] |
|
6614 |
] |
|
6615 |
]. |
|
6616 |
||
6617 |
" |
|
6618 |
if that did not work, look for an st-source file ... |
|
6619 |
" |
|
6620 |
ok ifFalse:[ |
|
6621 |
filenameToSet := classFileName. |
|
6622 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6623 |
ifFalse:[ |
|
6624 |
alternativeClassFileName notNil ifTrue:[ |
|
6625 |
filenameToSet := alternativeClassFileName. |
|
6626 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6627 |
]. |
|
6628 |
ok ifFalse:[ |
|
6629 |
" |
|
6630 |
... and in the standard source-directory |
|
6631 |
" |
|
6632 |
filenameToSet := 'source' asFilename / classFileName. |
|
6633 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6634 |
ifFalse:[ |
|
6635 |
alternativeClassFileName notNil ifTrue:[ |
|
6636 |
filenameToSet := 'source' asFilename / alternativeClassFileName. |
|
6637 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6638 |
] |
|
6639 |
] |
|
6640 |
] |
|
6641 |
]. |
|
6642 |
" |
|
6643 |
if that did not work, and the classes package is known, |
|
6644 |
look for an st-source file |
|
6645 |
in a package subdir of the source-directory ... |
|
6646 |
" |
|
6647 |
ok ifFalse:[ |
|
6648 |
packageDir notNil ifTrue:[ |
|
6649 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName). |
|
6650 |
packageFile isNil ifTrue:[ |
|
6651 |
packageFile := (packageDir / 'source' / classFileName). |
|
6652 |
]. |
|
6653 |
filenameToSet := packageFile. |
|
6654 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6655 |
ifFalse:[ |
|
6656 |
alternativeClassFileName notNil ifTrue:[ |
|
6657 |
packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName). |
|
6658 |
packageFile isNil ifTrue:[ |
|
6659 |
packageFile := (packageDir / 'source' / alternativeClassFileName). |
|
6660 |
]. |
|
6661 |
filenameToSet := packageFile. |
|
6662 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6663 |
]. |
|
6664 |
ok ifFalse:[ |
|
6665 |
packageFile := self getPackageSourceFileName:(packageDir / classFileName). |
|
6666 |
packageFile isNil ifTrue:[ |
|
6667 |
packageFile := (packageDir / classFileName). |
|
6668 |
]. |
|
6669 |
filenameToSet := packageFile. |
|
6670 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
6671 |
ifFalse:[ |
|
6672 |
alternativeClassFileName notNil ifTrue:[ |
|
6673 |
packageFile := self getPackageFileName:(packageDir / alternativeClassFileName). |
|
6674 |
packageFile isNil ifTrue:[ |
|
6675 |
packageFile := packageDir / alternativeClassFileName. |
|
6676 |
]. |
|
6677 |
filenameToSet := packageFile. |
|
6678 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
6679 |
]. |
|
6680 |
ok ifFalse:[ |
|
6681 |
" |
|
6682 |
... and in the standard source-directory |
|
6683 |
" |
|
6684 |
filenameToSet := 'source' asFilename / packageDir / classFileName. |
|
6685 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
6686 |
ifFalse:[ |
|
6687 |
alternativeClassFileName notNil ifTrue:[ |
|
6688 |
filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName. |
|
6689 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
6690 |
] |
|
6691 |
] |
|
6692 |
] |
|
6693 |
]. |
|
6694 |
]. |
|
6695 |
]. |
|
6696 |
] |
|
6697 |
]. |
|
6698 |
" |
|
6699 |
if that did not work, and the classes package is known, |
|
6700 |
look for a zipArchive containing a class entry. |
|
6701 |
" |
|
6702 |
ok ifFalse:[ |
|
6703 |
packageDir notNil ifTrue:[ |
|
6704 |
zarFn := self getPackageFileName:(packageDir / 'source.zip'). |
|
6705 |
zarFn isNil ifTrue:[ |
|
6706 |
zarFn := packageDir withSuffix:'zip'. |
|
6707 |
zarFn := self getSourceFileName:zarFn. |
|
6708 |
]. |
|
6709 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
|
6710 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6711 |
zar notNil ifTrue:[ |
|
6712 |
entry := zar extract:(classFileName , '.st'). |
|
6713 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6714 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
6715 |
]. |
|
6716 |
entry notNil ifTrue:[ |
|
6717 |
filenameToSet := zarFn. |
|
6718 |
ok := self |
|
6719 |
fileInStream:(entry asString readStream) |
|
6720 |
lazy:loadLazy |
|
6721 |
silent:beSilent |
|
6722 |
logged:false |
|
6723 |
addPath:nil |
|
6724 |
]. |
|
6725 |
] |
|
6726 |
] |
|
6727 |
] |
|
6728 |
]. |
|
6729 |
||
6730 |
" |
|
6731 |
if that did not work, |
|
6732 |
look for a zipArchive containing a class entry. |
|
6733 |
" |
|
6734 |
ok ifFalse:[ |
|
6735 |
zarFn := self getSourceFileName:'source.zip'. |
|
6736 |
zarFn notNil ifTrue:[ |
|
6737 |
zar := ZipArchive oldFileNamed:zarFn. |
|
6738 |
zar notNil ifTrue:[ |
|
6739 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
6740 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
6741 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
6742 |
]. |
|
6743 |
entry notNil ifTrue:[ |
|
6744 |
filenameToSet := zarFn. |
|
6745 |
ok := self |
|
6746 |
fileInStream:(entry asString readStream) |
|
6747 |
lazy:loadLazy |
|
6748 |
silent:beSilent |
|
6749 |
logged:false |
|
6750 |
addPath:nil |
|
6751 |
]. |
|
6752 |
] |
|
6753 |
] |
|
6754 |
]. |
|
6755 |
ok ifFalse:[ |
|
6756 |
" |
|
6757 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
6758 |
" |
|
6759 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
6760 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
|
6761 |
inStream notNil ifTrue:[ |
|
6762 |
filenameToSet := nil. |
|
6763 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
6764 |
] |
|
6765 |
]. |
|
6766 |
]. |
|
6767 |
]. |
|
6768 |
] |
|
6769 |
]. |
|
6770 |
] ensure:[ |
|
6771 |
Compiler compileLazy:wasLazy. |
|
6772 |
wasSilent notNil ifTrue:[ |
|
6773 |
self silentLoading:wasSilent |
|
6774 |
] |
|
6775 |
]. |
|
6776 |
]. |
|
6777 |
||
6778 |
ok ifTrue:[ |
|
6779 |
newClass := self at:(aClassName asSymbol). |
|
6780 |
newClass notNil ifTrue:[ |
|
6781 |
"set the classes name - but do not change if already set" |
|
6782 |
filenameToSet notNil ifTrue:[ |
|
6783 |
newClass getClassFilename isNil ifTrue:[ |
|
6784 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
6785 |
]. |
|
6786 |
]. |
|
6787 |
||
6788 |
doInit ifTrue:[ |
|
6789 |
newClass initialize |
|
6790 |
] |
|
6791 |
] |
|
6792 |
]. |
|
10641 | 6793 |
]. |
6794 |
||
6795 |
^ newClass |
|
6796 |
||
13415 | 6797 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
6798 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
6799 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
6800 |
"Modified: / 28-06-2016 / 07:52:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 6801 |
! |
6802 |
||
6803 |
fileInClassLibrary:aClassLibraryName |
|
6804 |
"find an object file containing a binary class library in some standard places |
|
6805 |
and load it. This install all of its contained classes. |
|
6806 |
Return true if ok, false if not. |
|
6807 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6808 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6809 |
make the caller independent of the underlying operatingSystem." |
|
10641 | 6810 |
|
6811 |
|path fn| |
|
6812 |
||
16144 | 6813 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6814 |
^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'. |
16144 | 6815 |
]. |
10641 | 6816 |
|
6817 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6818 |
fn := fn pathName. |
|
6819 |
||
6820 |
path := self getBinaryFileName:fn. |
|
6821 |
path isNil ifTrue:[ |
|
18668 | 6822 |
path := self getSystemFileName:fn. |
16144 | 6823 |
]. |
6824 |
path isNil ifTrue:[ |
|
18668 | 6825 |
^ PackageNotFoundError raiseRequestWith:aClassLibraryName. |
16144 | 6826 |
]. |
6827 |
||
6828 |
(ObjectFileLoader loadObjectFile:path) isNil ifTrue:[ |
|
18668 | 6829 |
^ PackageLoadError raiseRequestWith:aClassLibraryName. |
16144 | 6830 |
]. |
6831 |
^ true. |
|
6832 |
||
10641 | 6833 |
|
6834 |
" |
|
6835 |
Smalltalk fileInClassLibrary:'libtable' |
|
6836 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6837 |
" |
|
6838 |
||
6839 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
6840 |
! |
|
6841 |
||
6842 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
6843 |
"find an object file containing a binary class library in some standard places |
|
6844 |
and load it. This installs all of its contained classes. |
|
6845 |
Return true if ok, false if not. |
|
6846 |
Notice: the argument may not have an extension (by purpose); |
|
18668 | 6847 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
6848 |
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
|
6849 |
|
11690 | 6850 |
|baseName handle libraryFilename packagePath| |
10641 | 6851 |
|
16144 | 6852 |
ObjectFileLoader isNil ifTrue:[ |
18668 | 6853 |
^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader' |
16144 | 6854 |
]. |
10641 | 6855 |
|
6856 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
6857 |
baseName exists ifTrue:[ |
|
18668 | 6858 |
"/ load local file first... |
6859 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6860 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6861 |
handle isNil ifTrue:[ |
18668 | 6862 |
packagePath := self getPackageDirectoryForPackage:packageID. |
6863 |
packagePath isNil ifTrue:[ |
|
6864 |
^ PackageNotFoundError raiseRequestWith:packageID. |
|
6865 |
]. |
|
6866 |
packagePath := packagePath asFilename. |
|
6867 |
libraryFilename := packagePath / baseName. |
|
6868 |
libraryFilename exists ifFalse:[ |
|
6869 |
libraryFilename := nil. |
|
6870 |
#('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir | |
|
6871 |
"in windows, with Borland compiler, DLLs in development environment are under objbc; |
|
6872 |
with MSVC, they are under objvc" |
|
6873 |
libraryFilename isNil ifTrue:[ |
|
6874 |
libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName. |
|
6875 |
libraryFilename exists ifFalse:[ libraryFilename := nil ] |
|
6876 |
]. |
|
6877 |
]. |
|
6878 |
]. |
|
6879 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
6880 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
6881 |
]. |
|
16144 | 6882 |
]. |
6883 |
||
6884 |
handle isNil ifTrue:[ |
|
18668 | 6885 |
^ PackageNotFoundError raiseRequestWith:packageID. |
16144 | 6886 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6887 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6888 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
6889 |
"/ ]. |
16144 | 6890 |
^ true. |
10641 | 6891 |
|
6892 |
" |
|
6893 |
Smalltalk fileInClassLibrary:'libtable' |
|
6894 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
6895 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
6896 |
" |
|
6897 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
6898 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
10641 | 6899 |
! |
6900 |
||
15073 | 6901 |
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent |
18562
d0cc0d0cfffd
Reverted change a37464a68e70 as it breaks autoloading/source loading.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18561
diff
changeset
|
6902 |
"Try all available programming languages" |
13415 | 6903 |
|
15073 | 6904 |
|filename| |
6905 |
||
6906 |
filename := filenameArg asFilename. |
|
18668 | 6907 |
"/ 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
|
6908 |
"/ | f | |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6909 |
"/ |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6910 |
"/ "/ 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
|
6911 |
"/ "/ 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
|
6912 |
"/ (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
|
6913 |
"/ (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
|
6914 |
"/ ^ true |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6915 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6916 |
"/ ] |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6917 |
"/ ]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6918 |
"/ 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
|
6919 |
ProgrammingLanguage allDo:[:lang| | f | |
18668 | 6920 |
f := (filename hasSuffix:lang sourceFileSuffix) |
6921 |
ifTrue:[filename] |
|
6922 |
ifFalse:[filename addSuffix:lang sourceFileSuffix]. |
|
6923 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
6924 |
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
|
6925 |
]. |
b088a44b9681
\"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents:
18560
diff
changeset
|
6926 |
|
15073 | 6927 |
^ false |
13415 | 6928 |
|
6929 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
6930 |
! |
|
6931 |
||
10641 | 6932 |
fileInStream:streamArg |
6933 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
6934 |
! |
|
6935 |
||
6936 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
6937 |
"read sourceCode from aStream; |
|
6938 |
return true if ok, false if failed. |
|
6939 |
If lazy is true, no code is generated for methods, instead stubs |
|
6940 |
are created which compile themself when first executed. This allows |
|
6941 |
for much faster fileIn (but slows down the first execution later). |
|
6942 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6943 |
code which is known to be syntactically correct. |
|
6944 |
If silent is true, no compiler messages are output to the transcript. |
|
6945 |
Giving nil for silent/lazy will use the current settings. |
|
6946 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
6947 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
6948 |
using a relative path." |
|
6949 |
||
11427 | 6950 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 6951 |
|
6952 |
inStream := streamArg. |
|
6953 |
inStream isNil ifTrue:[^ false]. |
|
19385 | 6954 |
inStream isLineNumberReadStream ifFalse:[ |
20588 | 6955 |
LineNumberReadStream notNil ifTrue:[ |
6956 |
"/ sigh - is in libbasic2, which is not always present |
|
6957 |
inStream := LineNumberReadStream on:inStream. |
|
6958 |
]. |
|
19385 | 6959 |
]. |
12611
38d61d374d89
care for nonPositionable stream (stdin) in fileIn
Claus Gittinger <cg@exept.de>
parents:
12557
diff
changeset
|
6960 |
inStream := EncodedStream isNil |
18669 | 6961 |
ifTrue:[ inStream ] |
6962 |
ifFalse:[ EncodedStream decodedStreamFor:inStream ]. |
|
10641 | 6963 |
|
6964 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
6965 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
6966 |
morePath notNil ifTrue:[ |
|
18669 | 6967 |
oldSystemPath := SystemPath copy. |
6968 |
SystemPath addFirst:morePath. |
|
6969 |
oldRealPath := RealSystemPath. |
|
6970 |
RealSystemPath := nil. |
|
6971 |
]. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
6972 |
|
10641 | 6973 |
[ |
18669 | 6974 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
6975 |
"JV: Changed to give ProgrammingLanguage to choose |
|
6976 |
proper reader" |
|
6977 |
(ProgrammingLanguage forStream: inStream) fileInStream: inStream |
|
6978 |
] |
|
10641 | 6979 |
] ensure:[ |
18669 | 6980 |
morePath notNil ifTrue:[ |
6981 |
"take care, someone could have changed SystemPath during fileIn!!" |
|
6982 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
|
6983 |
SystemPath := oldSystemPath. |
|
6984 |
RealSystemPath := oldRealPath. |
|
6985 |
] ifFalse:[ |
|
6986 |
(oldSystemPath includes:morePath) ifFalse:[ |
|
6987 |
SystemPath remove:morePath ifAbsent:[]. |
|
6988 |
]. |
|
6989 |
RealSystemPath := nil. |
|
6990 |
]. |
|
6991 |
]. |
|
6992 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
|
6993 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
6994 |
inStream close |
|
10641 | 6995 |
]. |
6996 |
^ true |
|
6997 |
||
6998 |
" |
|
6999 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
7000 |
" |
|
7001 |
||
13415 | 7002 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
7003 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 7004 |
! |
7005 |
||
7006 |
isClassLibraryLoaded:name |
|
7007 |
"return true, if a particular class library is already loaded" |
|
7008 |
||
7009 |
ObjectMemory |
|
18668 | 7010 |
binaryModuleInfo |
7011 |
do:[:entry | |
|
7012 |
entry type == #classLibrary ifTrue:[ |
|
7013 |
entry libraryName = name ifTrue:[ |
|
7014 |
^ true "/ already loaded |
|
7015 |
] |
|
7016 |
]. |
|
7017 |
]. |
|
10641 | 7018 |
|
7019 |
^ false |
|
7020 |
||
7021 |
" |
|
7022 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
7023 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
7024 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
7025 |
" |
|
7026 |
||
7027 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
7028 |
! |
|
7029 |
||
7030 |
loadClassLibraryIfAbsent:name |
|
7031 |
"dynamically load a classLibrary, if not already loaded |
|
7032 |
and the system supports dynamic loading. |
|
7033 |
Return true, if the library is loaded, false if not. |
|
7034 |
This entry is called without system specific filename |
|
7035 |
extensions - it is portable among different architectures |
|
7036 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
7037 |
are be present ..." |
|
7038 |
||
7039 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
7040 |
^ self fileInClassLibrary:name |
|
7041 |
||
7042 |
" |
|
7043 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
7044 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
7045 |
" |
|
7046 |
||
7047 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
7048 |
! |
|
7049 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7050 |
secureFileIn:aFileName |
10641 | 7051 |
"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
|
7052 |
Catch various errors during fileIn. |
13000 | 7053 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7054 |
|
10641 | 7055 |
|retVal| |
7056 |
||
16025 | 7057 |
Parser isNil ifTrue:[^ false]. "/ for small stand alone apps. |
10641 | 7058 |
retVal := false. |
16025 | 7059 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7060 |
(SignalSet |
18668 | 7061 |
with:AbortOperationRequest |
7062 |
with:TerminateProcessRequest |
|
7063 |
with:Parser parseErrorSignal) |
|
7064 |
handle:[:ex | ex return ] |
|
7065 |
do:[ retVal := self fileIn:aFileName ]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7066 |
^ retVal |
10641 | 7067 |
! |
7068 |
||
7069 |
silentFileIn:aFilename |
|
7070 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
7071 |
Main use is during startup." |
|
7072 |
||
13353 | 7073 |
self silentlyLoadingDo:[ |
18668 | 7074 |
self fileIn:aFilename |
13353 | 7075 |
]. |
3044 | 7076 |
! ! |
7077 |
||
7078 |
!Smalltalk class methodsFor:'system management-files'! |
|
7079 |
||
20663 | 7080 |
addIdeTopDirectoryToPackagePath |
7081 |
"{ Pragma: +optSpace }" |
|
7082 |
||
7083 |
|topDirectory| |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7084 |
|
20663 | 7085 |
(topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[ |
7086 |
topDirectory := topDirectory asFilename. |
|
7087 |
(topDirectory directory / 'stc') exists ifTrue:[ |
|
7088 |
topDirectory := topDirectory directory. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7089 |
] ifFalse:[ |
20663 | 7090 |
(topDirectory directory directory / 'stc') exists ifTrue:[ |
7091 |
topDirectory := topDirectory directory directory. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7092 |
] ifFalse:[ |
20663 | 7093 |
(topDirectory directory directory directory / 'stc') exists ifTrue:[ |
7094 |
topDirectory := topDirectory directory directory directory. |
|
7095 |
] ifFalse:[ |
|
7096 |
topDirectory := nil |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7097 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7098 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7099 |
]. |
20663 | 7100 |
topDirectory notNil ifTrue:[ |
7101 |
"/ one above "stx" |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7102 |
topDirectory := topDirectory directory pathName. |
20663 | 7103 |
(PackagePath includes:topDirectory) ifFalse:[ |
7104 |
PackagePath add:topDirectory |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7105 |
] |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7106 |
] |
20663 | 7107 |
]. |
7108 |
! |
|
7109 |
||
18868 | 7110 |
addWorkspaceDirectoryToPackagePath |
7111 |
"{ Pragma: +optSpace }" |
|
7112 |
||
7113 |
|workspaceDirectory| |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7114 |
|
18868 | 7115 |
(workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[ |
7116 |
(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[ |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7117 |
workspaceDirectory := workspaceDirectory pathName. |
20663 | 7118 |
(PackagePath includes:workspaceDirectory) ifFalse:[ |
7119 |
PackagePath addFirst:workspaceDirectory |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7120 |
] |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
7121 |
] |
18868 | 7122 |
]. |
7123 |
! |
|
7124 |
||
10641 | 7125 |
bitmapFileStreamFor:aFileName |
7126 |
"search aFileName in some standard places; |
|
7127 |
return a readonly fileStream or nil if not found. |
|
7128 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
7129 |
Notice: this does not look in the package-specific bitmaps directories." |
|
7130 |
||
7131 |
|aString| |
|
7132 |
||
7133 |
aString := self getBitmapFileName:aFileName. |
|
7134 |
aString notNil ifTrue:[ |
|
18668 | 7135 |
^ aString asFilename readStreamOrNil |
10641 | 7136 |
]. |
7137 |
^ nil |
|
7138 |
! |
|
7139 |
||
7140 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
7141 |
"backward compatibility: |
|
7142 |
search aFileName in some standard places: |
|
7143 |
first in the redefinable bitmaps path, |
|
7144 |
then in the classes own package directory if existing. |
|
7145 |
Return an image or nil." |
|
7146 |
||
7147 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
7148 |
||
7149 |
" |
|
7150 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7151 |
" |
|
7152 |
! |
|
7153 |
||
7154 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
7155 |
"backward compatibility: |
|
7156 |
search aFileName in some standard places: |
|
7157 |
first in the redefinable bitmaps path, |
|
7158 |
then in the package directory if existing. |
|
7159 |
Return an image or nil." |
|
7160 |
||
7161 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
7162 |
||
7163 |
" |
|
7164 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7165 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7166 |
" |
|
7167 |
! |
|
7168 |
||
7169 |
classNameForFile:aFileName |
|
7170 |
"return the className which corresponds to an abbreviated fileName, |
|
7171 |
or nil if no special translation applies. The given filename arg may |
|
7172 |
include a '.st' suffix (but no other)." |
|
7173 |
||
7174 |
|fn| |
|
7175 |
||
7176 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
18668 | 7177 |
fn := aFileName copyButLast:3 |
10641 | 7178 |
] ifFalse:[ |
18668 | 7179 |
fn := aFileName |
10641 | 7180 |
]. |
7181 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
7182 |
||
7183 |
" |
|
7184 |
Smalltalk classNameForFile:'DrawObj' |
|
7185 |
Smalltalk classNameForFile:'DrawObj.st' |
|
7186 |
Smalltalk classNameForFile:'ArrColl.st' |
|
7187 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
7188 |
" |
|
7189 |
||
7190 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
7191 |
! |
|
7192 |
||
7193 |
constructPathFor:aDirectoryName |
|
7194 |
"search for aDirectory in SystemPath; |
|
20294 | 7195 |
return a collection of paths which include that directory." |
10641 | 7196 |
|
7197 |
^ self realSystemPath select:[:dirName | |
|
20294 | 7198 |
|fullPath| |
7199 |
||
7200 |
fullPath := dirName asFilename construct:aDirectoryName. |
|
7201 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
|
7202 |
fullPath isDirectory and:[fullPath isReadable] |
|
10641 | 7203 |
]. |
7204 |
! |
|
7205 |
||
7206 |
fileInFileStreamFor:aFileName |
|
7207 |
"obsolete |
|
7208 |
search aFileName in some standard places; |
|
7209 |
return a readonly fileStream or nil if not found. |
|
7210 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
7211 |
||
7212 |
|aString| |
|
7213 |
||
7214 |
aString := self getFileInFileName:aFileName. |
|
7215 |
aString notNil ifTrue:[ |
|
18668 | 7216 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7217 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7218 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7219 |
! |
7758 | 7220 |
|
12022 | 7221 |
fileNameForClass:aClassOrClassName |
7222 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
7223 |
- only the base name (without directory part) and without suffix." |
|
7224 |
||
15958 | 7225 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg | |
12022 | 7226 |
|
12301 | 7227 |
"/ This was added as an extension of libsvn - should be no longer needed |
15958 | 7228 |
"/ JV@2012-09-25: but it actually is. The problem is that class filename |
7229 |
"/ is stored in the class itself and used to generate abbrev.stc and |
|
7230 |
"/ prerequisites in makefiles. But if you renamed such a stc-compiled class, |
|
7231 |
"/ the filename remains the same, but SVN __ALWAYS__ keep container name |
|
7232 |
"/ and class name in sync. Therefore build files gets messed up. Indeed, this |
|
7233 |
"/ should be fixed in code that files-out the package and generates build files. |
|
7234 |
"/ Certainly a hack, but do not remove this until fixed elsewhere |
|
7235 |
||
7236 |
compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'. |
|
7237 |
(compatQuery notNil |
|
7238 |
and:[compatQuery isLoaded |
|
18668 | 7239 |
and:[compatQuery query not]]) ifTrue:[ |
7240 |
nm := aClassOrClassName isBehavior |
|
7241 |
ifTrue:[aClassOrClassName name] |
|
7242 |
ifFalse:[aClassOrClassName]. |
|
7243 |
nm := nm copyReplaceAll:$: with:$_ ifNone:nm. |
|
7244 |
^nm |
|
15958 | 7245 |
]. |
7246 |
||
16122
18c865388947
Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
16117
diff
changeset
|
7247 |
"/ 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
|
7248 |
"/ 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
|
7249 |
"/ 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
|
7250 |
"/ of classes OUTSIDE filed-out package when generating makefile dependencies. |
15958 | 7251 |
compatQuery := Smalltalk classNamed: 'SCMCompatModeQuery'. |
7252 |
(compatQuery notNil |
|
7253 |
and:[compatQuery isLoaded |
|
18668 | 7254 |
and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[ |
7255 |
| compatPkgs | |
|
7256 |
"/ Originally libscm could only fileout one package at time so |
|
7257 |
"/ the query answered one package name. However, to support nested |
|
7258 |
"/ packages, libscm is being rewritten to commit multiple packages |
|
7259 |
"/ at once, so query answers a collection of packages. The code below |
|
7260 |
"/ makes sure it works for both. |
|
7261 |
compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ]. |
|
7262 |
nm := aClassOrClassName isBehavior |
|
7263 |
ifTrue:[aClassOrClassName name] |
|
7264 |
ifFalse:[aClassOrClassName]. |
|
7265 |
cls := Smalltalk at: nm asSymbol. |
|
7266 |
(cls notNil and:[compatPkgs includes: cls package]) ifTrue:[ |
|
7267 |
nm := nm copyReplaceAll:$: with:$_. |
|
7268 |
^nm |
|
7269 |
]. |
|
15958 | 7270 |
]. |
12301 | 7271 |
|
12022 | 7272 |
aClassOrClassName isBehavior ifTrue:[ |
18668 | 7273 |
cls := aClassOrClassName. |
12022 | 7274 |
] ifFalse:[ |
18668 | 7275 |
cls := Smalltalk classNamed:aClassOrClassName. |
7276 |
cls isNil ifTrue:[ |
|
7277 |
nameWithPrefix := aClassOrClassName. |
|
7278 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
|
7279 |
]. |
|
12022 | 7280 |
]. |
7281 |
||
7282 |
cls notNil ifTrue:[ |
|
18668 | 7283 |
nonMetaclass := cls theNonMetaclass. |
7284 |
nm := nonMetaclass getClassFilename. |
|
7285 |
nm isNil ifTrue:[ |
|
7286 |
|revisionInfo| |
|
7287 |
||
7288 |
(revisionInfo := cls revisionInfo) notNil ifTrue:[ |
|
7289 |
nm := revisionInfo fileName. |
|
7290 |
]. |
|
7291 |
]. |
|
7292 |
nm notNil ifTrue:[ |
|
7293 |
^ nm asFilename withoutSuffix baseName |
|
7294 |
]. |
|
7295 |
nameWithPrefix := nonMetaclass name. |
|
7296 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
|
12022 | 7297 |
]. |
7298 |
||
7299 |
CachedAbbreviations notNil ifTrue:[ |
|
18668 | 7300 |
nameWithPrefix := nameWithPrefix asSymbol. |
7301 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
|
7302 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
|
7303 |
]. |
|
7304 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
|
7305 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
|
7306 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
|
7307 |
]. |
|
12022 | 7308 |
]. |
7309 |
||
7310 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
7311 |
||
7312 |
" |
|
7313 |
Smalltalk fileNameForClass:#Complex |
|
7314 |
Smalltalk fileNameForClass:'SmallInteger' |
|
7315 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
7316 |
Smalltalk fileNameForClass:'Launcher' |
|
7317 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
7318 |
||
7319 |
Smalltalk fileNameForClass:HTML::Encoder |
|
7320 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
7321 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
7322 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
7323 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
7324 |
" |
|
7325 |
||
7326 |
"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
|
7327 |
"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
|
7328 |
"Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12022 | 7329 |
! |
7330 |
||
10641 | 7331 |
filenameAbbreviations |
7332 |
"return a dictionary containing the classname-to-filename |
|
7333 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
7334 |
to 14 chars)" |
|
7335 |
||
7336 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 7337 |
self readAbbreviations |
10641 | 7338 |
]. |
7339 |
^ CachedAbbreviations |
|
7340 |
||
7341 |
"flush with: |
|
7342 |
||
7343 |
CachedAbbreviations := nil |
|
7344 |
" |
|
7345 |
" |
|
7346 |
Smalltalk filenameAbbreviations |
|
7347 |
" |
|
7348 |
! |
|
7349 |
||
13368 | 7350 |
findPackageDirectoryForPackage:aPackage |
7351 |
"find a packages directory along a number of standard places" |
|
7352 |
||
7353 |
|relDir| |
|
7354 |
||
7355 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
7356 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
7357 |
||
7358 |
^ Smalltalk getPackageFileName:relDir. |
|
7359 |
||
7360 |
" |
|
7361 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
7362 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
7363 |
" |
|
7364 |
! |
|
7365 |
||
10641 | 7366 |
flushPathCaches |
7367 |
"{ Pragma: +optSpace }" |
|
7368 |
||
7369 |
"forget pathCaches - these are collections containing valid directory names, |
|
7370 |
where system files (resource, bitmaps etc.) are found. |
|
7371 |
A flush is only required, if a new system directory has been created while |
|
7372 |
the system is active, and those files should override the others |
|
7373 |
(for example, if you created a private resource directory)" |
|
7374 |
||
7375 |
RealSystemPath := ResourcePath := SourcePath := |
|
15332 | 7376 |
BinaryPath := FileInPath := nil. |
7377 |
||
10641 | 7378 |
" |
7379 |
Smalltalk flushPathCaches |
|
7380 |
" |
|
7381 |
! |
|
7382 |
||
7383 |
getBinaryFileName:aFileName |
|
7384 |
"obsolete |
|
7385 |
search aFileName in some standard places |
|
7386 |
(subdirectories named 'binary' in SystemPath); |
|
7387 |
return the absolute filename or nil if none is found." |
|
7388 |
||
7389 |
BinaryPath isNil ifTrue:[ |
|
18668 | 7390 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 7391 |
]. |
7392 |
||
7393 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
7394 |
||
7395 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
7396 |
! |
|
7397 |
||
7398 |
getBitmapFileName:aFileName |
|
7399 |
"for backward compatibility: |
|
7400 |
search aFileName in some standard places |
|
7401 |
(subdirectories named 'bitmaps' in SystemPath); |
|
7402 |
Return the pathName or nil if none is found." |
|
7403 |
||
7404 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
7405 |
||
7406 |
" |
|
7407 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
7408 |
" |
|
7409 |
||
7410 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
7411 |
! |
|
7412 |
||
7413 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
7414 |
"for backward compatibility. |
|
7415 |
search aFileName in some standard places: |
|
7416 |
first in the redefinable bitmaps path, |
|
7417 |
then in the package directory if existing. |
|
7418 |
Return a path or nil. |
|
7419 |
Search order is: |
|
18668 | 7420 |
bitmaps/<pkg>/file |
7421 |
resources/<pkg>/bitmaps/file |
|
7422 |
<pkg>/bitmaps/file |
|
10641 | 7423 |
" |
7424 |
||
7425 |
|f dir packageDir pF| |
|
7426 |
||
15225 | 7427 |
f := aFileName asString withoutPrefix:'bitmaps/'. |
10641 | 7428 |
|
7429 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7430 |
"/ this will be an error in the future |
10641 | 7431 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
7432 |
"/ self halt. |
|
7433 |
||
18668 | 7434 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
7435 |
pF notNil ifTrue:[ |
|
7436 |
^ pF. |
|
7437 |
]. |
|
7438 |
f ~= aFileName ifTrue:[ |
|
7439 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
|
7440 |
pF notNil ifTrue:[ |
|
7441 |
^ pF. |
|
7442 |
]. |
|
7443 |
]. |
|
7444 |
^ nil |
|
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7445 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7446 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7447 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7448 |
dir notNil ifTrue:[ |
18668 | 7449 |
pF := dir asFilename / f. |
7450 |
pF exists ifTrue:[ |
|
7451 |
^ pF. |
|
7452 |
]. |
|
7453 |
pF := dir asFilename / 'bitmaps' /f. |
|
7454 |
pF exists ifTrue:[ |
|
7455 |
^ pF. |
|
7456 |
]. |
|
10641 | 7457 |
]. |
7458 |
||
7459 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7460 |
||
7461 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
7462 |
pF notNil ifTrue:[ |
|
18668 | 7463 |
^ pF. |
10641 | 7464 |
]. |
7465 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
7466 |
pF notNil ifTrue:[ |
|
18668 | 7467 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7468 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
7469 |
|
10641 | 7470 |
^ nil |
7471 |
||
7472 |
" |
|
7473 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7474 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7475 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7476 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7477 |
" |
|
7478 |
||
7479 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
7480 |
! |
|
7481 |
||
7482 |
getFileInFileName:aFileName |
|
7483 |
"obsolete |
|
7484 |
search aFileName in some standard places |
|
7485 |
(subdirectories named 'fileIn' in SystemPath); |
|
7486 |
return the absolute filename or nil if none is found." |
|
7487 |
||
7488 |
FileInPath isNil ifTrue:[ |
|
18668 | 7489 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 7490 |
]. |
7491 |
||
7492 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
7493 |
||
7494 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
7495 |
! |
|
7496 |
||
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7497 |
getPackageDirectoryForPackage:aPackageId |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7498 |
"Return a directory containing a given package (its resoruces, bitmaps, sources and |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7499 |
other files). |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7500 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7501 |
The directory is looked up as following: |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7502 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7503 |
* package path is searched. If found, matching directory is returned. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7504 |
(see #packagePath and #initPackagePath) |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7505 |
* then directories named 'packages' under system path are searched. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7506 |
If found, matching directory is returned. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7507 |
(see #systemPath and #initSystemPath) |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7508 |
* Otherwise, nil is returned (meaning no package directory for given package |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7509 |
is found) |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7510 |
" |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7511 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7512 |
|packageDirName packageDir| |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7513 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7514 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7515 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7516 |
packageDir := self getPackageFileName:packageDirName. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7517 |
packageDir isNil ifTrue:[ |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7518 |
^ nil. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7519 |
]. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7520 |
^ packageDir asFilename |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7521 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7522 |
" |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7523 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7524 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7525 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
10641 | 7526 |
" |
7527 |
||
7528 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
7529 |
"Modified: / 28-06-2016 / 07:31:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 7530 |
! |
7531 |
||
7532 |
getPackageFileName:aFileName |
|
7533 |
"search aFileName in some standard places |
|
7534 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
7535 |
return the absolute filename or nil if none is found." |
|
7536 |
||
7537 |
|f| |
|
7538 |
||
7539 |
"/ search along packagePath ... |
|
7540 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
7541 |
f isNil ifTrue:[ |
|
18668 | 7542 |
"/ search under packages-directory along systemPath ... |
7543 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
|
7544 |
"/ kludge - allow for stx-directory to be named differently |
|
7545 |
f isNil ifTrue:[ |
|
7546 |
(aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[ |
|
7547 |
f := '..' asFilename / '..' / (aFileName copyFrom:5). |
|
7548 |
] |
|
7549 |
]. |
|
10641 | 7550 |
]. |
7551 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
18668 | 7552 |
^ f pathName |
7758 | 7553 |
]. |
7554 |
^ nil |
|
10641 | 7555 |
|
7556 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7557 |
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
|
7558 |
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
|
7559 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
10641 | 7560 |
" |
7561 |
! |
|
7562 |
||
15074 | 7563 |
getPackageSourceFileName:filenameWithoutSuffixArg |
13415 | 7564 |
"search aFileName in some standard places and try all available languages" |
7565 |
||
15074 | 7566 |
|filenameWithoutSuffix| |
7567 |
||
7568 |
filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename. |
|
7569 |
||
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
7570 |
ProgrammingLanguage |
18668 | 7571 |
allDo:[:lang | |
7572 |
|file| |
|
7573 |
||
7574 |
file := self |
|
7575 |
getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix). |
|
7576 |
file notNil ifTrue:[ ^ file ] |
|
7577 |
]. |
|
15074 | 7578 |
^ nil |
13415 | 7579 |
|
7580 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
7581 |
! |
|
7582 |
||
10641 | 7583 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7584 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7585 |
|
10641 | 7586 |
"search aFileName in some standard places |
7587 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7588 |
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
|
7589 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7590 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7591 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 7592 |
^ self getResourceFileName:aFileName forPackage:nil |
7593 |
||
7594 |
" |
|
7595 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
7596 |
" |
|
7597 |
||
7598 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
7599 |
! |
|
7600 |
||
7601 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
7602 |
"search aFileName in some standard places |
|
7603 |
(subdirectories named 'resource' in SystemPath); |
|
7604 |
and in aClasses package directory. |
|
7605 |
Return the absolute filename or nil if none is found." |
|
7606 |
||
7607 |
|pkgOrNil| |
|
7608 |
||
7609 |
aClassOrNil notNil ifTrue:[ |
|
18668 | 7610 |
pkgOrNil := aClassOrNil package. |
10641 | 7611 |
]. |
7612 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
7613 |
||
7614 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7615 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 7616 |
" |
7617 |
! |
|
7618 |
||
7619 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
7620 |
"search aFileName in some standard places |
|
7621 |
(subdirectories named 'resource' in SystemPath); |
|
7622 |
and in a packages directory. |
|
7623 |
Return the absolute filename or nil if none is found. |
|
7624 |
Search order is: |
|
18668 | 7625 |
resources/<pkg>/file |
7626 |
<pkg>/resources/file |
|
10641 | 7627 |
" |
7628 |
||
7629 |
|pF f dir packageDir| |
|
7630 |
||
15225 | 7631 |
f := aFileName asString withoutPrefix:'resources/'. |
10641 | 7632 |
|
7633 |
aPackageIDOrNil isNil ifTrue:[ |
|
18668 | 7634 |
"/ this will be an error in the future |
10641 | 7635 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
7636 |
"/ self halt. |
|
7637 |
||
18668 | 7638 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
7639 |
pF notNil ifTrue:[ |
|
7640 |
^ pF. |
|
7641 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7642 |
"/ 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
|
7643 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7644 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7645 |
"/ ]. |
18668 | 7646 |
f ~= aFileName ifTrue:[ |
7647 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
|
7648 |
pF notNil ifTrue:[ |
|
7649 |
^ pF. |
|
7650 |
]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7651 |
"/ 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
|
7652 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7653 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7654 |
"/ ]. |
18668 | 7655 |
]. |
7656 |
^ nil |
|
10641 | 7657 |
]. |
7658 |
||
7659 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
7660 |
||
7661 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
|
7662 |
pF notNil ifTrue:[ |
|
18668 | 7663 |
^ pF. |
10641 | 7664 |
]. |
7665 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7666 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 7667 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
7668 |
dir notNil ifTrue:[ |
|
18668 | 7669 |
dir := dir asFilename. |
7670 |
||
7671 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7672 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 7673 |
|
18668 | 7674 |
"resolve something like: 'ASN/definition.asn1'" |
7675 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
|
12377 | 7676 |
]. |
7677 |
||
10641 | 7678 |
^ nil |
7679 |
||
7680 |
" |
|
7681 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
7682 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
7683 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7684 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 7685 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
7686 |
" |
|
7687 |
||
7688 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
7689 |
! |
|
7690 |
||
7691 |
getSourceFileName:aFileName |
|
7692 |
"search aFileName in some standard places |
|
7693 |
(subdirectories named 'source' in SystemPath); |
|
7694 |
return the absolute filename or nil if none is found. |
|
7695 |
This is used to find a sourceFile for a methods source, |
|
7696 |
if no sourceCodeManager is available." |
|
7697 |
||
7698 |
|f| |
|
7699 |
||
7700 |
SourcePath isNil ifTrue:[ |
|
18668 | 7701 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 7702 |
]. |
7703 |
||
7704 |
"/ first, try a source subdir along the path. |
|
7705 |
SourcePath notNil ifTrue:[ |
|
18668 | 7706 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 7707 |
]. |
7708 |
f isNil ifTrue:[ |
|
18668 | 7709 |
"/ then, try it itself along the path. |
7710 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
|
10641 | 7711 |
]. |
7712 |
^ f |
|
7713 |
||
7714 |
" |
|
7715 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
7716 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
7717 |
" |
|
7718 |
||
7719 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
7720 |
! |
|
7721 |
||
7722 |
getSystemFileName:aFileNameOrString |
|
7723 |
"search aFileNameOrString in some standard places; |
|
7724 |
return the absolute filename or nil if none is found. |
|
7725 |
see comment in Smalltalk>>initSystemPath. |
|
7726 |
This should be used to access resources such as bitmaps, doc-files, |
|
7727 |
and other help files. |
|
7728 |
" |
|
7729 |
||
7730 |
"credits for this method go to Markus ...." |
|
7731 |
||
7732 |
|fn nameString| |
|
7733 |
||
7734 |
fn := aFileNameOrString asFilename. |
|
7735 |
nameString := fn name. |
|
7736 |
fn isAbsolute ifTrue:[ |
|
20811 | 7737 |
"don't use path for absolute file names" |
7738 |
||
7739 |
^ nameString |
|
10641 | 7740 |
]. |
7741 |
||
7742 |
self realSystemPath do:[:dirName | |
|
20811 | 7743 |
|realName| |
7744 |
||
7745 |
realName := dirName asFilename / nameString. |
|
7746 |
"/ |
|
7747 |
"/ here, we also return true if its a directory |
|
7748 |
"/ (Even if unreadable). |
|
7749 |
"/ It could be that the file itself is still readable. |
|
7750 |
"/ |
|
7751 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
|
7752 |
^ realName name |
|
7753 |
] |
|
10641 | 7754 |
]. |
7755 |
^ nil |
|
7756 |
||
7757 |
" |
|
7758 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
7759 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
7760 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
7761 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
7762 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
7763 |
" |
|
7764 |
||
7765 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
7766 |
! |
|
7767 |
||
7768 |
imageFromFileNamed:aFileName forClass:aClass |
|
7769 |
"search aFileName in some standard places: |
|
7770 |
first in the redefinable bitmaps path, then in the classes |
|
7771 |
own package directory if existing. |
|
7772 |
Return an image or nil." |
|
7773 |
||
7774 |
|classPackage img| |
|
7775 |
||
7776 |
classPackage := aClass package. |
|
7777 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
7778 |
img isNil ifTrue:[ |
|
18668 | 7779 |
"/ try under the goodies package ... |
7780 |
classPackage ~= 'stx:goodies' ifTrue:[ |
|
7781 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
|
7782 |
] |
|
10641 | 7783 |
]. |
7784 |
^ img |
|
7785 |
||
7786 |
" |
|
7787 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
7788 |
" |
|
7789 |
! |
|
7790 |
||
7791 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
7792 |
"search aFileName in some standard places: |
|
7793 |
first in the redefinable bitmaps path, |
|
7794 |
then in the package directory if existing. |
|
7795 |
Return an image or nil. |
|
7796 |
Search order is: |
|
18668 | 7797 |
bitmaps/<pkg>/file |
7798 |
resources/<pkg>/bitmaps/file |
|
7799 |
<pkg>/bitmaps/file |
|
10641 | 7800 |
" |
7801 |
||
7802 |
|path| |
|
7803 |
||
7804 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
7805 |
path notNil ifTrue:[ |
|
18668 | 7806 |
^ Image fromFile:path. |
10641 | 7807 |
]. |
7808 |
^ nil |
|
7809 |
||
7810 |
" |
|
7811 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
7812 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
7813 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
7814 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
7815 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
7816 |
" |
|
7817 |
||
7818 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
7819 |
! |
|
7820 |
||
7821 |
libraryFileNameOfClass:aClassOrClassName |
|
7822 |
"for a given class, return the name of a classLibrary which contains |
|
7823 |
binary code for it. |
|
7824 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
7825 |
for an entry for aClassOrClassName. |
|
7826 |
Search for the className in the first col, and return the value found in |
|
7827 |
the 2nd col. |
|
7828 |
Return nil if no entry is found. |
|
7829 |
||
7830 |
A nil returns means that this class is either built-in or not present |
|
7831 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
7832 |
Otherwise, the returned name is the classLibrary object of that class. |
|
7833 |
The classes code can be loaded from that file if binary loading is supported." |
|
7834 |
||
7835 |
|aStream line words n aClassName| |
|
7836 |
||
7837 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 7838 |
aClassName := aClassOrClassName name |
10641 | 7839 |
] ifFalse:[ |
18668 | 7840 |
aClassName := aClassOrClassName |
10641 | 7841 |
]. |
7842 |
aClassName := aClassName asString. |
|
7843 |
||
7844 |
#('include/liblist.stc') "/ filenames |
|
7845 |
with:#(2) "/ column |
|
7846 |
do:[:fileName :col | |
|
7847 |
||
18668 | 7848 |
aStream := self systemFileStreamFor:fileName. |
7849 |
aStream notNil ifTrue:[ |
|
7850 |
[aStream atEnd] whileFalse:[ |
|
7851 |
line := aStream nextLine. |
|
7852 |
line notNil ifTrue:[ |
|
7853 |
(line startsWith:'#') ifFalse:[ |
|
7854 |
words := line asCollectionOfWords. |
|
7855 |
(n := words size) > 1 ifTrue:[ |
|
7856 |
(words at:1) = aClassName ifTrue:[ |
|
7857 |
n >= col ifTrue:[ |
|
7858 |
aStream close. |
|
7859 |
^ (words at:col) withoutSeparators |
|
7860 |
] |
|
7861 |
] |
|
7862 |
] |
|
7863 |
] |
|
7864 |
] |
|
7865 |
]. |
|
7866 |
aStream close |
|
7867 |
]. |
|
10641 | 7868 |
]. |
7869 |
||
7870 |
^ nil |
|
7871 |
||
7872 |
" |
|
7873 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
7874 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
7875 |
" |
|
7876 |
||
7877 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
7878 |
! |
|
7879 |
||
7880 |
packagePath |
|
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7881 |
"Return a list directory names, where smalltalk looks for packages, |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7882 |
that is, the list of directories searched when a package load is |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7883 |
requested via #loadPackage:. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7884 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7885 |
To add a new entry to a package path, do |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7886 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7887 |
Smalltalk packagePath add: '/path/to/some/directory'. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7888 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7889 |
See comment of Smalltalk class>>initPackagePath for default package path. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7890 |
|
10641 | 7891 |
Notice, that directories named 'packages' under the systemPath are |
7892 |
always consulted - even if not in the packagePath" |
|
7893 |
||
20640 | 7894 |
^ PackagePath ? #() |
10641 | 7895 |
|
7896 |
" |
|
7897 |
Smalltalk packagePath |
|
7898 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
7899 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
7900 |
" |
|
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7901 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7902 |
"Modified (comment): / 25-06-2016 / 16:44:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 7903 |
! |
7904 |
||
7905 |
packagePath:aPath |
|
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7906 |
"set the 'packagePath', a list of directories where smalltalk |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7907 |
looks for packages. See #packagePath and #initPackagePath |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7908 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7909 |
Setting package path this way is rarely necessary, to add more |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7910 |
directories you may do |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7911 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7912 |
Smalltalk packagePath add: '/path/to/some/directory'. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7913 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7914 |
ALso note, that directories named 'packages' under the systemPath are |
10641 | 7915 |
always consulted - even if not in the packagePath" |
7916 |
||
7917 |
PackagePath := aPath asOrderedCollection |
|
7918 |
||
7919 |
" |
|
7920 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
7921 |
" |
|
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7922 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
7923 |
"Modified (format): / 26-06-2016 / 05:31:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10641 | 7924 |
! |
7925 |
||
7926 |
projectDirectoryForClass:aClass |
|
7927 |
"given a class, return the path to its package directory; |
|
7928 |
nil if not found." |
|
7929 |
||
7930 |
|pkg| |
|
7931 |
||
7932 |
pkg := aClass package. |
|
7933 |
pkg isNil ifTrue:[^ nil]. |
|
7934 |
||
7935 |
^ self projectDirectoryForPackage:pkg. |
|
7936 |
||
7937 |
" |
|
7938 |
Smalltalk projectDirectoryForClass:Array |
|
7939 |
Smalltalk projectDirectoryForClass:View |
|
7940 |
" |
|
7941 |
! |
|
7942 |
||
7943 |
projectDirectoryForPackage:aPackage |
|
7944 |
"given a packageID, return the path to its package directory; |
|
7945 |
nil if not found." |
|
7946 |
||
7947 |
|prj prjDir| |
|
7948 |
||
16642 | 7949 |
^ aPackage asPackageId packageDirectory. |
7950 |
||
10641 | 7951 |
"/ there might be a package specific resource directory ... |
7952 |
"/ in the directory, from which the project was loaded |
|
7953 |
prj := Project projectWithId:aPackage. |
|
7954 |
prj notNil ifTrue:[ |
|
18668 | 7955 |
prjDir := prj directory. |
10641 | 7956 |
]. |
7957 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
18668 | 7958 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 7959 |
]. |
7960 |
^ prjDir |
|
7961 |
||
7962 |
" |
|
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7963 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
10641 | 7964 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
16668
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7965 |
Smalltalk projectDirectoryForPackage:'stx' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7966 |
Smalltalk projectDirectoryForPackage:'bosch' |
b88318df967d
flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents:
16666
diff
changeset
|
7967 |
Smalltalk projectDirectoryForPackage:'bosch:foo' |
10641 | 7968 |
" |
7969 |
||
7970 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
7971 |
! |
|
7972 |
||
7973 |
readAbbreviations |
|
7974 |
"read classname to filename mappings from include/abbrev.stc. |
|
7975 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
7976 |
||
7977 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
7978 |
||
7979 |
CachedAbbreviations := IdentityDictionary new. |
|
7980 |
self installAutoloadedClasses. |
|
7981 |
^ CachedAbbreviations. |
|
7982 |
||
7983 |
" |
|
7984 |
Smalltalk readAbbreviations |
|
7985 |
" |
|
7986 |
||
7987 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
7988 |
! |
|
7989 |
||
7990 |
readAbbreviationsFromStream:aStream |
|
7991 |
"read classname to filename mappings from aStream. |
|
7992 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
7993 |
||
11375 | 7994 |
self |
18668 | 7995 |
withAbbreviationsFromStream:aStream |
7996 |
do:[:className :abbrev :pkg | |
|
7997 |
self setFilename:abbrev forClass:className package:pkg. |
|
7998 |
]. |
|
10641 | 7999 |
|
8000 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
8001 |
! |
|
8002 |
||
8003 |
realSystemPath |
|
16642 | 8004 |
"return the realSystemPath - that's the directory names from |
10641 | 8005 |
SystemPath which exist and are readable" |
8006 |
||
8007 |
|nP| |
|
8008 |
||
8009 |
RealSystemPath isNil ifTrue:[ |
|
18668 | 8010 |
OperatingSystem isVMSlike ifTrue:[ |
8011 |
"/ temporary kludge: since we cannot currently |
|
8012 |
"/ check for existence of a name like 'volume:', |
|
8013 |
"/ leave those in the Path without a check. |
|
8014 |
RealSystemPath := SystemPath select:[:dirName | |f| |
|
8015 |
f := dirName asFilename. |
|
8016 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
|
8017 |
] |
|
8018 |
] ifFalse:[ |
|
8019 |
RealSystemPath := SystemPath |
|
8020 |
select:[:eachDirectoryName | |f| |
|
8021 |
f := eachDirectoryName asFilename. |
|
8022 |
(f isDirectory) and:[f isReadable] |
|
8023 |
] thenCollect:[:eachDirectoryName| |
|
8024 |
eachDirectoryName asFilename pathName. |
|
8025 |
]. |
|
8026 |
||
8027 |
"/ remove duplicates (but keep order) |
|
8028 |
nP := OrderedCollection new. |
|
8029 |
RealSystemPath do:[:p | |
|
8030 |
(nP includes:p) ifFalse:[ |
|
8031 |
nP add:p |
|
8032 |
] |
|
8033 |
]. |
|
8034 |
(nP includes:'.') ifFalse:[ |
|
8035 |
nP add:'.' |
|
8036 |
]. |
|
8037 |
RealSystemPath := nP. |
|
8038 |
]. |
|
617 | 8039 |
]. |
8040 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8041 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8042 |
|
10641 | 8043 |
recursiveReadAllAbbreviationsFrom:aDirectory |
8044 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
8045 |
! |
|
8046 |
||
8047 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
8048 |
"read all abbreviations from and under aDirectory." |
|
8049 |
||
8050 |
|abbrevStream dir directoryContents| |
|
8051 |
||
8052 |
maxLevels == 0 ifTrue:[ |
|
8053 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
19117 | 8054 |
^ self |
10641 | 8055 |
]. |
8056 |
||
8057 |
dir := aDirectory asFilename. |
|
8058 |
dir exists ifFalse:[^ self]. |
|
8059 |
||
8060 |
[ |
|
19117 | 8061 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
8062 |
self readAbbreviationsFromStream:abbrevStream. |
|
8063 |
abbrevStream close. |
|
10641 | 8064 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
8065 |
||
8066 |
[ |
|
19117 | 8067 |
directoryContents := dir directoryContents. |
10641 | 8068 |
] on:FileStream openErrorSignal do:[:ex| |
19117 | 8069 |
"non-accessible directory: we are done" |
8070 |
^ self |
|
10641 | 8071 |
]. |
8072 |
||
8073 |
directoryContents do:[:aFilename | |
|
19117 | 8074 |
|f| |
8075 |
||
8076 |
(#( |
|
8077 |
'doc' |
|
8078 |
'CVS' |
|
8079 |
'bitmaps' |
|
8080 |
'resources' |
|
8081 |
'source' |
|
8082 |
) includes:aFilename) ifFalse:[ |
|
8083 |
f := dir / aFilename. |
|
8084 |
f isDirectory ifTrue:[ |
|
8085 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
|
8086 |
] |
|
8087 |
]. |
|
4458 | 8088 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8089 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8090 |
|
15334 | 8091 |
reinitializePackagePath |
8092 |
"{ Pragma: +optSpace }" |
|
20207 | 8093 |
|
15334 | 8094 |
PackagePath notNil ifTrue:[ |
18868 | 8095 |
PackagePath := PackagePath select:[:p | p asFilename exists]. |
15334 | 8096 |
]. |
8097 |
PackagePath isEmptyOrNil ifTrue:[ |
|
20073
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
8098 |
self initSystemPath |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
8099 |
]. |
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
8100 |
|
17bf4a096c2e
Issue #98: Refactored package path initialization to #initPackagePath.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19967
diff
changeset
|
8101 |
"Modified: / 25-06-2016 / 16:36:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
15334 | 8102 |
! |
8103 |
||
13368 | 8104 |
relativePackagePathForPackage:aPackage |
8105 |
|path| |
|
8106 |
||
8107 |
PackageToPathMapping notNil ifTrue:[ |
|
18668 | 8108 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
8109 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
13370 | 8110 |
]. |
8111 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 8112 |
|
8113 |
" |
|
8114 |
PackageToPathMapping := Dictionary new. |
|
8115 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
8116 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
8117 |
||
8118 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
8119 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
8120 |
" |
|
8121 |
! |
|
8122 |
||
10641 | 8123 |
resourceDirectoryForPackage:aPackage |
8124 |
"given a packageID, return the path to its resource directory; |
|
8125 |
nil if not found." |
|
8126 |
||
8127 |
|prjDir rsrcDir| |
|
8128 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
8129 |
aPackage notNil ifTrue:[ |
18668 | 8130 |
prjDir := self projectDirectoryForPackage:aPackage. |
8131 |
||
8132 |
(prjDir notNil |
|
8133 |
and:[(prjDir := prjDir asFilename) exists |
|
8134 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
|
8135 |
^ rsrcDir |
|
8136 |
]. |
|
8137 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
|
8138 |
rsrcDir notNil ifTrue:[ |
|
8139 |
^ rsrcDir asFilename |
|
8140 |
]. |
|
10641 | 8141 |
]. |
8142 |
^ nil |
|
8143 |
||
8144 |
" |
|
8145 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
8146 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
8147 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
8148 |
" |
|
8149 |
! |
|
8150 |
||
8151 |
resourceFileStreamFor:aFileName |
|
8152 |
"search aFileName in some standard places; |
|
8153 |
return a readonly fileStream or nil if not found. |
|
8154 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8155 |
||
8156 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
8157 |
! |
|
8158 |
||
8159 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
8160 |
"search aFileName in some standard places and in the classes |
|
8161 |
package-resource directory. |
|
8162 |
Return a readonly fileStream or nil if not found. |
|
8163 |
Searches in subdirectories named 'resource' in SystemPath" |
|
8164 |
||
8165 |
|aString| |
|
8166 |
||
8167 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
8168 |
aString notNil ifTrue:[ |
|
18668 | 8169 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8170 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8171 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8172 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8173 |
|
10641 | 8174 |
searchPath:aPath for:aFileName in:aDirName |
8175 |
"search aPath for a subdirectory named aDirectory with a file |
|
8176 |
named aFileName" |
|
8177 |
||
8178 |
|f| |
|
8179 |
||
8180 |
((f := aFileName asFilename) isAbsolute |
|
8181 |
or:[f isExplicitRelative]) ifTrue:[ |
|
20811 | 8182 |
"/ |
8183 |
"/ don't use path for absolute or explicit .-relative file names |
|
8184 |
"/ |
|
8185 |
^ aFileName |
|
10641 | 8186 |
]. |
8187 |
||
8188 |
aPath notNil ifTrue:[ |
|
20811 | 8189 |
aPath do:[:dirName | |
8190 |
|realName dir| |
|
8191 |
||
8192 |
dir := dirName asFilename. |
|
8193 |
aDirName notNil ifTrue:[ |
|
8194 |
realName := dir / aDirName / aFileName. |
|
8195 |
] ifFalse:[ |
|
8196 |
realName := dir / aFileName. |
|
8197 |
]. |
|
8198 |
(realName isReadable) ifTrue:[ |
|
8199 |
^ realName name |
|
8200 |
] |
|
8201 |
]. |
|
11108 | 8202 |
]. |
8203 |
||
8204 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 8205 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 8206 |
"/ (realName isReadable) ifTrue:[ |
8207 |
"/ ^ realName name |
|
8208 |
"/ ]. |
|
10641 | 8209 |
^ nil. |
8210 |
||
8211 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
8212 |
! |
|
8213 |
||
8214 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
8215 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
8216 |
||
8217 |
CachedAbbreviations isNil ifTrue:[ |
|
18668 | 8218 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 8219 |
]. |
8220 |
||
8221 |
abbrevs := CachedAbbreviations. |
|
8222 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
18668 | 8223 |
classNameSymbol := aClassNameString asSymbol. |
8224 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
|
8225 |
oldAbbrev notNil ifTrue:[ |
|
8226 |
oldAbbrev ~= aFileNameString ifTrue:[ |
|
8227 |
oldAbbrev asFilename isAbsolute |
|
8228 |
ifTrue:[ oldPath := oldAbbrev ] |
|
8229 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
|
8230 |
aFileNameString asFilename isAbsolute |
|
8231 |
ifTrue:[ newPath := aFileNameString ] |
|
8232 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
|
8233 |
||
8234 |
oldPath ~= newPath ifTrue:[ |
|
8235 |
StandAlone ifFalse:[ |
|
8236 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
|
8237 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
|
8238 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
|
8239 |
] |
|
8240 |
] |
|
8241 |
]. |
|
8242 |
"overwrite old abbreviation with new one, |
|
8243 |
to allow fixing of bad abbrev files" |
|
8244 |
]. |
|
8245 |
||
8246 |
cls := self classNamed:aFileNameString. |
|
8247 |
cls notNil ifTrue:[ |
|
8248 |
cls name ~= aClassNameString ifTrue:[ |
|
8249 |
"/ ok, there is a class named after this abbrev ... |
|
8250 |
"/ this is only a conflict, if the other class has no |
|
8251 |
"/ abbreviation (or the same). |
|
8252 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
|
8253 |
cls isNameSpace ifFalse:[ |
|
8254 |
aPackageNameString = cls package ifTrue:[ |
|
8255 |
StandAlone ifFalse:[ |
|
8256 |
('Smalltalk [warning]: conflict for: ' , cls name , |
|
8257 |
' in package ' , aPackageNameString) infoPrintCR. |
|
8258 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
|
8259 |
, ')') infoPrintCR |
|
8260 |
] |
|
8261 |
] |
|
8262 |
] |
|
8263 |
] |
|
8264 |
] |
|
8265 |
]. |
|
8266 |
abbrevs at:classNameSymbol put:aFileNameString. |
|
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
8267 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8268 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8269 |
|
10641 | 8270 |
sourceDirectoryNameOfClass:aClassOrClassName |
8271 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
8272 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
8273 |
for an entry for aClassOrClassName. |
|
8274 |
Search for the className in the first col, and return the value found in |
|
8275 |
the 3rd col. |
|
8276 |
Return nil if no entry is found." |
|
8277 |
||
8278 |
|aStream line words n aClassName| |
|
8279 |
||
8280 |
aClassOrClassName isBehavior ifTrue:[ |
|
18668 | 8281 |
aClassName := aClassOrClassName name |
10641 | 8282 |
] ifFalse:[ |
18668 | 8283 |
aClassName := aClassOrClassName |
10641 | 8284 |
]. |
8285 |
aClassName := aClassName asString. |
|
8286 |
||
8287 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
8288 |
with:#(3 2) "/ column |
|
8289 |
do:[:fileName :col | |
|
8290 |
||
18668 | 8291 |
aStream := self systemFileStreamFor:fileName. |
8292 |
aStream notNil ifTrue:[ |
|
8293 |
[aStream atEnd] whileFalse:[ |
|
8294 |
line := aStream nextLine. |
|
8295 |
line notNil ifTrue:[ |
|
8296 |
(line startsWith:'#') ifFalse:[ |
|
8297 |
words := line asCollectionOfWords. |
|
8298 |
(n := words size) > 1 ifTrue:[ |
|
8299 |
(words at:1) = aClassName ifTrue:[ |
|
8300 |
n >= col ifTrue:[ |
|
8301 |
aStream close. |
|
8302 |
^ (words at:col) withoutSeparators |
|
8303 |
] |
|
8304 |
] |
|
8305 |
] |
|
8306 |
] |
|
8307 |
] |
|
8308 |
]. |
|
8309 |
aStream close |
|
8310 |
]. |
|
10641 | 8311 |
]. |
8312 |
||
8313 |
^ nil |
|
8314 |
||
8315 |
" |
|
8316 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
8317 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
8318 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
8319 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
8320 |
" |
|
8321 |
||
8322 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
8323 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
8324 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
8325 |
! |
|
8326 |
||
8327 |
sourceFileStreamFor:aFileName |
|
8328 |
"search aFileName in some standard places; |
|
8329 |
return a readonly fileStream or nil if not found. |
|
8330 |
Searches in subdirectories named 'source' in SystemPath" |
|
8331 |
||
8332 |
|aString| |
|
8333 |
||
8334 |
aString := self getSourceFileName:aFileName. |
|
8335 |
aString notNil ifTrue:[ |
|
18668 | 8336 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8337 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8338 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8339 |
! |
7758 | 8340 |
|
10641 | 8341 |
systemFileStreamFor:aFileName |
8342 |
"search aFileName in some standard places; |
|
8343 |
return a readonly fileStream or nil if not found. |
|
8344 |
see comment in Smalltalk>>initSystemPath" |
|
8345 |
||
8346 |
|aString| |
|
8347 |
||
8348 |
aString := self getSystemFileName:aFileName. |
|
8349 |
aString notNil ifTrue:[ |
|
18668 | 8350 |
^ aString asFilename readStreamOrNil |
617 | 8351 |
]. |
8352 |
^ nil |
|
8353 |
! |
|
8354 |
||
10641 | 8355 |
systemPath |
8356 |
"return a collection of directorynames, where smalltalk |
|
8357 |
looks for system files |
|
8358 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8359 |
see comment in Smalltalk>>initSystemPath." |
|
8360 |
||
20640 | 8361 |
^ SystemPath ? #() |
10641 | 8362 |
|
8363 |
" |
|
8364 |
Smalltalk systemPath |
|
8365 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
8366 |
" |
|
8367 |
! |
|
8368 |
||
8369 |
systemPath:aPath |
|
8370 |
"set the collection of directorynames, where smalltalk |
|
8371 |
looks for system files |
|
8372 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
8373 |
see comment in Smalltalk>>initSystemPath." |
|
8374 |
||
8375 |
SystemPath := aPath. |
|
8376 |
self flushPathCaches |
|
8377 |
||
8378 |
" |
|
8379 |
Smalltalk systemPath |
|
8380 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8381 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8382 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8383 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8384 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8385 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8386 |
Evaluate aBlock for each tuple: |
18668 | 8387 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8388 |
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
|
8389 |
|
13415 | 8390 |
|line lineNo words nm abbrev pkg category size s w| |
8391 |
||
8392 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8393 |
[aStream atEnd] whileFalse:[ |
18668 | 8394 |
line := aStream nextLine. |
8395 |
lineNo := lineNo + 1. |
|
8396 |
line notEmptyOrNil ifTrue:[ |
|
8397 |
(line startsWith:'#') ifFalse:[ |
|
8398 |
||
8399 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8400 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
8401 |
|
18668 | 8402 |
words := OrderedCollection new. |
8403 |
s := line readStream. |
|
8404 |
[s atEnd] whileFalse:[ |
|
8405 |
s skipSeparators. |
|
8406 |
s peek == $' ifTrue:[ |
|
8407 |
s next. |
|
8408 |
w := s upTo:$'. |
|
8409 |
s skipSeparators. |
|
8410 |
] ifFalse:[ |
|
8411 |
w := s upToSeparator |
|
8412 |
]. |
|
8413 |
words add:w |
|
8414 |
]. |
|
8415 |
words size >= 3 ifTrue:[ |
|
8416 |
nm := (words at:1) withoutSeparators. |
|
8417 |
abbrev := (words at:2) withoutSeparators. |
|
8418 |
pkg := (words at:3) withoutSeparators. |
|
8419 |
aBlock argumentCount = 3 ifTrue:[ |
|
8420 |
aBlock value:nm value:abbrev value:pkg. |
|
8421 |
] ifFalse:[ |
|
8422 |
words size >= 4 ifTrue:[ |
|
8423 |
category := words at:4. |
|
8424 |
]. |
|
8425 |
words size = 5 ifTrue:[ |
|
8426 |
size := (words at:5) asNumber |
|
8427 |
]. |
|
8428 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
8429 |
] |
|
8430 |
] ifFalse:[ |
|
8431 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
8432 |
] |
|
8433 |
] |
|
8434 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8435 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
8436 |
|
13415 | 8437 |
"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
|
8438 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8439 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8440 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8441 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8442 |
|
16159 | 8443 |
isPackageLoaded:aPackageIdOrPackage |
8444 |
|projectDefinition| |
|
8445 |
||
8446 |
projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass. |
|
16161 | 8447 |
^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]] |
16159 | 8448 |
|
8449 |
" |
|
8450 |
Smalltalk isPackageLoaded:'stx:goodies/persistency' |
|
16170
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8451 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint' |
ca4d03def070
endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents:
16164
diff
changeset
|
8452 |
Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling' |
16159 | 8453 |
" |
8454 |
! |
|
8455 |
||
20898 | 8456 |
knownLoadablePackagesDo:aBlock |
8457 |
"enumerate loadable packages from the packages folder." |
|
8458 |
||
8459 |
Smalltalk realSystemPath do:[:dirName | |
|
8460 |
|packageDir| |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8461 |
|
20898 | 8462 |
packageDir := dirName asFilename / 'packages'. |
8463 |
(packageDir exists and:[packageDir isDirectory]) ifTrue:[ |
|
8464 |
packageDir directoryContentsAsFilenames sort do:[:fn | |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8465 |
|item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded |
20898 | 8466 |
defClass target type nameComponents packageName packageID| |
8467 |
||
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8468 |
((fn suffix = 'mcz') |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8469 |
or:[ fn isDirectory |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8470 |
or:[ (fn baseName startsWith:'.') |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8471 |
or:[ (fn baseName = 'README') ]]]) ifFalse:[ |
20898 | 8472 |
base := fn withoutSuffix baseName. |
8473 |
(base startsWith:'lib') ifTrue:[ |
|
8474 |
nm := (base copyFrom:4). |
|
8475 |
fn suffix notEmptyOrNil ifTrue:[ |
|
8476 |
type := #library. |
|
8477 |
] ifFalse:[ |
|
8478 |
type := #application. |
|
8479 |
] |
|
8480 |
] ifFalse:[ |
|
8481 |
nm := base. |
|
8482 |
type := #application. |
|
8483 |
]. |
|
8484 |
||
20899 | 8485 |
(base ~= 'librun') ifTrue:[ |
20898 | 8486 |
(fn suffix = 'mcz') ifTrue:[ |
8487 |
packageName := fn withoutSuffix. |
|
8488 |
target := fn. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8489 |
] ifFalse:[ |
20898 | 8490 |
( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[ |
8491 |
(base startsWith:'lib') ifTrue:[ |
|
8492 |
nm := base copyFrom:4. |
|
8493 |
] ifFalse:[ |
|
8494 |
nm := base. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8495 |
]. |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8496 |
]. |
20898 | 8497 |
nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_. |
8498 |
packageName := nameComponents first. |
|
8499 |
nameComponents size > 1 ifTrue:[ |
|
8500 |
packageName := packageName,':',((nameComponents from:2) asStringWith:'/') |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8501 |
]. |
20898 | 8502 |
]. |
8503 |
packageName notNil ifTrue:[ |
|
8504 |
aBlock value:packageName value:type value:fn . |
|
8505 |
] |
|
8506 |
] |
|
8507 |
] |
|
8508 |
] |
|
8509 |
] |
|
8510 |
] |
|
8511 |
||
8512 |
" |
|
8513 |
Smalltalk knownLoadablePackagesDo:[:packageID :type :path | |
|
8514 |
Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path. |
|
8515 |
] |
|
8516 |
" |
|
8517 |
! |
|
8518 |
||
10641 | 8519 |
loadPackage:aPackageIdOrPackage |
12250 | 8520 |
"make certain, that some particular package is loaded into the system. |
8521 |
Return true if loaded, false otherwise." |
|
11668 | 8522 |
|
8523 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
8524 |
||
8525 |
" |
|
8526 |
Smalltalk loadPackage:'stx:libbasic' |
|
8527 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8528 |
Smalltalk loadPackage:'cg:cparser' |
|
8529 |
Smalltalk loadPackage:'cg:rose' |
|
8530 |
" |
|
8531 |
! |
|
8532 |
||
10641 | 8533 |
packageDirectoryForPackageId:aPackageId |
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
8534 |
<resource: #obsolete> |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
8535 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
8536 |
self obsoleteMethodWarning:'Use #getPackageDirectoryForPackage: instead'. |
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
8537 |
^ self getPackageDirectoryForPackage: aPackageId |
10641 | 8538 |
|
8539 |
" |
|
11375 | 8540 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 8541 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
8542 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
8543 |
" |
|
20075
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
8544 |
|
7f62aabd8dbf
Issue #94: Cleaned up Smalltalk >> packageDirectoryForPackageId:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
20073
diff
changeset
|
8545 |
"Modified (format): / 28-06-2016 / 07:56:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
12250 | 8546 |
! |
8547 |
||
18794 | 8548 |
requirePackage:aPackageIdOrPackage |
8549 |
"make certain, that some particular package is loaded into the system. |
|
8550 |
Return true if loaded, false otherwise. |
|
8551 |
Just an alias which is easier to remember" |
|
8552 |
||
8553 |
^ self loadPackage:aPackageIdOrPackage |
|
8554 |
||
8555 |
" |
|
8556 |
Smalltalk loadPackage:'stx:libbasic' |
|
8557 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8558 |
Smalltalk loadPackage:'cg:cparser' |
|
8559 |
Smalltalk loadPackage:'cg:rose' |
|
8560 |
" |
|
8561 |
! |
|
8562 |
||
12250 | 8563 |
unloadPackage:aPackageIdOrPackage |
8564 |
|projectDefinition| |
|
8565 |
||
8566 |
projectDefinition := aPackageIdOrPackage. |
|
8567 |
projectDefinition isProjectDefinition ifFalse:[ |
|
20603 | 8568 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
8569 |
projectDefinition isNil ifTrue:[ |
|
8570 |
Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage. |
|
8571 |
^ self. |
|
8572 |
]. |
|
12250 | 8573 |
]. |
8574 |
projectDefinition unloadPackage. |
|
8575 |
||
8576 |
" |
|
8577 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
8578 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
8579 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8580 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8581 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8582 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8583 |
|
10641 | 8584 |
clearUndeclaredVariables |
8585 |
"remove all undeclared variables" |
|
8586 |
||
8587 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
18668 | 8588 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 8589 |
]. |
8590 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8591 |
Smalltalk removeKey:#Undeclared. |
10641 | 8592 |
! |
8593 |
||
8594 |
undeclaredPrefix |
|
8595 |
"the prefix used for undeclared variables" |
|
8596 |
||
8597 |
^ 'Undeclared:::' |
|
8598 |
||
8599 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 8600 |
! ! |
8601 |
||
8602 |
!Smalltalk class methodsFor:'time-versions'! |
|
8603 |
||
10641 | 8604 |
configuration |
8605 |
"{ Pragma: +optSpace }" |
|
8606 |
||
8607 |
"for developers only: return the configuration, with which |
|
8608 |
this smalltalk was compiled." |
|
8609 |
||
8610 |
%{ /* NOCONTEXT */ |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8611 |
extern char *__getBuildTargetString(void); |
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8612 |
|
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8613 |
RETURN (__MKSTRING(__getBuildTargetString())); |
10641 | 8614 |
%}. |
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8615 |
self primitiveFailed. |
10641 | 8616 |
|
8617 |
" |
|
10071 | 8618 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8619 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8620 |
! |
453 | 8621 |
|
10641 | 8622 |
copyrightString |
8623 |
"{ Pragma: +optSpace }" |
|
8624 |
||
8625 |
"return a copyright string" |
|
8626 |
||
8627 |
%{ /* NOCONTEXT */ |
|
8628 |
#ifndef __getCopyrightString |
|
8629 |
extern OBJ __getCopyrightString(); |
|
8630 |
#endif |
|
8631 |
||
8632 |
RETURN (__getCopyrightString()); |
|
8633 |
%}. |
|
8634 |
^ self primitiveFailed |
|
8635 |
||
8636 |
" |
|
7758 | 8637 |
Smalltalk copyrightString |
8638 |
" |
|
8639 |
! |
|
8640 |
||
10641 | 8641 |
distributorString |
8642 |
"{ Pragma: +optSpace }" |
|
8643 |
||
8644 |
"return a string describing the distributor of this software" |
|
8645 |
||
8646 |
%{ /* NOCONTEXT */ |
|
8647 |
#ifndef __getDistributorString |
|
8648 |
extern OBJ __getDistributorString(); |
|
8649 |
#endif |
|
8650 |
||
8651 |
RETURN (__getDistributorString()); |
|
8652 |
%}. |
|
8653 |
^ 'eXept Software AG, Germany' |
|
8654 |
||
8655 |
" |
|
8656 |
Smalltalk distributorString |
|
8657 |
" |
|
8658 |
! |
|
8659 |
||
8660 |
expirationTime |
|
8661 |
"{ Pragma: +optSpace }" |
|
8662 |
||
8663 |
"for developers only: return the time when the system will expire. |
|
8664 |
after this time it will not run any longer. |
|
8665 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
8666 |
||
8667 |
|exp| |
|
8668 |
||
8669 |
%{ |
|
8670 |
extern unsigned int __getExpirationTime(); |
|
8671 |
||
8672 |
exp = __MKUINT(__getExpirationTime()); |
|
8673 |
%}. |
|
8674 |
exp == 0 ifTrue:[ |
|
18668 | 8675 |
^ nil |
10641 | 8676 |
]. |
8677 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
8678 |
||
8679 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8680 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8681 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8682 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8683 |
|
10641 | 8684 |
fullVersionString |
8685 |
"{ Pragma: +optSpace }" |
|
8686 |
||
8687 |
"return a full version string" |
|
8688 |
||
19529 | 8689 |
^ 'Smalltalk/X jv-branch release %1%2 of %3' |
19516 | 8690 |
bindWith:(self versionString) |
8691 |
with:((ExternalAddress pointerSize == 8) |
|
8692 |
ifTrue:[' (64bit)'] |
|
8693 |
ifFalse:['']) |
|
8694 |
with:(self versionDate) |
|
8695 |
||
8696 |
" |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8697 |
Smalltalk fullVersionString |
10641 | 8698 |
" |
8699 |
||
8700 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
8701 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
8702 |
! |
|
8703 |
||
8704 |
hello |
|
8705 |
"{ Pragma: +optSpace }" |
|
8706 |
||
8707 |
"return a greeting string" |
|
8708 |
||
8709 |
"stupid: this should come from a resource file ... |
|
18924 | 8710 |
but I don't use it here, to allow mini-systems without |
10641 | 8711 |
Resource-stuff." |
8712 |
||
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8713 |
|proto lang bit machine| |
10641 | 8714 |
|
8715 |
lang := Language. |
|
19187 | 8716 |
bit := 'bit'. |
8717 |
||
10641 | 8718 |
(lang == #de) ifTrue:[ |
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8719 |
proto := 'Willkommen bei %1 (%4, Version %2 von %3)'. bit := 'Bit'. |
10641 | 8720 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8721 |
proto := 'Salut, Bienvenue à %1 (%4, version %2 de %3)' |
10641 | 8722 |
] ifFalse:[ (lang == #it) ifTrue:[ |
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8723 |
proto := 'Ciao, benvenuto al %1 (%4, versione %2 di %3)' |
10641 | 8724 |
] ifFalse:[ (lang == #es) ifTrue:[ |
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8725 |
proto := 'Hola, bienvenida a %1 (%4, version %2 de %3)' |
18924 | 8726 |
] ifFalse:[ (lang == #pt) ifTrue:[ |
25401 | 8727 |
proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)' |
10641 | 8728 |
] ifFalse:[ (lang == #no) ifTrue:[ |
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8729 |
proto := 'Hei, verdenmottakelse til %1 (%4, versjon %2 av %3)' |
10641 | 8730 |
]]]]]]. |
8731 |
||
8732 |
"/ ... more needed here ... |
|
8733 |
||
8734 |
proto isNil ifTrue:[ |
|
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8735 |
proto := 'Hello World - welcome to %1 (%4, version %2 of %3)'. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8736 |
]. |
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8737 |
machine := OperatingSystem getSystemInfo at: #machine. |
10641 | 8738 |
|
18759
c1217211909c
Changed identification strings to contain jv-branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18737
diff
changeset
|
8739 |
^ proto bindWith:('Smalltalk/X jv-branch' allBold) |
18924 | 8740 |
with:(self versionString) |
8741 |
with:(self versionDate) |
|
25158
21d7d4b01bc7
Change "hello" string to include configutation triplet
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23547
diff
changeset
|
8742 |
with:machine |
10641 | 8743 |
|
8744 |
" |
|
8745 |
Smalltalk language:#us. |
|
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8746 |
Smalltalk hello |
10641 | 8747 |
|
8748 |
Smalltalk language:#de. |
|
8749 |
Smalltalk hello |
|
8750 |
||
8751 |
Smalltalk language:#no. |
|
8752 |
Smalltalk hello |
|
8753 |
||
8754 |
Transcript showCR:(Smalltalk hello) |
|
8755 |
Stdout showCR:(Smalltalk hello) |
|
8756 |
" |
|
8757 |
||
8758 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
8759 |
! |
|
8760 |
||
8761 |
imageRestartTime |
|
8762 |
"return a timestamp for the moment when this image was restarted. |
|
8763 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
8764 |
||
8765 |
^ ImageRestartTime |
|
8766 |
||
8767 |
" |
|
8768 |
Smalltalk imageStartTime |
|
8769 |
Smalltalk imageRestartTime |
|
8770 |
" |
|
8771 |
||
8772 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
8773 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
8774 |
! |
|
8775 |
||
8776 |
imageSaveTime |
|
8777 |
"{ Pragma: +optSpace }" |
|
8778 |
||
8779 |
"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
|
8780 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8781 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8782 |
! |
7758 | 8783 |
|
10641 | 8784 |
imageStartTime |
8785 |
"{ Pragma: +optSpace }" |
|
8786 |
||
8787 |
"return a timestamp for the moment when this system started the first time |
|
8788 |
(i.e. the first initial start without an image)" |
|
8789 |
||
8790 |
^ ImageStartTime |
|
8791 |
||
8792 |
" |
|
8793 |
Smalltalk imageStartTime |
|
8794 |
Smalltalk imageRestartTime |
|
8795 |
" |
|
8796 |
||
8797 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
8798 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
8799 |
! |
|
8800 |
||
8801 |
majorVersionNr |
|
8802 |
"{ Pragma: +optSpace }" |
|
8803 |
||
8804 |
"return the major version number. |
|
8805 |
This is only incremented for very fundamental changes, |
|
8806 |
which make old object files totally incompatible |
|
8807 |
(for example, if the layout/representation of fundamental |
|
8808 |
classes changes). |
|
8809 |
||
8810 |
ST/X revision Naming is: |
|
19974 | 8811 |
<major>.<minor>.<revision>.<release>" |
8812 |
||
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8813 |
^ 8 |
10641 | 8814 |
|
8815 |
" |
|
8816 |
Smalltalk majorVersionNr |
|
8817 |
" |
|
8818 |
||
8819 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
|
8820 |
! |
|
8821 |
||
8822 |
minorVersionNr |
|
8823 |
"{ Pragma: +optSpace }" |
|
8824 |
||
8825 |
"return the minor version number. |
|
8826 |
This is incremented for changes which make some old object |
|
8827 |
files incompatible, or the protocol changes such that some |
|
8828 |
classes need rework. |
|
8829 |
||
8830 |
ST/X revision Naming is: |
|
19974 | 8831 |
<major>.<minor>.<revision>.<release>" |
8832 |
||
23098
078e5d40fb7f
Cleanup: catchup after ranema of `__getConfigurationString()` to `__getBuildDateString()`
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23093
diff
changeset
|
8833 |
^ 0 |
10641 | 8834 |
|
8835 |
" |
|
8836 |
Smalltalk minorVersionNr |
|
8837 |
" |
|
8838 |
||
8839 |
"Modified: / 16-08-2006 / 09:37:25 / cg" |
|
8840 |
! |
|
8841 |
||
8842 |
releaseIdentification |
|
8843 |
"{ Pragma: +optSpace }" |
|
8844 |
||
8845 |
"for developers only: return the release |
|
8846 |
(to further identify the version in case of errors)" |
|
8847 |
||
8848 |
%{ /* NOCONTEXT */ |
|
8849 |
extern OBJ __getRel(); |
|
8850 |
||
8851 |
RETURN (__getRel()); |
|
8852 |
%}. |
|
8853 |
^ 'ST/X_experimental' |
|
8854 |
||
8855 |
" |
|
8856 |
Smalltalk releaseIdentification |
|
8857 |
" |
|
8858 |
! |
|
8859 |
||
8860 |
releaseNr |
|
8861 |
"{ Pragma: +optSpace }" |
|
8862 |
||
14542 | 8863 |
"return the release number. |
8864 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 8865 |
|
8866 |
ST/X revision Naming is: |
|
18668 | 8867 |
<major>.<minor>.<revision>.<release>" |
14529 | 8868 |
|
8869 |
|releaseNumber| |
|
8870 |
||
8871 |
releaseNumber := Smalltalk versionBuildNumber. |
|
8872 |
releaseNumber isEmpty ifTrue:[ |
|
18668 | 8873 |
^ 0. |
14529 | 8874 |
]. |
8875 |
^ releaseNumber |
|
10641 | 8876 |
|
8877 |
" |
|
8878 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
8879 |
Smalltalk versionString |
10641 | 8880 |
" |
8881 |
||
8882 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
8883 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
8884 |
! |
|
8885 |
||
8886 |
revisionNr |
|
8887 |
"{ Pragma: +optSpace }" |
|
8888 |
||
8889 |
"return the revision number. |
|
8890 |
Incremented for releases which fix bugs/add features |
|
8891 |
and represent a stable workable version which got published |
|
8892 |
to the outside world. |
|
8893 |
||
8894 |
ST/X revision Naming is: |
|
19974 | 8895 |
<major>.<minor>.<revision>.<release>" |
8896 |
||
23205
b123e9a0e04b
Bumped revision number to 99 to mark Smalltalk/X 8.1.0 development line.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23107
diff
changeset
|
8897 |
^ 99 |
10641 | 8898 |
|
8899 |
" |
|
8900 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
8901 |
Smalltalk hello string |
13014 | 8902 |
" |
8903 |
||
14210 | 8904 |
"Modified: / 18-07-2012 / 19:09:42 / cg" |
14898 | 8905 |
"Modified: / 19-03-2013 / 10:48:59 / az" |
19974 | 8906 |
"Modified: / 09-06-2016 / 16:28:57 / cg" |
10641 | 8907 |
! |
8908 |
||
8909 |
timeStamp |
|
8910 |
"return a string useful for timestamping a file. |
|
8911 |
The returned string is padded with spaces for a constant |
|
8912 |
length (to avoid changing a files size in fileOut with unchanged |
|
8913 |
class)." |
|
8914 |
||
8915 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
8916 |
! |
|
8917 |
||
8918 |
timeStamp:aStream |
|
8919 |
"write a string useful for timestamping a file onto aStream. |
|
8920 |
ST80 compatibility" |
|
8921 |
||
8922 |
aStream nextPutAll:(self timeStamp). |
|
8923 |
||
8924 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
8925 |
! |
|
8926 |
||
8927 |
timeStampString |
|
8928 |
"return a string useful for timestamping a file." |
|
8929 |
||
8930 |
|dateString| |
|
8931 |
||
8932 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
8933 |
||
18759
c1217211909c
Changed identification strings to contain jv-branch
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18737
diff
changeset
|
8934 |
^ ('From Smalltalk/X jv-branch, Version:' , (Smalltalk versionString) , ' on ' |
10641 | 8935 |
, dateString , ' at ' , Time now printString |
7758 | 8936 |
) |
8937 |
! |
|
8938 |
||
14529 | 8939 |
versionBuildNumber |
8940 |
"{ Pragma: +optSpace }" |
|
8941 |
||
8942 |
"return the executables build number - that's the jenkins build #. |
|
8943 |
Empty if not built by jenkins" |
|
8944 |
||
8945 |
%{ /* NOCONTEXT */ |
|
8946 |
extern char *__getBuildNumberString(); |
|
8947 |
||
8948 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
8949 |
%}. |
|
8950 |
^ '' |
|
8951 |
||
8952 |
" |
|
8953 |
Smalltalk versionBuildNumber |
|
8954 |
" |
|
8955 |
! |
|
8956 |
||
10641 | 8957 |
versionDate |
8958 |
"{ Pragma: +optSpace }" |
|
8959 |
||
14522 | 8960 |
"return the executables build date - that's the date when the smalltalk |
10641 | 8961 |
executable was built" |
8962 |
||
8963 |
%{ /* NOCONTEXT */ |
|
8964 |
extern char *__getBuildDateString(); |
|
8965 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
8966 |
%}. |
|
8967 |
^ 'today' |
|
8968 |
||
8969 |
" |
|
10071 | 8970 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8971 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8972 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8973 |
|
10641 | 8974 |
versionString |
8975 |
"{ Pragma: +optSpace }" |
|
8976 |
||
8977 |
"return the version string" |
|
8978 |
||
8979 |
^ (self majorVersionNr printString , |
|
8980 |
'.', |
|
8981 |
self minorVersionNr printString , |
|
8982 |
'.', |
|
14529 | 8983 |
self revisionNr printString, |
8984 |
'.', |
|
8985 |
self releaseNr printString) |
|
13771 | 8986 |
|
10641 | 8987 |
|
8988 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8989 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
8990 |
" |
10641 | 8991 |
! |
8992 |
||
8993 |
vmMajorVersionNr |
|
8994 |
"{ Pragma: +optSpace }" |
|
8995 |
||
8996 |
"return the VMs major version number." |
|
8997 |
%{ |
|
8998 |
RETURN (__mkSmallInteger(4)); |
|
8999 |
%}. |
|
9000 |
^ 4 |
|
9001 |
||
9002 |
" |
|
9003 |
Smalltalk vmMajorVersionNr |
|
9004 |
" |
|
2 | 9005 |
! ! |
453 | 9006 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
9007 |
!Smalltalk class methodsFor:'documentation'! |
630 | 9008 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9009 |
version |
18562
d0cc0d0cfffd
Reverted change a37464a68e70 as it breaks autoloading/source loading.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18561
diff
changeset
|
9010 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1133 2015-05-22 18:41:08 cg Exp $' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9011 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
9012 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
9013 |
version_CVS |
18562
d0cc0d0cfffd
Reverted change a37464a68e70 as it breaks autoloading/source loading.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18561
diff
changeset
|
9014 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1133 2015-05-22 18:41:08 cg Exp $' |
13415 | 9015 |
! |
9016 |
||
18247
3c81bb9bbaea
Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18200
diff
changeset
|
9017 |
version_HG |
3c81bb9bbaea
Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18200
diff
changeset
|
9018 |
|
3c81bb9bbaea
Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
18200
diff
changeset
|
9019 |
^ '$Changeset: <not expanded> $' |
13415 | 9020 |
! |
9021 |
||
9022 |
version_SVN |
|
15225 | 9023 |
^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 $' |
630 | 9024 |
! ! |
18669 | 9025 |