author | Stefan Vogel <sv@exept.de> |
Wed, 22 Feb 2012 14:28:10 +0100 | |
changeset 14020 | 3cbf9505591c |
parent 14011 | d33d2c6497f4 |
child 14210 | 06966b03a12c |
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:] |
13814 | 71 |
none - all handling is done in the VM |
1286 | 72 |
|
73 |
[Class variables:] |
|
74 |
||
13814 | 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 |
|
13814 | 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:] |
|
13814 | 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:] |
13814 | 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: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
230 |
this is not called when an image is restarted; in this |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
231 |
case the show starts in Smalltalk>>restart." |
11057 | 232 |
|
13771 | 233 |
Compiler := ByteCodeCompiler. |
234 |
Compiler isNil ifTrue:[ |
|
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 |
|
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 |
"/ |
|
277 |
"/ now, finally, initialize all other classes |
|
278 |
"/ |
|
279 |
self initializeModules. |
|
280 |
||
281 |
ImageStartTime := Timestamp now. |
|
282 |
||
283 |
self initInterrupts. |
|
284 |
self initUserPreferences. |
|
285 |
||
286 |
"/ |
|
287 |
"/ give classes a chance to perform 2nd-level initialization |
|
288 |
"/ now, we are certain, that all other classes have been initialized |
|
289 |
"/ (especially: streams and signals can now be used) |
|
290 |
"/ |
|
291 |
ObjectMemory changed:#initialized. |
|
292 |
||
293 |
"Modified: / 08-01-1997 / 19:58:12 / stefan" |
|
294 |
"Modified: / 05-12-2006 / 21:48:58 / cg" |
|
295 |
! |
|
296 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
297 |
initGlobalsFromEnvironment |
617 | 298 |
"setup globals from the shell-environment" |
299 |
||
300 |
|envString i langString terrString| |
|
301 |
||
5406 | 302 |
StandAlone isNil ifTrue:[ |
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
303 |
StandAlone := false. |
5406 | 304 |
]. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
305 |
HeadlessOperation isNil ifTrue:[ |
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
306 |
HeadlessOperation := false. |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
307 |
]. |
5406 | 308 |
|
617 | 309 |
" |
310 |
extract Language and LanguageTerritory from LANG variable. |
|
5846 | 311 |
valid are for example: |
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
312 |
en_en / en |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
313 |
en_us |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
314 |
en_gb |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
315 |
de_de / de |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
316 |
de_at (for Austria) |
5846 | 317 |
" |
318 |
||
319 |
Language := #en. |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
320 |
LanguageTerritory := #us. |
617 | 321 |
|
5846 | 322 |
|
323 |
"Format of LANG is: language[_territory][.codeset][@modifier] |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
324 |
language ISO-639 Language code |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
325 |
territory ISO-3166 Contry code" |
7779
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
326 |
|
6d88d32bdd64
Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents:
7763
diff
changeset
|
327 |
envString := OperatingSystem getLanguage. |
3991
7b53bc45bf91
(isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
328 |
envString size > 0 ifTrue:[ |
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
329 |
i := envString indexOf:$@. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
330 |
(i ~~ 0) ifTrue:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
331 |
LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
332 |
envString := envString copyTo:(i - 1). |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
333 |
] ifFalse:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
334 |
LanguageModifier := nil. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
335 |
]. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
336 |
i := envString indexOf:$.. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
337 |
(i ~~ 0) ifTrue:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
338 |
LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
339 |
envString := envString copyTo:(i - 1). |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
340 |
] ifFalse:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
341 |
LanguageCodeset := #'iso8859-1'. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
342 |
]. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
343 |
i := envString indexOf:$_. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
344 |
(i == 0) ifTrue:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
345 |
langString := envString. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
346 |
terrString := envString |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
347 |
] ifFalse:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
348 |
langString := envString copyTo:(i - 1). |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
349 |
terrString := envString copyFrom:(i + 1) |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
350 |
]. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
351 |
langString := langString asLowercase. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
352 |
terrString := terrString asLowercase. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
353 |
(langString = 'c' or:[terrString = 'c']) ifTrue:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
354 |
('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
355 |
] ifFalse:[ |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
356 |
Language := langString asSymbol. |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
357 |
LanguageTerritory := terrString asSymbol |
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
358 |
] |
617 | 359 |
]. |
360 |
||
361 |
" |
|
362 |
Smalltalk initGlobalsFromEnvironment |
|
363 |
" |
|
994
6163ae7aaf9b
territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents:
977
diff
changeset
|
364 |
|
14011
d33d2c6497f4
changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents:
13998
diff
changeset
|
365 |
"Modified: / 14-02-2012 / 15:25:08 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
366 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
367 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
368 |
initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
369 |
"initialize interrupts" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
370 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
371 |
OperatingSystem enableUserInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
372 |
OperatingSystem enableHardSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
373 |
OperatingSystem enableCrashSignalInterrupts. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
374 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
375 |
ObjectMemory userInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
376 |
ObjectMemory signalInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
377 |
ObjectMemory recursionInterruptHandler:self. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
378 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
379 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
380 |
Smalltalk initInterrupts |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
381 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
382 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
383 |
"Modified: 20.8.1997 / 09:35:49 / stefan" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
384 |
! |
617 | 385 |
|
386 |
initStandardStreams |
|
387 |
"initialize some well-known streams" |
|
388 |
||
389 |
Stdout := NonPositionableExternalStream forStdout. |
|
390 |
Stderr := NonPositionableExternalStream forStderr. |
|
391 |
Stdin := NonPositionableExternalStream forStdin. |
|
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
392 |
PrinterStream notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
393 |
Printer := PrinterStream defaultPrinter. |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
394 |
]. |
617 | 395 |
Transcript := Stderr |
396 |
||
963
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
397 |
" |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
398 |
Smalltalk initStandardStreams |
fef0f2ed2709
more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
399 |
" |
10145
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
400 |
|
cca90547778e
allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents:
10143
diff
changeset
|
401 |
"Modified: / 25-10-2006 / 17:36:46 / cg" |
617 | 402 |
! |
403 |
||
404 |
initStandardTools |
|
10646 | 405 |
"predefine some tools which we might need later |
617 | 406 |
- if the view-classes exist, |
407 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
408 |
||
409 |
Display notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
410 |
InspectorView notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
411 |
Inspector := InspectorView |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
412 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
413 |
DebugView notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
414 |
Debugger := DebugView |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
415 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
416 |
"/ Display initialize |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
417 |
]. |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
418 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
419 |
"/ make the changeFilePath an absolute one, |
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
420 |
"/ in case some stupid windows fileDialog changes the current directory... |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
421 |
ObjectMemory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
422 |
nameForChanges:(Filename currentDirectory construct:ObjectMemory nameForChangesLocal) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
423 |
asAbsoluteFilename pathName |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
424 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
425 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
426 |
Smalltalk initStandardTools |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
427 |
" |
13303
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
428 |
|
1aa90c41dd35
changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents:
13212
diff
changeset
|
429 |
"Modified: / 09-02-2011 / 20:44:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
430 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
431 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
432 |
initSystemPath |
617 | 433 |
"setup path where system files are searched for. |
434 |
the default path is set to: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
435 |
. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
436 |
<directory of exe> (WIN32 only) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
437 |
$HOME (if defined) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
438 |
$HOME/.smalltalk (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
439 |
$SMALLTALK_LIBDIR (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
440 |
$STX_LIBDIR (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
441 |
$STX_TOPDIR (if defined & existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
442 |
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
|
443 |
REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir') (WIN32 only) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
444 |
<standard places> |
9021 | 445 |
|
446 |
standard places (unix): |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
447 |
/opt/smalltalk/<release> (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
448 |
/opt/smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
449 |
/usr/local/lib/smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
450 |
/usr/lib/smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
451 |
/lib/smalltalk (if existing) |
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
452 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
453 |
win32: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
454 |
\programs\exept\smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
455 |
\programs\smalltalk (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
456 |
\smalltalk (if existing) |
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
457 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
458 |
vms: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
459 |
$stx:lib (if existing) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
460 |
$stx:root (if existing) |
617 | 461 |
|
462 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
463 |
startup file; add expressions such as: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
464 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
465 |
or: |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
466 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
4001
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
467 |
|
fa75465bd263
made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
468 |
However, smalltalk.rc itself must be found along the above path. |
617 | 469 |
" |
470 |
||
2928 | 471 |
ChangeFileName := 'changes'. |
472 |
OperatingSystem isVMSlike ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
473 |
BitmapDirName := 'bitmaps.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
474 |
BinaryDirName := 'binary.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
475 |
SourceDirName := 'source.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
476 |
ResourceDirName := 'resources.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
477 |
FileInDirName := 'filein.dir'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
478 |
PackageDirName := 'packages.dir'. |
2928 | 479 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
480 |
BitmapDirName := 'bitmaps'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
481 |
BinaryDirName := 'binary'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
482 |
SourceDirName := 'source'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
483 |
ResourceDirName := 'resources'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
484 |
FileInDirName := 'fileIn'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
485 |
PackageDirName := 'packages'. |
2928 | 486 |
]. |
487 |
||
680 | 488 |
SystemPath isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
489 |
SystemPath := OperatingSystem defaultSystemPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
490 |
self flushPathCaches |
5139 | 491 |
]. |
492 |
||
5144 | 493 |
PackagePath isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
494 |
PackagePath := OperatingSystem defaultPackagePath. |
5144 | 495 |
]. |
617 | 496 |
|
497 |
" |
|
498 |
Smalltalk initSystemPath |
|
499 |
Smalltalk systemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
500 |
|
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
501 |
OperatingSystem defaultSystemPath |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
502 |
OperatingSystem defaultPackagePath |
617 | 503 |
" |
5139 | 504 |
|
5145 | 505 |
"Modified: / 24.12.1999 / 00:23:35 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
506 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
507 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
508 |
initUserPreferences |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
509 |
"setup other stuff" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
510 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
511 |
LogDoits := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
512 |
LoadBinaries := false. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
513 |
SaveEmergencyImage := (StandAlone ~~ true). |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
514 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
515 |
"Modified: / 24.10.1997 / 18:22:47 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
516 |
! |
617 | 517 |
|
7526 | 518 |
initializeClass:aClass |
519 |
"sent from VM via #initializeModules" |
|
520 |
||
7527 | 521 |
Error handle:[:ex | |
13771 | 522 |
ClassesFailedToInitialize isNil ifTrue:[ |
523 |
ClassesFailedToInitialize := IdentitySet new. |
|
524 |
]. |
|
525 |
ClassesFailedToInitialize add:aClass. |
|
526 |
('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR. |
|
527 |
ex suspendedContext fullPrintAll. |
|
528 |
'------------------------------------------------' errorPrintCR. |
|
529 |
(Smalltalk commandLineArguments includes:'--debug') ifTrue:[ |
|
530 |
ex reject |
|
531 |
]. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
532 |
] do:[ |
13771 | 533 |
aClass initialize |
13675 | 534 |
]. |
535 |
||
536 |
"Modified: / 11-09-2011 / 17:01:32 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
537 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
538 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
539 |
initializeModules |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
540 |
"perform module specific initialization and |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
541 |
send #initialize to all classes. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
542 |
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
|
543 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
544 |
self initializeModulesOnce. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
545 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
546 |
('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
547 |
ClassesFailedToInitialize := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
548 |
self initializeModulesOnce. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
549 |
ClassesFailedToInitialize size > 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
550 |
('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
551 |
] |
10122 | 552 |
]. |
553 |
||
554 |
ProjectDefinition initializeAllProjectDefinitions. |
|
555 |
||
556 |
"Modified: / 23-10-2006 / 16:40:39 / cg" |
|
7527 | 557 |
! |
558 |
||
7563 | 559 |
initializeModulesOnce |
560 |
"perform module specific initialization and |
|
561 |
send #initialize to all classes. |
|
7527 | 562 |
Notice: this is not called when an image is restarted" |
4963 | 563 |
|
617 | 564 |
%{ |
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1682
diff
changeset
|
565 |
__init_registered_modules__(3); |
4963 | 566 |
|
1481 | 567 |
@global(DemoMode) = __getDemoMode() ? true : false; |
5410 | 568 |
RETURN (self); |
569 |
%}. |
|
570 |
^ self primitiveFailed |
|
617 | 571 |
! |
572 |
||
7563 | 573 |
initializeSystem |
574 |
"initialize all other classes; setup dispatcher processes etc. |
|
3499 | 575 |
This one is the very first entry into the smalltalk world, |
576 |
right after startup, ususally immediately followed by Smalltalk>>start. |
|
10071 | 577 |
Notice: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
578 |
this is not called when an image is restarted; in this |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
579 |
case the show starts in Smalltalk>>restart." |
211 | 580 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
581 |
|idx| |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
582 |
|
12861 | 583 |
NumberOfClassesHint := 10000. |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
584 |
|
3499 | 585 |
Initializing := true. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
586 |
|
3499 | 587 |
AbstractOperatingSystem initializeConcreteClass. |
588 |
||
5400 | 589 |
CommandLineArguments isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
590 |
CommandLineArguments := #('stx'). |
5400 | 591 |
]. |
4006
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
592 |
CommandLine := CommandLineArguments copy. |
c7ad38c52eb9
must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents:
4001
diff
changeset
|
593 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
6842 | 594 |
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
|
595 |
|
4028
b46539f16af5
added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents:
4026
diff
changeset
|
596 |
SilentLoading := (CommandLineArguments includes:'--silentStartup'). |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
597 |
VerboseLoading := (CommandLineArguments includes:'--verboseLoading'). |
348 | 598 |
|
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
599 |
DebuggingStandAlone := false. |
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
600 |
|
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
601 |
StandAlone ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
602 |
InfoPrinting := false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
603 |
ObjectMemory infoPrinting:false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
604 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
605 |
idx := CommandLineArguments indexOf:'--debug'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
606 |
idx ~~ 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
607 |
DebuggingStandAlone := true. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
608 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
609 |
DebuggingStandAlone ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
610 |
Inspector := MiniInspector. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
611 |
Debugger := MiniDebugger. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
612 |
]. |
6841
37bc69fc9240
set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents:
6837
diff
changeset
|
613 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
614 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
615 |
"/ define low-level debugging tools - graphical classes are not prepared yet |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
616 |
"/ to handle things. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
617 |
"/ This will bring us into the MiniDebugger when an error occurs during startup. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
618 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
619 |
Inspector := MiniInspector. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
620 |
Debugger := MiniDebugger. |
11057 | 621 |
]. |
622 |
||
623 |
Error handle:[:ex | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
624 |
StandAlone ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
625 |
DebuggingStandAlone ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
626 |
'Startup Error - use --debug command line argument for more info' errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
627 |
Smalltalk exit:1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
628 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
629 |
'Startup Error' errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
630 |
thisContext fullPrintAll. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
631 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
632 |
ex reject. |
11057 | 633 |
] do:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
634 |
self basicInitializeSystem |
11057 | 635 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
636 |
|
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
637 |
"Modified: / 12-10-2010 / 11:27:47 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
638 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
639 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
640 |
isInitialized |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
641 |
"this returns true, if the system is properly initialized; |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
642 |
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
|
643 |
not working correctly until initialized." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
644 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
645 |
^ Initializing not |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
646 |
! |
1 | 647 |
|
7563 | 648 |
reinitStandardStreams |
649 |
"reinitialize some well-known streams. |
|
650 |
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
|
651 |
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
|
652 |
(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
|
653 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
654 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
161 | 655 |
! ! |
656 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
657 |
!Smalltalk class methodsFor:'Compatibility-Squeak'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
658 |
|
10560 | 659 |
at:aKey ifAbsentPut:aBlock |
11977 | 660 |
"return the element indexed by aKey if present, |
661 |
if not present, store the result of evaluating valueBlock |
|
662 |
under aKey and return it." |
|
663 |
||
10560 | 664 |
^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ]. |
665 |
||
666 |
"Created: / 29-05-2007 / 12:41:12 / cg" |
|
667 |
! |
|
668 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
669 |
beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
670 |
Screen current beep |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
671 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
672 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
673 |
garbageCollect |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
674 |
ObjectMemory garbageCollect |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
675 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
676 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
677 |
garbageCollectMost |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
678 |
"collect recently created garbage; return the amount of freeSpace. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
679 |
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
|
680 |
newSpace + freeListSpace is returned." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
681 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
682 |
ObjectMemory scavenge. |
10071 | 683 |
^ ObjectMemory freeSpace |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
684 |
+ (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed) |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
685 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
686 |
! |
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 |
isMorphic |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
689 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
690 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
691 |
|
10844 | 692 |
platformName |
693 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
694 |
||
695 |
^ OperatingSystem platformName asUppercaseFirst |
|
696 |
||
697 |
" |
|
698 |
Smalltalk platformName -> 'Win32' |
|
699 |
" |
|
700 |
! |
|
701 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
702 |
registerExternalObject: anObject |
7563 | 703 |
"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
|
704 |
If it is already there, just return its index. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
705 |
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
|
706 |
primitive code (via the global Smalltalk:SpecialObjectArray)" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
707 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
708 |
| objects firstEmptyIndex obj sz newObjects | |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
709 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
710 |
objects := SpecialObjectArray. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
711 |
objects isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
712 |
objects := Array new:5. |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
713 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
714 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
715 |
"find the first empty slot and look if already registered" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
716 |
firstEmptyIndex := 0. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
717 |
1 to: objects size do: [:i | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
718 |
obj := objects at: i. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
719 |
obj == anObject ifTrue: [^ i]. "object already there, just return its index" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
720 |
(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
721 |
firstEmptyIndex := i |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
722 |
] |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
723 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
724 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
725 |
"if no empty slots, expand the array" |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
726 |
firstEmptyIndex = 0 ifTrue: [ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
727 |
sz := objects size. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
728 |
newObjects := objects species new: sz + 20. "grow linearly" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
729 |
newObjects replaceFrom: 1 to: sz with: objects startingAt: 1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
730 |
firstEmptyIndex := sz + 1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
731 |
SpecialObjectArray := newObjects. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
732 |
objects := newObjects |
4584
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
733 |
]. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
734 |
|
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
735 |
objects at: firstEmptyIndex put: anObject. |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
736 |
^ firstEmptyIndex |
789c83e8cae0
some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
4524
diff
changeset
|
737 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
738 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
739 |
|
12358 | 740 |
removeClassNamed: aName |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
741 |
"Invoked from fileouts: if there is currently a class in the system named aName, then remove it. |
12358 | 742 |
If anything untoward happens, report it in the Transcript. " |
743 |
||
744 |
| oldClass | |
|
745 |
||
746 |
(oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
747 |
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
|
748 |
^ self |
12358 | 749 |
]. |
750 |
oldClass removeFromSystem |
|
751 |
! |
|
752 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
753 |
renameClassNamed:oldName as:newName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
754 |
self renameClass:(self at:oldName) to:newName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
755 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
756 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
757 |
unregisterExternalObject: anObject |
10071 | 758 |
"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
|
759 |
Do nothing if it isn't registered." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
760 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
761 |
|objects| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
762 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
763 |
anObject isNil ifTrue:[^ self]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
764 |
objects := SpecialObjectArray. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
765 |
1 to: objects size do: [:i | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
766 |
(objects at: i) == anObject ifTrue: [ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
767 |
objects at: i put: nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
768 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
769 |
]. |
10844 | 770 |
! |
771 |
||
772 |
windowSystemName |
|
773 |
"not yet fully implemented (I have to figure out, what squeak returns in each case...)" |
|
774 |
||
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
775 |
|platformName| |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
776 |
|
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
777 |
platformName := Screen current platformName. |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
778 |
platformName = #WIN32 ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
779 |
^ #Win32. |
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
780 |
]. |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
781 |
^ platformName. |
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
782 |
|
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
783 |
" |
11375 | 784 |
Smalltalk windowSystemName |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
785 |
-> 'Win32' |
10844 | 786 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
787 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
788 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
789 |
!Smalltalk class methodsFor:'Compatibility-V''Age'! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
790 |
|
7563 | 791 |
allClassesImplementing:aSelector |
12304
b0dc1c58de1a
changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents:
12301
diff
changeset
|
792 |
^ self allClassesForWhich:[:cls | cls includesSelector:aSelector]. |
9506 | 793 |
|
794 |
"Modified: / 10-08-2006 / 12:12:17 / cg" |
|
9090 | 795 |
! |
796 |
||
797 |
declareConstant:constantName poolName:poolName value:value |
|
798 |
|pool| |
|
799 |
||
800 |
pool := self classNamed:poolName. |
|
801 |
pool declareConstant:constantName value:value |
|
802 |
! |
|
803 |
||
804 |
declarePoolDictionary:poolDictionaryName |
|
13998
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
805 |
^ SharedPool subclass:(poolDictionaryName asSymbol) |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
806 |
instanceVariableNames:'' |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
807 |
classVariableNames:'' |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
808 |
poolDictionaries:'' |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
809 |
category:nil |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
810 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
811 |
"Modified: / 07-02-2012 / 15:56:16 / cg" |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
812 |
! |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
813 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
814 |
declareVariable:varName poolName:poolName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
815 |
|pool| |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
816 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
817 |
pool := self classNamed:poolName. |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
818 |
pool declareVariable:varName |
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
819 |
|
890d42903662
added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents:
13958
diff
changeset
|
820 |
"Created: / 07-02-2012 / 15:57:05 / cg" |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
821 |
! ! |
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
822 |
|
7295 | 823 |
!Smalltalk class methodsFor:'Compatibility-VW5.4'! |
6094
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
824 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
825 |
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
|
826 |
^ self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
827 |
defineClass:nameSymbol |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
828 |
superclass:superclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
829 |
indexedType:indexed |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
830 |
private:private |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
831 |
instanceVariableNames:instVars |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
832 |
classInstanceVariableNames:classInstVars |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
833 |
imports:imports |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
834 |
category:category |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
835 |
attributes:nil |
12033 | 836 |
! |
837 |
||
7563 | 838 |
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
|
839 |
|newClass| |
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
840 |
|
79ebf84b51bd
first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents:
6080
diff
changeset
|
841 |
indexed == #none ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
842 |
newClass := superclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
843 |
subclass:nameSymbol |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
844 |
instanceVariableNames:instVars |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
845 |
classVariableNames:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
846 |
poolDictionaries:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
847 |
category:category |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
848 |
inEnvironment:self. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
849 |
classInstVars size > 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
850 |
newClass class instanceVariableNames:classInstVars. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
851 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
852 |
^ newClass |
6851 | 853 |
]. |
854 |
self shouldImplement. |
|
12033 | 855 |
! |
856 |
||
857 |
defineNameSpace:nameSymbol private:private imports:imports category:category |
|
858 |
|newNameSpace| |
|
859 |
||
860 |
private ifTrue:[self halt]. "/ what to do ? |
|
861 |
imports withoutSeparators notEmpty ifTrue:[self halt]. "/ what to do ? |
|
862 |
newNameSpace := NameSpace name:nameSymbol. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
863 |
newNameSpace setCategory:category. |
12033 | 864 |
^ newNameSpace |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
865 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
866 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
867 |
!Smalltalk class methodsFor:'accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
868 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
869 |
associationAt:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
870 |
"return a key-value association for aKey. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
871 |
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
|
872 |
simulated here." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
873 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
874 |
|val| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
875 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
876 |
val := self at:aKey ifAbsent:nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
877 |
val isNil ifTrue:[^ nil]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
878 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
879 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
880 |
"Created: / 1.11.1997 / 13:27:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
881 |
! |
3083 | 882 |
|
7563 | 883 |
associationAt:aKey ifAbsent:exceptionBlock |
884 |
"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
|
885 |
from exceptionBlock, if no such key is present. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
886 |
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
|
887 |
simulated here." |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
888 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
889 |
|val| |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
890 |
|
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
891 |
val := self at:aKey ifAbsent:nil. |
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
892 |
val isNil ifTrue:[^ exceptionBlock value]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
893 |
^ Association key:aKey value:val |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
894 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
895 |
"Created: / 18.6.1998 / 17:05:24 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
896 |
! |
3610
12f32c1fe72b
added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents:
3565
diff
changeset
|
897 |
|
7563 | 898 |
at:aKey |
10071 | 899 |
"retrieve the value stored under aKey, a symbol. |
900 |
Return nil if not present |
|
1956 | 901 |
(this will be changed to trigger an error - better use #at:ifAbsent:)" |
453 | 902 |
|
6851 | 903 |
aKey class == String ifTrue:[self error:'expected symbol']. |
6080
15ea3cbf6003
renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents:
6074
diff
changeset
|
904 |
|
453 | 905 |
%{ /* NOCONTEXT */ |
906 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
5406 | 907 |
%}. |
5410 | 908 |
^ self primitiveFailed |
453 | 909 |
! |
910 |
||
7563 | 911 |
at:aKey ifAbsent:aBlock |
912 |
"retrieve the value stored at aKey. |
|
7565 | 913 |
If there is nothing stored under this key, return the value of |
914 |
the evaluation of aBlock." |
|
453 | 915 |
|
916 |
(self includesKey:aKey) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
917 |
^ self at:aKey |
453 | 918 |
]. |
919 |
^ aBlock value |
|
920 |
||
921 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
922 |
Smalltalk at:#fooBar <- returns nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
923 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
924 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
925 |
! |
453 | 926 |
|
7563 | 927 |
at:aKey ifPresent:aBlock |
928 |
"try to retrieve the value stored at aKey. |
|
929 |
If there is nothing stored under this key, do nothing. |
|
4870 | 930 |
Otherwise, evaluate aBlock, passing the retrieved value as argument." |
931 |
||
13883 | 932 |
|val| |
933 |
||
4870 | 934 |
(self includesKey:aKey) ifTrue:[ |
13883 | 935 |
(val := self at:aKey) notNil ifTrue:[ |
936 |
^ aBlock value:val |
|
937 |
] |
|
4870 | 938 |
]. |
939 |
^ nil |
|
940 |
||
941 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
942 |
Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
943 |
Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
944 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
945 |
|
13883 | 946 |
"Modified: / 27-12-2011 / 10:14:30 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
947 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
948 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
949 |
at:aKey put:aValue |
7563 | 950 |
"store the argument aValue under aKey, a symbol. |
951 |
Return aValue (sigh)." |
|
453 | 952 |
|
953 |
|oldValue| |
|
954 |
||
955 |
%{ |
|
956 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
957 |
%}. |
|
958 |
CachedClasses notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
959 |
oldValue isBehavior ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
960 |
oldValue name == aKey ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
961 |
CachedClasses remove:oldValue ifAbsent:[] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
962 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
963 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
964 |
aValue isBehavior ifTrue:[ |
1956 | 965 |
"/ aValue isMeta ifTrue:[ |
966 |
"/ "/ this should not happen |
|
967 |
"/ ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR. |
|
968 |
"/ ]. |
|
969 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
970 |
aValue name == aKey ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
971 |
CachedClasses add:aValue |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
972 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
973 |
CachedClasses := nil |
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 |
]. |
453 | 976 |
]. |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
977 |
^ aValue. |
1955 | 978 |
"/ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
979 |
"/%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
980 |
"/ (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
981 |
"/%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
982 |
"/ CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
983 |
"/ ^ aValue |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
984 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
985 |
"Modified: 19.4.1996 / 11:31:49 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
986 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
987 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
988 |
includesKey:aKey |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
989 |
"return true, if the key is known" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
990 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
991 |
"/ for debugging - this is a common mistake, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
992 |
"/ to try to access a class by nameString, instead |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
993 |
"/ of by symbol. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
994 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
995 |
"/ aKey class == String ifTrue:[self halt]. |
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 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
998 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
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 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1001 |
! |
453 | 1002 |
|
7563 | 1003 |
keyAtValue:anObject |
1004 |
"return the symbol under which anObject is stored - or nil" |
|
453 | 1005 |
|
1006 |
self keysDo:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1007 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
453 | 1008 |
]. |
1009 |
^ nil |
|
1010 |
||
1011 |
"Smalltalk keyAtValue:Object" |
|
1012 |
! |
|
1013 |
||
7563 | 1014 |
keys |
1015 |
"return a collection with all keys in the Smalltalk dictionary" |
|
1016 |
||
1017 |
|keys| |
|
453 | 1018 |
|
1019 |
keys := IdentitySet new. |
|
1020 |
self keysDo:[:k | keys add:k]. |
|
1021 |
^ keys |
|
617 | 1022 |
! |
1023 |
||
7563 | 1024 |
removeKey:aKey |
1025 |
"remove the association stored under the key-argument from the globals dictionary. |
|
10071 | 1026 |
WARNING: |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1027 |
this is somewhat dangerous: conceptionally, the association is removed, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1028 |
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
|
1029 |
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
|
1030 |
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
|
1031 |
value. (which is correct) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1032 |
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
|
1033 |
the new global now referenced via the new association. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1034 |
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
|
1035 |
(this is questionable). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1036 |
To avoid this problem, the #removeClass: method never removed the key." |
617 | 1037 |
|
1038 |
CachedClasses := nil. |
|
1039 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1040 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1041 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1042 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1043 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1044 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1045 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1046 |
|
10538 | 1047 |
startBlocks |
1048 |
^ StartBlocks |
|
1049 |
! |
|
1050 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1051 |
values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1052 |
"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
|
1053 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1054 |
|values| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1055 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1056 |
values := OrderedCollection new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1057 |
self do:[:v | values add:v]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1058 |
^ values |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1059 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1060 |
"Created: 20.6.1997 / 16:58:28 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1061 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1062 |
|
13540 | 1063 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1064 |
!Smalltalk class methodsFor:'browsing'! |
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 |
browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1067 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1068 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1069 |
"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
|
1070 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1071 |
UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1072 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1073 |
" |
10071 | 1074 |
Smalltalk browseAllCallsOn:#at:put: |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1075 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1076 |
! |
617 | 1077 |
|
7563 | 1078 |
browseAllSelect:aBlock |
1079 |
"{ Pragma: +optSpace }" |
|
1080 |
||
1081 |
"startup a browser for all methods for which aBlock returns true" |
|
617 | 1082 |
|
6020 | 1083 |
UserPreferences systemBrowserClass browseAllSelect:aBlock |
617 | 1084 |
|
1085 |
" |
|
1086 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
1087 |
" |
|
1088 |
! |
|
1089 |
||
7563 | 1090 |
browseChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1091 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1092 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1093 |
"startup a changes browser" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1094 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1095 |
ChangesBrowser notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1096 |
ChangesBrowser open |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1097 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1098 |
self warn:'no ChangesBrowser built in' |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1099 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1100 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1101 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1102 |
Smalltalk browseChanges |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1103 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1104 |
! |
453 | 1105 |
|
7563 | 1106 |
browseClass:aClass |
1107 |
"{ Pragma: +optSpace }" |
|
1108 |
||
11375 | 1109 |
"startup a browser on aClass. |
11150 | 1110 |
The broser will only show that class (i.e. be a singleClass-browser). |
1111 |
See browseInClass: for a full browser, which has aClass selected initially." |
|
6970 | 1112 |
|
1113 |
UserPreferences systemBrowserClass browseClass:aClass |
|
1114 |
||
1115 |
" |
|
10071 | 1116 |
Smalltalk browseClass:Array |
6970 | 1117 |
" |
1118 |
! |
|
1119 |
||
7563 | 1120 |
browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
1121 |
"{ Pragma: +optSpace }" |
|
6819 | 1122 |
|
1123 |
"startup a browser for all methods implementing a message matching" |
|
1124 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1125 |
UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1126 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1127 |
" |
10071 | 1128 |
Smalltalk browseImplementorsOf:#'at:put:' |
1129 |
Smalltalk browseImplementorsMatching:#'at:*' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1130 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1131 |
! |
6819 | 1132 |
|
7563 | 1133 |
browseImplementorsOf:aSelectorSymbol |
1134 |
"{ Pragma: +optSpace }" |
|
1135 |
||
1136 |
"startup a browser for all methods implementing a particular message" |
|
453 | 1137 |
|
6020 | 1138 |
UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol |
453 | 1139 |
|
1140 |
" |
|
10071 | 1141 |
Smalltalk browseImplementorsOf:#at:put: |
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 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1144 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1145 |
browseInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1146 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1147 |
|
11150 | 1148 |
"startup a full browser showing aClass. |
1149 |
The browser will be a full browser with aClass initially selekted. |
|
1150 |
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
|
1151 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1152 |
UserPreferences systemBrowserClass openInClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1153 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1154 |
" |
10071 | 1155 |
Smalltalk browseInClass:Array |
8583
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 |
! |
6970 | 1158 |
|
7563 | 1159 |
browseInClass:aClass selector:selector |
1160 |
"{ Pragma: +optSpace }" |
|
1161 |
||
11150 | 1162 |
"startup a full browser showing aClass>>selector. |
1163 |
The browser will be a full browser with aClass initially selekted. |
|
1164 |
See browseClass: for a singleClass browser, which shows only a single class." |
|
6970 | 1165 |
|
1166 |
UserPreferences systemBrowserClass openInClass:aClass selector:selector |
|
1167 |
||
1168 |
" |
|
1169 |
Smalltalk browseInClass:Array selector:#at: |
|
1170 |
" |
|
453 | 1171 |
! ! |
1172 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1173 |
!Smalltalk class methodsFor:'class management'! |
453 | 1174 |
|
7563 | 1175 |
changeCategoryOf:aClass to:newCategory |
1176 |
"change a classes category, add a change record, |
|
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1177 |
send change notifications" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1178 |
|
8405 | 1179 |
|ns oldCategory| |
1180 |
||
1181 |
oldCategory := aClass category. |
|
1182 |
oldCategory ~= newCategory ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1183 |
aClass category:(newCategory withoutSeparators asSymbol). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1184 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1185 |
"notify change of category" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1186 |
ns := aClass environment ? self. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1187 |
ns changed:#organization with:(aClass -> oldCategory). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1188 |
ns ~~ self ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1189 |
self changed:#organization with:(aClass -> oldCategory). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1190 |
] |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1191 |
]. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1192 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1193 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1194 |
Smalltalk changeCategoryOf:NewApplication to:#myApplications |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1195 |
" |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1196 |
|
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1197 |
"Modified: / 11.2.2000 / 11:36:27 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1198 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1199 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1200 |
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
|
1201 |
NameSpace name:name |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1202 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1203 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1204 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1205 |
flushCachedClass:aClass |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1206 |
CachedClasses notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1207 |
CachedClasses remove:aClass ifAbsent:[]. |
12700 | 1208 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1209 |
! |
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 |
flushCachedClasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1212 |
CachedClasses := nil. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1213 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1214 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1215 |
Smalltalk flushCachedClasses |
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 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1218 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1219 |
removeClass:aClass |
7563 | 1220 |
"remove the argument, aClass from the smalltalk dictionary; |
453 | 1221 |
we have to flush the caches since these methods are now void. |
1222 |
Also, class variables of aClass are removed." |
|
1223 |
||
4781 | 1224 |
|sym cSym names oldName oldNameSym actualName wrongName ns ons| |
453 | 1225 |
|
4099 | 1226 |
aClass isNil ifTrue:[^ self]. |
4781 | 1227 |
|
453 | 1228 |
oldName := aClass name. |
4781 | 1229 |
sym := oldNameSym := oldName asSymbol. |
1230 |
((self at:oldNameSym) == aClass) ifFalse:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1231 |
"check other name ..." |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1232 |
(self includes:aClass) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1233 |
'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1234 |
^ self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1235 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1236 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1237 |
the class has changed its name - without telling me ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1238 |
what should be done in this case ? |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1239 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1240 |
'Smalltalk [warning]: class ' errorPrint. oldName errorPrint. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1241 |
' has changed its name' errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1242 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1243 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1244 |
"/ might be an alias (i.e. removing a compatibility name) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1245 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1246 |
actualName := self keyAtValue:aClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1247 |
('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1248 |
sym := actualName asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1249 |
oldName := actualName asString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1250 |
wrongName := true. |
453 | 1251 |
]. |
1252 |
||
4781 | 1253 |
ns := aClass nameSpace. |
1254 |
aClass topOwningClass notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1255 |
ons := aClass topOwningClass nameSpace |
4781 | 1256 |
]. |
1257 |
||
453 | 1258 |
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
|
1259 |
|
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1260 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1261 |
"/ 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
|
1262 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1263 |
"/ 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
|
1264 |
"/ still compiled code references." |
453 | 1265 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1266 |
"remove private classes" |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1267 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1268 |
aClass privateClassesSorted do:[:somePrivateClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1269 |
aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1270 |
]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1271 |
|
453 | 1272 |
"remove class variables" |
1273 |
||
1274 |
names := aClass classVariableString asCollectionOfWords. |
|
1275 |
names do:[:name | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1276 |
cSym := aClass globalKeyForClassVar:name. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1277 |
self at:cSym asSymbol put:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1278 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1279 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1280 |
"/ see comment in removeKey: on why we dont remove it here |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1281 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1282 |
"/ self removeKey:cSym |
453 | 1283 |
]. |
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1284 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1285 |
|
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1286 |
"/ actually could get along with less flushing |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1287 |
"/ (entries for aClass and subclasses only) |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1288 |
"/ 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
|
1289 |
"/ 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
|
1290 |
"/ expensive then cache flushing. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1291 |
"/ |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1292 |
"/ aClass allSubclassesDo:[:aSubclass | |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1293 |
"/ ObjectMemory flushInlineCachesForClass:aSubclass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1294 |
"/ ObjectMemory flushMethodCacheFor:aSubclass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1295 |
"/ ]. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1296 |
"/ ObjectMemory flushInlineCachesForClass:aClass. |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1297 |
"/ ObjectMemory flushMethodCacheFor:aClass |
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1298 |
|
453 | 1299 |
ObjectMemory flushInlineCaches. |
1300 |
ObjectMemory flushMethodCache. |
|
1301 |
||
7181 | 1302 |
aClass addChangeRecordForClassRemove. |
453 | 1303 |
self changed:#classRemove with:aClass. |
1304 |
||
7581
6912a7336e15
class category: sends a change notification;
Claus Gittinger <cg@exept.de>
parents:
7572
diff
changeset
|
1305 |
aClass setCategory:#'* removed *'. |
1655 | 1306 |
|
12700 | 1307 |
"/ self flushCachedClasses. |
1308 |
"/ Class flushSubclassInfo. |
|
1309 |
self flushCachedClass:aClass. |
|
1310 |
Class flushSubclassInfoFor:aClass superclass. |
|
1311 |
Class flushSubclassInfoFor:aClass. |
|
5326 | 1312 |
|
3627
452f2e1ff1b4
removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents:
3626
diff
changeset
|
1313 |
wrongName == true ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1314 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1315 |
"/ an alias (i.e. removing a compatibility name) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1316 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1317 |
"/ check if there are more refs to it ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1318 |
[self includes:aClass] whileTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1319 |
actualName := self keyAtValue:aClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1320 |
('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1321 |
, ' - remove that binding too.') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1322 |
self at:actualName put:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1323 |
]. |
4724
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1324 |
]. |
44793fe70787
recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents:
4723
diff
changeset
|
1325 |
|
4781 | 1326 |
ns ~~ Smalltalk ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1327 |
ons notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1328 |
ClassBuilder |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1329 |
recompileGlobalAccessorsTo:oldNameSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1330 |
in:ons |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1331 |
except:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1332 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1333 |
(ns notNil and:[ns ~~ ons]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1334 |
ClassBuilder |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1335 |
recompileGlobalAccessorsTo:oldNameSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1336 |
in:ns |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1337 |
except:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1338 |
]. |
10182 | 1339 |
]. |
1340 |
||
1341 |
"Modified: / 18-11-2006 / 17:16:31 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1342 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1343 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1344 |
renameClass:aClass to:newName |
7563 | 1345 |
"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
|
1346 |
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
|
1347 |
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
|
1348 |
|
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1349 |
|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
|
1350 |
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
|
1351 |
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
|
1352 |
oldMetaclass newMetaclass newCategory| |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1353 |
|
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1354 |
"/ check for all intermediate namespaces / owning classes |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1355 |
i1 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1356 |
i2 := 1. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1357 |
ns := self. |
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1358 |
[i2 ~~ 0] whileTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1359 |
i2 := newName indexOfSubCollection:'::' startingAt:i1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1360 |
i2 ~~ 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1361 |
nm := newName copyFrom:i1 to:i2-1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1362 |
ns isNameSpace ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1363 |
subns := ns at:nm asSymbol ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1364 |
subns isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1365 |
self error:'Nonexisting namespace: ',nm. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1366 |
^ nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1367 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1368 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1369 |
subns := ns privateClassesAt:nm asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1370 |
subns isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1371 |
self error:'Cannot create a namespace below a class' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1372 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1373 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1374 |
ns := subns. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1375 |
i1 := i2 + 2. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1376 |
]. |
5253
c6b2933882fe
rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents:
5247
diff
changeset
|
1377 |
]. |
617 | 1378 |
|
1379 |
oldName := aClass name. |
|
6734 | 1380 |
oldNameSpace := aClass topNameSpace. |
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1381 |
oldBaseName := aClass nameWithoutNameSpacePrefix. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1382 |
oldBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
617 | 1383 |
oldSym := oldName asSymbol. |
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1384 |
privateClasses := aClass privateClassesSorted. |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1385 |
|
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1386 |
((self at:oldSym) ~~ aClass) ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1387 |
'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1388 |
^ self |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1389 |
]. |
617 | 1390 |
|
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1391 |
"/ rename the class |
617 | 1392 |
|
1847
6e567214b167
care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents:
1758
diff
changeset
|
1393 |
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
|
1394 |
|
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1395 |
"/ change the owning class |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1396 |
ns isNameSpace ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1397 |
aClass isPrivate ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1398 |
aClass class setOwningClass:ns. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1399 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1400 |
"/ sigh - must make a PrivateMetaclass from Metaclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1401 |
oldMetaclass := aClass class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1402 |
newMetaclass := PrivateMetaclass new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1403 |
newMetaclass flags:(oldMetaclass flags). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1404 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1405 |
newMetaclass instSize:(oldMetaclass instSize). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1406 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1407 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1408 |
newMetaclass setSoleInstance:aClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1409 |
newMetaclass setOwningClass:ns. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1410 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1411 |
aClass changeClassTo:newMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1412 |
ObjectMemory flushCaches. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1413 |
] |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1414 |
] ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1415 |
aClass isPrivate ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1416 |
newCategory := aClass topOwningClass category. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1417 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1418 |
"/ sigh - must make a Metaclass from PrivateMetaclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1419 |
oldMetaclass := aClass class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1420 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1421 |
newMetaclass := Metaclass new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1422 |
newMetaclass flags:(oldMetaclass flags). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1423 |
newMetaclass setSuperclass:(oldMetaclass superclass). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1424 |
newMetaclass instSize:(oldMetaclass instSize). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1425 |
newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1426 |
newMetaclass setMethodDictionary:(oldMetaclass methodDictionary). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1427 |
newMetaclass setSoleInstance:aClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1428 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1429 |
aClass category:newCategory. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1430 |
aClass changeClassTo:newMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1431 |
ObjectMemory flushCaches. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1432 |
] |
5610
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1433 |
]. |
af0d91fe32fc
rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents:
5601
diff
changeset
|
1434 |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1435 |
aClass setName:newSym. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1436 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1437 |
"/ store it in Smalltalk |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1438 |
self at:oldSym put:nil. |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
1439 |
|
878
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1440 |
"/ |
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1441 |
"/ 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
|
1442 |
"/ |
c09b016c6674
do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents:
857
diff
changeset
|
1443 |
"/ self removeKey:oldSym. |
617 | 1444 |
self at:newSym put:aClass. |
1445 |
||
1525
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1446 |
"/ 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
|
1447 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1448 |
oldNameToNewName := IdentityDictionary new. |
617 | 1449 |
|
1450 |
names := aClass classVariableString asCollectionOfWords. |
|
1451 |
names do:[:name | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1452 |
oldCVSym := (oldSym , ':' , name) asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1453 |
value := self at:oldCVSym. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1454 |
self at:oldCVSym put:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1455 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1456 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1457 |
"/ see comment in #removeKey: on why we dont remove it it here |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1458 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1459 |
"/ self removeKey:cSym. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1460 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1461 |
newCVSym := (newSym , ':' , name) asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1462 |
self at:newCVSym put:value. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1463 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1464 |
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
|
1465 |
]. |
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1466 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1467 |
"/ 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
|
1468 |
|
935b12ecf8ff
in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents:
1481
diff
changeset
|
1469 |
oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1470 |
aClass withAllSubclasses do:[:aSubClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1471 |
Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1472 |
aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1473 |
aMethod changeLiteral:oldNameSym to:newNameSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1474 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1475 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1476 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1477 |
"/ and also in privateClasses ? ... |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1478 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1479 |
"/ privateClasses size > 0 ifTrue:[ |
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1480 |
"/ privateClasses do:[:aPrivateClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1481 |
"/ aPrivateClass withAllSubclasses do:[:aSubClass | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1482 |
"/ aSubClass class methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1483 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1484 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1485 |
"/ aSubClass methodDictionary do:[:aMethod | |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1486 |
"/ aMethod changeLiteral:oldNameSym to:newNameSym |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1487 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1488 |
"/ ]. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1489 |
"/ ] |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1490 |
"/ ] |
617 | 1491 |
]. |
1492 |
||
2270
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1493 |
aClass addChangeRecordForClassRename:oldSym to:newSym. |
76c239686353
when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents:
2249
diff
changeset
|
1494 |
|
5333
d80386e06d21
rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents:
5328
diff
changeset
|
1495 |
"/ 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
|
1496 |
aClass setEnvironment:nil. |
6734 | 1497 |
newNameSpace := aClass topNameSpace. |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1498 |
|
2485
9f4a11a4521f
new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents:
2476
diff
changeset
|
1499 |
privateClasses size > 0 ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1500 |
"/ must rename privateClasses as well |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1501 |
Class withoutUpdatingChangesDo:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1502 |
privateClasses do:[:aPrivateClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1503 |
self renameClass:aPrivateClass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1504 |
to:(newSym , '::' , aPrivateClass nameWithoutPrefix). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1505 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1506 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1507 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1508 |
aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1509 |
aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1510 |
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
|
1511 |
"/ ClassBuilder |
10071 | 1512 |
"/ recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol |
1513 |
"/ in:newNameSpace |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1514 |
"/ except:nil. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1515 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1516 |
] |
2405
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1517 |
]. |
939f4e751ef3
dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents:
2379
diff
changeset
|
1518 |
|
2319
640bb389f90a
recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents:
2317
diff
changeset
|
1519 |
oldNameSpace ~~ newNameSpace ifTrue:[ |
5246
2ca7b20c4108
create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5214
diff
changeset
|
1520 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1521 |
"/ all those referencing the class from the old nameSpace |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1522 |
"/ must be recompiled ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1523 |
"/ (to now access the global from smalltalk) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1524 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1525 |
oldNameSpace ~~ Smalltalk ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1526 |
Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1527 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1528 |
ClassBuilder |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1529 |
recompileGlobalAccessorsTo:oldName asSymbol |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1530 |
in:oldNameSpace |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1531 |
except:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1532 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1533 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1534 |
"/ all referencing the class in the new namespace |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1535 |
"/ as well; to now access the new class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1536 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1537 |
(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1538 |
Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1539 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1540 |
ClassBuilder |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1541 |
recompileGlobalAccessorsTo:oldBaseName asSymbol |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1542 |
in:newNameSpace |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1543 |
except:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1544 |
]. |
3698
8bce45214d24
fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents:
3678
diff
changeset
|
1545 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1546 |
"/ all references to a global with my new name in my owning class |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1547 |
"/ must now be redirected to myself. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1548 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1549 |
aClass isPrivate ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1550 |
newBaseName := aClass nameWithoutNameSpacePrefix. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1551 |
newBaseNameWithoutPrefix := aClass nameWithoutPrefix. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1552 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1553 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1554 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1555 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1556 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1557 |
Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1558 |
aClass owningClass recompileMethodsAccessingGlobal:oldBaseName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1559 |
aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1560 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1561 |
Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1562 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1563 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1564 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1565 |
Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1566 |
aClass owningClass recompileMethodsAccessingGlobal:newBaseName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1567 |
aClass owningClass class recompileMethodsAccessingGlobal:newBaseName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1568 |
] |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1569 |
]. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1570 |
|
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1571 |
aClass changed:#definition. |
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1572 |
"/ 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
|
1573 |
aClass allSubclassesDo:[:subClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1574 |
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
|
1575 |
]. |
facae0a118da
when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents:
7992
diff
changeset
|
1576 |
"/ 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
|
1577 |
aClass subclassesDo:[:subClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1578 |
subClass addChangeRecordForClass:subClass. |
4040
b27f87d9772d
must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
4028
diff
changeset
|
1579 |
]. |
5613
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1580 |
self changed:#definition. |
b534e427f028
change message when renaming a class
Claus Gittinger <cg@exept.de>
parents:
5611
diff
changeset
|
1581 |
Smalltalk 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
|
1582 |
|
9822
38acd1c5eeab
recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents:
9819
diff
changeset
|
1583 |
"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
|
1584 |
"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
|
1585 |
"Modified: / 05-09-2006 / 12:52:25 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1586 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1587 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1588 |
!Smalltalk class methodsFor:'copying'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1589 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1590 |
deepCopy |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1591 |
"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
|
1592 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1593 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1594 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1595 |
"Modified: 18.5.1996 / 12:13:33 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1596 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1597 |
|
10952 | 1598 |
deepCopyUsing:aDictionary postCopySelector:postCopySelector |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1599 |
"return a deep copy of the receiver. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1600 |
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
|
1601 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1602 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1603 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1604 |
"Modified: 18.5.1996 / 12:13:36 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1605 |
! |
453 | 1606 |
|
7563 | 1607 |
shallowCopy |
1608 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
617 | 1609 |
|
1610 |
^ self |
|
1410 | 1611 |
|
1612 |
"Modified: 18.5.1996 / 12:13:39 / cg" |
|
617 | 1613 |
! |
1614 |
||
7563 | 1615 |
simpleDeepCopy |
1616 |
"redefined to return self - there is only one Smalltalk dictionary" |
|
453 | 1617 |
|
1618 |
^ self |
|
1410 | 1619 |
|
1620 |
"Modified: 18.5.1996 / 12:13:42 / cg" |
|
453 | 1621 |
! ! |
1622 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
1623 |
!Smalltalk class methodsFor:'debugging ST/X'! |
453 | 1624 |
|
7563 | 1625 |
compileTrace:aBoolean |
1626 |
"dump generated inline code (NOOP if VM was compiled without the trace-debug option)" |
|
7325 | 1627 |
%{ |
1628 |
extern char __compileTrace__; |
|
1629 |
||
1630 |
__compileTrace__ = (aBoolean == true) ? 1 : 0; |
|
1631 |
%} |
|
1632 |
" |
|
1633 |
Smalltalk compileTrace:true |
|
1634 |
Smalltalk compileTrace:false |
|
1635 |
" |
|
1636 |
! |
|
1637 |
||
7563 | 1638 |
debugBreakPoint |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1639 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1640 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1641 |
"call the dummy debug function, on which a breakpoint |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1642 |
can be put in adb, sdb, dbx or gdb. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1643 |
WARNING: this method is for debugging only |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1644 |
it will be removed without notice." |
453 | 1645 |
%{ |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1646 |
__PATCHUPCONTEXTS(__context); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1647 |
__debugBreakPoint__(); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1648 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1649 |
^ self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1650 |
! |
453 | 1651 |
|
7563 | 1652 |
exitWithCoreDump |
1653 |
"{ Pragma: +optSpace }" |
|
1654 |
||
1655 |
"abort program and dump core" |
|
1656 |
||
1657 |
OperatingSystem exitWithCoreDump |
|
4096
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1658 |
"/ never returns |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1659 |
|
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1660 |
"Be careful evaluating this |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1661 |
Smalltalk exitWithCoreDump |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1662 |
" |
d292495070db
exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents:
4067
diff
changeset
|
1663 |
|
617 | 1664 |
! |
1665 |
||
7563 | 1666 |
fatalAbort |
1667 |
"{ Pragma: +optSpace }" |
|
1668 |
||
1669 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
617 | 1670 |
(You may turn off the stack print with debugPrinting:false)" |
1671 |
%{ |
|
1672 |
__fatal0(__context, "fatalAbort"); |
|
1673 |
/* NEVER RETURNS */ |
|
5410 | 1674 |
%}. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1675 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1676 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1677 |
! |
617 | 1678 |
|
7563 | 1679 |
fatalAbort:aMessage |
1680 |
"{ Pragma: +optSpace }" |
|
1681 |
||
1682 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
617 | 1683 |
(You may turn off the stack print with debugPrinting:false)" |
1684 |
||
1685 |
%{ |
|
1686 |
char *msg; |
|
1687 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
1688 |
if (__isStringLike(aMessage)) |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1689 |
msg = (char *) __stringVal(aMessage); |
617 | 1690 |
else |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1691 |
msg = "fatalAbort"; |
617 | 1692 |
|
1693 |
__fatal0(__context, msg); |
|
1694 |
/* NEVER RETURNS */ |
|
5410 | 1695 |
%}. |
1696 |
^ self primitiveFailed |
|
5441 | 1697 |
! |
1698 |
||
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1699 |
ignoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1700 |
"return true, if halts are ignored. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1701 |
Usually, this is done in standAlone applications" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1702 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1703 |
IgnoreHalt isNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1704 |
^ self isStandAloneApp |
13135
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1705 |
]. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1706 |
^ IgnoreHalt |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1707 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1708 |
"Created: / 18-11-2010 / 11:20:16 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1709 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1710 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1711 |
ignoreHalt:aBoolean |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1712 |
"control if halts are to be ignored; |
13135
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 := aBoolean |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1716 |
|
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 |
Smalltalk ignoreHalt:true. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1719 |
self halt. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1720 |
Smalltalk ignoreHalt:false. |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1721 |
self halt. |
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 |
|
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1724 |
"Created: / 18-11-2010 / 11:20:27 / cg" |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1725 |
! |
1031ffdd98fd
ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents:
13129
diff
changeset
|
1726 |
|
7563 | 1727 |
vmInstructionTrace:aBoolean |
13947 | 1728 |
self halt:'not yet implemented' |
1729 |
||
1730 |
"Modified: / 19-01-2012 / 10:15:35 / cg" |
|
7563 | 1731 |
! ! |
1732 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1733 |
!Smalltalk class methodsFor:'enumerating'! |
7563 | 1734 |
|
453 | 1735 |
allBehaviorsDo:aBlock |
5580
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1736 |
"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
|
1737 |
|
374e843aa424
allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents:
5579
diff
changeset
|
1738 |
self allClassesAndMetaclassesDo:aBlock |
453 | 1739 |
|
1740 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1741 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printCR] |
453 | 1742 |
" |
7563 | 1743 |
! |
1744 |
||
1745 |
allClassCategories |
|
1746 |
"return a set of all class categories in the system" |
|
1747 |
||
1748 |
|allCategories| |
|
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1749 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1750 |
allCategories := Set new. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1751 |
Smalltalk allClassesDo:[:cls | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1752 |
|category| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1753 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1754 |
category := cls category. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1755 |
category notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1756 |
allCategories add:category. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1757 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1758 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1759 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1760 |
^ allCategories. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1761 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1762 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1763 |
Smalltalk allClassCategories |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1764 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1765 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1766 |
"Created: / 17.11.2001 / 12:13:09 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1767 |
! |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1768 |
|
7563 | 1769 |
allClassesAndMetaclassesDo:aBlock |
1770 |
"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
|
1771 |
|
5940
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1772 |
|already| |
804fb27727a6
oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents:
5916
diff
changeset
|
1773 |
|
12861 | 1774 |
already := IdentitySet new:NumberOfClassesHint*2. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1775 |
self allClassesDo:[:eachClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1776 |
|cls| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1777 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1778 |
cls := eachClass theNonMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1779 |
(already includes:cls) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1780 |
aBlock value:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1781 |
already add:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1782 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1783 |
cls := cls class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1784 |
(already includes:cls) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1785 |
aBlock value:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1786 |
already add:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1787 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1788 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1789 |
! |
5579
26af506d271e
added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents:
5550
diff
changeset
|
1790 |
|
7563 | 1791 |
allClassesDo:aBlock |
1792 |
"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
|
1793 |
|
5765 | 1794 |
self allClasses do:aBlock |
453 | 1795 |
|
1796 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1797 |
Smalltalk allClassesDo:[:aClass | aClass name printCR] |
453 | 1798 |
" |
1799 |
! |
|
1800 |
||
9506 | 1801 |
allClassesForWhich:filter |
10071 | 1802 |
"return a collection with all classes in the system, |
9506 | 1803 |
for which filter evaluates to true." |
1804 |
||
1805 |
|collectedClasses| |
|
1806 |
||
1807 |
collectedClasses := OrderedCollection new. |
|
1808 |
self allClassesForWhich:filter do:[:cls | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1809 |
collectedClasses add:cls |
9506 | 1810 |
]. |
1811 |
^ collectedClasses |
|
1812 |
||
1813 |
" |
|
10071 | 1814 |
Smalltalk |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1815 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
9506 | 1816 |
" |
1817 |
||
1818 |
"Created: / 10-08-2006 / 12:11:31 / cg" |
|
1819 |
! |
|
1820 |
||
9292 | 1821 |
allClassesForWhich:filter do:aBlock |
1822 |
"evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true." |
|
1823 |
||
1824 |
self allClassesDo:[:cls | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1825 |
(filter value:cls) ifTrue:[ aBlock value:cls ]. |
10071 | 1826 |
]. |
1827 |
||
1828 |
" |
|
1829 |
Smalltalk |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1830 |
allClassesForWhich:[:cls | cls name startsWith:'Po'] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1831 |
do:[:aClass | Transcript showCR:aClass name] |
9292 | 1832 |
" |
1833 |
! |
|
1834 |
||
7563 | 1835 |
allClassesInCategory:aCategory |
1836 |
"return a collection of for all classes in aCategory; |
|
1299 | 1837 |
The order of the classes is not defined." |
1838 |
||
9506 | 1839 |
^ self allClassesForWhich:[:cls | cls category = aCategory] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1840 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1841 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1842 |
Smalltalk allClassesInCategory:'Views-Basic' |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1843 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1844 |
|
9506 | 1845 |
"Modified: / 10-08-2006 / 12:13:32 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1846 |
! |
1299 | 1847 |
|
7563 | 1848 |
allClassesInCategory:aCategory do:aBlock |
1849 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
453 | 1850 |
The order of the classes is not defined." |
1851 |
||
1852 |
aCategory notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1853 |
self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock |
453 | 1854 |
] |
1855 |
||
1856 |
" |
|
9490 | 1857 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass] |
1858 |
" |
|
1859 |
||
1860 |
"Modified: / 09-08-2006 / 17:18:50 / fm" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1861 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1862 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1863 |
allClassesInCategory:aCategory inOrderDo:aBlock |
7563 | 1864 |
"evaluate the argument, aBlock for all classes in aCategory; |
453 | 1865 |
superclasses come first - then subclasses" |
1866 |
||
1867 |
|classes| |
|
1868 |
||
1869 |
aCategory notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1870 |
classes := OrderedCollection new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1871 |
self allClassesInCategory:aCategory do:[:aClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1872 |
classes add:aClass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1873 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1874 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1875 |
classes do:aBlock |
453 | 1876 |
] |
1877 |
||
1878 |
" |
|
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1879 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR] |
453 | 1880 |
" |
6217
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1881 |
|
e0f4f3959c49
reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents:
6188
diff
changeset
|
1882 |
"Modified: / 17.11.2001 / 12:18:15 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1883 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1884 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1885 |
allClassesInOrderDo:aBlock |
7563 | 1886 |
"evaluate the argument, aBlock for all classes in the system; |
5406 | 1887 |
Evaluation order is by inheritance: superclasses come first." |
1888 |
||
1889 |
|already| |
|
1890 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1891 |
already := IdentitySet new:NumberOfClassesHint. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1892 |
self allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1893 |
(already includes:eachClass) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1894 |
eachClass allSuperclasses reverseDo:[:eachSuperClass | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1895 |
(already includes:eachSuperClass) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1896 |
already add:eachSuperClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1897 |
aBlock value:eachSuperClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1898 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1899 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1900 |
already add:eachClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1901 |
aBlock value:eachClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1902 |
] |
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1903 |
]. |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1904 |
|
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1905 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
1906 |
Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name] |
5406 | 1907 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1908 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1909 |
|
9506 | 1910 |
allClassesInPackage:aPackageID |
1911 |
"evaluate the argument, aBlock for all classes a package; |
|
10087 | 1912 |
The order of the classes is not defined. |
1913 |
The returned collection may include private classes" |
|
9506 | 1914 |
|
1915 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] |
|
1916 |
||
1917 |
" |
|
10071 | 1918 |
Smalltalk allClassesInPackage:'bosch:dapasx' |
9506 | 1919 |
" |
1920 |
||
1921 |
"Created: / 10-08-2006 / 12:14:10 / cg" |
|
10087 | 1922 |
"Modified: / 12-10-2006 / 23:48:43 / cg" |
9506 | 1923 |
! |
1924 |
||
9490 | 1925 |
allClassesInPackage:aPackageID do:aBlock |
1926 |
"evaluate the argument, aBlock for all classes a package; |
|
1927 |
The order of the classes is not defined." |
|
1928 |
||
1929 |
^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock |
|
1930 |
||
1931 |
" |
|
10071 | 1932 |
Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass] |
9490 | 1933 |
" |
1934 |
||
1935 |
"Created: / 09-08-2006 / 17:14:17 / fm" |
|
1936 |
! |
|
1937 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1938 |
allKeysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1939 |
"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
|
1940 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1941 |
^ self keysDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1942 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1943 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1944 |
allMethodCategories |
12298 | 1945 |
"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
|
1946 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1947 |
|allCategories| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1948 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1949 |
allCategories := Set new. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1950 |
Smalltalk allClassesDo:[:cls | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1951 |
allCategories addAll:cls categories. |
8583
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 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1954 |
^ allCategories. |
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 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
1957 |
Smalltalk allMethodCategories |
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 |
! |
6722
8388292bc41d
allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents:
6715
diff
changeset
|
1960 |
|
9259 | 1961 |
allMethodsDo:aBlock |
12298 | 1962 |
"enumerate all methods in all classes" |
12000 | 1963 |
|
9259 | 1964 |
Smalltalk allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1965 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1966 |
aBlock value:mthd |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1967 |
] |
12298 | 1968 |
]. |
1969 |
! |
|
1970 |
||
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
1971 |
allMethodsWithSelectorDo:aTwoArgBlock |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1972 |
"enumerate all methods in all classes and evaluate aBlock |
12300
e72e90ea410f
changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents:
12299
diff
changeset
|
1973 |
with method and selector as arguments." |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1974 |
|
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1975 |
Smalltalk allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1976 |
eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1977 |
aTwoArgBlock value:mthd value:sel |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1978 |
] |
12299
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1979 |
]. |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1980 |
! |
3ed13f5685b9
added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents:
12298
diff
changeset
|
1981 |
|
7563 | 1982 |
associationsDo:aBlock |
10071 | 1983 |
"evaluate the argument, aBlock for all key/value pairs |
617 | 1984 |
in the Smalltalk dictionary" |
1985 |
||
1986 |
self keysDo:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
1987 |
aBlock value:(aKey -> (self at:aKey)) |
617 | 1988 |
] |
1989 |
||
2588
090cf1da8036
handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents:
2572
diff
changeset
|
1990 |
"Smalltalk associationsDo:[:assoc | assoc printCR]" |
617 | 1991 |
! |
1992 |
||
7563 | 1993 |
basicKeys |
1994 |
"for rel > 5 only" |
|
1995 |
||
1996 |
self primitiveFailed |
|
1997 |
||
1998 |
||
1999 |
||
2000 |
||
2001 |
||
2002 |
||
2003 |
! |
|
2004 |
||
2005 |
do:aBlock |
|
2006 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
617 | 2007 |
|
2008 |
|work| |
|
2009 |
||
2010 |
%{ /* 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
|
2011 |
__GLOBALS_DO(&aBlock, &work); |
5406 | 2012 |
RETURN (self); |
2013 |
%}. |
|
2014 |
self keysDo:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2015 |
aBlock value:(self at:aKey) |
5406 | 2016 |
] |
617 | 2017 |
! |
2018 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2019 |
keysAndValuesDo:aBlock |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2020 |
"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
|
2021 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2022 |
self keysDo:[:aKey | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2023 |
aBlock value:aKey value:(self at:aKey) |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2024 |
] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2025 |
! |
617 | 2026 |
|
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2027 |
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2028 |
|collected| |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2029 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2030 |
collected := OrderedCollection new. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2031 |
self keysAndValuesDo:[:eachKey :eachValue | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2032 |
(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2033 |
collected add:(collectBlockWith2Args value:eachKey value:eachValue) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2034 |
]. |
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2035 |
]. |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2036 |
^ collected |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2037 |
|
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2038 |
" |
10071 | 2039 |
Smalltalk |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2040 |
keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2041 |
thenCollect:[:nm :val | nm] |
9077
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2042 |
" |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2043 |
! |
327b64542a83
+keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents:
9054
diff
changeset
|
2044 |
|
7563 | 2045 |
keysDo:aBlock |
2046 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
617 | 2047 |
|work| |
2048 |
||
2049 |
%{ /* 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
|
2050 |
__GLOBALKEYS_DO(&aBlock, &work); |
5406 | 2051 |
RETURN (self); |
2052 |
%}. |
|
2053 |
self basicKeys do:[:aKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2054 |
aBlock value:aKey |
5406 | 2055 |
] |
453 | 2056 |
! ! |
2057 |
||
10169 | 2058 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2059 |
!Smalltalk class methodsFor:'message control'! |
453 | 2060 |
|
7563 | 2061 |
silentLoading |
12408 | 2062 |
"returns the Silentloading class variable, which globally controls if compilation |
2063 |
messages are shown on the transcript during a fileIn." |
|
7563 | 2064 |
|
10355
b1cb807fd03c
Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents:
10329
diff
changeset
|
2065 |
^ SilentLoading ? false |
7563 | 2066 |
! |
2067 |
||
2068 |
silentLoading:aBoolean |
|
2069 |
"{ Pragma: +optSpace }" |
|
2070 |
||
2071 |
"allows access to the Silentloading class variable, which controls |
|
12408 | 2072 |
messages (especially during fileIn) onto the transcript. |
453 | 2073 |
You can save a snapshot with this flag set to true, which makes |
2074 |
the image come up silent. Can also be set, to read in files unlogged." |
|
2075 |
||
2076 |
|prev| |
|
2077 |
||
2078 |
prev := SilentLoading. |
|
2079 |
SilentLoading := aBoolean. |
|
2080 |
^ prev |
|
12409 | 2081 |
! |
2082 |
||
2083 |
silentlyLoadingDo:aBlock |
|
2084 |
"evaluates aBlock with silent loading on - no compilation messages (except errors) |
|
2085 |
are shown on the transcript" |
|
2086 |
||
2087 |
|sav| |
|
2088 |
||
2089 |
sav := SilentLoading. |
|
2090 |
SilentLoading := true. |
|
2091 |
aBlock ensure:[ SilentLoading := sav ]. |
|
453 | 2092 |
! ! |
2093 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2094 |
!Smalltalk class methodsFor:'misc accessing'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2095 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2096 |
beHeadless:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2097 |
"set/clear the headlessOperation flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2098 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2099 |
HeadlessOperation := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2100 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2101 |
|
10231 | 2102 |
beSTScript:aBoolean |
2103 |
"set/clear the isSTScript flag." |
|
2104 |
||
2105 |
IsSTScript := aBoolean |
|
2106 |
||
2107 |
"Created: / 06-12-2006 / 16:43:36 / cg" |
|
2108 |
! |
|
2109 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2110 |
standAloneApp:aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2111 |
"set/clear the StandAlone flag." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2112 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2113 |
StandAlone := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2114 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2115 |
|
12250 | 2116 |
!Smalltalk class methodsFor:'private-system management-packages'! |
2117 |
||
2118 |
knownPackages |
|
2119 |
<resource: #obsolete> |
|
2120 |
self obsoleteMethodWarning. |
|
2121 |
^ KnownPackages ? #() |
|
2122 |
! |
|
2123 |
||
2124 |
loadExtensionsForPackage:aPackageId |
|
13415 | 2125 |
| extensionsLoaded | |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2126 |
|
13415 | 2127 |
extensionsLoaded := false. |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2128 |
ProgrammingLanguage allDo:[:lang| |
13771 | 2129 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: lang) |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2130 |
]. |
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2131 |
^ extensionsLoaded |
13415 | 2132 |
|
2133 |
"Modified: / 18-02-2007 / 11:03:26 / cg" |
|
2134 |
"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
|
2135 |
"Modified (format): / 04-09-2011 / 09:19:24 / cg" |
13415 | 2136 |
! |
2137 |
||
2138 |
loadExtensionsForPackage:aPackageId language: language |
|
13771 | 2139 |
|mgr packageDirName inStream projectDefinition extensionsFilename mod dir |
13621
85297bc6cfa8
comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents:
13602
diff
changeset
|
2140 |
extensionsRevisionString extensionsRevisionInfo| |
12250 | 2141 |
|
13415 | 2142 |
language supportsExtensionMethods ifFalse:[^false]. |
2143 |
||
12250 | 2144 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
2145 |
packageDirName := self getPackageFileName:packageDirName. |
|
2146 |
||
2147 |
(packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[ |
|
13814 | 2148 |
(self loadExtensionsFromDirectory:packageDirName language: language) ifTrue:[ |
2149 |
^ true. |
|
2150 |
]. |
|
2151 |
packageDirName := nil. "do not try again" |
|
12250 | 2152 |
]. |
2153 |
||
2154 |
" |
|
2155 |
if there is a sourceCodeManager, ask it first for the extensions |
|
2156 |
" |
|
2157 |
mgr := Smalltalk at:#SourceCodeManager. |
|
2158 |
mgr notNil ifTrue:[ |
|
13814 | 2159 |
extensionsFilename := 'extensions.' , language sourceFileSuffix. |
2160 |
||
2161 |
projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId. |
|
2162 |
projectDefinition notNil ifTrue:[ |
|
2163 |
mod := aPackageId asPackageId module. |
|
2164 |
dir := aPackageId asPackageId directory. |
|
2165 |
extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil. |
|
2166 |
extensionsRevisionString notNil ifTrue:[ |
|
2167 |
extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil. |
|
2168 |
extensionsRevisionInfo notNil ifTrue:[ |
|
2169 |
extensionsRevisionInfo fileName = extensionsFilename ifFalse:[^ false]. |
|
2170 |
] |
|
2171 |
]. |
|
2172 |
SourceCodeManagerError handle:[:ex | |
|
2173 |
] do:[ |
|
2174 |
inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true. |
|
2175 |
]. |
|
2176 |
]. |
|
2177 |
inStream isNil ifTrue:[ |
|
2178 |
SourceCodeManagerError handle:[:ex | |
|
2179 |
] do:[ |
|
2180 |
inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId. |
|
2181 |
]. |
|
2182 |
]. |
|
2183 |
inStream notNil ifTrue:[ |
|
2184 |
Class withoutUpdatingChangeSetDo:[ |
|
2185 |
inStream fileIn. |
|
2186 |
]. |
|
2187 |
inStream close. |
|
2188 |
VerboseLoading ifTrue:[ |
|
2189 |
Transcript showCR:('loaded extensions for ',aPackageId,' from repository'). |
|
2190 |
]. |
|
2191 |
^ true |
|
2192 |
] |
|
12250 | 2193 |
]. |
2194 |
||
2195 |
packageDirName notNil ifTrue:[ |
|
13814 | 2196 |
^ self loadExtensionsFromDirectory:packageDirName language: language |
12250 | 2197 |
]. |
2198 |
^ false |
|
2199 |
||
13415 | 2200 |
"Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2201 |
"Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2202 |
"Modified: / 04-11-2011 / 13:41:29 / cg" |
12250 | 2203 |
! |
2204 |
||
2205 |
loadExtensionsFromDirectory:packageDirOrString |
|
13415 | 2206 |
|
2207 |
| extensionsLoaded | |
|
2208 |
extensionsLoaded := false. |
|
2209 |
ProgrammingLanguage allDo: |
|
13771 | 2210 |
[:lang| |
2211 |
extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: lang)]. |
|
13415 | 2212 |
^extensionsLoaded |
2213 |
||
2214 |
"Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2215 |
! |
|
2216 |
||
2217 |
loadExtensionsFromDirectory:packageDirOrString language: language |
|
12250 | 2218 |
|packageDir f| |
2219 |
||
2220 |
packageDir := packageDirOrString asFilename. |
|
2221 |
||
13415 | 2222 |
f := packageDir / ('extensions.' , language sourceFileSuffix). |
12250 | 2223 |
f exists ifTrue:[ |
13814 | 2224 |
Class withoutUpdatingChangeSetDo:[ |
2225 |
f fileIn. |
|
2226 |
]. |
|
2227 |
VerboseLoading ifTrue:[ |
|
2228 |
Transcript showCR:('loaded extensions: ' , f pathName). |
|
2229 |
]. |
|
2230 |
^ true |
|
12250 | 2231 |
]. |
2232 |
^ false |
|
13415 | 2233 |
|
2234 |
"Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13814 | 2235 |
"Modified: / 04-11-2011 / 13:41:19 / cg" |
12250 | 2236 |
! |
2237 |
||
12782 | 2238 |
loadPackage:aPackageString asAutoloaded:doLoadAsAutoloaded |
2239 |
"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
|
2240 |
Return true on success, false otherwise." |
12782 | 2241 |
|
2242 |
|packageDir def sourceCodeManager| |
|
2243 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2244 |
"if I am here, so must my package" |
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2245 |
aPackageString = 'stx:libbasic' ifTrue:[^ true]. |
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2246 |
|
12782 | 2247 |
"/ if there is a projectDefinition, let it load itself... |
2248 |
def := aPackageString asPackageId projectDefinitionClass. |
|
2249 |
def notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2250 |
def loadAsAutoloaded:doLoadAsAutoloaded. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2251 |
^ true. |
12782 | 2252 |
]. |
2253 |
||
2254 |
packageDir := self packageDirectoryForPackageId:aPackageString. |
|
2255 |
packageDir isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2256 |
(aPackageString includes:$:) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2257 |
"/ assume stx |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2258 |
packageDir := self packageDirectoryForPackageId:('stx:',aPackageString). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2259 |
]. |
12782 | 2260 |
]. |
2261 |
||
2262 |
(self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2263 |
loadPackage:aPackageString |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2264 |
fromDirectory:packageDir |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2265 |
asAutoloaded:doLoadAsAutoloaded) ifTrue: [^ true]. |
12782 | 2266 |
|
2267 |
AbstractSourceCodeManager notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2268 |
sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage: aPackageString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2269 |
sourceCodeManager notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2270 |
^ sourceCodeManager loadPackageWithId: aPackageString fromRepositoryAsAutoloaded: doLoadAsAutoloaded |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2271 |
]. |
12782 | 2272 |
]. |
2273 |
||
2274 |
^ false |
|
2275 |
||
2276 |
" |
|
2277 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2278 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2279 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2280 |
" |
|
2281 |
||
13129
0ac3f6a28aaf
changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13120
diff
changeset
|
2282 |
"Modified: / 16-11-2010 / 17:42:49 / cg" |
12782 | 2283 |
! |
2284 |
||
12250 | 2285 |
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory |
2286 |
"load all source files found in aDirectory and treat them like |
|
2287 |
a package. Allows for initial import of alien ST-code as a new package. |
|
2288 |
Experimental." |
|
2289 |
||
2290 |
|p t new anyFail repeatCount| |
|
2291 |
||
2292 |
"/ problem: dependencies. |
|
2293 |
"/ solution: repeat twice, so that superclasses are present the second time |
|
2294 |
||
2295 |
Class packageQuerySignal answer:packageId asSymbol do:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2296 |
|any| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2297 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2298 |
repeatCount := 0. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2299 |
[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2300 |
repeatCount := repeatCount + 1. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2301 |
anyFail := false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2302 |
aDirectory directoryContents do:[:file | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2303 |
|fn| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2304 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2305 |
fn := aDirectory / file. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2306 |
(fn hasSuffix:'st') ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2307 |
Metaclass confirmationQuerySignal answer:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2308 |
do:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2309 |
Error |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2310 |
handle:[:ex | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2311 |
anyFail := true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2312 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2313 |
do:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2314 |
(self fileIn:fn) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2315 |
anyFail := true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2316 |
] ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2317 |
any := true. |
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 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2320 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2321 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2322 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2323 |
any ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2324 |
^ false "/ no file found |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2325 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2326 |
] doWhile:[anyFail and:[repeatCount<2]]. |
12250 | 2327 |
]. |
2328 |
||
2329 |
new := (p := Project projectWithId:packageId) isNil. |
|
2330 |
new ifTrue:[ p := Project new]. |
|
2331 |
||
2332 |
p name:packageId. |
|
2333 |
p directory:aDirectory. |
|
2334 |
p package:packageId. |
|
2335 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2336 |
p repositoryModule:(t first). |
|
2337 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2338 |
p isLoaded:true. |
|
2339 |
||
2340 |
new ifTrue:[Project addLoadedProject:p]. |
|
2341 |
^ anyFail not |
|
2342 |
! |
|
2343 |
||
2344 |
loadPackage:packageId fromClassLibrary:aFilename |
|
2345 |
"load a package from a compiled classLib. |
|
2346 |
Experimental." |
|
2347 |
||
2348 |
|p t new| |
|
2349 |
||
2350 |
(self fileIn:aFilename) ifFalse:[ |
|
13370 | 2351 |
(self fileInClassLibrary:aFilename) ifFalse:[ |
2352 |
self warn:'Failed to load the package ', packageId printString. |
|
2353 |
^ false. |
|
2354 |
] |
|
12250 | 2355 |
]. |
2356 |
||
2357 |
new := (p := Project projectWithId:packageId) isNil. |
|
2358 |
new ifTrue:[ p := Project new]. |
|
2359 |
||
2360 |
p name:packageId. |
|
2361 |
p directory:aFilename directory. |
|
2362 |
p package:packageId. |
|
2363 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2364 |
p repositoryModule:(t first). |
|
2365 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2366 |
p isLoaded:true. |
|
2367 |
||
2368 |
new ifTrue:[Project addLoadedProject:p]. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2369 |
|
12250 | 2370 |
^ true |
2371 |
! |
|
2372 |
||
12782 | 2373 |
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded |
2374 |
"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
|
2375 |
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
|
2376 |
Answer true, if the load succeeded, false if it failed" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2377 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2378 |
|packageDir packageName shLibName |
12782 | 2379 |
binaryClassLibraryFilename projectDefinitionFilename loadAllFilename |
2380 |
projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded |
|
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2381 |
loadOK loadErrorOccurred exePath| |
12782 | 2382 |
|
2383 |
packageDirOrStringOrNil notNil ifTrue:[ |
|
13771 | 2384 |
packageDir := packageDirOrStringOrNil asFilename. |
12782 | 2385 |
]. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
2386 |
VerboseLoading ifTrue:[ |
13771 | 2387 |
silent := false |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
2388 |
] ifFalse:[ |
13771 | 2389 |
silent := SilentLoading | StandAlone | InfoPrinting not. |
13091
bc840cd6f1ae
--verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents:
13061
diff
changeset
|
2390 |
]. |
12782 | 2391 |
|
2392 |
"For now: have to read the project definition first!! |
|
2393 |
The class library may contain subclasses of classes in prerequisite packages - |
|
2394 |
so the prerequisite packages have to be loaded first" |
|
2395 |
||
2396 |
"normally there is a project definiton, use that one to pull in the rest" |
|
2397 |
||
2398 |
"maybe, it is already in the image - autoloaded" |
|
2399 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2400 |
||
2401 |
"if not, file it in ..." |
|
2402 |
(projectDefinitionClass isNil and:[packageDir notNil]) ifTrue:[ |
|
13771 | 2403 |
projectDefinitionClassName := ProjectDefinition initialClassNameForDefinitionOf:aPackageString. |
2404 |
"/ try to load the project definition class |
|
2405 |
projectDefinitionFilename := (packageDir / projectDefinitionClassName) withSuffix:'st'. |
|
2406 |
projectDefinitionFilename exists ifFalse:[ |
|
2407 |
projectDefinitionFilename := (packageDir / 'source' / projectDefinitionClassName) withSuffix:'st'. |
|
2408 |
]. |
|
2409 |
projectDefinitionFilename exists ifTrue:[ |
|
2410 |
Class withoutUpdatingChangesDo:[ |
|
2411 |
Smalltalk silentlyLoadingDo:[ |
|
2412 |
projectDefinitionFilename fileIn. |
|
2413 |
]. |
|
2414 |
]. |
|
2415 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2416 |
]. |
|
12782 | 2417 |
]. |
2418 |
||
2419 |
projectDefinitionClass notNil ifTrue:[ |
|
13771 | 2420 |
projectDefinitionClass autoload. |
2421 |
somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded. |
|
2422 |
(silent not and:[somethingHasBeenLoaded]) ifTrue:[ |
|
2423 |
Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition'). |
|
2424 |
]. |
|
2425 |
^ true. |
|
12782 | 2426 |
]. |
2427 |
||
2428 |
"/ no project-definition class. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2429 |
|
12782 | 2430 |
"Is there a shared library (.dll or .so) ?" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2431 |
shLibName := aPackageString asPackageId libraryName asFilename |
13771 | 2432 |
withSuffix:ObjectFileLoader sharedLibrarySuffix. |
12782 | 2433 |
|
13120
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2434 |
"/ silent ifFalse:[ |
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2435 |
"/ Transcript showCR:('looking for binary classLib file: ' , shLibName pathName). |
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2436 |
"/ ]. |
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2437 |
exePath := OperatingSystem pathOfSTXExecutable asFilename directory. |
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2438 |
binaryClassLibraryFilename := exePath / shLibName. |
12782 | 2439 |
binaryClassLibraryFilename exists ifFalse:[ |
13771 | 2440 |
exePath baseName = 'bin' ifTrue:[ |
2441 |
binaryClassLibraryFilename := exePath directory / 'lib' / shLibName. |
|
2442 |
]. |
|
2443 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2444 |
binaryClassLibraryFilename := exePath directory / 'plugin' / shLibName. |
|
2445 |
binaryClassLibraryFilename exists ifFalse:[ |
|
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2446 |
"/ binaryClassLibraryFilename := Filename currentDirectory / shLibName. |
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2447 |
"/ binaryClassLibraryFilename exists ifFalse:[ |
13771 | 2448 |
packageDir notNil ifTrue:[ |
2449 |
binaryClassLibraryFilename := packageDir / shLibName. |
|
2450 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2451 |
"/ mhmh - is this a good idea ? (temporary kludge) |
|
2452 |
binaryClassLibraryFilename := packageDir / 'objbc' / shLibName. |
|
2453 |
binaryClassLibraryFilename exists ifFalse:[ |
|
2454 |
binaryClassLibraryFilename := packageDir / 'objvc' / shLibName. |
|
2455 |
] |
|
2456 |
] |
|
2457 |
] |
|
13060
488c6ad12c93
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13056
diff
changeset
|
2458 |
"/ ]. |
13771 | 2459 |
]. |
2460 |
]. |
|
12782 | 2461 |
]. |
2462 |
binaryClassLibraryFilename exists ifTrue:[ |
|
13771 | 2463 |
ObjectFileLoader::ObjectFileLoadErrorNotification handle:[:ex | |
2464 |
loadErrorOccurred := true. |
|
2465 |
ex proceedWith:true. |
|
2466 |
] do:[ |
|
2467 |
loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename. |
|
2468 |
]. |
|
2469 |
loadOK ifTrue:[ |
|
2470 |
silent ifFalse:[ |
|
2471 |
Transcript showCR:('loaded package: ' , aPackageString , ' from binary classLib file: ' , binaryClassLibraryFilename pathName). |
|
2472 |
]. |
|
2473 |
doLoadAsAutoloaded ifFalse:[ |
|
2474 |
"/ force autoloading... |
|
2475 |
Smalltalk allClassesDo:[:eachClass | |
|
2476 |
eachClass package == aPackageString ifTrue:[eachClass autoload]. |
|
2477 |
]. |
|
2478 |
]. |
|
2479 |
^ true |
|
2480 |
]. |
|
2481 |
loadErrorOccurred ifTrue:[ |
|
2482 |
self breakPoint:#cg. |
|
2483 |
projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString. |
|
2484 |
projectDefinitionClass notNil ifTrue:[ |
|
2485 |
"/ load prerequisites... |
|
2486 |
projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded. |
|
2487 |
self breakPoint:#cg. |
|
2488 |
]. |
|
2489 |
]. |
|
12782 | 2490 |
]. |
2491 |
||
2492 |
packageDir isNil ifTrue:[ |
|
13771 | 2493 |
^ false. |
12782 | 2494 |
]. |
2495 |
||
2496 |
"/ loadAll ? - will be soon obsolete |
|
13120
7fa4fe320d14
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13092
diff
changeset
|
2497 |
"/ mhmh - this will vanish soon... |
12782 | 2498 |
loadAllFilename := packageDir / 'loadAll'. |
2499 |
loadAllFilename exists ifFalse:[ |
|
13771 | 2500 |
loadAllFilename := packageDir / 'loadall'. |
12782 | 2501 |
]. |
2502 |
loadAllFilename exists ifTrue:[ |
|
13771 | 2503 |
(self loadPackage:aPackageString fromLoadAllFile:loadAllFilename) ifTrue:[ |
2504 |
silent ifFalse:[ |
|
2505 |
Transcript showCR:('loaded package: ' , aPackageString , ' from loadAll file: ' , loadAllFilename pathName). |
|
2506 |
]. |
|
2507 |
^ true |
|
2508 |
] |
|
12782 | 2509 |
]. |
2510 |
||
2511 |
packageName := packageDir baseName. |
|
2512 |
||
2513 |
"/ zip-file loading no longer supported |
|
2514 |
"/ "/ .zip ? |
|
2515 |
"/ f := (packageDir / packageName) withSuffix:'zip'. |
|
2516 |
"/ f exists ifTrue:[ |
|
2517 |
"/ (self loadPackage:aPackageString fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
|
2518 |
"/ silent ifFalse:[ |
|
2519 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from zip file: ' , f pathName). |
|
2520 |
"/ ]. |
|
2521 |
"/ ^ true |
|
2522 |
"/ ] |
|
2523 |
"/ ]. |
|
2524 |
||
2525 |
"/ abbrev-file loading no longer supported |
|
2526 |
"/ "/ abbrev.stc ? |
|
2527 |
"/ (self loadPackageFromAbbrevFile:aPackageString asAutoloaded:doLoadAsAutoloaded) ifTrue:[ |
|
2528 |
"/ ^ true |
|
2529 |
"/ ]. |
|
2530 |
||
2531 |
"/ any .so-file loading no longer supported |
|
2532 |
"/ "/ any .so ? -> load the first one found (maybe not a good idea) |
|
2533 |
"/ packageDir directoryContentsAsFilenamesDo:[:aFilename | |
|
2534 |
"/ (aFilename hasSuffix:ObjectFileLoader sharedLibrarySuffix) ifTrue:[ |
|
2535 |
"/ (self loadPackage:aPackageString fromClassLibrary:aFilename) ifTrue:[ |
|
2536 |
"/ silent ifFalse:[ |
|
2537 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from binary classLib file: ' , aFilename pathName). |
|
2538 |
"/ ]. |
|
2539 |
"/ doLoadAsAutoloaded ifFalse:[ |
|
2540 |
"/ "/ force autoloading... |
|
2541 |
"/ Smalltalk allClassesDo:[:eachClass | |
|
2542 |
"/ eachClass package == aPackageString ifTrue:[ eachClass autoload]. |
|
2543 |
"/ ]. |
|
2544 |
"/ ]. |
|
2545 |
"/ ^ true |
|
2546 |
"/ ] |
|
2547 |
"/ ] |
|
2548 |
"/ ]. |
|
2549 |
||
2550 |
"/ "/ source files-file loading no longer supported |
|
2551 |
"/ "/ however, allow for autoload-stub loaded |
|
2552 |
"/ doLoadAsAutoloaded ifTrue:[ |
|
2553 |
"/ self |
|
2554 |
"/ recursiveInstallAutoloadedClassesFrom:packageDir |
|
2555 |
"/ rememberIn:(Set new) |
|
2556 |
"/ maxLevels:2 |
|
2557 |
"/ noAutoload:false |
|
2558 |
"/ packageTop:packageDir |
|
2559 |
"/ showSplashInLevels:0. |
|
2560 |
"/ ]. |
|
2561 |
||
2562 |
"/ doLoadAsAutoloaded ifFalse:[ |
|
2563 |
"/ "/ source files |
|
2564 |
"/ (self loadPackage:aPackageString fromAllSourceFilesInDirectory:packageDir) ifTrue:[ |
|
2565 |
"/ silent ifFalse:[ |
|
2566 |
"/ Transcript showCR:('loaded package: ' , aPackageString , ' from source files in:' , packageDir pathName). |
|
2567 |
"/ ]. |
|
2568 |
"/ ^ true |
|
2569 |
"/ ]. |
|
2570 |
"/ ]. |
|
2571 |
"/ ^ true |
|
2572 |
||
12813
054a53cb88fd
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
12795
diff
changeset
|
2573 |
Transcript showCR:('Smalltalk [info]: no projectDef, dll or loadAll found in: ' , aPackageString). |
12782 | 2574 |
^ false |
2575 |
||
2576 |
" |
|
2577 |
Smalltalk loadPackageWithId:'stx:libbasic' |
|
2578 |
Smalltalk loadPackageWithId:'stx:goodies/persistency' |
|
2579 |
Smalltalk loadPackageWithId:'exept:ctypes' |
|
2580 |
" |
|
2581 |
||
13529
3fa8f8852e91
changed: #loadPackage:fromDirectory:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents:
13528
diff
changeset
|
2582 |
"Modified: / 29-07-2011 / 19:55:35 / cg" |
12782 | 2583 |
! |
2584 |
||
12250 | 2585 |
loadPackage:packageId fromLoadAllFile:aFilename |
12782 | 2586 |
<resource: #obsolete> |
12250 | 2587 |
"load a package from a loadAll - loader script. |
2588 |
Experimental." |
|
2589 |
||
2590 |
|p t new| |
|
2591 |
||
2592 |
Metaclass confirmationQuerySignal answer:false |
|
2593 |
do:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2594 |
(self fileIn:aFilename) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2595 |
self warn:'Failed to load the package ', packageId printString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2596 |
^ false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2597 |
] |
12250 | 2598 |
]. |
2599 |
||
2600 |
new := (p := Project projectWithId:packageId) isNil. |
|
2601 |
new ifTrue:[ p := Project new]. |
|
2602 |
||
2603 |
p name:packageId. |
|
2604 |
p directory:aFilename directory. |
|
2605 |
p package:packageId. |
|
2606 |
t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'. |
|
2607 |
p repositoryModule:(t first). |
|
2608 |
p repositoryDirectory:(packageId copyFrom:t first size + 2). |
|
2609 |
p isLoaded:true. |
|
2610 |
||
2611 |
new ifTrue:[Project addLoadedProject:p]. |
|
2612 |
^ true |
|
2613 |
! |
|
2614 |
||
2615 |
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded |
|
2616 |
"load a package from a .zip delivery file. |
|
2617 |
Experimental." |
|
2618 |
||
2619 |
"/ not yet implemented ... |
|
2620 |
^ false |
|
2621 |
! |
|
2622 |
||
2623 |
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded |
|
12782 | 2624 |
<resource: #obsolete> |
12250 | 2625 |
|abbrevFile packageDir| |
2626 |
||
2627 |
packageDir := self packageDirectoryForPackageId:aPackageId. |
|
2628 |
packageDir isNil ifTrue:[^ false]. |
|
2629 |
||
2630 |
"/ abbrev.stc ? |
|
12377 | 2631 |
abbrevFile := packageDir / 'abbrev.stc'. |
12250 | 2632 |
abbrevFile exists ifFalse:[^ false]. |
2633 |
||
2634 |
Smalltalk installAutoloadedClassesFrom:abbrevFile pathName. |
|
2635 |
||
2636 |
doLoadAsAutoloaded ifFalse:[ |
|
13814 | 2637 |
"/ force autoloading... |
2638 |
Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload]. |
|
12250 | 2639 |
]. |
2640 |
||
2641 |
self loadExtensionsFromDirectory:packageDir. |
|
13814 | 2642 |
VerboseLoading ifTrue:[ |
2643 |
Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName). |
|
12250 | 2644 |
]. |
2645 |
^ true |
|
2646 |
||
13814 | 2647 |
"Modified: / 04-11-2011 / 13:43:29 / cg" |
12250 | 2648 |
! ! |
2649 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2650 |
!Smalltalk class methodsFor:'queries'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2651 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2652 |
allClasses |
7563 | 2653 |
"return an unordered collection of all classes in the system. |
10071 | 2654 |
Only globally anchored classes are returned |
453 | 2655 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2656 |
||
2657 |
|classes| |
|
2658 |
||
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2659 |
"/ you may wonder, what this while is for, here ... |
453 | 2660 |
"/ the reason is that if we modify the class hierarchy in |
4067 | 2661 |
"/ another view (background fileIn), while building up the |
453 | 2662 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
2663 |
"/ other process in the meanwhile. |
|
2664 |
"/ If that happens, we restart the set-building here |
|
2665 |
"/ |
|
2666 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2667 |
CachedClasses := classes := IdentitySet new:NumberOfClassesHint. |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2668 |
self keysAndValuesDo:[:eachName :eachGlobal | |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2669 |
(eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[ |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2670 |
"/ sigh - would like to skip over aliases |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2671 |
"/ but this cannot be done simply by comparing |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2672 |
"/ the classes name against the store-key |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2673 |
"/ i.e. cannot do: |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2674 |
"/ anObject name == sym ifTrue:[ |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2675 |
"/ classes add:anObject |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2676 |
"/ ] |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2677 |
"/ because that would lead to ignore all java |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2678 |
"/ classes, which are stored under a different |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2679 |
"/ key. |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2680 |
|
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2681 |
(eachGlobal name == eachName |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2682 |
or:[eachGlobal isJavaClass]) ifTrue:[ |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2683 |
classes add:eachGlobal |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2684 |
]. |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2685 |
] |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2686 |
]. |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2687 |
NumberOfClassesHint := classes size. |
453 | 2688 |
]. |
2689 |
^ classes |
|
2690 |
||
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2691 |
" |
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2692 |
CachedClasses := nil. |
453 | 2693 |
Smalltalk allClasses |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2694 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2695 |
to get the list sorted by name: |
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2696 |
|
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2697 |
Smalltalk allClasses asSortedCollection:[:a :b | a name < b name] |
453 | 2698 |
" |
745
d16f199a1551
added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents:
736
diff
changeset
|
2699 |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
2700 |
"Modified: / 06-12-2011 / 12:41:42 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2701 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2702 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2703 |
allClassesAndMetaclasses |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2704 |
"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
|
2705 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2706 |
|classes| |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2707 |
|
8964
91b012315d91
Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents:
8960
diff
changeset
|
2708 |
classes := IdentitySet new:NumberOfClassesHint*2. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2709 |
self allClassesDo:[:eachClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2710 |
classes add:(eachClass theNonMetaclass). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2711 |
classes add:(eachClass theMetaclass). |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2712 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2713 |
^ classes |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2714 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2715 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2716 |
allClassesWithAllPrivateClasses |
7563 | 2717 |
"return an unordered collection of all classes in the Smalltalk namespace. |
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2718 |
Only globally anchored classes are returned; Namespaces are not included. |
4642 | 2719 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
2720 |
||
10071 | 2721 |
^ self allClasses select:[:aClass | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2722 |
|owner| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2723 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2724 |
(aClass isRealNameSpace not) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2725 |
and:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2726 |
owner := aClass topOwningClass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2727 |
(owner ? aClass) nameSpace == Smalltalk |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2728 |
] |
4642 | 2729 |
] |
2730 |
||
2731 |
" |
|
2732 |
Smalltalk allClassesWithAllPrivateClasses |
|
2733 |
" |
|
10173
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2734 |
|
765b385fd1b8
changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents:
10169
diff
changeset
|
2735 |
"Modified: / 10-11-2006 / 17:24:00 / cg" |
4642 | 2736 |
! |
2737 |
||
11153 | 2738 |
allExtensionsForPackage:aProjectID |
2739 |
|methods| |
|
2740 |
||
2741 |
methods := OrderedCollection new. |
|
2742 |
self allClassesDo:[:eachClass | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2743 |
methods addAll:(eachClass extensionsFrom:aProjectID). |
11153 | 2744 |
]. |
2745 |
^ methods |
|
2746 |
! |
|
2747 |
||
9227 | 2748 |
allImplementorsOf:aSelector |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2749 |
"return a collection of classes which implement the given selector" |
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2750 |
|
9227 | 2751 |
|implementors| |
2752 |
||
2753 |
implementors := OrderedCollection new. |
|
2754 |
self allClassesDo:[:cls | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2755 |
(cls includesSelector:aSelector) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2756 |
implementors add:cls. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2757 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2758 |
(cls class includesSelector:aSelector) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2759 |
implementors add:cls class. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2760 |
]. |
9227 | 2761 |
]. |
2762 |
^ implementors |
|
2763 |
||
2764 |
" |
|
10071 | 2765 |
Smalltalk allImplementorsOf:#isNil |
2766 |
(Smalltalk allImplementorsOf:#add:) size |
|
9227 | 2767 |
" |
12919
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2768 |
|
a7ea070197c9
comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents:
12911
diff
changeset
|
2769 |
"Modified: / 07-05-2010 / 10:56:09 / cg" |
9227 | 2770 |
! |
2771 |
||
12376 | 2772 |
allLoadedProjectIDs |
2773 |
||
2774 |
^ self allProjectsIdsIncludingUnloadedClasses: false |
|
2775 |
||
2776 |
||
2777 |
" |
|
2778 |
Smalltalk allLoadedProjectIDs |
|
2779 |
" |
|
2780 |
! |
|
2781 |
||
9254 | 2782 |
allProjectIDs |
12376 | 2783 |
|
2784 |
^ self allProjectsIdsIncludingUnloadedClasses: true |
|
2785 |
||
2786 |
||
2787 |
" |
|
2788 |
Smalltalk allProjectIDs |
|
2789 |
" |
|
2790 |
! |
|
2791 |
||
2792 |
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses |
|
2793 |
"Returns all projects ids. |
|
2794 |
Excludes projects coming from unloaded classes if includeUnloadedClasses is false. |
|
2795 |
" |
|
2796 |
||
9254 | 2797 |
|allProjects| |
2798 |
||
2799 |
allProjects := Set new. |
|
2800 |
self allClassesDo:[:eachClass | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2801 |
|cls pkg| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2802 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2803 |
eachClass isRealNameSpace ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2804 |
(includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2805 |
cls := eachClass theNonMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2806 |
cls isPrivate ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2807 |
cls := cls topOwningClass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2808 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2809 |
pkg := cls package. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2810 |
pkg size > 0 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2811 |
allProjects add:pkg. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2812 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2813 |
"/ for now, nameSpaces are not in any package; |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2814 |
"/ this might change. Then, 0-sized packages are |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2815 |
"/ illegal, and the following should be enabled. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2816 |
"/ self halt |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2817 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2818 |
cls isJavaClass ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2819 |
cls instAndClassSelectorsAndMethodsDo:[:sel :mthd | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2820 |
allProjects add:mthd package asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2821 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2822 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2823 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2824 |
]. |
9254 | 2825 |
]. |
2826 |
allProjects := allProjects asOrderedCollection sort. |
|
2827 |
^ allProjects |
|
2828 |
||
2829 |
" |
|
12376 | 2830 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: true |
2831 |
Smalltalk allProjectsIdsIncludingUnloadedClasses: false |
|
9254 | 2832 |
" |
2833 |
! |
|
2834 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2835 |
cellAt:aName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2836 |
"{ Pragma: +optSpace }" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2837 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2838 |
"return the address of a global cell |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2839 |
- used internally for compiler only" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2840 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2841 |
%{ /* NOCONTEXT */ |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2842 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2843 |
%}. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2844 |
^ self primitiveFailed |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2845 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2846 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2847 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2848 |
classCategoryCompletion:aPartialCategory |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2849 |
"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
|
2850 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2851 |
2nd: collection consisting of matching categories" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2852 |
|
9508 | 2853 |
^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2854 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2855 |
" |
10071 | 2856 |
Smalltalk classCategoryCompletion:'Sys' |
2857 |
Smalltalk classCategoryCompletion:'System' |
|
2858 |
Smalltalk classCategoryCompletion:'System-BinaryStorage' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2859 |
" |
9508 | 2860 |
|
2861 |
"Modified: / 10-08-2006 / 13:06:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2862 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2863 |
|
8570 | 2864 |
classNamed:aString |
2865 |
"return the class with name aString, or nil if absent. |
|
2866 |
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
|
2867 |
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
|
2868 |
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
|
2869 |
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
|
2870 |
|
10127 | 2871 |
|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
|
2872 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2873 |
"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
|
2874 |
But be careful, to not invent new symbols ..." |
453 | 2875 |
sym := aString asSymbolIfInterned. |
2876 |
sym notNil ifTrue:[ |
|
13771 | 2877 |
cls := self at:sym ifAbsent:nil. |
2878 |
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
|
2879 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2880 |
|
1480
df0bea6285f8
Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents:
1461
diff
changeset
|
2881 |
(aString endsWith:' class') ifTrue:[ |
13771 | 2882 |
nonMeta := self classNamed:(aString copyWithoutLast:6). |
2883 |
nonMeta notNil ifTrue:[ |
|
2884 |
^ nonMeta theMetaclass |
|
2885 |
]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2886 |
]. |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2887 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2888 |
"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
|
2889 |
cls isNil ifTrue:[ |
13771 | 2890 |
idx := aString indexOfSubCollection:'::'. |
2891 |
idx ~~ 0 ifTrue:[ |
|
2892 |
prefix := aString copyTo:idx-1. |
|
2893 |
nsNameSymbol := prefix asSymbolIfInterned. |
|
2894 |
nsNameSymbol notNil ifTrue:[ |
|
2895 |
rest := aString copyFrom:idx+2. |
|
2896 |
namespace := self at:prefix asSymbolIfInterned ifAbsent:nil. |
|
2897 |
"namespace may be the owner of a private class. |
|
2898 |
NameSpaces and Behaviors have the same protocol" |
|
2899 |
[namespace isBehavior] whileTrue:[ |
|
2900 |
idx := rest indexOfSubCollection:'::'. |
|
2901 |
idx ~~ 0 ifTrue:[ |
|
2902 |
prefix := rest copyTo:idx-1. |
|
2903 |
rest := rest copyFrom:idx+2. |
|
2904 |
"this does an implicit autoload if required" |
|
2905 |
namespace := namespace privateClassesAt:prefix. |
|
2906 |
] ifFalse:[ |
|
2907 |
namespace isLoaded ifTrue:[ |
|
2908 |
cls := namespace privateClassesAt:rest. |
|
2909 |
cls isBehavior ifTrue:[^ cls]. |
|
2910 |
]. |
|
2911 |
namespace := nil. "force exit of loop" |
|
2912 |
]. |
|
2913 |
]. |
|
2914 |
]. |
|
2915 |
]. |
|
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2916 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
2917 |
|
453 | 2918 |
^ nil |
2919 |
||
2920 |
" |
|
10071 | 2921 |
Smalltalk classNamed:'Object' |
2922 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
2923 |
Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
2924 |
Smalltalk classNamed:'Authentication::BasicAuthenticator' |
|
2925 |
Smalltalk classNamed:'fooBar' |
|
2926 |
Smalltalk classNamed:'true' |
|
2927 |
Smalltalk classNamed:'Object class' |
|
2928 |
Smalltalk classNamed:'Metaclass' |
|
2929 |
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
|
2930 |
Smalltalk classNamed:'Array class' |
453 | 2931 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2932 |
|
9468 | 2933 |
"Created: / 24-11-1995 / 17:30:22 / cg" |
2934 |
"Modified: / 19-06-1996 / 14:22:21 / stefan" |
|
10127 | 2935 |
"Modified: / 23-10-2006 / 18:06:53 / cg" |
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
2936 |
"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
|
2937 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2938 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2939 |
classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2940 |
"return a collection of all classNames in the system" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2941 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2942 |
^ self allClasses collect:[:aClass | aClass name] |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2943 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2944 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2945 |
Smalltalk classNames |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2946 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2947 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2948 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2949 |
classnameCompletion:aPartialClassName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2950 |
"given a partial classname, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2951 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2952 |
2nd: collection consisting of matching names" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2953 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2954 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2955 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2956 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2957 |
classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
7563 | 2958 |
"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
|
2959 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2960 |
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
|
2961 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2962 |
^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2963 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2964 |
" |
10071 | 2965 |
Smalltalk classnameCompletion:'Arr' |
2966 |
Smalltalk classnameCompletion:'Arra' |
|
2967 |
Smalltalk classnameCompletion:'arra' |
|
2968 |
Smalltalk classnameCompletion:'*rray' |
|
2969 |
||
2970 |
Smalltalk classnameCompletion:'Arr cl' |
|
2971 |
Smalltalk classnameCompletion:'*rray cl' |
|
453 | 2972 |
" |
644
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2973 |
|
9363244ef25d
classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
630
diff
changeset
|
2974 |
"Created: 24.11.1995 / 17:24:45 / cg" |
2523
04db1fd74e0d
try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents:
2514
diff
changeset
|
2975 |
"Modified: 3.4.1997 / 18:25:01 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2976 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2977 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2978 |
defaultNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2979 |
"return the default namespace, where new classes are installed, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2980 |
if NO special nameSpace handler is present" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2981 |
|
9562
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
2982 |
^ Project defaultNameSpace. |
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
2983 |
|
7d36dbb02bb3
code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents:
9550
diff
changeset
|
2984 |
"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
|
2985 |
"Modified: / 17-08-2006 / 14:01:22 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2986 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2987 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
2988 |
globalNameCompletion:aPartialGlobalName |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2989 |
"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
|
2990 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
2991 |
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
|
2992 |
|
12614
b8fca618dcb6
changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents:
12613
diff
changeset
|
2993 |
^ 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
|
2994 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
2995 |
" |
10071 | 2996 |
Smalltalk globalnameCompletion:'Arr' |
2997 |
Smalltalk globalnameCompletion:'Arra' |
|
2998 |
Smalltalk globalnameCompletion:'arra' |
|
2999 |
Smalltalk globalnameCompletion:'*rray' |
|
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3000 |
" |
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3001 |
|
9508 | 3002 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3003 |
"Modified: / 10-08-2006 / 13:05:39 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3004 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3005 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3006 |
globalnameCompletion:aPartialGlobalName |
7563 | 3007 |
"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
|
3008 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3009 |
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
|
3010 |
|
8358 | 3011 |
<resource:#obsolete> |
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3012 |
self obsoleteMethodWarning:'use #globalNameCompletion:'. |
9508 | 3013 |
^ 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
|
3014 |
|
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3015 |
" |
10071 | 3016 |
Smalltalk globalnameCompletion:'Arr' |
3017 |
Smalltalk globalnameCompletion:'Arra' |
|
3018 |
Smalltalk globalnameCompletion:'arra' |
|
3019 |
Smalltalk globalnameCompletion:'*rray' |
|
5736 | 3020 |
" |
3021 |
||
9508 | 3022 |
"Created: / 24-11-1995 / 17:24:45 / cg" |
3023 |
"Modified: / 10-08-2006 / 13:05:48 / cg" |
|
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 |
|
13771 | 3026 |
hasClassNamed:aString |
3027 |
Symbol |
|
3028 |
hasInterned:aString |
|
3029 |
ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ]. |
|
13602
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3030 |
^ false |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3031 |
|
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3032 |
"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
|
3033 |
"Modified: / 20-08-2011 / 16:41:31 / cg" |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3034 |
! |
5fe3c7ce7d7e
comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents:
13601
diff
changeset
|
3035 |
|
9290 | 3036 |
hasNameSpaces |
3037 |
"can be redefined by dummy namespaces/environments, to suppress |
|
3038 |
the namespace display in a browser (PocketSmalltalk)" |
|
3039 |
||
3040 |
^ true |
|
3041 |
! |
|
3042 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3043 |
hasNamespaces |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3044 |
"can be redefined by dummy namespaces/environments, to suppress |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3045 |
the namespace display in a browser (PocketSmalltalk)" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3046 |
|
9290 | 3047 |
<resource:#obsolete> |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3048 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3049 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3050 |
|
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3051 |
hasSelectorNameSpaces |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3052 |
"for now return false |
10999 | 3053 |
Selector namespaces are being implemented and supported by the VM, |
10432
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3054 |
but not yet fully supported by all tools... |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3055 |
Therefore, for now, do not generate code which uses this feature." |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3056 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3057 |
^ false |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3058 |
|
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3059 |
"Created: / 05-03-2007 / 13:26:28 / cg" |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3060 |
! |
9d0a4de5e69c
preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents:
10429
diff
changeset
|
3061 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3062 |
includes:something |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3063 |
"this should come from Collection. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3064 |
will change the inheritance - Smalltalk is actually a collection" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3065 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3066 |
self do:[:element | element = something ifTrue:[^ true]]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3067 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3068 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3069 |
|
10041
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3070 |
isBrowserStartable |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3071 |
^ false. |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3072 |
|
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3073 |
"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
|
3074 |
! |
1ef0cb09523b
protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents:
9937
diff
changeset
|
3075 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3076 |
isNameSpace |
9227 | 3077 |
"return true, if the receiver is a nameSpace." |
3078 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3079 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3080 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3081 |
"Created: 11.10.1996 / 18:10:43 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3082 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3083 |
|
10169 | 3084 |
isRealNameSpace |
3085 |
"return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)." |
|
3086 |
||
3087 |
^ false |
|
3088 |
||
3089 |
"Created: / 10-11-2006 / 17:02:19 / cg" |
|
3090 |
! |
|
3091 |
||
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3092 |
isTopLevelNameSpace |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3093 |
^ true |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3094 |
! |
7563 | 3095 |
|
3096 |
isTopLevelNamespace |
|
3097 |
"obsolete - use isTopLevelNameSpace" |
|
5365 | 3098 |
|
7432 | 3099 |
<resource:#obsolete> |
3100 |
||
7999
475bba3ead9a
moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents:
7996
diff
changeset
|
3101 |
self obsoleteMethodWarning:'use #isTopLevelNameSpace'. |
4458 | 3102 |
^ true |
3103 |
||
3104 |
"Created: 11.10.1996 / 18:10:43 / cg" |
|
3105 |
! |
|
3106 |
||
9081 | 3107 |
keyIsClassVariableNameKey:aKey |
3108 |
|i| |
|
3109 |
||
3110 |
i := aKey lastIndexOf:$:. |
|
3111 |
i ~~ 0 ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3112 |
i > 1 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3113 |
(aKey at:(i-1)) == $: ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3114 |
^ true. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3115 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3116 |
]. |
9081 | 3117 |
]. |
3118 |
^ false. |
|
3119 |
||
3120 |
" |
|
10071 | 3121 |
self keyIsClassVariableNameKey:'foo::bar' |
3122 |
self keyIsClassVariableNameKey:'foo:bar' |
|
3123 |
self keyIsClassVariableNameKey:':bar' |
|
3124 |
self keyIsClassVariableNameKey:'::bar' |
|
9081 | 3125 |
" |
3126 |
! |
|
3127 |
||
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3128 |
loadedClassNamed:aString |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3129 |
"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
|
3130 |
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
|
3131 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3132 |
|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
|
3133 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3134 |
"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
|
3135 |
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
|
3136 |
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
|
3137 |
sym notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3138 |
cls := self at:sym ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3139 |
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
|
3140 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3141 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3142 |
(aString endsWith:' class') ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3143 |
nonMeta := self loadedClassNamed:(aString copyWithoutLast:6). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3144 |
nonMeta notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3145 |
^ nonMeta theMetaclass |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3146 |
]. |
9374
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3147 |
]. |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3148 |
^ nil |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3149 |
|
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3150 |
" |
10071 | 3151 |
Smalltalk loadedClassNamed:'Object' |
3152 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData' |
|
3153 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class' |
|
3154 |
Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator' |
|
3155 |
Smalltalk loadedClassNamed:'fooBar' |
|
3156 |
Smalltalk loadedClassNamed:'true' |
|
3157 |
Smalltalk loadedClassNamed:'Object class' |
|
3158 |
Smalltalk loadedClassNamed:'Metaclass' |
|
3159 |
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
|
3160 |
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
|
3161 |
" |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3162 |
! |
8198d65aadd3
#classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents:
9292
diff
changeset
|
3163 |
|
7563 | 3164 |
methodProtocolCompletion:aPartialProtocolName |
3165 |
"given a partial method protocol name, return an array consisting of |
|
10071 | 3166 |
2 entries: 1st: the best (longest) match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3167 |
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
|
3168 |
|
9508 | 3169 |
^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3170 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3171 |
" |
10071 | 3172 |
Smalltalk methodProtocolCompletion:'doc' |
3173 |
Smalltalk methodProtocolCompletion:'docu' |
|
3174 |
Smalltalk methodProtocolCompletion:'documenta' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3175 |
" |
9508 | 3176 |
|
3177 |
"Modified: / 10-08-2006 / 13:05:20 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3178 |
! |
5505
e99e8e9cbfef
added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents:
5504
diff
changeset
|
3179 |
|
7563 | 3180 |
numberOfGlobals |
3181 |
"return the number of global variables in the system" |
|
3182 |
||
3183 |
|tally "{ Class: SmallInteger }" | |
|
617 | 3184 |
|
3185 |
tally := 0. |
|
3186 |
self do:[:obj | tally := tally + 1]. |
|
3187 |
^ tally |
|
3188 |
||
3189 |
"Smalltalk numberOfGlobals" |
|
3190 |
! |
|
3191 |
||
7563 | 3192 |
referencesAny:aCollection |
3193 |
"redefined, since the references are only kept in the VM's symbol table" |
|
3260 | 3194 |
|
3195 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3196 |
aCollection do:[:anObject | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3197 |
(key == anObject) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3198 |
(val == anObject ) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3199 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3200 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3201 |
^ super referencesAny:aCollection |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3202 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3203 |
"Created: / 2.2.1998 / 16:01:20 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3204 |
! |
3260 | 3205 |
|
7563 | 3206 |
referencesDerivedInstanceOf:aClass |
3207 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3208 |
|
3209 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3210 |
(key isKindOf:aClass) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3211 |
(val isKindOf:aClass) ifTrue:[^ true]. |
617 | 3212 |
]. |
3213 |
^ super referencesDerivedInstanceOf:aClass |
|
3214 |
! |
|
3215 |
||
7563 | 3216 |
referencesInstanceOf:aClass |
3217 |
"redefined, since the references are only kept in the VM's symbol table" |
|
617 | 3218 |
|
3219 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3220 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3221 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
617 | 3222 |
]. |
3223 |
^ super referencesInstanceOf:aClass |
|
3224 |
! |
|
3225 |
||
7563 | 3226 |
referencesObject:anObject |
3227 |
"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
|
3228 |
|
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3229 |
self keysAndValuesDo:[:key :val | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3230 |
(key == anObject) ifTrue:[^ true]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3231 |
(val == anObject ) ifTrue:[^ true]. |
6074
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3232 |
]. |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3233 |
^ super referencesObject:anObject |
d91c99700e3b
renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents:
6033
diff
changeset
|
3234 |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3235 |
"Modified: / 3.2.1998 / 14:22:46 / cg" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3236 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3237 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3238 |
resolveName:nameIn inClass:aClass |
7563 | 3239 |
"resolve aName as if compiled within aClass; |
3026 | 3240 |
i.e. if it has a private class with this name, return it; |
3241 |
if aName is known within the classes namespace, return that. |
|
3242 |
Otherwise, return a global with that name. |
|
3243 |
This should be used whereever Smalltalk>>at: used to be used, |
|
3244 |
to resolve a global by name." |
|
3245 |
||
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3246 |
|aName sym cls ns| |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3247 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3248 |
nameIn isNil ifTrue:[^ nil]. |
4356 | 3249 |
nameIn isBehavior ifTrue:[^ nameIn]. "/ already resolved |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3250 |
aName := nameIn. |
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3251 |
|
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3252 |
(aName startsWith:'Smalltalk::') ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3253 |
aName := aName copyFrom:12. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3254 |
^ self at:(aName asSymbol) ifAbsent:nil. |
4354
8e265dcb2536
fixed name resolving with Smalltalk:: as prefix
Claus Gittinger <cg@exept.de>
parents:
4334
diff
changeset
|
3255 |
]. |
3026 | 3256 |
|
3257 |
sym := aName asSymbol. |
|
3258 |
||
3259 |
cls := aClass privateClassesAt:sym. |
|
3260 |
cls notNil ifTrue:[^ cls]. |
|
3261 |
||
3262 |
ns := aClass nameSpace. |
|
3263 |
(ns notNil and:[ns ~~ Smalltalk]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3264 |
ns isNameSpace ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3265 |
cls := ns at:sym ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3266 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3267 |
cls := ns privateClassesAt:sym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3268 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3269 |
cls notNil ifTrue:[^ cls]. |
3025 | 3270 |
]. |
3026 | 3271 |
^ self at:sym ifAbsent:nil. |
4356 | 3272 |
|
3273 |
"Modified: / 9.7.1999 / 01:18:07 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3274 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3275 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3276 |
selectorCompletion:aPartialSymbolName |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3277 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3278 |
2 entries: 1st: the longest match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3279 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3280 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3281 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3282 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3283 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3284 |
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3285 |
"given a partial selector, return an array consisting of |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3286 |
2 entries: 1st: the longest match |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3287 |
2nd: collection consisting of matching implemented selectors" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3288 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3289 |
^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3290 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3291 |
" |
10071 | 3292 |
Smalltalk selectorCompletion:'at:p' |
3293 |
Smalltalk selectorCompletion:'nextP' |
|
3294 |
Smalltalk selectorCompletion:'nextp' |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3295 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3296 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3297 |
"Modified: / 7.6.1996 / 08:44:33 / stefan" |
3565
966a108e3765
also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents:
3560
diff
changeset
|
3298 |
"Modified: / 14.6.1998 / 15:54:03 / cg" |
453 | 3299 |
! ! |
3300 |
||
4431 | 3301 |
!Smalltalk class methodsFor:'queries-system'! |
3302 |
||
7563 | 3303 |
dialectName |
8736 | 3304 |
^ #SmalltalkX |
7563 | 3305 |
|
3306 |
" |
|
3307 |
Smalltalk dialectName |
|
3308 |
" |
|
3309 |
! |
|
3310 |
||
3311 |
dialectReleaseVersion |
|
7348 | 3312 |
^ self versionString |
3313 |
||
3314 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3315 |
Smalltalk dialectReleaseVersion |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3316 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3317 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3318 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3319 |
isDolphinSmalltalk |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3320 |
"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
|
3321 |
applications - add #isDolphinSmalltalk to your dolphin, |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3322 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3323 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3324 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3325 |
! |
4970 | 3326 |
|
7563 | 3327 |
isSmalltalkMT |
3328 |
"return false here - this may be useful to write portable |
|
3329 |
applications - add #isSmalltalkMT to your smalltalk-MT, |
|
4970 | 3330 |
returning true there." |
3331 |
||
3332 |
^ false |
|
3333 |
! |
|
3334 |
||
7563 | 3335 |
isSmalltalkV |
3336 |
"return false here - this may be useful to write portable |
|
3337 |
applications - add #isSmalltalkV to your smalltalkV, |
|
4431 | 3338 |
returning true there." |
3339 |
||
3340 |
^ false |
|
3341 |
! |
|
3342 |
||
7563 | 3343 |
isSmalltalkX |
3344 |
"return true here - this may be useful to write portable |
|
3345 |
applications - add #isSmalltalkX to your other smalltalks, |
|
4431 | 3346 |
returning false there." |
3347 |
||
3348 |
^ true |
|
3349 |
! |
|
3350 |
||
7563 | 3351 |
isSqueak |
3352 |
"return false here - this may be useful to write portable |
|
3353 |
applications - add #isSqueak to your squeak, |
|
4431 | 3354 |
returning true there." |
3355 |
||
3356 |
^ false |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3357 |
! |
4431 | 3358 |
|
7563 | 3359 |
isVisualAge |
3360 |
"return false here - this may be useful to write portable |
|
3361 |
applications - add #isVisualAge to your visualAge, |
|
4431 | 3362 |
returning true there." |
3363 |
||
3364 |
^ false |
|
3365 |
! |
|
3366 |
||
7563 | 3367 |
isVisualWorks |
3368 |
"return false here - this may be useful to write portable |
|
3369 |
applications - add #isVisualWorks to your visualWorks, |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3370 |
returning true there." |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3371 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3372 |
^ false |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3373 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3374 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
3375 |
!Smalltalk class methodsFor:'startup'! |
1 | 3376 |
|
9032 | 3377 |
browserWindowStartup |
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3378 |
"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
|
3379 |
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
|
3380 |
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
|
3381 |
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
|
3382 |
multiwindow application. |
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3383 |
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
|
3384 |
|
9032 | 3385 |
|windowIDString numericWindowID windowID params idx process| |
3386 |
||
3387 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
|
3388 |
windowIDString := CommandLineArguments at:idx+1. |
|
3389 |
numericWindowID := Integer fromString:windowIDString. |
|
3390 |
windowID := ExternalAddress newAddress:numericWindowID. |
|
3391 |
||
3392 |
idx := CommandLineArguments indexOf:'--browserParameters:'. |
|
3393 |
idx ~~ 0 ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3394 |
params := Dictionary new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3395 |
(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3396 |
params at:key put:value. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3397 |
]. |
9032 | 3398 |
]. |
3399 |
||
3400 |
'browserWindow is: ' errorPrint. windowID errorPrintCR. |
|
3401 |
'browserParameters are: ' errorPrint. params errorPrintCR. |
|
3402 |
'Display is: ' errorPrint. Display errorPrintCR. |
|
3403 |
||
3404 |
process := [ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3405 |
PluginSupport |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3406 |
startInBrowserWithWindowID:windowID |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3407 |
parameters:params. |
9032 | 3408 |
] newProcess. |
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3409 |
process priority:(Processor userSchedulingPriority). |
9032 | 3410 |
process name:'browser start handler'. |
3411 |
process beGroupLeader. |
|
3412 |
process resume. |
|
3413 |
process := nil. |
|
3414 |
||
3415 |
Processor dispatchLoop. |
|
3416 |
Smalltalk exit. |
|
13056
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3417 |
|
1fa92a4cd9cc
comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
3418 |
"Modified: / 11-09-2010 / 14:06:59 / cg" |
9032 | 3419 |
! |
3420 |
||
7563 | 3421 |
displayInitializationDone |
3422 |
"inform the restart, that the display has been initialized" |
|
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3423 |
|
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3424 |
CallbackSignal raiseRequest. |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3425 |
! |
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3426 |
|
13893 | 3427 |
executeStartBlocks |
3428 |
|startBlocks| |
|
3429 |
||
3430 |
startBlocks := self startBlocks. |
|
3431 |
startBlocks notNil ifTrue:[ |
|
3432 |
'Smalltalk [info]: execute startBlocks...' infoPrintCR. |
|
3433 |
startBlocks do:[:aBlock| |
|
3434 |
Error handle:[:ex | |
|
13958
698009ec817a
changed: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents:
13947
diff
changeset
|
3435 |
InfoPrinting == true ifTrue:[ |
698009ec817a
changed: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents:
13947
diff
changeset
|
3436 |
'Smalltalk [warning]: error cought in startBlock: ' infoPrint. |
698009ec817a
changed: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents:
13947
diff
changeset
|
3437 |
ex description infoPrintCR. |
698009ec817a
changed: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents:
13947
diff
changeset
|
3438 |
ex infoPrintCR. |
698009ec817a
changed: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents:
13947
diff
changeset
|
3439 |
thisContext fullPrintAll. |
698009ec817a
changed: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents:
13947
diff
changeset
|
3440 |
]. |
13893 | 3441 |
] do: aBlock |
3442 |
]. |
|
3443 |
startBlocks removeAll. |
|
3444 |
]. |
|
3445 |
||
3446 |
"Created: / 07-01-2012 / 12:58:39 / cg" |
|
3447 |
! |
|
3448 |
||
11375 | 3449 |
hideSplashWindow |
3450 |
%{ |
|
3451 |
#ifdef WIN32 |
|
3452 |
extern void __win32_hideSplashScreen(); |
|
3453 |
||
3454 |
__win32_hideSplashScreen(); |
|
3455 |
#endif |
|
3456 |
%} |
|
3457 |
! |
|
3458 |
||
7563 | 3459 |
mainStartup:graphicalMode |
3460 |
"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
|
3461 |
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
|
3462 |
|
9012 | 3463 |
|process imageName thisIsARestart idx| |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3464 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3465 |
imageName := ObjectMemory imageName. |
2249
cdb6c87f0707
send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents:
2212
diff
changeset
|
3466 |
thisIsARestart := imageName notNil. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3467 |
|
10644 | 3468 |
graphicalMode ifTrue:[ |
13850 | 3469 |
Display isNil ifTrue:[ |
3470 |
(StartupClass notNil |
|
3471 |
and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[ |
|
3472 |
self openDisplay. |
|
3473 |
]. |
|
3474 |
]. |
|
10644 | 3475 |
]. |
3476 |
||
10645 | 3477 |
StandAlone ifFalse:[ |
13850 | 3478 |
" |
3479 |
enable the graphical debugger/inspector |
|
3480 |
(they could have been (re)defined as autoloaded in the patches file) |
|
3481 |
" |
|
3482 |
self initStandardTools. |
|
10645 | 3483 |
]. |
3484 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3485 |
" |
10071 | 3486 |
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
|
3487 |
" |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3488 |
Display notNil ifTrue:[ |
13850 | 3489 |
Display deviceIOTimeoutErrorSignal handlerBlock:[:ex | |
3490 |
SaveEmergencyImage == true ifTrue:[ |
|
3491 |
'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR. |
|
3492 |
ObjectMemory primSnapShotOn:'crash.img'. |
|
3493 |
]. |
|
3494 |
'Display [warning]: broken display connection - exit.' infoPrintCR. |
|
3495 |
self exit. |
|
3496 |
]. |
|
3497 |
Display startDispatch. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3498 |
]. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3499 |
|
9016 | 3500 |
idx := CommandLineArguments indexOf:'--browserWindow:'. |
9029 | 3501 |
IsPlugin := (idx ~~ 0). |
3502 |
IsPlugin ifTrue:[ |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3503 |
'Smalltalk [info]: startup browser window...' infoPrintCR. |
13850 | 3504 |
self browserWindowStartup. |
3505 |
"/ not reached |
|
9012 | 3506 |
]. |
3507 |
||
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3508 |
Initializing := false. |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3509 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3510 |
"/ 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
|
3511 |
"/ 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
|
3512 |
"/ 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
|
3513 |
"/ 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
|
3514 |
|
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3515 |
process := [ |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3516 |
'Smalltalk [info]: startup process 1 active.' infoPrintCR. |
13850 | 3517 |
StartBlocks notNil ifTrue:[ |
13893 | 3518 |
self executeStartBlocks. |
13850 | 3519 |
StartBlocks := nil. |
3520 |
]. |
|
3521 |
ImageStartBlocks notNil ifTrue:[ |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3522 |
'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR. |
13850 | 3523 |
ImageStartBlocks do:[:aBlock| |
3524 |
aBlock value |
|
3525 |
]. |
|
3526 |
]. |
|
3527 |
StandAlone ifFalse:[ |
|
3528 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
|
3529 |
thisIsARestart ifTrue:[ |
|
3530 |
Transcript cr. |
|
3531 |
Transcript showCR:('Smalltalk restarted from:' |
|
3532 |
, imageName |
|
3533 |
, ' (saved ' |
|
3534 |
, ObjectMemory imageSaveTime printString |
|
3535 |
, ')' ). |
|
3536 |
] ifFalse:[ |
|
3537 |
Transcript showCR:(self hello). |
|
3538 |
Transcript showCR:(self copyrightString). |
|
3539 |
]. |
|
3540 |
Transcript cr. |
|
3541 |
]. |
|
3542 |
||
3543 |
DemoMode==true ifTrue:[ |
|
3544 |
Transcript showCR:'*** Restricted use: ***'. |
|
3545 |
Transcript showCR:'*** This program may be used for education only. ***'. |
|
3546 |
Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
3547 |
Transcript showCR:'*** for more details. ***'. |
|
3548 |
Transcript cr. |
|
3549 |
]. |
|
3550 |
]. |
|
3551 |
||
3552 |
thisIsARestart ifTrue:[ |
|
3553 |
"/ |
|
3554 |
"/ the final late notification - users can now assume that |
|
3555 |
"/ views, forms etc. have been recreated. |
|
3556 |
||
3557 |
ObjectMemory changed:#returnFromSnapshot. |
|
3558 |
] |
|
7039
6f1c02381145
Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents:
7000
diff
changeset
|
3559 |
|
7040 | 3560 |
] newProcess. |
3561 |
||
9043
e6106f500263
do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents:
9036
diff
changeset
|
3562 |
process priority:(Processor userSchedulingPriority). |
7043
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3563 |
process name:'start block handler'. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3564 |
process beGroupLeader. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3565 |
process resume. |
d88be9c553d2
Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents:
7040
diff
changeset
|
3566 |
process := nil. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
3567 |
|
10139
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
3568 |
ObjectMemory startBackgroundCollectorAt:5. |
a3f6265978ad
Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents:
10131
diff
changeset
|
3569 |
ObjectMemory startBackgroundFinalizationAt:5. |
1650
b4b36961d1bc
Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents:
1647
diff
changeset
|
3570 |
|
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3571 |
"/ 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
|
3572 |
"/ message. |
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
3573 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3574 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
13850 | 3575 |
" |
3576 |
allow more customization by reading an image specific rc-file |
|
3577 |
" |
|
3578 |
thisIsARestart ifTrue:[ |
|
3579 |
(imageName asFilename hasSuffix:'img') ifTrue:[ |
|
3580 |
imageName := imageName copyWithoutLast:4 |
|
3581 |
]. |
|
3582 |
self fileIn:(imageName , '.rc') |
|
3583 |
]. |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3584 |
|
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3585 |
"/ Display notNil ifTrue:[ |
6559
2ec6d0d1b821
Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents:
6539
diff
changeset
|
3586 |
"/ Display exitOnLastClose:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3587 |
"/ ]. |
2086 | 3588 |
"/ Processor exitWhenNoMoreUserProcesses:true. |
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3589 |
|
13850 | 3590 |
process := [ |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3591 |
'Smalltalk [info]: startup process 2 active.' infoPrintCR. |
13850 | 3592 |
StandAlone ifTrue:[ |
3593 |
AbortOperationRequest handle:[:ex | |
|
3594 |
'Smalltalk [info]: aborted - exit.' infoPrintCR. |
|
3595 |
OperatingSystem exit:1 |
|
3596 |
] do:[ |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3597 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR. |
13850 | 3598 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
3599 |
] |
|
3600 |
] ifFalse:[ |
|
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3601 |
('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR. |
13850 | 3602 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
3603 |
]. |
|
3604 |
||
3605 |
"/ |
|
3606 |
"/ non-GUI apps exit after the startup; |
|
3607 |
"/ assume that GUI apps have created & opened some view ... |
|
3608 |
"/ |
|
3609 |
Display isNil ifTrue:[ |
|
3610 |
'Smalltalk [info]: no Display - exit.' infoPrintCR. |
|
3611 |
Smalltalk exit. |
|
3612 |
]. |
|
3613 |
"/ |
|
3614 |
"/ GUI apps exit after the last user process has finished |
|
3615 |
"/ |
|
3616 |
Display exitOnLastClose:true. |
|
3617 |
Processor exitWhenNoMoreUserProcesses:true. |
|
3618 |
] newProcess. |
|
3619 |
process priority:(Processor userSchedulingPriority). |
|
3620 |
process name:'main'. |
|
3621 |
process beGroupLeader. |
|
3622 |
process resume. |
|
3623 |
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
|
3624 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3625 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3626 |
StandAlone ifTrue:[ |
13850 | 3627 |
Display notNil ifTrue:[ |
3628 |
FlyByHelp notNil ifTrue:[ |
|
3629 |
FlyByHelp start |
|
3630 |
]. |
|
3631 |
]. |
|
12627
144e362477ff
ask startupClass if splash window should be kept open
Claus Gittinger <cg@exept.de>
parents:
12614
diff
changeset
|
3632 |
]. |
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3633 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3634 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3635 |
if view-classes exist, start dispatching; |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3636 |
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
|
3637 |
" |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3638 |
((Display notNil and:[graphicalMode]) |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3639 |
or:[process notNil |
13851
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3640 |
or:[HeadlessOperation |
5ab434e0a636
changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents:
13850
diff
changeset
|
3641 |
or:[StandAlone]]]) ifTrue:[ |
13850 | 3642 |
Processor dispatchLoop. |
3643 |
"done - the last process finished" |
|
3644 |
'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
|
3645 |
] ifFalse:[ |
13850 | 3646 |
StandAlone ifFalse:[ |
3647 |
self readEvalPrint |
|
3648 |
] |
|
11681
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3649 |
]. |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3650 |
|
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3651 |
self exit |
4c274a7ef60c
Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents:
11679
diff
changeset
|
3652 |
|
13526 | 3653 |
"Created: / 18-07-1996 / 21:07:39 / cg" |
3654 |
"Modified: / 09-09-1996 / 17:42:50 / stefan" |
|
13893 | 3655 |
"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
|
3656 |
! |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
3657 |
|
10641 | 3658 |
openDisplay |
3659 |
"try to open a display connection. |
|
3660 |
If so, also read display- and keyboard.rc" |
|
3661 |
||
13385 | 3662 |
|commandName| |
3663 |
||
3664 |
commandName := Smalltalk commandName. |
|
3665 |
(commandName, ' [info]: opening display...') infoPrintCR. |
|
10649 | 3666 |
|
10641 | 3667 |
Display isNil ifTrue:[ |
13771 | 3668 |
Screen notNil ifTrue:[ |
3669 |
[ |
|
3670 |
Screen openDefaultDisplay:nil. |
|
3671 |
] on:Screen deviceOpenErrorSignal do:[:ex| |
|
3672 |
('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR. |
|
3673 |
(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR. |
|
3674 |
(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR. |
|
3675 |
HeadlessOperation == true ifFalse:[ |
|
3676 |
OperatingSystem exit:1. |
|
3677 |
]. |
|
3678 |
]. |
|
3679 |
||
3680 |
Display notNil ifTrue:[ |
|
3681 |
(self secureFileIn:'display.rc') ifFalse:[ |
|
3682 |
"/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR. |
|
3683 |
(self secureFileIn:'keyboard.rc') ifFalse:[ |
|
3684 |
"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR. |
|
3685 |
] |
|
3686 |
] |
|
3687 |
]. |
|
3688 |
] |
|
10641 | 3689 |
] |
3690 |
||
3691 |
"Created: / 06-12-2006 / 15:38:17 / cg" |
|
3692 |
! |
|
3693 |
||
3694 |
readEvalPrint |
|
3695 |
"{ Pragma: +optSpace }" |
|
3696 |
||
3697 |
(ReadEvalPrintLoop new prompt:'ST> ') readEvalPrintLoop |
|
3698 |
||
3699 |
"Modified: / 07-12-2006 / 17:35:19 / cg" |
|
3700 |
! |
|
3701 |
||
3702 |
restart |
|
3703 |
"startup after an image has been loaded; |
|
3704 |
there are three change-notifications made to dependents of ObjectMemory, |
|
3705 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
3706 |
||
3707 |
#earlySystemInstallation is sent for ST80 compatibility |
|
3708 |
||
3709 |
#earlyRestart is send first, nothing has been setup yet. |
|
13771 | 3710 |
(should be used to flush all device dependent entries) |
10641 | 3711 |
|
3712 |
#restarted is send right after. |
|
13771 | 3713 |
(should be used to recreate external resources (fds, bitmaps etc) |
10641 | 3714 |
|
3715 |
#returnFromSnapshot is sent last |
|
13771 | 3716 |
(should be used to restart processes, reOpen Streams which cannot |
3717 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
3718 |
(Notice that positionable fileStreams are already reopened and repositioned) |
|
10641 | 3719 |
" |
3720 |
||
3721 |
|deb insp transcript idx| |
|
3722 |
||
3723 |
"/ |
|
3724 |
"/ when we arrive here, all objects from our previous life |
|
3725 |
"/ have been reloaded - however, some may still contain invalid device |
|
3726 |
"/ handles, display information etc. |
|
3727 |
"/ also, dynamically loaded modules have not yet been reloaded yet. |
|
3728 |
"/ and the concrete OS, concrete FileName etc. are still refering to |
|
3729 |
"/ the previous classes. |
|
3730 |
||
3731 |
Initializing := true. |
|
3732 |
AbstractOperatingSystem initializeConcreteClass. |
|
3733 |
||
3734 |
ImageRestartTime := Timestamp now. |
|
3735 |
||
3736 |
CommandLine := CommandLineArguments copy. |
|
3737 |
CommandLineArguments := CommandLineArguments asOrderedCollection. |
|
3738 |
CommandName := CommandLineArguments removeFirst. "/ the command |
|
3739 |
||
3740 |
idx := CommandLineArguments indexOf:'-q'. |
|
3741 |
idx == 0 ifTrue:[ |
|
13771 | 3742 |
idx := CommandLineArguments indexOf:'--silent'. |
10641 | 3743 |
]. |
3744 |
idx ~~ 0 ifTrue:[ |
|
13771 | 3745 |
Object infoPrinting:false. |
3746 |
ObjectMemory infoPrinting:false. |
|
3747 |
CommandLineArguments removeAtIndex:idx. |
|
10641 | 3748 |
]. |
3749 |
||
3750 |
"/ |
|
3751 |
"/ start catching SIGSEGV and SIGBUS |
|
3752 |
||
3753 |
OperatingSystem enableHardSignalInterrupts. |
|
3754 |
||
3755 |
"/ reinit Filename |
|
3756 |
Filename reinitialize. |
|
3757 |
||
3758 |
"/ |
|
3759 |
"/ flush cached path directories (may have changed in the meanwhile) |
|
3760 |
||
3761 |
self flushPathCaches. |
|
3762 |
||
3763 |
"/ |
|
3764 |
"/ reinit the default streams: Stdin, Stdout and Stderr |
|
3765 |
"/ after that, we can write to stderr. |
|
3766 |
||
3767 |
self reinitStandardStreams. |
|
3768 |
||
3769 |
"/ |
|
3770 |
"/ redirect Transcript to Stderr during startup |
|
3771 |
||
3772 |
transcript := Transcript. |
|
3773 |
Transcript := Stderr. |
|
3774 |
||
3775 |
"/ |
|
3776 |
"/ temporary switch back to dumb interface - |
|
3777 |
"/ to handle errors while view-stuff is not yet reinitialized |
|
3778 |
||
3779 |
insp := Inspector. |
|
3780 |
deb := Debugger. |
|
3781 |
deb notNil ifTrue:[ |
|
13771 | 3782 |
deb reinitialize |
10641 | 3783 |
]. |
3784 |
Inspector := MiniInspector. |
|
3785 |
Debugger := MiniDebugger. |
|
3786 |
||
3787 |
"/ reload any dynamically loaded objects. |
|
3788 |
"/ this must be done before doing anything else below, |
|
3789 |
"/ because the Processor may restart processes which use |
|
3790 |
"/ this code. |
|
3791 |
"/ Also, a dynamic object might be registered as dependent of |
|
3792 |
"/ ObjectFileLoader; therefore, must reload before doing any notifications. |
|
3793 |
||
3794 |
ObjectFileLoader notNil ifTrue:[ |
|
13771 | 3795 |
ObjectFileLoader reloadAllRememberedObjectFiles. |
10641 | 3796 |
]. |
3797 |
||
3798 |
"/ |
|
3799 |
"/ invalidate all display connections. |
|
3800 |
"/ This is required to avoid trouble if someone accesses |
|
3801 |
"/ a display during early startup. |
|
3802 |
||
3803 |
Screen notNil ifTrue:[ |
|
13771 | 3804 |
Screen allScreens do:[:aDisplay | |
3805 |
aDisplay invalidateConnection |
|
3806 |
]. |
|
10641 | 3807 |
]. |
3808 |
||
3809 |
ObjectMemory changed:#earlySystemInstallation. |
|
3810 |
||
3811 |
"/ |
|
3812 |
"/ reinitialize the Processor - restartable processes |
|
3813 |
"/ are now restarted here (but not yet scheduled). |
|
3814 |
"/ |
|
3815 |
Processor reinitialize. |
|
3816 |
||
3817 |
"/ |
|
3818 |
"/ flush device handles & recreate OS resources (if possible) |
|
3819 |
"/ (mostly view/GC/color & font stuff) |
|
3820 |
||
3821 |
ObjectMemory |
|
13771 | 3822 |
changed:#earlyRestart; changed:#restarted. |
10641 | 3823 |
|
3824 |
"/ |
|
3825 |
"/ start catching SIGINT and SIGQUIT |
|
3826 |
||
3827 |
OperatingSystem enableUserInterrupts. |
|
3828 |
OperatingSystem enableCrashSignalInterrupts. |
|
12782 | 3829 |
ObjectMemory restoreGarbageCollectorSettings. |
10641 | 3830 |
|
3831 |
"/ give user a chance to re-customize things in smalltalk_r.rc. |
|
3832 |
"/ reading if smalltalk_r.rc may be suppressed by the --faststart argument. |
|
3833 |
||
3834 |
idx := CommandLineArguments indexOf:'--faststart'. |
|
3835 |
idx == 0 ifTrue:[ |
|
13771 | 3836 |
idx := CommandLineArguments indexOf:'--fastStart'. |
10641 | 3837 |
]. |
3838 |
idx ~~ 0 ifTrue:[ |
|
13771 | 3839 |
CommandLineArguments removeAtIndex:idx. |
10641 | 3840 |
] ifFalse:[ |
13771 | 3841 |
CallbackSignal := QuerySignal new. |
3842 |
[ |
|
3843 |
Class withoutUpdatingChangesDo:[ |
|
3844 |
(self fileIn:(self commandName , '_r.rc')) ifFalse:[ |
|
3845 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
|
3846 |
self fileIn:'smalltalk_r.rc' |
|
3847 |
]. |
|
3848 |
] |
|
3849 |
] on:CallbackSignal do:[:ex| |
|
3850 |
"/ now, display and view-stuff works; |
|
3851 |
"/ back to the previous debugging interface |
|
3852 |
||
3853 |
Inspector := insp. |
|
3854 |
Debugger := deb. |
|
3855 |
||
3856 |
"/ reinstall Transcript, if not changed during restart. |
|
3857 |
"/ if there was no Transcript, go to stderr |
|
3858 |
||
3859 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
3860 |
Transcript := transcript. |
|
3861 |
]. |
|
3862 |
Initializing := false. |
|
3863 |
ex proceed. |
|
3864 |
]. |
|
3865 |
CallbackSignal := nil. |
|
10641 | 3866 |
]. |
3867 |
||
3868 |
"/ reinitialization (restart) of Display is normally performed |
|
3869 |
"/ in the restart script. If this has not been run for some reason, |
|
3870 |
"/ do in now. |
|
3871 |
Initializing ifTrue:[ |
|
13771 | 3872 |
Display notNil ifTrue:[ |
3873 |
[ |
|
3874 |
Display reinitializeFor:Screen defaultDisplayName. |
|
3875 |
] on:Screen deviceOpenErrorSignal do:[ |
|
3876 |
'Smalltalk [error]: Cannot restart connection to: ' errorPrint. |
|
3877 |
Screen defaultDisplayName errorPrintCR. |
|
3878 |
OperatingSystem exit:1. |
|
3879 |
]. |
|
3880 |
]. |
|
3881 |
"/ now, display and view-stuff works; |
|
3882 |
"/ back to the previous debugging interface |
|
3883 |
||
3884 |
Inspector := insp. |
|
3885 |
Debugger := deb. |
|
3886 |
||
3887 |
"/ reinstall Transcript, if not changed during restart. |
|
3888 |
"/ if there was no Transcript, go to stderr |
|
3889 |
||
3890 |
(transcript notNil and:[Transcript == Stderr]) ifTrue:[ |
|
3891 |
Transcript := transcript. |
|
3892 |
]. |
|
3893 |
Initializing := false. |
|
10641 | 3894 |
]. |
3895 |
Screen notNil ifTrue:[ |
|
13771 | 3896 |
"clean up leftover screens (and views) that haven't been reopened. |
3897 |
Operate on a copy, since brokenConnection removes us from AllScreens" |
|
3898 |
Screen allScreens copy do:[:eachDisplay | |
|
3899 |
eachDisplay isOpen ifFalse:[ |
|
3900 |
'Smalltalk [info]: cannot reopen secondary display: ' errorPrint. |
|
3901 |
eachDisplay errorPrintCR. |
|
3902 |
eachDisplay cleanupAfterDispatch; brokenConnection. |
|
3903 |
] |
|
3904 |
]. |
|
10641 | 3905 |
]. |
3906 |
||
3907 |
deb := insp := transcript := nil. "avoid dangling refs" |
|
13526 | 3908 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
13771 | 3909 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 3910 |
]. |
10641 | 3911 |
self mainStartup:true |
3912 |
||
13526 | 3913 |
"Modified: / 03-08-1999 / 09:42:21 / stefan" |
3914 |
"Modified: / 29-07-2011 / 17:58:23 / cg" |
|
1 | 3915 |
! |
3916 |
||
11399 | 3917 |
showSplashMessage:aString |
3918 |
"put the message into the splash screen (if there is one). |
|
3919 |
Use this for messages during startup" |
|
3920 |
||
3921 |
self showSplashMessage:aString color:nil. |
|
3922 |
! |
|
3923 |
||
11388 | 3924 |
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil |
11389 | 3925 |
"put the message into the splash screen (if there is one)." |
3926 |
||
11388 | 3927 |
%{ |
3928 |
#ifdef WIN32 |
|
3929 |
extern void __win32_splashMessage(); |
|
3930 |
char *msg = (char *)0; |
|
3931 |
int clr = 0; |
|
3932 |
||
12481
805176d238d2
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
12413
diff
changeset
|
3933 |
if (__isStringLike(aMessageStringOrNil)) { |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3934 |
msg = __stringVal(aMessageStringOrNil); |
11388 | 3935 |
} |
3936 |
if (__isSmallInteger(rgbValueOrNil)) { |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3937 |
clr = __intVal(rgbValueOrNil); |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
3938 |
__win32_splashMessageColor(clr); |
11388 | 3939 |
} |
3940 |
__win32_splashMessage(msg); |
|
3941 |
#endif |
|
3942 |
%} |
|
3943 |
! |
|
3944 |
||
3945 |
splashInfo:aString |
|
11389 | 3946 |
"like infoPrintCR, |
3947 |
but in addition put the message into the splash screen (if there is one). |
|
3948 |
Use this for info messages during startup" |
|
3949 |
||
12883 | 3950 |
aString notNil ifTrue:[ aString infoPrintCR ]. |
11388 | 3951 |
self showSplashMessage:aString color:nil. |
3952 |
! |
|
3953 |
||
7563 | 3954 |
start |
3955 |
"main startup, if there is a Display, initialize it |
|
3956 |
and start dispatching; otherwise go into a read-eval-print loop." |
|
617 | 3957 |
|
9012 | 3958 |
|idx graphicalMode arg didReadRCFile| |
960
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3959 |
|
e3b75f50d0cd
changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents:
948
diff
changeset
|
3960 |
graphicalMode := true. |
617 | 3961 |
Initializing := true. |
3962 |
||
13526 | 3963 |
(StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[ |
13771 | 3964 |
self hideSplashWindow. "/ if there is one, it's now time to hide it |
13526 | 3965 |
]. |
3966 |
||
617 | 3967 |
" |
3968 |
while reading patches- and rc-file, do not add things into change-file |
|
3969 |
" |
|
3970 |
Class withoutUpdatingChangesDo:[ |
|
13771 | 3971 |
|commandFile defaultRC prevCatchSetting| |
3972 |
||
3973 |
didReadRCFile := false. |
|
3974 |
||
3975 |
StandAlone ifFalse:[ |
|
3976 |
"/ |
|
3977 |
"/ look for any '-q', '-e' or '-f' command line arguments |
|
3978 |
"/ and handle them; |
|
3979 |
"/ read startup and patches file |
|
3980 |
"/ |
|
3981 |
idx := CommandLineArguments indexOf:'-q'. |
|
3982 |
idx == 0 ifTrue:[ |
|
3983 |
idx := CommandLineArguments indexOf:'--silent'. |
|
3984 |
]. |
|
3985 |
idx ~~ 0 ifTrue:[ |
|
3986 |
Object infoPrinting:false. |
|
3987 |
ObjectMemory infoPrinting:false. |
|
3988 |
CommandLineArguments removeAtIndex:idx. |
|
3989 |
]. |
|
3990 |
||
3991 |
"/ look for a '--repl' argument |
|
3992 |
"/ then go into a read-eval-print loop immediately |
|
3993 |
idx := CommandLineArguments indexOf:'--repl'. |
|
3994 |
idx ~~ 0 ifTrue:[ |
|
3995 |
CommandLineArguments removeAtIndex:idx. |
|
3996 |
self startSchedulerAndBackgroundCollector. |
|
3997 |
self readEvalPrint. |
|
3998 |
self exit. |
|
3999 |
]. |
|
4000 |
||
4001 |
"/ look for a '-e filename' or '--execute filename' argument |
|
4002 |
"/ this will force fileIn of filename only, no standard startup. |
|
4003 |
||
4004 |
idx := CommandLineArguments indexOf:'-e'. |
|
4005 |
idx == 0 ifTrue:[ |
|
4006 |
idx := CommandLineArguments indexOf:'--execute'. |
|
4007 |
idx == 0 ifTrue:[ |
|
4008 |
idx := CommandLineArguments indexOf:'--script'. |
|
4009 |
idx ~~ 0 ifTrue:[ |
|
4010 |
SilentLoading := true. |
|
4011 |
]. |
|
4012 |
]. |
|
4013 |
]. |
|
4014 |
idx ~~ 0 ifTrue:[ |
|
4015 |
|process| |
|
4016 |
||
4017 |
CommandName := arg := CommandLineArguments at:idx + 1. |
|
4018 |
||
4019 |
CommandLineArguments |
|
4020 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4021 |
||
4022 |
self startSchedulerAndBackgroundCollector. |
|
4023 |
process := [ |
|
4024 |
arg = '-' ifTrue:[ |
|
4025 |
self fileInStream:Stdin |
|
4026 |
lazy:nil |
|
4027 |
silent:nil |
|
4028 |
logged:false |
|
4029 |
addPath:nil |
|
4030 |
] ifFalse:[ |
|
4031 |
IsSTScript := true. |
|
4032 |
self fileIn:arg. |
|
4033 |
]. |
|
4034 |
self exit. |
|
4035 |
] newProcess. |
|
4036 |
process priority:(Processor userSchedulingPriority). |
|
4037 |
process name:'main'. |
|
4038 |
process beGroupLeader. |
|
4039 |
process resume. |
|
4040 |
||
4041 |
Processor dispatchLoop. |
|
4042 |
self exit |
|
4043 |
]. |
|
4044 |
||
4045 |
"/ look for a '-E expr' or '--eval expr' argument |
|
4046 |
"/ this will force evaluation of expr only, no standard startup |
|
4047 |
idx := CommandLineArguments indexOf:'-E'. |
|
4048 |
idx == 0 ifTrue:[ |
|
4049 |
idx := CommandLineArguments indexOf:'--eval'. |
|
4050 |
]. |
|
4051 |
idx ~~ 0 ifTrue:[ |
|
4052 |
arg := CommandLineArguments at:idx + 1. |
|
4053 |
||
4054 |
CommandLineArguments |
|
4055 |
removeAtIndex:idx+1; removeAtIndex:idx. |
|
4056 |
||
4057 |
self startSchedulerAndBackgroundCollector. |
|
4058 |
self |
|
4059 |
fileInStream:arg readStream |
|
4060 |
lazy:nil |
|
4061 |
silent:nil |
|
4062 |
logged:false |
|
4063 |
addPath:nil. |
|
4064 |
||
4065 |
self exit |
|
4066 |
]. |
|
4067 |
||
4068 |
"look for a '-f filename' or '--file filename' argument |
|
4069 |
this will force evaluation of filename instead of smalltalk.rc" |
|
4070 |
||
4071 |
idx := CommandLineArguments indexOf:'-f'. |
|
4072 |
idx == 0 ifTrue:[ |
|
4073 |
idx := CommandLineArguments indexOf:'--file'. |
|
4074 |
]. |
|
4075 |
idx ~~ 0 ifTrue:[ |
|
4076 |
CommandName := commandFile := CommandLineArguments at:idx+1. |
|
4077 |
CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx. |
|
4078 |
]. |
|
4079 |
]. |
|
4080 |
||
4081 |
commandFile notNil ifTrue:[ |
|
4082 |
self startSchedulerAndBackgroundCollector. |
|
4083 |
(self secureFileIn:commandFile) ifFalse:[ |
|
4084 |
('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR. |
|
4085 |
OperatingSystem exit:1. |
|
4086 |
]. |
|
4087 |
] ifFalse:[ |
|
4088 |
"/ look for <command>.rc |
|
4089 |
"/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation) |
|
4090 |
||
4091 |
commandFile := self commandName asFilename withSuffix:'rc'. |
|
4092 |
(didReadRCFile := commandFile exists and:[self secureFileIn:commandFile]) ifFalse:[ |
|
4093 |
StandAlone ifFalse:[ |
|
4094 |
defaultRC := 'smalltalk.rc' asFilename |
|
4095 |
] ifTrue:[ |
|
4096 |
defaultRC := 'stxapp.rc' asFilename |
|
4097 |
]. |
|
4098 |
||
4099 |
didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC]. |
|
4100 |
didReadRCFile ifFalse:[ |
|
4101 |
StandAlone ifFalse:[ |
|
4102 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4103 |
graphicalMode := false. |
|
4104 |
] |
|
4105 |
] |
|
4106 |
]. |
|
4107 |
||
4108 |
"/ ('StandAlone is %1' bindWith:StandAlone) printCR. |
|
4109 |
"/ ('Headless is %1' bindWith:HeadlessOperation) printCR. |
|
4110 |
"/ ('Display is %1' bindWith:Display) printCR. |
|
4111 |
"/ ('Screen is %1' bindWith:Screen) printCR. |
|
4112 |
||
4113 |
didReadRCFile ifFalse:[ |
|
4114 |
'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ]. |
|
4115 |
||
4116 |
"/ |
|
4117 |
"/ No RC file found; |
|
4118 |
"/ Setup more default stuff |
|
4119 |
"/ |
|
4120 |
StandAlone ifFalse:[ |
|
4121 |
"/ its a smalltalk - proceed in interpreter. |
|
4122 |
'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR. |
|
4123 |
graphicalMode := false. |
|
4124 |
]. |
|
4125 |
||
4126 |
"/ setup more defaults... |
|
13537 | 4127 |
"/ ObjectMemory startBackgroundCollectorAt:5. |
4128 |
"/ ObjectMemory startBackgroundFinalizationAt:5. |
|
13771 | 4129 |
self addStartBlock:[ |
4130 |
self startSchedulerAndBackgroundCollector |
|
4131 |
]. |
|
4132 |
]. |
|
4133 |
]. |
|
617 | 4134 |
]. |
4135 |
||
10644 | 4136 |
HeadlessOperation ifTrue:[ |
13771 | 4137 |
graphicalMode := false. |
2074
01f7e1396c18
fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents:
2050
diff
changeset
|
4138 |
]. |
10645 | 4139 |
|
1578
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4140 |
self mainStartup:graphicalMode |
9df8cc1ec5c4
start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents:
1573
diff
changeset
|
4141 |
|
13564 | 4142 |
"Modified: / 07-08-2011 / 16:55:21 / cg" |
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4143 |
! |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4144 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4145 |
startSchedulerAndBackgroundCollector |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4146 |
Processor startTimeSlicing. |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4147 |
Processor supportDynamicPriorities:true. |
13537 | 4148 |
|
4149 |
ObjectMemory startBackgroundCollectorAt:5. |
|
4150 |
ObjectMemory startBackgroundFinalizationAt:5. |
|
13536
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4151 |
ObjectMemory backgroundCollectProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4152 |
ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9). |
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4153 |
|
839fe9c57304
added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents:
13532
diff
changeset
|
4154 |
"Created: / 31-07-2011 / 20:01:33 / cg" |
11808
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4155 |
! |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4156 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4157 |
startStartBlockProcess |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4158 |
"at the end of the smalltalk initialization, start all actions that |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4159 |
were delayed until the ProcessorScheduler is running in a separate process" |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4160 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4161 |
|p| |
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4162 |
|
14b417cf2b51
Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents:
11690
diff
changeset
|
4163 |
p := |
13892 | 4164 |
[ |
13893 | 4165 |
self executeStartBlocks. |
13892 | 4166 |
] newProcess. |
12022 | 4167 |
|
4168 |
p |
|
13892 | 4169 |
priority:(Processor userSchedulingPriority); |
4170 |
name:'start block handler'; |
|
4171 |
beGroupLeader; |
|
4172 |
resume. |
|
4173 |
||
13893 | 4174 |
"Modified: / 07-01-2012 / 12:59:01 / cg" |
1097 | 4175 |
! ! |
4176 |
||
13947 | 4177 |
!Smalltalk class methodsFor:'startup and exit'! |
4178 |
||
4179 |
addExitBlock:aBlock |
|
4180 |
"{ Pragma: +optSpace }" |
|
4181 |
||
4182 |
"add a block to be executed when Smalltalk finishes. |
|
4183 |
This feature is currently not used anywhere - but could be useful for |
|
4184 |
cleanup in stand alone applications. |
|
4185 |
||
4186 |
Better use: ObjectMemory>>#addDependent: and handle the change message |
|
4187 |
#aboutToQuit." |
|
4188 |
||
4189 |
ExitBlocks isNil ifTrue:[ |
|
4190 |
ExitBlocks := OrderedCollection with:aBlock |
|
4191 |
] ifFalse:[ |
|
4192 |
ExitBlocks add:aBlock |
|
4193 |
] |
|
4194 |
! |
|
4195 |
||
4196 |
addImageStartBlock:aBlock |
|
4197 |
"{ Pragma: +optSpace }" |
|
4198 |
||
4199 |
"add a blocks to be executed in a separate process after |
|
4200 |
everything has been initialized. |
|
4201 |
These blocks will be executed after an image restart." |
|
4202 |
||
4203 |
ImageStartBlocks isNil ifTrue:[ |
|
4204 |
ImageStartBlocks := OrderedCollection with:aBlock |
|
4205 |
] ifFalse:[ |
|
4206 |
ImageStartBlocks add:aBlock |
|
4207 |
] |
|
4208 |
||
4209 |
"Created: 9.9.1996 / 16:48:20 / stefan" |
|
4210 |
! |
|
4211 |
||
4212 |
addStartBlock:aBlock |
|
4213 |
"add a block to be executed in a separate process after |
|
4214 |
everything has been initialized. These blocks will |
|
4215 |
be executed only once and not be executed after an image restart. |
|
4216 |
Initial processes such as the launcher are usually started here |
|
4217 |
(see smalltalk.rc / private.rc)." |
|
4218 |
||
4219 |
"{ Pragma: +optSpace }" |
|
4220 |
||
4221 |
StartBlocks isNil ifTrue:[ |
|
4222 |
StartBlocks := OrderedCollection with:aBlock |
|
4223 |
] ifFalse:[ |
|
4224 |
StartBlocks add:aBlock |
|
4225 |
] |
|
4226 |
||
4227 |
"Created: / 09-09-1996 / 16:46:53 / stefan" |
|
4228 |
"Modified (comment): / 18-08-2011 / 09:18:42 / cg" |
|
4229 |
! |
|
4230 |
||
4231 |
exit |
|
4232 |
"{ Pragma: +optSpace }" |
|
4233 |
||
4234 |
"finish the Smalltalk system" |
|
4235 |
||
4236 |
self exit:0 |
|
4237 |
"not reached" |
|
4238 |
||
4239 |
"Be careful evaluating this |
|
4240 |
Smalltalk exit |
|
4241 |
" |
|
4242 |
! |
|
4243 |
||
4244 |
exit:statusInteger |
|
4245 |
"{ Pragma: +optSpace }" |
|
4246 |
||
4247 |
"finish the Smalltalk system" |
|
4248 |
||
4249 |
ObjectMemory changed:#aboutToExit. "/ for ST/X backward compatibility |
|
4250 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
4251 |
ExitBlocks notNil ifTrue:[ |
|
4252 |
ExitBlocks do:[:aBlock | |
|
4253 |
aBlock value |
|
4254 |
] |
|
4255 |
]. |
|
4256 |
OperatingSystem exit:statusInteger |
|
4257 |
"not reached" |
|
4258 |
||
4259 |
"Be careful evaluating this |
|
4260 |
Smalltalk exit:1 |
|
4261 |
" |
|
4262 |
! ! |
|
4263 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4264 |
!Smalltalk class methodsFor:'startup queries'! |
1097 | 4265 |
|
10641 | 4266 |
commandLine |
4267 |
"return the full command line arguments (with which ST/X was started)" |
|
4268 |
||
4269 |
^ CommandLine |
|
4270 |
||
4271 |
" |
|
4272 |
Smalltalk commandLine |
|
4273 |
" |
|
4274 |
||
4275 |
"Created: 19.7.1996 / 11:09:06 / cg" |
|
4276 |
! |
|
4277 |
||
4278 |
commandLineArgumentNamed:aString |
|
4279 |
"extract a named argument from the command line arguments." |
|
4280 |
||
4281 |
|args index| |
|
4282 |
||
4283 |
args := self commandLineArguments. |
|
4284 |
index := args indexOf:aString. |
|
4285 |
(index between:1 and:(args size - 1)) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4286 |
^ args at:index+1 |
10641 | 4287 |
]. |
4288 |
^ nil. |
|
4289 |
||
4290 |
" |
|
4291 |
self commandLineArgumentNamed:'-display' |
|
4292 |
" |
|
4293 |
! |
|
4294 |
||
4295 |
commandLineArguments |
|
4296 |
"return the user command line arguments; |
|
4297 |
This is a collection of strings (separated command line words), |
|
4298 |
from which the internal startup arguments have already been removed. |
|
4299 |
I.e. if started with: 'smalltalk -I -f xxx foo bar baz', |
|
4300 |
the commandLineArguments will be #('foo' 'bar' 'baz'). |
|
4301 |
In contrast, the value returned by #commandLine will be the full set of words." |
|
4302 |
||
4303 |
^ CommandLineArguments |
|
4304 |
||
4305 |
"Modified: 19.7.1996 / 11:11:03 / cg" |
|
4306 |
! |
|
4307 |
||
4308 |
commandName |
|
4309 |
"return the excutables name - this is normally 'stx', |
|
4310 |
but can be something else for standAlone apps." |
|
4311 |
||
4312 |
^ CommandName. |
|
4313 |
||
4314 |
" |
|
4315 |
Smalltalk commandName |
|
4316 |
" |
|
4317 |
||
4318 |
"Modified: 19.7.1996 / 11:11:16 / cg" |
|
4319 |
! |
|
4320 |
||
4321 |
hasNoConsole |
|
4322 |
"return true, if this is a console-less application (i.e. I am winstx) |
|
4323 |
i.e. there should be no writing to stdout/stderr" |
|
4324 |
||
4325 |
^ HasNoConsole ? false |
|
4326 |
||
4327 |
" |
|
10071 | 4328 |
Smalltalk hasNoConsole |
9054 | 4329 |
" |
4330 |
! |
|
4331 |
||
10641 | 4332 |
isHeadless |
4333 |
"return true, if this is a headless application |
|
4334 |
i.e. no default Display connection is required/used" |
|
4335 |
||
4336 |
^ HeadlessOperation ? false |
|
4337 |
||
4338 |
" |
|
10071 | 4339 |
Smalltalk isHeadless |
9029 | 4340 |
" |
4341 |
! |
|
4342 |
||
10641 | 4343 |
isPlugin |
4344 |
"return true, if this is a plugin application |
|
4345 |
i.e. running in a browserWindow" |
|
4346 |
||
4347 |
^ IsPlugin ? false |
|
4348 |
||
4349 |
" |
|
10071 | 4350 |
Smalltalk isPlugin |
9029 | 4351 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4352 |
! |
4957 | 4353 |
|
10641 | 4354 |
isSTScript |
4355 |
"return true, if this is stscript. i.e. the stx scripting engine." |
|
4356 |
||
4357 |
^ IsSTScript ? false |
|
4358 |
||
4359 |
" |
|
4360 |
Smalltalk isSTScript |
|
4361 |
" |
|
4362 |
||
4363 |
"Created: / 06-12-2006 / 16:41:21 / cg" |
|
4364 |
! |
|
4365 |
||
4366 |
isSharedLibraryComponent |
|
4367 |
"return true, if this is a shared library component of another application |
|
4368 |
i.e. a dll within another app." |
|
4369 |
||
4370 |
^ IsSharedLibraryComponent ? false |
|
4371 |
||
4372 |
" |
|
4373 |
Smalltalk isSharedLibraryComponent |
|
4374 |
" |
|
4375 |
||
4376 |
"Created: / 10-08-2006 / 13:09:34 / cg" |
|
4377 |
! |
|
4378 |
||
4379 |
isSmalltalkDevelopmentSystem |
|
4380 |
"return true, if this is a real smalltalk system |
|
4381 |
i.e. NOT a stripped or a linked application (such as the webServer) |
|
4382 |
and NOT a plugIn (i.e. running in a browser) |
|
4383 |
and NOT a sharedLibrary component (i.e. a dll in another app). |
|
4384 |
This is used to determine, wether debugging is possible or not." |
|
4385 |
||
4386 |
self isPlugin ifTrue:[^ false]. "/ I am a browser-plugin |
|
4387 |
self isSharedLibraryComponent ifTrue:[^ false]. "/ I am a COM-ponent |
|
4388 |
self isSTScript ifTrue:[^ true ]. "/ I am stScript |
|
10999 | 4389 |
^ self isStandAloneApp not. |
10641 | 4390 |
|
4391 |
" |
|
4392 |
Smalltalk isSmalltalkDevelopmentSystem |
|
4393 |
" |
|
4394 |
||
4395 |
"Created: / 10-08-2006 / 13:12:49 / cg" |
|
4396 |
"Modified: / 06-12-2006 / 16:42:56 / cg" |
|
4397 |
! |
|
4398 |
||
4399 |
isStandAloneApp |
|
4400 |
"return true, if this is a standAlone application |
|
4401 |
i.e. a stripped & linked application (such as the webServer) |
|
4402 |
in contrast to a full smalltalk (development) system." |
|
4403 |
||
4404 |
^ StandAlone ? false |
|
4405 |
||
4406 |
" |
|
10071 | 4407 |
Smalltalk isStandAloneApp |
9029 | 4408 |
" |
617 | 4409 |
! |
4410 |
||
13947 | 4411 |
isStandAloneDebug |
4412 |
"return true, if this is a standAlone application which |
|
4413 |
was started with the -debug option." |
|
4414 |
||
4415 |
^ DebuggingStandAlone ? false |
|
4416 |
||
4417 |
" |
|
4418 |
Smalltalk isStandAloneDebug |
|
4419 |
" |
|
4420 |
||
4421 |
"Created: / 19-01-2012 / 10:17:41 / cg" |
|
4422 |
! |
|
4423 |
||
10641 | 4424 |
startupArguments |
4425 |
"return the arguments passed to StartupClass when stx gets started. |
|
4426 |
Usually these are nil, |
|
4427 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
4428 |
a simple way to configure and create stand-alone applications" |
|
4429 |
||
4430 |
^ StartupArguments |
|
4431 |
||
4432 |
" |
|
10071 | 4433 |
Smalltalk startupArguments |
9029 | 4434 |
" |
7563 | 4435 |
! |
4436 |
||
10641 | 4437 |
startupClass |
4438 |
"return the class, that will get the start message when smalltalk |
|
4439 |
starts and its non-nil. Usually this is nil, |
|
4440 |
but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for |
|
4441 |
a simple way to configure and create stand-alone applications" |
|
4442 |
||
4443 |
^ StartupClass |
|
4444 |
||
4445 |
" |
|
10071 | 4446 |
Smalltalk startupClass |
9029 | 4447 |
" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4448 |
! |
8570 | 4449 |
|
10641 | 4450 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
4451 |
"{ Pragma: +optSpace }" |
|
4452 |
||
4453 |
"set the class, selector and arguments to be performed when smalltalk |
|
4454 |
starts. Setting those before saving a snapshot, will make the saved |
|
4455 |
image come up executing your application (instead of the normal mainloop)" |
|
4456 |
||
4457 |
StartupClass := aClass. |
|
4458 |
StartupSelector := aSymbol. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4459 |
StartupArguments := anArrayOrNil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4460 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4461 |
|
10641 | 4462 |
startupSelector |
4463 |
"return the selector, that will be sent to StartupClass. |
|
4464 |
Usually this is nil, |
|
4465 |
but saving an image with a non-nil StartupClass/StartupSelector allows for |
|
4466 |
a simple way to configure and create stand-alone applications" |
|
4467 |
||
4468 |
^ StartupSelector |
|
4469 |
||
4470 |
" |
|
10071 | 4471 |
Smalltalk startupSelector |
9029 | 4472 |
" |
10641 | 4473 |
! |
4474 |
||
4475 |
wasStartedFromImage |
|
4476 |
"return true, if this smalltalk was started from an image, |
|
4477 |
as opposed to a fresh and clean startup" |
|
4478 |
||
4479 |
^ ImageRestartTime notNil |
|
4480 |
||
4481 |
" |
|
4482 |
Smalltalk wasStartedFromImage |
|
4483 |
" |
|
70 | 4484 |
! ! |
4485 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4486 |
!Smalltalk class methodsFor:'system environment'! |
1069 | 4487 |
|
10641 | 4488 |
language |
4489 |
"return the language setting" |
|
4490 |
||
4491 |
^ Language |
|
4492 |
||
4493 |
" |
|
4494 |
Smalltalk language |
|
4495 |
" |
|
4496 |
||
4497 |
"Modified: 26.4.1996 / 17:10:05 / cg" |
|
4498 |
! |
|
4499 |
||
4500 |
language:aLanguageSymbol |
|
10991 | 4501 |
"set the language - send out change notifications" |
10641 | 4502 |
|
4503 |
Language := aLanguageSymbol asSymbol. |
|
4504 |
self changed:#Language |
|
4505 |
||
4506 |
" |
|
4507 |
Smalltalk language:#de |
|
4508 |
" |
|
4509 |
||
4510 |
"Modified: / 19-10-2006 / 23:17:29 / cg" |
|
4511 |
! |
|
4512 |
||
4513 |
language:aLanguageSymbol territory:aTerritorySymbol |
|
10991 | 4514 |
"set the language & territory - send out change notifications" |
10641 | 4515 |
|
4516 |
Language := aLanguageSymbol asSymbol. |
|
4517 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
4518 |
self changed:#Language |
|
4519 |
||
4520 |
" |
|
4521 |
Smalltalk language:#de territory:#de |
|
4522 |
" |
|
4523 |
||
4524 |
"Created: / 19-10-2006 / 22:16:22 / cg" |
|
4525 |
"Modified: / 19-10-2006 / 23:17:36 / cg" |
|
4526 |
! |
|
4527 |
||
13212
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4528 |
languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4529 |
"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
|
4530 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4531 |
^ Language , '-' , (LanguageTerritory ? Language) |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4532 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4533 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4534 |
Smalltalk languageAndTerritory |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4535 |
" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4536 |
|
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4537 |
"Created: / 16-01-2011 / 10:19:42 / cg" |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4538 |
! |
e75edfda9b2e
added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents:
13135
diff
changeset
|
4539 |
|
10641 | 4540 |
languageTerritory |
4541 |
"return the language territory setting" |
|
7563 | 4542 |
|
4543 |
^ LanguageTerritory |
|
4544 |
! |
|
4545 |
||
10641 | 4546 |
languageTerritory:aTerritorySymbol |
10991 | 4547 |
"set the language territory - send out change notifications" |
10641 | 4548 |
|
4549 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
4550 |
self changed:#LanguageTerritory |
|
4551 |
||
4552 |
" |
|
4553 |
Time now |
|
4554 |
||
4555 |
Smalltalk languageTerritory:#us. |
|
4556 |
Time now |
|
4557 |
||
4558 |
Smalltalk languageTerritory:#de. |
|
4559 |
Time now |
|
4560 |
" |
|
4561 |
||
4562 |
"Modified: / 19-10-2006 / 23:17:40 / cg" |
|
4563 |
! |
|
4564 |
||
4565 |
setLanguage:aLanguageSymbol |
|
10991 | 4566 |
"set the language without change notification" |
10641 | 4567 |
|
4568 |
Language := aLanguageSymbol. |
|
10991 | 4569 |
! |
4570 |
||
4571 |
setLanguage:aLanguageSymbol territory:aTerritorySymbol |
|
4572 |
"set the language & territory - no change notification" |
|
4573 |
||
4574 |
Language := aLanguageSymbol asSymbol. |
|
4575 |
LanguageTerritory := aTerritorySymbol asSymbol. |
|
1069 | 4576 |
! ! |
4577 |
||
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
4578 |
!Smalltalk class methodsFor:'system management'! |
70 | 4579 |
|
10641 | 4580 |
compressSources |
4581 |
"{ Pragma: +optSpace }" |
|
4582 |
||
4583 |
"compress the sources file, and remove all method source strings |
|
4584 |
from the system and replace them by refs to a string in the source file. |
|
4585 |
This is a bit different in ST/X than in other smalltalks, |
|
4586 |
since we use per-class sourcefiles for the compiled classes, |
|
4587 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
4588 |
incremental compiled methods. |
|
4589 |
Therefore, only those sources which are not coming from compiled |
|
4590 |
methods are put into the 'st.src' file - all others are untouched. |
|
4591 |
This is being automated - so dont care for now." |
|
4592 |
||
4593 |
|newStream table source pos fileName| |
|
4594 |
||
4595 |
" |
|
4596 |
first, find all methods which contain either a string-ref |
|
4597 |
or an external string in the 'st.src' file |
|
4598 |
" |
|
4599 |
newStream := 'src.tmp' asFilename writeStream. |
|
4600 |
||
4601 |
table := IdentityDictionary new:100. |
|
4602 |
||
4603 |
Method allSubInstancesDo:[:aMethod | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4604 |
source := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4605 |
aMethod sourcePosition notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4606 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4607 |
source := aMethod source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4608 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4609 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4610 |
source := aMethod source |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4611 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4612 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4613 |
source notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4614 |
pos := newStream position1Based. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4615 |
newStream nextChunkPut:source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4616 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4617 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4618 |
dont change the methods info - maybe some write error |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4619 |
occurs later, in that case we abort and leave everything |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4620 |
untouched. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4621 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4622 |
table at:aMethod put:pos |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4623 |
] |
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4624 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4625 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4626 |
newStream syncData; close. |
10641 | 4627 |
|
4628 |
" |
|
4629 |
now, rename the new source file, |
|
4630 |
" |
|
4631 |
fileName := (ObjectMemory nameForSources). |
|
4632 |
'src.tmp' asFilename renameTo:fileName. |
|
4633 |
||
4634 |
"good - now go over all changed methods, and change their |
|
4635 |
source reference" |
|
4636 |
||
4637 |
table keysAndValuesDo:[:aMethod :pos | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4638 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 4639 |
"/ aMethod printCR. |
4640 |
]. |
|
4641 |
||
4642 |
" |
|
4643 |
Smalltalk compressSources |
|
4644 |
" |
|
4645 |
||
4646 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
4647 |
! |
|
4648 |
||
4649 |
generateSingleSourceFile |
|
4650 |
"{ Pragma: +optSpace }" |
|
4651 |
||
4652 |
"generate the sources file, and remove all method source strings |
|
4653 |
from the system and replace them by refs to a string in the source file. |
|
4654 |
This makes the image independent from the per-class source files |
|
4655 |
and makes transportation of endUser applications easier, since |
|
4656 |
only 3 files (executable, image and sourceFile) need to be |
|
4657 |
transported." |
|
4658 |
||
4659 |
|newStream table source pos fileName| |
|
4660 |
||
4661 |
newStream := 'src.tmp' asFilename writeStream. |
|
4662 |
||
4663 |
table := IdentityDictionary new:100. |
|
4664 |
||
4665 |
Method allSubInstancesDo:[:aMethod | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4666 |
source := aMethod source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4667 |
source notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4668 |
pos := newStream position1Based. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4669 |
newStream nextChunkPut:source. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4670 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4671 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4672 |
dont change the methods info - maybe some write error |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4673 |
occurs later, in that case we abort and leave everything |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4674 |
untouched. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4675 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4676 |
table at:aMethod put:pos |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4677 |
] |
11655
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4678 |
]. |
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4679 |
|
4306fb61b9f8
sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents:
11624
diff
changeset
|
4680 |
newStream syncData; close. |
10641 | 4681 |
|
4682 |
" |
|
4683 |
now, rename the new source file, |
|
4684 |
" |
|
4685 |
fileName := (ObjectMemory nameForSources). |
|
4686 |
'src.tmp' asFilename renameTo:fileName. |
|
4687 |
||
4688 |
"good - now go over all changed methods, and change their |
|
4689 |
source reference" |
|
4690 |
||
4691 |
table keysAndValuesDo:[:aMethod :pos | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4692 |
aMethod localSourceFilename:fileName position:pos. |
10641 | 4693 |
"/ aMethod printCR. |
4694 |
]. |
|
4695 |
||
4696 |
" |
|
4697 |
Smalltalk generateSingleSourceFile |
|
4698 |
" |
|
4699 |
||
4700 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
4701 |
"Created: 17.10.1997 / 13:00:56 / cg" |
|
4702 |
! |
|
4703 |
||
4704 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil |
|
4705 |
"create & install an autoload stub for a class named: clsName, |
|
4706 |
to be loaded from package. |
|
4707 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
4708 |
(otherwise, the newest revision will be loaded" |
|
4709 |
||
4710 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4711 |
installAutoloadedClassNamed:clsName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4712 |
category:cat |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4713 |
package:package |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4714 |
revision:revisionOrNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4715 |
numClassInstVars:nil. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4716 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4717 |
|
10641 | 4718 |
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil |
4719 |
"create & install an autoload stub for a class named: clsName, |
|
4720 |
to be loaded from package. |
|
4721 |
If revisionOrNil is non-nil, set it up to load exactly that revision |
|
4722 |
(otherwise, the newest revision will be loaded" |
|
4723 |
||
4724 |
|clsSym cls| |
|
4725 |
||
4726 |
clsSym := clsName asSymbol. |
|
4727 |
||
4728 |
"/ install if not already compiled-in |
|
4729 |
(cls := self at:clsSym) isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4730 |
Autoload subclass:clsSym |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4731 |
instanceVariableNames:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4732 |
classVariableNames:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4733 |
poolDictionaries:'' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4734 |
category:cat |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4735 |
inEnvironment:Smalltalk. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4736 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4737 |
cls := self at:clsSym. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4738 |
cls isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4739 |
('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4740 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4741 |
cls package:package asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4742 |
revisionOrNil notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4743 |
cls setBinaryRevision:revisionOrNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4744 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4745 |
] |
10641 | 4746 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4747 |
"/ class already present - however, if unloaded, check for category/package change |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4748 |
cls isLoaded ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4749 |
package ~= cls package ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4750 |
cls withoutUpdatingChangesDo:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4751 |
cls package:package asSymbol. |
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 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4754 |
cat ~= cls category ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4755 |
cls withoutUpdatingChangesDo:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4756 |
cls category:cat. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4757 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4758 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4759 |
]. |
10641 | 4760 |
]. |
4761 |
^ cls. |
|
4762 |
||
4763 |
"Created: / 05-11-1998 / 15:10:25 / cg" |
|
4764 |
"Modified: / 16-01-2007 / 12:56:18 / cg" |
|
11169
32fda240ee57
#installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents:
11153
diff
changeset
|
4765 |
|
10641 | 4766 |
! |
4767 |
||
4768 |
installAutoloadedClasses |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4769 |
"scan all packages and install all classes found there as |
10641 | 4770 |
autoloaded. This takes some time ..." |
4771 |
||
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4772 |
|dirsConsulted| |
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
4773 |
|
10641 | 4774 |
dirsConsulted := Set new. |
4775 |
||
4776 |
"/ 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
|
4777 |
self packagePath do:[:eachPathComponent | |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4778 |
(dirsConsulted includes:eachPathComponent) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4779 |
self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4780 |
recursiveInstallAutoloadedClassesFrom:eachPathComponent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4781 |
rememberIn:dirsConsulted |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4782 |
maxLevels:15 |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4783 |
noAutoload:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4784 |
packageTop:eachPathComponent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4785 |
showSplashInLevels:2. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4786 |
] |
10641 | 4787 |
]. |
11388 | 4788 |
self splashInfo:nil. |
10641 | 4789 |
|
4790 |
" |
|
4791 |
Smalltalk installAutoloadedClasses |
|
4792 |
" |
|
4793 |
||
4794 |
"Created: / 14.2.1997 / 17:32:57 / cg" |
|
4795 |
"Modified: / 13.12.1999 / 11:56:50 / cg" |
|
4796 |
! |
|
4797 |
||
4798 |
installAutoloadedClassesFrom:anAbbrevFilePath |
|
4799 |
"read the given abbreviation file; install all classes found there as |
|
4800 |
autoloaded. This takes some time ..." |
|
4801 |
||
4802 |
|f s| |
|
4803 |
||
4804 |
f := self getSystemFileName:anAbbrevFilePath. |
|
4805 |
f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath]. |
|
4806 |
||
4807 |
f notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4808 |
f := f asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4809 |
f isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4810 |
f := f construct:'abbrev.stc' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4811 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4812 |
[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4813 |
s := f readStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4814 |
self installAutoloadedClassesFromStream:s. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4815 |
s close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4816 |
] on:FileStream openErrorSignal |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4817 |
do:[:ex| "do nothing"]. |
10641 | 4818 |
] |
4819 |
||
4820 |
" |
|
4821 |
Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc' |
|
4822 |
" |
|
4823 |
||
4824 |
"Modified: / 5.11.1998 / 15:10:51 / cg" |
|
4825 |
! |
|
4826 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4827 |
installAutoloadedClassesFromAbbrevFile:aFilename |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4828 |
aFilename readingFileDo:[:abbrevStream | |
13771 | 4829 |
self installAutoloadedClassesFromStream:abbrevStream. |
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4830 |
] |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4831 |
|
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4832 |
"Created: / 29-07-2011 / 20:39:21 / cg" |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4833 |
! |
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
4834 |
|
10641 | 4835 |
installAutoloadedClassesFromStream:anAbbrevFileStream |
4836 |
"read the given abbreviation file; |
|
4837 |
install all classes found there as autoloaded, and also update the |
|
4838 |
abbreviation (className-to-fileName mapping) table. |
|
4839 |
This takes some time ..." |
|
4840 |
||
4841 |
|s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w| |
|
4842 |
||
4843 |
anAbbrevFileStream isFileStream ifTrue:[ |
|
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4844 |
abbrevFileName := anAbbrevFileStream pathName. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4845 |
info := 'declared from: ', abbrevFileName. |
10641 | 4846 |
]. |
4847 |
||
4848 |
KnownPackages isNil ifTrue:[ |
|
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4849 |
KnownPackages := Set new. |
10641 | 4850 |
]. |
4851 |
||
4852 |
"/ yes, create any required nameSpace, without asking user. |
|
4853 |
Class createNameSpaceQuerySignal answer:true do:[ |
|
4854 |
||
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4855 |
[anAbbrevFileStream atEnd] whileFalse:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4856 |
l := anAbbrevFileStream nextLine withoutSeparators. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4857 |
"Skip empty lines and comments" |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4858 |
(l notEmpty and:[l first ~= $#]) ifTrue:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4859 |
"/ must do it manually, caring for quoted strings. |
10641 | 4860 |
"/ words := line asCollectionOfWords. |
4861 |
||
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4862 |
words := OrderedCollection new. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4863 |
s2 := l readStream. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4864 |
[s2 atEnd] whileFalse:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4865 |
s2 skipSeparators. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4866 |
s2 peek == $' ifTrue:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4867 |
s2 next. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4868 |
w := s2 upTo:$'. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4869 |
s2 skipSeparators. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4870 |
] ifFalse:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4871 |
w := s2 upToSeparator |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4872 |
]. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4873 |
words add:w |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4874 |
]. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4875 |
words size < 3 ifTrue:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4876 |
'Smalltalk [warning]: bad abbrev entry' errorPrint. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4877 |
anAbbrevFileStream isFileStream ifTrue:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4878 |
' (in ''' errorPrint. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4879 |
anAbbrevFileStream pathName errorPrint. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4880 |
''')' errorPrint |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4881 |
]. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4882 |
': ' errorPrint. l errorPrintCR |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4883 |
] ifFalse:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4884 |
clsName := (words at:1) asSymbol. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4885 |
abbrev := (words at:2). |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4886 |
package := (words at:3) asSymbol. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4887 |
cat := words at:4 ifAbsent:nil. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4888 |
numClassInstVars := words at:5 ifAbsent:'0'. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4889 |
numClassInstVars := Integer readFrom:numClassInstVars onError:[0]. |
10641 | 4890 |
|
4891 |
"/ KnownPackages add:package. |
|
4892 |
||
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4893 |
(cat size == 0) ifTrue:[ |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4894 |
cat := 'autoloaded' |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4895 |
]. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4896 |
|
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4897 |
"/ on the fly, update the abbreviations |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4898 |
self setFilename:abbrev forClass:clsName package:package. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4899 |
|
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4900 |
"/ ' autoloaded: ' print. clsName print. ' in ' print. cat printCR. |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4901 |
|
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4902 |
cls := self |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4903 |
installAutoloadedClassNamed:clsName |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4904 |
category:cat |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4905 |
package:package |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4906 |
revision:nil |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4907 |
numClassInstVars:numClassInstVars. |
10641 | 4908 |
|
4909 |
"/ info notNil ifTrue:[ |
|
4910 |
"/ cls setComment:info. |
|
4911 |
"/ ]. |
|
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4912 |
] |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4913 |
] |
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
4914 |
] |
4458 | 4915 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4916 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4917 |
|
10641 | 4918 |
loadBinaries |
4919 |
"return true, if binaries should be loaded into the system, |
|
4920 |
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
|
4921 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4922 |
^ LoadBinaries |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4923 |
! |
3044 | 4924 |
|
10641 | 4925 |
loadBinaries:aBoolean |
4926 |
"{ Pragma: +optSpace }" |
|
4927 |
||
4928 |
"turn on/off loading of binary objects" |
|
4929 |
||
4930 |
aBoolean ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4931 |
(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4932 |
LoadBinaries := true. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4933 |
^ self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4934 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4935 |
'Smalltalk [info]: this system does not support binary loading' infoPrintCR. |
10641 | 4936 |
]. |
4937 |
LoadBinaries := false |
|
4938 |
||
4939 |
"Modified: 10.1.1997 / 15:11:00 / cg" |
|
4940 |
! |
|
4941 |
||
4942 |
logDoits |
|
4943 |
"return true if doits should go into the changes file |
|
4944 |
as well as changes - by default, this is off, since |
|
4945 |
it can blow up the changes file enormously ... |
|
4946 |
" |
|
4947 |
||
4948 |
^ LogDoits |
|
4949 |
||
4950 |
" |
|
4951 |
LogDoits := false |
|
3044 | 4952 |
LogDoits := true |
4953 |
" |
|
4954 |
! |
|
4955 |
||
10641 | 4956 |
logDoits:aBoolean |
4957 |
"{ Pragma: +optSpace }" |
|
4958 |
||
4959 |
"turn on/off logging of doits in the changes file. |
|
4960 |
By default, this is off, since it can blow up the |
|
4961 |
changes file enormously ... |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4962 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4963 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4964 |
LogDoits := aBoolean |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4965 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4966 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
4967 |
|
10641 | 4968 |
makeBytecodeMethods |
4969 |
"{ Pragma: +optSpace }" |
|
4970 |
||
4971 |
"walk over all methods and make each a bytecode method |
|
4972 |
iff it does not contain primitive C code. |
|
4973 |
Experimental and not yet used." |
|
4974 |
||
4975 |
Method allSubInstancesDo:[:aMethod | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4976 |
|newMethod| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4977 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4978 |
aMethod hasPrimitiveCode ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4979 |
newMethod := aMethod asByteCodeMethod. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4980 |
newMethod ~~ aMethod ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4981 |
aMethod becomeSameAs:newMethod |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4982 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
4983 |
]. |
10641 | 4984 |
]. |
4985 |
||
4986 |
" |
|
4987 |
Smalltalk makeBytecodeMethods |
|
4988 |
" |
|
4989 |
||
4990 |
"Modified: 16.1.1997 / 01:25:58 / cg" |
|
4991 |
"Created: 17.10.1997 / 13:52:19 / cg" |
|
4992 |
! |
|
4993 |
||
4994 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
|
4995 |
"read all abbrev.stc files from and under aDirectory |
|
4996 |
and install autoloaded classes. |
|
4997 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
4998 |
(however, the directories are searched for packages) |
|
4999 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
5000 |
||
11391 | 5001 |
self |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5002 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5003 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5004 |
showSplashInLevels:0. |
11391 | 5005 |
|
5006 |
" |
|
5007 |
Smalltalk installAutoloadedClasses |
|
5008 |
" |
|
5009 |
||
5010 |
"Modified: / 17-08-2006 / 16:48:43 / cg" |
|
5011 |
! |
|
5012 |
||
12022 | 5013 |
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted |
11391 | 5014 |
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath |
5015 |
showSplashInLevels:showSplashInLevels |
|
5016 |
"read all abbrev.stc files from and under aDirectory |
|
5017 |
and install autoloaded classes. |
|
5018 |
If a file called NOAUTOLOAD is found, no classes there and below are installed as autoloaded |
|
5019 |
(however, the directories are searched for packages) |
|
5020 |
If a file called NOPACKAGES is found, no further searching is done in that directory or below." |
|
5021 |
||
13531
6ab20c7e1dec
added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents:
13529
diff
changeset
|
5022 |
|dir noAutoloadHere dirName pkgName directoryContents| |
10641 | 5023 |
|
5024 |
maxLevels == 0 ifTrue:[ |
|
5025 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
13771 | 5026 |
^ self |
10641 | 5027 |
]. |
5028 |
||
5029 |
dir := aDirectory asFilename. |
|
11392 | 5030 |
dirName := dir pathName. |
5031 |
||
5032 |
(dirsConsulted includes:dirName) ifTrue:[ |
|
13771 | 5033 |
^ self |
10641 | 5034 |
]. |
11392 | 5035 |
dirsConsulted add:dirName. |
10641 | 5036 |
|
12377 | 5037 |
(dir / 'NOPACKAGES') exists ifTrue:[ |
13771 | 5038 |
^ self. |
10641 | 5039 |
]. |
12377 | 5040 |
(dir / 'NOSUBAUTOLOAD') exists ifTrue:[ |
13771 | 5041 |
^ self. |
10641 | 5042 |
]. |
11392 | 5043 |
|
10641 | 5044 |
noAutoloadHere := noAutoloadIn. |
5045 |
noAutoloadHere ifFalse:[ |
|
13771 | 5046 |
(dir / 'NOAUTOLOAD') exists ifTrue:[ |
5047 |
noAutoloadHere := true. |
|
5048 |
]. |
|
10641 | 5049 |
] ifTrue:[ |
13771 | 5050 |
(dir / 'AUTOLOAD') exists ifTrue:[ |
5051 |
noAutoloadHere := false. |
|
5052 |
]. |
|
10641 | 5053 |
]. |
5054 |
||
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5055 |
((dir / 'loadAll') exists or:[(dir / 'abbrev.stc') exists]) ifTrue:[ |
13771 | 5056 |
KnownPackages isNil ifTrue:[ |
5057 |
KnownPackages := Set new. |
|
5058 |
]. |
|
5059 |
pkgName := dirName copyFrom:(packageTopPath asFilename pathName) size + 1 + 1. |
|
5060 |
KnownPackages add:pkgName |
|
10641 | 5061 |
]. |
5062 |
||
11393 | 5063 |
showSplashInLevels >= 0 ifTrue:[ |
13771 | 5064 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...' |
5065 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 5066 |
]. |
5067 |
||
10641 | 5068 |
"/ |
5069 |
"/ suppress installation as autoloaded in this and everything |
|
5070 |
"/ below; however, still traverse the directories to find packages ... |
|
5071 |
"/ |
|
5072 |
noAutoloadHere ifFalse:[ |
|
13771 | 5073 |
[ |
5074 |
self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc'). |
|
5075 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
|
10641 | 5076 |
]. |
5077 |
||
5078 |
[ |
|
13771 | 5079 |
directoryContents := dir directoryContents asSet. "asSet to speed up remove" |
10641 | 5080 |
] on:FileStream openErrorSignal do:[:ex| |
13771 | 5081 |
"non-accessable directory: we are done" |
5082 |
^ self |
|
10641 | 5083 |
]. |
5084 |
||
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5085 |
directoryContents removeAllFoundIn:#( |
13771 | 5086 |
'objbc' |
5087 |
'objvc' |
|
5088 |
'doc' |
|
5089 |
'CVS' |
|
5090 |
'bitmaps' |
|
5091 |
'resources' |
|
5092 |
'source' |
|
5093 |
'not_delivered' |
|
5094 |
'not_ported' |
|
5095 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5096 |
dir baseName = 'stx' ifTrue:[ |
13771 | 5097 |
directoryContents removeAllFoundIn:#( |
5098 |
'configurations' |
|
5099 |
'include' |
|
5100 |
'rules' |
|
5101 |
'stc' |
|
5102 |
'support' |
|
5103 |
). |
|
12911
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5104 |
]. |
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5105 |
|
0822e257daeb
comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents:
12883
diff
changeset
|
5106 |
directoryContents do:[:eachFilenameString | |
13771 | 5107 |
|f| |
5108 |
||
5109 |
f := dir / eachFilenameString. |
|
5110 |
f isDirectory ifTrue:[ |
|
5111 |
self |
|
5112 |
recursiveInstallAutoloadedClassesFrom:f |
|
5113 |
rememberIn:dirsConsulted |
|
5114 |
maxLevels:maxLevels-1 |
|
5115 |
noAutoload:noAutoloadHere |
|
5116 |
packageTop:packageTopPath |
|
5117 |
showSplashInLevels:showSplashInLevels - 1. |
|
5118 |
] |
|
10641 | 5119 |
]. |
5120 |
||
11393 | 5121 |
showSplashInLevels >= 0 ifTrue:[ |
13771 | 5122 |
self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...' |
5123 |
bindWith:(dirName contractAtBeginningTo:35)). |
|
11392 | 5124 |
]. |
5125 |
||
10641 | 5126 |
" |
5127 |
Smalltalk installAutoloadedClasses |
|
5128 |
" |
|
5129 |
||
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
5130 |
"Modified: / 29-07-2011 / 20:40:51 / cg" |
10641 | 5131 |
! |
5132 |
||
5133 |
replaceReferencesTo:anObject with:newRef |
|
12194
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5134 |
"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
|
5135 |
Return true, if any reference was changed. |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5136 |
Notice: this does not change the class-reference." |
208afdcf182b
comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents:
12172
diff
changeset
|
5137 |
|
10641 | 5138 |
|toAdd| |
5139 |
||
5140 |
toAdd := OrderedCollection new. |
|
5141 |
self keysAndValuesDo:[:key :val | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5142 |
(key == anObject) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5143 |
self shouldImplement. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5144 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5145 |
(val == anObject ) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5146 |
toAdd add:(key -> newRef) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5147 |
]. |
10641 | 5148 |
]. |
5149 |
toAdd do:[:each | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5150 |
self at:(each key) put:(each value) |
10641 | 5151 |
]. |
5152 |
! |
|
5153 |
||
5154 |
saveEmergencyImage:aBoolean |
|
5155 |
"set/clear the flag which controls if ST/X should save an |
|
5156 |
emergency image in case of a broken display connection. |
|
5157 |
The default is true. |
|
5158 |
This may be useful, if you work with an unsecure display |
|
5159 |
(serial line), and want to have a chance of proceeding after |
|
5160 |
a crash. In multiheaded applications, this only affects |
|
5161 |
crashes of the master Display connection (the initial connection); |
|
5162 |
errors on other displays are reported to the views and treated |
|
5163 |
like window destroy from the windowManager." |
|
5164 |
||
5165 |
SaveEmergencyImage := aBoolean |
|
5166 |
||
5167 |
"Modified: / 24.10.1997 / 18:22:26 / cg" |
|
5168 |
! |
|
5169 |
||
5170 |
systemOrganization |
|
5171 |
"for partial ST80 compatibility; |
|
5172 |
In ST80, Smalltalk organization returns a systemOrganizer, which |
|
5173 |
keeps track of class-categories, while all classes return a classOrganizer |
|
5174 |
from #organization, which keeps track of method categories of that class. |
|
5175 |
Since in ST/X, Smalltalk is a class, there is now a conflict. |
|
5176 |
To make a workaround possible, use #systemOrganization when porting |
|
5177 |
VW apps to ST/X to get the class-categories. |
|
5178 |
Read the documentation in SystemOrganizer for more info." |
|
5179 |
||
5180 |
^ SystemOrganizer for:nil |
|
5181 |
||
5182 |
"Created: / 20.6.1998 / 12:24:02 / cg" |
|
5183 |
"Modified: / 20.6.1998 / 12:41:34 / cg" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5184 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5185 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5186 |
!Smalltalk class methodsFor:'system management-fileIn'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5187 |
|
10641 | 5188 |
fileIn:aFileName |
5189 |
"read in the named file - look for it in some standard places; |
|
5190 |
return true if ok, false if failed. |
|
5191 |
This method can load almost anything which makes sense: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5192 |
.st - source files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5193 |
.cls - binary smalltalk bytecode files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5194 |
.so - binary compiled machine code class libraries |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5195 |
[.class - java bytecode -- soon to come]" |
10641 | 5196 |
|
5197 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
|
5198 |
||
5199 |
" |
|
5200 |
Smalltalk fileIn:'source/TicTacToe.st' |
|
5201 |
Smalltalk fileIn:'binary/TicTacToe.cls' |
|
5202 |
Smalltalk fileIn:'binary/TicTacToe.so' |
|
5203 |
" |
|
5204 |
||
5205 |
"Created: 28.10.1995 / 17:06:28 / cg" |
|
5206 |
! |
|
5207 |
||
5208 |
fileIn:aFileName inPackage:aPackageID |
|
5209 |
"read in the named file in a packages directory." |
|
5210 |
||
5211 |
|dir| |
|
5212 |
||
5213 |
dir := self getPackageDirectoryForPackage:aPackageID. |
|
5214 |
dir isNil ifTrue:[^ false]. |
|
5215 |
||
5216 |
dir := dir asFilename. |
|
5217 |
^ (self fileIn:(dir construct:aFileName)) |
|
5218 |
or:[ self fileIn:((dir construct:'source') construct:aFileName) ] |
|
5219 |
! |
|
5220 |
||
5221 |
fileIn:aFileName lazy:lazy |
|
5222 |
"read in the named file - look for it in some standard places; |
|
5223 |
return true if ok, false if failed. |
|
5224 |
If lazy is true, no code is generated for methods, instead stubs |
|
5225 |
are created which compile themself when first executed. This allows |
|
5226 |
for much faster fileIn (but slows down the first execution later). |
|
5227 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5228 |
code which is known to be syntactically correct." |
|
5229 |
||
5230 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
|
5231 |
||
5232 |
" |
|
5233 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
|
5234 |
" |
|
5235 |
||
5236 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
5237 |
! |
|
5238 |
||
5239 |
fileIn:aFileName lazy:lazy silent:silent |
|
5240 |
"read in the named file - look for it in some standard places; |
|
5241 |
return true if ok, false if failed. |
|
5242 |
If lazy is true, no code is generated for methods, instead stubs |
|
5243 |
are created which compile themself when first executed. This allows |
|
5244 |
for much faster fileIn (but slows down the first execution later). |
|
5245 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5246 |
code which is known to be syntactically correct. |
|
5247 |
If silent is true, no compiler messages are output to the transcript. |
|
5248 |
Giving nil for silent/lazy will use the current settings." |
|
5249 |
||
5250 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
5251 |
||
5252 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
5253 |
! |
|
5254 |
||
5255 |
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged |
|
5256 |
"read in the named file - look for it in some standard places; |
|
5257 |
return true if ok, false if failed. |
|
5258 |
If lazy is true, no code is generated for methods, instead stubs |
|
5259 |
are created which compile themself when first executed. This allows |
|
5260 |
for much faster fileIn (but slows down the first execution later). |
|
5261 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5262 |
code which is known to be syntactically correct. |
|
5263 |
If silent is true, no compiler messages are output to the transcript. |
|
5264 |
Giving nil for silent/lazy will use the current settings. |
|
5265 |
This method can load almost anything which makes sense: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5266 |
.st - source files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5267 |
.cls - binary smalltalk bytecode files |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5268 |
.so - binary compiled machine code class libraries |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5269 |
[.class - java bytecode -- soon to come]" |
10641 | 5270 |
|
5271 |
|fileNameString aStream path morePath bos| |
|
5272 |
||
5273 |
fileNameString := aFileNameOrString asString. |
|
5274 |
||
5275 |
" |
|
5276 |
an object or shared object ? |
|
5277 |
" |
|
5278 |
(ObjectFileLoader notNil |
|
5279 |
and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5280 |
"/ LoadBinaries ifFalse:[^ false]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5281 |
path := self getBinaryFileName:fileNameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5282 |
path isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5283 |
path := self getSystemFileName:fileNameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5284 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5285 |
path isNil ifTrue:[^ false]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5286 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
10641 | 5287 |
]. |
5288 |
||
5289 |
(fileNameString asFilename hasSuffix:'cls') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5290 |
BinaryObjectStorage notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5291 |
aStream := self systemFileStreamFor:fileNameString. |
10641 | 5292 |
"/ path := self getBinaryFileName:fileNameString. |
5293 |
"/ path isNil ifTrue:[^ false]. |
|
5294 |
"/ aStream := path asFilename readStream. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5295 |
aStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5296 |
aStream binary. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5297 |
bos := BinaryObjectStorage onOld:aStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5298 |
bos next. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5299 |
bos close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5300 |
^ true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5301 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5302 |
^ false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5303 |
] |
10641 | 5304 |
]. |
5305 |
||
5306 |
aStream := self systemFileStreamFor:fileNameString. |
|
5307 |
aStream isNil ifTrue:[^ false]. |
|
5308 |
||
5309 |
(fileNameString includes:$/) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5310 |
"/ temporarily prepend the files directory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5311 |
"/ to the searchPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5312 |
"/ This allows fileIn-driver files to refer to local |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5313 |
"/ files via a relative path, and drivers to fileIn other |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5314 |
"/ drivers ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5315 |
morePath := aStream pathName asFilename directoryName. |
10641 | 5316 |
]. |
5317 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
|
5318 |
||
5319 |
" |
|
5320 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
|
5321 |
" |
|
5322 |
||
5323 |
"Modified: / 08-09-2006 / 19:21:16 / cg" |
|
5324 |
! |
|
5325 |
||
5326 |
fileIn:aFileName logged:logged |
|
5327 |
"read in the named file - look for it in some standard places; |
|
5328 |
return true if ok, false if failed. |
|
5329 |
The argument logged controls, if the changefile is to be updated." |
|
5330 |
||
5331 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
5332 |
||
5333 |
" |
|
5334 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
5335 |
" |
|
5336 |
! |
|
5337 |
||
5338 |
fileIn:aFileName silent:silent |
|
5339 |
"read in the named file - look for it in some standard places; |
|
5340 |
return true if ok, false if failed. |
|
5341 |
If silent is true, no compiler messages are output to the transcript." |
|
5342 |
||
5343 |
^ self fileIn:aFileName lazy:nil silent:silent logged:false |
|
5344 |
||
5345 |
" |
|
5346 |
Smalltalk fileIn:'source/TicTacToe.st' silent:true |
|
5347 |
" |
|
5348 |
||
5349 |
"Created: 28.10.1995 / 17:06:36 / cg" |
|
5350 |
! |
|
5351 |
||
5352 |
fileInChanges |
|
5353 |
"read in the last changes file - bringing the system to the state it |
|
5354 |
had when left the last time. |
|
5355 |
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
|
5356 |
last '**snapshot**' - entry |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5357 |
(instead of the complete changes file)." |
10641 | 5358 |
|
5359 |
" |
|
5360 |
do NOT update the changes file now ... |
|
5361 |
" |
|
5362 |
self fileIn:ChangeFileName logged:false |
|
5363 |
||
5364 |
" |
|
10071 | 5365 |
Smalltalk fileInChanges |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5366 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
5367 |
! |
1 | 5368 |
|
10641 | 5369 |
fileInClass:aClassName |
5370 |
"find a source/object file for aClassName and -if found - load it. |
|
5371 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5372 |
finally source file (.st) in that order. |
|
5373 |
The file is first searched for using the class name, then the abbreviated name." |
|
5374 |
||
5375 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5376 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5377 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5378 |
initialize:true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5379 |
lazy:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5380 |
silent:nil |
10641 | 5381 |
|
5382 |
"Modified: / 9.1.1998 / 14:41:46 / cg" |
|
5383 |
! |
|
5384 |
||
5385 |
fileInClass:aClassName fromObject:aFileName |
|
5386 |
"read in the named object file and dynamic-link it into the system |
|
5387 |
- look for it in some standard places. |
|
5388 |
Only install the named class from this object file. |
|
5389 |
Return true if ok, false if failed." |
|
5390 |
||
5391 |
|path ok| |
|
5392 |
||
5393 |
" |
|
5394 |
check if the dynamic loader class is in |
|
5395 |
" |
|
5396 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
|
5397 |
||
5398 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
|
5399 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
|
5400 |
ok ifTrue:[ |
|
13814 | 5401 |
VerboseLoading ifTrue:[ |
5402 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCR:aFileName. |
|
5403 |
] |
|
10641 | 5404 |
]. |
5405 |
^ ok |
|
5406 |
||
5407 |
" |
|
5408 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
|
5409 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
5410 |
" |
|
5411 |
||
13814 | 5412 |
"Modified: / 04-11-2011 / 13:42:24 / cg" |
10641 | 5413 |
! |
5414 |
||
5415 |
fileInClass:aClassName initialize:doInit |
|
5416 |
"find a source/object file for aClassName and -if found - load it. |
|
5417 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5418 |
finally source file (.st) in that order. |
|
5419 |
The file is first searched for using the class name, then the abbreviated name." |
|
5420 |
||
5421 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5422 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5423 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5424 |
initialize:doInit |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5425 |
lazy:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5426 |
silent:nil |
10641 | 5427 |
|
5428 |
"Modified: / 9.1.1998 / 14:42:02 / cg" |
|
5429 |
! |
|
5430 |
||
5431 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
|
5432 |
"find a source/object file for aClassName and -if found - load it. |
|
5433 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5434 |
finally source file (.st) in that order. |
|
5435 |
The file is first searched for using the class name, then the abbreviated name." |
|
5436 |
||
5437 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5438 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5439 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5440 |
initialize:doInit |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5441 |
lazy:loadLazy |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5442 |
silent:nil |
10641 | 5443 |
|
5444 |
"Modified: / 9.1.1998 / 14:42:19 / cg" |
|
5445 |
! |
|
5446 |
||
5447 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
5448 |
"find a source/object file for aClassName and -if found - load it. |
|
5449 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
|
5450 |
finally source file (.st), in that order. |
|
5451 |
The file is first searched for using the class name, then the abbreviated name. |
|
5452 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
5453 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
5454 |
should not send notes to the transcript; it can be true, false or nil, where |
|
5455 |
nil uses the value from SilentLoading." |
|
5456 |
||
5457 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5458 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5459 |
package:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5460 |
initialize:doInit |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5461 |
lazy:loadLazy |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5462 |
silent:beSilent |
10641 | 5463 |
|
5464 |
"Modified: / 9.1.1998 / 14:42:28 / cg" |
|
5465 |
! |
|
5466 |
||
5467 |
fileInClass:aClassName package:package |
|
5468 |
"find a source/object file for aClassName and -if found - load it. |
|
5469 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
5470 |
finally source file (.st) in that order. |
|
5471 |
The file is first searched for using the class name, then the abbreviated name." |
|
5472 |
||
5473 |
^ self |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5474 |
fileInClass:aClassName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5475 |
package:package |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5476 |
initialize:true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5477 |
lazy:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5478 |
silent:nil |
10641 | 5479 |
|
5480 |
"Created: / 08-01-2007 / 10:06:09 / cg" |
|
5481 |
! |
|
5482 |
||
10999 | 5483 |
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent |
10641 | 5484 |
"find a source/object file for aClassName and -if found - load it. |
5485 |
This is the workhorse for autoloading. |
|
10999 | 5486 |
Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
10641 | 5487 |
finally source file (.st), in that order. |
5488 |
The file is first searched for using the class name, then the abbreviated name. |
|
5489 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
5490 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
5491 |
should not send notes to the transcript; it can be true, false or nil, where |
|
5492 |
nil uses the value from SilentLoading." |
|
5493 |
||
10999 | 5494 |
|classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr |
10641 | 5495 |
filenameToSet packageDir packageFile bos| |
5496 |
||
5497 |
wasLazy := Compiler compileLazy:loadLazy. |
|
5498 |
beSilent notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5499 |
wasSilent := self silentLoading:beSilent. |
10641 | 5500 |
]. |
5501 |
||
5502 |
classFileName := Smalltalk fileNameForClass:aClassName. |
|
5503 |
(classFileName = aClassName) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5504 |
"/ no abbrev.stc translation for className |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5505 |
(aClassName includes:$:) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5506 |
"/ a nameSpace name |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5507 |
alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1 |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5508 |
]. |
10641 | 5509 |
]. |
5510 |
||
5511 |
classFileName asFilename isAbsolute ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5512 |
classFileName asFilename suffix notEmptyOrNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5513 |
ok := self fileIn:classFileName lazy:loadLazy silent:beSilent. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5514 |
] ifFalse:[ |
13771 | 5515 |
ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5516 |
] |
10641 | 5517 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5518 |
classFileName := classFileName copyReplaceAll:$: with:$_. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5519 |
[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5520 |
Class withoutUpdatingChangesDo:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5521 |
|zarFn zar entry| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5522 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5523 |
ok := false. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5524 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5525 |
package notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5526 |
packageDir := package asString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5527 |
packageDir := packageDir copyReplaceAll:$: with:$/. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5528 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5529 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5530 |
Class packageQuerySignal answer:package do:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5531 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5532 |
then, if dynamic linking is available, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5533 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5534 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5535 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5536 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5537 |
first look for a class packages shared binary in binary/xxx.o |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5538 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5539 |
libName := self libraryFileNameOfClass:aClassName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5540 |
libName notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5541 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5542 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5543 |
sharedLibExtension ~= '.o' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5544 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5545 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5546 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5547 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5548 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5549 |
then, look for a shared binary in binary/xxx.o |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5550 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5551 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5552 |
(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension)) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5553 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5554 |
sharedLibExtension ~= '.o' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5555 |
ok := self fileInClass:aClassName fromObject:(classFileName, '.o') |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5556 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5557 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5558 |
alternativeClassFileName notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5559 |
(ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension)) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5560 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5561 |
sharedLibExtension ~= '.o' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5562 |
ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o') |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5563 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5564 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5565 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5566 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5567 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5568 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5569 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5570 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5571 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5572 |
if that did not work, look for a compiled-bytecode file ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5573 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5574 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5575 |
(ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5576 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5577 |
alternativeClassFileName notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5578 |
ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5579 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5580 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5581 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5582 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5583 |
if that did not work, and the classes package is known, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5584 |
look for an st-cls file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5585 |
in a package subdir of the source-directory ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5586 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5587 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5588 |
(packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5589 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , classFileName , '.cls'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5590 |
packageFile isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5591 |
packageFile := (packageDir , '/classes/' , classFileName , '.cls'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5592 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5593 |
(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5594 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5595 |
alternativeClassFileName notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5596 |
packageFile := self getPackageFileName:(packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5597 |
packageFile isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5598 |
packageFile := (packageDir , '/classes/' , alternativeClassFileName , '.cls'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5599 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5600 |
ok := self fileIn:packageFile lazy:loadLazy silent:beSilent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5601 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5602 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5603 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5604 |
zarFn := self getPackageFileName:(packageDir , '/classes.zip'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5605 |
zarFn notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5606 |
zar := ZipArchive oldFileNamed:zarFn. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5607 |
zar notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5608 |
entry := zar extract:(classFileName , '.cls'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5609 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5610 |
entry := zar extract:(alternativeClassFileName , '.cls'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5611 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5612 |
entry notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5613 |
bos := BinaryObjectStorage onOld:(entry asByteArray readStream). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5614 |
bos next. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5615 |
bos close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5616 |
ok := true |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5617 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5618 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5619 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5620 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5621 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5622 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5623 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5624 |
if that did not work, look for an st-source file ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5625 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5626 |
ok ifFalse:[ |
13771 | 5627 |
filenameToSet := classFileName. |
5628 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5629 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5630 |
alternativeClassFileName notNil ifTrue:[ |
13771 | 5631 |
filenameToSet := alternativeClassFileName. |
5632 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5633 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5634 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5635 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5636 |
... and in the standard source-directory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5637 |
" |
13771 | 5638 |
filenameToSet := 'source/' , classFileName. |
5639 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5640 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5641 |
alternativeClassFileName notNil ifTrue:[ |
13771 | 5642 |
filenameToSet := 'source/' , alternativeClassFileName. |
5643 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5644 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5645 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5646 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5647 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5648 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5649 |
if that did not work, and the classes package is known, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5650 |
look for an st-source file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5651 |
in a package subdir of the source-directory ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5652 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5653 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5654 |
packageDir notNil ifTrue:[ |
13771 | 5655 |
packageFile := self getPackageSourceFileName:(packageDir , '/source/' , classFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5656 |
packageFile isNil ifTrue:[ |
13771 | 5657 |
packageFile := (packageDir , '/source/' , classFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5658 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5659 |
filenameToSet := packageFile. |
13771 | 5660 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5661 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5662 |
alternativeClassFileName notNil ifTrue:[ |
13771 | 5663 |
packageFile := self getPackageSourceFileName:(packageDir , '/source/' , alternativeClassFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5664 |
packageFile isNil ifTrue:[ |
13771 | 5665 |
packageFile := (packageDir , '/source/' , alternativeClassFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5666 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5667 |
filenameToSet := packageFile. |
13771 | 5668 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5669 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5670 |
ok ifFalse:[ |
13771 | 5671 |
packageFile := self getPackageSourceFileName:(packageDir , '/' , classFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5672 |
packageFile isNil ifTrue:[ |
13771 | 5673 |
packageFile := (packageDir , '/' , classFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5674 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5675 |
filenameToSet := packageFile. |
13771 | 5676 |
(ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent) |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5677 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5678 |
alternativeClassFileName notNil ifTrue:[ |
13771 | 5679 |
packageFile := self getPackageFileName:(packageDir , '/' , alternativeClassFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5680 |
packageFile isNil ifTrue:[ |
13771 | 5681 |
packageFile := (packageDir , '/' , alternativeClassFileName). |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5682 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5683 |
filenameToSet := packageFile. |
13771 | 5684 |
ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5685 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5686 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5687 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5688 |
... and in the standard source-directory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5689 |
" |
13771 | 5690 |
filenameToSet := 'source/' , packageDir , '/' , classFileName. |
5691 |
(ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent) |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5692 |
ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5693 |
alternativeClassFileName notNil ifTrue:[ |
13771 | 5694 |
filenameToSet := 'source/' , packageDir , '/' , alternativeClassFileName. |
5695 |
ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5696 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5697 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5698 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5699 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5700 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5701 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5702 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5703 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5704 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5705 |
if that did not work, and the classes package is known, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5706 |
look for a zipArchive containing a class entry. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5707 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5708 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5709 |
packageDir notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5710 |
zarFn := self getPackageFileName:(packageDir , '/source.zip'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5711 |
zarFn isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5712 |
zarFn := packageDir asFilename withSuffix:'zip'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5713 |
zarFn := self getSourceFileName:zarFn. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5714 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5715 |
zarFn notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5716 |
zar := ZipArchive oldFileNamed:zarFn. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5717 |
zar notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5718 |
entry := zar extract:(classFileName , '.st'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5719 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5720 |
entry := zar extract:(alternativeClassFileName , '.st'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5721 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5722 |
entry notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5723 |
filenameToSet := zarFn. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5724 |
ok := self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5725 |
fileInStream:(entry asString readStream) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5726 |
lazy:loadLazy |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5727 |
silent:beSilent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5728 |
logged:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5729 |
addPath:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5730 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5731 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5732 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5733 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5734 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5735 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5736 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5737 |
if that did not work, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5738 |
look for a zipArchive containing a class entry. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5739 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5740 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5741 |
zarFn := self getSourceFileName:'source.zip'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5742 |
zarFn notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5743 |
zar := ZipArchive oldFileNamed:zarFn. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5744 |
zar notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5745 |
entry := zar extract:(zarFn := classFileName , '.st'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5746 |
(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5747 |
entry := zar extract:(zarFn := alternativeClassFileName , '.st'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5748 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5749 |
entry notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5750 |
filenameToSet := zarFn. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5751 |
ok := self |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5752 |
fileInStream:(entry asString readStream) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5753 |
lazy:loadLazy |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5754 |
silent:beSilent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5755 |
logged:false |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5756 |
addPath:nil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5757 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5758 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5759 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5760 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5761 |
ok ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5762 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5763 |
if there is a sourceCodeManager, ask it for the classes sourceCode |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5764 |
" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5765 |
(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5766 |
inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5767 |
inStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5768 |
filenameToSet := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5769 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5770 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5771 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5772 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5773 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5774 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5775 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5776 |
] ensure:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5777 |
Compiler compileLazy:wasLazy. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5778 |
wasSilent notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5779 |
self silentLoading:wasSilent |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5780 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5781 |
]. |
10641 | 5782 |
]. |
5783 |
||
5784 |
ok ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5785 |
newClass := self at:(aClassName asSymbol). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5786 |
newClass notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5787 |
"set the classes name - but do not change if already set" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5788 |
filenameToSet notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5789 |
newClass getClassFilename isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5790 |
newClass setClassFilename:(filenameToSet asFilename baseName) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5791 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5792 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5793 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5794 |
doInit ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5795 |
newClass initialize |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5796 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5797 |
] |
10641 | 5798 |
]. |
5799 |
||
5800 |
^ newClass |
|
5801 |
||
13415 | 5802 |
"Created: / 09-01-1998 / 14:40:32 / cg" |
5803 |
"Modified: / 05-06-1999 / 14:53:01 / cg" |
|
5804 |
"Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 5805 |
! |
5806 |
||
5807 |
fileInClassLibrary:aClassLibraryName |
|
5808 |
"find an object file containing a binary class library in some standard places |
|
5809 |
and load it. This install all of its contained classes. |
|
5810 |
Return true if ok, false if not. |
|
5811 |
Notice: the argument may not have an extension (by purpose); |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5812 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5813 |
make the caller independent of the underlying operatingSystem." |
10641 | 5814 |
|
5815 |
|path fn| |
|
5816 |
||
5817 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
5818 |
||
5819 |
fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
5820 |
fn := fn pathName. |
|
5821 |
||
5822 |
path := self getBinaryFileName:fn. |
|
5823 |
path isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5824 |
path := self getSystemFileName:fn. |
10641 | 5825 |
]. |
5826 |
path isNil ifTrue:[^ false]. |
|
5827 |
||
5828 |
^ (ObjectFileLoader loadObjectFile:path) notNil |
|
5829 |
||
5830 |
" |
|
5831 |
Smalltalk fileInClassLibrary:'libtable' |
|
5832 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
5833 |
" |
|
5834 |
||
5835 |
"Modified: 8.1.1997 / 17:58:56 / cg" |
|
5836 |
! |
|
5837 |
||
5838 |
fileInClassLibrary:aClassLibraryName inPackage:packageID |
|
5839 |
"find an object file containing a binary class library in some standard places |
|
5840 |
and load it. This installs all of its contained classes. |
|
5841 |
Return true if ok, false if not. |
|
5842 |
Notice: the argument may not have an extension (by purpose); |
|
13785
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5843 |
the sharedLib extension (.dll / .so / .sl) is added here, to |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5844 |
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
|
5845 |
|
11690 | 5846 |
|baseName handle libraryFilename packagePath| |
10641 | 5847 |
|
5848 |
ObjectFileLoader isNil ifTrue:[^ false]. |
|
5849 |
||
5850 |
baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix). |
|
5851 |
baseName exists ifTrue:[ |
|
13785
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5852 |
"/ load local file first... |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5853 |
handle := ObjectFileLoader loadObjectFile:baseName. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5854 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5855 |
handle isNil ifTrue:[ |
13785
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5856 |
packagePath := self getPackageDirectoryForPackage:packageID. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5857 |
packagePath isNil ifTrue:[^ false]. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5858 |
packagePath := packagePath asFilename. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5859 |
libraryFilename := packagePath / baseName. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5860 |
libraryFilename exists ifFalse:[ |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5861 |
libraryFilename := nil. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5862 |
#('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir | |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5863 |
"in windows, with Borland compiler, DLLs in development environment are under objbc; |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5864 |
with MSVC, they are under objvc" |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5865 |
libraryFilename isNil ifTrue:[ |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5866 |
libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5867 |
libraryFilename exists ifFalse:[ libraryFilename := nil ] |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5868 |
]. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5869 |
]. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5870 |
]. |
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
5871 |
(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[ |
13785
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5872 |
handle := ObjectFileLoader loadObjectFile:libraryFilename pathName. |
966eb3315984
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13771
diff
changeset
|
5873 |
]. |
12744
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5874 |
]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5875 |
|
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5876 |
"/ handle notNil ifTrue:[ |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5877 |
"/ Transcript showCR:(' Smalltalk: loaded %1.' bindWith:libraryFilename pathName). |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5878 |
"/ ]. |
80f6da0fee57
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
12700
diff
changeset
|
5879 |
^ handle notNil |
10641 | 5880 |
|
5881 |
" |
|
5882 |
Smalltalk fileInClassLibrary:'libtable' |
|
5883 |
Smalltalk fileInClassLibrary:'binary/libwidg3' |
|
5884 |
Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser' |
|
5885 |
" |
|
5886 |
||
13787
1695a24d0fa7
changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents:
13785
diff
changeset
|
5887 |
"Modified: / 08-10-2011 / 00:08:51 / cg" |
10641 | 5888 |
! |
5889 |
||
13415 | 5890 |
fileInSourceFile:filename lazy:loadLazy silent:beSilent |
5891 |
||
5892 |
"Try all available programming languages" |
|
5893 |
||
5894 |
ProgrammingLanguage allDo: |
|
13771 | 5895 |
[:lang| | f | |
5896 |
f := (filename endsWith: ('.' , lang sourceFileSuffix)) |
|
5897 |
ifTrue:[filename] |
|
5898 |
ifFalse:[filename , '.' , lang sourceFileSuffix]. |
|
5899 |
(self fileIn:f lazy:loadLazy silent:beSilent) |
|
5900 |
ifTrue:[^true]]. |
|
13415 | 5901 |
^false |
5902 |
||
5903 |
"Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
5904 |
! |
|
5905 |
||
10641 | 5906 |
fileInStream:streamArg |
5907 |
^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil |
|
5908 |
! |
|
5909 |
||
5910 |
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath |
|
5911 |
"read sourceCode from aStream; |
|
5912 |
return true if ok, false if failed. |
|
5913 |
If lazy is true, no code is generated for methods, instead stubs |
|
5914 |
are created which compile themself when first executed. This allows |
|
5915 |
for much faster fileIn (but slows down the first execution later). |
|
5916 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
5917 |
code which is known to be syntactically correct. |
|
5918 |
If silent is true, no compiler messages are output to the transcript. |
|
5919 |
Giving nil for silent/lazy will use the current settings. |
|
5920 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
|
5921 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
|
5922 |
using a relative path." |
|
5923 |
||
11427 | 5924 |
|inStream wasLazy wasSilent oldSystemPath oldRealPath| |
10641 | 5925 |
|
5926 |
inStream := streamArg. |
|
5927 |
inStream isNil ifTrue:[^ false]. |
|
12611
38d61d374d89
care for nonPositionable stream (stdin) in fileIn
Claus Gittinger <cg@exept.de>
parents:
12557
diff
changeset
|
5928 |
inStream := EncodedStream isNil |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5929 |
ifTrue:[ inStream ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5930 |
ifFalse:[ EncodedStream decodedStreamFor:inStream ]. |
10641 | 5931 |
|
5932 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
|
5933 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
5934 |
morePath notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5935 |
oldSystemPath := SystemPath copy. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5936 |
SystemPath addFirst:morePath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5937 |
oldRealPath := RealSystemPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5938 |
RealSystemPath := nil. |
10641 | 5939 |
]. |
5940 |
[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5941 |
(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[ |
13771 | 5942 |
"JV: Changed to give ProgrammingLanguage to choose |
5943 |
proper reader" |
|
5944 |
(ProgrammingLanguage forStream: inStream) |
|
5945 |
fileInStream: inStream |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5946 |
] |
10641 | 5947 |
] ensure:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5948 |
morePath notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5949 |
"take care, someone could have changed SystemPath during fileIn!!" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5950 |
(SystemPath copyFrom:2) = oldSystemPath ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5951 |
SystemPath := oldSystemPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5952 |
RealSystemPath := oldRealPath. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5953 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5954 |
(oldSystemPath includes:morePath) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5955 |
SystemPath remove:morePath ifAbsent:[]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5956 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5957 |
RealSystemPath := nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5958 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5959 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5960 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5961 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5962 |
inStream close |
10641 | 5963 |
]. |
5964 |
^ true |
|
5965 |
||
5966 |
" |
|
5967 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
|
5968 |
" |
|
5969 |
||
13415 | 5970 |
"Modified: / 05-11-1996 / 20:03:35 / cg" |
5971 |
"Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
10641 | 5972 |
! |
5973 |
||
5974 |
isClassLibraryLoaded:name |
|
5975 |
"return true, if a particular class library is already loaded" |
|
5976 |
||
5977 |
ObjectMemory |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5978 |
binaryModuleInfo |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5979 |
do:[:entry | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5980 |
entry type == #classLibrary ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5981 |
entry libraryName = name ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5982 |
^ true "/ already loaded |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5983 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5984 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
5985 |
]. |
10641 | 5986 |
|
5987 |
^ false |
|
5988 |
||
5989 |
" |
|
5990 |
Smalltalk isClassLibraryLoaded:'libstx_libbasic' |
|
5991 |
Smalltalk isClassLibraryLoaded:'libstx_libwidg3' |
|
5992 |
Smalltalk isClassLibraryLoaded:'libstx_libboss' |
|
5993 |
" |
|
5994 |
||
5995 |
"Modified: / 23-08-2006 / 15:54:46 / cg" |
|
5996 |
! |
|
5997 |
||
5998 |
loadClassLibraryIfAbsent:name |
|
5999 |
"dynamically load a classLibrary, if not already loaded |
|
6000 |
and the system supports dynamic loading. |
|
6001 |
Return true, if the library is loaded, false if not. |
|
6002 |
This entry is called without system specific filename |
|
6003 |
extensions - it is portable among different architectures |
|
6004 |
as long as corresponding files (x.so / x.dll / x.sl / x.o) |
|
6005 |
are be present ..." |
|
6006 |
||
6007 |
(self isClassLibraryLoaded:name) ifTrue:[ ^ true ]. "/ already loaded |
|
6008 |
^ self fileInClassLibrary:name |
|
6009 |
||
6010 |
" |
|
6011 |
Smalltalk loadClassLibraryIfAbsent:'libbasic' |
|
6012 |
Smalltalk loadClassLibraryIfAbsent:'libwidg3' |
|
6013 |
" |
|
6014 |
||
6015 |
"Modified: 31.10.1996 / 16:57:24 / cg" |
|
6016 |
! |
|
6017 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6018 |
secureFileIn:aFileName |
10641 | 6019 |
"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
|
6020 |
Catch various errors during fileIn. |
13000 | 6021 |
Return true if ok, false if failed" |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6022 |
|
10641 | 6023 |
|retVal| |
6024 |
||
6025 |
retVal := false. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6026 |
(SignalSet |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6027 |
with:AbortOperationRequest |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6028 |
with:TerminateProcessRequest |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6029 |
with:Parser parseErrorSignal) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6030 |
handle:[:ex | ex return ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6031 |
do:[ retVal := self fileIn:aFileName ]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6032 |
^ retVal |
10641 | 6033 |
! |
6034 |
||
6035 |
silentFileIn:aFilename |
|
6036 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
|
6037 |
Main use is during startup." |
|
6038 |
||
13353 | 6039 |
self silentlyLoadingDo:[ |
13370 | 6040 |
self fileIn:aFilename |
13353 | 6041 |
]. |
3044 | 6042 |
! ! |
6043 |
||
6044 |
!Smalltalk class methodsFor:'system management-files'! |
|
6045 |
||
10641 | 6046 |
bitmapFileStreamFor:aFileName |
6047 |
"search aFileName in some standard places; |
|
6048 |
return a readonly fileStream or nil if not found. |
|
6049 |
Searches in subdirectories named 'bitmaps' in the SystemPath. |
|
6050 |
Notice: this does not look in the package-specific bitmaps directories." |
|
6051 |
||
6052 |
|aString| |
|
6053 |
||
6054 |
aString := self getBitmapFileName:aFileName. |
|
6055 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6056 |
^ aString asFilename readStreamOrNil |
10641 | 6057 |
]. |
6058 |
^ nil |
|
6059 |
! |
|
6060 |
||
6061 |
bitmapFromFileNamed:aFileName forClass:aClass |
|
6062 |
"backward compatibility: |
|
6063 |
search aFileName in some standard places: |
|
6064 |
first in the redefinable bitmaps path, |
|
6065 |
then in the classes own package directory if existing. |
|
6066 |
Return an image or nil." |
|
6067 |
||
6068 |
^ self imageFromFileNamed:aFileName forClass:aClass |
|
6069 |
||
6070 |
" |
|
6071 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
6072 |
" |
|
6073 |
! |
|
6074 |
||
6075 |
bitmapFromFileNamed:aFileName inPackage:aPackage |
|
6076 |
"backward compatibility: |
|
6077 |
search aFileName in some standard places: |
|
6078 |
first in the redefinable bitmaps path, |
|
6079 |
then in the package directory if existing. |
|
6080 |
Return an image or nil." |
|
6081 |
||
6082 |
^ self imageFromFileNamed:aFileName inPackage:aPackage |
|
6083 |
||
6084 |
" |
|
6085 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6086 |
Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6087 |
" |
|
6088 |
! |
|
6089 |
||
6090 |
classNameForFile:aFileName |
|
6091 |
"return the className which corresponds to an abbreviated fileName, |
|
6092 |
or nil if no special translation applies. The given filename arg may |
|
6093 |
include a '.st' suffix (but no other)." |
|
6094 |
||
6095 |
|fn| |
|
6096 |
||
6097 |
(aFileName asFilename hasSuffix:'st') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6098 |
fn := aFileName copyWithoutLast:3 |
10641 | 6099 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6100 |
fn := aFileName |
10641 | 6101 |
]. |
6102 |
^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn]. |
|
6103 |
||
6104 |
" |
|
6105 |
Smalltalk classNameForFile:'DrawObj' |
|
6106 |
Smalltalk classNameForFile:'DrawObj.st' |
|
6107 |
Smalltalk classNameForFile:'ArrColl.st' |
|
6108 |
Smalltalk classNameForFile:'ArrColl.chg' |
|
6109 |
" |
|
6110 |
||
6111 |
"Modified: 11.12.1995 / 14:51:10 / cg" |
|
6112 |
! |
|
6113 |
||
6114 |
constructPathFor:aDirectoryName |
|
6115 |
"search for aDirectory in SystemPath; |
|
6116 |
return a collection of pathes which include that directory." |
|
6117 |
||
6118 |
^ self realSystemPath select:[:dirName | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6119 |
|fullPath| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6120 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6121 |
fullPath := dirName asFilename construct:aDirectoryName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6122 |
"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6123 |
fullPath isDirectory and:[fullPath isReadable] |
10641 | 6124 |
]. |
6125 |
! |
|
6126 |
||
6127 |
fileInFileStreamFor:aFileName |
|
6128 |
"obsolete |
|
6129 |
search aFileName in some standard places; |
|
6130 |
return a readonly fileStream or nil if not found. |
|
6131 |
Searches in subdirectories named 'fileIn' in SystemPath" |
|
6132 |
||
6133 |
|aString| |
|
6134 |
||
6135 |
aString := self getFileInFileName:aFileName. |
|
6136 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6137 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6138 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6139 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6140 |
! |
7758 | 6141 |
|
12022 | 6142 |
fileNameForClass:aClassOrClassName |
6143 |
"return a actual or expected (or most wanted) filename for aClassOrClassName |
|
6144 |
- only the base name (without directory part) and without suffix." |
|
6145 |
||
6146 |
|cls nonMetaclass nm nameWithPrefix nameWithoutPrefix| |
|
6147 |
||
12301 | 6148 |
"/ This was added as an extension of libsvn - should be no longer needed |
6149 |
"/ compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6150 |
"/ (compatQuery notNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6151 |
"/ and:[compatQuery isLoaded |
12301 | 6152 |
"/ and:[compatQuery query not]]) ifTrue:[ |
6153 |
"/ nm := aClassOrClassName isBehavior |
|
6154 |
"/ ifTrue:[aClassOrClassName name] |
|
6155 |
"/ ifFalse:[aClassOrClassName]. |
|
6156 |
"/ nm := nm copyReplaceAll:$: with:$_. |
|
6157 |
"/ ^nm |
|
6158 |
"/ ]. |
|
6159 |
||
12022 | 6160 |
aClassOrClassName isBehavior ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6161 |
cls := aClassOrClassName. |
12022 | 6162 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6163 |
cls := Smalltalk classNamed:aClassOrClassName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6164 |
cls isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6165 |
nameWithPrefix := aClassOrClassName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6166 |
nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6167 |
]. |
12022 | 6168 |
]. |
6169 |
||
6170 |
cls notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6171 |
nonMetaclass := cls theNonMetaclass. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6172 |
nm := nonMetaclass getClassFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6173 |
nm isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6174 |
cls revisionInfo notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6175 |
nm := cls revisionInfo fileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6176 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6177 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6178 |
nm notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6179 |
^ nm asFilename withoutSuffix baseName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6180 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6181 |
nameWithPrefix := nonMetaclass name. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6182 |
nameWithoutPrefix := nonMetaclass nameWithoutPrefix. |
12022 | 6183 |
]. |
6184 |
||
6185 |
CachedAbbreviations notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6186 |
nameWithPrefix := nameWithPrefix asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6187 |
(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6188 |
^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6189 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6190 |
nameWithoutPrefix := nameWithoutPrefix asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6191 |
(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6192 |
^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6193 |
]. |
12022 | 6194 |
]. |
6195 |
||
6196 |
^ nameWithPrefix copyReplaceAll:$: with:$_ |
|
6197 |
||
6198 |
" |
|
6199 |
Smalltalk fileNameForClass:#Complex |
|
6200 |
Smalltalk fileNameForClass:'SmallInteger' |
|
6201 |
Smalltalk fileNameForClass:'UnixOperatingSystem' |
|
6202 |
Smalltalk fileNameForClass:'Launcher' |
|
6203 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
|
6204 |
||
6205 |
Smalltalk fileNameForClass:HTML::Encoder |
|
6206 |
Smalltalk fileNameForClass:OSI::FTAMOperation |
|
6207 |
Smalltalk fileNameForClass:'OSI::Foobar' |
|
6208 |
Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons) |
|
6209 |
Workflow::UnsuccessfulFinishReasons classFilename |
|
6210 |
" |
|
6211 |
||
6212 |
"Modified: / 06-10-2006 / 16:16:01 / cg" |
|
6213 |
! |
|
6214 |
||
10641 | 6215 |
filenameAbbreviations |
6216 |
"return a dictionary containing the classname-to-filename |
|
6217 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
6218 |
to 14 chars)" |
|
6219 |
||
6220 |
CachedAbbreviations isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6221 |
self readAbbreviations |
10641 | 6222 |
]. |
6223 |
^ CachedAbbreviations |
|
6224 |
||
6225 |
"flush with: |
|
6226 |
||
6227 |
CachedAbbreviations := nil |
|
6228 |
" |
|
6229 |
" |
|
6230 |
Smalltalk filenameAbbreviations |
|
6231 |
" |
|
6232 |
! |
|
6233 |
||
13368 | 6234 |
findPackageDirectoryForPackage:aPackage |
6235 |
"find a packages directory along a number of standard places" |
|
6236 |
||
6237 |
|relDir| |
|
6238 |
||
6239 |
relDir := Smalltalk relativePackagePathForPackage:aPackage. |
|
6240 |
relDir asFilename isAbsolute ifTrue:[^ relDir]. |
|
6241 |
||
6242 |
^ Smalltalk getPackageFileName:relDir. |
|
6243 |
||
6244 |
" |
|
6245 |
Smalltalk findPackageDirectoryForPackage:'stx:libview/resources' |
|
6246 |
Smalltalk findPackageDirectoryForPackage:'stx:libview' |
|
6247 |
" |
|
6248 |
! |
|
6249 |
||
10641 | 6250 |
flushPathCaches |
6251 |
"{ Pragma: +optSpace }" |
|
6252 |
||
6253 |
"forget pathCaches - these are collections containing valid directory names, |
|
6254 |
where system files (resource, bitmaps etc.) are found. |
|
6255 |
A flush is only required, if a new system directory has been created while |
|
6256 |
the system is active, and those files should override the others |
|
6257 |
(for example, if you created a private resource directory)" |
|
6258 |
||
6259 |
RealSystemPath := ResourcePath := SourcePath := |
|
6260 |
BinaryPath := FileInPath := nil |
|
6261 |
||
6262 |
" |
|
6263 |
Smalltalk flushPathCaches |
|
6264 |
" |
|
6265 |
! |
|
6266 |
||
6267 |
getBinaryFileName:aFileName |
|
6268 |
"obsolete |
|
6269 |
search aFileName in some standard places |
|
6270 |
(subdirectories named 'binary' in SystemPath); |
|
6271 |
return the absolute filename or nil if none is found." |
|
6272 |
||
6273 |
BinaryPath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6274 |
BinaryPath := self constructPathFor:BinaryDirName |
10641 | 6275 |
]. |
6276 |
||
6277 |
^ self searchPath:BinaryPath for:aFileName in:BinaryDirName |
|
6278 |
||
6279 |
"Modified: 18.7.1996 / 15:53:49 / cg" |
|
6280 |
! |
|
6281 |
||
6282 |
getBitmapFileName:aFileName |
|
6283 |
"for backward compatibility: |
|
6284 |
search aFileName in some standard places |
|
6285 |
(subdirectories named 'bitmaps' in SystemPath); |
|
6286 |
Return the pathName or nil if none is found." |
|
6287 |
||
6288 |
^ self getBitmapFileName:aFileName forPackage:nil |
|
6289 |
||
6290 |
" |
|
6291 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
6292 |
" |
|
6293 |
||
6294 |
"Modified: 18.7.1996 / 15:53:55 / cg" |
|
6295 |
! |
|
6296 |
||
6297 |
getBitmapFileName:aFileName forPackage:aPackageIDOrNil |
|
6298 |
"for backward compatibility. |
|
6299 |
search aFileName in some standard places: |
|
6300 |
first in the redefinable bitmaps path, |
|
6301 |
then in the package directory if existing. |
|
6302 |
Return a path or nil. |
|
6303 |
Search order is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6304 |
bitmaps/<pkg>/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6305 |
resources/<pkg>/bitmaps/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6306 |
<pkg>/bitmaps/file |
10641 | 6307 |
" |
6308 |
||
6309 |
|f dir packageDir pF| |
|
6310 |
||
6311 |
((f := aFileName asString) startsWith:'bitmaps/') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6312 |
f := f copyFrom:('bitmaps/' size + 1). |
10641 | 6313 |
]. |
6314 |
||
6315 |
aPackageIDOrNil isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6316 |
"/ this will be an error in the future |
10641 | 6317 |
"/ 'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR. |
6318 |
"/ self halt. |
|
6319 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6320 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6321 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6322 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6323 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6324 |
f ~= aFileName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6325 |
pF := self searchPath:(self realSystemPath) for:f in:('bitmaps'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6326 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6327 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6328 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6329 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6330 |
^ nil |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6331 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6332 |
|
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6333 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6334 |
dir notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6335 |
pF := dir asFilename / f. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6336 |
pF exists ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6337 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6338 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6339 |
pF := dir asFilename / 'bitmaps' /f. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6340 |
pF exists ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6341 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6342 |
]. |
10641 | 6343 |
]. |
6344 |
||
6345 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
6346 |
||
6347 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir). |
|
6348 |
pF notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6349 |
^ pF. |
10641 | 6350 |
]. |
6351 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps'). |
|
6352 |
pF notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6353 |
^ pF. |
11077
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6354 |
]. |
14df4640ed89
image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents:
11057
diff
changeset
|
6355 |
|
10641 | 6356 |
^ nil |
6357 |
||
6358 |
" |
|
6359 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6360 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6361 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
6362 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
6363 |
" |
|
6364 |
||
6365 |
"Modified: / 11-10-2006 / 13:53:18 / cg" |
|
6366 |
! |
|
6367 |
||
6368 |
getFileInFileName:aFileName |
|
6369 |
"obsolete |
|
6370 |
search aFileName in some standard places |
|
6371 |
(subdirectories named 'fileIn' in SystemPath); |
|
6372 |
return the absolute filename or nil if none is found." |
|
6373 |
||
6374 |
FileInPath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6375 |
FileInPath := self constructPathFor:FileInDirName |
10641 | 6376 |
]. |
6377 |
||
6378 |
^ self searchPath:FileInPath for:aFileName in:FileInDirName |
|
6379 |
||
6380 |
"Modified: 18.7.1996 / 15:53:59 / cg" |
|
6381 |
! |
|
6382 |
||
6383 |
getPackageDirectoryForPackage:aPackageID |
|
6384 |
"search for a particular package; return its directory, or nil. |
|
6385 |
Stand alone applications might get nil, if there are only binaries installed." |
|
6386 |
||
6387 |
|checkForPackageDirectory module packageSubDirectory| |
|
6388 |
||
6389 |
module := aPackageID asPackageId module. |
|
6390 |
packageSubDirectory := aPackageID asPackageId directory. |
|
6391 |
||
6392 |
checkForPackageDirectory := |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6393 |
[:moduleDir | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6394 |
|packageDir| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6395 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6396 |
moduleDir isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6397 |
packageDir := moduleDir / packageSubDirectory. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6398 |
packageDir isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6399 |
^ packageDir |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6400 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6401 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6402 |
]. |
10641 | 6403 |
|
6404 |
self packagePath do:[:aPath | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6405 |
|moduleDir| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6406 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6407 |
moduleDir := aPath asFilename / module. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6408 |
checkForPackageDirectory value:moduleDir. |
10641 | 6409 |
]. |
6410 |
||
6411 |
^ nil |
|
6412 |
||
6413 |
" |
|
6414 |
Smalltalk getPackageDirectoryForPackage:(Array package) |
|
6415 |
Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps' |
|
6416 |
Smalltalk getPackageDirectoryForPackage:'stx:libview' |
|
6417 |
" |
|
6418 |
||
6419 |
"Modified: / 06-10-2006 / 11:49:27 / cg" |
|
6420 |
! |
|
6421 |
||
6422 |
getPackageFileName:aFileName |
|
6423 |
"search aFileName in some standard places |
|
6424 |
(packagePath and subdirectories named 'packages' in SystemPath); |
|
6425 |
return the absolute filename or nil if none is found." |
|
6426 |
||
6427 |
|f| |
|
6428 |
||
6429 |
"/ search along packagePath ... |
|
6430 |
f := self searchPath:self packagePath for:aFileName in:nil. |
|
6431 |
f isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6432 |
"/ search under packages-directory along systemPath ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6433 |
f := self searchPath:self realSystemPath for:aFileName in:PackageDirName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6434 |
"/ kludge - allow for stx-directory to be named differently |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6435 |
f isNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6436 |
(aFileName startsWith:('stx' , Filename separator)) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6437 |
f := '../..' asFilename / (aFileName copyFrom:5). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6438 |
f exists ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6439 |
^ f pathName |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6440 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6441 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6442 |
]. |
10641 | 6443 |
]. |
6444 |
(f notNil and:[(f := f asFilename) exists]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6445 |
^ f pathName |
7758 | 6446 |
]. |
6447 |
^ nil |
|
10641 | 6448 |
|
6449 |
" |
|
6450 |
Smalltalk getPackageFileName:'stx/libview/resources/normal.style' |
|
6451 |
Smalltalk getPackageFileName:'stx/libview/source.zip' |
|
6452 |
" |
|
6453 |
! |
|
6454 |
||
13415 | 6455 |
getPackageSourceFileName:filenameWithoutSuffix |
6456 |
"search aFileName in some standard places and try all available languages" |
|
6457 |
||
6458 |
ProgrammingLanguage allDo: |
|
13771 | 6459 |
[:lang| | file | |
6460 |
file := self getPackageFileName: filenameWithoutSuffix , '.' , lang sourceFileSuffix. |
|
6461 |
file ifNotNil:[^file]]. |
|
13415 | 6462 |
^nil |
6463 |
||
6464 |
"Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
6465 |
! |
|
6466 |
||
10641 | 6467 |
getResourceFileName:aFileName |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6468 |
<resource: #obsolete> |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6469 |
|
10641 | 6470 |
"search aFileName in some standard places |
6471 |
(subdirectories named 'resources' in SystemPath); |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6472 |
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
|
6473 |
Obsolete: you must now provide a package argument." |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6474 |
|
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6475 |
self obsoleteMethodWarning:'use getResourceFileName:forPackage:'. |
10641 | 6476 |
^ self getResourceFileName:aFileName forPackage:nil |
6477 |
||
6478 |
" |
|
6479 |
Smalltalk getResourceFileName:'SystemBrowser.rs' |
|
6480 |
" |
|
6481 |
||
6482 |
"Modified: 18.7.1996 / 15:54:03 / cg" |
|
6483 |
! |
|
6484 |
||
6485 |
getResourceFileName:aFileName forClass:aClassOrNil |
|
6486 |
"search aFileName in some standard places |
|
6487 |
(subdirectories named 'resource' in SystemPath); |
|
6488 |
and in aClasses package directory. |
|
6489 |
Return the absolute filename or nil if none is found." |
|
6490 |
||
6491 |
|pkgOrNil| |
|
6492 |
||
6493 |
aClassOrNil notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6494 |
pkgOrNil := aClassOrNil package. |
10641 | 6495 |
]. |
6496 |
^ self getResourceFileName:aFileName forPackage:pkgOrNil. |
|
6497 |
||
6498 |
" |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6499 |
Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser |
10641 | 6500 |
" |
6501 |
! |
|
6502 |
||
6503 |
getResourceFileName:aFileName forPackage:aPackageIDOrNil |
|
6504 |
"search aFileName in some standard places |
|
6505 |
(subdirectories named 'resource' in SystemPath); |
|
6506 |
and in a packages directory. |
|
6507 |
Return the absolute filename or nil if none is found. |
|
6508 |
Search order is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6509 |
resources/<pkg>/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6510 |
<pkg>/resources/file |
10641 | 6511 |
" |
6512 |
||
6513 |
|pF f dir packageDir| |
|
6514 |
||
6515 |
((f := aFileName asString) startsWith:'resources/') ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6516 |
f := aFileName copyFrom:('resources/' size + 1). |
10641 | 6517 |
]. |
6518 |
||
6519 |
aPackageIDOrNil isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6520 |
"/ this will be an error in the future |
10641 | 6521 |
"/ 'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR. |
6522 |
"/ self halt. |
|
6523 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6524 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6525 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6526 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6527 |
]. |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6528 |
"/ 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
|
6529 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6530 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6531 |
"/ ]. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6532 |
f ~= aFileName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6533 |
pF := self searchPath:(self realSystemPath) for:f in:('resources'). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6534 |
pF notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6535 |
^ pF. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6536 |
]. |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6537 |
"/ 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
|
6538 |
"/ pF notNil ifTrue:[ |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6539 |
"/ ^ pF. |
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6540 |
"/ ]. |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6541 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6542 |
^ nil |
10641 | 6543 |
]. |
6544 |
||
6545 |
packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/. |
|
6546 |
||
6547 |
pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir). |
|
6548 |
pF notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6549 |
^ pF. |
10641 | 6550 |
]. |
6551 |
||
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6552 |
"/ the following code finds the file within the IDE's own hierarchy |
10641 | 6553 |
dir := self projectDirectoryForPackage:aPackageIDOrNil. |
6554 |
dir notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6555 |
dir := dir asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6556 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6557 |
(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ]. |
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6558 |
"/ (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ]. |
12377 | 6559 |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6560 |
"resolve something like: 'ASN/definition.asn1'" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6561 |
(pF := dir / f) exists ifTrue:[ ^ pF name ]. |
12377 | 6562 |
]. |
6563 |
||
10641 | 6564 |
^ nil |
6565 |
||
6566 |
" |
|
6567 |
Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool' |
|
6568 |
Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview' |
|
12547
30fda24cebb5
comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents:
12539
diff
changeset
|
6569 |
Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview' |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6570 |
Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview' |
10641 | 6571 |
Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview' |
6572 |
" |
|
6573 |
||
6574 |
"Modified: / 11-10-2006 / 13:53:43 / cg" |
|
6575 |
! |
|
6576 |
||
6577 |
getSourceFileName:aFileName |
|
6578 |
"search aFileName in some standard places |
|
6579 |
(subdirectories named 'source' in SystemPath); |
|
6580 |
return the absolute filename or nil if none is found. |
|
6581 |
This is used to find a sourceFile for a methods source, |
|
6582 |
if no sourceCodeManager is available." |
|
6583 |
||
6584 |
|f| |
|
6585 |
||
6586 |
SourcePath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6587 |
SourcePath := self constructPathFor:SourceDirName |
10641 | 6588 |
]. |
6589 |
||
6590 |
"/ first, try a source subdir along the path. |
|
6591 |
SourcePath notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6592 |
f := self searchPath:SourcePath for:aFileName in:SourceDirName. |
10641 | 6593 |
]. |
6594 |
f isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6595 |
"/ then, try it itself along the path. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6596 |
f := self searchPath:self realSystemPath for:aFileName in:nil |
10641 | 6597 |
]. |
6598 |
^ f |
|
6599 |
||
6600 |
" |
|
6601 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
6602 |
Smalltalk getSourceFileName:'ArrColl.st' |
|
6603 |
" |
|
6604 |
||
6605 |
"Modified: 18.7.1996 / 15:54:07 / cg" |
|
6606 |
! |
|
6607 |
||
6608 |
getSystemFileName:aFileNameOrString |
|
6609 |
"search aFileNameOrString in some standard places; |
|
6610 |
return the absolute filename or nil if none is found. |
|
6611 |
see comment in Smalltalk>>initSystemPath. |
|
6612 |
This should be used to access resources such as bitmaps, doc-files, |
|
6613 |
and other help files. |
|
6614 |
" |
|
6615 |
||
6616 |
"credits for this method go to Markus ...." |
|
6617 |
||
6618 |
|fn nameString| |
|
6619 |
||
6620 |
fn := aFileNameOrString asFilename. |
|
6621 |
nameString := fn name. |
|
6622 |
fn isAbsolute ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6623 |
"dont use path for absolute file names" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6624 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6625 |
^ nameString |
10641 | 6626 |
]. |
6627 |
||
6628 |
self realSystemPath do:[:dirName | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6629 |
|realName| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6630 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6631 |
realName := dirName asFilename / nameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6632 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6633 |
"/ here, we also return true if its a directory |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6634 |
"/ (Even if unreadable). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6635 |
"/ It could be that the file itself is still readable. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6636 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6637 |
(realName isDirectory or:[realName isReadable]) ifTrue: [ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6638 |
^ realName name |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6639 |
] |
10641 | 6640 |
]. |
6641 |
^ nil |
|
6642 |
||
6643 |
" |
|
6644 |
Smalltalk getSystemFileName:'doc/online/english/TOP.html' |
|
6645 |
Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm' |
|
6646 |
Smalltalk getSystemFileName:'bitmaps/foo' |
|
6647 |
Smalltalk getSystemFileName:'resources/View.rs' |
|
6648 |
Smalltalk getSystemFileName:'resources/iris.style' |
|
6649 |
" |
|
6650 |
||
6651 |
"Modified: / 6.5.1999 / 10:40:37 / cg" |
|
6652 |
! |
|
6653 |
||
6654 |
imageFromFileNamed:aFileName forClass:aClass |
|
6655 |
"search aFileName in some standard places: |
|
6656 |
first in the redefinable bitmaps path, then in the classes |
|
6657 |
own package directory if existing. |
|
6658 |
Return an image or nil." |
|
6659 |
||
6660 |
|classPackage img| |
|
6661 |
||
6662 |
classPackage := aClass package. |
|
6663 |
img := self imageFromFileNamed:aFileName inPackage:classPackage. |
|
6664 |
img isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6665 |
"/ try under the goodies package ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6666 |
classPackage ~= 'stx:goodies' ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6667 |
img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6668 |
] |
10641 | 6669 |
]. |
6670 |
^ img |
|
6671 |
||
6672 |
" |
|
6673 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View |
|
6674 |
" |
|
6675 |
! |
|
6676 |
||
6677 |
imageFromFileNamed:aFileName inPackage:aPackage |
|
6678 |
"search aFileName in some standard places: |
|
6679 |
first in the redefinable bitmaps path, |
|
6680 |
then in the package directory if existing. |
|
6681 |
Return an image or nil. |
|
6682 |
Search order is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6683 |
bitmaps/<pkg>/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6684 |
resources/<pkg>/bitmaps/file |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6685 |
<pkg>/bitmaps/file |
10641 | 6686 |
" |
6687 |
||
6688 |
|path| |
|
6689 |
||
6690 |
path := self getBitmapFileName:aFileName forPackage:aPackage. |
|
6691 |
path notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6692 |
^ Image fromFile:path. |
10641 | 6693 |
]. |
6694 |
^ nil |
|
6695 |
||
6696 |
" |
|
6697 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview' |
|
6698 |
Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool' |
|
6699 |
Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies' |
|
6700 |
Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg' |
|
6701 |
Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg' |
|
6702 |
" |
|
6703 |
||
6704 |
"Modified: / 08-09-2006 / 18:02:04 / cg" |
|
6705 |
! |
|
6706 |
||
6707 |
libraryFileNameOfClass:aClassOrClassName |
|
6708 |
"for a given class, return the name of a classLibrary which contains |
|
6709 |
binary code for it. |
|
6710 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
|
6711 |
for an entry for aClassOrClassName. |
|
6712 |
Search for the className in the first col, and return the value found in |
|
6713 |
the 2nd col. |
|
6714 |
Return nil if no entry is found. |
|
6715 |
||
6716 |
A nil returns means that this class is either built-in or not present |
|
6717 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
6718 |
Otherwise, the returned name is the classLibrary object of that class. |
|
6719 |
The classes code can be loaded from that file if binary loading is supported." |
|
6720 |
||
6721 |
|aStream line words n aClassName| |
|
6722 |
||
6723 |
aClassOrClassName isBehavior ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6724 |
aClassName := aClassOrClassName name |
10641 | 6725 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6726 |
aClassName := aClassOrClassName |
10641 | 6727 |
]. |
6728 |
aClassName := aClassName asString. |
|
6729 |
||
6730 |
#('include/liblist.stc') "/ filenames |
|
6731 |
with:#(2) "/ column |
|
6732 |
do:[:fileName :col | |
|
6733 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6734 |
aStream := self systemFileStreamFor:fileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6735 |
aStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6736 |
[aStream atEnd] whileFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6737 |
line := aStream nextLine. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6738 |
line notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6739 |
(line startsWith:'#') ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6740 |
words := line asCollectionOfWords. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6741 |
(n := words size) > 1 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6742 |
(words at:1) = aClassName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6743 |
n >= col ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6744 |
aStream close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6745 |
^ (words at:col) withoutSeparators |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6746 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6747 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6748 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6749 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6750 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6751 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6752 |
aStream close |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6753 |
]. |
10641 | 6754 |
]. |
6755 |
||
6756 |
^ nil |
|
6757 |
||
6758 |
" |
|
6759 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
6760 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
6761 |
" |
|
6762 |
||
6763 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
|
6764 |
! |
|
6765 |
||
6766 |
packagePath |
|
6767 |
"return a collection of additional directorynames, where smalltalk |
|
6768 |
looks for package directories. |
|
6769 |
Notice, that directories named 'packages' under the systemPath are |
|
6770 |
always consulted - even if not in the packagePath" |
|
6771 |
||
6772 |
^ PackagePath |
|
6773 |
||
6774 |
" |
|
6775 |
Smalltalk packagePath |
|
6776 |
Smalltalk packagePath addLast:'/opt/smalltalk' |
|
6777 |
Smalltalk packagePath addFirst:'/usr/local/otherPackages' |
|
6778 |
" |
|
6779 |
! |
|
6780 |
||
6781 |
packagePath:aPath |
|
6782 |
"set the packagePath; |
|
6783 |
a collection of additional directorynames, where smalltalk |
|
6784 |
looks for package directories. |
|
6785 |
Notice, that directories named 'packages' under the systemPath are |
|
6786 |
always consulted - even if not in the packagePath" |
|
6787 |
||
6788 |
PackagePath := aPath asOrderedCollection |
|
6789 |
||
6790 |
" |
|
6791 |
Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages') |
|
6792 |
" |
|
6793 |
! |
|
6794 |
||
6795 |
projectDirectoryForClass:aClass |
|
6796 |
"given a class, return the path to its package directory; |
|
6797 |
nil if not found." |
|
6798 |
||
6799 |
|pkg| |
|
6800 |
||
6801 |
pkg := aClass package. |
|
6802 |
pkg isNil ifTrue:[^ nil]. |
|
6803 |
||
6804 |
^ self projectDirectoryForPackage:pkg. |
|
6805 |
||
6806 |
" |
|
6807 |
Smalltalk projectDirectoryForClass:Array |
|
6808 |
Smalltalk projectDirectoryForClass:View |
|
6809 |
" |
|
6810 |
! |
|
6811 |
||
6812 |
projectDirectoryForPackage:aPackage |
|
6813 |
"given a packageID, return the path to its package directory; |
|
6814 |
nil if not found." |
|
6815 |
||
6816 |
|prj prjDir| |
|
6817 |
||
6818 |
"/ there might be a package specific resource directory ... |
|
6819 |
"/ in the directory, from which the project was loaded |
|
6820 |
prj := Project projectWithId:aPackage. |
|
6821 |
prj notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6822 |
prjDir := prj directory. |
10641 | 6823 |
]. |
6824 |
(prjDir notNil and:[prjDir asFilename exists]) ifFalse:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6825 |
prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/). |
10641 | 6826 |
]. |
6827 |
^ prjDir |
|
6828 |
||
6829 |
" |
|
6830 |
Smalltalk projectDirectoryForPackage:'stx:libbasic' |
|
6831 |
Smalltalk projectDirectoryForPackage:'exept:smartcard' |
|
6832 |
Smalltalk projectDirectoryForPackage:'stx' |
|
6833 |
Smalltalk projectDirectoryForPackage:'bosch' |
|
6834 |
" |
|
6835 |
||
6836 |
"Modified: / 07-10-2006 / 17:45:58 / cg" |
|
6837 |
! |
|
6838 |
||
6839 |
readAbbreviations |
|
6840 |
"read classname to filename mappings from include/abbrev.stc. |
|
6841 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
6842 |
||
6843 |
"since installAutoloadedClasses also reads all abbreviations, use it" |
|
6844 |
||
6845 |
CachedAbbreviations := IdentityDictionary new. |
|
6846 |
self installAutoloadedClasses. |
|
6847 |
^ CachedAbbreviations. |
|
6848 |
||
6849 |
" |
|
6850 |
Smalltalk readAbbreviations |
|
6851 |
" |
|
6852 |
||
6853 |
"Modified: / 10.12.1999 / 17:48:53 / cg" |
|
6854 |
! |
|
6855 |
||
6856 |
readAbbreviationsFromStream:aStream |
|
6857 |
"read classname to filename mappings from aStream. |
|
6858 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
|
6859 |
||
11375 | 6860 |
self |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6861 |
withAbbreviationsFromStream:aStream |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6862 |
do:[:className :abbrev :pkg | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6863 |
self setFilename:abbrev forClass:className package:pkg. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6864 |
]. |
10641 | 6865 |
|
6866 |
"Modified: / 13.12.1999 / 11:54:17 / cg" |
|
6867 |
! |
|
6868 |
||
6869 |
realSystemPath |
|
11679
69e588cca61f
Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents:
11670
diff
changeset
|
6870 |
"return the realSystemPath - thats the directory names from |
10641 | 6871 |
SystemPath which exist and are readable" |
6872 |
||
6873 |
|nP| |
|
6874 |
||
6875 |
RealSystemPath isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6876 |
OperatingSystem isVMSlike ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6877 |
"/ temporary kludge: since we cannot currently |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6878 |
"/ check for existance of a name like 'volume:', |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6879 |
"/ leave those in the Path without a check. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6880 |
RealSystemPath := SystemPath select:[:dirName | |f| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6881 |
f := dirName asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6882 |
f isVolumeOnly or:[(f isDirectory) and:[f isReadable]] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6883 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6884 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6885 |
RealSystemPath := SystemPath |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6886 |
select:[:eachDirectoryName | |f| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6887 |
f := eachDirectoryName asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6888 |
(f isDirectory) and:[f isReadable] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6889 |
] thenCollect:[:eachDirectoryName| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6890 |
eachDirectoryName asFilename pathName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6891 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6892 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6893 |
"/ remove duplicates (but keep order) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6894 |
nP := OrderedCollection new. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6895 |
RealSystemPath do:[:p | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6896 |
(nP includes:p) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6897 |
nP add:p |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6898 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6899 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6900 |
(nP includes:'.') ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6901 |
nP add:'.' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6902 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6903 |
RealSystemPath := nP. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6904 |
]. |
617 | 6905 |
]. |
6906 |
^ RealSystemPath |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6907 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6908 |
|
10641 | 6909 |
recursiveReadAllAbbreviationsFrom:aDirectory |
6910 |
self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15 |
|
6911 |
! |
|
6912 |
||
6913 |
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels |
|
6914 |
"read all abbreviations from and under aDirectory." |
|
6915 |
||
6916 |
|abbrevStream dir directoryContents| |
|
6917 |
||
6918 |
maxLevels == 0 ifTrue:[ |
|
6919 |
"/ 'Smalltalk [warning]: max directory nesting reached.' infoPrintCR. |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6920 |
^ self |
10641 | 6921 |
]. |
6922 |
||
6923 |
dir := aDirectory asFilename. |
|
6924 |
dir exists ifFalse:[^ self]. |
|
6925 |
||
6926 |
[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6927 |
abbrevStream := (dir / 'abbrev.stc') asFilename readStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6928 |
self readAbbreviationsFromStream:abbrevStream. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6929 |
abbrevStream close. |
10641 | 6930 |
] on:FileStream openErrorSignal do:[:ex| "ignore this file"]. |
6931 |
||
6932 |
[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6933 |
directoryContents := dir directoryContents. |
10641 | 6934 |
] on:FileStream openErrorSignal do:[:ex| |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6935 |
"non-accessable directory: we are done" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6936 |
^ self |
10641 | 6937 |
]. |
6938 |
||
6939 |
directoryContents do:[:aFilename | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6940 |
|f| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6941 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6942 |
(#( |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6943 |
'doc' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6944 |
'CVS' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6945 |
'bitmaps' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6946 |
'resources' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6947 |
'source' |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6948 |
) includes:aFilename) ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6949 |
f := dir / aFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6950 |
f isDirectory ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6951 |
self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1 |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6952 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6953 |
]. |
4458 | 6954 |
]. |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6955 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
6956 |
|
13368 | 6957 |
relativePackagePathForPackage:aPackage |
6958 |
|path| |
|
6959 |
||
6960 |
PackageToPathMapping notNil ifTrue:[ |
|
13370 | 6961 |
path := PackageToPathMapping at:aPackage ifAbsent:nil. |
6962 |
PackageToPathMapping notNil ifTrue:[^ path]. |
|
6963 |
]. |
|
6964 |
^ aPackage copyReplaceAll:$: with:$/. |
|
13368 | 6965 |
|
6966 |
" |
|
6967 |
PackageToPathMapping := Dictionary new. |
|
6968 |
PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'. |
|
6969 |
PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'. |
|
6970 |
||
6971 |
Smalltalk relativePackagePathForPackage:'stx:libview/resources' |
|
6972 |
Smalltalk relativePackagePathForPackage:'stx:libview' |
|
6973 |
" |
|
6974 |
! |
|
6975 |
||
10641 | 6976 |
resourceDirectoryForPackage:aPackage |
6977 |
"given a packageID, return the path to its resource directory; |
|
6978 |
nil if not found." |
|
6979 |
||
6980 |
|prjDir rsrcDir| |
|
6981 |
||
11183
9a4e7475a655
care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents:
11174
diff
changeset
|
6982 |
aPackage notNil ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6983 |
prjDir := self projectDirectoryForPackage:aPackage. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6984 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6985 |
(prjDir notNil |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6986 |
and:[(prjDir := prjDir asFilename) exists |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6987 |
and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6988 |
^ rsrcDir |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6989 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6990 |
rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6991 |
rsrcDir notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6992 |
^ rsrcDir asFilename |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
6993 |
]. |
10641 | 6994 |
]. |
6995 |
^ nil |
|
6996 |
||
6997 |
" |
|
6998 |
Smalltalk resourceDirectoryForPackage:'stx:libbasic' |
|
6999 |
Smalltalk resourceDirectoryForPackage:'exept:expecco' |
|
7000 |
Smalltalk resourceDirectoryForPackage:'exept:smartcard' |
|
7001 |
" |
|
7002 |
! |
|
7003 |
||
7004 |
resourceFileStreamFor:aFileName |
|
7005 |
"search aFileName in some standard places; |
|
7006 |
return a readonly fileStream or nil if not found. |
|
7007 |
Searches in subdirectories named 'resource' in SystemPath" |
|
7008 |
||
7009 |
^ self resourceFileStreamFor:aFileName forClass:nil |
|
7010 |
! |
|
7011 |
||
7012 |
resourceFileStreamFor:aFileName forClass:aClassOrNil |
|
7013 |
"search aFileName in some standard places and in the classes |
|
7014 |
package-resource directory. |
|
7015 |
Return a readonly fileStream or nil if not found. |
|
7016 |
Searches in subdirectories named 'resource' in SystemPath" |
|
7017 |
||
7018 |
|aString| |
|
7019 |
||
7020 |
aString := self getResourceFileName:aFileName forClass:aClassOrNil. |
|
7021 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7022 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7023 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7024 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7025 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7026 |
|
10641 | 7027 |
searchPath:aPath for:aFileName in:aDirName |
7028 |
"search aPath for a subdirectory named aDirectory with a file |
|
7029 |
named aFileName" |
|
7030 |
||
7031 |
|f| |
|
7032 |
||
7033 |
((f := aFileName asFilename) isAbsolute |
|
7034 |
or:[f isExplicitRelative]) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7035 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7036 |
"/ dont use path for absolute or explicit .-relative file names |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7037 |
"/ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7038 |
^ aFileName |
10641 | 7039 |
]. |
7040 |
||
7041 |
aPath notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7042 |
aPath do:[:dirName | |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7043 |
|realName dir| |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7044 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7045 |
dir := dirName asFilename. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7046 |
aDirName notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7047 |
realName := dir / aDirName / aFileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7048 |
] ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7049 |
realName := dir / aFileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7050 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7051 |
(realName isReadable) ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7052 |
^ realName name |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7053 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7054 |
]. |
11108 | 7055 |
]. |
7056 |
||
7057 |
"/ not needed - executing dir is always in SearchPath |
|
12377 | 7058 |
"/ realName := Filename currentDirectory / aFileName. |
11108 | 7059 |
"/ (realName isReadable) ifTrue:[ |
7060 |
"/ ^ realName name |
|
7061 |
"/ ]. |
|
10641 | 7062 |
^ nil. |
7063 |
||
7064 |
"Modified: / 29.4.1999 / 15:06:43 / cg" |
|
7065 |
! |
|
7066 |
||
7067 |
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString |
|
7068 |
|classNameSymbol oldAbbrev oldPath newPath cls abbrevs| |
|
7069 |
||
7070 |
CachedAbbreviations isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7071 |
CachedAbbreviations := IdentityDictionary new. |
10641 | 7072 |
]. |
7073 |
||
7074 |
abbrevs := CachedAbbreviations. |
|
7075 |
aClassNameString ~= aFileNameString ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7076 |
classNameSymbol := aClassNameString asSymbol. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7077 |
oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7078 |
oldAbbrev notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7079 |
oldAbbrev ~= aFileNameString ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7080 |
oldAbbrev asFilename isAbsolute |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7081 |
ifTrue:[ oldPath := oldAbbrev ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7082 |
ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7083 |
aFileNameString asFilename isAbsolute |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7084 |
ifTrue:[ newPath := aFileNameString ] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7085 |
ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7086 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7087 |
oldPath ~= newPath ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7088 |
StandAlone ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7089 |
('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7090 |
('Smalltalk [info]: old: ',oldPath) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7091 |
('Smalltalk [info]: new: ',newPath) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7092 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7093 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7094 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7095 |
"overwrite old abbreviation with new one, |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7096 |
to allow fixing of bad abbrev files" |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7097 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7098 |
|
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7099 |
cls := self classNamed:aFileNameString. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7100 |
cls notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7101 |
cls name ~= aClassNameString ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7102 |
"/ ok, there is a class named after this abbrev ... |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7103 |
"/ this is only a conflict, if the other class has no |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7104 |
"/ abbreviation (or the same). |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7105 |
(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7106 |
cls isNameSpace ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7107 |
aPackageNameString = cls package ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7108 |
StandAlone ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7109 |
('Smalltalk [warning]: conflict for: ' , cls name , |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7110 |
' in package ' , aPackageNameString) infoPrintCR. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7111 |
('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7112 |
, ')') infoPrintCR |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7113 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7114 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7115 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7116 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7117 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7118 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7119 |
abbrevs at:classNameSymbol put:aFileNameString. |
8470
d79e917d4f36
Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents:
8445
diff
changeset
|
7120 |
] |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7121 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7122 |
|
10641 | 7123 |
sourceDirectoryNameOfClass:aClassOrClassName |
7124 |
"for a given class, return the pathname relative to TOP of the classes source code. |
|
7125 |
Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process) |
|
7126 |
for an entry for aClassOrClassName. |
|
7127 |
Search for the className in the first col, and return the value found in |
|
7128 |
the 3rd col. |
|
7129 |
Return nil if no entry is found." |
|
7130 |
||
7131 |
|aStream line words n aClassName| |
|
7132 |
||
7133 |
aClassOrClassName isBehavior ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7134 |
aClassName := aClassOrClassName name |
10641 | 7135 |
] ifFalse:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7136 |
aClassName := aClassOrClassName |
10641 | 7137 |
]. |
7138 |
aClassName := aClassName asString. |
|
7139 |
||
7140 |
#('include/abbrev.stc' 'include/liblist.stc') "/ filenames |
|
7141 |
with:#(3 2) "/ column |
|
7142 |
do:[:fileName :col | |
|
7143 |
||
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7144 |
aStream := self systemFileStreamFor:fileName. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7145 |
aStream notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7146 |
[aStream atEnd] whileFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7147 |
line := aStream nextLine. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7148 |
line notNil ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7149 |
(line startsWith:'#') ifFalse:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7150 |
words := line asCollectionOfWords. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7151 |
(n := words size) > 1 ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7152 |
(words at:1) = aClassName ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7153 |
n >= col ifTrue:[ |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7154 |
aStream close. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7155 |
^ (words at:col) withoutSeparators |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7156 |
] |
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 |
] |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7159 |
] |
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 |
]. |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7162 |
aStream close |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7163 |
]. |
10641 | 7164 |
]. |
7165 |
||
7166 |
^ nil |
|
7167 |
||
7168 |
" |
|
7169 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
|
7170 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
|
7171 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
|
7172 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
|
7173 |
" |
|
7174 |
||
7175 |
"Created: 6.11.1995 / 15:43:30 / cg" |
|
7176 |
"Modified: 9.12.1995 / 23:54:14 / cg" |
|
7177 |
"Modified: 3.1.1997 / 11:26:44 / stefan" |
|
7178 |
! |
|
7179 |
||
7180 |
sourceFileStreamFor:aFileName |
|
7181 |
"search aFileName in some standard places; |
|
7182 |
return a readonly fileStream or nil if not found. |
|
7183 |
Searches in subdirectories named 'source' in SystemPath" |
|
7184 |
||
7185 |
|aString| |
|
7186 |
||
7187 |
aString := self getSourceFileName:aFileName. |
|
7188 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7189 |
^ aString asFilename readStreamOrNil |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7190 |
]. |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7191 |
^ nil |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7192 |
! |
7758 | 7193 |
|
10641 | 7194 |
systemFileStreamFor:aFileName |
7195 |
"search aFileName in some standard places; |
|
7196 |
return a readonly fileStream or nil if not found. |
|
7197 |
see comment in Smalltalk>>initSystemPath" |
|
7198 |
||
7199 |
|aString| |
|
7200 |
||
7201 |
aString := self getSystemFileName:aFileName. |
|
7202 |
aString notNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7203 |
^ aString asFilename readStreamOrNil |
617 | 7204 |
]. |
7205 |
^ nil |
|
7206 |
! |
|
7207 |
||
10641 | 7208 |
systemPath |
7209 |
"return a collection of directorynames, where smalltalk |
|
7210 |
looks for system files |
|
7211 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
7212 |
see comment in Smalltalk>>initSystemPath." |
|
7213 |
||
7214 |
^ SystemPath |
|
7215 |
||
7216 |
" |
|
7217 |
Smalltalk systemPath |
|
7218 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
|
7219 |
" |
|
7220 |
! |
|
7221 |
||
7222 |
systemPath:aPath |
|
7223 |
"set the collection of directorynames, where smalltalk |
|
7224 |
looks for system files |
|
7225 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
7226 |
see comment in Smalltalk>>initSystemPath." |
|
7227 |
||
7228 |
SystemPath := aPath. |
|
7229 |
self flushPathCaches |
|
7230 |
||
7231 |
" |
|
7232 |
Smalltalk systemPath |
|
7233 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7234 |
" |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7235 |
! |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7236 |
|
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7237 |
withAbbreviationsFromStream:aStream do:aBlock |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7238 |
"read classname to filename mappings from aStream. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7239 |
Evaluate aBlock for each tuple: |
13771 | 7240 |
class-name , abbrev-name, package |
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7241 |
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
|
7242 |
|
13415 | 7243 |
|line lineNo words nm abbrev pkg category size s w| |
7244 |
||
7245 |
lineNo := 0. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7246 |
[aStream atEnd] whileFalse:[ |
13771 | 7247 |
line := aStream nextLine. |
7248 |
lineNo := lineNo + 1. |
|
7249 |
line notEmptyOrNil ifTrue:[ |
|
7250 |
(line startsWith:'#') ifFalse:[ |
|
7251 |
||
7252 |
"/ must do it manually, caring for quoted strings. |
|
11301
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7253 |
"/ words := line asCollectionOfWords. |
f65ffb560925
refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents:
11232
diff
changeset
|
7254 |
|
13771 | 7255 |
words := OrderedCollection new. |
7256 |
s := line readStream. |
|
7257 |
[s atEnd] whileFalse:[ |
|
7258 |
s skipSeparators. |
|
7259 |
s peek == $' ifTrue:[ |
|
7260 |
s next. |
|
7261 |
w := s upTo:$'. |
|
7262 |
s skipSeparators. |
|
7263 |
] ifFalse:[ |
|
7264 |
w := s upToSeparator |
|
7265 |
]. |
|
7266 |
words add:w |
|
7267 |
]. |
|
7268 |
words size >= 3 ifTrue:[ |
|
7269 |
nm := (words at:1) withoutSeparators. |
|
7270 |
abbrev := (words at:2) withoutSeparators. |
|
7271 |
pkg := (words at:3) withoutSeparators. |
|
7272 |
aBlock argumentCount = 3 ifTrue:[ |
|
7273 |
aBlock value:nm value:abbrev value:pkg. |
|
7274 |
] ifFalse:[ |
|
7275 |
words size >= 4 ifTrue:[ |
|
7276 |
category := words at:4. |
|
7277 |
]. |
|
7278 |
words size = 5 ifTrue:[ |
|
7279 |
size := (words at:5) asNumber |
|
7280 |
]. |
|
7281 |
aBlock value:nm value:abbrev value:pkg value: category value: size |
|
7282 |
] |
|
7283 |
] ifFalse:[ |
|
7284 |
('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR. |
|
7285 |
] |
|
7286 |
] |
|
7287 |
] |
|
13518
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
7288 |
]. |
b81bc64782b1
not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents:
13506
diff
changeset
|
7289 |
|
13415 | 7290 |
"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
|
7291 |
"Modified: / 04-08-2011 / 21:35:00 / cg" |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7292 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7293 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7294 |
!Smalltalk class methodsFor:'system management-packages'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7295 |
|
10641 | 7296 |
loadPackage:aPackageIdOrPackage |
12250 | 7297 |
"make certain, that some particular package is loaded into the system. |
7298 |
Return true if loaded, false otherwise." |
|
11668 | 7299 |
|
7300 |
^ self loadPackage:aPackageIdOrPackage asAutoloaded:false |
|
7301 |
||
7302 |
" |
|
7303 |
Smalltalk loadPackage:'stx:libbasic' |
|
7304 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7305 |
Smalltalk loadPackage:'cg:cparser' |
|
7306 |
Smalltalk loadPackage:'cg:rose' |
|
7307 |
" |
|
7308 |
! |
|
7309 |
||
10641 | 7310 |
packageDirectoryForPackageId:aPackageId |
12250 | 7311 |
"used by classes to find the location of their resource- and bitmap directories. |
7312 |
||
7313 |
Notice that the directory structure is different between the development |
|
7314 |
environment (top for packages is ../../../stx) and delivered stand alone executables, |
|
7315 |
where the top is specified via a shell environment variable, and is typically ../lib. |
|
7316 |
At runtime, Smalltalk knows about the systemPath setting." |
|
7317 |
||
10641 | 7318 |
|packageDirName packageDir| |
7319 |
||
7320 |
packageDirName := aPackageId copyReplaceAll:$: with:$/. |
|
7321 |
||
7322 |
packageDir := self getPackageFileName:packageDirName. |
|
7323 |
packageDir isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7324 |
^ nil. |
10641 | 7325 |
]. |
7326 |
^ packageDir asFilename |
|
7327 |
||
7328 |
" |
|
11375 | 7329 |
Smalltalk packageDirectoryForPackageId:'stx:libbasic' |
10641 | 7330 |
Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency' |
7331 |
Smalltalk packageDirectoryForPackageId:'exept:ctypes' |
|
7332 |
" |
|
12250 | 7333 |
! |
7334 |
||
7335 |
unloadPackage:aPackageIdOrPackage |
|
7336 |
|projectDefinition| |
|
7337 |
||
7338 |
projectDefinition := aPackageIdOrPackage. |
|
7339 |
projectDefinition isProjectDefinition ifFalse:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7340 |
projectDefinition := projectDefinition asPackageId projectDefinitionClass |
12250 | 7341 |
]. |
7342 |
projectDefinition unloadPackage. |
|
7343 |
||
7344 |
" |
|
7345 |
Smalltalk loadPackage:'stx:goodies/persistency' |
|
7346 |
Smalltalk unloadPackage:'stx:goodies/persistency' |
|
7347 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7348 |
! ! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7349 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7350 |
!Smalltalk class methodsFor:'system management-undeclared variables'! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7351 |
|
10641 | 7352 |
clearUndeclaredVariables |
7353 |
"remove all undeclared variables" |
|
7354 |
||
7355 |
(Smalltalk at:#Undeclared) do:[:eachKey | |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7356 |
Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol. |
10641 | 7357 |
]. |
7358 |
(Smalltalk at:#Undeclared) removeAll. |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7359 |
Smalltalk removeKey:#Undeclared. |
10641 | 7360 |
! |
7361 |
||
7362 |
undeclaredPrefix |
|
7363 |
"the prefix used for undeclared variables" |
|
7364 |
||
7365 |
^ 'Undeclared:::' |
|
7366 |
||
7367 |
"Created: / 31.10.1997 / 01:13:10 / cg" |
|
7758 | 7368 |
! ! |
7369 |
||
7370 |
!Smalltalk class methodsFor:'time-versions'! |
|
7371 |
||
10641 | 7372 |
configuration |
7373 |
"{ Pragma: +optSpace }" |
|
7374 |
||
7375 |
"for developers only: return the configuration, with which |
|
7376 |
this smalltalk was compiled." |
|
7377 |
||
7378 |
%{ /* NOCONTEXT */ |
|
7379 |
extern char *__getConfigurationString(); |
|
7380 |
||
7381 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
7382 |
%}. |
|
7383 |
^ 'unknownOS/unknownCONF:unknownPACK' |
|
7384 |
||
7385 |
" |
|
10071 | 7386 |
Smalltalk configuration |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7387 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7388 |
! |
453 | 7389 |
|
10641 | 7390 |
copyrightString |
7391 |
"{ Pragma: +optSpace }" |
|
7392 |
||
7393 |
"return a copyright string" |
|
7394 |
||
7395 |
%{ /* NOCONTEXT */ |
|
7396 |
#ifndef __getCopyrightString |
|
7397 |
extern OBJ __getCopyrightString(); |
|
7398 |
#endif |
|
7399 |
||
7400 |
RETURN (__getCopyrightString()); |
|
7401 |
%}. |
|
7402 |
^ self primitiveFailed |
|
7403 |
||
7404 |
" |
|
7758 | 7405 |
Smalltalk copyrightString |
7406 |
" |
|
7407 |
! |
|
7408 |
||
10641 | 7409 |
distributorString |
7410 |
"{ Pragma: +optSpace }" |
|
7411 |
||
7412 |
"return a string describing the distributor of this software" |
|
7413 |
||
7414 |
%{ /* NOCONTEXT */ |
|
7415 |
#ifndef __getDistributorString |
|
7416 |
extern OBJ __getDistributorString(); |
|
7417 |
#endif |
|
7418 |
||
7419 |
RETURN (__getDistributorString()); |
|
7420 |
%}. |
|
7421 |
^ 'eXept Software AG, Germany' |
|
7422 |
||
7423 |
" |
|
7424 |
Smalltalk distributorString |
|
7425 |
" |
|
7426 |
! |
|
7427 |
||
7428 |
expirationTime |
|
7429 |
"{ Pragma: +optSpace }" |
|
7430 |
||
7431 |
"for developers only: return the time when the system will expire. |
|
7432 |
after this time it will not run any longer. |
|
7433 |
It returns nil, if no expiration time has been set (system runs forever :-))" |
|
7434 |
||
7435 |
|exp| |
|
7436 |
||
7437 |
%{ |
|
7438 |
extern unsigned int __getExpirationTime(); |
|
7439 |
||
7440 |
exp = __MKUINT(__getExpirationTime()); |
|
7441 |
%}. |
|
7442 |
exp == 0 ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7443 |
^ nil |
10641 | 7444 |
]. |
7445 |
^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970" |
|
7446 |
||
7447 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7448 |
Smalltalk expirationTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7449 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7450 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7451 |
|
10641 | 7452 |
fullVersionString |
7453 |
"{ Pragma: +optSpace }" |
|
7454 |
||
7455 |
"return a full version string" |
|
7456 |
||
7457 |
^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate |
|
7458 |
||
7459 |
" |
|
7460 |
Smalltalk fullVersionString |
|
7461 |
" |
|
7462 |
||
7463 |
"Created: / 27.10.1997 / 17:03:09 / cg" |
|
7464 |
"Modified: / 27.10.1997 / 17:04:02 / cg" |
|
7465 |
! |
|
7466 |
||
7467 |
hello |
|
7468 |
"{ Pragma: +optSpace }" |
|
7469 |
||
7470 |
"return a greeting string" |
|
7471 |
||
7472 |
"stupid: this should come from a resource file ... |
|
7473 |
but I dont use it here, to allow mini-systems without |
|
7474 |
Resource-stuff." |
|
7475 |
||
7476 |
|proto lang| |
|
7477 |
||
7478 |
lang := Language. |
|
7479 |
(lang == #de) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7480 |
proto := 'Willkommen bei %1 (Version %2 von %3)' |
10641 | 7481 |
] ifFalse:[ (lang == #fr) ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7482 |
proto := 'Salut, Bienvenue à %1 (version %2 de %3)' |
10641 | 7483 |
] ifFalse:[ (lang == #it) ifTrue:[ |
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7484 |
proto := 'Ciao, benvenuto al %1 (versione %2 di %3)' |
10641 | 7485 |
] ifFalse:[ (lang == #es) ifTrue:[ |
7486 |
"/ proto := 'Hola, bienvenida a %1 (versión %2 de %3)' |
|
7487 |
] ifFalse:[ (lang == #es) ifTrue:[ |
|
7488 |
"/ proto := 'Oi, benvindo a %1 (versão %2 de %3)' |
|
7489 |
] ifFalse:[ (lang == #no) ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7490 |
proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)' |
10641 | 7491 |
]]]]]]. |
7492 |
||
7493 |
"/ ... more needed here ... |
|
7494 |
||
7495 |
proto isNil ifTrue:[ |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7496 |
proto := 'Hello World - here is %1 version %2 of %3'. |
10641 | 7497 |
]. |
7498 |
||
7499 |
^ proto bindWith:('SmallTalk/X' allBold) |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7500 |
with:(self versionString) |
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7501 |
with:(self versionDate) |
10641 | 7502 |
|
7503 |
" |
|
7504 |
Smalltalk language:#us. |
|
7505 |
Smalltalk hello |
|
7506 |
||
7507 |
Smalltalk language:#de. |
|
7508 |
Smalltalk hello |
|
7509 |
||
7510 |
Smalltalk language:#no. |
|
7511 |
Smalltalk hello |
|
7512 |
||
7513 |
Transcript showCR:(Smalltalk hello) |
|
7514 |
Stdout showCR:(Smalltalk hello) |
|
7515 |
" |
|
7516 |
||
7517 |
"Modified: 18.5.1996 / 14:25:13 / cg" |
|
7518 |
! |
|
7519 |
||
7520 |
imageRestartTime |
|
7521 |
"return a timestamp for the moment when this image was restarted. |
|
7522 |
If we do not execute from an image (i.e. fresh start), return nil." |
|
7523 |
||
7524 |
^ ImageRestartTime |
|
7525 |
||
7526 |
" |
|
7527 |
Smalltalk imageStartTime |
|
7528 |
Smalltalk imageRestartTime |
|
7529 |
" |
|
7530 |
||
7531 |
"Created: 13.12.1995 / 17:44:20 / cg" |
|
7532 |
"Modified: 6.3.1996 / 11:56:35 / cg" |
|
7533 |
! |
|
7534 |
||
7535 |
imageSaveTime |
|
7536 |
"{ Pragma: +optSpace }" |
|
7537 |
||
7538 |
"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
|
7539 |
|
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7540 |
^ ObjectMemory imageSaveTime |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7541 |
! |
7758 | 7542 |
|
10641 | 7543 |
imageStartTime |
7544 |
"{ Pragma: +optSpace }" |
|
7545 |
||
7546 |
"return a timestamp for the moment when this system started the first time |
|
7547 |
(i.e. the first initial start without an image)" |
|
7548 |
||
7549 |
^ ImageStartTime |
|
7550 |
||
7551 |
" |
|
7552 |
Smalltalk imageStartTime |
|
7553 |
Smalltalk imageRestartTime |
|
7554 |
" |
|
7555 |
||
7556 |
"Created: 13.12.1995 / 17:44:14 / cg" |
|
7557 |
"Modified: 13.12.1995 / 17:45:47 / cg" |
|
7558 |
! |
|
7559 |
||
7560 |
majorVersionNr |
|
7561 |
"{ Pragma: +optSpace }" |
|
7562 |
||
7563 |
"return the major version number. |
|
7564 |
This is only incremented for very fundamental changes, |
|
7565 |
which make old object files totally incompatible |
|
7566 |
(for example, if the layout/representation of fundamental |
|
7567 |
classes changes). |
|
7568 |
||
7569 |
ST/X revision Naming is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7570 |
<major>.<minor>.<revision>.<release>" |
10641 | 7571 |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
7572 |
^ 6 |
10641 | 7573 |
|
7574 |
" |
|
7575 |
Smalltalk majorVersionNr |
|
7576 |
" |
|
7577 |
||
7578 |
"Modified: 8.11.1996 / 19:59:21 / cg" |
|
7579 |
! |
|
7580 |
||
7581 |
minorVersionNr |
|
7582 |
"{ Pragma: +optSpace }" |
|
7583 |
||
7584 |
"return the minor version number. |
|
7585 |
This is incremented for changes which make some old object |
|
7586 |
files incompatible, or the protocol changes such that some |
|
7587 |
classes need rework. |
|
7588 |
||
7589 |
ST/X revision Naming is: |
|
13771 | 7590 |
<major>.<minor>.<revision>.<release>" |
13489 | 7591 |
|
7592 |
^ 2 |
|
10641 | 7593 |
|
7594 |
" |
|
7595 |
Smalltalk minorVersionNr |
|
7596 |
" |
|
7597 |
||
7598 |
"Modified: / 16-08-2006 / 09:37:25 / cg" |
|
7599 |
! |
|
7600 |
||
7601 |
releaseIdentification |
|
7602 |
"{ Pragma: +optSpace }" |
|
7603 |
||
7604 |
"for developers only: return the release |
|
7605 |
(to further identify the version in case of errors)" |
|
7606 |
||
7607 |
%{ /* NOCONTEXT */ |
|
7608 |
extern OBJ __getRel(); |
|
7609 |
||
7610 |
RETURN (__getRel()); |
|
7611 |
%}. |
|
7612 |
^ 'ST/X_experimental' |
|
7613 |
||
7614 |
" |
|
7615 |
Smalltalk releaseIdentification |
|
7616 |
" |
|
7617 |
! |
|
7618 |
||
7619 |
releaseNr |
|
7620 |
"{ Pragma: +optSpace }" |
|
7621 |
||
7622 |
"return the revision number. |
|
7623 |
Incremented for releases which fix bugs/add features but did not find |
|
7624 |
their way to the outside world. |
|
7625 |
||
7626 |
ST/X revision Naming is: |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7627 |
<major>.<minor>.<revision>.<release>" |
11054 | 7628 |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
7629 |
^ 1 |
10641 | 7630 |
|
7631 |
" |
|
7632 |
Smalltalk releaseNr |
|
12867
2b9cbcea983b
version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents:
12861
diff
changeset
|
7633 |
Smalltalk versionString |
10641 | 7634 |
" |
7635 |
||
7636 |
"Created: / 10-12-1995 / 01:42:19 / cg" |
|
7637 |
"Modified: / 10-02-2007 / 14:49:51 / cg" |
|
7638 |
! |
|
7639 |
||
7640 |
revisionNr |
|
7641 |
"{ Pragma: +optSpace }" |
|
7642 |
||
7643 |
"return the revision number. |
|
7644 |
Incremented for releases which fix bugs/add features |
|
7645 |
and represent a stable workable version which got published |
|
7646 |
to the outside world. |
|
7647 |
||
7648 |
ST/X revision Naming is: |
|
13771 | 7649 |
<major>.<minor>.<revision>.<release>" |
13489 | 7650 |
|
7651 |
^ 1 |
|
10641 | 7652 |
|
7653 |
" |
|
7654 |
Smalltalk revisionNr |
|
13323
68e5bb82f5f7
changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents:
13303
diff
changeset
|
7655 |
Smalltalk hello string |
13014 | 7656 |
" |
7657 |
||
7658 |
"Modified: / 12-08-2010 / 01:20:56 / cg" |
|
10641 | 7659 |
! |
7660 |
||
7661 |
timeStamp |
|
7662 |
"return a string useful for timestamping a file. |
|
7663 |
The returned string is padded with spaces for a constant |
|
7664 |
length (to avoid changing a files size in fileOut with unchanged |
|
7665 |
class)." |
|
7666 |
||
7667 |
^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space) |
|
7668 |
! |
|
7669 |
||
7670 |
timeStamp:aStream |
|
7671 |
"write a string useful for timestamping a file onto aStream. |
|
7672 |
ST80 compatibility" |
|
7673 |
||
7674 |
aStream nextPutAll:(self timeStamp). |
|
7675 |
||
7676 |
"Created: / 18.6.1998 / 17:22:58 / cg" |
|
7677 |
! |
|
7678 |
||
7679 |
timeStampString |
|
7680 |
"return a string useful for timestamping a file." |
|
7681 |
||
7682 |
|dateString| |
|
7683 |
||
7684 |
dateString := String streamContents:[:s | Date today printOn:s language:#en]. "/ MUST be english !!!! |
|
7685 |
||
7686 |
^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
|
7687 |
, dateString , ' at ' , Time now printString |
|
7758 | 7688 |
) |
7689 |
! |
|
7690 |
||
10641 | 7691 |
versionDate |
7692 |
"{ Pragma: +optSpace }" |
|
7693 |
||
7694 |
"return the executables build date - thats the date when the smalltalk |
|
7695 |
executable was built" |
|
7696 |
||
7697 |
%{ /* NOCONTEXT */ |
|
7698 |
extern char *__getBuildDateString(); |
|
7699 |
||
7700 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
7701 |
%}. |
|
7702 |
^ 'today' |
|
7703 |
||
7704 |
" |
|
10071 | 7705 |
Smalltalk versionDate |
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7706 |
" |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7707 |
! |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7708 |
|
10641 | 7709 |
versionString |
7710 |
"{ Pragma: +optSpace }" |
|
7711 |
||
7712 |
"return the version string" |
|
7713 |
||
7714 |
^ (self majorVersionNr printString , |
|
7715 |
'.', |
|
7716 |
self minorVersionNr printString , |
|
7717 |
'.', |
|
7718 |
self revisionNr printString) |
|
13771 | 7719 |
|
10641 | 7720 |
|
7721 |
" |
|
8583
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7722 |
Smalltalk versionString |
2952bfabeaf7
oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents:
8570
diff
changeset
|
7723 |
" |
10641 | 7724 |
! |
7725 |
||
7726 |
vmMajorVersionNr |
|
7727 |
"{ Pragma: +optSpace }" |
|
7728 |
||
7729 |
"return the VMs major version number." |
|
7730 |
%{ |
|
7731 |
RETURN (__mkSmallInteger(4)); |
|
7732 |
%}. |
|
7733 |
^ 4 |
|
7734 |
||
7735 |
" |
|
7736 |
Smalltalk vmMajorVersionNr |
|
7737 |
" |
|
2 | 7738 |
! ! |
453 | 7739 |
|
1750
36ff7e62388a
care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents:
1713
diff
changeset
|
7740 |
!Smalltalk class methodsFor:'documentation'! |
630 | 7741 |
|
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
7742 |
version |
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
7743 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.990 2012-02-22 13:28:10 stefan Exp $' |
13532
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
7744 |
! |
638f9bfab880
changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents:
13531
diff
changeset
|
7745 |
|
12172
d90a72004f43
changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents:
12033
diff
changeset
|
7746 |
version_CVS |
14020
3cbf9505591c
changed: #installAutoloadedClassesFromStream:
Stefan Vogel <sv@exept.de>
parents:
14011
diff
changeset
|
7747 |
^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.990 2012-02-22 13:28:10 stefan Exp $' |
13415 | 7748 |
! |
7749 |
||
7750 |
version_SVN |
|
13489 | 7751 |
^ '§ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1 §' |
630 | 7752 |
! ! |