author | Claus Gittinger <cg@exept.de> |
Mon, 18 Mar 2013 14:39:49 +0100 | |
changeset 14890 | 37618c9121f2 |
parent 14833 | c718848b1051 |
child 14892 | 77c2f020de5d |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
5363 | 12 |
"{ Package: 'stx:libbasic' }" |
13 |
||
1 | 14 |
Object subclass:#Smalltalk |
12795 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses |
|
17 |
NumberOfClassesHint SystemPath StartupClass StartupSelector |
|
18 |
StartupArguments CommandLine CommandName CommandLineArguments |
|
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
19 |
CachedAbbreviations VerboseLoading SilentLoading Initializing |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
20 |
StandAlone HeadlessOperation IsPlugin IsSharedLibraryComponent |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
21 |
IsSTScript DebuggingStandAlone LogDoits LoadBinaries |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
22 |
RealSystemPath ResourcePath SourcePath BinaryPath FileInPath |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
23 |
PackagePath BinaryDirName ResourceDirName SourceDirName |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
24 |
BitmapDirName PackageDirName FileInDirName ChangeFileName |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
25 |
ImageStartTime ImageRestartTime DemoMode SaveEmergencyImage |
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
26 |
SpecialObjectArray CallbackSignal KnownPackages |
13368 | 27 |
ClassesFailedToInitialize HasNoConsole IgnoreHalt |
28 |
PackageToPathMapping' |
|
12795 | 29 |
poolDictionaries:'' |
30 |
category:'System-Support' |
|
1 | 31 |
! |
32 |
||
13415 | 33 |
Smalltalk comment:'' |
8845
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
34 |
! |
17288e4e99eb
remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents:
8821
diff
changeset
|
35 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
36 |
!Smalltalk class methodsFor:'documentation'! |
70 | 37 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
38 |
copyright |
617 | 39 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
40 |
COPYRIGHT (c) 1988 by Claus Gittinger |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
41 |
All Rights Reserved |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
42 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
43 |
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
|
44 |
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
|
45 |
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
|
46 |
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
|
47 |
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
|
48 |
hereby transferred. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
49 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
50 |
! |
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 |
documentation |
70 | 53 |
" |
54 |
This is one of the central classes in the system; |
|
55 |
it provides all system-startup, shutdown and maintenance support. |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
56 |
Also global variables are (conceptionally) kept here. |
70 | 57 |
|
58 |
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
|
59 |
- my implementation of globals is totally different |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
60 |
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
|
61 |
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
|
62 |
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
|
63 |
functions found there. |
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
64 |
|
70 | 65 |
However, it provides the known enumeration protocol. |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
66 |
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
|
67 |
to inherit more collection stuff ... |
70 | 68 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
69 |
|
1286 | 70 |
[Instance variables:] |
14432 | 71 |
none - all handling is done in the VM |
1286 | 72 |
|
73 |
[Class variables:] |
|
74 |
||
14432 | 75 |
StartBlocks <Collection> blocks to be executed in a separate process after |
76 |
everything has been initialized. These blocks will |
|
77 |
be deleted after execution and therefore not be |
|
78 |
executed after an image restart. Initial processes |
|
79 |
(such as the Launcher) are usually started here. |
|
80 |
These blocks are added by smalltalk.rc/private.rc etc. |
|
81 |
via #addStartBlock during early initialization. |
|
82 |
||
83 |
ImageStartBlocks |
|
84 |
<Collection> blocks to be executed in a separate process after |
|
85 |
everything has been initialized. These blocks will be |
|
86 |
executed after an image restart. |
|
87 |
These blocks are usually added by smalltalk_r.rc etc. |
|
88 |
||
89 |
ExitBlocks <Collection> blocks to evaluate before system is |
|
90 |
left. Not currently used (GNU-ST compatibility). |
|
91 |
||
92 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
|
93 |
Set to a default here, but typically changed from some |
|
94 |
startup.rc file |
|
95 |
||
96 |
PackagePath <Collection> path to search for package. |
|
97 |
This is going to replace the above systemPath, and a classes |
|
98 |
resources will eventually searched in its package directory. |
|
99 |
This list defines the path, where packages are searched for, |
|
100 |
initially this is something like /opt/smalltalk/packages. |
|
101 |
Set to a default here, but typically changed from some |
|
102 |
startup.rc file |
|
103 |
||
104 |
StartupClass <Class> class and selector, where the system starts up |
|
105 |
StartupSelector <Symbol> (right after VM initialization) |
|
106 |
StartupArguments <Array> If an image is saved while those being nonNil, |
|
107 |
the image will come up there. |
|
108 |
Allows for customized images to be generated from a standard ST/X. |
|
109 |
StandAlone programs also set those during initialization. |
|
110 |
||
111 |
CommandLine <String> Unix (OS-) command line |
|
112 |
||
113 |
CommandName <String> the command (i.e. argv[0]) |
|
114 |
||
115 |
CommandLineArguments <Array> Unix (OS-) command line arguments broken into words |
|
116 |
CommandName has been stripped off. |
|
117 |
(initially set by the VM) |
|
118 |
||
119 |
SilentLoading <Boolean> OBSOLETE: |
|
120 |
suppresses messages during fileIn and in compiler |
|
121 |
(can be set to true from a customized main.c) |
|
122 |
||
123 |
VerboseLoading <Boolean> generate messages during fileIn and in compiler |
|
124 |
(can be set to true from a customized main.c) |
|
125 |
||
126 |
Initializing <Boolean> true while (re-)initializing |
|
127 |
Controls the behavior of certain error |
|
128 |
reporters (for example: suppress dialogBoxes) |
|
129 |
while the system is not yet fit for full operation. |
|
130 |
||
131 |
StandAlone <Boolean> true, if this is a standalone app; |
|
132 |
if true the process scheduler watches for |
|
133 |
which processes are still running, and |
|
134 |
exits ST/X, when the last non-background |
|
135 |
and non-system process exits. |
|
136 |
Can be set in an application-specific startup script, |
|
137 |
or, for standAlone programs, by C-code during initialization. |
|
138 |
||
139 |
HeadlessOperation if true, a non-existing Display connection |
|
140 |
<Boolean> will NOT lead to an error-exit during startup. |
|
141 |
Default is false. |
|
142 |
Can be set in an application-specific startup script, |
|
143 |
or, for standAlone programs, by C-code during initialization. |
|
144 |
||
145 |
LogDoits <Boolean> if true, doits are also logged in the changes |
|
146 |
file. Default is false, since the changes file |
|
147 |
may become huge if every tiny doIt is saved there ... |
|
148 |
||
149 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
|
150 |
file, if present. If false, this is always suppressed. |
|
151 |
||
152 |
SaveEmergencyImage <Boolean> if true (the default), an emergency image |
|
153 |
is saved, if the main Display looses its |
|
154 |
connection. This is useful if you have a |
|
155 |
flaky display connection (serial line) |
|
156 |
and want to have your stuff saved automatically |
|
157 |
in case of a broken connection. |
|
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
158 |
|
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
159 |
strictly private classVariables (helpers): |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
160 |
|
14432 | 161 |
CachedClasses <Collection> known classes (cached for faster class enumeration) |
162 |
||
163 |
CachedAbbreviations |
|
164 |
<Dictionary> className to filename mappings |
|
165 |
||
166 |
RealSystemPath <Collection> cached collection of directories along the path |
|
167 |
which really exist. Caching avoids long checks |
|
168 |
for existing directories on broken NFS volumes. |
|
169 |
||
170 |
SourcePath <Collection> cached names of really existing directories |
|
171 |
These are remembered, as in NFS systems, |
|
172 |
ResourcePath the time to lookup files may become long |
|
173 |
BinaryPath (especially, if some directories are on machines |
|
174 |
FileInPath which are not up ...). |
|
175 |
Therefore, the set of really |
|
176 |
existing directories is cached when the SystemPath |
|
177 |
is walked the first time. |
|
178 |
A consequence is that you have to invoke |
|
179 |
flushSystemPath, when you create any of those |
|
180 |
directories while running |
|
181 |
(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
|
182 |
|
1286 | 183 |
|
184 |
[author:] |
|
14432 | 185 |
Claus Gittinger |
3062
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
186 |
|
5b8a2aa07108
write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
187 |
[see also:] |
14432 | 188 |
ObjectMemory |
189 |
StandaloneStartup |
|
190 |
GetOpt |
|
191 |
ReadEvalPrintLoop |
|
70 | 192 |
" |
8945 | 193 |
! |
194 |
||
195 |
readme_resources |
|
196 |
" |
|
197 |
What is a resource file: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
198 |
resource files contain language transformation and sometimes |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
199 |
UI-look specifics such as icons etc. |
8945 | 200 |
|
201 |
Where are resources stored in the image: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
202 |
Resource files are only read on demand (i.e. when needed) and only read once |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
203 |
i.e. they are cached in the image). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
204 |
The cached data is held in a per-class class-instVar named 'ClassResources'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
205 |
With only a few exceptions, the only classes which need resources are the GUI |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
206 |
classes under the SimpleView hierarchy. |
8945 | 207 |
|
208 |
How does the system find resources: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
209 |
The idea is that the system-provided resource files can be overwritten |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
210 |
by the user or an application configuration. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
211 |
This works via a hierarchy of directories where resources are searched for, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
212 |
with the systems standard resource-files being at the end of that chain. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
213 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
214 |
When searching for a resource file for class X, the following files are searched |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
215 |
in order: |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
216 |
{ResourcePath} / resources / X.rs |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
217 |
{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
218 |
{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs |
8945 | 219 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
220 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
221 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
222 |
!Smalltalk class methodsFor:'initialization'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
223 |
|
11057 | 224 |
basicInitializeSystem |
225 |
"initialize all other classes; setup dispatcher processes etc. |
|
226 |
This one is the very first entry into the smalltalk world, |
|
227 |
right after startup, ususally immediately followed by Smalltalk>>start. |
|
228 |
[with error handling, via the initializeSystem] |
|
229 |
Notice: |
|
14432 | 230 |
this is not called when an image is restarted; in this |
231 |
case the show starts in Smalltalk>>restart." |
|
11057 | 232 |
|
13771 | 233 |
Compiler := ByteCodeCompiler. |
234 |
Compiler isNil ifTrue:[ |
|
14432 | 235 |
" |
236 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
237 |
this allows at least immediate evaluations for runtime systems without compiler |
|
238 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
239 |
" |
|
240 |
Compiler := Parser |
|
13771 | 241 |
]. |
242 |
||
11057 | 243 |
"/ |
244 |
"/ start catching SIGSEGV and SIGBUS |
|
245 |
"/ |
|
246 |
OperatingSystem enableHardSignalInterrupts. |
|
247 |
||
248 |
self initGlobalsFromEnvironment. |
|
249 |
||
250 |
"/ |
|
251 |
"/ sorry - there are some, which MUST be initialized before .. |
|
252 |
"/ reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
253 |
"/ |
|
254 |
Object initialize. |
|
255 |
Stream initialize. |
|
256 |
PositionableStream initialize. |
|
257 |
Filename initialize. |
|
258 |
ObjectMemory initialize. |
|
259 |
OperatingSystem initialize. |
|
260 |
ExternalStream initialize. |
|
12745
e944659a6a52
changed: #basicInitializeSystem
Claus Gittinger <cg@exept.de>
parents:
12744
diff
changeset
|
261 |
ProcessorScheduler initialize. |
11057 | 262 |
|
263 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
264 |
||
265 |
"/ |
|
266 |
"/ sorry, path must be set before ... |
|
267 |
"/ reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
268 |
"/ |
|
269 |
self initSystemPath. |
|
270 |
||
271 |
"/ |
|
272 |
"/ another one, to be initialized before others |
|
273 |
"/ |
|
274 |
ProcessorScheduler initialize. |
|
275 |
||
276 |
"/ |
|
14427 | 277 |
"/ in case, someone needs the objectFileLoader early |
278 |
"/ |
|
279 |
ObjectFileLoader initialize. |
|
280 |
||
281 |
"/ |
|
11057 | 282 |
"/ now, finally, initialize all other classes |
283 |
"/ |
|
284 |
self initializeModules. |
|
285 |
||
286 |
ImageStartTime := Timestamp now. |
|
287 |
||
288 |
self initInterrupts. |
|
289 |
self initUserPreferences. |
|
290 |
||
291 |
"/ |
|
292 |
"/ give classes a chance to perform 2nd-level initialization |
|
293 |
"/ now, we are certain, that all other classes have been initialized |
|
294 |
"/ (especially: streams and signals can now be used) |
|
295 |
"/ |
|
296 |
ObjectMemory changed:#initialized. |
|
297 |
||
298 |
"Modified: / 08-01-1997 / 19:58:12 / stefan" |
|
299 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
14427 | 300 |
"Modified: / 24-10-2012 / 18:45:15 / sr" |
11057 | 301 |
! |
302 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
303 |
initGlobalsFromEnvironment |
617 | 304 |
"setup globals from the shell-environment" |
305 |
||
306 |
|envString i langString terrString| |
|
307 |
||
5406 | 308 |
StandAlone isNil ifTrue:[ |
14432 | 309 |
StandAlone := false. |
5406 | 310 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
311 |
HeadlessOperation isNil ifTrue:[ |
14432 | 312 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
313 |
]. |
5406 | 314 |
|
617 | 315 |
" |
316 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 317 |
valid are for example: |
14432 | 318 |
en_en / en |
319 |
en_us |
|
320 |
en_gb |
|
321 |
de_de / de |
|
322 |
de_at (for Austria) |
|
5846 | 323 |
" |
324 |
||
325 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
326 |
LanguageTerritory := #us. |
617 | 327 |
|
5846 | 328 |
|
329 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
14432 | 330 |
language ISO-639 Language code |
331 |
territory ISO-3166 Contry code" |
|
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
332 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
333 |
envString := OperatingSystem getLanguage. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
334 |
envString size > 0 ifTrue:[ |
14432 | 335 |
i := envString indexOf:$@. |
336 |
(i ~~ 0) ifTrue:[ |
|
337 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
338 |
envString := envString copyTo:(i - 1). |
|
339 |
] ifFalse:[ |
|
340 |
LanguageModifier := nil. |
|
341 |
]. |
|
342 |
i := envString indexOf:$.. |
|
343 |
(i ~~ 0) ifTrue:[ |
|
344 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
|
345 |
envString := envString copyTo:(i - 1). |
|
346 |
] ifFalse:[ |
|
347 |
LanguageCodeset := #'iso8859-1'. |
|
348 |
]. |
|
349 |
i := envString indexOf:$_. |
|
350 |
(i == 0) ifTrue:[ |
|
351 |
langString := envString. |
|
352 |
terrString := envString |
|
353 |
] ifFalse:[ |
|
354 |
langString := envString copyTo:(i - 1). |
|
355 |
terrString := envString copyFrom:(i + 1) |
|
356 |
]. |
|
357 |
langString := langString asLowercase. |
|
358 |
terrString := terrString asLowercase. |
|
359 |
(langString = 'c' or:[terrString = 'c']) ifTrue:[ |
|
360 |
('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR. |
|
361 |
] ifFalse:[ |
|
362 |
Language := langString asSymbol. |
|
363 |
LanguageTerritory := terrString asSymbol |
|
364 |
] |
|
617 | 365 |
]. |
366 |
||
367 |
" |
|
368 |
Smalltalk initGlobalsFromEnvironment |
|
369 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
370 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
371 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
372 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
373 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
374 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
375 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
376 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
377 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
378 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
379 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
380 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
381 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
382 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
383 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
384 |
|
14805 | 385 |
OperatingSystem isOSXlike ifTrue:[ |
386 |
"/ OSX sends SIGABRT for NSExceptions |
|
387 |
OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException. |
|
388 |
OperatingSystem enableAbortInterrupts. |
|
389 |
]. |
|
390 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
391 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
392 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
393 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
394 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
395 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
396 |
! |
617 | 397 |
|
398 |
initStandardStreams |
|
399 |
"initialize some well-known streams" |
|
400 |
||
401 |
Stdout := NonPositionableExternalStream forStdout. |
|
402 |
Stderr := NonPositionableExternalStream forStderr. |
|
403 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
404 |
PrinterStream notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
405 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
406 |
]. |
617 | 407 |
Transcript := Stderr |
408 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
409 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
410 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
411 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
412 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
413 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 414 |
! |
415 |
||
416 |
initStandardTools |
|
10646 | 417 |
"predefine some tools which we might need later |
617 | 418 |
- if the view-classes exist, |
419 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
420 |
||
421 |
Display notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
422 |
InspectorView notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
423 |
Inspector := InspectorView |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
424 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
425 |
DebugView notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
426 |
Debugger := DebugView |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
427 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
428 |
"/ Display initialize |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
429 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
430 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
431 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
432 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
433 |
ObjectMemory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
434 |
nameForChanges:(Filename currentDirectory construct:ObjectMemory nameForChangesLocal) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
435 |
asAbsoluteFilename pathName |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
436 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
437 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
438 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
439 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
440 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
441 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
442 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
443 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
444 |
initSystemPath |
617 | 445 |
"setup path where system files are searched for. |
446 |
the default path is set to: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
447 |
. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
448 |
<directory of exe> (WIN32 only) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
449 |
$HOME (if defined) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
450 |
$HOME/.smalltalk (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
451 |
$SMALLTALK_LIBDIR (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
452 |
$STX_LIBDIR (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
453 |
$STX_TOPDIR (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
454 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
455 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
456 |
<standard places> |
9021 | 457 |
|
458 |
standard places (unix): |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
459 |
/opt/smalltalk/<release> (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
460 |
/opt/smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
461 |
/usr/local/lib/smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
462 |
/usr/lib/smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
463 |
/lib/smalltalk (if existing) |
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
464 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
465 |
win32: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
466 |
\programs\exept\smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
467 |
\programs\smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
468 |
\smalltalk (if existing) |
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
469 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
470 |
vms: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
471 |
$stx:lib (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
472 |
$stx:root (if existing) |
617 | 473 |
|
474 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
475 |
startup file; add expressions such as: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
476 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
477 |
or: |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
478 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
479 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
480 |
However, smalltalk.rc itself must be found along the above path. |
617 | 481 |
" |
482 |
||
2928 | 483 |
ChangeFileName := 'changes'. |
484 |
OperatingSystem isVMSlike ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
485 |
BitmapDirName := 'bitmaps.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
486 |
BinaryDirName := 'binary.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
487 |
SourceDirName := 'source.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
488 |
ResourceDirName := 'resources.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
489 |
FileInDirName := 'filein.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
490 |
PackageDirName := 'packages.dir'. |
2928 | 491 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
492 |
BitmapDirName := 'bitmaps'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
493 |
BinaryDirName := 'binary'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
494 |
SourceDirName := 'source'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
495 |
ResourceDirName := 'resources'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
496 |
FileInDirName := 'fileIn'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
497 |
PackageDirName := 'packages'. |
2928 | 498 |
]. |
499 |
||
680 | 500 |
SystemPath isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
501 |
SystemPath := OperatingSystem defaultSystemPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
502 |
self flushPathCaches |
5139 | 503 |
]. |
504 |
||
5144 | 505 |
PackagePath isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
506 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 507 |
]. |
617 | 508 |
|
509 |
" |
|
510 |
Smalltalk initSystemPath |
|
511 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
512 |
|
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
513 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
514 |
OperatingSystem defaultPackagePath |
617 | 515 |
" |
5139 | 516 |
|
5145 | 517 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
518 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
519 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
520 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
521 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
522 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
523 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
524 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
525 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
526 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
527 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
528 |
! |
617 | 529 |
|
7526 | 530 |
initializeClass:aClass |
531 |
"sent from VM via #initializeModules" |
|
532 |
||
7527 | 533 |
Error handle:[:ex | |
14432 | 534 |
ObjectMemory printStackBacktrace. |
535 |
ClassesFailedToInitialize isNil ifTrue:[ |
|
536 |
ClassesFailedToInitialize := IdentitySet new. |
|
537 |
]. |
|
538 |
ClassesFailedToInitialize add:aClass. |
|
539 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
540 |
ex suspendedContext fullPrintAll. |
|
541 |
'------------------------------------------------' errorPrintCR. |
|
542 |
(Smalltalk commandLineArguments includes:'--debug') ifTrue:[ |
|
543 |
ex reject |
|
544 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
545 |
] do:[ |
14432 | 546 |
aClass initialize |
13675 | 547 |
]. |
548 |
||
549 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
550 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
551 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
552 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
553 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
554 |
send #initialize to all classes. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
555 |
Notice: this is not called when an image is restarted" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
556 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
557 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
558 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
559 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
560 |
ClassesFailedToInitialize := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
561 |
self initializeModulesOnce. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
562 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
563 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
564 |
] |
10122 | 565 |
]. |
566 |
||
567 |
ProjectDefinition initializeAllProjectDefinitions. |
|
568 |
||
569 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 570 |
! |
571 |
||
7563 | 572 |
initializeModulesOnce |
573 |
"perform module specific initialization and |
|
574 |
send #initialize to all classes. |
|
7527 | 575 |
Notice: this is not called when an image is restarted" |
4963 | 576 |
|
617 | 577 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
578 |
__init_registered_modules__(3); |
4963 | 579 |
|
1481 | 580 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 581 |
RETURN (self); |
582 |
%}. |
|
583 |
^ self primitiveFailed |
|
617 | 584 |
! |
585 |
||
7563 | 586 |
initializeSystem |
587 |
"initialize all other classes; setup dispatcher processes etc. |
|
3499 | 588 |
This one is the very first entry into the smalltalk world, |
589 |
right after startup, ususally immediately followed by Smalltalk>>start. |
|
10071 | 590 |
Notice: |
14432 | 591 |
this is not called when an image is restarted; in this |
592 |
case the show starts in Smalltalk>>restart." |
|
211 | 593 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
594 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
595 |
|
12861 | 596 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
597 |
|
3499 | 598 |
Initializing := true. |
599 |
AbstractOperatingSystem initializeConcreteClass. |
|
600 |
||
5400 | 601 |
CommandLineArguments isNil ifTrue:[ |
14432 | 602 |
CommandLineArguments := #('stx'). |
5400 | 603 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
604 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
605 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 606 |
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
|
607 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
608 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
609 |
VerboseLoading := (CommandLineArguments includes:'--verboseLoading'). |
348 | 610 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
611 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
612 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
613 |
StandAlone ifTrue:[ |
14432 | 614 |
InfoPrinting := false. |
615 |
ObjectMemory infoPrinting:false. |
|
616 |
||
617 |
idx := CommandLineArguments indexOf:'--debug'. |
|
618 |
idx ~~ 0 ifTrue:[ |
|
619 |
DebuggingStandAlone := true. |
|
620 |
]. |
|
621 |
DebuggingStandAlone ifTrue:[ |
|
622 |
Inspector := MiniInspector. |
|
623 |
Debugger := MiniDebugger. |
|
624 |
]. |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
625 |
] ifFalse:[ |
14432 | 626 |
"/ |
627 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
|
628 |
"/ to handle things. |
|
629 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
|
630 |
"/ |
|
631 |
Inspector := MiniInspector. |
|
632 |
Debugger := MiniDebugger. |
|
633 |
]. |
|
634 |
||
11057 | 635 |
Error handle:[:ex | |
14432 | 636 |
StandAlone ifTrue:[ |
637 |
DebuggingStandAlone ifFalse:[ |
|
638 |
'Startup Error - use --debug command line argument for more info' errorPrintCR. |
|
639 |
Smalltalk exit:1. |
|
640 |
]. |
|
641 |
'Startup Error' errorPrintCR. |
|
642 |
thisContext fullPrintAll. |
|
643 |
]. |
|
644 |
ex reject. |
|
11057 | 645 |
] do:[ |
14432 | 646 |
self basicInitializeSystem |
647 |
]. |
|
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
648 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
649 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
650 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
651 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
652 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
653 |
"this returns true, if the system is properly initialized; |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
654 |
i.e. false during startup. Especially, the whole viewing stuff is |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
655 |
not working correctly until initialized." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
656 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
657 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
658 |
! |
1 | 659 |
|
7563 | 660 |
reinitStandardStreams |
661 |
"reinitialize some well-known streams. |
|
662 |
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
|
663 |
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
|
664 |
(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
|
665 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
666 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 667 |
! ! |
668 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
669 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
670 |
|
10560 | 671 |
at:aKey ifAbsentPut:aBlock |
11977 | 672 |
"return the element indexed by aKey if present, |
673 |
if not present, store the result of evaluating valueBlock |
|
674 |
under aKey and return it." |
|
675 |
||
10560 | 676 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
677 |
||
678 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
679 |
! |
|
680 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
681 |
beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
682 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
683 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
684 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
685 |
garbageCollect |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
686 |
ObjectMemory garbageCollect |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
687 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
688 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
689 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
690 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
691 |
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
|
692 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
693 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
694 |
ObjectMemory scavenge. |
10071 | 695 |
^ ObjectMemory freeSpace |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
696 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
697 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
698 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
699 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
700 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
701 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
702 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
703 |
|
10844 | 704 |
platformName |
705 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
706 |
||
707 |
^ OperatingSystem platformName asUppercaseFirst |
|
708 |
||
709 |
" |
|
710 |
Smalltalk platformName -> 'Win32' |
|
711 |
" |
|
712 |
! |
|
713 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
714 |
registerExternalObject: anObject |
7563 | 715 |
"Register the given object in the external objects array and return its index. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
716 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
717 |
ExternalObjects are protected from GC and can be accessed easily from |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
718 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
719 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
720 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
721 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
722 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
723 |
objects isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
724 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
725 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
726 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
727 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
728 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
729 |
1 to: objects size do: [:i | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
730 |
obj := objects at: i. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
731 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
732 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
733 |
firstEmptyIndex := i |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
734 |
] |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
735 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
736 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
737 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
738 |
firstEmptyIndex = 0 ifTrue: [ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
739 |
sz := objects size. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
740 |
newObjects := objects species new: sz + 20. "grow linearly" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
741 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
742 |
firstEmptyIndex := sz + 1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
743 |
SpecialObjectArray := newObjects. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
744 |
objects := newObjects |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
745 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
746 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
747 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
748 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
749 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
750 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
751 |
|
12358 | 752 |
removeClassNamed: aName |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
753 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
12358 | 754 |
If anything untoward happens, report it in the Transcript. " |
755 |
||
756 |
| oldClass | |
|
757 |
||
758 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
759 |
Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
760 |
^ self |
12358 | 761 |
]. |
762 |
oldClass removeFromSystem |
|
763 |
! |
|
764 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
765 |
renameClassNamed:oldName as:newName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
766 |
self renameClass:(self at:oldName) to:newName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
767 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
768 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
769 |
unregisterExternalObject: anObject |
10071 | 770 |
"Unregister the given object in the external objects array. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
771 |
Do nothing if it isn't registered." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
772 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
773 |
|objects| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
774 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
775 |
anObject isNil ifTrue:[^ self]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
776 |
objects := SpecialObjectArray. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
777 |
1 to: objects size do: [:i | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
778 |
(objects at: i) == anObject ifTrue: [ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
779 |
objects at: i put: nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
780 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
781 |
]. |
10844 | 782 |
! |
783 |
||
784 |
windowSystemName |
|
785 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
786 |
||
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
787 |
|platformName| |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
788 |
|
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
789 |
platformName := Screen current platformName. |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
790 |
platformName = #WIN32 ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
791 |
^ #Win32. |
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
792 |
]. |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
793 |
^ platformName. |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
794 |
|
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
795 |
" |
11375 | 796 |
Smalltalk windowSystemName |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
797 |
-> 'Win32' |
10844 | 798 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
799 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
800 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
801 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
802 |
|
7563 | 803 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
804 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 805 |
|
806 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 807 |
! |
808 |
||
809 |
declareConstant:constantName poolName:poolName value:value |
|
810 |
|pool| |
|
811 |
||
812 |
pool := self classNamed:poolName. |
|
813 |
pool declareConstant:constantName value:value |
|
814 |
! |
|
815 |
||
816 |
declarePoolDictionary:poolDictionaryName |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
817 |
^ SharedPool subclass:(poolDictionaryName asSymbol) |
14432 | 818 |
instanceVariableNames:'' |
819 |
classVariableNames:'' |
|
820 |
poolDictionaries:'' |
|
821 |
category:nil |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
822 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
823 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
824 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
825 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
826 |
declareVariable:varName poolName:poolName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
827 |
|pool| |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
828 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
829 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
830 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
831 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
832 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
833 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
834 |
|
7295 | 835 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
836 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
837 |
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
|
838 |
^ self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
839 |
defineClass:nameSymbol |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
840 |
superclass:superclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
841 |
indexedType:indexed |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
842 |
private:private |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
843 |
instanceVariableNames:instVars |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
844 |
classInstanceVariableNames:classInstVars |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
845 |
imports:imports |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
846 |
category:category |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
847 |
attributes:nil |
12033 | 848 |
! |
849 |
||
7563 | 850 |
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
|
851 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
852 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
853 |
indexed == #none ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
854 |
newClass := superclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
855 |
subclass:nameSymbol |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
856 |
instanceVariableNames:instVars |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
857 |
classVariableNames:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
858 |
poolDictionaries:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
859 |
category:category |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
860 |
inEnvironment:self. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
861 |
classInstVars size > 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
862 |
newClass class instanceVariableNames:classInstVars. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
863 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
864 |
^ newClass |
6851 | 865 |
]. |
866 |
self shouldImplement. |
|
12033 | 867 |
! |
868 |
||
869 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
870 |
|newNameSpace| |
|
871 |
||
872 |
private ifTrue:[self halt]. "/ what to do ? |
|
873 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
874 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
875 |
newNameSpace setCategory:category. |
12033 | 876 |
^ newNameSpace |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
877 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
878 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
879 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
880 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
881 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
882 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
883 |
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
|
884 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
885 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
886 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
887 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
888 |
val := self at:aKey ifAbsent:nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
889 |
val isNil ifTrue:[^ nil]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
890 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
891 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
892 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
893 |
! |
3083 | 894 |
|
7563 | 895 |
associationAt:aKey ifAbsent:exceptionBlock |
896 |
"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
|
897 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
898 |
Since ST/X's Smalltalk as no real dictionary, this is |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
899 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
900 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
901 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
902 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
903 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
904 |
val isNil ifTrue:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
905 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
906 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
907 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
908 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
909 |
|
7563 | 910 |
at:aKey |
10071 | 911 |
"retrieve the value stored under aKey, a symbol. |
912 |
Return nil if not present |
|
1956 | 913 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 914 |
|
6851 | 915 |
aKey class == String ifTrue:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
916 |
|
453 | 917 |
%{ /* NOCONTEXT */ |
918 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 919 |
%}. |
5410 | 920 |
^ self primitiveFailed |
453 | 921 |
! |
922 |
||
7563 | 923 |
at:aKey ifAbsent:aBlock |
924 |
"retrieve the value stored at aKey. |
|
7565 | 925 |
If there is nothing stored under this key, return the value of |
926 |
the evaluation of aBlock." |
|
453 | 927 |
|
928 |
(self includesKey:aKey) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
929 |
^ self at:aKey |
453 | 930 |
]. |
931 |
^ aBlock value |
|
932 |
||
933 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
934 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
935 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
936 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
937 |
! |
453 | 938 |
|
7563 | 939 |
at:aKey ifPresent:aBlock |
940 |
"try to retrieve the value stored at aKey. |
|
941 |
If there is nothing stored under this key, do nothing. |
|
4870 | 942 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
943 |
||
13883 | 944 |
|val| |
945 |
||
4870 | 946 |
(self includesKey:aKey) ifTrue:[ |
14432 | 947 |
(val := self at:aKey) notNil ifTrue:[ |
948 |
^ aBlock value:val |
|
949 |
] |
|
4870 | 950 |
]. |
951 |
^ nil |
|
952 |
||
953 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
954 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
955 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
956 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
957 |
|
13883 | 958 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
959 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
960 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
961 |
at:aKey put:aValue |
7563 | 962 |
"store the argument aValue under aKey, a symbol. |
963 |
Return aValue (sigh)." |
|
453 | 964 |
|
965 |
|oldValue| |
|
966 |
||
967 |
%{ |
|
968 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
969 |
%}. |
|
970 |
CachedClasses notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
971 |
oldValue isBehavior ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
972 |
oldValue name == aKey ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
973 |
CachedClasses remove:oldValue ifAbsent:[] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
974 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
975 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
976 |
aValue isBehavior ifTrue:[ |
1956 | 977 |
"/ aValue isMeta ifTrue:[ |
978 |
"/ "/ this should not happen |
|
979 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
980 |
"/ ]. |
|
981 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
982 |
aValue name == aKey ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
983 |
CachedClasses add:aValue |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
984 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
985 |
CachedClasses := nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
986 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
987 |
]. |
453 | 988 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
989 |
^ aValue. |
1955 | 990 |
"/ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
991 |
"/%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
992 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
993 |
"/%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
994 |
"/ CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
995 |
"/ ^ aValue |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
996 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
997 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
998 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
999 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1000 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1001 |
"return true, if the key is known" |
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 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1004 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1005 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1006 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1007 |
"/ aKey class == String ifTrue:[self halt]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1008 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1009 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1010 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1011 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1012 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1013 |
! |
453 | 1014 |
|
7563 | 1015 |
keyAtValue:anObject |
1016 |
"return the symbol under which anObject is stored - or nil" |
|
453 | 1017 |
|
1018 |
self keysDo:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1019 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1020 |
]. |
1021 |
^ nil |
|
1022 |
||
1023 |
"Smalltalk keyAtValue:Object" |
|
1024 |
! |
|
1025 |
||
7563 | 1026 |
keys |
1027 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1028 |
||
1029 |
|keys| |
|
453 | 1030 |
|
1031 |
keys := IdentitySet new. |
|
1032 |
self keysDo:[:k | keys add:k]. |
|
1033 |
^ keys |
|
617 | 1034 |
! |
1035 |
||
7563 | 1036 |
removeKey:aKey |
1037 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1038 |
WARNING: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1039 |
this is somewhat dangerous: conceptionally, the association is removed, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1040 |
to which machine & byte compiled code refers if it accesses a global. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1041 |
If there are still global accesses in some literalArray or from machine-compiled code, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1042 |
it continues to reference the globals value via that obsolete association and gets a nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1043 |
value. (which is correct) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1044 |
However, if that global is later reintroduced, a new association will be created and |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1045 |
the new global now referenced via the new association. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1046 |
The old accesses will still see nil, although the globals value is actually non-nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1047 |
(this is questionable). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1048 |
To avoid this problem, the #removeClass: method never removed the key." |
617 | 1049 |
|
1050 |
CachedClasses := nil. |
|
1051 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1052 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1053 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1054 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1055 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1056 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1057 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1058 |
|
10538 | 1059 |
startBlocks |
1060 |
^ StartBlocks |
|
1061 |
! |
|
1062 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1063 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1064 |
"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
|
1065 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1066 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1067 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1068 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1069 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1070 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1071 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1072 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1073 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1074 |
|
13540 | 1075 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1076 |
!Smalltalk class methodsFor:'browsing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1077 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1078 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1079 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1080 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1081 |
"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
|
1082 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1083 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1084 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1085 |
" |
10071 | 1086 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1087 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1088 |
! |
617 | 1089 |
|
7563 | 1090 |
browseAllSelect:aBlock |
1091 |
"{ Pragma: +optSpace }" |
|
1092 |
||
1093 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1094 |
|
6020 | 1095 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 1096 |
|
1097 |
" |
|
1098 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1099 |
" |
|
1100 |
! |
|
1101 |
||
7563 | 1102 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1103 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1104 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1105 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1106 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1107 |
ChangesBrowser notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1108 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1109 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1110 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1111 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1112 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1113 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1114 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1115 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1116 |
! |
453 | 1117 |
|
7563 | 1118 |
browseClass:aClass |
1119 |
"{ Pragma: +optSpace }" |
|
1120 |
||
11375 | 1121 |
"startup a browser on aClass. |
11150 | 1122 |
The broser will only show that class (i.e. be a singleClass-browser). |
1123 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1124 |
|
1125 |
UserPreferences systemBrowserClass browseClass:aClass |
|
1126 |
||
1127 |
" |
|
10071 | 1128 |
Smalltalk browseClass:Array |
6970 | 1129 |
" |
1130 |
! |
|
1131 |
||
7563 | 1132 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1133 |
"{ Pragma: +optSpace }" |
|
6819 | 1134 |
|
1135 |
"startup a browser for all methods implementing a message matching" |
|
1136 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1137 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1138 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1139 |
" |
10071 | 1140 |
Smalltalk browseImplementorsOf:#'at:put:' |
1141 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
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 |
! |
6819 | 1144 |
|
7563 | 1145 |
browseImplementorsOf:aSelectorSymbol |
1146 |
"{ Pragma: +optSpace }" |
|
1147 |
||
1148 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1149 |
|
6020 | 1150 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 1151 |
|
1152 |
" |
|
10071 | 1153 |
Smalltalk browseImplementorsOf:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1154 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1155 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1156 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1157 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1158 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1159 |
|
11150 | 1160 |
"startup a full browser showing aClass. |
1161 |
The browser will be a full browser with aClass initially selekted. |
|
1162 |
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
|
1163 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1164 |
UserPreferences systemBrowserClass openInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1165 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1166 |
" |
10071 | 1167 |
Smalltalk browseInClass:Array |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1168 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1169 |
! |
6970 | 1170 |
|
7563 | 1171 |
browseInClass:aClass selector:selector |
1172 |
"{ Pragma: +optSpace }" |
|
1173 |
||
11150 | 1174 |
"startup a full browser showing aClass>>selector. |
1175 |
The browser will be a full browser with aClass initially selekted. |
|
1176 |
See browseClass: for a singleClass browser, which shows only a single class." |
|
6970 | 1177 |
|
1178 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
1179 |
||
1180 |
" |
|
1181 |
Smalltalk browseInClass:Array selector:#at: |
|
1182 |
" |
|
453 | 1183 |
! ! |
1184 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1185 |
!Smalltalk class methodsFor:'class management'! |
453 | 1186 |
|
7563 | 1187 |
changeCategoryOf:aClass to:newCategory |
1188 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1189 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1190 |
|
8405 | 1191 |
|ns oldCategory| |
1192 |
||
1193 |
oldCategory := aClass category. |
|
1194 |
oldCategory ~= newCategory ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1195 |
aClass category:(newCategory withoutSeparators asSymbol). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1196 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1197 |
"notify change of category" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1198 |
ns := aClass environment ? self. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1199 |
ns changed:#organization with:(aClass -> oldCategory). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1200 |
ns ~~ self ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1201 |
self changed:#organization with:(aClass -> oldCategory). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1202 |
] |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1203 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1204 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1205 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1206 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1207 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1208 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1209 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1210 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1211 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1212 |
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
|
1213 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1214 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1215 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1216 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1217 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1218 |
CachedClasses notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1219 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1220 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1221 |
! |
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 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1224 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1225 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1226 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1227 |
Smalltalk flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1228 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1229 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1230 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1231 |
removeClass:aClass |
7563 | 1232 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1233 |
we have to flush the caches since these methods are now void. |
1234 |
Also, class variables of aClass are removed." |
|
1235 |
||
4781 | 1236 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 1237 |
|
4099 | 1238 |
aClass isNil ifTrue:[^ self]. |
4781 | 1239 |
|
453 | 1240 |
oldName := aClass name. |
4781 | 1241 |
sym := oldNameSym := oldName asSymbol. |
1242 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1243 |
"check other name ..." |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1244 |
(self includes:aClass) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1245 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1246 |
^ self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1247 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1248 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1249 |
the class has changed its name - without telling me ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1250 |
what should be done in this case ? |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1251 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1252 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1253 |
' has changed its name' errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1254 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1255 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1256 |
"/ might be an alias (i.e. removing a compatibility name) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1257 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1258 |
actualName := self keyAtValue:aClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1259 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1260 |
sym := actualName asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1261 |
oldName := actualName asString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1262 |
wrongName := true. |
453 | 1263 |
]. |
1264 |
||
4781 | 1265 |
ns := aClass nameSpace. |
1266 |
aClass topOwningClass notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1267 |
ons := aClass topOwningClass nameSpace |
4781 | 1268 |
]. |
1269 |
||
453 | 1270 |
self at:sym put:nil. "nil it out for compiled accesses" |
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1271 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1272 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1273 |
"/ see comment in removeKey: on why we dont remove it here |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1274 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1275 |
"/ self removeKey:sym. "/ remove key - this actually fails, if there are |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1276 |
"/ still compiled code references." |
453 | 1277 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1278 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1279 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1280 |
aClass privateClassesSorted do:[:somePrivateClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1281 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1282 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1283 |
|
453 | 1284 |
"remove class variables" |
1285 |
||
1286 |
names := aClass classVariableString asCollectionOfWords. |
|
1287 |
names do:[:name | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1288 |
cSym := aClass globalKeyForClassVar:name. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1289 |
self at:cSym asSymbol put:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1290 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1291 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1292 |
"/ see comment in removeKey: on why we dont remove it here |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1293 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1294 |
"/ self removeKey:cSym |
453 | 1295 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1296 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1297 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1298 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1299 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1300 |
"/ but we have to delay this, until we have the set of subclasses |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1301 |
"/ at hand - for now, searching for all subclasses is way more |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1302 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1303 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1304 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1305 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1306 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1307 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1308 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1309 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1310 |
|
453 | 1311 |
ObjectMemory flushInlineCaches. |
1312 |
ObjectMemory flushMethodCache. |
|
1313 |
||
7181 | 1314 |
aClass addChangeRecordForClassRemove. |
453 | 1315 |
self changed:#classRemove with:aClass. |
1316 |
||
7581
6912a7336e15
class category: sends a change notification;
Claus Gittinger <cg@exept.de>
parents:
7572
diff
changeset
|
1317 |
aClass setCategory:#'* removed *'. |
1655 | 1318 |
|
12700 | 1319 |
"/ self flushCachedClasses. |
1320 |
"/ Class flushSubclassInfo. |
|
1321 |
self flushCachedClass:aClass. |
|
1322 |
Class flushSubclassInfoFor:aClass superclass. |
|
1323 |
Class flushSubclassInfoFor:aClass. |
|
5326 | 1324 |
|
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1325 |
wrongName == true ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1326 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1327 |
"/ an alias (i.e. removing a compatibility name) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1328 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1329 |
"/ check if there are more refs to it ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1330 |
[self includes:aClass] whileTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1331 |
actualName := self keyAtValue:aClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1332 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1333 |
, ' - remove that binding too.') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1334 |
self at:actualName put:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1335 |
]. |
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1336 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1337 |
|
4781 | 1338 |
ns ~~ Smalltalk ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1339 |
ons notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1340 |
ClassBuilder |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1341 |
recompileGlobalAccessorsTo:oldNameSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1342 |
in:ons |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1343 |
except:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1344 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1345 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1346 |
ClassBuilder |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1347 |
recompileGlobalAccessorsTo:oldNameSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1348 |
in:ns |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1349 |
except:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1350 |
]. |
10182 | 1351 |
]. |
1352 |
||
1353 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1354 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1355 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1356 |
renameClass:aClass to:newName |
7563 | 1357 |
"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
|
1358 |
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
|
1359 |
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
|
1360 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1361 |
|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
|
1362 |
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
|
1363 |
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
|
1364 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1365 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1366 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1367 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1368 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1369 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1370 |
[i2 ~~ 0] whileTrue:[ |
14611 | 1371 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
1372 |
i2 ~~ 0 ifTrue:[ |
|
1373 |
nm := newName copyFrom:i1 to:i2-1. |
|
1374 |
ns isNameSpace ifTrue:[ |
|
1375 |
subns := ns at:nm asSymbol ifAbsent:nil. |
|
1376 |
subns isNil ifTrue:[ |
|
1377 |
self error:'Nonexisting namespace: ',nm. |
|
1378 |
^ nil. |
|
1379 |
]. |
|
1380 |
] ifFalse:[ |
|
1381 |
subns := ns privateClassesAt:nm asSymbol. |
|
1382 |
subns isNil ifTrue:[ |
|
1383 |
self error:'Cannot create a namespace below a class' |
|
1384 |
] |
|
1385 |
]. |
|
1386 |
ns := subns. |
|
1387 |
i1 := i2 + 2. |
|
1388 |
]. |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1389 |
]. |
617 | 1390 |
|
1391 |
oldName := aClass name. |
|
6734 | 1392 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1393 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1394 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1395 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1396 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1397 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1398 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
14611 | 1399 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
1400 |
^ self |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1401 |
]. |
617 | 1402 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1403 |
"/ rename the class |
617 | 1404 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1405 |
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
|
1406 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1407 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1408 |
ns isNameSpace ifFalse:[ |
14611 | 1409 |
aClass isPrivate ifTrue:[ |
1410 |
aClass class setOwningClass:ns. |
|
1411 |
] ifFalse:[ |
|
1412 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
|
1413 |
oldMetaclass := aClass class. |
|
1414 |
newMetaclass := PrivateMetaclass new. |
|
1415 |
newMetaclass flags:(oldMetaclass flags). |
|
1416 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1417 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1418 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1419 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1420 |
newMetaclass setSoleInstance:aClass. |
|
1421 |
newMetaclass setOwningClass:ns. |
|
1422 |
||
1423 |
aClass changeClassTo:newMetaclass. |
|
1424 |
ObjectMemory flushCaches. |
|
1425 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1426 |
] ifTrue:[ |
14611 | 1427 |
aClass isPrivate ifTrue:[ |
1428 |
newCategory := aClass topOwningClass category. |
|
1429 |
||
1430 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
|
1431 |
oldMetaclass := aClass class. |
|
1432 |
||
1433 |
newMetaclass := Metaclass new. |
|
1434 |
newMetaclass flags:(oldMetaclass flags). |
|
1435 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
|
1436 |
newMetaclass instSize:(oldMetaclass instSize). |
|
1437 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
|
1438 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
|
1439 |
newMetaclass setSoleInstance:aClass. |
|
1440 |
||
1441 |
aClass category:newCategory. |
|
1442 |
aClass changeClassTo:newMetaclass. |
|
1443 |
ObjectMemory flushCaches. |
|
1444 |
] |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1445 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1446 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1447 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1448 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1449 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1450 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1451 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1452 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1453 |
"/ see comment in #removeKey: on why we dont remove it it here |
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1454 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1455 |
"/ self removeKey:oldSym. |
617 | 1456 |
self at:newSym put:aClass. |
1457 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1458 |
"/ 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
|
1459 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1460 |
oldNameToNewName := IdentityDictionary new. |
617 | 1461 |
|
1462 |
names := aClass classVariableString asCollectionOfWords. |
|
1463 |
names do:[:name | |
|
14611 | 1464 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
1465 |
value := self at:oldCVSym. |
|
1466 |
self at:oldCVSym put:nil. |
|
1467 |
||
1468 |
"/ |
|
1469 |
"/ see comment in #removeKey: on why we dont remove it it here |
|
1470 |
"/ |
|
1471 |
"/ self removeKey:cSym. |
|
1472 |
||
1473 |
newCVSym := (newSym , ':' , name) asSymbol. |
|
1474 |
self at:newCVSym put:value. |
|
1475 |
||
1476 |
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
|
1477 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1478 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1479 |
"/ 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
|
1480 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1481 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
14611 | 1482 |
aClass withAllSubclasses do:[:aSubClass | |
1483 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
|
1484 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
|
1485 |
aMethod changeLiteral:oldNameSym to:newNameSym |
|
1486 |
]. |
|
1487 |
]. |
|
1488 |
||
1489 |
"/ and also in privateClasses ? ... |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1490 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1491 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1492 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1493 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1494 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1495 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1496 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1497 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1498 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1499 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1500 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1501 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1502 |
"/ ] |
617 | 1503 |
]. |
1504 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1505 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1506 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1507 |
"/ 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
|
1508 |
aClass setEnvironment:nil. |
6734 | 1509 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1510 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1511 |
privateClasses size > 0 ifTrue:[ |
14611 | 1512 |
"/ must rename privateClasses as well |
1513 |
Class withoutUpdatingChangesDo:[ |
|
1514 |
privateClasses do:[:aPrivateClass | |
|
1515 |
self renameClass:aPrivateClass |
|
1516 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
|
1517 |
||
1518 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
|
1519 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1520 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
|
1521 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
|
1522 |
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
|
1523 |
"/ ClassBuilder |
10071 | 1524 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1525 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1526 |
"/ except:nil. |
14611 | 1527 |
] |
1528 |
] |
|
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1529 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1530 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1531 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1532 |
|
14611 | 1533 |
"/ all those referencing the class from the old nameSpace |
1534 |
"/ must be recompiled ... |
|
1535 |
"/ (to now access the global from smalltalk) |
|
1536 |
||
1537 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
|
1538 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
|
1539 |
||
1540 |
ClassBuilder |
|
1541 |
recompileGlobalAccessorsTo:oldName asSymbol |
|
1542 |
in:oldNameSpace |
|
1543 |
except:nil. |
|
1544 |
]. |
|
1545 |
||
1546 |
"/ all referencing the class in the new namespace |
|
1547 |
"/ as well; to now access the new class. |
|
1548 |
||
1549 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
|
1550 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
|
1551 |
||
1552 |
ClassBuilder |
|
1553 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
|
1554 |
in:newNameSpace |
|
1555 |
except:nil. |
|
1556 |
]. |
|
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1557 |
] ifFalse:[ |
14611 | 1558 |
"/ all references to a global with my new name in my owning class |
1559 |
"/ must now be redirected to myself. |
|
1560 |
||
1561 |
aClass isPrivate ifTrue:[ |
|
1562 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
|
1563 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
|
1564 |
||
1565 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1566 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1567 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
|
1568 |
||
1569 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1570 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
|
1571 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
|
1572 |
||
1573 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1574 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1575 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
|
1576 |
||
1577 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
|
1578 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
|
1579 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
|
1580 |
] |
|
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1581 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1582 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1583 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1584 |
"/ 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
|
1585 |
aClass allSubclassesDo:[:subClass | |
14611 | 1586 |
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
|
1587 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1588 |
"/ 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
|
1589 |
aClass subclassesDo:[:subClass | |
14611 | 1590 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1591 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1592 |
self changed:#definition. |
14611 | 1593 |
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
|
1594 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1595 |
"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
|
1596 |
"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
|
1597 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1598 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1599 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1600 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1601 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1602 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1603 |
"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
|
1604 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1605 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1606 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1607 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1608 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1609 |
|
10952 | 1610 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1611 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1612 |
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
|
1613 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1614 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1615 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1616 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1617 |
! |
453 | 1618 |
|
7563 | 1619 |
shallowCopy |
1620 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1621 |
|
1622 |
^ self |
|
1410 | 1623 |
|
1624 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1625 |
! |
1626 |
||
7563 | 1627 |
simpleDeepCopy |
1628 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1629 |
|
1630 |
^ self |
|
1410 | 1631 |
|
1632 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1633 |
! ! |
1634 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1635 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1636 |
|
7563 | 1637 |
compileTrace:aBoolean |
1638 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1639 |
%{ |
1640 |
extern char __compileTrace__; |
|
1641 |
||
1642 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1643 |
%} |
|
1644 |
" |
|
1645 |
Smalltalk compileTrace:true |
|
1646 |
Smalltalk compileTrace:false |
|
1647 |
" |
|
1648 |
! |
|
1649 |
||
7563 | 1650 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1651 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1652 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1653 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1654 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1655 |
WARNING: this method is for debugging only |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1656 |
it will be removed without notice." |
453 | 1657 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1658 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1659 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1660 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1661 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1662 |
! |
453 | 1663 |
|
7563 | 1664 |
exitWithCoreDump |
1665 |
"{ Pragma: +optSpace }" |
|
1666 |
||
1667 |
"abort program and dump core" |
|
1668 |
||
1669 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1670 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1671 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1672 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1673 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1674 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1675 |
|
617 | 1676 |
! |
1677 |
||
7563 | 1678 |
fatalAbort |
1679 |
"{ Pragma: +optSpace }" |
|
1680 |
||
1681 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1682 |
(You may turn off the stack print with debugPrinting:false)" |
1683 |
%{ |
|
1684 |
__fatal0(__context, "fatalAbort"); |
|
1685 |
/* NEVER RETURNS */ |
|
5410 | 1686 |
%}. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1687 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1688 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1689 |
! |
617 | 1690 |
|
7563 | 1691 |
fatalAbort:aMessage |
1692 |
"{ Pragma: +optSpace }" |
|
1693 |
||
1694 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1695 |
(You may turn off the stack print with debugPrinting:false)" |
1696 |
||
1697 |
%{ |
|
1698 |
char *msg; |
|
1699 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1700 |
if (__isStringLike(aMessage)) |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1701 |
msg = (char *) __stringVal(aMessage); |
617 | 1702 |
else |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1703 |
msg = "fatalAbort"; |
617 | 1704 |
|
1705 |
__fatal0(__context, msg); |
|
1706 |
/* NEVER RETURNS */ |
|
5410 | 1707 |
%}. |
1708 |
^ self primitiveFailed |
|
5441 | 1709 |
! |
1710 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1711 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1712 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1713 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1714 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1715 |
IgnoreHalt isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1716 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1717 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1718 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1719 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1720 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1721 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1722 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1723 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1724 |
"control if halts are to be ignored; |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1725 |
usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1726 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1727 |
IgnoreHalt := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1728 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1729 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1730 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1731 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1732 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1733 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1734 |
" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1735 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1736 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1737 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1738 |
|
7563 | 1739 |
vmInstructionTrace:aBoolean |
13947 | 1740 |
self halt:'not yet implemented' |
1741 |
||
1742 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 1743 |
! ! |
1744 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1745 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 1746 |
|
453 | 1747 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1748 |
"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
|
1749 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1750 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1751 |
|
1752 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1753 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1754 |
" |
7563 | 1755 |
! |
1756 |
||
1757 |
allClassCategories |
|
1758 |
"return a set of all class categories in the system" |
|
1759 |
||
1760 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1761 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1762 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1763 |
Smalltalk allClassesDo:[:cls | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1764 |
|category| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1765 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1766 |
category := cls category. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1767 |
category notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1768 |
allCategories add:category. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1769 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1770 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1771 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1772 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1773 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1774 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1775 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1776 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1777 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1778 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1779 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1780 |
|
7563 | 1781 |
allClassesAndMetaclassesDo:aBlock |
1782 |
"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
|
1783 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1784 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1785 |
|
12861 | 1786 |
already := IdentitySet new:NumberOfClassesHint*2. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1787 |
self allClassesDo:[:eachClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1788 |
|cls| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1789 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1790 |
cls := eachClass theNonMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1791 |
(already includes:cls) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1792 |
aBlock value:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1793 |
already add:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1794 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1795 |
cls := cls class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1796 |
(already includes:cls) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1797 |
aBlock value:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1798 |
already add:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1799 |
]. |
8583
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 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1802 |
|
7563 | 1803 |
allClassesDo:aBlock |
1804 |
"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
|
1805 |
|
5765 | 1806 |
self allClasses do:aBlock |
453 | 1807 |
|
1808 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1809 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1810 |
" |
1811 |
! |
|
1812 |
||
9506 | 1813 |
allClassesForWhich:filter |
10071 | 1814 |
"return a collection with all classes in the system, |
9506 | 1815 |
for which filter evaluates to true." |
1816 |
||
1817 |
|collectedClasses| |
|
1818 |
||
1819 |
collectedClasses := OrderedCollection new. |
|
1820 |
self allClassesForWhich:filter do:[:cls | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1821 |
collectedClasses add:cls |
9506 | 1822 |
]. |
1823 |
^ collectedClasses |
|
1824 |
||
1825 |
" |
|
10071 | 1826 |
Smalltalk |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1827 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 1828 |
" |
1829 |
||
1830 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
1831 |
! |
|
1832 |
||
9292 | 1833 |
allClassesForWhich:filter do:aBlock |
1834 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true." |
|
1835 |
||
1836 |
self allClassesDo:[:cls | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1837 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 1838 |
]. |
1839 |
||
1840 |
" |
|
1841 |
Smalltalk |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1842 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1843 |
do:[:aClass | Transcript showCR:aClass name] |
9292 | 1844 |
" |
1845 |
! |
|
1846 |
||
7563 | 1847 |
allClassesInCategory:aCategory |
1848 |
"return a collection of for all classes in aCategory; |
|
1299 | 1849 |
The order of the classes is not defined." |
1850 |
||
9506 | 1851 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1852 |
|
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 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1855 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1856 |
|
9506 | 1857 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1858 |
! |
1299 | 1859 |
|
7563 | 1860 |
allClassesInCategory:aCategory do:aBlock |
1861 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 1862 |
The order of the classes is not defined." |
1863 |
||
1864 |
aCategory notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1865 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 1866 |
] |
1867 |
||
1868 |
" |
|
9490 | 1869 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
1870 |
" |
|
1871 |
||
1872 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1873 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1874 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1875 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 1876 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 1877 |
superclasses come first - then subclasses" |
1878 |
||
1879 |
|classes| |
|
1880 |
||
1881 |
aCategory notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1882 |
classes := OrderedCollection new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1883 |
self allClassesInCategory:aCategory do:[:aClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1884 |
classes add:aClass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1885 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1886 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1887 |
classes do:aBlock |
453 | 1888 |
] |
1889 |
||
1890 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1891 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1892 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1893 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1894 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1895 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1896 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1897 |
allClassesInOrderDo:aBlock |
7563 | 1898 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 1899 |
Evaluation order is by inheritance: superclasses come first." |
1900 |
||
1901 |
|already| |
|
1902 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1903 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1904 |
self allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1905 |
(already includes:eachClass) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1906 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1907 |
(already includes:eachSuperClass) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1908 |
already add:eachSuperClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1909 |
aBlock value:eachSuperClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1910 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1911 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1912 |
already add:eachClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1913 |
aBlock value:eachClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1914 |
] |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1915 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1916 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1917 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1918 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 1919 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1920 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1921 |
|
9506 | 1922 |
allClassesInPackage:aPackageID |
1923 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 1924 |
The order of the classes is not defined. |
1925 |
The returned collection may include private classes" |
|
9506 | 1926 |
|
1927 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
1928 |
||
1929 |
" |
|
10071 | 1930 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 1931 |
" |
1932 |
||
1933 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 1934 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 1935 |
! |
1936 |
||
9490 | 1937 |
allClassesInPackage:aPackageID do:aBlock |
1938 |
"evaluate the argument, aBlock for all classes a package; |
|
1939 |
The order of the classes is not defined." |
|
1940 |
||
1941 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
1942 |
||
1943 |
" |
|
10071 | 1944 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 1945 |
" |
1946 |
||
1947 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
1948 |
! |
|
1949 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1950 |
allKeysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1951 |
"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
|
1952 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1953 |
^ self keysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1954 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1955 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1956 |
allMethodCategories |
12298 | 1957 |
"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
|
1958 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1959 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1960 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1961 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1962 |
Smalltalk allClassesDo:[:cls | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1963 |
allCategories addAll:cls categories. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1964 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1965 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1966 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1967 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1968 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1969 |
Smalltalk allMethodCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1970 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1971 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1972 |
|
9259 | 1973 |
allMethodsDo:aBlock |
12298 | 1974 |
"enumerate all methods in all classes" |
12000 | 1975 |
|
9259 | 1976 |
Smalltalk allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1977 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1978 |
aBlock value:mthd |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1979 |
] |
12298 | 1980 |
]. |
1981 |
! |
|
1982 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
1983 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1984 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
1985 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1986 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1987 |
Smalltalk allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1988 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1989 |
aTwoArgBlock value:mthd value:sel |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1990 |
] |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1991 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1992 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1993 |
|
7563 | 1994 |
associationsDo:aBlock |
10071 | 1995 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 1996 |
in the Smalltalk dictionary" |
1997 |
||
1998 |
self keysDo:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1999 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 2000 |
] |
2001 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
2002 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 2003 |
! |
2004 |
||
7563 | 2005 |
basicKeys |
2006 |
"for rel > 5 only" |
|
2007 |
||
2008 |
self primitiveFailed |
|
2009 |
||
2010 |
||
2011 |
||
2012 |
||
2013 |
||
2014 |
||
2015 |
! |
|
2016 |
||
2017 |
do:aBlock |
|
2018 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2019 |
|
2020 |
|work| |
|
2021 |
||
2022 |
%{ /* 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
|
2023 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2024 |
RETURN (self); |
2025 |
%}. |
|
2026 |
self keysDo:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2027 |
aBlock value:(self at:aKey) |
5406 | 2028 |
] |
617 | 2029 |
! |
2030 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2031 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2032 |
"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
|
2033 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2034 |
self keysDo:[:aKey | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2035 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2036 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2037 |
! |
617 | 2038 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2039 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2040 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2041 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2042 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2043 |
self keysAndValuesDo:[:eachKey :eachValue | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2044 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2045 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2046 |
]. |
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2047 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2048 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2049 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2050 |
" |
10071 | 2051 |
Smalltalk |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2052 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2053 |
thenCollect:[:nm :val | nm] |
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2054 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2055 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2056 |
|
7563 | 2057 |
keysDo:aBlock |
2058 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2059 |
|work| |
2060 |
||
2061 |
%{ /* 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
|
2062 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2063 |
RETURN (self); |
2064 |
%}. |
|
2065 |
self basicKeys do:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2066 |
aBlock value:aKey |
5406 | 2067 |
] |
453 | 2068 |
! ! |
2069 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2070 |
!Smalltalk class methodsFor:'message control'! |
453 | 2071 |
|
7563 | 2072 |
silentLoading |
12408 | 2073 |
"returns the Silentloading class variable, which globally controls if compilation |
2074 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2075 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2076 |
^ SilentLoading ? false |
7563 | 2077 |
! |
2078 |
||
2079 |
silentLoading:aBoolean |
|
2080 |
"{ Pragma: +optSpace }" |
|
2081 |
||
2082 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2083 |
messages (especially during fileIn) onto the transcript. |
453 | 2084 |
You can save a snapshot with this flag set to true, which makes |
2085 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2086 |
||
2087 |
|prev| |
|
2088 |
||
2089 |
prev := SilentLoading. |
|
2090 |
SilentLoading := aBoolean. |
|
2091 |
^ prev |
|
12409 | 2092 |
! |
2093 |
||
2094 |
silentlyLoadingDo:aBlock |
|
2095 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2096 |
are shown on the transcript" |
|
2097 |
||
2098 |
|sav| |
|
2099 |
||
2100 |
sav := SilentLoading. |
|
2101 |
SilentLoading := true. |
|
2102 |
aBlock ensure:[ SilentLoading := sav ]. |
|
453 | 2103 |
! ! |
2104 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2105 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2106 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2107 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2108 |
"set/clear the headlessOperation flag." |
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 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2111 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2112 |
|
10231 | 2113 |
beSTScript:aBoolean |
2114 |
"set/clear the isSTScript flag." |
|
2115 |
||
2116 |
IsSTScript := aBoolean |
|
2117 |
||
2118 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2119 |
! |
|
2120 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2121 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2122 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2123 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2124 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2125 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2126 |
|
12250 | 2127 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2128 |
||
2129 |
knownPackages |
|
2130 |
<resource: #obsolete> |
|
2131 |
self obsoleteMethodWarning. |
|
2132 |
^ KnownPackages ? #() |
|
2133 |
! |
|
2134 |
||
2135 |
loadExtensionsForPackage:aPackageId |
|
13415 | 2136 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2137 |
|
13415 | 2138 |
extensionsLoaded := false. |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2139 |
ProgrammingLanguage allDo:[:lang| |
13771 | 2140 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: lang) |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2141 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2142 |
^ extensionsLoaded |
13415 | 2143 |
|
2144 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2145 |
"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
|
2146 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2147 |
! |
2148 |
||
2149 |
loadExtensionsForPackage:aPackageId language: language |
|
13771 | 2150 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2151 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2152 |
|
13415 | 2153 |
language supportsExtensionMethods ifFalse:[^false]. |
2154 |
||
12250 | 2155 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2156 |
packageDirName := self getPackageFileName:packageDirName. |
|
2157 |
||
2158 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
14432 | 2159 |
(self loadExtensionsFromDirectory:packageDirName language: language) ifTrue:[ |
2160 |
^ true. |
|
2161 |
]. |
|
2162 |
packageDirName := nil. "do not try again" |
|
12250 | 2163 |
]. |
2164 |
||
2165 |
" |
|
2166 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2167 |
" |
|
2168 |
mgr := Smalltalk at:#SourceCodeManager. |
|
2169 |
mgr notNil ifTrue:[ |
|
14432 | 2170 |
extensionsFilename := 'extensions.' , language sourceFileSuffix. |
2171 |
||
2172 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2173 |
projectDefinition notNil ifTrue:[ |
|
2174 |
mod := aPackageId asPackageId module. |
|
2175 |
dir := aPackageId asPackageId directory. |
|
2176 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2177 |
extensionsRevisionString notNil ifTrue:[ |
|
2178 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2179 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2180 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[^ false]. |
|
2181 |
] |
|
2182 |
]. |
|
2183 |
SourceCodeManagerError handle:[:ex | |
|
2184 |
] do:[ |
|
2185 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2186 |
]. |
|
2187 |
]. |
|
2188 |
inStream isNil ifTrue:[ |
|
2189 |
SourceCodeManagerError handle:[:ex | |
|
2190 |
] do:[ |
|
2191 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2192 |
]. |
|
2193 |
]. |
|
2194 |
inStream notNil ifTrue:[ |
|
2195 |
Class withoutUpdatingChangeSetDo:[ |
|
2196 |
inStream fileIn. |
|
2197 |
]. |
|
2198 |
inStream close. |
|
2199 |
VerboseLoading ifTrue:[ |
|
2200 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2201 |
]. |
|
2202 |
^ true |
|
2203 |
] |
|
12250 | 2204 |
]. |
2205 |
||
2206 |
packageDirName notNil ifTrue:[ |
|
14432 | 2207 |
^ self loadExtensionsFromDirectory:packageDirName language: language |
12250 | 2208 |
]. |
2209 |
^ false |
|
2210 |
||
13415 | 2211 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2212 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2213 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
12250 | 2214 |
! |
2215 |
||
2216 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2217 |
|
2218 |
| extensionsLoaded | |
|
2219 |
extensionsLoaded := false. |
|
2220 |
ProgrammingLanguage allDo: |
|
13771 | 2221 |
[:lang| |
2222 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: lang)]. |
|
13415 | 2223 |
^extensionsLoaded |
2224 |
||
2225 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2226 |
! |
|
2227 |
||
2228 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2229 |
|packageDir f| |
2230 |
||
2231 |
packageDir := packageDirOrString asFilename. |
|
2232 |
||
13415 | 2233 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2234 |
f exists ifTrue:[ |
14432 | 2235 |
Class withoutUpdatingChangeSetDo:[ |
2236 |
f fileIn. |
|
2237 |
]. |
|
2238 |
VerboseLoading ifTrue:[ |
|
2239 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2240 |
]. |
|
2241 |
^ true |
|
12250 | 2242 |
]. |
2243 |
^ false |
|
13415 | 2244 |
|
2245 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2246 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
12250 | 2247 |
! |
2248 |
||
14589 | 2249 |
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded |
12782 | 2250 |
"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
|
2251 |
Return true on success, false otherwise." |
12782 | 2252 |
|
14589 | 2253 |
|packageId packageString packageDir def sourceCodeManager| |
2254 |
||
2255 |
packageId := aPackageStringArg asPackageId. |
|
14833 | 2256 |
packageString := packageId string. |
12782 | 2257 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2258 |
"if I am here, so must my package" |
14589 | 2259 |
packageString = 'stx:libbasic' ifTrue:[^ true]. |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2260 |
|
12782 | 2261 |
"/ if there is a projectDefinition, let it load itself... |
14589 | 2262 |
def := packageId projectDefinitionClass. |
14833 | 2263 |
(def notNil and:[def isLoaded]) ifTrue:[ |
14589 | 2264 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
2265 |
^ true. |
|
2266 |
]. |
|
2267 |
||
2268 |
packageDir := self packageDirectoryForPackageId:packageId. |
|
12782 | 2269 |
packageDir isNil ifTrue:[ |
14589 | 2270 |
(packageString includes:$:) ifFalse:[ |
2271 |
"/ assume stx |
|
2272 |
packageDir := self packageDirectoryForPackageId:('stx:',packageString). |
|
2273 |
]. |
|
12782 | 2274 |
]. |
2275 |
||
2276 |
(self |
|
14589 | 2277 |
loadPackage:packageString |
2278 |
fromDirectory:packageDir |
|
2279 |
asAutoloaded:doLoadAsAutoloaded) ifTrue: [^ true]. |
|
12782 | 2280 |
|
2281 |
AbstractSourceCodeManager notNil ifTrue:[ |
|
14589 | 2282 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage: packageString. |
2283 |
sourceCodeManager notNil ifTrue:[ |
|
2284 |
^ sourceCodeManager loadPackageWithId: packageString fromRepositoryAsAutoloaded: doLoadAsAutoloaded |
|
2285 |
]. |
|
12782 | 2286 |
]. |
2287 |
||
2288 |
^ false |
|
2289 |
||
2290 |
" |
|
2291 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2292 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2293 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2294 |
" |
|
2295 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2296 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2297 |
! |
2298 |
||
12250 | 2299 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2300 |
"load all source files found in aDirectory and treat them like |
|
2301 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2302 |
Experimental." |
|
2303 |
||
2304 |
|p t new anyFail repeatCount| |
|
2305 |
||
2306 |
"/ problem: dependencies. |
|
2307 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2308 |
||
2309 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2310 |
|any| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2311 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2312 |
repeatCount := 0. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2313 |
[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2314 |
repeatCount := repeatCount + 1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2315 |
anyFail := false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2316 |
aDirectory directoryContents do:[:file | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2317 |
|fn| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2318 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2319 |
fn := aDirectory / file. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2320 |
(fn hasSuffix:'st') ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2321 |
Metaclass confirmationQuerySignal answer:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2322 |
do:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2323 |
Error |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2324 |
handle:[:ex | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2325 |
anyFail := true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2326 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2327 |
do:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2328 |
(self fileIn:fn) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2329 |
anyFail := true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2330 |
] ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2331 |
any := true. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2332 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2333 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2334 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2335 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2336 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2337 |
any ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2338 |
^ false "/ no file found |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2339 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2340 |
] doWhile:[anyFail and:[repeatCount<2]]. |
12250 | 2341 |
]. |
2342 |
||
2343 |
new := (p := Project projectWithId:packageId) isNil. |
|
2344 |
new ifTrue:[ p := Project new]. |
|
2345 |
||
2346 |
p name:packageId. |
|
2347 |
p directory:aDirectory. |
|
2348 |
p package:packageId. |
|
2349 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2350 |
p repositoryModule:(t first). |
|
2351 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2352 |
p isLoaded:true. |
|
2353 |
||
2354 |
new ifTrue:[Project addLoadedProject:p]. |
|
2355 |
^ anyFail not |
|
2356 |
! |
|
2357 |
||
2358 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2359 |
"load a package from a compiled classLib. |
|
2360 |
Experimental." |
|
2361 |
||
2362 |
|p t new| |
|
2363 |
||
2364 |
(self fileIn:aFilename) ifFalse:[ |
|
13370 | 2365 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2366 |
self warn:'Failed to load the package ', packageId printString. |
|
2367 |
^ false. |
|
2368 |
] |
|
12250 | 2369 |
]. |
2370 |
||
2371 |
new := (p := Project projectWithId:packageId) isNil. |
|
2372 |
new ifTrue:[ p := Project new]. |
|
2373 |
||
2374 |
p name:packageId. |
|
2375 |
p directory:aFilename directory. |
|
2376 |
p package:packageId. |
|
2377 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2378 |
p repositoryModule:(t first). |
|
2379 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2380 |
p isLoaded:true. |
|
2381 |
||
2382 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2383 |
|
12250 | 2384 |
^ true |
2385 |
! |
|
2386 |
||
12782 | 2387 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2388 |
"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
|
2389 |
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
|
2390 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2391 |
|
14833 | 2392 |
|packageDir shLibName |
2393 |
binaryClassLibraryFilename projectDefinitionFilename projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
|
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2394 |
loadOK loadErrorOccurred exePath| |
12782 | 2395 |
|
2396 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
14589 | 2397 |
packageDir := packageDirOrStringOrNil asFilename. |
12782 | 2398 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
2399 |
VerboseLoading ifTrue:[ |
14589 | 2400 |
silent := false |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
2401 |
] ifFalse:[ |
14589 | 2402 |
silent := (SilentLoading or:[ StandAlone ]) or:[ InfoPrinting not ]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
2403 |
]. |
12782 | 2404 |
|
2405 |
"For now: have to read the project definition first!! |
|
2406 |
The class library may contain subclasses of classes in prerequisite packages - |
|
2407 |
so the prerequisite packages have to be loaded first" |
|
2408 |
"normally there is a project definiton, use that one to pull in the rest" |
|
2409 |
||
2410 |
"maybe, it is already in the image - autoloaded" |
|
2411 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2412 |
||
14833 | 2413 |
false ifTrue:[ |
12782 | 2414 |
"if not, file it in ..." |
2415 |
(projectDefinitionClass isNil and:[packageDir notNil]) ifTrue:[ |
|
14589 | 2416 |
projectDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageString. |
2417 |
"/ try to load the project definition class |
|
2418 |
projectDefinitionFilename := (packageDir / projectDefinitionClassName) withSuffix:'st'. |
|
2419 |
projectDefinitionFilename exists ifFalse:[ |
|
2420 |
projectDefinitionFilename := (packageDir / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2421 |
]. |
|
2422 |
projectDefinitionFilename exists ifTrue:[ |
|
2423 |
Class withoutUpdatingChangesDo:[ |
|
2424 |
Smalltalk silentlyLoadingDo:[ |
|
2425 |
projectDefinitionFilename fileIn. |
|
2426 |
]. |
|
2427 |
]. |
|
2428 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
14793 | 2429 |
projectDefinitionClass notNil ifTrue:[ |
2430 |
projectDefinitionClass loadDirectory:(projectDefinitionFilename asFilename directory) |
|
2431 |
] |
|
14589 | 2432 |
]. |
12782 | 2433 |
]. |
2434 |
projectDefinitionClass notNil ifTrue:[ |
|
14589 | 2435 |
projectDefinitionClass autoload. |
2436 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2437 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2438 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2439 |
]. |
|
2440 |
^ true. |
|
12782 | 2441 |
]. |
14833 | 2442 |
]. |
12782 | 2443 |
|
2444 |
"/ no project-definition class. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2445 |
|
12782 | 2446 |
"Is there a shared library (.dll or .so) ?" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2447 |
shLibName := aPackageString asPackageId libraryName asFilename |
14589 | 2448 |
withSuffix:ObjectFileLoader sharedLibrarySuffix. |
12782 | 2449 |
|
13120
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2450 |
"/ silent ifFalse:[ |
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2451 |
"/ Transcript showCR:('looking for binary classLib file: ' , shLibName pathName). |
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2452 |
"/ ]. |
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2453 |
exePath := OperatingSystem pathOfSTXExecutable asFilename directory. |
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2454 |
binaryClassLibraryFilename := exePath / shLibName. |
12782 | 2455 |
binaryClassLibraryFilename exists ifFalse:[ |
14589 | 2456 |
exePath baseName = 'bin' ifTrue:[ |
2457 |
binaryClassLibraryFilename := exePath directory / 'lib' / shLibName. |
|
2458 |
]. |
|
2459 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2460 |
binaryClassLibraryFilename := exePath directory / 'plugin' / shLibName. |
|
2461 |
binaryClassLibraryFilename exists ifFalse:[ |
|
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2462 |
"/ binaryClassLibraryFilename := Filename currentDirectory / shLibName. |
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2463 |
"/ binaryClassLibraryFilename exists ifFalse:[ |
14589 | 2464 |
packageDir notNil ifTrue:[ |
2465 |
binaryClassLibraryFilename := packageDir / shLibName. |
|
2466 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2467 |
"/ mhmh - is this a good idea ? (temporary kludge) |
|
14833 | 2468 |
ExternalAddress pointerSize == 4 ifTrue:[ |
2469 |
binaryClassLibraryFilename := packageDir / 'objbc' / shLibName. |
|
2470 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2471 |
binaryClassLibraryFilename := packageDir / 'objvc' / shLibName. |
|
2472 |
] |
|
2473 |
] ifFalse:[ |
|
2474 |
binaryClassLibraryFilename := packageDir / 'objmingw' / shLibName. |
|
2475 |
]. |
|
14589 | 2476 |
] |
2477 |
] |
|
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2478 |
"/ ]. |
14589 | 2479 |
]. |
2480 |
]. |
|
14833 | 2481 |
packageDir notNil ifTrue:[ |
2482 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2483 |
"/ look in package directory |
|
2484 |
binaryClassLibraryFilename := packageDir / shLibName. |
|
2485 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2486 |
ExternalAddress pointerSize == 4 ifTrue:[ |
|
2487 |
binaryClassLibraryFilename := packageDir / 'objbc' / shLibName. |
|
2488 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2489 |
binaryClassLibraryFilename := packageDir / 'objvc' / shLibName. |
|
2490 |
] |
|
2491 |
] ifFalse:[ |
|
2492 |
binaryClassLibraryFilename := packageDir / 'objmingw' / shLibName. |
|
2493 |
]. |
|
2494 |
]. |
|
2495 |
]. |
|
2496 |
]. |
|
2497 |
]. |
|
2498 |
||
12782 | 2499 |
binaryClassLibraryFilename exists ifTrue:[ |
14589 | 2500 |
ObjectFileLoader::ObjectFileLoadErrorNotification handle:[:ex | |
2501 |
loadErrorOccurred := true. |
|
2502 |
ex proceedWith:true. |
|
2503 |
] do:[ |
|
14833 | 2504 |
loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil. |
2505 |
"/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
14589 | 2506 |
]. |
2507 |
loadOK ifTrue:[ |
|
2508 |
silent ifFalse:[ |
|
2509 |
Transcript showCR:('loaded package: ' , aPackageString , ' from binary classLib file: ' , binaryClassLibraryFilename pathName). |
|
2510 |
]. |
|
14833 | 2511 |
"now, all compiled classes have been loaded. |
2512 |
keep classes in the package which are autoloaded as autoloaded. |
|
2513 |
(so the code below is disabled)" |
|
2514 |
"/ doLoadAsAutoloaded ifFalse:[ |
|
2515 |
"/ "/ force autoloading... |
|
2516 |
"/ Smalltalk allClassesDo:[:eachClass | |
|
2517 |
"/ eachClass package == aPackageString ifTrue:[eachClass autoload]. |
|
2518 |
"/ ]. |
|
2519 |
"/ ]. |
|
14589 | 2520 |
^ true |
2521 |
]. |
|
2522 |
loadErrorOccurred ifTrue:[ |
|
2523 |
self breakPoint:#cg. |
|
2524 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2525 |
projectDefinitionClass notNil ifTrue:[ |
|
2526 |
"/ load prerequisites... |
|
2527 |
projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2528 |
self breakPoint:#cg. |
|
2529 |
]. |
|
2530 |
]. |
|
12782 | 2531 |
]. |
2532 |
||
2533 |
packageDir isNil ifTrue:[ |
|
14589 | 2534 |
^ false. |
12782 | 2535 |
]. |
2536 |
||
14833 | 2537 |
"fallback - go through the project definition" |
2538 |
projectDefinitionClass isNil ifTrue:[ |
|
2539 |
projectDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageString. |
|
2540 |
"/ try to load the project definition class |
|
2541 |
projectDefinitionFilename := (packageDir / projectDefinitionClassName) withSuffix:'st'. |
|
2542 |
projectDefinitionFilename exists ifFalse:[ |
|
2543 |
projectDefinitionFilename := (packageDir / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2544 |
]. |
|
2545 |
projectDefinitionFilename exists ifTrue:[ |
|
2546 |
Class withoutUpdatingChangesDo:[ |
|
2547 |
Smalltalk silentlyLoadingDo:[ |
|
2548 |
projectDefinitionFilename fileIn. |
|
2549 |
]. |
|
14589 | 2550 |
]. |
14833 | 2551 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
2552 |
projectDefinitionClass notNil ifTrue:[ |
|
2553 |
projectDefinitionClass loadDirectory:(projectDefinitionFilename asFilename directory) |
|
2554 |
] |
|
2555 |
]. |
|
2556 |
]. |
|
2557 |
projectDefinitionClass notNil ifTrue:[ |
|
2558 |
projectDefinitionClass autoload. |
|
2559 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2560 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2561 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2562 |
]. |
|
2563 |
^ true. |
|
2564 |
]. |
|
2565 |
||
2566 |
"/ loadAll no longer supported |
|
2567 |
"/ loadAllFilename := packageDir / 'loadAll'. |
|
2568 |
"/ loadAllFilename exists ifFalse:[ |
|
2569 |
"/ loadAllFilename := packageDir / 'loadall'. |
|
2570 |
"/ ]. |
|
2571 |
"/ loadAllFilename exists ifTrue:[ |
|
2572 |
"/ (self loadPackage:aPackageString fromLoadAllFile:loadAllFilename) ifTrue:[ |
|
2573 |
"/ silent ifFalse:[ |
|
2574 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from loadAll file: ' , loadAllFilename pathName). |
|
2575 |
"/ ]. |
|
2576 |
"/ ^ true |
|
2577 |
"/ ] |
|
2578 |
"/ ]. |
|
2579 |
"/ |
|
2580 |
"/ packageName := packageDir baseName. |
|
12782 | 2581 |
|
2582 |
"/ zip-file loading no longer supported |
|
2583 |
"/ "/ .zip ? |
|
2584 |
"/ f := (packageDir / packageName) withSuffix:'zip'. |
|
2585 |
"/ f exists ifTrue:[ |
|
2586 |
"/ (self loadPackage:aPackageString fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
|
2587 |
"/ silent ifFalse:[ |
|
2588 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from zip file: ' , f pathName). |
|
2589 |
"/ ]. |
|
2590 |
"/ ^ true |
|
2591 |
"/ ] |
|
2592 |
"/ ]. |
|
2593 |
||
2594 |
"/ abbrev-file loading no longer supported |
|
2595 |
"/ "/ abbrev.stc ? |
|
2596 |
"/ (self loadPackageFromAbbrevFile:aPackageString asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
|
2597 |
"/ ^ true |
|
2598 |
"/ ]. |
|
2599 |
||
2600 |
"/ any .so-file loading no longer supported |
|
2601 |
"/ "/ any .so ? -> load the first one found (maybe not a good idea) |
|
2602 |
"/ packageDir directoryContentsAsFilenamesDo:[:aFilename | |
|
2603 |
"/ (aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
|
2604 |
"/ (self loadPackage:aPackageString fromClassLibrary:aFilename) ifTrue:[ |
|
2605 |
"/ silent ifFalse:[ |
|
2606 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from binary classLib file: ' , aFilename pathName). |
|
2607 |
"/ ]. |
|
2608 |
"/ doLoadAsAutoloaded ifFalse:[ |
|
2609 |
"/ "/ force autoloading... |
|
2610 |
"/ Smalltalk allClassesDo:[:eachClass | |
|
2611 |
"/ eachClass package == aPackageString ifTrue:[ eachClass autoload]. |
|
2612 |
"/ ]. |
|
2613 |
"/ ]. |
|
2614 |
"/ ^ true |
|
2615 |
"/ ] |
|
2616 |
"/ ] |
|
2617 |
"/ ]. |
|
2618 |
||
2619 |
"/ "/ source files-file loading no longer supported |
|
2620 |
"/ "/ however, allow for autoload-stub loaded |
|
2621 |
"/ doLoadAsAutoloaded ifTrue:[ |
|
2622 |
"/ self |
|
2623 |
"/ recursiveInstallAutoloadedClassesFrom:packageDir |
|
2624 |
"/ rememberIn:(Set new) |
|
2625 |
"/ maxLevels:2 |
|
2626 |
"/ noAutoload:false |
|
2627 |
"/ packageTop:packageDir |
|
2628 |
"/ showSplashInLevels:0. |
|
2629 |
"/ ]. |
|
2630 |
||
2631 |
"/ doLoadAsAutoloaded ifFalse:[ |
|
2632 |
"/ "/ source files |
|
2633 |
"/ (self loadPackage:aPackageString fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
|
2634 |
"/ silent ifFalse:[ |
|
2635 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from source files in:' , packageDir pathName). |
|
2636 |
"/ ]. |
|
2637 |
"/ ^ true |
|
2638 |
"/ ]. |
|
2639 |
"/ ]. |
|
2640 |
"/ ^ true |
|
2641 |
||
12813
054a53cb88fd
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
12795
diff
changeset
|
2642 |
Transcript showCR:('Smalltalk [info]: no projectDef, dll or loadAll found in: ' , aPackageString). |
12782 | 2643 |
^ false |
2644 |
||
2645 |
" |
|
2646 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2647 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2648 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2649 |
" |
|
2650 |
||
13529
3fa8f8852e91
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13528
diff
changeset
|
2651 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
12782 | 2652 |
! |
2653 |
||
12250 | 2654 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2655 |
<resource: #obsolete> |
12250 | 2656 |
"load a package from a loadAll - loader script. |
2657 |
Experimental." |
|
2658 |
||
2659 |
|p t new| |
|
2660 |
||
2661 |
Metaclass confirmationQuerySignal answer:false |
|
2662 |
do:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2663 |
(self fileIn:aFilename) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2664 |
self warn:'Failed to load the package ', packageId printString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2665 |
^ false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2666 |
] |
12250 | 2667 |
]. |
2668 |
||
2669 |
new := (p := Project projectWithId:packageId) isNil. |
|
2670 |
new ifTrue:[ p := Project new]. |
|
2671 |
||
2672 |
p name:packageId. |
|
2673 |
p directory:aFilename directory. |
|
2674 |
p package:packageId. |
|
2675 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2676 |
p repositoryModule:(t first). |
|
2677 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2678 |
p isLoaded:true. |
|
2679 |
||
2680 |
new ifTrue:[Project addLoadedProject:p]. |
|
2681 |
^ true |
|
2682 |
! |
|
2683 |
||
2684 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
2685 |
"load a package from a .zip delivery file. |
|
2686 |
Experimental." |
|
2687 |
||
2688 |
"/ not yet implemented ... |
|
2689 |
^ false |
|
2690 |
! |
|
2691 |
||
2692 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2693 |
<resource: #obsolete> |
12250 | 2694 |
|abbrevFile packageDir| |
2695 |
||
2696 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
2697 |
packageDir isNil ifTrue:[^ false]. |
|
2698 |
||
2699 |
"/ abbrev.stc ? |
|
12377 | 2700 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2701 |
abbrevFile exists ifFalse:[^ false]. |
2702 |
||
2703 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2704 |
||
2705 |
doLoadAsAutoloaded ifFalse:[ |
|
14432 | 2706 |
"/ force autoloading... |
2707 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 2708 |
]. |
2709 |
||
2710 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2711 |
VerboseLoading ifTrue:[ |
14432 | 2712 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
12250 | 2713 |
]. |
2714 |
^ true |
|
2715 |
||
13814 | 2716 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 2717 |
! ! |
2718 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2719 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2720 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2721 |
allClasses |
7563 | 2722 |
"return an unordered collection of all classes in the system. |
10071 | 2723 |
Only globally anchored classes are returned |
453 | 2724 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2725 |
||
2726 |
|classes| |
|
2727 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2728 |
"/ you may wonder, what this while is for, here ... |
453 | 2729 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 2730 |
"/ another view (background fileIn), while building up the |
453 | 2731 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
2732 |
"/ other process in the meanwhile. |
|
2733 |
"/ If that happens, we restart the set-building here |
|
2734 |
"/ |
|
2735 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
14432 | 2736 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
2737 |
self keysAndValuesDo:[:eachName :eachGlobal | |
|
2738 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
|
2739 |
"/ sigh - would like to skip over aliases |
|
2740 |
"/ but this cannot be done simply by comparing |
|
2741 |
"/ the classes name against the store-key |
|
2742 |
"/ i.e. cannot do: |
|
2743 |
"/ anObject name == sym ifTrue:[ |
|
2744 |
"/ classes add:anObject |
|
2745 |
"/ ] |
|
2746 |
"/ because that would lead to ignore all java |
|
2747 |
"/ classes, which are stored under a different |
|
2748 |
"/ key. |
|
2749 |
||
2750 |
(eachGlobal name == eachName |
|
2751 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
|
2752 |
classes add:eachGlobal |
|
2753 |
]. |
|
2754 |
] |
|
2755 |
]. |
|
2756 |
NumberOfClassesHint := classes size. |
|
453 | 2757 |
]. |
2758 |
^ classes |
|
2759 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2760 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2761 |
CachedClasses := nil. |
453 | 2762 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2763 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2764 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2765 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2766 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 2767 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2768 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2769 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2770 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2771 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2772 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2773 |
"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
|
2774 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2775 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2776 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2777 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2778 |
self allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2779 |
classes add:(eachClass theNonMetaclass). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2780 |
classes add:(eachClass theMetaclass). |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2781 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2782 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2783 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2784 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2785 |
allClassesWithAllPrivateClasses |
7563 | 2786 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2787 |
Only globally anchored classes are returned; Namespaces are not included. |
4642 | 2788 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2789 |
||
10071 | 2790 |
^ self allClasses select:[:aClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2791 |
|owner| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2792 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2793 |
(aClass isRealNameSpace not) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2794 |
and:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2795 |
owner := aClass topOwningClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2796 |
(owner ? aClass) nameSpace == Smalltalk |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2797 |
] |
4642 | 2798 |
] |
2799 |
||
2800 |
" |
|
2801 |
Smalltalk allClassesWithAllPrivateClasses |
|
2802 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2803 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2804 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 2805 |
! |
2806 |
||
11153 | 2807 |
allExtensionsForPackage:aProjectID |
14890 | 2808 |
"return a collection of all extension methods for a given projectID" |
2809 |
||
11153 | 2810 |
|methods| |
2811 |
||
2812 |
methods := OrderedCollection new. |
|
2813 |
self allClassesDo:[:eachClass | |
|
14890 | 2814 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 2815 |
]. |
2816 |
^ methods |
|
2817 |
! |
|
2818 |
||
9227 | 2819 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2820 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2821 |
|
9227 | 2822 |
|implementors| |
2823 |
||
2824 |
implementors := OrderedCollection new. |
|
2825 |
self allClassesDo:[:cls | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2826 |
(cls includesSelector:aSelector) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2827 |
implementors add:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2828 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2829 |
(cls class includesSelector:aSelector) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2830 |
implementors add:cls class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2831 |
]. |
9227 | 2832 |
]. |
2833 |
^ implementors |
|
2834 |
||
2835 |
" |
|
10071 | 2836 |
Smalltalk allImplementorsOf:#isNil |
2837 |
(Smalltalk allImplementorsOf:#add:) size |
|
9227 | 2838 |
" |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2839 |
|
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2840 |
"Modified: / 07-05-2010 / 10:56:09 / cg" |
9227 | 2841 |
! |
2842 |
||
12376 | 2843 |
allLoadedProjectIDs |
2844 |
||
2845 |
^ self allProjectsIdsIncludingUnloadedClasses: false |
|
2846 |
||
2847 |
||
2848 |
" |
|
2849 |
Smalltalk allLoadedProjectIDs |
|
2850 |
" |
|
2851 |
! |
|
2852 |
||
9254 | 2853 |
allProjectIDs |
12376 | 2854 |
|
2855 |
^ self allProjectsIdsIncludingUnloadedClasses: true |
|
2856 |
||
2857 |
||
2858 |
" |
|
2859 |
Smalltalk allProjectIDs |
|
2860 |
" |
|
2861 |
! |
|
2862 |
||
2863 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
2864 |
"Returns all projects ids. |
|
2865 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
2866 |
" |
|
2867 |
||
9254 | 2868 |
|allProjects| |
2869 |
||
2870 |
allProjects := Set new. |
|
2871 |
self allClassesDo:[:eachClass | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2872 |
|cls pkg| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2873 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2874 |
eachClass isRealNameSpace ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2875 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2876 |
cls := eachClass theNonMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2877 |
cls isPrivate ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2878 |
cls := cls topOwningClass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2879 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2880 |
pkg := cls package. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2881 |
pkg size > 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2882 |
allProjects add:pkg. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2883 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2884 |
"/ for now, nameSpaces are not in any package; |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2885 |
"/ this might change. Then, 0-sized packages are |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2886 |
"/ illegal, and the following should be enabled. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2887 |
"/ self halt |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2888 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2889 |
cls isJavaClass ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2890 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2891 |
allProjects add:mthd package asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2892 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2893 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2894 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2895 |
]. |
9254 | 2896 |
]. |
2897 |
allProjects := allProjects asOrderedCollection sort. |
|
2898 |
^ allProjects |
|
2899 |
||
2900 |
" |
|
12376 | 2901 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
2902 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 2903 |
" |
2904 |
! |
|
2905 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2906 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2907 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2908 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2909 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2910 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2911 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2912 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2913 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2914 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2915 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2916 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2917 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2918 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2919 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2920 |
"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
|
2921 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2922 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2923 |
|
9508 | 2924 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2925 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2926 |
" |
10071 | 2927 |
Smalltalk classCategoryCompletion:'Sys' |
2928 |
Smalltalk classCategoryCompletion:'System' |
|
2929 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2930 |
" |
9508 | 2931 |
|
2932 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2933 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2934 |
|
8570 | 2935 |
classNamed:aString |
2936 |
"return the class with name aString, or nil if absent. |
|
2937 |
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
|
2938 |
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
|
2939 |
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
|
2940 |
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
|
2941 |
|
10127 | 2942 |
|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
|
2943 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2944 |
"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
|
2945 |
But be careful, to not invent new symbols ..." |
453 | 2946 |
sym := aString asSymbolIfInterned. |
2947 |
sym notNil ifTrue:[ |
|
13771 | 2948 |
cls := self at:sym ifAbsent:nil. |
2949 |
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
|
2950 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2951 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2952 |
(aString endsWith:' class') ifTrue:[ |
13771 | 2953 |
nonMeta := self classNamed:(aString copyWithoutLast:6). |
2954 |
nonMeta notNil ifTrue:[ |
|
2955 |
^ nonMeta theMetaclass |
|
2956 |
]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2957 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2958 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2959 |
"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
|
2960 |
cls isNil ifTrue:[ |
13771 | 2961 |
idx := aString indexOfSubCollection:'::'. |
2962 |
idx ~~ 0 ifTrue:[ |
|
2963 |
prefix := aString copyTo:idx-1. |
|
2964 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
2965 |
nsNameSymbol notNil ifTrue:[ |
|
2966 |
rest := aString copyFrom:idx+2. |
|
2967 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
2968 |
"namespace may be the owner of a private class. |
|
2969 |
NameSpaces and Behaviors have the same protocol" |
|
2970 |
[namespace isBehavior] whileTrue:[ |
|
2971 |
idx := rest indexOfSubCollection:'::'. |
|
2972 |
idx ~~ 0 ifTrue:[ |
|
2973 |
prefix := rest copyTo:idx-1. |
|
2974 |
rest := rest copyFrom:idx+2. |
|
2975 |
"this does an implicit autoload if required" |
|
2976 |
namespace := namespace privateClassesAt:prefix. |
|
2977 |
] ifFalse:[ |
|
2978 |
namespace isLoaded ifTrue:[ |
|
2979 |
cls := namespace privateClassesAt:rest. |
|
2980 |
cls isBehavior ifTrue:[^ cls]. |
|
2981 |
]. |
|
2982 |
namespace := nil. "force exit of loop" |
|
2983 |
]. |
|
2984 |
]. |
|
2985 |
]. |
|
2986 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2987 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2988 |
|
453 | 2989 |
^ nil |
2990 |
||
2991 |
" |
|
10071 | 2992 |
Smalltalk classNamed:'Object' |
2993 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
2994 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
2995 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
2996 |
Smalltalk classNamed:'fooBar' |
|
2997 |
Smalltalk classNamed:'true' |
|
2998 |
Smalltalk classNamed:'Object class' |
|
2999 |
Smalltalk classNamed:'Metaclass' |
|
3000 |
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
|
3001 |
Smalltalk classNamed:'Array class' |
453 | 3002 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3003 |
|
9468 | 3004 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
3005 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 3006 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3007 |
"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
|
3008 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3009 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3010 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3011 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3012 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3013 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3014 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3015 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3016 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3017 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3018 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3019 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3020 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3021 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3022 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3023 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3024 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3025 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3026 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3027 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3028 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 3029 |
"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
|
3030 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3031 |
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
|
3032 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3033 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3034 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3035 |
" |
10071 | 3036 |
Smalltalk classnameCompletion:'Arr' |
3037 |
Smalltalk classnameCompletion:'Arra' |
|
3038 |
Smalltalk classnameCompletion:'arra' |
|
3039 |
Smalltalk classnameCompletion:'*rray' |
|
3040 |
||
3041 |
Smalltalk classnameCompletion:'Arr cl' |
|
3042 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 3043 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3044 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
3045 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
3046 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3047 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3048 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3049 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3050 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3051 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3052 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3053 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3054 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
3055 |
"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
|
3056 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3057 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3058 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3059 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3060 |
"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
|
3061 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3062 |
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
|
3063 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
3064 |
^ 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
|
3065 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3066 |
" |
10071 | 3067 |
Smalltalk globalnameCompletion:'Arr' |
3068 |
Smalltalk globalnameCompletion:'Arra' |
|
3069 |
Smalltalk globalnameCompletion:'arra' |
|
3070 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3071 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3072 |
|
9508 | 3073 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3074 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3075 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3076 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3077 |
globalnameCompletion:aPartialGlobalName |
7563 | 3078 |
"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
|
3079 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3080 |
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
|
3081 |
|
8358 | 3082 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3083 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3084 |
^ 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
|
3085 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3086 |
" |
10071 | 3087 |
Smalltalk globalnameCompletion:'Arr' |
3088 |
Smalltalk globalnameCompletion:'Arra' |
|
3089 |
Smalltalk globalnameCompletion:'arra' |
|
3090 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3091 |
" |
3092 |
||
9508 | 3093 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3094 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3095 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3096 |
|
13771 | 3097 |
hasClassNamed:aString |
3098 |
Symbol |
|
3099 |
hasInterned:aString |
|
3100 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3101 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3102 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3103 |
"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
|
3104 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3105 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3106 |
|
9290 | 3107 |
hasNameSpaces |
3108 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3109 |
the namespace display in a browser (PocketSmalltalk)" |
|
3110 |
||
3111 |
^ true |
|
3112 |
! |
|
3113 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3114 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3115 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3116 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3117 |
|
9290 | 3118 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3119 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3120 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3121 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3122 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3123 |
"for now return false |
10999 | 3124 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3125 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3126 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3127 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3128 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3129 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3130 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3131 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3132 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3133 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3134 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3135 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3136 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3137 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3138 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3139 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3140 |
|
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3141 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3142 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3143 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3144 |
"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
|
3145 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3146 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3147 |
isNameSpace |
9227 | 3148 |
"return true, if the receiver is a nameSpace." |
3149 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3150 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3151 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3152 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3153 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3154 |
|
10169 | 3155 |
isRealNameSpace |
3156 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3157 |
||
3158 |
^ false |
|
3159 |
||
3160 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3161 |
! |
|
3162 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3163 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3164 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3165 |
! |
7563 | 3166 |
|
3167 |
isTopLevelNamespace |
|
3168 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3169 |
|
7432 | 3170 |
<resource:#obsolete> |
3171 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3172 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3173 |
^ true |
3174 |
||
3175 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3176 |
! |
|
3177 |
||
9081 | 3178 |
keyIsClassVariableNameKey:aKey |
3179 |
|i| |
|
3180 |
||
3181 |
i := aKey lastIndexOf:$:. |
|
3182 |
i ~~ 0 ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3183 |
i > 1 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3184 |
(aKey at:(i-1)) == $: ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3185 |
^ true. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3186 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3187 |
]. |
9081 | 3188 |
]. |
3189 |
^ false. |
|
3190 |
||
3191 |
" |
|
10071 | 3192 |
self keyIsClassVariableNameKey:'foo::bar' |
3193 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3194 |
self keyIsClassVariableNameKey:':bar' |
|
3195 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3196 |
" |
3197 |
! |
|
3198 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3199 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3200 |
"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
|
3201 |
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
|
3202 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3203 |
|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
|
3204 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3205 |
"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
|
3206 |
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
|
3207 |
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
|
3208 |
sym notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3209 |
cls := self at:sym ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3210 |
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
|
3211 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3212 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3213 |
(aString endsWith:' class') ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3214 |
nonMeta := self loadedClassNamed:(aString copyWithoutLast:6). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3215 |
nonMeta notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3216 |
^ nonMeta theMetaclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3217 |
]. |
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3218 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3219 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3220 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3221 |
" |
10071 | 3222 |
Smalltalk loadedClassNamed:'Object' |
3223 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3224 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3225 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3226 |
Smalltalk loadedClassNamed:'fooBar' |
|
3227 |
Smalltalk loadedClassNamed:'true' |
|
3228 |
Smalltalk loadedClassNamed:'Object class' |
|
3229 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3230 |
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
|
3231 |
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
|
3232 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3233 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3234 |
|
7563 | 3235 |
methodProtocolCompletion:aPartialProtocolName |
3236 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3237 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3238 |
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
|
3239 |
|
9508 | 3240 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3241 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3242 |
" |
10071 | 3243 |
Smalltalk methodProtocolCompletion:'doc' |
3244 |
Smalltalk methodProtocolCompletion:'docu' |
|
3245 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3246 |
" |
9508 | 3247 |
|
3248 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3249 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3250 |
|
7563 | 3251 |
numberOfGlobals |
3252 |
"return the number of global variables in the system" |
|
3253 |
||
3254 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3255 |
|
3256 |
tally := 0. |
|
3257 |
self do:[:obj | tally := tally + 1]. |
|
3258 |
^ tally |
|
3259 |
||
3260 |
"Smalltalk numberOfGlobals" |
|
3261 |
! |
|
3262 |
||
7563 | 3263 |
referencesAny:aCollection |
3264 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3265 |
|
3266 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3267 |
aCollection do:[:anObject | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3268 |
(key == anObject) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3269 |
(val == anObject ) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3270 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3271 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3272 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3273 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3274 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3275 |
! |
3260 | 3276 |
|
7563 | 3277 |
referencesDerivedInstanceOf:aClass |
3278 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3279 |
|
3280 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3281 |
(key isKindOf:aClass) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3282 |
(val isKindOf:aClass) ifTrue:[^ true]. |
617 | 3283 |
]. |
3284 |
^ super referencesDerivedInstanceOf:aClass |
|
3285 |
! |
|
3286 |
||
7563 | 3287 |
referencesInstanceOf:aClass |
3288 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3289 |
|
3290 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3291 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3292 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
617 | 3293 |
]. |
3294 |
^ super referencesInstanceOf:aClass |
|
3295 |
! |
|
3296 |
||
7563 | 3297 |
referencesObject:anObject |
3298 |
"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
|
3299 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3300 |
self keysAndValuesDo:[:key :val | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3301 |
(key == anObject) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3302 |
(val == anObject ) ifTrue:[^ true]. |
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3303 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3304 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3305 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3306 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
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 |
resolveName:nameIn inClass:aClass |
7563 | 3310 |
"resolve aName as if compiled within aClass; |
3026 | 3311 |
i.e. if it has a private class with this name, return it; |
3312 |
if aName is known within the classes namespace, return that. |
|
3313 |
Otherwise, return a global with that name. |
|
3314 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3315 |
to resolve a global by name." |
|
3316 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3317 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3318 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3319 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 3320 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3321 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3322 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3323 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3324 |
aName := aName copyFrom:12. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3325 |
^ self at:(aName asSymbol) ifAbsent:nil. |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3326 |
]. |
3026 | 3327 |
|
3328 |
sym := aName asSymbol. |
|
3329 |
||
3330 |
cls := aClass privateClassesAt:sym. |
|
3331 |
cls notNil ifTrue:[^ cls]. |
|
3332 |
||
3333 |
ns := aClass nameSpace. |
|
3334 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3335 |
ns isNameSpace ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3336 |
cls := ns at:sym ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3337 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3338 |
cls := ns privateClassesAt:sym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3339 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3340 |
cls notNil ifTrue:[^ cls]. |
3025 | 3341 |
]. |
3026 | 3342 |
^ self at:sym ifAbsent:nil. |
4356 | 3343 |
|
3344 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3345 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3346 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3347 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3348 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3349 |
2 entries: 1st: the longest match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3350 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3351 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3352 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3353 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3354 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3355 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3356 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3357 |
2 entries: 1st: the longest match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3358 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3359 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3360 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3361 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3362 |
" |
10071 | 3363 |
Smalltalk selectorCompletion:'at:p' |
3364 |
Smalltalk selectorCompletion:'nextP' |
|
3365 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3366 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3367 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3368 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3369 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 3370 |
! ! |
3371 |
||
4431 | 3372 |
!Smalltalk class methodsFor:'queries-system'! |
3373 |
||
7563 | 3374 |
dialectName |
8736 | 3375 |
^ #SmalltalkX |
7563 | 3376 |
|
3377 |
" |
|
3378 |
Smalltalk dialectName |
|
3379 |
" |
|
3380 |
! |
|
3381 |
||
3382 |
dialectReleaseVersion |
|
7348 | 3383 |
^ self versionString |
3384 |
||
3385 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3386 |
Smalltalk dialectReleaseVersion |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3387 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3388 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3389 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3390 |
isDolphinSmalltalk |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3391 |
"return false here - this may be useful to write portable |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3392 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3393 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3394 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3395 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3396 |
! |
4970 | 3397 |
|
7563 | 3398 |
isSmalltalkMT |
3399 |
"return false here - this may be useful to write portable |
|
3400 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
4970 | 3401 |
returning true there." |
3402 |
||
3403 |
^ false |
|
3404 |
! |
|
3405 |
||
7563 | 3406 |
isSmalltalkV |
3407 |
"return false here - this may be useful to write portable |
|
3408 |
applications - add #isSmalltalkV to your smalltalkV, |
|
4431 | 3409 |
returning true there." |
3410 |
||
3411 |
^ false |
|
3412 |
! |
|
3413 |
||
7563 | 3414 |
isSmalltalkX |
3415 |
"return true here - this may be useful to write portable |
|
3416 |
applications - add #isSmalltalkX to your other smalltalks, |
|
4431 | 3417 |
returning false there." |
3418 |
||
3419 |
^ true |
|
3420 |
! |
|
3421 |
||
7563 | 3422 |
isSqueak |
3423 |
"return false here - this may be useful to write portable |
|
3424 |
applications - add #isSqueak to your squeak, |
|
4431 | 3425 |
returning true there." |
3426 |
||
3427 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3428 |
! |
4431 | 3429 |
|
7563 | 3430 |
isVisualAge |
3431 |
"return false here - this may be useful to write portable |
|
3432 |
applications - add #isVisualAge to your visualAge, |
|
4431 | 3433 |
returning true there." |
3434 |
||
3435 |
^ false |
|
3436 |
! |
|
3437 |
||
7563 | 3438 |
isVisualWorks |
3439 |
"return false here - this may be useful to write portable |
|
3440 |
applications - add #isVisualWorks to your visualWorks, |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3441 |
returning true there." |
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 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3444 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3445 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3446 |
!Smalltalk class methodsFor:'startup'! |
1 | 3447 |
|
9032 | 3448 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3449 |
"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
|
3450 |
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
|
3451 |
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
|
3452 |
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
|
3453 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3454 |
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
|
3455 |
|
9032 | 3456 |
|windowIDString numericWindowID windowID params idx process| |
3457 |
||
3458 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3459 |
windowIDString := CommandLineArguments at:idx+1. |
|
3460 |
numericWindowID := Integer fromString:windowIDString. |
|
3461 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3462 |
||
3463 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3464 |
idx ~~ 0 ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3465 |
params := Dictionary new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3466 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3467 |
params at:key put:value. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3468 |
]. |
9032 | 3469 |
]. |
3470 |
||
3471 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3472 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3473 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3474 |
||
3475 |
process := [ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3476 |
PluginSupport |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3477 |
startInBrowserWithWindowID:windowID |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3478 |
parameters:params. |
9032 | 3479 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3480 |
process priority:(Processor userSchedulingPriority). |
9032 | 3481 |
process name:'browser start handler'. |
3482 |
process beGroupLeader. |
|
3483 |
process resume. |
|
3484 |
process := nil. |
|
3485 |
||
3486 |
Processor dispatchLoop. |
|
3487 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3488 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3489 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3490 |
! |
3491 |
||
7563 | 3492 |
displayInitializationDone |
3493 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3494 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3495 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3496 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3497 |
|
13893 | 3498 |
executeStartBlocks |
3499 |
|startBlocks| |
|
3500 |
||
3501 |
startBlocks := self startBlocks. |
|
3502 |
startBlocks notNil ifTrue:[ |
|
14432 | 3503 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
3504 |
startBlocks do:[:aBlock| |
|
3505 |
Error handle:[:ex | |
|
3506 |
InfoPrinting == true ifTrue:[ |
|
3507 |
'Smalltalk [warning]: error cought in startBlock: ' infoPrint. |
|
3508 |
ex description infoPrintCR. |
|
3509 |
ex infoPrintCR. |
|
3510 |
thisContext fullPrintAll. |
|
3511 |
]. |
|
3512 |
] do: aBlock |
|
3513 |
]. |
|
3514 |
startBlocks removeAll. |
|
13893 | 3515 |
]. |
3516 |
||
3517 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
3518 |
! |
|
3519 |
||
11375 | 3520 |
hideSplashWindow |
3521 |
%{ |
|
3522 |
#ifdef WIN32 |
|
3523 |
extern void __win32_hideSplashScreen(); |
|
3524 |
||
3525 |
__win32_hideSplashScreen(); |
|
3526 |
#endif |
|
3527 |
%} |
|
3528 |
! |
|
3529 |
||
7563 | 3530 |
mainStartup:graphicalMode |
3531 |
"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
|
3532 |
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
|
3533 |
|
9012 | 3534 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3535 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3536 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3537 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3538 |
|
10644 | 3539 |
graphicalMode ifTrue:[ |
14432 | 3540 |
Display isNil ifTrue:[ |
3541 |
(StartupClass notNil |
|
3542 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3543 |
self openDisplay. |
|
3544 |
]. |
|
3545 |
]. |
|
10644 | 3546 |
]. |
3547 |
||
10645 | 3548 |
StandAlone ifFalse:[ |
14432 | 3549 |
" |
3550 |
enable the graphical debugger/inspector |
|
3551 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3552 |
" |
|
3553 |
self initStandardTools. |
|
10645 | 3554 |
]. |
3555 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3556 |
" |
10071 | 3557 |
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
|
3558 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3559 |
Display notNil ifTrue:[ |
14432 | 3560 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
3561 |
SaveEmergencyImage == true ifTrue:[ |
|
3562 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
3563 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
3564 |
]. |
|
3565 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
3566 |
self exit. |
|
3567 |
]. |
|
3568 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3569 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3570 |
|
9016 | 3571 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 3572 |
IsPlugin := (idx ~~ 0). |
3573 |
IsPlugin ifTrue:[ |
|
14432 | 3574 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
3575 |
self browserWindowStartup. |
|
3576 |
"/ not reached |
|
9012 | 3577 |
]. |
3578 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3579 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3580 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3581 |
"/ 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
|
3582 |
"/ 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
|
3583 |
"/ 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
|
3584 |
"/ 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
|
3585 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3586 |
process := [ |
14432 | 3587 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
3588 |
StartBlocks notNil ifTrue:[ |
|
3589 |
self executeStartBlocks. |
|
3590 |
StartBlocks := nil. |
|
3591 |
]. |
|
3592 |
ImageStartBlocks notNil ifTrue:[ |
|
3593 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
|
3594 |
ImageStartBlocks do:[:aBlock| |
|
3595 |
aBlock value |
|
3596 |
]. |
|
3597 |
]. |
|
3598 |
StandAlone ifFalse:[ |
|
3599 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
3600 |
thisIsARestart ifTrue:[ |
|
3601 |
Transcript cr. |
|
3602 |
Transcript showCR:('Smalltalk restarted from:' |
|
3603 |
, imageName |
|
3604 |
, ' (saved ' |
|
3605 |
, ObjectMemory imageSaveTime printString |
|
3606 |
, ')' ). |
|
3607 |
] ifFalse:[ |
|
3608 |
Transcript showCR:(self hello). |
|
3609 |
Transcript showCR:(self copyrightString). |
|
3610 |
]. |
|
3611 |
Transcript cr. |
|
3612 |
]. |
|
3613 |
||
3614 |
DemoMode==true ifTrue:[ |
|
3615 |
Transcript showCR:'*** Restricted use: ***'. |
|
3616 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
3617 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
3618 |
Transcript showCR:'*** for more details. ***'. |
|
3619 |
Transcript cr. |
|
3620 |
]. |
|
3621 |
]. |
|
3622 |
||
3623 |
thisIsARestart ifTrue:[ |
|
3624 |
"/ |
|
3625 |
"/ the final late notification - users can now assume that |
|
3626 |
"/ views, forms etc. have been recreated. |
|
3627 |
||
3628 |
ObjectMemory changed:#returnFromSnapshot. |
|
3629 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
3630 |
|
7040 | 3631 |
] newProcess. |
3632 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3633 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3634 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3635 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3636 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3637 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
3638 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
3639 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
3640 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
3641 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3642 |
"/ 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
|
3643 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3644 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3645 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
14432 | 3646 |
" |
3647 |
allow more customization by reading an image specific rc-file |
|
3648 |
" |
|
3649 |
thisIsARestart ifTrue:[ |
|
3650 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
3651 |
imageName := imageName copyWithoutLast:4 |
|
3652 |
]. |
|
3653 |
self fileIn:(imageName , '.rc') |
|
3654 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3655 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3656 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3657 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3658 |
"/ ]. |
2086 | 3659 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3660 |
|
14432 | 3661 |
process := [ |
3662 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
|
3663 |
StandAlone ifTrue:[ |
|
3664 |
AbortOperationRequest handle:[:ex | |
|
3665 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
3666 |
OperatingSystem exit:1 |
|
3667 |
] do:[ |
|
3668 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
|
3669 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
3670 |
] |
|
3671 |
] ifFalse:[ |
|
3672 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
|
3673 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
3674 |
]. |
|
3675 |
||
3676 |
"/ |
|
3677 |
"/ non-GUI apps exit after the startup; |
|
3678 |
"/ assume that GUI apps have created & opened some view ... |
|
3679 |
"/ |
|
3680 |
Display isNil ifTrue:[ |
|
3681 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
3682 |
Smalltalk exit. |
|
3683 |
]. |
|
3684 |
"/ |
|
3685 |
"/ GUI apps exit after the last user process has finished |
|
3686 |
"/ |
|
3687 |
Display exitOnLastClose:true. |
|
3688 |
Processor exitWhenNoMoreUserProcesses:true. |
|
3689 |
] newProcess. |
|
3690 |
process priority:(Processor userSchedulingPriority). |
|
3691 |
process name:'main'. |
|
3692 |
process beGroupLeader. |
|
3693 |
process resume. |
|
3694 |
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
|
3695 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3696 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3697 |
StandAlone ifTrue:[ |
14432 | 3698 |
Display notNil ifTrue:[ |
3699 |
FlyByHelp notNil ifTrue:[ |
|
3700 |
FlyByHelp start |
|
3701 |
]. |
|
3702 |
]. |
|
12627
144e362477ff
ask startupClass if splash window should be kept open
Claus Gittinger <cg@exept.de>
parents:
12614
diff
changeset
|
3703 |
]. |
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3704 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3705 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3706 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3707 |
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
|
3708 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3709 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3710 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3711 |
or:[HeadlessOperation |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3712 |
or:[StandAlone]]]) ifTrue:[ |
14432 | 3713 |
Processor dispatchLoop. |
3714 |
"done - the last process finished" |
|
3715 |
'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
|
3716 |
] ifFalse:[ |
14432 | 3717 |
StandAlone ifFalse:[ |
3718 |
self readEvalPrint |
|
3719 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3720 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3721 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3722 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3723 |
|
13526 | 3724 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
3725 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
13893 | 3726 |
"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
|
3727 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3728 |
|
10641 | 3729 |
openDisplay |
3730 |
"try to open a display connection. |
|
3731 |
If so, also read display- and keyboard.rc" |
|
3732 |
||
13385 | 3733 |
|commandName| |
3734 |
||
3735 |
commandName := Smalltalk commandName. |
|
3736 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 3737 |
|
10641 | 3738 |
Display isNil ifTrue:[ |
13771 | 3739 |
Screen notNil ifTrue:[ |
3740 |
[ |
|
3741 |
Screen openDefaultDisplay:nil. |
|
3742 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
3743 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
|
3744 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
|
3745 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
3746 |
HeadlessOperation == true ifFalse:[ |
|
3747 |
OperatingSystem exit:1. |
|
3748 |
]. |
|
3749 |
]. |
|
3750 |
||
3751 |
Display notNil ifTrue:[ |
|
3752 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
3753 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
3754 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
3755 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
3756 |
] |
|
3757 |
] |
|
3758 |
]. |
|
3759 |
] |
|
10641 | 3760 |
] |
3761 |
||
3762 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
3763 |
! |
|
3764 |
||
3765 |
readEvalPrint |
|
3766 |
"{ Pragma: +optSpace }" |
|
3767 |
||
3768 |
(ReadEvalPrintLoop new prompt:'ST> ') readEvalPrintLoop |
|
3769 |
||
3770 |
"Modified: / 07-12-2006 / 17:35:19 / cg" |
|
3771 |
! |
|
3772 |
||
3773 |
restart |
|
3774 |
"startup after an image has been loaded; |
|
3775 |
there are three change-notifications made to dependents of ObjectMemory, |
|
3776 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
3777 |
||
3778 |
#earlySystemInstallation is sent for ST80 compatibility |
|
3779 |
||
3780 |
#earlyRestart is send first, nothing has been setup yet. |
|
13771 | 3781 |
(should be used to flush all device dependent entries) |
10641 | 3782 |
|
3783 |
#restarted is send right after. |
|
13771 | 3784 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 3785 |
|
3786 |
#returnFromSnapshot is sent last |
|
13771 | 3787 |
(should be used to restart processes, reOpen Streams which cannot |
3788 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
3789 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 3790 |
" |
3791 |
||
3792 |
|deb insp transcript idx| |
|
3793 |
||
3794 |
"/ |
|
3795 |
"/ when we arrive here, all objects from our previous life |
|
3796 |
"/ have been reloaded - however, some may still contain invalid device |
|
3797 |
"/ handles, display information etc. |
|
3798 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
3799 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
3800 |
"/ the previous classes. |
|
3801 |
||
3802 |
Initializing := true. |
|
3803 |
AbstractOperatingSystem initializeConcreteClass. |
|
3804 |
||
3805 |
ImageRestartTime := Timestamp now. |
|
3806 |
||
3807 |
CommandLine := CommandLineArguments copy. |
|
3808 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
3809 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
3810 |
||
3811 |
idx := CommandLineArguments indexOf:'-q'. |
|
3812 |
idx == 0 ifTrue:[ |
|
13771 | 3813 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 3814 |
]. |
3815 |
idx ~~ 0 ifTrue:[ |
|
13771 | 3816 |
Object infoPrinting:false. |
3817 |
ObjectMemory infoPrinting:false. |
|
3818 |
CommandLineArguments removeAtIndex:idx. |
|
10641 | 3819 |
]. |
3820 |
||
3821 |
"/ |
|
3822 |
"/ start catching SIGSEGV and SIGBUS |
|
3823 |
||
3824 |
OperatingSystem enableHardSignalInterrupts. |
|
3825 |
||
3826 |
"/ reinit Filename |
|
3827 |
Filename reinitialize. |
|
3828 |
||
3829 |
"/ |
|
3830 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
3831 |
||
3832 |
self flushPathCaches. |
|
3833 |
||
3834 |
"/ |
|
3835 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
3836 |
"/ after that, we can write to stderr. |
|
3837 |
||
3838 |
self reinitStandardStreams. |
|
3839 |
||
3840 |
"/ |
|
3841 |
"/ redirect Transcript to Stderr during startup |
|
3842 |
||
3843 |
transcript := Transcript. |
|
3844 |
Transcript := Stderr. |
|
3845 |
||
3846 |
"/ |
|
3847 |
"/ temporary switch back to dumb interface - |
|
3848 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
3849 |
||
3850 |
insp := Inspector. |
|
3851 |
deb := Debugger. |
|
3852 |
deb notNil ifTrue:[ |
|
13771 | 3853 |
deb reinitialize |
10641 | 3854 |
]. |
3855 |
Inspector := MiniInspector. |
|
3856 |
Debugger := MiniDebugger. |
|
3857 |
||
3858 |
"/ reload any dynamically loaded objects. |
|
3859 |
"/ this must be done before doing anything else below, |
|
3860 |
"/ because the Processor may restart processes which use |
|
3861 |
"/ this code. |
|
3862 |
"/ Also, a dynamic object might be registered as dependent of |
|
3863 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
3864 |
||
3865 |
ObjectFileLoader notNil ifTrue:[ |
|
13771 | 3866 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
10641 | 3867 |
]. |
3868 |
||
3869 |
"/ |
|
3870 |
"/ invalidate all display connections. |
|
3871 |
"/ This is required to avoid trouble if someone accesses |
|
3872 |
"/ a display during early startup. |
|
3873 |
||
3874 |
Screen notNil ifTrue:[ |
|
13771 | 3875 |
Screen allScreens do:[:aDisplay | |
3876 |
aDisplay invalidateConnection |
|
3877 |
]. |
|
10641 | 3878 |
]. |
3879 |
||
3880 |
ObjectMemory changed:#earlySystemInstallation. |
|
3881 |
||
3882 |
"/ |
|
3883 |
"/ reinitialize the Processor - restartable processes |
|
3884 |
"/ are now restarted here (but not yet scheduled). |
|
3885 |
"/ |
|
3886 |
Processor reinitialize. |
|
3887 |
||
3888 |
"/ |
|
3889 |
"/ flush device handles & recreate OS resources (if possible) |
|
3890 |
"/ (mostly view/GC/color & font stuff) |
|
3891 |
||
3892 |
ObjectMemory |
|
13771 | 3893 |
changed:#earlyRestart; changed:#restarted. |
10641 | 3894 |
|
3895 |
"/ |
|
3896 |
"/ start catching SIGINT and SIGQUIT |
|
3897 |
||
3898 |
OperatingSystem enableUserInterrupts. |
|
3899 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 3900 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 3901 |
|
3902 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
3903 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
3904 |
||
3905 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
3906 |
idx == 0 ifTrue:[ |
|
13771 | 3907 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 3908 |
]. |
3909 |
idx ~~ 0 ifTrue:[ |
|
13771 | 3910 |
CommandLineArguments removeAtIndex:idx. |
10641 | 3911 |
] ifFalse:[ |
13771 | 3912 |
CallbackSignal := QuerySignal new. |
3913 |
[ |
|
3914 |
Class withoutUpdatingChangesDo:[ |
|
3915 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
3916 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
3917 |
self fileIn:'smalltalk_r.rc' |
|
3918 |
]. |
|
3919 |
] |
|
3920 |
] on:CallbackSignal do:[:ex| |
|
3921 |
"/ now, display and view-stuff works; |
|
3922 |
"/ back to the previous debugging interface |
|
3923 |
||
3924 |
Inspector := insp. |
|
3925 |
Debugger := deb. |
|
3926 |
||
3927 |
"/ reinstall Transcript, if not changed during restart. |
|
3928 |
"/ if there was no Transcript, go to stderr |
|
3929 |
||
3930 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
3931 |
Transcript := transcript. |
|
3932 |
]. |
|
3933 |
Initializing := false. |
|
3934 |
ex proceed. |
|
3935 |
]. |
|
3936 |
CallbackSignal := nil. |
|
10641 | 3937 |
]. |
3938 |
||
3939 |
"/ reinitialization (restart) of Display is normally performed |
|
3940 |
"/ in the restart script. If this has not been run for some reason, |
|
3941 |
"/ do in now. |
|
3942 |
Initializing ifTrue:[ |
|
13771 | 3943 |
Display notNil ifTrue:[ |
3944 |
[ |
|
3945 |
Display reinitializeFor:Screen defaultDisplayName. |
|
3946 |
] on:Screen deviceOpenErrorSignal do:[ |
|
3947 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
3948 |
Screen defaultDisplayName errorPrintCR. |
|
3949 |
OperatingSystem exit:1. |
|
3950 |
]. |
|
3951 |
]. |
|
3952 |
"/ now, display and view-stuff works; |
|
3953 |
"/ back to the previous debugging interface |
|
3954 |
||
3955 |
Inspector := insp. |
|
3956 |
Debugger := deb. |
|
3957 |
||
3958 |
"/ reinstall Transcript, if not changed during restart. |
|
3959 |
"/ if there was no Transcript, go to stderr |
|
3960 |
||
3961 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
3962 |
Transcript := transcript. |
|
3963 |
]. |
|
3964 |
Initializing := false. |
|
10641 | 3965 |
]. |
3966 |
Screen notNil ifTrue:[ |
|
13771 | 3967 |
"clean up leftover screens (and views) that haven't been reopened. |
3968 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
3969 |
Screen allScreens copy do:[:eachDisplay | |
|
3970 |
eachDisplay isOpen ifFalse:[ |
|
3971 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
3972 |
eachDisplay errorPrintCR. |
|
3973 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
3974 |
] |
|
3975 |
]. |
|
10641 | 3976 |
]. |
3977 |
||
3978 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 3979 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
13771 | 3980 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 3981 |
]. |
10641 | 3982 |
self mainStartup:true |
3983 |
||
13526 | 3984 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
3985 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 3986 |
! |
3987 |
||
11399 | 3988 |
showSplashMessage:aString |
3989 |
"put the message into the splash screen (if there is one). |
|
3990 |
Use this for messages during startup" |
|
3991 |
||
3992 |
self showSplashMessage:aString color:nil. |
|
3993 |
! |
|
3994 |
||
11388 | 3995 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 3996 |
"put the message into the splash screen (if there is one)." |
3997 |
||
11388 | 3998 |
%{ |
3999 |
#ifdef WIN32 |
|
4000 |
extern void __win32_splashMessage(); |
|
4001 |
char *msg = (char *)0; |
|
4002 |
int clr = 0; |
|
4003 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
4004 |
if (__isStringLike(aMessageStringOrNil)) { |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4005 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 4006 |
} |
4007 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4008 |
clr = __intVal(rgbValueOrNil); |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4009 |
__win32_splashMessageColor(clr); |
11388 | 4010 |
} |
4011 |
__win32_splashMessage(msg); |
|
4012 |
#endif |
|
4013 |
%} |
|
4014 |
! |
|
4015 |
||
4016 |
splashInfo:aString |
|
11389 | 4017 |
"like infoPrintCR, |
4018 |
but in addition put the message into the splash screen (if there is one). |
|
4019 |
Use this for info messages during startup" |
|
4020 |
||
12883 | 4021 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 4022 |
self showSplashMessage:aString color:nil. |
4023 |
! |
|
4024 |
||
7563 | 4025 |
start |
4026 |
"main startup, if there is a Display, initialize it |
|
4027 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
617 | 4028 |
|
9012 | 4029 |
|idx graphicalMode arg didReadRCFile| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4030 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
4031 |
graphicalMode := true. |
617 | 4032 |
Initializing := true. |
4033 |
||
13526 | 4034 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
14545 | 4035 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 4036 |
]. |
4037 |
||
617 | 4038 |
" |
4039 |
while reading patches- and rc-file, do not add things into change-file |
|
4040 |
" |
|
4041 |
Class withoutUpdatingChangesDo:[ |
|
14545 | 4042 |
|commandFile defaultRC prevCatchSetting| |
4043 |
||
4044 |
didReadRCFile := false. |
|
4045 |
||
4046 |
StandAlone ifFalse:[ |
|
4047 |
"/ |
|
4048 |
"/ look for any '-q', '-e' or '-f' command line arguments |
|
4049 |
"/ and handle them; |
|
4050 |
"/ read startup and patches file |
|
4051 |
"/ |
|
4052 |
idx := CommandLineArguments indexOf:'-q'. |
|
4053 |
idx == 0 ifTrue:[ |
|
4054 |
idx := CommandLineArguments indexOf:'--silent'. |
|
4055 |
]. |
|
4056 |
idx ~~ 0 ifTrue:[ |
|
4057 |
Object infoPrinting:false. |
|
4058 |
ObjectMemory infoPrinting:false. |
|
4059 |
CommandLineArguments removeAtIndex:idx. |
|
4060 |
]. |
|
4061 |
||
4062 |
"/ look for a '--repl' argument |
|
4063 |
"/ then go into a read-eval-print loop immediately |
|
4064 |
idx := CommandLineArguments indexOf:'--repl'. |
|
4065 |
idx ~~ 0 ifTrue:[ |
|
4066 |
CommandLineArguments removeAtIndex:idx. |
|
4067 |
self startSchedulerAndBackgroundCollector. |
|
4068 |
self readEvalPrint. |
|
4069 |
self exit. |
|
4070 |
]. |
|
4071 |
||
4072 |
"/ look for a '-e filename' or '--execute filename' argument |
|
4073 |
"/ this will force fileIn of filename only, no standard startup. |
|
4074 |
||
4075 |
idx := CommandLineArguments indexOf:'-e'. |
|
4076 |
idx == 0 ifTrue:[ |
|
4077 |
idx := CommandLineArguments indexOf:'--execute'. |
|
4078 |
idx == 0 ifTrue:[ |
|
4079 |
idx := CommandLineArguments indexOf:'--script'. |
|
4080 |
idx ~~ 0 ifTrue:[ |
|
4081 |
SilentLoading := true. |
|
4082 |
]. |
|
4083 |
]. |
|
4084 |
]. |
|
4085 |
idx ~~ 0 ifTrue:[ |
|
4086 |
|process| |
|
4087 |
||
4088 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4089 |
||
4090 |
CommandLineArguments |
|
4091 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4092 |
||
4093 |
self startSchedulerAndBackgroundCollector. |
|
4094 |
Initializing := false. |
|
4095 |
||
4096 |
process := [ |
|
4097 |
arg = '-' ifTrue:[ |
|
4098 |
self fileInStream:Stdin |
|
4099 |
lazy:nil |
|
4100 |
silent:nil |
|
4101 |
logged:false |
|
4102 |
addPath:nil |
|
4103 |
] ifFalse:[ |
|
4104 |
IsSTScript := true. |
|
4105 |
self fileIn:arg. |
|
4106 |
]. |
|
4107 |
self exit. |
|
4108 |
] newProcess. |
|
4109 |
process priority:(Processor userSchedulingPriority). |
|
4110 |
process name:'main'. |
|
4111 |
process beGroupLeader. |
|
4112 |
process resume. |
|
4113 |
||
4114 |
Processor dispatchLoop. |
|
4115 |
self exit |
|
4116 |
]. |
|
4117 |
||
4118 |
"/ look for a '-E expr' or '--eval expr' argument |
|
4119 |
"/ this will force evaluation of expr only, no standard startup |
|
4120 |
idx := CommandLineArguments indexOf:'-E'. |
|
4121 |
idx == 0 ifTrue:[ |
|
4122 |
idx := CommandLineArguments indexOf:'--eval'. |
|
4123 |
]. |
|
4124 |
idx ~~ 0 ifTrue:[ |
|
4125 |
arg := CommandLineArguments at:idx + 1. |
|
4126 |
||
4127 |
CommandLineArguments |
|
4128 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4129 |
||
4130 |
self startSchedulerAndBackgroundCollector. |
|
4131 |
Initializing := false. |
|
4132 |
||
4133 |
self |
|
4134 |
fileInStream:arg readStream |
|
4135 |
lazy:nil |
|
4136 |
silent:nil |
|
4137 |
logged:false |
|
4138 |
addPath:nil. |
|
4139 |
||
4140 |
self exit |
|
4141 |
]. |
|
4142 |
||
4143 |
"look for a '-f filename' or '--file filename' argument |
|
4144 |
this will force evaluation of filename instead of smalltalk.rc" |
|
4145 |
||
4146 |
idx := CommandLineArguments indexOf:'-f'. |
|
4147 |
idx == 0 ifTrue:[ |
|
4148 |
idx := CommandLineArguments indexOf:'--file'. |
|
4149 |
]. |
|
4150 |
idx ~~ 0 ifTrue:[ |
|
4151 |
CommandName := commandFile := CommandLineArguments at:idx+1. |
|
4152 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4153 |
]. |
|
4154 |
]. |
|
4155 |
||
4156 |
commandFile notNil ifTrue:[ |
|
4157 |
self startSchedulerAndBackgroundCollector. |
|
4158 |
Initializing := false. |
|
4159 |
||
4160 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4161 |
('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4162 |
OperatingSystem exit:1. |
|
4163 |
]. |
|
4164 |
] ifFalse:[ |
|
4165 |
"/ look for <command>.rc |
|
4166 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4167 |
||
4168 |
commandFile := self commandName asFilename withSuffix:'rc'. |
|
4169 |
(didReadRCFile := commandFile exists and:[self secureFileIn:commandFile]) ifFalse:[ |
|
4170 |
StandAlone ifFalse:[ |
|
4171 |
defaultRC := 'smalltalk.rc' asFilename |
|
4172 |
] ifTrue:[ |
|
4173 |
defaultRC := 'stxapp.rc' asFilename |
|
4174 |
]. |
|
4175 |
||
4176 |
didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4177 |
didReadRCFile ifFalse:[ |
|
4178 |
StandAlone ifFalse:[ |
|
4179 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4180 |
graphicalMode := false. |
|
4181 |
] |
|
4182 |
] |
|
4183 |
]. |
|
4184 |
||
4185 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4186 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4187 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4188 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4189 |
||
4190 |
didReadRCFile ifFalse:[ |
|
4191 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4192 |
||
4193 |
"/ |
|
4194 |
"/ No RC file found; |
|
4195 |
"/ Setup more default stuff |
|
4196 |
"/ |
|
4197 |
StandAlone ifFalse:[ |
|
4198 |
"/ its a smalltalk - proceed in interpreter. |
|
4199 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4200 |
graphicalMode := false. |
|
4201 |
]. |
|
4202 |
||
4203 |
"/ setup more defaults... |
|
13537 | 4204 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
4205 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
14545 | 4206 |
self addStartBlock:[ |
4207 |
self startSchedulerAndBackgroundCollector |
|
4208 |
]. |
|
4209 |
]. |
|
4210 |
]. |
|
617 | 4211 |
]. |
4212 |
||
10644 | 4213 |
HeadlessOperation ifTrue:[ |
14545 | 4214 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4215 |
]. |
10645 | 4216 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4217 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4218 |
|
13564 | 4219 |
"Modified: / 07-08-2011 / 16:55:21 / cg" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4220 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4221 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4222 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4223 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4224 |
Processor supportDynamicPriorities:true. |
13537 | 4225 |
|
4226 |
ObjectMemory startBackgroundCollectorAt:5. |
|
4227 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4228 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4229 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4230 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4231 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4232 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4233 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4234 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4235 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4236 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4237 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4238 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4239 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4240 |
p := |
14432 | 4241 |
[ |
4242 |
self executeStartBlocks. |
|
4243 |
] newProcess. |
|
12022 | 4244 |
|
4245 |
p |
|
14432 | 4246 |
priority:(Processor userSchedulingPriority); |
4247 |
name:'start block handler'; |
|
4248 |
beGroupLeader; |
|
4249 |
resume. |
|
13892 | 4250 |
|
13893 | 4251 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 4252 |
! ! |
4253 |
||
13947 | 4254 |
!Smalltalk class methodsFor:'startup and exit'! |
4255 |
||
4256 |
addExitBlock:aBlock |
|
4257 |
"{ Pragma: +optSpace }" |
|
4258 |
||
4259 |
"add a block to be executed when Smalltalk finishes. |
|
4260 |
This feature is currently not used anywhere - but could be useful for |
|
4261 |
cleanup in stand alone applications. |
|
4262 |
||
4263 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
4264 |
#aboutToQuit." |
|
4265 |
||
4266 |
ExitBlocks isNil ifTrue:[ |
|
4267 |
ExitBlocks := OrderedCollection with:aBlock |
|
4268 |
] ifFalse:[ |
|
4269 |
ExitBlocks add:aBlock |
|
4270 |
] |
|
4271 |
! |
|
4272 |
||
4273 |
addImageStartBlock:aBlock |
|
4274 |
"{ Pragma: +optSpace }" |
|
4275 |
||
4276 |
"add a blocks to be executed in a separate process after |
|
4277 |
everything has been initialized. |
|
4278 |
These blocks will be executed after an image restart." |
|
4279 |
||
4280 |
ImageStartBlocks isNil ifTrue:[ |
|
4281 |
ImageStartBlocks := OrderedCollection with:aBlock |
|
4282 |
] ifFalse:[ |
|
4283 |
ImageStartBlocks add:aBlock |
|
4284 |
] |
|
4285 |
||
4286 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
4287 |
! |
|
4288 |
||
4289 |
addStartBlock:aBlock |
|
4290 |
"add a block to be executed in a separate process after |
|
4291 |
everything has been initialized. These blocks will |
|
4292 |
be executed only once and not be executed after an image restart. |
|
4293 |
Initial processes such as the launcher are usually started here |
|
4294 |
(see smalltalk.rc / private.rc)." |
|
4295 |
||
4296 |
"{ Pragma: +optSpace }" |
|
4297 |
||
4298 |
StartBlocks isNil ifTrue:[ |
|
4299 |
StartBlocks := OrderedCollection with:aBlock |
|
4300 |
] ifFalse:[ |
|
4301 |
StartBlocks add:aBlock |
|
4302 |
] |
|
4303 |
||
4304 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
4305 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
4306 |
! |
|
4307 |
||
4308 |
exit |
|
4309 |
"{ Pragma: +optSpace }" |
|
4310 |
||
4311 |
"finish the Smalltalk system" |
|
4312 |
||
4313 |
self exit:0 |
|
4314 |
"not reached" |
|
4315 |
||
4316 |
"Be careful evaluating this |
|
4317 |
Smalltalk exit |
|
4318 |
" |
|
4319 |
! |
|
4320 |
||
4321 |
exit:statusInteger |
|
4322 |
"{ Pragma: +optSpace }" |
|
4323 |
||
4324 |
"finish the Smalltalk system" |
|
4325 |
||
4326 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
4327 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
4328 |
ExitBlocks notNil ifTrue:[ |
|
4329 |
ExitBlocks do:[:aBlock | |
|
4330 |
aBlock value |
|
4331 |
] |
|
4332 |
]. |
|
4333 |
OperatingSystem exit:statusInteger |
|
4334 |
"not reached" |
|
4335 |
||
4336 |
"Be careful evaluating this |
|
4337 |
Smalltalk exit:1 |
|
4338 |
" |
|
4339 |
! ! |
|
4340 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4341 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 4342 |
|
10641 | 4343 |
commandLine |
4344 |
"return the full command line arguments (with which ST/X was started)" |
|
4345 |
||
4346 |
^ CommandLine |
|
4347 |
||
4348 |
" |
|
4349 |
Smalltalk commandLine |
|
4350 |
" |
|
4351 |
||
4352 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
4353 |
! |
|
4354 |
||
4355 |
commandLineArgumentNamed:aString |
|
4356 |
"extract a named argument from the command line arguments." |
|
4357 |
||
4358 |
|args index| |
|
4359 |
||
4360 |
args := self commandLineArguments. |
|
4361 |
index := args indexOf:aString. |
|
4362 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4363 |
^ args at:index+1 |
10641 | 4364 |
]. |
4365 |
^ nil. |
|
4366 |
||
4367 |
" |
|
4368 |
self commandLineArgumentNamed:'-display' |
|
4369 |
" |
|
4370 |
! |
|
4371 |
||
4372 |
commandLineArguments |
|
4373 |
"return the user command line arguments; |
|
4374 |
This is a collection of strings (separated command line words), |
|
4375 |
from which the internal startup arguments have already been removed. |
|
4376 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
4377 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
4378 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
4379 |
||
4380 |
^ CommandLineArguments |
|
4381 |
||
4382 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
4383 |
! |
|
4384 |
||
4385 |
commandName |
|
4386 |
"return the excutables name - this is normally 'stx', |
|
4387 |
but can be something else for standAlone apps." |
|
4388 |
||
4389 |
^ CommandName. |
|
4390 |
||
4391 |
" |
|
4392 |
Smalltalk commandName |
|
4393 |
" |
|
4394 |
||
4395 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
4396 |
! |
|
4397 |
||
4398 |
hasNoConsole |
|
4399 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
4400 |
i.e. there should be no writing to stdout/stderr" |
|
4401 |
||
4402 |
^ HasNoConsole ? false |
|
4403 |
||
4404 |
" |
|
10071 | 4405 |
Smalltalk hasNoConsole |
9054 | 4406 |
" |
4407 |
! |
|
4408 |
||
10641 | 4409 |
isHeadless |
4410 |
"return true, if this is a headless application |
|
4411 |
i.e. no default Display connection is required/used" |
|
4412 |
||
4413 |
^ HeadlessOperation ? false |
|
4414 |
||
4415 |
" |
|
10071 | 4416 |
Smalltalk isHeadless |
9029 | 4417 |
" |
4418 |
! |
|
4419 |
||
10641 | 4420 |
isPlugin |
4421 |
"return true, if this is a plugin application |
|
4422 |
i.e. running in a browserWindow" |
|
4423 |
||
4424 |
^ IsPlugin ? false |
|
4425 |
||
4426 |
" |
|
10071 | 4427 |
Smalltalk isPlugin |
9029 | 4428 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4429 |
! |
4957 | 4430 |
|
10641 | 4431 |
isSTScript |
4432 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
4433 |
||
4434 |
^ IsSTScript ? false |
|
4435 |
||
4436 |
" |
|
4437 |
Smalltalk isSTScript |
|
4438 |
" |
|
4439 |
||
4440 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
4441 |
! |
|
4442 |
||
4443 |
isSharedLibraryComponent |
|
4444 |
"return true, if this is a shared library component of another application |
|
4445 |
i.e. a dll within another app." |
|
4446 |
||
4447 |
^ IsSharedLibraryComponent ? false |
|
4448 |
||
4449 |
" |
|
4450 |
Smalltalk isSharedLibraryComponent |
|
4451 |
" |
|
4452 |
||
4453 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
4454 |
! |
|
4455 |
||
4456 |
isSmalltalkDevelopmentSystem |
|
4457 |
"return true, if this is a real smalltalk system |
|
4458 |
i.e. NOT a stripped or a linked application (such as the webServer) |
|
4459 |
and NOT a plugIn (i.e. running in a browser) |
|
4460 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
4461 |
This is used to determine, wether debugging is possible or not." |
|
4462 |
||
4463 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
4464 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
4465 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 4466 |
^ self isStandAloneApp not. |
10641 | 4467 |
|
4468 |
" |
|
4469 |
Smalltalk isSmalltalkDevelopmentSystem |
|
4470 |
" |
|
4471 |
||
4472 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
4473 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
4474 |
! |
|
4475 |
||
4476 |
isStandAloneApp |
|
4477 |
"return true, if this is a standAlone application |
|
4478 |
i.e. a stripped & linked application (such as the webServer) |
|
4479 |
in contrast to a full smalltalk (development) system." |
|
4480 |
||
4481 |
^ StandAlone ? false |
|
4482 |
||
4483 |
" |
|
10071 | 4484 |
Smalltalk isStandAloneApp |
9029 | 4485 |
" |
617 | 4486 |
! |
4487 |
||
13947 | 4488 |
isStandAloneDebug |
4489 |
"return true, if this is a standAlone application which |
|
4490 |
was started with the -debug option." |
|
4491 |
||
4492 |
^ DebuggingStandAlone ? false |
|
4493 |
||
4494 |
" |
|
4495 |
Smalltalk isStandAloneDebug |
|
4496 |
" |
|
4497 |
||
4498 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
4499 |
! |
|
4500 |
||
10641 | 4501 |
startupArguments |
4502 |
"return the arguments passed to StartupClass when stx gets started. |
|
4503 |
Usually these are nil, |
|
4504 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
4505 |
a simple way to configure and create stand-alone applications" |
|
4506 |
||
4507 |
^ StartupArguments |
|
4508 |
||
4509 |
" |
|
10071 | 4510 |
Smalltalk startupArguments |
9029 | 4511 |
" |
7563 | 4512 |
! |
4513 |
||
10641 | 4514 |
startupClass |
4515 |
"return the class, that will get the start message when smalltalk |
|
4516 |
starts and its non-nil. Usually this is nil, |
|
4517 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
4518 |
a simple way to configure and create stand-alone applications" |
|
4519 |
||
4520 |
^ StartupClass |
|
4521 |
||
4522 |
" |
|
10071 | 4523 |
Smalltalk startupClass |
9029 | 4524 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4525 |
! |
8570 | 4526 |
|
10641 | 4527 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
4528 |
"{ Pragma: +optSpace }" |
|
4529 |
||
4530 |
"set the class, selector and arguments to be performed when smalltalk |
|
4531 |
starts. Setting those before saving a snapshot, will make the saved |
|
4532 |
image come up executing your application (instead of the normal mainloop)" |
|
4533 |
||
4534 |
StartupClass := aClass. |
|
4535 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4536 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4537 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4538 |
|
10641 | 4539 |
startupSelector |
4540 |
"return the selector, that will be sent to StartupClass. |
|
4541 |
Usually this is nil, |
|
4542 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
4543 |
a simple way to configure and create stand-alone applications" |
|
4544 |
||
4545 |
^ StartupSelector |
|
4546 |
||
4547 |
" |
|
10071 | 4548 |
Smalltalk startupSelector |
9029 | 4549 |
" |
10641 | 4550 |
! |
4551 |
||
4552 |
wasStartedFromImage |
|
4553 |
"return true, if this smalltalk was started from an image, |
|
4554 |
as opposed to a fresh and clean startup" |
|
4555 |
||
4556 |
^ ImageRestartTime notNil |
|
4557 |
||
4558 |
" |
|
4559 |
Smalltalk wasStartedFromImage |
|
4560 |
" |
|
70 | 4561 |
! ! |
4562 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4563 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 4564 |
|
10641 | 4565 |
language |
4566 |
"return the language setting" |
|
4567 |
||
4568 |
^ Language |
|
4569 |
||
4570 |
" |
|
4571 |
Smalltalk language |
|
4572 |
" |
|
4573 |
||
4574 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
4575 |
! |
|
4576 |
||
4577 |
language:aLanguageSymbol |
|
10991 | 4578 |
"set the language - send out change notifications" |
10641 | 4579 |
|
4580 |
Language := aLanguageSymbol asSymbol. |
|
4581 |
self changed:#Language |
|
4582 |
||
4583 |
" |
|
4584 |
Smalltalk language:#de |
|
4585 |
" |
|
4586 |
||
4587 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
4588 |
! |
|
4589 |
||
4590 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 4591 |
"set the language & territory - send out change notifications" |
10641 | 4592 |
|
4593 |
Language := aLanguageSymbol asSymbol. |
|
4594 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
4595 |
self changed:#Language |
|
4596 |
||
4597 |
" |
|
4598 |
Smalltalk language:#de territory:#de |
|
4599 |
" |
|
4600 |
||
4601 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
4602 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
4603 |
! |
|
4604 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4605 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4606 |
"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
|
4607 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4608 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4609 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4610 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4611 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4612 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4613 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4614 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4615 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4616 |
|
10641 | 4617 |
languageTerritory |
4618 |
"return the language territory setting" |
|
7563 | 4619 |
|
4620 |
^ LanguageTerritory |
|
4621 |
! |
|
4622 |
||
10641 | 4623 |
languageTerritory:aTerritorySymbol |
10991 | 4624 |
"set the language territory - send out change notifications" |
10641 | 4625 |
|
4626 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
4627 |
self changed:#LanguageTerritory |
|
4628 |
||
4629 |
" |
|
4630 |
Time now |
|
4631 |
||
4632 |
Smalltalk languageTerritory:#us. |
|
4633 |
Time now |
|
4634 |
||
4635 |
Smalltalk languageTerritory:#de. |
|
4636 |
Time now |
|
4637 |
" |
|
4638 |
||
4639 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
4640 |
! |
|
4641 |
||
4642 |
setLanguage:aLanguageSymbol |
|
10991 | 4643 |
"set the language without change notification" |
10641 | 4644 |
|
4645 |
Language := aLanguageSymbol. |
|
10991 | 4646 |
! |
4647 |
||
4648 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
4649 |
"set the language & territory - no change notification" |
|
4650 |
||
4651 |
Language := aLanguageSymbol asSymbol. |
|
4652 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 4653 |
! ! |
4654 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4655 |
!Smalltalk class methodsFor:'system management'! |
70 | 4656 |
|
10641 | 4657 |
compressSources |
4658 |
"{ Pragma: +optSpace }" |
|
4659 |
||
4660 |
"compress the sources file, and remove all method source strings |
|
4661 |
from the system and replace them by refs to a string in the source file. |
|
4662 |
This is a bit different in ST/X than in other smalltalks, |
|
4663 |
since we use per-class sourcefiles for the compiled classes, |
|
4664 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
4665 |
incremental compiled methods. |
|
4666 |
Therefore, only those sources which are not coming from compiled |
|
4667 |
methods are put into the 'st.src' file - all others are untouched. |
|
4668 |
This is being automated - so dont care for now." |
|
4669 |
||
4670 |
|newStream table source pos fileName| |
|
4671 |
||
4672 |
" |
|
4673 |
first, find all methods which contain either a string-ref |
|
4674 |
or an external string in the 'st.src' file |
|
4675 |
" |
|
4676 |
newStream := 'src.tmp' asFilename writeStream. |
|
4677 |
||
4678 |
table := IdentityDictionary new:100. |
|
4679 |
||
4680 |
Method allSubInstancesDo:[:aMethod | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4681 |
source := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4682 |
aMethod sourcePosition notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4683 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4684 |
source := aMethod source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4685 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4686 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4687 |
source := aMethod source |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4688 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4689 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4690 |
source notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4691 |
pos := newStream position1Based. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4692 |
newStream nextChunkPut:source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4693 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4694 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4695 |
dont change the methods info - maybe some write error |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4696 |
occurs later, in that case we abort and leave everything |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4697 |
untouched. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4698 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4699 |
table at:aMethod put:pos |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4700 |
] |
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4701 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4702 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4703 |
newStream syncData; close. |
10641 | 4704 |
|
4705 |
" |
|
4706 |
now, rename the new source file, |
|
4707 |
" |
|
4708 |
fileName := (ObjectMemory nameForSources). |
|
4709 |
'src.tmp' asFilename renameTo:fileName. |
|
4710 |
||
4711 |
"good - now go over all changed methods, and change their |
|
4712 |
source reference" |
|
4713 |
||
4714 |
table keysAndValuesDo:[:aMethod :pos | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4715 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 4716 |
"/ aMethod printCR. |
4717 |
]. |
|
4718 |
||
4719 |
" |
|
4720 |
Smalltalk compressSources |
|
4721 |
" |
|
4722 |
||
4723 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
4724 |
! |
|
4725 |
||
4726 |
generateSingleSourceFile |
|
4727 |
"{ Pragma: +optSpace }" |
|
4728 |
||
4729 |
"generate the sources file, and remove all method source strings |
|
4730 |
from the system and replace them by refs to a string in the source file. |
|
4731 |
This makes the image independent from the per-class source files |
|
4732 |
and makes transportation of endUser applications easier, since |
|
4733 |
only 3 files (executable, image and sourceFile) need to be |
|
4734 |
transported." |
|
4735 |
||
4736 |
|newStream table source pos fileName| |
|
4737 |
||
4738 |
newStream := 'src.tmp' asFilename writeStream. |
|
4739 |
||
4740 |
table := IdentityDictionary new:100. |
|
4741 |
||
4742 |
Method allSubInstancesDo:[:aMethod | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4743 |
source := aMethod source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4744 |
source notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4745 |
pos := newStream position1Based. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4746 |
newStream nextChunkPut:source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4747 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4748 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4749 |
dont change the methods info - maybe some write error |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4750 |
occurs later, in that case we abort and leave everything |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4751 |
untouched. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4752 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4753 |
table at:aMethod put:pos |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4754 |
] |
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4755 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4756 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4757 |
newStream syncData; close. |
10641 | 4758 |
|
4759 |
" |
|
4760 |
now, rename the new source file, |
|
4761 |
" |
|
4762 |
fileName := (ObjectMemory nameForSources). |
|
4763 |
'src.tmp' asFilename renameTo:fileName. |
|
4764 |
||
4765 |
"good - now go over all changed methods, and change their |
|
4766 |
source reference" |
|
4767 |
||
4768 |
table keysAndValuesDo:[:aMethod :pos | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4769 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 4770 |
"/ aMethod printCR. |
4771 |
]. |
|
4772 |
||
4773 |
" |
|
4774 |
Smalltalk generateSingleSourceFile |
|
4775 |
" |
|
4776 |
||
4777 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
4778 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
4779 |
! |
|
4780 |
||
4781 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
|
4782 |
"create & install an autoload stub for a class named: clsName, |
|
4783 |
to be loaded from package. |
|
4784 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
4785 |
(otherwise, the newest revision will be loaded" |
|
4786 |
||
4787 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4788 |
installAutoloadedClassNamed:clsName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4789 |
category:cat |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4790 |
package:package |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4791 |
revision:revisionOrNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4792 |
numClassInstVars:nil. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4793 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4794 |
|
10641 | 4795 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
4796 |
"create & install an autoload stub for a class named: clsName, |
|
4797 |
to be loaded from package. |
|
4798 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
4799 |
(otherwise, the newest revision will be loaded" |
|
4800 |
||
4801 |
|clsSym cls| |
|
4802 |
||
4803 |
clsSym := clsName asSymbol. |
|
4804 |
||
4805 |
"/ install if not already compiled-in |
|
4806 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4807 |
Autoload subclass:clsSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4808 |
instanceVariableNames:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4809 |
classVariableNames:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4810 |
poolDictionaries:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4811 |
category:cat |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4812 |
inEnvironment:Smalltalk. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4813 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4814 |
cls := self at:clsSym. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4815 |
cls isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4816 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4817 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4818 |
cls package:package asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4819 |
revisionOrNil notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4820 |
cls setBinaryRevision:revisionOrNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4821 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4822 |
] |
10641 | 4823 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4824 |
"/ class already present - however, if unloaded, check for category/package change |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4825 |
cls isLoaded ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4826 |
package ~= cls package ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4827 |
cls withoutUpdatingChangesDo:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4828 |
cls package:package asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4829 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4830 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4831 |
cat ~= cls category ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4832 |
cls withoutUpdatingChangesDo:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4833 |
cls category:cat. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4834 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4835 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4836 |
]. |
10641 | 4837 |
]. |
4838 |
^ cls. |
|
4839 |
||
4840 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
4841 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
4842 |
|
10641 | 4843 |
! |
4844 |
||
4845 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4846 |
"scan all packages and install all classes found there as |
10641 | 4847 |
autoloaded. This takes some time ..." |
4848 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4849 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4850 |
|
10641 | 4851 |
dirsConsulted := Set new. |
4852 |
||
4853 |
"/ along the package-path |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4854 |
self packagePath do:[:eachPathComponent | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4855 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4856 |
self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4857 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4858 |
rememberIn:dirsConsulted |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4859 |
maxLevels:15 |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4860 |
noAutoload:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4861 |
packageTop:eachPathComponent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4862 |
showSplashInLevels:2. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4863 |
] |
10641 | 4864 |
]. |
11388 | 4865 |
self splashInfo:nil. |
10641 | 4866 |
|
4867 |
" |
|
4868 |
Smalltalk installAutoloadedClasses |
|
4869 |
" |
|
4870 |
||
4871 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
4872 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
4873 |
! |
|
4874 |
||
4875 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
4876 |
"read the given abbreviation file; install all classes found there as |
|
4877 |
autoloaded. This takes some time ..." |
|
4878 |
||
4879 |
|f s| |
|
4880 |
||
4881 |
f := self getSystemFileName:anAbbrevFilePath. |
|
4882 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
4883 |
||
4884 |
f notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4885 |
f := f asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4886 |
f isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4887 |
f := f construct:'abbrev.stc' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4888 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4889 |
[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4890 |
s := f readStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4891 |
self installAutoloadedClassesFromStream:s. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4892 |
s close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4893 |
] on:FileStream openErrorSignal |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4894 |
do:[:ex| "do nothing"]. |
10641 | 4895 |
] |
4896 |
||
4897 |
" |
|
4898 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
4899 |
" |
|
4900 |
||
4901 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
4902 |
! |
|
4903 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4904 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4905 |
aFilename readingFileDo:[:abbrevStream | |
13771 | 4906 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4907 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4908 |
|
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4909 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4910 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4911 |
|
10641 | 4912 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
4913 |
"read the given abbreviation file; |
|
4914 |
install all classes found there as autoloaded, and also update the |
|
4915 |
abbreviation (className-to-fileName mapping) table. |
|
4916 |
This takes some time ..." |
|
4917 |
||
4918 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
4919 |
||
4920 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
14432 | 4921 |
abbrevFileName := anAbbrevFileStream pathName. |
4922 |
info := 'declared from: ', abbrevFileName. |
|
10641 | 4923 |
]. |
4924 |
||
4925 |
KnownPackages isNil ifTrue:[ |
|
14432 | 4926 |
KnownPackages := Set new. |
10641 | 4927 |
]. |
4928 |
||
4929 |
"/ yes, create any required nameSpace, without asking user. |
|
4930 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
4931 |
||
14432 | 4932 |
[anAbbrevFileStream atEnd] whileFalse:[ |
4933 |
l := anAbbrevFileStream nextLine withoutSeparators. |
|
4934 |
"Skip empty lines and comments" |
|
4935 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
|
4936 |
"/ must do it manually, caring for quoted strings. |
|
10641 | 4937 |
"/ words := line asCollectionOfWords. |
4938 |
||
14432 | 4939 |
words := OrderedCollection new. |
4940 |
s2 := l readStream. |
|
4941 |
[s2 atEnd] whileFalse:[ |
|
4942 |
s2 skipSeparators. |
|
4943 |
s2 peek == $' ifTrue:[ |
|
4944 |
s2 next. |
|
4945 |
w := s2 upTo:$'. |
|
4946 |
s2 skipSeparators. |
|
4947 |
] ifFalse:[ |
|
4948 |
w := s2 upToSeparator |
|
4949 |
]. |
|
4950 |
words add:w |
|
4951 |
]. |
|
4952 |
words size < 3 ifTrue:[ |
|
4953 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
|
4954 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
4955 |
' (in ''' errorPrint. |
|
4956 |
anAbbrevFileStream pathName errorPrint. |
|
4957 |
''')' errorPrint |
|
4958 |
]. |
|
4959 |
': ' errorPrint. l errorPrintCR |
|
4960 |
] ifFalse:[ |
|
4961 |
clsName := (words at:1) asSymbol. |
|
4962 |
abbrev := (words at:2). |
|
4963 |
package := (words at:3) asSymbol. |
|
4964 |
cat := words at:4 ifAbsent:nil. |
|
4965 |
numClassInstVars := words at:5 ifAbsent:'0'. |
|
4966 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
|
10641 | 4967 |
|
4968 |
"/ KnownPackages add:package. |
|
4969 |
||
14432 | 4970 |
(cat size == 0) ifTrue:[ |
4971 |
cat := 'autoloaded' |
|
4972 |
]. |
|
4973 |
||
4974 |
"/ on the fly, update the abbreviations |
|
4975 |
self setFilename:abbrev forClass:clsName package:package. |
|
4976 |
||
4977 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
|
4978 |
||
4979 |
cls := self |
|
4980 |
installAutoloadedClassNamed:clsName |
|
4981 |
category:cat |
|
4982 |
package:package |
|
4983 |
revision:nil |
|
4984 |
numClassInstVars:numClassInstVars. |
|
10641 | 4985 |
|
4986 |
"/ info notNil ifTrue:[ |
|
4987 |
"/ cls setComment:info. |
|
4988 |
"/ ]. |
|
14432 | 4989 |
] |
4990 |
] |
|
4991 |
] |
|
4458 | 4992 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4993 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4994 |
|
10641 | 4995 |
loadBinaries |
4996 |
"return true, if binaries should be loaded into the system, |
|
4997 |
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
|
4998 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4999 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5000 |
! |
3044 | 5001 |
|
10641 | 5002 |
loadBinaries:aBoolean |
5003 |
"{ Pragma: +optSpace }" |
|
5004 |
||
5005 |
"turn on/off loading of binary objects" |
|
5006 |
||
5007 |
aBoolean ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5008 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5009 |
LoadBinaries := true. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5010 |
^ self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5011 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5012 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
10641 | 5013 |
]. |
5014 |
LoadBinaries := false |
|
5015 |
||
5016 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
5017 |
! |
|
5018 |
||
5019 |
logDoits |
|
5020 |
"return true if doits should go into the changes file |
|
5021 |
as well as changes - by default, this is off, since |
|
5022 |
it can blow up the changes file enormously ... |
|
5023 |
" |
|
5024 |
||
5025 |
^ LogDoits |
|
5026 |
||
5027 |
" |
|
5028 |
LogDoits := false |
|
3044 | 5029 |
LogDoits := true |
5030 |
" |
|
5031 |
! |
|
5032 |
||
10641 | 5033 |
logDoits:aBoolean |
5034 |
"{ Pragma: +optSpace }" |
|
5035 |
||
5036 |
"turn on/off logging of doits in the changes file. |
|
5037 |
By default, this is off, since it can blow up the |
|
5038 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5039 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5040 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5041 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5042 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5043 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5044 |
|
10641 | 5045 |
makeBytecodeMethods |
5046 |
"{ Pragma: +optSpace }" |
|
5047 |
||
5048 |
"walk over all methods and make each a bytecode method |
|
5049 |
iff it does not contain primitive C code. |
|
5050 |
Experimental and not yet used." |
|
5051 |
||
5052 |
Method allSubInstancesDo:[:aMethod | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5053 |
|newMethod| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5054 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5055 |
aMethod hasPrimitiveCode ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5056 |
newMethod := aMethod asByteCodeMethod. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5057 |
newMethod ~~ aMethod ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5058 |
aMethod becomeSameAs:newMethod |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5059 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5060 |
]. |
10641 | 5061 |
]. |
5062 |
||
5063 |
" |
|
5064 |
Smalltalk makeBytecodeMethods |
|
5065 |
" |
|
5066 |
||
5067 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
5068 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
5069 |
! |
|
5070 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5071 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5072 |
"scan all packages and install all classes found there as |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5073 |
autoloaded. This takes some time ..." |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5074 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5075 |
|dirsConsulted| |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5076 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5077 |
dirsConsulted := Set new. |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5078 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5079 |
self |
14432 | 5080 |
recursiveInstallAutoloadedClassesFrom:aTopDirectory |
5081 |
rememberIn:dirsConsulted |
|
5082 |
maxLevels:15 |
|
5083 |
noAutoload:false |
|
5084 |
packageTop:nil |
|
5085 |
showSplashInLevels:-1. |
|
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5086 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5087 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5088 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5089 |
Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler' |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5090 |
" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5091 |
|
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5092 |
"Created: / 31-07-2012 / 15:27:40 / cg" |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5093 |
! |
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5094 |
|
10641 | 5095 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5096 |
"read all abbrev.stc files from and under aDirectory |
|
5097 |
and install autoloaded classes. |
|
5098 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
5099 |
(however, the directories are searched for packages) |
|
5100 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
5101 |
||
11391 | 5102 |
self |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5103 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5104 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5105 |
showSplashInLevels:0. |
11391 | 5106 |
|
5107 |
" |
|
5108 |
Smalltalk installAutoloadedClasses |
|
5109 |
" |
|
5110 |
||
5111 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
5112 |
! |
|
5113 |
||
12022 | 5114 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 5115 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5116 |
showSplashInLevels:showSplashInLevels |
|
5117 |
"read all abbrev.stc files from and under aDirectory |
|
5118 |
and install autoloaded classes. |
|
5119 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
5120 |
(however, the directories are searched for packages) |
|
5121 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
5122 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5123 |
|dir noAutoloadHere dirName pkgName directoryContents| |
10641 | 5124 |
|
5125 |
maxLevels == 0 ifTrue:[ |
|
5126 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
14432 | 5127 |
^ self |
10641 | 5128 |
]. |
5129 |
||
5130 |
dir := aDirectory asFilename. |
|
11392 | 5131 |
dirName := dir pathName. |
5132 |
||
5133 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
14432 | 5134 |
^ self |
10641 | 5135 |
]. |
11392 | 5136 |
dirsConsulted add:dirName. |
10641 | 5137 |
|
12377 | 5138 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
14432 | 5139 |
^ self. |
10641 | 5140 |
]. |
12377 | 5141 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
14432 | 5142 |
^ self. |
10641 | 5143 |
]. |
11392 | 5144 |
|
10641 | 5145 |
noAutoloadHere := noAutoloadIn. |
5146 |
noAutoloadHere ifFalse:[ |
|
14432 | 5147 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
5148 |
noAutoloadHere := true. |
|
5149 |
]. |
|
10641 | 5150 |
] ifTrue:[ |
14432 | 5151 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
5152 |
noAutoloadHere := false. |
|
5153 |
]. |
|
10641 | 5154 |
]. |
5155 |
||
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5156 |
((dir / 'loadAll') exists or:[(dir / 'abbrev.stc') exists]) ifTrue:[ |
14432 | 5157 |
packageTopPath notNil ifTrue:[ |
5158 |
KnownPackages isNil ifTrue:[ |
|
5159 |
KnownPackages := Set new. |
|
5160 |
]. |
|
5161 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
|
5162 |
KnownPackages add:pkgName |
|
5163 |
]. |
|
10641 | 5164 |
]. |
5165 |
||
11393 | 5166 |
showSplashInLevels >= 0 ifTrue:[ |
14432 | 5167 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
5168 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 5169 |
]. |
5170 |
||
10641 | 5171 |
"/ |
5172 |
"/ suppress installation as autoloaded in this and everything |
|
5173 |
"/ below; however, still traverse the directories to find packages ... |
|
5174 |
"/ |
|
5175 |
noAutoloadHere ifFalse:[ |
|
14432 | 5176 |
[ |
5177 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
5178 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
|
10641 | 5179 |
]. |
5180 |
||
5181 |
[ |
|
14432 | 5182 |
directoryContents := dir directoryContents asSet. "asSet to speed up remove" |
10641 | 5183 |
] on:FileStream openErrorSignal do:[:ex| |
14432 | 5184 |
"non-accessable directory: we are done" |
5185 |
^ self |
|
10641 | 5186 |
]. |
5187 |
||
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5188 |
directoryContents removeAllFoundIn:#( |
14432 | 5189 |
'objbc' |
5190 |
'objvc' |
|
5191 |
'doc' |
|
5192 |
'CVS' |
|
5193 |
'bitmaps' |
|
5194 |
'resources' |
|
5195 |
'source' |
|
5196 |
'not_delivered' |
|
5197 |
'not_ported' |
|
5198 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5199 |
dir baseName = 'stx' ifTrue:[ |
14432 | 5200 |
directoryContents removeAllFoundIn:#( |
5201 |
'configurations' |
|
5202 |
'include' |
|
5203 |
'rules' |
|
5204 |
'stc' |
|
5205 |
'support' |
|
5206 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5207 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5208 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5209 |
directoryContents do:[:eachFilenameString | |
14432 | 5210 |
|f| |
5211 |
||
5212 |
f := dir / eachFilenameString. |
|
5213 |
f isDirectory ifTrue:[ |
|
5214 |
self |
|
5215 |
recursiveInstallAutoloadedClassesFrom:f |
|
5216 |
rememberIn:dirsConsulted |
|
5217 |
maxLevels:maxLevels-1 |
|
5218 |
noAutoload:noAutoloadHere |
|
5219 |
packageTop:packageTopPath |
|
5220 |
showSplashInLevels:showSplashInLevels - 1. |
|
5221 |
] |
|
10641 | 5222 |
]. |
5223 |
||
11393 | 5224 |
showSplashInLevels >= 0 ifTrue:[ |
14432 | 5225 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
5226 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 5227 |
]. |
5228 |
||
10641 | 5229 |
" |
5230 |
Smalltalk installAutoloadedClasses |
|
5231 |
" |
|
5232 |
||
14269
b540d11186f4
added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents:
14210
diff
changeset
|
5233 |
"Modified: / 31-07-2012 / 15:26:54 / cg" |
10641 | 5234 |
! |
5235 |
||
5236 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5237 |
"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
|
5238 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5239 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5240 |
|
10641 | 5241 |
|toAdd| |
5242 |
||
5243 |
toAdd := OrderedCollection new. |
|
5244 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5245 |
(key == anObject) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5246 |
self shouldImplement. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5247 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5248 |
(val == anObject ) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5249 |
toAdd add:(key -> newRef) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5250 |
]. |
10641 | 5251 |
]. |
5252 |
toAdd do:[:each | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5253 |
self at:(each key) put:(each value) |
10641 | 5254 |
]. |
5255 |
! |
|
5256 |
||
5257 |
saveEmergencyImage:aBoolean |
|
5258 |
"set/clear the flag which controls if ST/X should save an |
|
5259 |
emergency image in case of a broken display connection. |
|
5260 |
The default is true. |
|
5261 |
This may be useful, if you work with an unsecure display |
|
5262 |
(serial line), and want to have a chance of proceeding after |
|
5263 |
a crash. In multiheaded applications, this only affects |
|
5264 |
crashes of the master Display connection (the initial connection); |
|
5265 |
errors on other displays are reported to the views and treated |
|
5266 |
like window destroy from the windowManager." |
|
5267 |
||
5268 |
SaveEmergencyImage := aBoolean |
|
5269 |
||
5270 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
5271 |
! |
|
5272 |
||
5273 |
systemOrganization |
|
5274 |
"for partial ST80 compatibility; |
|
5275 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
5276 |
keeps track of class-categories, while all classes return a classOrganizer |
|
5277 |
from #organization, which keeps track of method categories of that class. |
|
5278 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
5279 |
To make a workaround possible, use #systemOrganization when porting |
|
5280 |
VW apps to ST/X to get the class-categories. |
|
5281 |
Read the documentation in SystemOrganizer for more info." |
|
5282 |
||
5283 |
^ SystemOrganizer for:nil |
|
5284 |
||
5285 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
5286 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5287 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5288 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5289 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5290 |
|
10641 | 5291 |
fileIn:aFileName |
5292 |
"read in the named file - look for it in some standard places; |
|
5293 |
return true if ok, false if failed. |
|
5294 |
This method can load almost anything which makes sense: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5295 |
.st - source files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5296 |
.cls - binary smalltalk bytecode files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5297 |
.so - binary compiled machine code class libraries |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5298 |
[.class - java bytecode -- soon to come]" |
10641 | 5299 |
|
5300 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
5301 |
||
5302 |
" |
|
5303 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
5304 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
5305 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
5306 |
" |
|
5307 |
||
5308 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
5309 |
! |
|
5310 |
||
5311 |
fileIn:aFileName inPackage:aPackageID |
|
5312 |
"read in the named file in a packages directory." |
|
5313 |
||
5314 |
|dir| |
|
5315 |
||
5316 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
5317 |
dir isNil ifTrue:[^ false]. |
|
5318 |
||
5319 |
dir := dir asFilename. |
|
5320 |
^ (self fileIn:(dir construct:aFileName)) |
|
5321 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5322 |
! |
|
5323 |
||
5324 |
fileIn:aFileName lazy:lazy |
|
5325 |
"read in the named file - look for it in some standard places; |
|
5326 |
return true if ok, false if failed. |
|
5327 |
If lazy is true, no code is generated for methods, instead stubs |
|
5328 |
are created which compile themself when first executed. This allows |
|
5329 |
for much faster fileIn (but slows down the first execution later). |
|
5330 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5331 |
code which is known to be syntactically correct." |
|
5332 |
||
5333 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
5334 |
||
5335 |
" |
|
5336 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
5337 |
" |
|
5338 |
||
5339 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
5340 |
! |
|
5341 |
||
5342 |
fileIn:aFileName lazy:lazy silent:silent |
|
5343 |
"read in the named file - look for it in some standard places; |
|
5344 |
return true if ok, false if failed. |
|
5345 |
If lazy is true, no code is generated for methods, instead stubs |
|
5346 |
are created which compile themself when first executed. This allows |
|
5347 |
for much faster fileIn (but slows down the first execution later). |
|
5348 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5349 |
code which is known to be syntactically correct. |
|
5350 |
If silent is true, no compiler messages are output to the transcript. |
|
5351 |
Giving nil for silent/lazy will use the current settings." |
|
5352 |
||
5353 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
5354 |
||
5355 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
5356 |
! |
|
5357 |
||
5358 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
5359 |
"read in the named file - look for it in some standard places; |
|
5360 |
return true if ok, false if failed. |
|
5361 |
If lazy is true, no code is generated for methods, instead stubs |
|
5362 |
are created which compile themself when first executed. This allows |
|
5363 |
for much faster fileIn (but slows down the first execution later). |
|
5364 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5365 |
code which is known to be syntactically correct. |
|
5366 |
If silent is true, no compiler messages are output to the transcript. |
|
5367 |
Giving nil for silent/lazy will use the current settings. |
|
5368 |
This method can load almost anything which makes sense: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5369 |
.st - source files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5370 |
.cls - binary smalltalk bytecode files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5371 |
.so - binary compiled machine code class libraries |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5372 |
[.class - java bytecode -- soon to come]" |
10641 | 5373 |
|
5374 |
|fileNameString aStream path morePath bos| |
|
5375 |
||
5376 |
fileNameString := aFileNameOrString asString. |
|
5377 |
||
5378 |
" |
|
5379 |
an object or shared object ? |
|
5380 |
" |
|
5381 |
(ObjectFileLoader notNil |
|
5382 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5383 |
"/ LoadBinaries ifFalse:[^ false]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5384 |
path := self getBinaryFileName:fileNameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5385 |
path isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5386 |
path := self getSystemFileName:fileNameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5387 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5388 |
path isNil ifTrue:[^ false]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5389 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
10641 | 5390 |
]. |
5391 |
||
5392 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5393 |
BinaryObjectStorage notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5394 |
aStream := self systemFileStreamFor:fileNameString. |
10641 | 5395 |
"/ path := self getBinaryFileName:fileNameString. |
5396 |
"/ path isNil ifTrue:[^ false]. |
|
5397 |
"/ aStream := path asFilename readStream. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5398 |
aStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5399 |
aStream binary. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5400 |
bos := BinaryObjectStorage onOld:aStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5401 |
bos next. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5402 |
bos close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5403 |
^ true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5404 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5405 |
^ false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5406 |
] |
10641 | 5407 |
]. |
5408 |
||
5409 |
aStream := self systemFileStreamFor:fileNameString. |
|
5410 |
aStream isNil ifTrue:[^ false]. |
|
5411 |
||
5412 |
(fileNameString includes:$/) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5413 |
"/ temporarily prepend the files directory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5414 |
"/ to the searchPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5415 |
"/ This allows fileIn-driver files to refer to local |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5416 |
"/ files via a relative path, and drivers to fileIn other |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5417 |
"/ drivers ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5418 |
morePath := aStream pathName asFilename directoryName. |
10641 | 5419 |
]. |
5420 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
|
5421 |
||
5422 |
" |
|
5423 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
5424 |
" |
|
5425 |
||
5426 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
5427 |
! |
|
5428 |
||
5429 |
fileIn:aFileName logged:logged |
|
5430 |
"read in the named file - look for it in some standard places; |
|
5431 |
return true if ok, false if failed. |
|
5432 |
The argument logged controls, if the changefile is to be updated." |
|
5433 |
||
5434 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
5435 |
||
5436 |
" |
|
5437 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
5438 |
" |
|
5439 |
! |
|
5440 |
||
5441 |
fileIn:aFileName silent:silent |
|
5442 |
"read in the named file - look for it in some standard places; |
|
5443 |
return true if ok, false if failed. |
|
5444 |
If silent is true, no compiler messages are output to the transcript." |
|
5445 |
||
5446 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
5447 |
||
5448 |
" |
|
5449 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
5450 |
" |
|
5451 |
||
5452 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
5453 |
! |
|
5454 |
||
5455 |
fileInChanges |
|
5456 |
"read in the last changes file - bringing the system to the state it |
|
5457 |
had when left the last time. |
|
5458 |
WARNING: this method is rubbish: it should only read things after the |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5459 |
last '**snapshot**' - entry |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5460 |
(instead of the complete changes file)." |
10641 | 5461 |
|
5462 |
" |
|
5463 |
do NOT update the changes file now ... |
|
5464 |
" |
|
5465 |
self fileIn:ChangeFileName logged:false |
|
5466 |
||
5467 |
" |
|
10071 | 5468 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5469 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5470 |
! |
1 | 5471 |
|
10641 | 5472 |
fileInClass:aClassName |
5473 |
"find a source/object file for aClassName and -if found - load it. |
|
5474 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5475 |
finally source file (.st) in that order. |
|
5476 |
The file is first searched for using the class name, then the abbreviated name." |
|
5477 |
||
5478 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5479 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5480 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5481 |
initialize:true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5482 |
lazy:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5483 |
silent:nil |
10641 | 5484 |
|
5485 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
5486 |
! |
|
5487 |
||
5488 |
fileInClass:aClassName fromObject:aFileName |
|
5489 |
"read in the named object file and dynamic-link it into the system |
|
5490 |
- look for it in some standard places. |
|
5491 |
Only install the named class from this object file. |
|
5492 |
Return true if ok, false if failed." |
|
5493 |
||
5494 |
|path ok| |
|
5495 |
||
5496 |
" |
|
5497 |
check if the dynamic loader class is in |
|
5498 |
" |
|
5499 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
5500 |
||
5501 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
5502 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
5503 |
ok ifTrue:[ |
|
14432 | 5504 |
VerboseLoading ifTrue:[ |
5505 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
5506 |
] |
|
10641 | 5507 |
]. |
5508 |
^ ok |
|
5509 |
||
5510 |
" |
|
5511 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
5512 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
5513 |
" |
|
5514 |
||
13814 | 5515 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 5516 |
! |
5517 |
||
5518 |
fileInClass:aClassName initialize:doInit |
|
5519 |
"find a source/object file for aClassName and -if found - load it. |
|
5520 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5521 |
finally source file (.st) in that order. |
|
5522 |
The file is first searched for using the class name, then the abbreviated name." |
|
5523 |
||
5524 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5525 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5526 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5527 |
initialize:doInit |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5528 |
lazy:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5529 |
silent:nil |
10641 | 5530 |
|
5531 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
5532 |
! |
|
5533 |
||
5534 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
5535 |
"find a source/object file for aClassName and -if found - load it. |
|
5536 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5537 |
finally source file (.st) in that order. |
|
5538 |
The file is first searched for using the class name, then the abbreviated name." |
|
5539 |
||
5540 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5541 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5542 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5543 |
initialize:doInit |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5544 |
lazy:loadLazy |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5545 |
silent:nil |
10641 | 5546 |
|
5547 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
5548 |
! |
|
5549 |
||
5550 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
5551 |
"find a source/object file for aClassName and -if found - load it. |
|
5552 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
5553 |
finally source file (.st), in that order. |
|
5554 |
The file is first searched for using the class name, then the abbreviated name. |
|
5555 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
5556 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
5557 |
should not send notes to the transcript; it can be true, false or nil, where |
|
5558 |
nil uses the value from SilentLoading." |
|
5559 |
||
5560 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5561 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5562 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5563 |
initialize:doInit |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5564 |
lazy:loadLazy |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5565 |
silent:beSilent |
10641 | 5566 |
|
5567 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
5568 |
! |
|
5569 |
||
5570 |
fileInClass:aClassName package:package |
|
5571 |
"find a source/object file for aClassName and -if found - load it. |
|
5572 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5573 |
finally source file (.st) in that order. |
|
5574 |
The file is first searched for using the class name, then the abbreviated name." |
|
5575 |
||
5576 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5577 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5578 |
package:package |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5579 |
initialize:true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5580 |
lazy:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5581 |
silent:nil |
10641 | 5582 |
|
5583 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
5584 |
! |
|
5585 |
||
10999 | 5586 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 5587 |
"find a source/object file for aClassName and -if found - load it. |
5588 |
This is the workhorse for autoloading. |
|
10999 | 5589 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 5590 |
finally source file (.st), in that order. |
5591 |
The file is first searched for using the class name, then the abbreviated name. |
|
5592 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
5593 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
5594 |
should not send notes to the transcript; it can be true, false or nil, where |
|
5595 |
nil uses the value from SilentLoading." |
|
5596 |
||
10999 | 5597 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
10641 | 5598 |
filenameToSet packageDir packageFile bos| |
5599 |
||
5600 |
wasLazy := Compiler compileLazy:loadLazy. |
|
5601 |
beSilent notNil ifTrue:[ |
|
14589 | 5602 |
wasSilent := self silentLoading:beSilent. |
10641 | 5603 |
]. |
5604 |
||
5605 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
5606 |
(classFileName = aClassName) ifTrue:[ |
|
14589 | 5607 |
"/ no abbrev.stc translation for className |
5608 |
(aClassName includes:$:) ifTrue:[ |
|
5609 |
"/ a nameSpace name |
|
5610 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
|
5611 |
]. |
|
10641 | 5612 |
]. |
5613 |
||
5614 |
classFileName asFilename isAbsolute ifTrue:[ |
|
14589 | 5615 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
5616 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
|
5617 |
] ifFalse:[ |
|
5618 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
|
5619 |
] |
|
10641 | 5620 |
] ifFalse:[ |
14589 | 5621 |
classFileName := classFileName copyReplaceAll:$: with:$_. |
5622 |
[ |
|
5623 |
Class withoutUpdatingChangesDo:[ |
|
5624 |
|zarFn zar entry| |
|
5625 |
||
5626 |
ok := false. |
|
5627 |
||
5628 |
package notNil ifTrue:[ |
|
5629 |
packageDir := package asPackageId projectDirectory. |
|
5630 |
"/ packageDir := package asString. |
|
5631 |
"/ packageDir := packageDir copyReplaceAll:$: with:$/. |
|
14620 | 5632 |
packageDir isNil ifTrue:[ |
5633 |
packageDir := self packageDirectoryForPackageId:package |
|
5634 |
]. |
|
14589 | 5635 |
]. |
5636 |
||
5637 |
Class packageQuerySignal answer:package do:[ |
|
5638 |
" |
|
5639 |
then, if dynamic linking is available, |
|
5640 |
" |
|
5641 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
|
5642 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
|
5643 |
" |
|
5644 |
first look for a class packages shared binary in binary/xxx.o |
|
5645 |
" |
|
5646 |
libName := self libraryFileNameOfClass:aClassName. |
|
5647 |
libName notNil ifTrue:[ |
|
5648 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
|
5649 |
ifFalse:[ |
|
5650 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
5651 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
|
5652 |
] |
|
5653 |
]. |
|
5654 |
]. |
|
5655 |
" |
|
5656 |
then, look for a shared binary in binary/xxx.o |
|
5657 |
" |
|
5658 |
ok ifFalse:[ |
|
5659 |
(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) |
|
5660 |
ifFalse:[ |
|
5661 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
5662 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
|
5663 |
]. |
|
5664 |
ok ifFalse:[ |
|
5665 |
alternativeClassFileName notNil ifTrue:[ |
|
5666 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
|
5667 |
ifFalse:[ |
|
5668 |
sharedLibExtension ~= '.o' ifTrue:[ |
|
5669 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
|
5670 |
] |
|
5671 |
] |
|
5672 |
]. |
|
5673 |
]. |
|
5674 |
]. |
|
5675 |
]. |
|
5676 |
]. |
|
5677 |
||
5678 |
" |
|
5679 |
if that did not work, look for a compiled-bytecode file ... |
|
5680 |
" |
|
5681 |
ok ifFalse:[ |
|
5682 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
|
5683 |
ifFalse:[ |
|
5684 |
alternativeClassFileName notNil ifTrue:[ |
|
5685 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
|
5686 |
] |
|
5687 |
] |
|
5688 |
]. |
|
5689 |
" |
|
5690 |
if that did not work, and the classes package is known, |
|
5691 |
look for an st-cls file |
|
5692 |
in a package subdir of the source-directory ... |
|
5693 |
" |
|
5694 |
ok ifFalse:[ |
|
5695 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
|
5696 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , classFileName , '.cls'). |
|
5697 |
packageFile isNil ifTrue:[ |
|
5698 |
packageFile := (packageDir , '/classes/' , classFileName , '.cls'). |
|
5699 |
]. |
|
5700 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
|
5701 |
ifFalse:[ |
|
5702 |
alternativeClassFileName notNil ifTrue:[ |
|
5703 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
|
5704 |
packageFile isNil ifTrue:[ |
|
5705 |
packageFile := (packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
|
5706 |
]. |
|
5707 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
|
5708 |
] |
|
5709 |
]. |
|
5710 |
||
5711 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
|
5712 |
zarFn notNil ifTrue:[ |
|
5713 |
zar := ZipArchive oldFileNamed:zarFn. |
|
5714 |
zar notNil ifTrue:[ |
|
5715 |
entry := zar extract:(classFileName , '.cls'). |
|
5716 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
5717 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
|
5718 |
]. |
|
5719 |
entry notNil ifTrue:[ |
|
5720 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
|
5721 |
bos next. |
|
5722 |
bos close. |
|
5723 |
ok := true |
|
5724 |
]. |
|
5725 |
] |
|
5726 |
] |
|
5727 |
] |
|
5728 |
]. |
|
5729 |
||
5730 |
" |
|
5731 |
if that did not work, look for an st-source file ... |
|
5732 |
" |
|
5733 |
ok ifFalse:[ |
|
5734 |
filenameToSet := classFileName. |
|
5735 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
5736 |
ifFalse:[ |
|
5737 |
alternativeClassFileName notNil ifTrue:[ |
|
5738 |
filenameToSet := alternativeClassFileName. |
|
5739 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
5740 |
]. |
|
5741 |
ok ifFalse:[ |
|
5742 |
" |
|
5743 |
... and in the standard source-directory |
|
5744 |
" |
|
5745 |
filenameToSet := 'source/' , classFileName. |
|
5746 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
5747 |
ifFalse:[ |
|
5748 |
alternativeClassFileName notNil ifTrue:[ |
|
5749 |
filenameToSet := 'source/' , alternativeClassFileName. |
|
5750 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
5751 |
] |
|
5752 |
] |
|
5753 |
] |
|
5754 |
]. |
|
5755 |
" |
|
5756 |
if that did not work, and the classes package is known, |
|
5757 |
look for an st-source file |
|
5758 |
in a package subdir of the source-directory ... |
|
5759 |
" |
|
5760 |
ok ifFalse:[ |
|
5761 |
packageDir notNil ifTrue:[ |
|
5762 |
packageFile := self getPackageSourceFileName:(packageDir , '/source/' , classFileName). |
|
5763 |
packageFile isNil ifTrue:[ |
|
5764 |
packageFile := (packageDir , '/source/' , classFileName). |
|
5765 |
]. |
|
5766 |
filenameToSet := packageFile. |
|
5767 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
5768 |
ifFalse:[ |
|
5769 |
alternativeClassFileName notNil ifTrue:[ |
|
5770 |
packageFile := self getPackageSourceFileName:(packageDir , '/source/' , alternativeClassFileName). |
|
5771 |
packageFile isNil ifTrue:[ |
|
5772 |
packageFile := (packageDir , '/source/' , alternativeClassFileName). |
|
5773 |
]. |
|
5774 |
filenameToSet := packageFile. |
|
5775 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
5776 |
]. |
|
5777 |
ok ifFalse:[ |
|
5778 |
packageFile := self getPackageSourceFileName:(packageDir , '/' , classFileName). |
|
5779 |
packageFile isNil ifTrue:[ |
|
5780 |
packageFile := (packageDir , '/' , classFileName). |
|
5781 |
]. |
|
5782 |
filenameToSet := packageFile. |
|
5783 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
|
5784 |
ifFalse:[ |
|
5785 |
alternativeClassFileName notNil ifTrue:[ |
|
5786 |
packageFile := self getPackageFileName:(packageDir , '/' , alternativeClassFileName). |
|
5787 |
packageFile isNil ifTrue:[ |
|
5788 |
packageFile := (packageDir , '/' , alternativeClassFileName). |
|
5789 |
]. |
|
5790 |
filenameToSet := packageFile. |
|
5791 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
|
5792 |
]. |
|
5793 |
ok ifFalse:[ |
|
5794 |
" |
|
5795 |
... and in the standard source-directory |
|
5796 |
" |
|
5797 |
filenameToSet := 'source/' , packageDir , '/' , classFileName. |
|
5798 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
5799 |
ifFalse:[ |
|
5800 |
alternativeClassFileName notNil ifTrue:[ |
|
5801 |
filenameToSet := 'source/' , packageDir , '/' , alternativeClassFileName. |
|
5802 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
5803 |
] |
|
5804 |
] |
|
5805 |
] |
|
5806 |
]. |
|
5807 |
]. |
|
5808 |
]. |
|
5809 |
] |
|
5810 |
]. |
|
5811 |
" |
|
5812 |
if that did not work, and the classes package is known, |
|
5813 |
look for a zipArchive containing a class entry. |
|
5814 |
" |
|
5815 |
ok ifFalse:[ |
|
5816 |
packageDir notNil ifTrue:[ |
|
5817 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
|
5818 |
zarFn isNil ifTrue:[ |
|
5819 |
zarFn := packageDir asFilename withSuffix:'zip'. |
|
5820 |
zarFn := self getSourceFileName:zarFn. |
|
5821 |
]. |
|
14810 | 5822 |
(zarFn notNil and:[zarFn asFilename exists]) ifTrue:[ |
14589 | 5823 |
zar := ZipArchive oldFileNamed:zarFn. |
5824 |
zar notNil ifTrue:[ |
|
5825 |
entry := zar extract:(classFileName , '.st'). |
|
5826 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
5827 |
entry := zar extract:(alternativeClassFileName , '.st'). |
|
5828 |
]. |
|
5829 |
entry notNil ifTrue:[ |
|
5830 |
filenameToSet := zarFn. |
|
5831 |
ok := self |
|
5832 |
fileInStream:(entry asString readStream) |
|
5833 |
lazy:loadLazy |
|
5834 |
silent:beSilent |
|
5835 |
logged:false |
|
5836 |
addPath:nil |
|
5837 |
]. |
|
5838 |
] |
|
5839 |
] |
|
5840 |
] |
|
5841 |
]. |
|
5842 |
||
5843 |
" |
|
5844 |
if that did not work, |
|
5845 |
look for a zipArchive containing a class entry. |
|
5846 |
" |
|
5847 |
ok ifFalse:[ |
|
5848 |
zarFn := self getSourceFileName:'source.zip'. |
|
5849 |
zarFn notNil ifTrue:[ |
|
5850 |
zar := ZipArchive oldFileNamed:zarFn. |
|
5851 |
zar notNil ifTrue:[ |
|
5852 |
entry := zar extract:(zarFn := classFileName , '.st'). |
|
5853 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
|
5854 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
|
5855 |
]. |
|
5856 |
entry notNil ifTrue:[ |
|
5857 |
filenameToSet := zarFn. |
|
5858 |
ok := self |
|
5859 |
fileInStream:(entry asString readStream) |
|
5860 |
lazy:loadLazy |
|
5861 |
silent:beSilent |
|
5862 |
logged:false |
|
5863 |
addPath:nil |
|
5864 |
]. |
|
5865 |
] |
|
5866 |
] |
|
5867 |
]. |
|
5868 |
ok ifFalse:[ |
|
5869 |
" |
|
5870 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
|
5871 |
" |
|
5872 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
|
14620 | 5873 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package. |
14589 | 5874 |
inStream notNil ifTrue:[ |
5875 |
filenameToSet := nil. |
|
5876 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
|
5877 |
] |
|
5878 |
]. |
|
5879 |
]. |
|
5880 |
]. |
|
5881 |
] |
|
5882 |
]. |
|
5883 |
] ensure:[ |
|
5884 |
Compiler compileLazy:wasLazy. |
|
5885 |
wasSilent notNil ifTrue:[ |
|
5886 |
self silentLoading:wasSilent |
|
5887 |
] |
|
5888 |
]. |
|
10641 | 5889 |
]. |
5890 |
||
5891 |
ok ifTrue:[ |
|
14589 | 5892 |
newClass := self at:(aClassName asSymbol). |
5893 |
newClass notNil ifTrue:[ |
|
5894 |
"set the classes name - but do not change if already set" |
|
5895 |
filenameToSet notNil ifTrue:[ |
|
5896 |
newClass getClassFilename isNil ifTrue:[ |
|
5897 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
|
5898 |
]. |
|
5899 |
]. |
|
5900 |
||
5901 |
doInit ifTrue:[ |
|
5902 |
newClass initialize |
|
5903 |
] |
|
5904 |
] |
|
10641 | 5905 |
]. |
5906 |
||
5907 |
^ newClass |
|
5908 |
||
13415 | 5909 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
5910 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
5911 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 5912 |
! |
5913 |
||
5914 |
fileInClassLibrary:aClassLibraryName |
|
5915 |
"find an object file containing a binary class library in some standard places |
|
5916 |
and load it. This install all of its contained classes. |
|
5917 |
Return true if ok, false if not. |
|
5918 |
Notice: the argument may not have an extension (by purpose); |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5919 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5920 |
make the caller independent of the underlying operatingSystem." |
10641 | 5921 |
|
5922 |
|path fn| |
|
5923 |
||
5924 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
5925 |
||
5926 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
5927 |
fn := fn pathName. |
|
5928 |
||
5929 |
path := self getBinaryFileName:fn. |
|
5930 |
path isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5931 |
path := self getSystemFileName:fn. |
10641 | 5932 |
]. |
5933 |
path isNil ifTrue:[^ false]. |
|
5934 |
||
5935 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
5936 |
||
5937 |
" |
|
5938 |
Smalltalk fileInClassLibrary:'libtable' |
|
5939 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
5940 |
" |
|
5941 |
||
5942 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
5943 |
! |
|
5944 |
||
5945 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
5946 |
"find an object file containing a binary class library in some standard places |
|
5947 |
and load it. This installs all of its contained classes. |
|
5948 |
Return true if ok, false if not. |
|
5949 |
Notice: the argument may not have an extension (by purpose); |
|
14432 | 5950 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
5951 |
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
|
5952 |
|
11690 | 5953 |
|baseName handle libraryFilename packagePath| |
10641 | 5954 |
|
5955 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
5956 |
||
5957 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
5958 |
baseName exists ifTrue:[ |
|
14432 | 5959 |
"/ load local file first... |
5960 |
handle := ObjectFileLoader loadObjectFile:baseName. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5961 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5962 |
handle isNil ifTrue:[ |
14432 | 5963 |
packagePath := self getPackageDirectoryForPackage:packageID. |
5964 |
packagePath isNil ifTrue:[^ false]. |
|
5965 |
packagePath := packagePath asFilename. |
|
5966 |
libraryFilename := packagePath / baseName. |
|
5967 |
libraryFilename exists ifFalse:[ |
|
5968 |
libraryFilename := nil. |
|
5969 |
#('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir | |
|
5970 |
"in windows, with Borland compiler, DLLs in development environment are under objbc; |
|
5971 |
with MSVC, they are under objvc" |
|
5972 |
libraryFilename isNil ifTrue:[ |
|
5973 |
libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName. |
|
5974 |
libraryFilename exists ifFalse:[ libraryFilename := nil ] |
|
5975 |
]. |
|
5976 |
]. |
|
5977 |
]. |
|
5978 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
|
5979 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
|
5980 |
]. |
|
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5981 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5982 |
|
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5983 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5984 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5985 |
"/ ]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5986 |
^ handle notNil |
10641 | 5987 |
|
5988 |
" |
|
5989 |
Smalltalk fileInClassLibrary:'libtable' |
|
5990 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
5991 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
5992 |
" |
|
5993 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
5994 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
10641 | 5995 |
! |
5996 |
||
13415 | 5997 |
fileInSourceFile:filename lazy:loadLazy silent:beSilent |
5998 |
||
5999 |
"Try all available programming languages" |
|
6000 |
||
6001 |
ProgrammingLanguage allDo: |
|
13771 | 6002 |
[:lang| | f | |
6003 |
f := (filename endsWith: ('.' , lang sourceFileSuffix)) |
|
6004 |
ifTrue:[filename] |
|
6005 |
ifFalse:[filename , '.' , lang sourceFileSuffix]. |
|
6006 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
6007 |
ifTrue:[^true]]. |
|
13415 | 6008 |
^false |
6009 |
||
6010 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
6011 |
! |
|
6012 |
||
10641 | 6013 |
fileInStream:streamArg |
6014 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
6015 |
! |
|
6016 |
||
6017 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
6018 |
"read sourceCode from aStream; |
|
6019 |
return true if ok, false if failed. |
|
6020 |
If lazy is true, no code is generated for methods, instead stubs |
|
6021 |
are created which compile themself when first executed. This allows |
|
6022 |
for much faster fileIn (but slows down the first execution later). |
|
6023 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
6024 |
code which is known to be syntactically correct. |
|
6025 |
If silent is true, no compiler messages are output to the transcript. |
|
6026 |
Giving nil for silent/lazy will use the current settings. |
|
6027 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
6028 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
6029 |
using a relative path." |
|
6030 |
||
11427 | 6031 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 6032 |
|
6033 |
inStream := streamArg. |
|
6034 |
inStream isNil ifTrue:[^ false]. |
|
12611
38d61d374d89
care for nonPositionable stream (stdin) in fileIn
Claus Gittinger <cg@exept.de>
parents:
12557
diff
changeset
|
6035 |
inStream := EncodedStream isNil |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6036 |
ifTrue:[ inStream ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6037 |
ifFalse:[ EncodedStream decodedStreamFor:inStream ]. |
10641 | 6038 |
|
6039 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
6040 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
6041 |
morePath notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6042 |
oldSystemPath := SystemPath copy. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6043 |
SystemPath addFirst:morePath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6044 |
oldRealPath := RealSystemPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6045 |
RealSystemPath := nil. |
10641 | 6046 |
]. |
6047 |
[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6048 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
13771 | 6049 |
"JV: Changed to give ProgrammingLanguage to choose |
6050 |
proper reader" |
|
6051 |
(ProgrammingLanguage forStream: inStream) |
|
6052 |
fileInStream: inStream |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6053 |
] |
10641 | 6054 |
] ensure:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6055 |
morePath notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6056 |
"take care, someone could have changed SystemPath during fileIn!!" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6057 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6058 |
SystemPath := oldSystemPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6059 |
RealSystemPath := oldRealPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6060 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6061 |
(oldSystemPath includes:morePath) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6062 |
SystemPath remove:morePath ifAbsent:[]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6063 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6064 |
RealSystemPath := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6065 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6066 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6067 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6068 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6069 |
inStream close |
10641 | 6070 |
]. |
6071 |
^ true |
|
6072 |
||
6073 |
" |
|
6074 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
6075 |
" |
|
6076 |
||
13415 | 6077 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
6078 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 6079 |
! |
6080 |
||
6081 |
isClassLibraryLoaded:name |
|
6082 |
"return true, if a particular class library is already loaded" |
|
6083 |
||
6084 |
ObjectMemory |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6085 |
binaryModuleInfo |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6086 |
do:[:entry | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6087 |
entry type == #classLibrary ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6088 |
entry libraryName = name ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6089 |
^ true "/ already loaded |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6090 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6091 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6092 |
]. |
10641 | 6093 |
|
6094 |
^ false |
|
6095 |
||
6096 |
" |
|
6097 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
6098 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
6099 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
6100 |
" |
|
6101 |
||
6102 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
6103 |
! |
|
6104 |
||
6105 |
loadClassLibraryIfAbsent:name |
|
6106 |
"dynamically load a classLibrary, if not already loaded |
|
6107 |
and the system supports dynamic loading. |
|
6108 |
Return true, if the library is loaded, false if not. |
|
6109 |
This entry is called without system specific filename |
|
6110 |
extensions - it is portable among different architectures |
|
6111 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
6112 |
are be present ..." |
|
6113 |
||
6114 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
6115 |
^ self fileInClassLibrary:name |
|
6116 |
||
6117 |
" |
|
6118 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
6119 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
6120 |
" |
|
6121 |
||
6122 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
6123 |
! |
|
6124 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6125 |
secureFileIn:aFileName |
10641 | 6126 |
"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
|
6127 |
Catch various errors during fileIn. |
13000 | 6128 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6129 |
|
10641 | 6130 |
|retVal| |
6131 |
||
6132 |
retVal := false. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6133 |
(SignalSet |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6134 |
with:AbortOperationRequest |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6135 |
with:TerminateProcessRequest |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6136 |
with:Parser parseErrorSignal) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6137 |
handle:[:ex | ex return ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6138 |
do:[ retVal := self fileIn:aFileName ]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6139 |
^ retVal |
10641 | 6140 |
! |
6141 |
||
6142 |
silentFileIn:aFilename |
|
6143 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
6144 |
Main use is during startup." |
|
6145 |
||
13353 | 6146 |
self silentlyLoadingDo:[ |
13370 | 6147 |
self fileIn:aFilename |
13353 | 6148 |
]. |
3044 | 6149 |
! ! |
6150 |
||
6151 |
!Smalltalk class methodsFor:'system management-files'! |
|
6152 |
||
10641 | 6153 |
bitmapFileStreamFor:aFileName |
6154 |
"search aFileName in some standard places; |
|
6155 |
return a readonly fileStream or nil if not found. |
|
6156 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
6157 |
Notice: this does not look in the package-specific bitmaps directories." |
|
6158 |
||
6159 |
|aString| |
|
6160 |
||
6161 |
aString := self getBitmapFileName:aFileName. |
|
6162 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6163 |
^ aString asFilename readStreamOrNil |
10641 | 6164 |
]. |
6165 |
^ nil |
|
6166 |
! |
|
6167 |
||
6168 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
6169 |
"backward compatibility: |
|
6170 |
search aFileName in some standard places: |
|
6171 |
first in the redefinable bitmaps path, |
|
6172 |
then in the classes own package directory if existing. |
|
6173 |
Return an image or nil." |
|
6174 |
||
6175 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
6176 |
||
6177 |
" |
|
6178 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
6179 |
" |
|
6180 |
! |
|
6181 |
||
6182 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
6183 |
"backward compatibility: |
|
6184 |
search aFileName in some standard places: |
|
6185 |
first in the redefinable bitmaps path, |
|
6186 |
then in the package directory if existing. |
|
6187 |
Return an image or nil." |
|
6188 |
||
6189 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
6190 |
||
6191 |
" |
|
6192 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6193 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6194 |
" |
|
6195 |
! |
|
6196 |
||
6197 |
classNameForFile:aFileName |
|
6198 |
"return the className which corresponds to an abbreviated fileName, |
|
6199 |
or nil if no special translation applies. The given filename arg may |
|
6200 |
include a '.st' suffix (but no other)." |
|
6201 |
||
6202 |
|fn| |
|
6203 |
||
6204 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6205 |
fn := aFileName copyWithoutLast:3 |
10641 | 6206 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6207 |
fn := aFileName |
10641 | 6208 |
]. |
6209 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
6210 |
||
6211 |
" |
|
6212 |
Smalltalk classNameForFile:'DrawObj' |
|
6213 |
Smalltalk classNameForFile:'DrawObj.st' |
|
6214 |
Smalltalk classNameForFile:'ArrColl.st' |
|
6215 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
6216 |
" |
|
6217 |
||
6218 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
6219 |
! |
|
6220 |
||
6221 |
constructPathFor:aDirectoryName |
|
6222 |
"search for aDirectory in SystemPath; |
|
6223 |
return a collection of pathes which include that directory." |
|
6224 |
||
6225 |
^ self realSystemPath select:[:dirName | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6226 |
|fullPath| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6227 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6228 |
fullPath := dirName asFilename construct:aDirectoryName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6229 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6230 |
fullPath isDirectory and:[fullPath isReadable] |
10641 | 6231 |
]. |
6232 |
! |
|
6233 |
||
6234 |
fileInFileStreamFor:aFileName |
|
6235 |
"obsolete |
|
6236 |
search aFileName in some standard places; |
|
6237 |
return a readonly fileStream or nil if not found. |
|
6238 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
6239 |
||
6240 |
|aString| |
|
6241 |
||
6242 |
aString := self getFileInFileName:aFileName. |
|
6243 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6244 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6245 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6246 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6247 |
! |
7758 | 6248 |
|
12022 | 6249 |
fileNameForClass:aClassOrClassName |
6250 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
6251 |
- only the base name (without directory part) and without suffix." |
|
6252 |
||
6253 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix| |
|
6254 |
||
12301 | 6255 |
"/ This was added as an extension of libsvn - should be no longer needed |
6256 |
"/ compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6257 |
"/ (compatQuery notNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6258 |
"/ and:[compatQuery isLoaded |
12301 | 6259 |
"/ and:[compatQuery query not]]) ifTrue:[ |
6260 |
"/ nm := aClassOrClassName isBehavior |
|
6261 |
"/ ifTrue:[aClassOrClassName name] |
|
6262 |
"/ ifFalse:[aClassOrClassName]. |
|
6263 |
"/ nm := nm copyReplaceAll:$: with:$_. |
|
6264 |
"/ ^nm |
|
6265 |
"/ ]. |
|
6266 |
||
12022 | 6267 |
aClassOrClassName isBehavior ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6268 |
cls := aClassOrClassName. |
12022 | 6269 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6270 |
cls := Smalltalk classNamed:aClassOrClassName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6271 |
cls isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6272 |
nameWithPrefix := aClassOrClassName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6273 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6274 |
]. |
12022 | 6275 |
]. |
6276 |
||
6277 |
cls notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6278 |
nonMetaclass := cls theNonMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6279 |
nm := nonMetaclass getClassFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6280 |
nm isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6281 |
cls revisionInfo notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6282 |
nm := cls revisionInfo fileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6283 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6284 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6285 |
nm notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6286 |
^ nm asFilename withoutSuffix baseName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6287 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6288 |
nameWithPrefix := nonMetaclass name. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6289 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
12022 | 6290 |
]. |
6291 |
||
6292 |
CachedAbbreviations notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6293 |
nameWithPrefix := nameWithPrefix asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6294 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6295 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6296 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6297 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6298 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6299 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6300 |
]. |
12022 | 6301 |
]. |
6302 |
||
6303 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
6304 |
||
6305 |
" |
|
6306 |
Smalltalk fileNameForClass:#Complex |
|
6307 |
Smalltalk fileNameForClass:'SmallInteger' |
|
6308 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
6309 |
Smalltalk fileNameForClass:'Launcher' |
|
6310 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
6311 |
||
6312 |
Smalltalk fileNameForClass:HTML::Encoder |
|
6313 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
6314 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
6315 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
6316 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
6317 |
" |
|
6318 |
||
6319 |
"Modified: / 06-10-2006 / 16:16:01 / cg" |
|
6320 |
! |
|
6321 |
||
10641 | 6322 |
filenameAbbreviations |
6323 |
"return a dictionary containing the classname-to-filename |
|
6324 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
6325 |
to 14 chars)" |
|
6326 |
||
6327 |
CachedAbbreviations isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6328 |
self readAbbreviations |
10641 | 6329 |
]. |
6330 |
^ CachedAbbreviations |
|
6331 |
||
6332 |
"flush with: |
|
6333 |
||
6334 |
CachedAbbreviations := nil |
|
6335 |
" |
|
6336 |
" |
|
6337 |
Smalltalk filenameAbbreviations |
|
6338 |
" |
|
6339 |
! |
|
6340 |
||
13368 | 6341 |
findPackageDirectoryForPackage:aPackage |
6342 |
"find a packages directory along a number of standard places" |
|
6343 |
||
6344 |
|relDir| |
|
6345 |
||
6346 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
6347 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
6348 |
||
6349 |
^ Smalltalk getPackageFileName:relDir. |
|
6350 |
||
6351 |
" |
|
6352 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
6353 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
6354 |
" |
|
6355 |
! |
|
6356 |
||
10641 | 6357 |
flushPathCaches |
6358 |
"{ Pragma: +optSpace }" |
|
6359 |
||
6360 |
"forget pathCaches - these are collections containing valid directory names, |
|
6361 |
where system files (resource, bitmaps etc.) are found. |
|
6362 |
A flush is only required, if a new system directory has been created while |
|
6363 |
the system is active, and those files should override the others |
|
6364 |
(for example, if you created a private resource directory)" |
|
6365 |
||
6366 |
RealSystemPath := ResourcePath := SourcePath := |
|
6367 |
BinaryPath := FileInPath := nil |
|
6368 |
||
6369 |
" |
|
6370 |
Smalltalk flushPathCaches |
|
6371 |
" |
|
6372 |
! |
|
6373 |
||
6374 |
getBinaryFileName:aFileName |
|
6375 |
"obsolete |
|
6376 |
search aFileName in some standard places |
|
6377 |
(subdirectories named 'binary' in SystemPath); |
|
6378 |
return the absolute filename or nil if none is found." |
|
6379 |
||
6380 |
BinaryPath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6381 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 6382 |
]. |
6383 |
||
6384 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
6385 |
||
6386 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
6387 |
! |
|
6388 |
||
6389 |
getBitmapFileName:aFileName |
|
6390 |
"for backward compatibility: |
|
6391 |
search aFileName in some standard places |
|
6392 |
(subdirectories named 'bitmaps' in SystemPath); |
|
6393 |
Return the pathName or nil if none is found." |
|
6394 |
||
6395 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
6396 |
||
6397 |
" |
|
6398 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
6399 |
" |
|
6400 |
||
6401 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
6402 |
! |
|
6403 |
||
6404 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
6405 |
"for backward compatibility. |
|
6406 |
search aFileName in some standard places: |
|
6407 |
first in the redefinable bitmaps path, |
|
6408 |
then in the package directory if existing. |
|
6409 |
Return a path or nil. |
|
6410 |
Search order is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6411 |
bitmaps/<pkg>/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6412 |
resources/<pkg>/bitmaps/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6413 |
<pkg>/bitmaps/file |
10641 | 6414 |
" |
6415 |
||
6416 |
|f dir packageDir pF| |
|
6417 |
||
6418 |
((f := aFileName asString) startsWith:'bitmaps/') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6419 |
f := f copyFrom:('bitmaps/' size + 1). |
10641 | 6420 |
]. |
6421 |
||
6422 |
aPackageIDOrNil isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6423 |
"/ this will be an error in the future |
10641 | 6424 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
6425 |
"/ self halt. |
|
6426 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6427 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6428 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6429 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6430 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6431 |
f ~= aFileName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6432 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6433 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6434 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6435 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6436 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6437 |
^ nil |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6438 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6439 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6440 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6441 |
dir notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6442 |
pF := dir asFilename / f. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6443 |
pF exists ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6444 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6445 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6446 |
pF := dir asFilename / 'bitmaps' /f. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6447 |
pF exists ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6448 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6449 |
]. |
10641 | 6450 |
]. |
6451 |
||
6452 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
6453 |
||
6454 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
6455 |
pF notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6456 |
^ pF. |
10641 | 6457 |
]. |
6458 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
6459 |
pF notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6460 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6461 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6462 |
|
10641 | 6463 |
^ nil |
6464 |
||
6465 |
" |
|
6466 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6467 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6468 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
6469 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
6470 |
" |
|
6471 |
||
6472 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
6473 |
! |
|
6474 |
||
6475 |
getFileInFileName:aFileName |
|
6476 |
"obsolete |
|
6477 |
search aFileName in some standard places |
|
6478 |
(subdirectories named 'fileIn' in SystemPath); |
|
6479 |
return the absolute filename or nil if none is found." |
|
6480 |
||
6481 |
FileInPath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6482 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 6483 |
]. |
6484 |
||
6485 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
6486 |
||
6487 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
6488 |
! |
|
6489 |
||
6490 |
getPackageDirectoryForPackage:aPackageID |
|
6491 |
"search for a particular package; return its directory, or nil. |
|
6492 |
Stand alone applications might get nil, if there are only binaries installed." |
|
6493 |
||
6494 |
|checkForPackageDirectory module packageSubDirectory| |
|
6495 |
||
6496 |
module := aPackageID asPackageId module. |
|
6497 |
packageSubDirectory := aPackageID asPackageId directory. |
|
6498 |
||
6499 |
checkForPackageDirectory := |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6500 |
[:moduleDir | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6501 |
|packageDir| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6502 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6503 |
moduleDir isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6504 |
packageDir := moduleDir / packageSubDirectory. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6505 |
packageDir isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6506 |
^ packageDir |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6507 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6508 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6509 |
]. |
10641 | 6510 |
|
6511 |
self packagePath do:[:aPath | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6512 |
|moduleDir| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6513 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6514 |
moduleDir := aPath asFilename / module. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6515 |
checkForPackageDirectory value:moduleDir. |
10641 | 6516 |
]. |
6517 |
||
6518 |
^ nil |
|
6519 |
||
6520 |
" |
|
6521 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
6522 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
6523 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
6524 |
" |
|
6525 |
||
6526 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
6527 |
! |
|
6528 |
||
6529 |
getPackageFileName:aFileName |
|
6530 |
"search aFileName in some standard places |
|
6531 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
6532 |
return the absolute filename or nil if none is found." |
|
6533 |
||
6534 |
|f| |
|
6535 |
||
6536 |
"/ search along packagePath ... |
|
6537 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
6538 |
f isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6539 |
"/ search under packages-directory along systemPath ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6540 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6541 |
"/ kludge - allow for stx-directory to be named differently |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6542 |
f isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6543 |
(aFileName startsWith:('stx' , Filename separator)) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6544 |
f := '../..' asFilename / (aFileName copyFrom:5). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6545 |
f exists ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6546 |
^ f pathName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6547 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6548 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6549 |
]. |
10641 | 6550 |
]. |
6551 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6552 |
^ f pathName |
7758 | 6553 |
]. |
6554 |
^ nil |
|
10641 | 6555 |
|
6556 |
" |
|
6557 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
|
6558 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
|
6559 |
" |
|
6560 |
! |
|
6561 |
||
13415 | 6562 |
getPackageSourceFileName:filenameWithoutSuffix |
6563 |
"search aFileName in some standard places and try all available languages" |
|
6564 |
||
6565 |
ProgrammingLanguage allDo: |
|
13771 | 6566 |
[:lang| | file | |
6567 |
file := self getPackageFileName: filenameWithoutSuffix , '.' , lang sourceFileSuffix. |
|
6568 |
file ifNotNil:[^file]]. |
|
13415 | 6569 |
^nil |
6570 |
||
6571 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
6572 |
! |
|
6573 |
||
10641 | 6574 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6575 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6576 |
|
10641 | 6577 |
"search aFileName in some standard places |
6578 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6579 |
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
|
6580 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6581 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6582 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 6583 |
^ self getResourceFileName:aFileName forPackage:nil |
6584 |
||
6585 |
" |
|
6586 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
6587 |
" |
|
6588 |
||
6589 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
6590 |
! |
|
6591 |
||
6592 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
6593 |
"search aFileName in some standard places |
|
6594 |
(subdirectories named 'resource' in SystemPath); |
|
6595 |
and in aClasses package directory. |
|
6596 |
Return the absolute filename or nil if none is found." |
|
6597 |
||
6598 |
|pkgOrNil| |
|
6599 |
||
6600 |
aClassOrNil notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6601 |
pkgOrNil := aClassOrNil package. |
10641 | 6602 |
]. |
6603 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
6604 |
||
6605 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6606 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 6607 |
" |
6608 |
! |
|
6609 |
||
6610 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
6611 |
"search aFileName in some standard places |
|
6612 |
(subdirectories named 'resource' in SystemPath); |
|
6613 |
and in a packages directory. |
|
6614 |
Return the absolute filename or nil if none is found. |
|
6615 |
Search order is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6616 |
resources/<pkg>/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6617 |
<pkg>/resources/file |
10641 | 6618 |
" |
6619 |
||
6620 |
|pF f dir packageDir| |
|
6621 |
||
6622 |
((f := aFileName asString) startsWith:'resources/') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6623 |
f := aFileName copyFrom:('resources/' size + 1). |
10641 | 6624 |
]. |
6625 |
||
6626 |
aPackageIDOrNil isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6627 |
"/ this will be an error in the future |
10641 | 6628 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
6629 |
"/ self halt. |
|
6630 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6631 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6632 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6633 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6634 |
]. |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6635 |
"/ 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
|
6636 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6637 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6638 |
"/ ]. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6639 |
f ~= aFileName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6640 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6641 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6642 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6643 |
]. |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6644 |
"/ 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
|
6645 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6646 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6647 |
"/ ]. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6648 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6649 |
^ nil |
10641 | 6650 |
]. |
6651 |
||
6652 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
6653 |
||
6654 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
|
6655 |
pF notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6656 |
^ pF. |
10641 | 6657 |
]. |
6658 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6659 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 6660 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
6661 |
dir notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6662 |
dir := dir asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6663 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6664 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6665 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 6666 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6667 |
"resolve something like: 'ASN/definition.asn1'" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6668 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
12377 | 6669 |
]. |
6670 |
||
10641 | 6671 |
^ nil |
6672 |
||
6673 |
" |
|
6674 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
6675 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6676 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6677 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 6678 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
6679 |
" |
|
6680 |
||
6681 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
6682 |
! |
|
6683 |
||
6684 |
getSourceFileName:aFileName |
|
6685 |
"search aFileName in some standard places |
|
6686 |
(subdirectories named 'source' in SystemPath); |
|
6687 |
return the absolute filename or nil if none is found. |
|
6688 |
This is used to find a sourceFile for a methods source, |
|
6689 |
if no sourceCodeManager is available." |
|
6690 |
||
6691 |
|f| |
|
6692 |
||
6693 |
SourcePath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6694 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 6695 |
]. |
6696 |
||
6697 |
"/ first, try a source subdir along the path. |
|
6698 |
SourcePath notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6699 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 6700 |
]. |
6701 |
f isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6702 |
"/ then, try it itself along the path. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6703 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
10641 | 6704 |
]. |
6705 |
^ f |
|
6706 |
||
6707 |
" |
|
6708 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
6709 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
6710 |
" |
|
6711 |
||
6712 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
6713 |
! |
|
6714 |
||
6715 |
getSystemFileName:aFileNameOrString |
|
6716 |
"search aFileNameOrString in some standard places; |
|
6717 |
return the absolute filename or nil if none is found. |
|
6718 |
see comment in Smalltalk>>initSystemPath. |
|
6719 |
This should be used to access resources such as bitmaps, doc-files, |
|
6720 |
and other help files. |
|
6721 |
" |
|
6722 |
||
6723 |
"credits for this method go to Markus ...." |
|
6724 |
||
6725 |
|fn nameString| |
|
6726 |
||
6727 |
fn := aFileNameOrString asFilename. |
|
6728 |
nameString := fn name. |
|
6729 |
fn isAbsolute ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6730 |
"dont use path for absolute file names" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6731 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6732 |
^ nameString |
10641 | 6733 |
]. |
6734 |
||
6735 |
self realSystemPath do:[:dirName | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6736 |
|realName| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6737 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6738 |
realName := dirName asFilename / nameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6739 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6740 |
"/ here, we also return true if its a directory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6741 |
"/ (Even if unreadable). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6742 |
"/ It could be that the file itself is still readable. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6743 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6744 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6745 |
^ realName name |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6746 |
] |
10641 | 6747 |
]. |
6748 |
^ nil |
|
6749 |
||
6750 |
" |
|
6751 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
6752 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
6753 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
6754 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
6755 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
6756 |
" |
|
6757 |
||
6758 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
6759 |
! |
|
6760 |
||
6761 |
imageFromFileNamed:aFileName forClass:aClass |
|
6762 |
"search aFileName in some standard places: |
|
6763 |
first in the redefinable bitmaps path, then in the classes |
|
6764 |
own package directory if existing. |
|
6765 |
Return an image or nil." |
|
6766 |
||
6767 |
|classPackage img| |
|
6768 |
||
6769 |
classPackage := aClass package. |
|
6770 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
6771 |
img isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6772 |
"/ try under the goodies package ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6773 |
classPackage ~= 'stx:goodies' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6774 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6775 |
] |
10641 | 6776 |
]. |
6777 |
^ img |
|
6778 |
||
6779 |
" |
|
6780 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
6781 |
" |
|
6782 |
! |
|
6783 |
||
6784 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
6785 |
"search aFileName in some standard places: |
|
6786 |
first in the redefinable bitmaps path, |
|
6787 |
then in the package directory if existing. |
|
6788 |
Return an image or nil. |
|
6789 |
Search order is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6790 |
bitmaps/<pkg>/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6791 |
resources/<pkg>/bitmaps/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6792 |
<pkg>/bitmaps/file |
10641 | 6793 |
" |
6794 |
||
6795 |
|path| |
|
6796 |
||
6797 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
6798 |
path notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6799 |
^ Image fromFile:path. |
10641 | 6800 |
]. |
6801 |
^ nil |
|
6802 |
||
6803 |
" |
|
6804 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6805 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6806 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
6807 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
6808 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
6809 |
" |
|
6810 |
||
6811 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
6812 |
! |
|
6813 |
||
6814 |
libraryFileNameOfClass:aClassOrClassName |
|
6815 |
"for a given class, return the name of a classLibrary which contains |
|
6816 |
binary code for it. |
|
6817 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
6818 |
for an entry for aClassOrClassName. |
|
6819 |
Search for the className in the first col, and return the value found in |
|
6820 |
the 2nd col. |
|
6821 |
Return nil if no entry is found. |
|
6822 |
||
6823 |
A nil returns means that this class is either built-in or not present |
|
6824 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
6825 |
Otherwise, the returned name is the classLibrary object of that class. |
|
6826 |
The classes code can be loaded from that file if binary loading is supported." |
|
6827 |
||
6828 |
|aStream line words n aClassName| |
|
6829 |
||
6830 |
aClassOrClassName isBehavior ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6831 |
aClassName := aClassOrClassName name |
10641 | 6832 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6833 |
aClassName := aClassOrClassName |
10641 | 6834 |
]. |
6835 |
aClassName := aClassName asString. |
|
6836 |
||
6837 |
#('include/liblist.stc') "/ filenames |
|
6838 |
with:#(2) "/ column |
|
6839 |
do:[:fileName :col | |
|
6840 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6841 |
aStream := self systemFileStreamFor:fileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6842 |
aStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6843 |
[aStream atEnd] whileFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6844 |
line := aStream nextLine. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6845 |
line notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6846 |
(line startsWith:'#') ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6847 |
words := line asCollectionOfWords. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6848 |
(n := words size) > 1 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6849 |
(words at:1) = aClassName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6850 |
n >= col ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6851 |
aStream close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6852 |
^ (words at:col) withoutSeparators |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6853 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6854 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6855 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6856 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6857 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6858 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6859 |
aStream close |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6860 |
]. |
10641 | 6861 |
]. |
6862 |
||
6863 |
^ nil |
|
6864 |
||
6865 |
" |
|
6866 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
6867 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
6868 |
" |
|
6869 |
||
6870 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
6871 |
! |
|
6872 |
||
6873 |
packagePath |
|
6874 |
"return a collection of additional directorynames, where smalltalk |
|
6875 |
looks for package directories. |
|
6876 |
Notice, that directories named 'packages' under the systemPath are |
|
6877 |
always consulted - even if not in the packagePath" |
|
6878 |
||
6879 |
^ PackagePath |
|
6880 |
||
6881 |
" |
|
6882 |
Smalltalk packagePath |
|
6883 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
6884 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
6885 |
" |
|
6886 |
! |
|
6887 |
||
6888 |
packagePath:aPath |
|
6889 |
"set the packagePath; |
|
6890 |
a collection of additional directorynames, where smalltalk |
|
6891 |
looks for package directories. |
|
6892 |
Notice, that directories named 'packages' under the systemPath are |
|
6893 |
always consulted - even if not in the packagePath" |
|
6894 |
||
6895 |
PackagePath := aPath asOrderedCollection |
|
6896 |
||
6897 |
" |
|
6898 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
6899 |
" |
|
6900 |
! |
|
6901 |
||
6902 |
projectDirectoryForClass:aClass |
|
6903 |
"given a class, return the path to its package directory; |
|
6904 |
nil if not found." |
|
6905 |
||
6906 |
|pkg| |
|
6907 |
||
6908 |
pkg := aClass package. |
|
6909 |
pkg isNil ifTrue:[^ nil]. |
|
6910 |
||
6911 |
^ self projectDirectoryForPackage:pkg. |
|
6912 |
||
6913 |
" |
|
6914 |
Smalltalk projectDirectoryForClass:Array |
|
6915 |
Smalltalk projectDirectoryForClass:View |
|
6916 |
" |
|
6917 |
! |
|
6918 |
||
6919 |
projectDirectoryForPackage:aPackage |
|
6920 |
"given a packageID, return the path to its package directory; |
|
6921 |
nil if not found." |
|
6922 |
||
6923 |
|prj prjDir| |
|
6924 |
||
6925 |
"/ there might be a package specific resource directory ... |
|
6926 |
"/ in the directory, from which the project was loaded |
|
6927 |
prj := Project projectWithId:aPackage. |
|
6928 |
prj notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6929 |
prjDir := prj directory. |
10641 | 6930 |
]. |
6931 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6932 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 6933 |
]. |
6934 |
^ prjDir |
|
6935 |
||
6936 |
" |
|
6937 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
|
6938 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
|
6939 |
Smalltalk projectDirectoryForPackage:'stx' |
|
6940 |
Smalltalk projectDirectoryForPackage:'bosch' |
|
6941 |
" |
|
6942 |
||
6943 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
6944 |
! |
|
6945 |
||
6946 |
readAbbreviations |
|
6947 |
"read classname to filename mappings from include/abbrev.stc. |
|
6948 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
6949 |
||
6950 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
6951 |
||
6952 |
CachedAbbreviations := IdentityDictionary new. |
|
6953 |
self installAutoloadedClasses. |
|
6954 |
^ CachedAbbreviations. |
|
6955 |
||
6956 |
" |
|
6957 |
Smalltalk readAbbreviations |
|
6958 |
" |
|
6959 |
||
6960 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
6961 |
! |
|
6962 |
||
6963 |
readAbbreviationsFromStream:aStream |
|
6964 |
"read classname to filename mappings from aStream. |
|
6965 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
6966 |
||
11375 | 6967 |
self |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6968 |
withAbbreviationsFromStream:aStream |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6969 |
do:[:className :abbrev :pkg | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6970 |
self setFilename:abbrev forClass:className package:pkg. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6971 |
]. |
10641 | 6972 |
|
6973 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
6974 |
! |
|
6975 |
||
6976 |
realSystemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
6977 |
"return the realSystemPath - thats the directory names from |
10641 | 6978 |
SystemPath which exist and are readable" |
6979 |
||
6980 |
|nP| |
|
6981 |
||
6982 |
RealSystemPath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6983 |
OperatingSystem isVMSlike ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6984 |
"/ temporary kludge: since we cannot currently |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6985 |
"/ check for existance of a name like 'volume:', |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6986 |
"/ leave those in the Path without a check. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6987 |
RealSystemPath := SystemPath select:[:dirName | |f| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6988 |
f := dirName asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6989 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6990 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6991 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6992 |
RealSystemPath := SystemPath |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6993 |
select:[:eachDirectoryName | |f| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6994 |
f := eachDirectoryName asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6995 |
(f isDirectory) and:[f isReadable] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6996 |
] thenCollect:[:eachDirectoryName| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6997 |
eachDirectoryName asFilename pathName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6998 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6999 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7000 |
"/ remove duplicates (but keep order) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7001 |
nP := OrderedCollection new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7002 |
RealSystemPath do:[:p | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7003 |
(nP includes:p) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7004 |
nP add:p |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7005 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7006 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7007 |
(nP includes:'.') ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7008 |
nP add:'.' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7009 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7010 |
RealSystemPath := nP. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7011 |
]. |
617 | 7012 |
]. |
7013 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7014 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7015 |
|
10641 | 7016 |
recursiveReadAllAbbreviationsFrom:aDirectory |
7017 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
7018 |
! |
|
7019 |
||
7020 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
7021 |
"read all abbreviations from and under aDirectory." |
|
7022 |
||
7023 |
|abbrevStream dir directoryContents| |
|
7024 |
||
7025 |
maxLevels == 0 ifTrue:[ |
|
7026 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7027 |
^ self |
10641 | 7028 |
]. |
7029 |
||
7030 |
dir := aDirectory asFilename. |
|
7031 |
dir exists ifFalse:[^ self]. |
|
7032 |
||
7033 |
[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7034 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7035 |
self readAbbreviationsFromStream:abbrevStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7036 |
abbrevStream close. |
10641 | 7037 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
7038 |
||
7039 |
[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7040 |
directoryContents := dir directoryContents. |
10641 | 7041 |
] on:FileStream openErrorSignal do:[:ex| |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7042 |
"non-accessable directory: we are done" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7043 |
^ self |
10641 | 7044 |
]. |
7045 |
||
7046 |
directoryContents do:[:aFilename | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7047 |
|f| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7048 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7049 |
(#( |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7050 |
'doc' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7051 |
'CVS' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7052 |
'bitmaps' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7053 |
'resources' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7054 |
'source' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7055 |
) includes:aFilename) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7056 |
f := dir / aFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7057 |
f isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7058 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7059 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7060 |
]. |
4458 | 7061 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7062 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7063 |
|
13368 | 7064 |
relativePackagePathForPackage:aPackage |
7065 |
|path| |
|
7066 |
||
7067 |
PackageToPathMapping notNil ifTrue:[ |
|
13370 | 7068 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
7069 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
7070 |
]. |
|
7071 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 7072 |
|
7073 |
" |
|
7074 |
PackageToPathMapping := Dictionary new. |
|
7075 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
7076 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
7077 |
||
7078 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
7079 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
7080 |
" |
|
7081 |
! |
|
7082 |
||
10641 | 7083 |
resourceDirectoryForPackage:aPackage |
7084 |
"given a packageID, return the path to its resource directory; |
|
7085 |
nil if not found." |
|
7086 |
||
7087 |
|prjDir rsrcDir| |
|
7088 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
7089 |
aPackage notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7090 |
prjDir := self projectDirectoryForPackage:aPackage. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7091 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7092 |
(prjDir notNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7093 |
and:[(prjDir := prjDir asFilename) exists |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7094 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7095 |
^ rsrcDir |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7096 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7097 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7098 |
rsrcDir notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7099 |
^ rsrcDir asFilename |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7100 |
]. |
10641 | 7101 |
]. |
7102 |
^ nil |
|
7103 |
||
7104 |
" |
|
7105 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
7106 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
7107 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
7108 |
" |
|
7109 |
! |
|
7110 |
||
7111 |
resourceFileStreamFor:aFileName |
|
7112 |
"search aFileName in some standard places; |
|
7113 |
return a readonly fileStream or nil if not found. |
|
7114 |
Searches in subdirectories named 'resource' in SystemPath" |
|
7115 |
||
7116 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
7117 |
! |
|
7118 |
||
7119 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
7120 |
"search aFileName in some standard places and in the classes |
|
7121 |
package-resource directory. |
|
7122 |
Return a readonly fileStream or nil if not found. |
|
7123 |
Searches in subdirectories named 'resource' in SystemPath" |
|
7124 |
||
7125 |
|aString| |
|
7126 |
||
7127 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
7128 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7129 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7130 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7131 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7132 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7133 |
|
10641 | 7134 |
searchPath:aPath for:aFileName in:aDirName |
7135 |
"search aPath for a subdirectory named aDirectory with a file |
|
7136 |
named aFileName" |
|
7137 |
||
7138 |
|f| |
|
7139 |
||
7140 |
((f := aFileName asFilename) isAbsolute |
|
7141 |
or:[f isExplicitRelative]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7142 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7143 |
"/ dont use path for absolute or explicit .-relative file names |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7144 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7145 |
^ aFileName |
10641 | 7146 |
]. |
7147 |
||
7148 |
aPath notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7149 |
aPath do:[:dirName | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7150 |
|realName dir| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7151 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7152 |
dir := dirName asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7153 |
aDirName notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7154 |
realName := dir / aDirName / aFileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7155 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7156 |
realName := dir / aFileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7157 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7158 |
(realName isReadable) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7159 |
^ realName name |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7160 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7161 |
]. |
11108 | 7162 |
]. |
7163 |
||
7164 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 7165 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 7166 |
"/ (realName isReadable) ifTrue:[ |
7167 |
"/ ^ realName name |
|
7168 |
"/ ]. |
|
10641 | 7169 |
^ nil. |
7170 |
||
7171 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
7172 |
! |
|
7173 |
||
7174 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
7175 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
7176 |
||
7177 |
CachedAbbreviations isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7178 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 7179 |
]. |
7180 |
||
7181 |
abbrevs := CachedAbbreviations. |
|
7182 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7183 |
classNameSymbol := aClassNameString asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7184 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7185 |
oldAbbrev notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7186 |
oldAbbrev ~= aFileNameString ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7187 |
oldAbbrev asFilename isAbsolute |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7188 |
ifTrue:[ oldPath := oldAbbrev ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7189 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7190 |
aFileNameString asFilename isAbsolute |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7191 |
ifTrue:[ newPath := aFileNameString ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7192 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7193 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7194 |
oldPath ~= newPath ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7195 |
StandAlone ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7196 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7197 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7198 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7199 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7200 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7201 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7202 |
"overwrite old abbreviation with new one, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7203 |
to allow fixing of bad abbrev files" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7204 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7205 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7206 |
cls := self classNamed:aFileNameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7207 |
cls notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7208 |
cls name ~= aClassNameString ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7209 |
"/ ok, there is a class named after this abbrev ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7210 |
"/ this is only a conflict, if the other class has no |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7211 |
"/ abbreviation (or the same). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7212 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7213 |
cls isNameSpace ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7214 |
aPackageNameString = cls package ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7215 |
StandAlone ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7216 |
('Smalltalk [warning]: conflict for: ' , cls name , |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7217 |
' in package ' , aPackageNameString) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7218 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7219 |
, ')') infoPrintCR |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7220 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7221 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7222 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7223 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7224 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7225 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7226 |
abbrevs at:classNameSymbol put:aFileNameString. |
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
7227 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7228 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7229 |
|
10641 | 7230 |
sourceDirectoryNameOfClass:aClassOrClassName |
7231 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
7232 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
7233 |
for an entry for aClassOrClassName. |
|
7234 |
Search for the className in the first col, and return the value found in |
|
7235 |
the 3rd col. |
|
7236 |
Return nil if no entry is found." |
|
7237 |
||
7238 |
|aStream line words n aClassName| |
|
7239 |
||
7240 |
aClassOrClassName isBehavior ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7241 |
aClassName := aClassOrClassName name |
10641 | 7242 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7243 |
aClassName := aClassOrClassName |
10641 | 7244 |
]. |
7245 |
aClassName := aClassName asString. |
|
7246 |
||
7247 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
7248 |
with:#(3 2) "/ column |
|
7249 |
do:[:fileName :col | |
|
7250 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7251 |
aStream := self systemFileStreamFor:fileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7252 |
aStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7253 |
[aStream atEnd] whileFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7254 |
line := aStream nextLine. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7255 |
line notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7256 |
(line startsWith:'#') ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7257 |
words := line asCollectionOfWords. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7258 |
(n := words size) > 1 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7259 |
(words at:1) = aClassName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7260 |
n >= col ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7261 |
aStream close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7262 |
^ (words at:col) withoutSeparators |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7263 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7264 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7265 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7266 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7267 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7268 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7269 |
aStream close |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7270 |
]. |
10641 | 7271 |
]. |
7272 |
||
7273 |
^ nil |
|
7274 |
||
7275 |
" |
|
7276 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
7277 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
7278 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
7279 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
7280 |
" |
|
7281 |
||
7282 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
7283 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
7284 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
7285 |
! |
|
7286 |
||
7287 |
sourceFileStreamFor:aFileName |
|
7288 |
"search aFileName in some standard places; |
|
7289 |
return a readonly fileStream or nil if not found. |
|
7290 |
Searches in subdirectories named 'source' in SystemPath" |
|
7291 |
||
7292 |
|aString| |
|
7293 |
||
7294 |
aString := self getSourceFileName:aFileName. |
|
7295 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7296 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7297 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7298 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7299 |
! |
7758 | 7300 |
|
10641 | 7301 |
systemFileStreamFor:aFileName |
7302 |
"search aFileName in some standard places; |
|
7303 |
return a readonly fileStream or nil if not found. |
|
7304 |
see comment in Smalltalk>>initSystemPath" |
|
7305 |
||
7306 |
|aString| |
|
7307 |
||
7308 |
aString := self getSystemFileName:aFileName. |
|
7309 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7310 |
^ aString asFilename readStreamOrNil |
617 | 7311 |
]. |
7312 |
^ nil |
|
7313 |
! |
|
7314 |
||
10641 | 7315 |
systemPath |
7316 |
"return a collection of directorynames, where smalltalk |
|
7317 |
looks for system files |
|
7318 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
7319 |
see comment in Smalltalk>>initSystemPath." |
|
7320 |
||
7321 |
^ SystemPath |
|
7322 |
||
7323 |
" |
|
7324 |
Smalltalk systemPath |
|
7325 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
7326 |
" |
|
7327 |
! |
|
7328 |
||
7329 |
systemPath:aPath |
|
7330 |
"set the collection of directorynames, where smalltalk |
|
7331 |
looks for system files |
|
7332 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
7333 |
see comment in Smalltalk>>initSystemPath." |
|
7334 |
||
7335 |
SystemPath := aPath. |
|
7336 |
self flushPathCaches |
|
7337 |
||
7338 |
" |
|
7339 |
Smalltalk systemPath |
|
7340 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7341 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7342 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7343 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7344 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7345 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7346 |
Evaluate aBlock for each tuple: |
13771 | 7347 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7348 |
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
|
7349 |
|
13415 | 7350 |
|line lineNo words nm abbrev pkg category size s w| |
7351 |
||
7352 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7353 |
[aStream atEnd] whileFalse:[ |
13771 | 7354 |
line := aStream nextLine. |
7355 |
lineNo := lineNo + 1. |
|
7356 |
line notEmptyOrNil ifTrue:[ |
|
7357 |
(line startsWith:'#') ifFalse:[ |
|
7358 |
||
7359 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7360 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7361 |
|
13771 | 7362 |
words := OrderedCollection new. |
7363 |
s := line readStream. |
|
7364 |
[s atEnd] whileFalse:[ |
|
7365 |
s skipSeparators. |
|
7366 |
s peek == $' ifTrue:[ |
|
7367 |
s next. |
|
7368 |
w := s upTo:$'. |
|
7369 |
s skipSeparators. |
|
7370 |
] ifFalse:[ |
|
7371 |
w := s upToSeparator |
|
7372 |
]. |
|
7373 |
words add:w |
|
7374 |
]. |
|
7375 |
words size >= 3 ifTrue:[ |
|
7376 |
nm := (words at:1) withoutSeparators. |
|
7377 |
abbrev := (words at:2) withoutSeparators. |
|
7378 |
pkg := (words at:3) withoutSeparators. |
|
7379 |
aBlock argumentCount = 3 ifTrue:[ |
|
7380 |
aBlock value:nm value:abbrev value:pkg. |
|
7381 |
] ifFalse:[ |
|
7382 |
words size >= 4 ifTrue:[ |
|
7383 |
category := words at:4. |
|
7384 |
]. |
|
7385 |
words size = 5 ifTrue:[ |
|
7386 |
size := (words at:5) asNumber |
|
7387 |
]. |
|
7388 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
7389 |
] |
|
7390 |
] ifFalse:[ |
|
7391 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
7392 |
] |
|
7393 |
] |
|
7394 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
7395 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
7396 |
|
13415 | 7397 |
"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
|
7398 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7399 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7400 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7401 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7402 |
|
10641 | 7403 |
loadPackage:aPackageIdOrPackage |
12250 | 7404 |
"make certain, that some particular package is loaded into the system. |
7405 |
Return true if loaded, false otherwise." |
|
11668 | 7406 |
|
7407 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
7408 |
||
7409 |
" |
|
7410 |
Smalltalk loadPackage:'stx:libbasic' |
|
7411 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7412 |
Smalltalk loadPackage:'cg:cparser' |
|
7413 |
Smalltalk loadPackage:'cg:rose' |
|
7414 |
" |
|
7415 |
! |
|
7416 |
||
10641 | 7417 |
packageDirectoryForPackageId:aPackageId |
12250 | 7418 |
"used by classes to find the location of their resource- and bitmap directories. |
7419 |
||
7420 |
Notice that the directory structure is different between the development |
|
7421 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
7422 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
7423 |
At runtime, Smalltalk knows about the systemPath setting." |
|
7424 |
||
10641 | 7425 |
|packageDirName packageDir| |
7426 |
||
14589 | 7427 |
packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/. |
10641 | 7428 |
|
7429 |
packageDir := self getPackageFileName:packageDirName. |
|
7430 |
packageDir isNil ifTrue:[ |
|
14589 | 7431 |
^ nil. |
10641 | 7432 |
]. |
7433 |
^ packageDir asFilename |
|
7434 |
||
7435 |
" |
|
11375 | 7436 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 7437 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
7438 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
7439 |
" |
|
12250 | 7440 |
! |
7441 |
||
7442 |
unloadPackage:aPackageIdOrPackage |
|
7443 |
|projectDefinition| |
|
7444 |
||
7445 |
projectDefinition := aPackageIdOrPackage. |
|
7446 |
projectDefinition isProjectDefinition ifFalse:[ |
|
14611 | 7447 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass. |
7448 |
projectDefinition isNil ifTrue:[ |
|
7449 |
'Smalltalk [info] trying to unload non-existing package: ' infoPrint. aPackageIdOrPackage infoPrintCR. |
|
7450 |
^ self. |
|
7451 |
]. |
|
12250 | 7452 |
]. |
7453 |
projectDefinition unloadPackage. |
|
7454 |
||
7455 |
" |
|
7456 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7457 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
7458 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7459 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7460 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7461 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7462 |
|
10641 | 7463 |
clearUndeclaredVariables |
7464 |
"remove all undeclared variables" |
|
7465 |
||
7466 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7467 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 7468 |
]. |
7469 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7470 |
Smalltalk removeKey:#Undeclared. |
10641 | 7471 |
! |
7472 |
||
7473 |
undeclaredPrefix |
|
7474 |
"the prefix used for undeclared variables" |
|
7475 |
||
7476 |
^ 'Undeclared:::' |
|
7477 |
||
7478 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 7479 |
! ! |
7480 |
||
7481 |
!Smalltalk class methodsFor:'time-versions'! |
|
7482 |
||
10641 | 7483 |
configuration |
7484 |
"{ Pragma: +optSpace }" |
|
7485 |
||
7486 |
"for developers only: return the configuration, with which |
|
7487 |
this smalltalk was compiled." |
|
7488 |
||
7489 |
%{ /* NOCONTEXT */ |
|
7490 |
extern char *__getConfigurationString(); |
|
7491 |
||
7492 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
7493 |
%}. |
|
7494 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
7495 |
||
7496 |
" |
|
10071 | 7497 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7498 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7499 |
! |
453 | 7500 |
|
10641 | 7501 |
copyrightString |
7502 |
"{ Pragma: +optSpace }" |
|
7503 |
||
7504 |
"return a copyright string" |
|
7505 |
||
7506 |
%{ /* NOCONTEXT */ |
|
7507 |
#ifndef __getCopyrightString |
|
7508 |
extern OBJ __getCopyrightString(); |
|
7509 |
#endif |
|
7510 |
||
7511 |
RETURN (__getCopyrightString()); |
|
7512 |
%}. |
|
7513 |
^ self primitiveFailed |
|
7514 |
||
7515 |
" |
|
7758 | 7516 |
Smalltalk copyrightString |
7517 |
" |
|
7518 |
! |
|
7519 |
||
10641 | 7520 |
distributorString |
7521 |
"{ Pragma: +optSpace }" |
|
7522 |
||
7523 |
"return a string describing the distributor of this software" |
|
7524 |
||
7525 |
%{ /* NOCONTEXT */ |
|
7526 |
#ifndef __getDistributorString |
|
7527 |
extern OBJ __getDistributorString(); |
|
7528 |
#endif |
|
7529 |
||
7530 |
RETURN (__getDistributorString()); |
|
7531 |
%}. |
|
7532 |
^ 'eXept Software AG, Germany' |
|
7533 |
||
7534 |
" |
|
7535 |
Smalltalk distributorString |
|
7536 |
" |
|
7537 |
! |
|
7538 |
||
7539 |
expirationTime |
|
7540 |
"{ Pragma: +optSpace }" |
|
7541 |
||
7542 |
"for developers only: return the time when the system will expire. |
|
7543 |
after this time it will not run any longer. |
|
7544 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
7545 |
||
7546 |
|exp| |
|
7547 |
||
7548 |
%{ |
|
7549 |
extern unsigned int __getExpirationTime(); |
|
7550 |
||
7551 |
exp = __MKUINT(__getExpirationTime()); |
|
7552 |
%}. |
|
7553 |
exp == 0 ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7554 |
^ nil |
10641 | 7555 |
]. |
7556 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
7557 |
||
7558 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7559 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7560 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7561 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7562 |
|
10641 | 7563 |
fullVersionString |
7564 |
"{ Pragma: +optSpace }" |
|
7565 |
||
7566 |
"return a full version string" |
|
7567 |
||
7568 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
|
7569 |
||
7570 |
" |
|
7571 |
Smalltalk fullVersionString |
|
7572 |
" |
|
7573 |
||
7574 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
7575 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
7576 |
! |
|
7577 |
||
7578 |
hello |
|
7579 |
"{ Pragma: +optSpace }" |
|
7580 |
||
7581 |
"return a greeting string" |
|
7582 |
||
7583 |
"stupid: this should come from a resource file ... |
|
7584 |
but I dont use it here, to allow mini-systems without |
|
7585 |
Resource-stuff." |
|
7586 |
||
7587 |
|proto lang| |
|
7588 |
||
7589 |
lang := Language. |
|
7590 |
(lang == #de) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7591 |
proto := 'Willkommen bei %1 (Version %2 von %3)' |
10641 | 7592 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7593 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
10641 | 7594 |
] ifFalse:[ (lang == #it) ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7595 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
10641 | 7596 |
] ifFalse:[ (lang == #es) ifTrue:[ |
7597 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
|
7598 |
] ifFalse:[ (lang == #es) ifTrue:[ |
|
7599 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
|
7600 |
] ifFalse:[ (lang == #no) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7601 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
10641 | 7602 |
]]]]]]. |
7603 |
||
7604 |
"/ ... more needed here ... |
|
7605 |
||
7606 |
proto isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7607 |
proto := 'Hello World - here is %1 version %2 of %3'. |
10641 | 7608 |
]. |
7609 |
||
7610 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7611 |
with:(self versionString) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7612 |
with:(self versionDate) |
10641 | 7613 |
|
7614 |
" |
|
7615 |
Smalltalk language:#us. |
|
7616 |
Smalltalk hello |
|
7617 |
||
7618 |
Smalltalk language:#de. |
|
7619 |
Smalltalk hello |
|
7620 |
||
7621 |
Smalltalk language:#no. |
|
7622 |
Smalltalk hello |
|
7623 |
||
7624 |
Transcript showCR:(Smalltalk hello) |
|
7625 |
Stdout showCR:(Smalltalk hello) |
|
7626 |
" |
|
7627 |
||
7628 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
7629 |
! |
|
7630 |
||
7631 |
imageRestartTime |
|
7632 |
"return a timestamp for the moment when this image was restarted. |
|
7633 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
7634 |
||
7635 |
^ ImageRestartTime |
|
7636 |
||
7637 |
" |
|
7638 |
Smalltalk imageStartTime |
|
7639 |
Smalltalk imageRestartTime |
|
7640 |
" |
|
7641 |
||
7642 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
7643 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
7644 |
! |
|
7645 |
||
7646 |
imageSaveTime |
|
7647 |
"{ Pragma: +optSpace }" |
|
7648 |
||
7649 |
"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
|
7650 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7651 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7652 |
! |
7758 | 7653 |
|
10641 | 7654 |
imageStartTime |
7655 |
"{ Pragma: +optSpace }" |
|
7656 |
||
7657 |
"return a timestamp for the moment when this system started the first time |
|
7658 |
(i.e. the first initial start without an image)" |
|
7659 |
||
7660 |
^ ImageStartTime |
|
7661 |
||
7662 |
" |
|
7663 |
Smalltalk imageStartTime |
|
7664 |
Smalltalk imageRestartTime |
|
7665 |
" |
|
7666 |
||
7667 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
7668 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
7669 |
! |
|
7670 |
||
7671 |
majorVersionNr |
|
7672 |
"{ Pragma: +optSpace }" |
|
7673 |
||
7674 |
"return the major version number. |
|
7675 |
This is only incremented for very fundamental changes, |
|
7676 |
which make old object files totally incompatible |
|
7677 |
(for example, if the layout/representation of fundamental |
|
7678 |
classes changes). |
|
7679 |
||
7680 |
ST/X revision Naming is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7681 |
<major>.<minor>.<revision>.<release>" |
10641 | 7682 |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
7683 |
^ 6 |
10641 | 7684 |
|
7685 |
" |
|
7686 |
Smalltalk majorVersionNr |
|
7687 |
" |
|
7688 |
||
7689 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
|
7690 |
! |
|
7691 |
||
7692 |
minorVersionNr |
|
7693 |
"{ Pragma: +optSpace }" |
|
7694 |
||
7695 |
"return the minor version number. |
|
7696 |
This is incremented for changes which make some old object |
|
7697 |
files incompatible, or the protocol changes such that some |
|
7698 |
classes need rework. |
|
7699 |
||
7700 |
ST/X revision Naming is: |
|
13771 | 7701 |
<major>.<minor>.<revision>.<release>" |
13489 | 7702 |
|
7703 |
^ 2 |
|
10641 | 7704 |
|
7705 |
" |
|
7706 |
Smalltalk minorVersionNr |
|
7707 |
" |
|
7708 |
||
7709 |
"Modified: / 16-08-2006 / 09:37:25 / cg" |
|
7710 |
! |
|
7711 |
||
7712 |
releaseIdentification |
|
7713 |
"{ Pragma: +optSpace }" |
|
7714 |
||
7715 |
"for developers only: return the release |
|
7716 |
(to further identify the version in case of errors)" |
|
7717 |
||
7718 |
%{ /* NOCONTEXT */ |
|
7719 |
extern OBJ __getRel(); |
|
7720 |
||
7721 |
RETURN (__getRel()); |
|
7722 |
%}. |
|
7723 |
^ 'ST/X_experimental' |
|
7724 |
||
7725 |
" |
|
7726 |
Smalltalk releaseIdentification |
|
7727 |
" |
|
7728 |
! |
|
7729 |
||
7730 |
releaseNr |
|
7731 |
"{ Pragma: +optSpace }" |
|
7732 |
||
14542 | 7733 |
"return the release number. |
7734 |
Now releaseNr is the build number (BUILD_NUMBER from Jenkins) |
|
10641 | 7735 |
|
7736 |
ST/X revision Naming is: |
|
14529 | 7737 |
<major>.<minor>.<revision>.<release>" |
7738 |
||
7739 |
|releaseNumber| |
|
7740 |
||
7741 |
releaseNumber := Smalltalk versionBuildNumber. |
|
7742 |
releaseNumber isEmpty ifTrue:[ |
|
7743 |
^ 0. |
|
7744 |
]. |
|
7745 |
^ releaseNumber |
|
10641 | 7746 |
|
7747 |
" |
|
7748 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
7749 |
Smalltalk versionString |
10641 | 7750 |
" |
7751 |
||
7752 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
7753 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
7754 |
! |
|
7755 |
||
7756 |
revisionNr |
|
7757 |
"{ Pragma: +optSpace }" |
|
7758 |
||
7759 |
"return the revision number. |
|
7760 |
Incremented for releases which fix bugs/add features |
|
7761 |
and represent a stable workable version which got published |
|
7762 |
to the outside world. |
|
7763 |
||
7764 |
ST/X revision Naming is: |
|
14432 | 7765 |
<major>.<minor>.<revision>.<release>" |
14210 | 7766 |
|
7767 |
^ 2 |
|
10641 | 7768 |
|
7769 |
" |
|
7770 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7771 |
Smalltalk hello string |
13014 | 7772 |
" |
7773 |
||
14210 | 7774 |
"Modified: / 18-07-2012 / 19:09:42 / cg" |
10641 | 7775 |
! |
7776 |
||
7777 |
timeStamp |
|
7778 |
"return a string useful for timestamping a file. |
|
7779 |
The returned string is padded with spaces for a constant |
|
7780 |
length (to avoid changing a files size in fileOut with unchanged |
|
7781 |
class)." |
|
7782 |
||
7783 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
7784 |
! |
|
7785 |
||
7786 |
timeStamp:aStream |
|
7787 |
"write a string useful for timestamping a file onto aStream. |
|
7788 |
ST80 compatibility" |
|
7789 |
||
7790 |
aStream nextPutAll:(self timeStamp). |
|
7791 |
||
7792 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
7793 |
! |
|
7794 |
||
7795 |
timeStampString |
|
7796 |
"return a string useful for timestamping a file." |
|
7797 |
||
7798 |
|dateString| |
|
7799 |
||
7800 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
7801 |
||
7802 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
7803 |
, dateString , ' at ' , Time now printString |
|
7758 | 7804 |
) |
7805 |
! |
|
7806 |
||
14529 | 7807 |
versionBuildNumber |
7808 |
"{ Pragma: +optSpace }" |
|
7809 |
||
7810 |
"return the executables build number - that's the jenkins build #. |
|
7811 |
Empty if not built by jenkins" |
|
7812 |
||
7813 |
%{ /* NOCONTEXT */ |
|
7814 |
extern char *__getBuildNumberString(); |
|
7815 |
||
7816 |
RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) ); |
|
7817 |
%}. |
|
7818 |
^ '' |
|
7819 |
||
7820 |
" |
|
7821 |
Smalltalk versionBuildNumber |
|
7822 |
" |
|
7823 |
! |
|
7824 |
||
10641 | 7825 |
versionDate |
7826 |
"{ Pragma: +optSpace }" |
|
7827 |
||
14522 | 7828 |
"return the executables build date - that's the date when the smalltalk |
10641 | 7829 |
executable was built" |
7830 |
||
7831 |
%{ /* NOCONTEXT */ |
|
7832 |
extern char *__getBuildDateString(); |
|
7833 |
||
7834 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
7835 |
%}. |
|
7836 |
^ 'today' |
|
7837 |
||
7838 |
" |
|
10071 | 7839 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7840 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7841 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7842 |
|
10641 | 7843 |
versionString |
7844 |
"{ Pragma: +optSpace }" |
|
7845 |
||
7846 |
"return the version string" |
|
7847 |
||
7848 |
^ (self majorVersionNr printString , |
|
7849 |
'.', |
|
7850 |
self minorVersionNr printString , |
|
7851 |
'.', |
|
14529 | 7852 |
self revisionNr printString, |
7853 |
'.', |
|
7854 |
self releaseNr printString) |
|
13771 | 7855 |
|
10641 | 7856 |
|
7857 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7858 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7859 |
" |
10641 | 7860 |
! |
7861 |
||
7862 |
vmMajorVersionNr |
|
7863 |
"{ Pragma: +optSpace }" |
|
7864 |
||
7865 |
"return the VMs major version number." |
|
7866 |
%{ |
|
7867 |
RETURN (__mkSmallInteger(4)); |
|
7868 |
%}. |
|
7869 |
^ 4 |
|
7870 |
||
7871 |
" |
|
7872 |
Smalltalk vmMajorVersionNr |
|
7873 |
" |
|
2 | 7874 |
! ! |
453 | 7875 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
7876 |
!Smalltalk class methodsFor:'documentation'! |
630 | 7877 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
7878 |
version |
14890 | 7879 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1011 2013-03-18 13:39:49 cg Exp $' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
7880 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
7881 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
7882 |
version_CVS |
14890 | 7883 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1011 2013-03-18 13:39:49 cg Exp $' |
13415 | 7884 |
! |
7885 |
||
7886 |
version_SVN |
|
13489 | 7887 |
^ '§ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 §' |
630 | 7888 |
! ! |
14611 | 7889 |