author | Claus Gittinger <cg@exept.de> |
Wed, 08 Nov 1995 18:03:09 +0100 | |
changeset 509 | 8f4649450d6e |
parent 501 | 1dc925f66637 |
child 524 | 1a5c3e68bd6a |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
159 | 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 |
" |
|
12 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
13 |
'From Smalltalk/X, Version:2.10.8 on 29-oct-1995 at 20:01:13' ! |
453 | 14 |
|
1 | 15 |
Object subclass:#Smalltalk |
453 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'ExitBlocks CachedClasses SystemPath StartupClass StartupSelector |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
18 |
StartupArguments CachedAbbreviations SilentLoading Initializing |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
19 |
StandAlone LogDoits LoadBinaries RealSystemPath ResourcePath |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
20 |
SourcePath BitmapPath BinaryPath FileInPath' |
453 | 21 |
poolDictionaries:'' |
22 |
category:'System-Support' |
|
1 | 23 |
! |
24 |
||
70 | 25 |
!Smalltalk class methodsFor:'documentation'! |
26 |
||
95 | 27 |
version |
28 |
" |
|
509
8f4649450d6e
alternative to SMALLTALK_LIBDIR -> STX_LIBDIR
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
29 |
$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.77 1995-11-08 17:03:09 cg Exp $ |
95 | 30 |
" |
31 |
! |
|
32 |
||
70 | 33 |
documentation |
34 |
" |
|
35 |
This is one of the central classes in the system; |
|
36 |
it provides all system-startup, shutdown and maintenance support. |
|
37 |
Also global variables are kept here. |
|
38 |
||
39 |
As you will notice, this is NOT a Dictionary |
|
40 |
- my implementation of globals is totally different |
|
41 |
(due to the need to be able to access globals from c-code as well). |
|
42 |
However, it provides the known enumeration protocol. |
|
43 |
It may change to become a subclass of collection at some time ... |
|
44 |
||
45 |
Instance variables: |
|
159 | 46 |
none - all handling is done in the VM |
70 | 47 |
|
48 |
Class variables: |
|
159 | 49 |
ExitBlocks <Collection> blocks to evaluate before system is |
50 |
left. Not currently used. |
|
70 | 51 |
|
159 | 52 |
CachedClasses <Collection> known classes (cached for faster enumeration) |
70 | 53 |
|
159 | 54 |
SystemPath <Collection> path to search for system files (sources, bitmaps etc) |
70 | 55 |
|
159 | 56 |
StartupClass <Class> class, which gets initial message |
57 |
(right after VM initialization) |
|
58 |
StartupSelector <Symbol> message sent to StartupClass |
|
70 | 59 |
|
159 | 60 |
CachedAbbreviations |
61 |
<Dictionary> className to filename mappings |
|
70 | 62 |
|
159 | 63 |
SilentLoading <Boolean> suppresses messages during fileIn and in compiler |
64 |
(can be set to true from a customized main) |
|
122 | 65 |
|
159 | 66 |
LogDoits <Boolean> if true, doits are also logged in the changes |
67 |
file. Default is false, since the changes file |
|
68 |
may become huge ... |
|
329 | 69 |
|
400 | 70 |
LoadBinaries <Boolean> if true, we attempt to load classes rom a binary |
390 | 71 |
file, if present. If false, this is always suppressed. |
72 |
||
329 | 73 |
SourcePath <Collection> cached names of really existing directories |
74 |
BitmapPath These are remembered, since in NFS systems, |
|
75 |
ResourcePath the time to lookup files may become long |
|
76 |
BinaryPath (especially, if some directories are on machines |
|
77 |
FileInPath which are not up ...). Therefore, the set of really |
|
78 |
existing directories is cached when the SystemPath |
|
79 |
is walked the first time. |
|
70 | 80 |
" |
1 | 81 |
! |
82 |
||
453 | 83 |
copyright |
84 |
" |
|
85 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
86 |
All Rights Reserved |
|
87 |
||
88 |
This software is furnished under a license and may be used |
|
89 |
only in accordance with the terms of that license and with the |
|
90 |
inclusion of the above copyright notice. This software may not |
|
91 |
be provided or otherwise made available to, or used by, any |
|
92 |
other person. No title to or ownership of the software is |
|
93 |
hereby transferred. |
|
94 |
" |
|
1 | 95 |
! ! |
96 |
||
97 |
!Smalltalk class methodsFor:'initialization'! |
|
98 |
||
325 | 99 |
initializeSystem |
24 | 100 |
"initialize all other classes; setup dispatcher processes etc. |
211 | 101 |
This one is the first entry into the smalltalk world right after startup, |
102 |
ususally followed by Smalltalk>>start. |
|
103 |
Notice: this is not called when an image is restarted; in this |
|
104 |
case the show starts in Smalltalk>>restart." |
|
105 |
||
348 | 106 |
SilentLoading := false. |
107 |
Initializing := true. |
|
108 |
||
211 | 109 |
" |
110 |
define low-level debugging tools - graphical classes are not prepared yet |
|
111 |
to handle things. |
|
112 |
This will bring us into the MiniDebugger when an error occurs |
|
113 |
during startup |
|
114 |
" |
|
115 |
Inspector := MiniInspector. |
|
116 |
Debugger := MiniDebugger. |
|
1 | 117 |
|
118 |
self initGlobalsFromEnvironment. |
|
119 |
||
70 | 120 |
" |
121 |
sorry - there are some, which MUST be initialized before .. |
|
122 |
reason: if any error happens during init, we need Signals, Stdout etc. to be there |
|
123 |
" |
|
1 | 124 |
Object initialize. |
423 | 125 |
Signal initialize. |
326 | 126 |
ObjectMemory initialize. |
1 | 127 |
ExternalStream initialize. |
211 | 128 |
|
129 |
self initStandardStreams. "/ setup Stdin, Stdout etc. |
|
1 | 130 |
|
70 | 131 |
" |
132 |
sorry, path must be set before ... |
|
133 |
reason: some classes need it during initialize (they might need resources, bitmaps etc) |
|
134 |
" |
|
1 | 135 |
self initSystemPath. |
136 |
||
70 | 137 |
" |
138 |
must init display here - some classes (Color, Form) need it during initialize |
|
139 |
" |
|
1 | 140 |
Workstation notNil ifTrue:[ |
159 | 141 |
Workstation initialize |
1 | 142 |
]. |
143 |
||
144 |
Compiler := ByteCodeCompiler. |
|
145 |
Compiler isNil ifTrue:[ |
|
159 | 146 |
" |
147 |
ByteCodeCompiler is not in the system (i.e. has not been linked in) |
|
148 |
this allows at least immediate evaluations for runtime systems without compiler |
|
149 |
NOTICE: a parser is always needed, otherwise we cannot read resource files etc. |
|
150 |
" |
|
151 |
Compiler := Parser |
|
1 | 152 |
]. |
153 |
||
70 | 154 |
" |
325 | 155 |
now, finally, initialize all other classes |
70 | 156 |
" |
325 | 157 |
self initializeModules. |
158 |
||
159 |
"/ self allBehaviorsDo:[:aClass | |
|
159 | 160 |
"/ 'init ' print. aClass name printNL. |
329 | 161 |
"/ aClass initialize |
325 | 162 |
"/ ]. |
159 | 163 |
|
321 | 164 |
Display notNil ifTrue:[ |
329 | 165 |
Display initialize. |
321 | 166 |
]. |
70 | 167 |
self initInterrupts. |
325 | 168 |
self initUserPreferences. |
169 |
! |
|
1 | 170 |
|
325 | 171 |
initializeModules |
172 |
"perform module specific initialization and |
|
173 |
send #initialize to all classes. |
|
174 |
Notice: this is not called when an image is restarted" |
|
175 |
%{ |
|
176 |
init_registered_modules(3 COMMA_CON); |
|
177 |
%} |
|
1 | 178 |
! |
179 |
||
122 | 180 |
initUserPreferences |
181 |
"setup other stuff" |
|
182 |
||
390 | 183 |
LogDoits := false. |
184 |
LoadBinaries := false. |
|
122 | 185 |
! |
186 |
||
1 | 187 |
initGlobalsFromEnvironment |
188 |
"setup globals from the shell-environment" |
|
189 |
||
211 | 190 |
|envString i langString terrString| |
1 | 191 |
|
70 | 192 |
" |
193 |
extract Language and LanguageTerritory from LANG variable. |
|
1 | 194 |
the language and territory must not be abbreviated, |
211 | 195 |
valid are for example: english_usa |
196 |
english |
|
197 |
german |
|
198 |
german_austria |
|
70 | 199 |
" |
1 | 200 |
|
211 | 201 |
Language := #english. |
202 |
LanguageTerritory := #usa. |
|
203 |
||
1 | 204 |
envString := OperatingSystem getEnvironment:'LANG'. |
205 |
envString notNil ifTrue:[ |
|
159 | 206 |
i := envString indexOf:$_. |
207 |
(i == 0) ifTrue:[ |
|
208 |
langString := envString. |
|
209 |
terrString := envString |
|
210 |
] ifFalse:[ |
|
211 |
langString := envString copyTo:(i - 1). |
|
212 |
terrString := envString copyFrom:(i + 1) |
|
213 |
]. |
|
214 |
Language := langString asSymbol. |
|
215 |
LanguageTerritory := terrString asSymbol |
|
1 | 216 |
]. |
217 |
||
70 | 218 |
" |
211 | 219 |
Smalltalk initGlobalsFromEnvironment |
70 | 220 |
" |
1 | 221 |
! |
222 |
||
223 |
initStandardTools |
|
95 | 224 |
"predefine some tools which we will need later |
1 | 225 |
- if the view-classes exist, |
226 |
they will redefine Inspector and Debugger for graphical interfaces" |
|
227 |
||
228 |
"redefine debug-tools, if view-classes exist" |
|
229 |
||
95 | 230 |
Display notNil ifTrue:[ |
159 | 231 |
InspectorView notNil ifTrue:[ |
232 |
Inspector := InspectorView |
|
233 |
]. |
|
234 |
DebugView notNil ifTrue:[ |
|
235 |
Debugger := DebugView |
|
236 |
]. |
|
237 |
Display initialize |
|
1 | 238 |
] |
239 |
"Smalltalk initStandardTools" |
|
240 |
! |
|
241 |
||
242 |
initStandardStreams |
|
243 |
"initialize some well-known streams" |
|
244 |
||
245 |
Stdout := NonPositionableExternalStream forStdout. |
|
246 |
Stderr := NonPositionableExternalStream forStderr. |
|
247 |
Stdin := NonPositionableExternalStream forStdin. |
|
248 |
Printer := PrinterStream. |
|
249 |
Transcript := Stderr |
|
250 |
||
251 |
"Smalltalk initStandardStreams" |
|
252 |
! |
|
253 |
||
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
254 |
reinitStandardStreams |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
255 |
"reinitialize some well-known streams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
256 |
Tis must be done very early during startup, to allow for |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
257 |
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
|
258 |
(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
|
259 |
|
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
260 |
Stdout reOpen. Stderr reOpen. Stdin reOpen. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
261 |
! |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
262 |
|
1 | 263 |
initInterrupts |
264 |
"initialize interrupts" |
|
265 |
||
266 |
OperatingSystem enableUserInterrupts. |
|
77 | 267 |
OperatingSystem enableHardSignalInterrupts. |
2 | 268 |
OperatingSystem enableFpExceptionInterrupts. |
269 |
||
270 |
ObjectMemory userInterruptHandler:self. |
|
13 | 271 |
ObjectMemory signalInterruptHandler:self. |
272 |
ObjectMemory recursionInterruptHandler:self. |
|
1 | 273 |
|
274 |
"Smalltalk initInterrupts" |
|
275 |
! |
|
276 |
||
277 |
initSystemPath |
|
70 | 278 |
"setup path where system files are searched for. |
7 | 279 |
the default path is set to: |
159 | 280 |
. |
281 |
.. |
|
282 |
$HOME (if defined) |
|
283 |
$HOME/.smalltalk (if defined & existing) |
|
284 |
$SMALLTALK_LIBDIR (if defined & existing) |
|
509
8f4649450d6e
alternative to SMALLTALK_LIBDIR -> STX_LIBDIR
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
285 |
$STX_LIBDIR (if defined & existing) |
159 | 286 |
/usr/local/lib/smalltalk (if existing) |
287 |
/usr/lib/smalltalk (if existing) |
|
70 | 288 |
|
289 |
of course, it is possible to add entries from the 'smalltalk.rc' |
|
290 |
startup file; add expressions such as: |
|
159 | 291 |
Smalltalk systemPath addFirst:'/foo/bar/baz'. |
292 |
or: |
|
293 |
Smalltalk systemPath addLast:'/fee/foe/foo'. |
|
7 | 294 |
" |
1 | 295 |
|
70 | 296 |
|p homePath| |
297 |
||
298 |
homePath := OperatingSystem getHomeDirectory. |
|
443 | 299 |
homePath isNil ifTrue:[ |
300 |
homePath := '.' |
|
301 |
]. |
|
1 | 302 |
|
70 | 303 |
" |
304 |
the path is set to search files first locally |
|
305 |
- this allows private stuff to override global stuff |
|
306 |
" |
|
1 | 307 |
SystemPath := OrderedCollection new. |
308 |
SystemPath add:'.'. |
|
309 |
SystemPath add:'..'. |
|
70 | 310 |
SystemPath add:homePath. |
311 |
(OperatingSystem isDirectory:(p := homePath , '/.smalltalk')) ifTrue:[ |
|
159 | 312 |
SystemPath add:p |
1 | 313 |
]. |
314 |
p := OperatingSystem getEnvironment:'SMALLTALK_LIBDIR'. |
|
315 |
p notNil ifTrue:[ |
|
159 | 316 |
SystemPath add:p |
1 | 317 |
]. |
509
8f4649450d6e
alternative to SMALLTALK_LIBDIR -> STX_LIBDIR
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
318 |
p := OperatingSystem getEnvironment:'STX_LIBDIR'. |
8f4649450d6e
alternative to SMALLTALK_LIBDIR -> STX_LIBDIR
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
319 |
p notNil ifTrue:[ |
8f4649450d6e
alternative to SMALLTALK_LIBDIR -> STX_LIBDIR
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
320 |
SystemPath add:p |
8f4649450d6e
alternative to SMALLTALK_LIBDIR -> STX_LIBDIR
Claus Gittinger <cg@exept.de>
parents:
501
diff
changeset
|
321 |
]. |
1 | 322 |
(OperatingSystem isDirectory:'/usr/local/lib/smalltalk') ifTrue:[ |
159 | 323 |
SystemPath add:'/usr/local/lib/smalltalk' |
1 | 324 |
]. |
325 |
(OperatingSystem isDirectory:'/usr/lib/smalltalk') ifTrue:[ |
|
159 | 326 |
SystemPath add:'/usr/lib/smalltalk' |
1 | 327 |
]. |
329 | 328 |
self flushPathCaches |
1 | 329 |
|
95 | 330 |
" |
331 |
Smalltalk initSystemPath |
|
332 |
Smalltalk systemPath |
|
333 |
" |
|
162 | 334 |
! |
335 |
||
336 |
isInitialized |
|
337 |
"this returns true, if the system is properly initialized; |
|
338 |
i.e. false during startup. Especially, the whole viewing stuff is |
|
339 |
not working correctly until initialized." |
|
340 |
||
341 |
^ Initializing not |
|
161 | 342 |
! ! |
343 |
||
453 | 344 |
!Smalltalk class methodsFor:'accessing'! |
345 |
||
346 |
at:aKey |
|
347 |
"retrieve the value stored under aKey, a symbol. |
|
348 |
Return nil if not present (this will be changed to trigger an error)" |
|
349 |
||
350 |
%{ /* NOCONTEXT */ |
|
351 |
extern OBJ __GLOBAL_GET(); |
|
352 |
||
353 |
RETURN ( __GLOBAL_GET(aKey) ); |
|
354 |
%} |
|
355 |
! |
|
356 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
357 |
includesKey:aKey |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
358 |
"return true, if the key is known" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
359 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
360 |
%{ /* NOCONTEXT */ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
361 |
extern OBJ __GLOBAL_KEYKNOWN(); |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
362 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
363 |
RETURN ( __GLOBAL_KEYKNOWN(aKey) ); |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
364 |
%} |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
365 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
366 |
|
453 | 367 |
at:aKey ifAbsent:aBlock |
368 |
"retrieve the value stored at aKey. |
|
369 |
If there is nothing stored under this key, return the value of |
|
370 |
the evaluation of aBlock." |
|
371 |
||
372 |
(self includesKey:aKey) ifTrue:[ |
|
373 |
^ self at:aKey |
|
374 |
]. |
|
375 |
^ aBlock value |
|
376 |
||
377 |
" |
|
378 |
Smalltalk at:#fooBar <- returns nil |
|
379 |
Smalltalk at:#fooBar ifAbsent:['sorry'] <- no error |
|
380 |
" |
|
381 |
! |
|
382 |
||
383 |
at:aKey put:aValue |
|
384 |
"store the argument aValue under aKey, a symbol" |
|
385 |
||
386 |
" |
|
387 |
|oldValue| |
|
388 |
||
389 |
%{ |
|
390 |
extern OBJ __GLOBAL_SET(); |
|
391 |
||
392 |
oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
393 |
%}. |
|
394 |
CachedClasses notNil ifTrue:[ |
|
395 |
oldValue isBehavior ifTrue:[ |
|
396 |
CachedClasses remove:oldValue |
|
397 |
]. |
|
398 |
aValue isBehavior ifTrue:[ |
|
399 |
CachedClasses add:aValue |
|
400 |
]. |
|
401 |
]. |
|
402 |
^ aValue |
|
403 |
" |
|
404 |
%{ /* NOCONTEXT */ |
|
405 |
extern OBJ __GLOBAL_SET(); |
|
406 |
||
407 |
(void) __GLOBAL_SET(aKey, aValue, (OBJ *)0); |
|
408 |
%}. |
|
409 |
CachedClasses := nil. |
|
410 |
^ aValue |
|
411 |
! |
|
412 |
||
413 |
removeKey:aKey |
|
414 |
"remove the argument from the globals dictionary" |
|
415 |
||
416 |
CachedClasses := nil. |
|
417 |
||
418 |
%{ /* NOCONTEXT */ |
|
419 |
extern OBJ __GLOBAL_REMOVE(); |
|
420 |
||
421 |
RETURN ( __GLOBAL_REMOVE(aKey) ); |
|
422 |
%} |
|
423 |
! |
|
424 |
||
425 |
keyAtValue:anObject |
|
426 |
"return the symbol under which anObject is stored - or nil" |
|
427 |
||
428 |
self keysDo:[:aKey | |
|
429 |
(self at:aKey) == anObject ifTrue:[^ aKey] |
|
430 |
]. |
|
431 |
^ nil |
|
432 |
||
433 |
"Smalltalk keyAtValue:Object" |
|
434 |
! |
|
435 |
||
436 |
keys |
|
437 |
"return a collection with all keys in the Smalltalk dictionary" |
|
438 |
||
439 |
|keys| |
|
440 |
||
441 |
keys := IdentitySet new. |
|
442 |
self keysDo:[:k | keys add:k]. |
|
443 |
^ keys |
|
444 |
! ! |
|
445 |
||
446 |
!Smalltalk class methodsFor:'binary storage'! |
|
447 |
||
448 |
addGlobalsTo: globalDictionary manager: manager |
|
449 |
|pools| |
|
450 |
||
451 |
pools := Set new. |
|
452 |
self associationsDo:[:assoc | |
|
453 |
assoc value == self ifFalse:[ |
|
454 |
assoc value isClass ifTrue:[ |
|
455 |
assoc value addGlobalsTo:globalDictionary manager:manager. |
|
456 |
pools addAll:assoc value sharedPools |
|
457 |
] ifFalse:[ |
|
458 |
globalDictionary at:assoc put:self |
|
459 |
]. |
|
460 |
assoc value isNil ifFalse:[ |
|
461 |
globalDictionary at:assoc value put:self |
|
462 |
] |
|
463 |
] |
|
464 |
]. |
|
465 |
||
466 |
pools do:[:poolDictionary| |
|
467 |
poolDictionary addGlobalsTo:globalDictionary manager:manager |
|
468 |
] |
|
469 |
! |
|
470 |
||
471 |
storeBinaryDefinitionOf: anObject on: stream manager: manager |
|
472 |
|string| |
|
473 |
||
474 |
anObject class == Association ifTrue:[ |
|
475 |
string := 'Smalltalk associationAt: ', anObject key storeString |
|
476 |
] ifFalse: [ |
|
477 |
string := 'Smalltalk at: ', (self keyAtValue: anObject) storeString |
|
478 |
]. |
|
479 |
stream nextNumber:2 put:string size. |
|
480 |
string do:[:char | stream nextPut:char asciiValue] |
|
481 |
! ! |
|
482 |
||
483 |
!Smalltalk class methodsFor:'browsing'! |
|
484 |
||
485 |
browseChanges |
|
486 |
"startup a changes browser" |
|
487 |
||
488 |
ChangesBrowser notNil ifTrue:[ |
|
489 |
ChangesBrowser open |
|
490 |
] ifFalse:[ |
|
491 |
self warn:'no ChangesBrowser built in' |
|
492 |
] |
|
493 |
||
494 |
" |
|
495 |
Smalltalk browseChanges |
|
496 |
" |
|
497 |
! |
|
498 |
||
499 |
browseAllSelect:aBlock |
|
500 |
"startup a browser for all methods for which aBlock returns true" |
|
501 |
||
502 |
SystemBrowser browseAllSelect:aBlock |
|
503 |
||
504 |
" |
|
505 |
Smalltalk browseAllSelect:[:m | m literals isNil] |
|
506 |
" |
|
507 |
! |
|
508 |
||
509 |
browseImplementorsOf:aSelectorSymbol |
|
510 |
"startup a browser for all methods implementing a particular message" |
|
511 |
||
512 |
SystemBrowser browseImplementorsOf:aSelectorSymbol |
|
513 |
||
514 |
" |
|
515 |
Smalltalk browseImplementorsOf:#at:put: |
|
516 |
" |
|
517 |
! |
|
518 |
||
519 |
browseAllCallsOn:aSelectorSymbol |
|
520 |
"startup a browser for all methods sending a particular message" |
|
521 |
||
522 |
SystemBrowser browseAllCallsOn:aSelectorSymbol |
|
523 |
||
524 |
" |
|
525 |
Smalltalk browseAllCallsOn:#at:put: |
|
526 |
" |
|
527 |
! ! |
|
528 |
||
529 |
!Smalltalk class methodsFor:'class management'! |
|
530 |
||
531 |
flushCachedClasses |
|
532 |
CachedClasses := nil |
|
533 |
! |
|
534 |
||
535 |
renameClass:aClass to:newName |
|
536 |
"rename aClass to newName" |
|
537 |
||
538 |
|oldName oldSym newSym names cSym value| |
|
539 |
||
540 |
oldName := aClass name. |
|
541 |
oldSym := oldName asSymbol. |
|
542 |
||
543 |
((self at:oldSym) == aClass) ifFalse:[^ self]. |
|
544 |
||
545 |
"rename the class" |
|
546 |
||
547 |
aClass setName:newName. |
|
548 |
||
549 |
"and its meta" |
|
550 |
||
551 |
aClass class setName:(newName , 'class'). |
|
552 |
||
553 |
"store it in Smalltalk" |
|
554 |
||
555 |
newSym := newName asSymbol. |
|
556 |
self at:oldSym put:nil. |
|
557 |
self removeKey:oldSym. |
|
558 |
self at:newSym put:aClass. |
|
559 |
||
560 |
"rename class variables" |
|
561 |
||
562 |
names := aClass classVariableString asCollectionOfWords. |
|
563 |
names do:[:name | |
|
564 |
cSym := (oldSym , ':' , name) asSymbol. |
|
565 |
value := self at:cSym. |
|
566 |
self at:cSym put:nil. |
|
567 |
self removeKey:cSym. |
|
568 |
cSym := (newSym , ':' , name) asSymbol. |
|
569 |
self at:cSym put:value. |
|
570 |
]. |
|
571 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
572 |
aClass updateVersionString. |
453 | 573 |
aClass addChangeRecordForClassRename:oldName to:newName |
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
574 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
575 |
"Created: 29.10.1995 / 19:58:32 / cg" |
453 | 576 |
! |
577 |
||
578 |
removeClass:aClass |
|
579 |
"remove the argument, aClass from the smalltalk dictionary; |
|
580 |
we have to flush the caches since these methods are now void. |
|
581 |
Also, class variables of aClass are removed." |
|
582 |
||
583 |
|sym cSym names oldName| |
|
584 |
||
585 |
oldName := aClass name. |
|
586 |
sym := oldName asSymbol. |
|
587 |
((self at:sym) == aClass) ifFalse:[ |
|
588 |
"check other name ..." |
|
589 |
(self includes:aClass) ifFalse:[ |
|
590 |
'SMALLTALK: no such class: ' errorPrint. oldName errorPrintNL. |
|
591 |
^ self |
|
592 |
]. |
|
593 |
" |
|
594 |
the class has changed its name - without telling me ... |
|
595 |
what should be done in this case ? |
|
596 |
" |
|
597 |
'SMALLTALK: class ' errorPrint. oldName errorPrint. |
|
598 |
' has changed its name' errorPrintNL. |
|
599 |
^ self |
|
600 |
]. |
|
601 |
||
602 |
self at:sym put:nil. "nil it out for compiled accesses" |
|
603 |
self removeKey:sym. "remove key - this actually fails, if there are |
|
604 |
still compiled code references." |
|
605 |
||
606 |
"remove class variables" |
|
607 |
||
608 |
names := aClass classVariableString asCollectionOfWords. |
|
609 |
names do:[:name | |
|
610 |
cSym := (sym , ':' , name) asSymbol. |
|
611 |
self at:cSym asSymbol put:nil. |
|
612 |
self removeKey:cSym |
|
613 |
]. |
|
614 |
" |
|
615 |
actually could get along with less flushing |
|
616 |
(entries for aClass and subclasses only) |
|
617 |
but we have to delay this, until we have the set of subclasses |
|
618 |
at hand - for now, searching for all subclasses is way more |
|
619 |
expensive then cache flushing. |
|
620 |
||
621 |
aClass allSubclassesDo:[:aSubclass | |
|
622 |
ObjectMemory flushInlineCachesForClass:aSubclass. |
|
623 |
ObjectMemory flushMethodCacheFor:aSubclass |
|
624 |
]. |
|
625 |
ObjectMemory flushInlineCachesForClass:aClass. |
|
626 |
ObjectMemory flushMethodCacheFor:aClass |
|
627 |
" |
|
628 |
ObjectMemory flushInlineCaches. |
|
629 |
ObjectMemory flushMethodCache. |
|
630 |
||
631 |
aClass addChangeRecordForClassRemove:oldName. |
|
632 |
self changed:#classRemove with:aClass. |
|
633 |
||
634 |
aClass category:#removed. |
|
635 |
! ! |
|
636 |
||
637 |
!Smalltalk class methodsFor:'copying'! |
|
638 |
||
639 |
shallowCopy |
|
640 |
"redefine copy - there is only one Smalltalk dictionary" |
|
641 |
||
642 |
^ self |
|
643 |
! |
|
644 |
||
645 |
simpleDeepCopy |
|
646 |
"redefine copy - there is only one Smalltalk dictionary" |
|
647 |
||
648 |
^ self |
|
649 |
! |
|
650 |
||
651 |
deepCopyUsing:aDictionary |
|
652 |
"redefine copy - there is only one Smalltalk dictionary" |
|
653 |
||
654 |
^ self |
|
655 |
! |
|
656 |
||
657 |
deepCopy |
|
658 |
"redefine copy - there is only one Smalltalk dictionary" |
|
659 |
||
660 |
^ self |
|
661 |
! ! |
|
662 |
||
663 |
!Smalltalk class methodsFor:'debugging ST/X'! |
|
664 |
||
665 |
debugBreakPoint |
|
666 |
"call the dummy debug function, on which a breakpoint |
|
667 |
can be put in adb, sdb, dbx or gdb. |
|
668 |
WARNING: this method is for debugging only |
|
669 |
it will be removed without notice." |
|
670 |
%{ |
|
671 |
_PATCHUPCONTEXTS(__context); |
|
672 |
debugBreakPoint(); |
|
673 |
%} |
|
674 |
! |
|
675 |
||
676 |
printPolyCaches |
|
677 |
"dump poly caches. |
|
678 |
WARNING: this method is for debugging only |
|
679 |
it will be removed without notice" |
|
680 |
%{ |
|
681 |
__dumpILCCaches(); |
|
682 |
%} |
|
683 |
! |
|
684 |
||
685 |
printStackBacktrace |
|
686 |
"print a stack backtrace - then continue. |
|
687 |
(You may turn off the stack print with debugPrinting:false) |
|
688 |
WARNING: this method is for debugging only |
|
689 |
it will be removed without notice" |
|
690 |
||
691 |
%{ |
|
692 |
__printStack(__context); |
|
693 |
%} |
|
694 |
"Smalltalk printStackBacktrace" |
|
695 |
! |
|
696 |
||
697 |
printSymbols |
|
698 |
"dump the internal symbol table. |
|
699 |
WARNING: this method is for debugging only |
|
700 |
it will be removed without notice" |
|
701 |
%{ |
|
702 |
__dumpSymbols(); |
|
703 |
%} |
|
704 |
! |
|
705 |
||
706 |
fatalAbort:aMessage |
|
707 |
"report a fatal-error; print a stack backtrace and exit with core dump |
|
708 |
(You may turn off the stack print with debugPrinting:false)" |
|
709 |
||
710 |
%{ |
|
711 |
char *msg; |
|
712 |
||
713 |
if (__isString(aMessage)) |
|
714 |
msg = (char *) _stringVal(aMessage); |
|
715 |
else |
|
716 |
msg = "fatalAbort"; |
|
717 |
||
718 |
__fatal0(__context, msg); |
|
719 |
/* NEVER RETURNS */ |
|
720 |
%} |
|
721 |
! |
|
722 |
||
723 |
fatalAbort |
|
724 |
"report a fatal-error, print a stack backtrace and exit with core dump. |
|
725 |
(You may turn off the stack print with debugPrinting:false)" |
|
726 |
%{ |
|
727 |
__fatal0(__context, "fatalAbort"); |
|
728 |
/* NEVER RETURNS */ |
|
729 |
%} |
|
730 |
! |
|
731 |
||
732 |
exitWithCoreDump |
|
733 |
"abort program and dump core" |
|
734 |
||
735 |
%{ /* NOCONTEXT */ |
|
736 |
abort(); |
|
737 |
/* NEVER RETURNS */ |
|
738 |
%} |
|
739 |
! |
|
740 |
||
741 |
statistic |
|
742 |
"print some statistic data. |
|
743 |
WARNING: this method is for debugging only |
|
744 |
it may be removed without notice" |
|
745 |
||
746 |
%{ /* NOCONTEXT */ |
|
747 |
__STATISTIC__(); |
|
748 |
%} |
|
749 |
! |
|
750 |
||
751 |
debugOn |
|
752 |
"turns some tracing on. |
|
753 |
WARNING: this method is for debugging only |
|
754 |
it may be removed without notice" |
|
755 |
||
756 |
"LookupTrace := true. " |
|
757 |
"AllocTrace := true. " |
|
758 |
ObjectMemory flushCaches |
|
759 |
! |
|
760 |
||
761 |
debugOff |
|
762 |
"turns tracing off. |
|
763 |
WARNING: this method is for debugging only |
|
764 |
it may be removed without notice" |
|
765 |
||
766 |
LookupTrace := nil. |
|
767 |
". AllocTrace := nil " |
|
768 |
! |
|
769 |
||
770 |
executionDebugOn |
|
771 |
"turns tracing of interpreter on. |
|
772 |
WARNING: this method is for debugging only |
|
773 |
it may be removed without notice" |
|
774 |
||
775 |
ExecutionTrace := true |
|
776 |
! |
|
777 |
||
778 |
executionDebugOff |
|
779 |
"turns tracing of interpreter off. |
|
780 |
WARNING: this method is for debugging only |
|
781 |
it may be removed without notice" |
|
782 |
||
783 |
ExecutionTrace := nil |
|
784 |
! ! |
|
785 |
||
786 |
!Smalltalk class methodsFor:'enumerating'! |
|
787 |
||
788 |
do:aBlock |
|
789 |
"evaluate the argument, aBlock for all values in the Smalltalk dictionary" |
|
790 |
||
791 |
|work| |
|
792 |
||
793 |
%{ /* NOREGISTER - work may not be placed into a register here */ |
|
794 |
__GLOBALS_DO(&aBlock, &work COMMA_CON); |
|
795 |
%} |
|
796 |
! |
|
797 |
||
798 |
allBehaviorsDo:aBlock |
|
799 |
"evaluate the argument, aBlock for all classes in the system" |
|
800 |
||
801 |
CachedClasses isNil ifTrue:[ |
|
802 |
self allClasses |
|
803 |
]. |
|
804 |
CachedClasses do:aBlock |
|
805 |
||
806 |
" |
|
807 |
Smalltalk allBehaviorsDo:[:aClass | aClass name printNL] |
|
808 |
" |
|
809 |
! |
|
810 |
||
811 |
keysDo:aBlock |
|
812 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
813 |
|work| |
|
814 |
||
815 |
%{ /* NOREGISTER - work may not be placed into a register here */ |
|
816 |
__GLOBALKEYS_DO(&aBlock, &work COMMA_CON); |
|
817 |
%} |
|
818 |
! |
|
819 |
||
820 |
allKeysDo:aBlock |
|
821 |
"evaluate the argument, aBlock for all keys in the Smalltalk dictionary" |
|
822 |
||
823 |
^ self keysDo:aBlock |
|
824 |
! |
|
825 |
||
826 |
associationsDo:aBlock |
|
827 |
"evaluate the argument, aBlock for all key/value pairs |
|
828 |
in the Smalltalk dictionary" |
|
829 |
||
830 |
self keysDo:[:aKey | |
|
831 |
aBlock value:(aKey -> (self at:aKey)) |
|
832 |
] |
|
833 |
||
834 |
"Smalltalk associationsDo:[:assoc | assoc printNL]" |
|
835 |
! |
|
836 |
||
837 |
keysAndValuesDo:aBlock |
|
838 |
"evaluate the two-arg block, aBlock for all keys and values" |
|
839 |
||
840 |
self keysDo:[:aKey | |
|
841 |
aBlock value:aKey value:(self at:aKey) |
|
842 |
] |
|
843 |
! |
|
844 |
||
845 |
allClassesDo:aBlock |
|
846 |
"evaluate the argument, aBlock for all classes in the system. |
|
847 |
Backward compatibility - use #allBehaviorsDo: for ST-80 compatibility." |
|
848 |
||
849 |
^ self allBehaviorsDo:aBlock |
|
850 |
||
851 |
" |
|
852 |
Smalltalk allClassesDo:[:aClass | aClass name printNL] |
|
853 |
" |
|
854 |
! |
|
855 |
||
856 |
allClassesInCategory:aCategory do:aBlock |
|
857 |
"evaluate the argument, aBlock for all classes in the aCategory; |
|
858 |
The order of the classes is not defined." |
|
859 |
||
860 |
aCategory notNil ifTrue:[ |
|
861 |
self allBehaviorsDo:[:aClass | |
|
862 |
aClass isMeta ifFalse:[ |
|
863 |
(aClass category = aCategory) ifTrue:[ |
|
864 |
aBlock value:aClass |
|
865 |
] |
|
866 |
] |
|
867 |
] |
|
868 |
] |
|
869 |
||
870 |
" |
|
871 |
Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | aClass name printNL] |
|
872 |
" |
|
873 |
! |
|
874 |
||
875 |
allClassesInCategory:aCategory inOrderDo:aBlock |
|
876 |
"evaluate the argument, aBlock for all classes in aCategory; |
|
877 |
superclasses come first - then subclasses" |
|
878 |
||
879 |
|classes| |
|
880 |
||
881 |
aCategory notNil ifTrue:[ |
|
882 |
classes := OrderedCollection new. |
|
883 |
self allBehaviorsDo:[:aClass | |
|
884 |
aClass isMeta ifFalse:[ |
|
885 |
(aClass category = aCategory) ifTrue:[ |
|
886 |
classes add:aClass |
|
887 |
] |
|
888 |
] |
|
889 |
]. |
|
890 |
classes topologicalSort:[:a :b | b isSubclassOf:a]. |
|
891 |
classes do:aBlock |
|
892 |
] |
|
893 |
||
894 |
" |
|
895 |
Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printNL] |
|
896 |
" |
|
897 |
! ! |
|
898 |
||
899 |
!Smalltalk class methodsFor:'inspecting'! |
|
900 |
||
901 |
inspectorClass |
|
902 |
"redefined to launch a DictionaryInspector |
|
903 |
(instead of the default Inspector)." |
|
904 |
||
905 |
^ DictionaryInspectorView |
|
906 |
! ! |
|
907 |
||
908 |
!Smalltalk class methodsFor:'message control'! |
|
909 |
||
910 |
silentLoading |
|
911 |
"returns the Silentloading class variable." |
|
912 |
||
913 |
^ SilentLoading |
|
914 |
! |
|
915 |
||
916 |
silentLoading:aBoolean |
|
917 |
"allows access to the Silentloading class variable, which controls |
|
918 |
messages from all kinds of system onto the transcript. |
|
919 |
You can save a snapshot with this flag set to true, which makes |
|
920 |
the image come up silent. Can also be set, to read in files unlogged." |
|
921 |
||
922 |
|prev| |
|
923 |
||
924 |
prev := SilentLoading. |
|
925 |
SilentLoading := aBoolean. |
|
926 |
^ prev |
|
927 |
! ! |
|
928 |
||
929 |
!Smalltalk class methodsFor:'misc stuff'! |
|
930 |
||
931 |
exit |
|
932 |
"finish Smalltalk system" |
|
933 |
||
934 |
ObjectMemory changed:#aboutToQuit. "/ for ST-80 compatibility |
|
935 |
ExitBlocks notNil ifTrue:[ |
|
936 |
ExitBlocks do:[:aBlock | |
|
937 |
aBlock value |
|
938 |
] |
|
939 |
]. |
|
940 |
OperatingSystem exit |
|
941 |
||
942 |
" |
|
943 |
Smalltalk exit |
|
944 |
" |
|
945 |
! |
|
946 |
||
947 |
addExitBlock:aBlock |
|
948 |
"add a block to be executed when Smalltalk finishes. |
|
949 |
This feature is currently not used anywhere - but could be useful for |
|
950 |
cleanup in stand alone applications." |
|
951 |
||
952 |
ExitBlocks isNil ifTrue:[ |
|
953 |
ExitBlocks := OrderedCollection with:aBlock |
|
954 |
] ifFalse:[ |
|
955 |
ExitBlocks add:aBlock |
|
956 |
] |
|
957 |
! |
|
958 |
||
959 |
sleep:aDelay |
|
960 |
"wait for aDelay seconds. |
|
961 |
OBSOLETE: this is historical leftover and will be removed" |
|
962 |
||
963 |
OperatingSystem sleep:aDelay |
|
964 |
! ! |
|
965 |
||
966 |
!Smalltalk class methodsFor:'queries'! |
|
967 |
||
968 |
allClasses |
|
969 |
"return an unordered collection of all classes in the system. |
|
970 |
Only globally anchored classes are returned |
|
971 |
(i.e. anonymous ones have to be aquired by Behavior allSubInstances)" |
|
972 |
||
973 |
|classes| |
|
974 |
||
975 |
"/ you may wander, what this while is for, here ... |
|
976 |
"/ the reason is that if we modify the class hierarchy in |
|
977 |
"/ anothe view (background fileIn), while building up the |
|
978 |
"/ cachedClasses set, this may be flushed (invalidated) by the |
|
979 |
"/ other process in the meanwhile. |
|
980 |
"/ If that happens, we restart the set-building here |
|
981 |
"/ |
|
982 |
[(classes := CachedClasses) isNil] whileTrue:[ |
|
983 |
CachedClasses := classes := IdentitySet new:800. |
|
984 |
self do:[:anObject | |
|
985 |
anObject notNil ifTrue:[ |
|
986 |
anObject isBehavior ifTrue:[ |
|
987 |
classes add:anObject |
|
988 |
] |
|
989 |
] |
|
990 |
] |
|
991 |
]. |
|
992 |
^ classes |
|
993 |
||
994 |
" |
|
995 |
Smalltalk allClasses |
|
996 |
" |
|
997 |
! |
|
998 |
||
999 |
classNamed:aString |
|
1000 |
"return the class with name aString, or nil if absent. |
|
1001 |
To get to the metaClass, append 'class' to the string." |
|
1002 |
||
1003 |
|cls str sym| |
|
1004 |
||
1005 |
"be careful, to not invent new symbols ..." |
|
1006 |
sym := aString asSymbolIfInterned. |
|
1007 |
sym notNil ifTrue:[ |
|
1008 |
cls := self at:sym ifAbsent:[]. |
|
1009 |
cls isNil ifTrue:[^ nil]. |
|
1010 |
cls isBehavior ifTrue:[^ cls] |
|
1011 |
]. |
|
1012 |
(aString endsWith:'class') ifTrue:[ |
|
1013 |
str := aString copyTo:(aString size - 5). |
|
1014 |
sym := str asSymbolIfInterned. |
|
1015 |
sym notNil ifTrue:[ |
|
1016 |
cls := self at:sym ifAbsent:[]. |
|
1017 |
cls isNil ifTrue:[^ nil]. |
|
1018 |
cls isBehavior ifTrue:[^ cls] |
|
1019 |
] |
|
1020 |
]. |
|
1021 |
^ nil |
|
1022 |
||
1023 |
" |
|
1024 |
Smalltalk classNamed:'Object' |
|
1025 |
Smalltalk classNamed:'fooBar' |
|
1026 |
Smalltalk classNamed:'true' |
|
1027 |
Smalltalk classNamed:'Objectclass' |
|
1028 |
Smalltalk classNamed:'Metaclass' |
|
1029 |
" |
|
1030 |
! |
|
1031 |
||
1032 |
numberOfGlobals |
|
1033 |
"return the number of global variables in the system" |
|
1034 |
||
1035 |
|tally "{ Class: SmallInteger }" | |
|
1036 |
||
1037 |
tally := 0. |
|
1038 |
self do:[:obj | tally := tally + 1]. |
|
1039 |
^ tally |
|
1040 |
||
1041 |
"Smalltalk numberOfGlobals" |
|
1042 |
! |
|
1043 |
||
1044 |
cellAt:aName |
|
1045 |
"return the address of a global cell |
|
1046 |
- used internally for compiler only" |
|
1047 |
||
1048 |
%{ /* NOCONTEXT */ |
|
1049 |
extern OBJ __GLOBAL_GETCELL(); |
|
1050 |
||
1051 |
RETURN ( __GLOBAL_GETCELL(aName) ); |
|
1052 |
%} |
|
1053 |
! |
|
1054 |
||
1055 |
classNames |
|
1056 |
"return a collection of all classNames in the system" |
|
1057 |
||
1058 |
^ self allClasses collect:[:aClass | aClass name] |
|
1059 |
||
1060 |
"Smalltalk classNames" |
|
1061 |
! |
|
1062 |
||
1063 |
classnameCompletion:aPartialClassName |
|
1064 |
"given a partial classname, return an array consisting of |
|
1065 |
2 entries: 1st: collection consisting of matching names |
|
1066 |
2nd: the longest match" |
|
1067 |
||
1068 |
|matches best| |
|
1069 |
||
1070 |
matches := SortedCollection new. |
|
1071 |
self allClassesDo:[:aClass | |
|
1072 |
aClass isMeta ifFalse:[ |
|
1073 |
(aClass name startsWith:aPartialClassName) ifTrue:[ |
|
1074 |
matches add:aClass name |
|
1075 |
] |
|
1076 |
] |
|
1077 |
]. |
|
1078 |
matches isEmpty ifTrue:[ |
|
1079 |
^ Array with:aPartialClassName with:(Array with:aPartialClassName) |
|
1080 |
]. |
|
1081 |
matches size == 1 ifTrue:[ |
|
1082 |
^ Array with:matches first with:(matches asArray) |
|
1083 |
]. |
|
1084 |
best := matches longestCommonPrefix. |
|
1085 |
^ Array with:best with:matches asArray |
|
1086 |
||
1087 |
" |
|
1088 |
Smalltalk classnameCompletion:'Arr' |
|
1089 |
Smalltalk classnameCompletion:'Arra' |
|
1090 |
" |
|
1091 |
! |
|
1092 |
||
1093 |
selectorCompletion:aPartialSymbolName |
|
1094 |
"given a partial selector, return an array consisting of |
|
1095 |
2 entries: 1st: collection consisting of matching implemented selectors |
|
1096 |
2nd: the longest match" |
|
1097 |
||
1098 |
|matches best| |
|
1099 |
||
1100 |
matches := IdentitySet new. |
|
1101 |
self allClassesDo:[:aClass | |
|
1102 |
aClass selectorArray do:[:aSelector | |
|
1103 |
(aSelector startsWith:aPartialSymbolName) ifTrue:[ |
|
1104 |
matches add:aSelector |
|
1105 |
] |
|
1106 |
]. |
|
1107 |
aClass class selectorArray do:[:aSelector | |
|
1108 |
(aSelector startsWith:aPartialSymbolName) ifTrue:[ |
|
1109 |
matches add:aSelector |
|
1110 |
] |
|
1111 |
] |
|
1112 |
]. |
|
1113 |
matches := matches asSortedCollection. |
|
1114 |
matches isEmpty ifTrue:[ |
|
1115 |
^ Array with:aPartialSymbolName with:(Array with:aPartialSymbolName) |
|
1116 |
]. |
|
1117 |
matches size == 1 ifTrue:[ |
|
1118 |
^ Array with:matches first with:(matches asArray) |
|
1119 |
]. |
|
1120 |
best := matches longestCommonPrefix. |
|
1121 |
^ Array with:best with:matches asArray |
|
1122 |
||
1123 |
" |
|
1124 |
Smalltalk selectorCompletion:'at:p' |
|
1125 |
Smalltalk selectorCompletion:'nextP' |
|
1126 |
" |
|
1127 |
! |
|
1128 |
||
1129 |
includes:something |
|
1130 |
"this should come from Collection. |
|
1131 |
will change the inheritance - Smalltalk is actually a collection" |
|
1132 |
||
1133 |
self do:[:element | element = something ifTrue:[^ true]]. |
|
1134 |
^ false |
|
1135 |
! |
|
1136 |
||
1137 |
references:anObject |
|
1138 |
"redefined, since the references are only kept in the VM's symbol table" |
|
1139 |
||
1140 |
self keysAndValuesDo:[:key :val | |
|
1141 |
(key == anObject) ifTrue:[^ true]. |
|
1142 |
(val == anObject ) ifTrue:[^ true]. |
|
1143 |
]. |
|
1144 |
^ super references:anObject |
|
1145 |
! |
|
1146 |
||
1147 |
referencesDerivedInstanceOf:aClass |
|
1148 |
"redefined, since the references are only kept in the VM's symbol table" |
|
1149 |
||
1150 |
self keysAndValuesDo:[:key :val | |
|
1151 |
(key isKindOf:aClass) ifTrue:[^ true]. |
|
1152 |
(val isKindOf:aClass) ifTrue:[^ true]. |
|
1153 |
]. |
|
1154 |
^ super referencesDerivedInstanceOf:aClass |
|
1155 |
! |
|
1156 |
||
1157 |
referencesInstanceOf:aClass |
|
1158 |
"redefined, since the references are only kept in the VM's symbol table" |
|
1159 |
||
1160 |
self keysAndValuesDo:[:key :val | |
|
1161 |
(key isMemberOf:aClass) ifTrue:[^ true]. |
|
1162 |
(val isMemberOf:aClass) ifTrue:[^ true]. |
|
1163 |
]. |
|
1164 |
^ super referencesInstanceOf:aClass |
|
1165 |
! ! |
|
1166 |
||
161 | 1167 |
!Smalltalk class methodsFor:'startup'! |
1 | 1168 |
|
1169 |
start |
|
1170 |
"main startup, if there is a Display, initialize it |
|
443 | 1171 |
and start dispatching; otherwise go into a read-eval-print loop." |
1172 |
||
1173 |
|idx haveStartupFile| |
|
1174 |
||
1175 |
haveStartupFile := true. |
|
1 | 1176 |
Initializing := true. |
1177 |
||
70 | 1178 |
" |
1179 |
while reading patches- and rc-file, do not add things into change-file |
|
1180 |
" |
|
421 | 1181 |
Class withoutUpdatingChangesDo:[ |
423 | 1182 |
" |
1183 |
look for a '-e filename' argument - this will force evaluation of |
|
1184 |
filename only, no standard startup |
|
1185 |
" |
|
1186 |
idx := Arguments indexOf:'-e'. |
|
1187 |
idx ~~ 0 ifTrue:[ |
|
421 | 1188 |
self fileIn:(Arguments at:idx + 1). |
1189 |
self exit |
|
423 | 1190 |
]. |
1191 |
||
1192 |
self secureFileIn:'patches'. |
|
1193 |
||
1194 |
(self secureFileIn:((Arguments at:1) , '.rc')) ifFalse:[ |
|
421 | 1195 |
"no .rc file where executable is; try default smalltalk.rc" |
1196 |
(self secureFileIn:'smalltalk.rc') ifFalse:[ |
|
443 | 1197 |
Transcript showCr:'SMALLTALK: no startup rc-file found. Going into line-by-line interpreter.'. |
1198 |
haveStartupFile := false. |
|
421 | 1199 |
] |
423 | 1200 |
]. |
7 | 1201 |
]. |
1202 |
||
70 | 1203 |
(SilentLoading == true) ifFalse:[ "i.e. undefined counts as false" |
159 | 1204 |
Transcript showCr:(self hello). |
1205 |
Transcript showCr:(self copyrightString). |
|
1206 |
Transcript cr. |
|
70 | 1207 |
|
159 | 1208 |
DemoMode ifTrue:[ |
1209 |
Transcript showCr:'*** Restricted use: ***'. |
|
1210 |
Transcript showCr:'*** This program may be used for education only. ***'. |
|
1211 |
Transcript showCr:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
1212 |
Transcript showCr:'*** for more details. ***'. |
|
1213 |
Transcript cr. |
|
1214 |
]. |
|
1 | 1215 |
]. |
1216 |
||
85 | 1217 |
" |
357 | 1218 |
enable the graphical debugger/inspector |
1219 |
(they could have been (re)defined as autoloaded in the patches file) |
|
85 | 1220 |
" |
1221 |
self initStandardTools. |
|
1222 |
||
1223 |
" |
|
95 | 1224 |
if there is a display, start its event dispatcher |
85 | 1225 |
" |
8 | 1226 |
Display notNil ifTrue:[ |
159 | 1227 |
Display startDispatch. |
8 | 1228 |
]. |
24 | 1229 |
|
162 | 1230 |
Initializing := false. |
1231 |
||
24 | 1232 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
159 | 1233 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
24 | 1234 |
]. |
1235 |
||
95 | 1236 |
" |
1237 |
if view-classes exist, start dispatching; |
|
1238 |
otherwise go into a read-eval-print loop |
|
1239 |
" |
|
443 | 1240 |
(Display notNil and:[haveStartupFile]) ifTrue:[ |
159 | 1241 |
Processor dispatchLoop |
95 | 1242 |
] ifFalse:[ |
159 | 1243 |
self readEvalPrint |
95 | 1244 |
]. |
1 | 1245 |
|
1246 |
"done" |
|
1247 |
||
1248 |
self exit |
|
1249 |
! |
|
1250 |
||
453 | 1251 |
readEvalPrint |
1252 |
"simple read-eval-print loop for non-graphical Minitalk" |
|
1253 |
||
1254 |
|text| |
|
1255 |
||
1256 |
'ST- ' print. |
|
1257 |
Stdin skipSeparators. |
|
1258 |
Stdin atEnd ifFalse:[ |
|
1259 |
text := Stdin nextChunk. |
|
1260 |
[text notNil] whileTrue:[ |
|
1261 |
(Compiler evaluate:text) printNL. |
|
1262 |
'ST- ' print. |
|
1263 |
text := Stdin nextChunk |
|
1264 |
]. |
|
1265 |
]. |
|
1266 |
'' printNL |
|
1267 |
! |
|
1268 |
||
1 | 1269 |
restart |
24 | 1270 |
"startup after an image has been loaded; |
10 | 1271 |
there are three change-notifications made to dependents of ObjectMemory, |
1272 |
which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot. |
|
335 | 1273 |
|
10 | 1274 |
#earlyRestart is send first, nothing has been setup yet. |
159 | 1275 |
(should be used to flush all device dependent entries) |
335 | 1276 |
|
10 | 1277 |
#restarted is send right after. |
159 | 1278 |
(should be used to recreate external resources (fds, bitmaps etc) |
335 | 1279 |
|
10 | 1280 |
#returnFromSnapshot is sent last |
159 | 1281 |
(should be used to restart processes, reOpen Streams which cannot |
1282 |
be automatically be reopened (i.e. Sockets, Pipes) and so on. |
|
335 | 1283 |
(Notice that positionable fileStreams are already reopened and repositioned) |
1 | 1284 |
" |
10 | 1285 |
|
77 | 1286 |
|deb insp imageName| |
1 | 1287 |
|
1288 |
Initializing := true. |
|
335 | 1289 |
|
1290 |
" |
|
1291 |
flush cached path directories (may have changed in the meanwhile) |
|
1292 |
" |
|
329 | 1293 |
self flushPathCaches. |
1 | 1294 |
|
477
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
1295 |
" |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
1296 |
reinit the default streams: Stdin, Stdout and Stderr |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
1297 |
" |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
1298 |
self reinitStandardStreams. |
8710aba7876b
oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents:
457
diff
changeset
|
1299 |
|
95 | 1300 |
"temporary switch back to dumb interface - |
1301 |
to handle errors while view-stuff is not yet reinitialized" |
|
1 | 1302 |
|
1303 |
insp := Inspector. |
|
1304 |
deb := Debugger. |
|
1305 |
Inspector := MiniInspector. |
|
1306 |
Debugger := MiniDebugger. |
|
1307 |
||
335 | 1308 |
" |
1309 |
reinitialize the Processor |
|
1310 |
" |
|
1311 |
Processor reinitialize. |
|
1312 |
||
7 | 1313 |
ObjectMemory changed:#earlyRestart. |
1 | 1314 |
ObjectMemory changed:#restarted. |
1315 |
||
1316 |
" |
|
1317 |
some must be reinitialized before ... |
|
1318 |
- sorry, but order is important |
|
1319 |
" |
|
62 | 1320 |
Workstation notNil ifTrue:[ |
159 | 1321 |
Workstation reinitialize. |
62 | 1322 |
]. |
1 | 1323 |
|
1324 |
ObjectMemory changed:#returnFromSnapshot. |
|
1325 |
||
1326 |
OperatingSystem enableUserInterrupts. |
|
77 | 1327 |
OperatingSystem enableHardSignalInterrupts. |
1 | 1328 |
|
335 | 1329 |
"now, display and view-stuff works; |
1330 |
back to the previous debugging interface |
|
1331 |
" |
|
1 | 1332 |
Inspector := insp. |
1333 |
Debugger := deb. |
|
1334 |
||
1335 |
Initializing := false. |
|
1336 |
||
1337 |
" |
|
1338 |
if there is no Transcript, go to stderr |
|
1339 |
" |
|
1340 |
Transcript isNil ifTrue:[ |
|
159 | 1341 |
Transcript := Stderr |
1 | 1342 |
]. |
1343 |
||
70 | 1344 |
(SilentLoading == true) ifFalse:[ |
159 | 1345 |
Transcript cr. |
1346 |
Transcript showCr:('Smalltalk restarted from:' , ObjectMemory imageName). |
|
1347 |
Transcript cr. |
|
70 | 1348 |
|
159 | 1349 |
DemoMode ifTrue:[ |
1350 |
Transcript showCr:'*** Restricted use: ***'. |
|
1351 |
Transcript showCr:'*** This program may be used for education only. ***'. |
|
1352 |
Transcript showCr:'*** Please read the files COPYRIGHT and LICENSE ***'. |
|
1353 |
Transcript showCr:'*** for more details. ***'. |
|
1354 |
Transcript cr. |
|
1355 |
]. |
|
1 | 1356 |
]. |
1357 |
||
7 | 1358 |
" |
1359 |
give user a chance to re-customize things |
|
335 | 1360 |
reading if smalltalk_r.rc may be suppressed by the |
1361 |
-fastStart argument. |
|
7 | 1362 |
" |
95 | 1363 |
(Arguments includes:'-faststart') ifFalse:[ |
423 | 1364 |
Class withoutUpdatingChangesDo:[ |
421 | 1365 |
(self fileIn:((Arguments at:1) , '_r.rc')) ifFalse:[ |
423 | 1366 |
"no _r.rc file where executable is; try default smalltalk_r.rc" |
1367 |
self fileIn:'smalltalk_r.rc' |
|
421 | 1368 |
]. |
1369 |
] |
|
7 | 1370 |
]. |
1371 |
||
95 | 1372 |
" |
1373 |
if there is a display, start its event dispatcher |
|
1374 |
" |
|
10 | 1375 |
Display notNil ifTrue:[ |
159 | 1376 |
Display startDispatch. |
10 | 1377 |
]. |
1378 |
||
95 | 1379 |
" |
1380 |
this allows firing an application by defining |
|
1381 |
these two globals during snapshot ... or in main |
|
1382 |
" |
|
7 | 1383 |
(StartupClass notNil and:[StartupSelector notNil]) ifTrue:[ |
335 | 1384 |
" |
1385 |
allow more customization by reading an image specific rc-file |
|
1386 |
" |
|
159 | 1387 |
imageName := ObjectMemory imageName. |
1388 |
imageName notNil ifTrue:[ |
|
1389 |
(imageName endsWith:'.img') ifTrue:[ |
|
359 | 1390 |
imageName := imageName copyWithoutLast:4 |
1391 |
]. |
|
1392 |
self fileIn:(imageName , '.rc') |
|
159 | 1393 |
]. |
1394 |
StartupClass perform:StartupSelector withArguments:StartupArguments. |
|
1 | 1395 |
]. |
1396 |
||
95 | 1397 |
" |
1398 |
if view-classes exist, start dispatching; |
|
1399 |
otherwise go into a read-eval-print loop |
|
1400 |
" |
|
1 | 1401 |
Display notNil ifTrue:[ |
159 | 1402 |
Processor dispatchLoop |
1 | 1403 |
] ifFalse:[ |
159 | 1404 |
self readEvalPrint |
1 | 1405 |
]. |
95 | 1406 |
|
1407 |
self exit |
|
1 | 1408 |
! |
1409 |
||
70 | 1410 |
startupClass:aClass selector:aSymbol arguments:anArrayOrNil |
1411 |
"set the class, selector and arguments to be performed when smalltalk |
|
1412 |
starts. Setting those before saving a snapshot, will make the saved |
|
1413 |
image come up executing your application (instead of the normal mainloop)" |
|
1414 |
||
1415 |
StartupClass := aClass. |
|
1416 |
StartupSelector := aSymbol. |
|
1417 |
StartupArguments := anArrayOrNil |
|
1418 |
! |
|
1419 |
||
1420 |
startupClass |
|
1421 |
"return the class, that will get the start message when smalltalk |
|
1422 |
starts and its non-nil. Usually this is nil, but saving an image |
|
1423 |
with a non-nil StartupClass allows stand-alone applications" |
|
1424 |
||
1425 |
^ StartupClass |
|
1426 |
! |
|
1427 |
||
1428 |
startupSelector |
|
1429 |
"return the selector, that will be sent to StartupClass" |
|
1430 |
||
1431 |
^ StartupSelector |
|
1432 |
! |
|
1433 |
||
1434 |
startupArguments |
|
1435 |
"return the arguments passed to StartupClass" |
|
1436 |
||
1437 |
^ StartupArguments |
|
1438 |
! ! |
|
1439 |
||
1440 |
!Smalltalk class methodsFor:'system management'! |
|
1441 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1442 |
searchPath:aPath for:aFileName in:aDirName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1443 |
"search aPath for a subdirectory named aDirectory with a file |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1444 |
named aFileName" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1445 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1446 |
aPath do:[:dirName | |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1447 |
|realName| |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1448 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1449 |
(OperatingSystem isReadable:(realName := dirName , '/' , aDirName , '/' , aFileName)) ifTrue: [ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1450 |
^ realName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1451 |
] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1452 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1453 |
^ nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1454 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1455 |
|
88 | 1456 |
language |
1457 |
"return the language setting" |
|
1458 |
||
1459 |
^ Language |
|
1460 |
! |
|
1461 |
||
1462 |
languageTerritory |
|
1463 |
"return the language territory setting" |
|
1464 |
||
1465 |
^ LanguageTerritory |
|
1466 |
! |
|
1467 |
||
122 | 1468 |
logDoits |
1469 |
"return true if doits should go into the changes file |
|
1470 |
as well as changes - by default, this is off, since |
|
1471 |
it can blow up the changes file enormously ... |
|
1472 |
" |
|
1473 |
||
1474 |
^ LogDoits |
|
1475 |
||
1476 |
" |
|
1477 |
LogDoits := false |
|
1478 |
LogDoits := true |
|
1479 |
" |
|
1480 |
! |
|
1481 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1482 |
loadBinaries:aBoolean |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1483 |
"turn on/off loading of binary objects" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1484 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1485 |
LoadBinaries := aBoolean |
453 | 1486 |
! |
1487 |
||
122 | 1488 |
logDoits:aBoolean |
1489 |
"turn on/off logging of doits in the changes file. |
|
1490 |
By default, this is off, since it can blow up the |
|
1491 |
changes file enormously ... |
|
1492 |
" |
|
1493 |
||
1494 |
LogDoits := aBoolean |
|
1495 |
||
1496 |
! |
|
1497 |
||
329 | 1498 |
getSourceFileName:aFileName |
1499 |
"search aFileName in some standard places |
|
1500 |
(subdirectories named 'source' in SystemPath); |
|
1501 |
return the absolute filename or nil if none is found." |
|
1502 |
||
1503 |
(aFileName startsWith:'/') ifTrue:[ |
|
1504 |
"dont use path for absolute file names" |
|
1505 |
||
1506 |
^ aFileName |
|
1507 |
]. |
|
1508 |
||
1509 |
SourcePath isNil ifTrue:[ |
|
1510 |
SourcePath := self constructPathFor:'source' |
|
1511 |
]. |
|
1512 |
||
1513 |
^ self searchPath:SourcePath for:aFileName in:'source' |
|
1514 |
||
1515 |
" |
|
1516 |
Smalltalk getSourceFileName:'Smalltalk.st' |
|
1517 |
" |
|
1518 |
! |
|
1519 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1520 |
systemPath |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1521 |
"return a collection of directorynames, where smalltalk |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1522 |
looks for system files |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1523 |
(usually in subdirs such as resources, bitmaps, source etc.) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1524 |
see comment in Smalltalk>>initSystemPath." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1525 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1526 |
^ SystemPath |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1527 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1528 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1529 |
Smalltalk systemPath |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1530 |
Smalltalk systemPath addLast:'someOtherDirectoryPath' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1531 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1532 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1533 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1534 |
realSystemPath |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1535 |
"return the realSystemPath - thats the directorynames from |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1536 |
SystemPath which exist and are readable" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1537 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1538 |
RealSystemPath isNil ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1539 |
RealSystemPath := SystemPath select:[:dirName | |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1540 |
(OperatingSystem isDirectory:dirName) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1541 |
and:[OperatingSystem isReadable:dirName] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1542 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1543 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1544 |
^ RealSystemPath |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1545 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1546 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1547 |
constructPathFor:aDirectoryName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1548 |
"search for aDirectory in SystemPath" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1549 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1550 |
^ self realSystemPath select:[:dirName | |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1551 |
OperatingSystem isDirectory:(dirName , '/' , aDirectoryName) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1552 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1553 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1554 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1555 |
loadBinaries |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1556 |
"return true, if binaries should be loaded into the system, |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1557 |
false if this should be suppressed. The default is false (for now)." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1558 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1559 |
^ LoadBinaries |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1560 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1561 |
|
329 | 1562 |
getResourceFileName:aFileName |
1563 |
"search aFileName in some standard places |
|
1564 |
(subdirectories named 'resource' in SystemPath); |
|
1565 |
return the absolute filename or nil if none is found." |
|
70 | 1566 |
|
1567 |
(aFileName startsWith:'/') ifTrue:[ |
|
159 | 1568 |
"dont use path for absolute file names" |
70 | 1569 |
|
159 | 1570 |
^ aFileName |
70 | 1571 |
]. |
1572 |
||
329 | 1573 |
ResourcePath isNil ifTrue:[ |
1574 |
ResourcePath := self constructPathFor:'resources' |
|
1575 |
]. |
|
1576 |
||
1577 |
^ self searchPath:ResourcePath for:aFileName in:'resources' |
|
1578 |
||
1579 |
" |
|
1580 |
Smalltalk getResourceFileName:'SBrowser.rs' |
|
1581 |
" |
|
1582 |
! |
|
1583 |
||
1584 |
getBitmapFileName:aFileName |
|
1585 |
"search aFileName in some standard places |
|
1586 |
(subdirectories named 'bitmaps' in SystemPath); |
|
1587 |
return the absolute filename or nil if none is found." |
|
1588 |
||
1589 |
(aFileName startsWith:'/') ifTrue:[ |
|
1590 |
"dont use path for absolute file names" |
|
1591 |
||
1592 |
^ aFileName |
|
1593 |
]. |
|
1594 |
||
1595 |
BitmapPath isNil ifTrue:[ |
|
1596 |
BitmapPath := self constructPathFor:'bitmaps' |
|
1597 |
]. |
|
1598 |
||
1599 |
^ self searchPath:BitmapPath for:aFileName in:'bitmaps' |
|
1600 |
||
1601 |
" |
|
1602 |
Smalltalk getBitmapFileName:'SBrowser.xbm' |
|
1603 |
" |
|
1604 |
! |
|
1605 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1606 |
flushPathCaches |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1607 |
RealSystemPath := ResourcePath := SourcePath := BitmapPath := BinaryPath := FileInPath := nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1608 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1609 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1610 |
bitmapFileStreamFor:aFileName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1611 |
"search aFileName in some standard places; |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1612 |
return a readonly fileStream or nil if not found. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1613 |
Searches in subdirectories named 'bitmaps' in SystemPath" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1614 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1615 |
|aString| |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1616 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1617 |
aString := self getBitmapFileName:aFileName. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1618 |
aString notNil ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1619 |
^ FileStream readonlyFileNamed:aString |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1620 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1621 |
^ nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1622 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1623 |
|
453 | 1624 |
getSystemFileName:aFileName |
1625 |
"search aFileName in some standard places; |
|
1626 |
return the absolute filename or nil if none is found. |
|
1627 |
see comment in Smalltalk>>initSystemPath." |
|
1628 |
||
1629 |
"credits for this method go to Markus ...." |
|
1630 |
||
1631 |
(aFileName startsWith:'/') ifTrue:[ |
|
1632 |
"dont use path for absolute file names" |
|
1633 |
||
1634 |
^ aFileName |
|
1635 |
]. |
|
1636 |
||
1637 |
self realSystemPath do:[:dirName | |
|
1638 |
|realName| |
|
1639 |
||
1640 |
realName := dirName , '/' , aFileName. |
|
1641 |
(OperatingSystem isReadable:realName) ifTrue: [ |
|
1642 |
^ realName |
|
1643 |
] |
|
1644 |
]. |
|
1645 |
^ nil |
|
1646 |
! |
|
1647 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1648 |
systemFileStreamFor:aFileName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1649 |
"search aFileName in some standard places; |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1650 |
return a readonly fileStream or nil if not found. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1651 |
see comment in Smalltalk>>initSystemPath" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1652 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1653 |
|aString| |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1654 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1655 |
aString := self getSystemFileName:aFileName. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1656 |
aString notNil ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1657 |
^ FileStream readonlyFileNamed:aString |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1658 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1659 |
^ nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1660 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1661 |
|
453 | 1662 |
systemPath:aPath |
1663 |
"set the collection of directorynames, where smalltalk |
|
1664 |
looks for system files |
|
1665 |
(usually in subdirs such as resources, bitmaps, source etc.) |
|
1666 |
see comment in Smalltalk>>initSystemPath." |
|
1667 |
||
1668 |
SystemPath := aPath. |
|
1669 |
self flushPathCaches |
|
1670 |
||
1671 |
" |
|
1672 |
Smalltalk systemPath |
|
1673 |
Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath') |
|
1674 |
" |
|
1675 |
! |
|
1676 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1677 |
resourceFileStreamFor:aFileName |
453 | 1678 |
"search aFileName in some standard places; |
1679 |
return a readonly fileStream or nil if not found. |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1680 |
Searches in subdirectories named 'resource' in SystemPath" |
453 | 1681 |
|
1682 |
|aString| |
|
1683 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1684 |
aString := self getResourceFileName:aFileName. |
453 | 1685 |
aString notNil ifTrue:[ |
1686 |
^ FileStream readonlyFileNamed:aString |
|
1687 |
]. |
|
1688 |
^ nil |
|
1689 |
! |
|
1690 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1691 |
sourceFileStreamFor:aFileName |
453 | 1692 |
"search aFileName in some standard places; |
1693 |
return a readonly fileStream or nil if not found. |
|
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1694 |
Searches in subdirectories named 'source' in SystemPath" |
453 | 1695 |
|
1696 |
|aString| |
|
1697 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1698 |
aString := self getSourceFileName:aFileName. |
453 | 1699 |
aString notNil ifTrue:[ |
1700 |
^ FileStream readonlyFileNamed:aString |
|
1701 |
]. |
|
1702 |
^ nil |
|
1703 |
! |
|
1704 |
||
329 | 1705 |
getFileInFileName:aFileName |
1706 |
"search aFileName in some standard places |
|
1707 |
(subdirectories named 'fileIn' in SystemPath); |
|
1708 |
return the absolute filename or nil if none is found." |
|
1709 |
||
1710 |
(aFileName startsWith:'/') ifTrue:[ |
|
1711 |
"dont use path for absolute file names" |
|
1712 |
||
1713 |
^ aFileName |
|
1714 |
]. |
|
1715 |
||
1716 |
FileInPath isNil ifTrue:[ |
|
1717 |
FileInPath := self constructPathFor:'fileIn' |
|
1718 |
]. |
|
1719 |
||
1720 |
^ self searchPath:FileInPath for:aFileName in:'fileIn' |
|
1721 |
||
1722 |
! |
|
1723 |
||
1724 |
getBinaryFileName:aFileName |
|
1725 |
"search aFileName in some standard places |
|
1726 |
(subdirectories named 'binary' in SystemPath); |
|
1727 |
return the absolute filename or nil if none is found." |
|
1728 |
||
1729 |
(aFileName startsWith:'/') ifTrue:[ |
|
1730 |
"dont use path for absolute file names" |
|
1731 |
||
1732 |
^ aFileName |
|
1733 |
]. |
|
1734 |
||
1735 |
BinaryPath isNil ifTrue:[ |
|
1736 |
BinaryPath := self constructPathFor:'binary' |
|
1737 |
]. |
|
1738 |
||
1739 |
^ self searchPath:BinaryPath for:aFileName in:'binary' |
|
70 | 1740 |
! |
1741 |
||
10 | 1742 |
readAbbreviations |
202 | 1743 |
"read classname to filename mappings from include/abbrev.stc. |
329 | 1744 |
sigh - all for those poor sys5.3 or MSDOS people with short filenames ..." |
10 | 1745 |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1746 |
|abbrevs aStream line words nm abbrev| |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1747 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1748 |
CachedAbbreviations := abbrevs := IdentityDictionary new. |
329 | 1749 |
aStream := self systemFileStreamFor:'include/abbrev.stc'. |
10 | 1750 |
aStream notNil ifTrue:[ |
159 | 1751 |
[aStream atEnd] whileFalse:[ |
1752 |
line := aStream nextLine. |
|
1753 |
line notNil ifTrue:[ |
|
1754 |
(line startsWith:'#') ifFalse:[ |
|
345 | 1755 |
words := line asCollectionOfWords. |
1756 |
words size >= 2 ifTrue:[ |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1757 |
nm := (words at:1) withoutSeparators. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1758 |
abbrev := (words at:2) withoutSeparators. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1759 |
nm ~= abbrev ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1760 |
abbrevs at:nm asSymbol put:abbrev. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1761 |
] |
345 | 1762 |
] |
1763 |
] |
|
1764 |
] |
|
1765 |
]. |
|
1766 |
aStream close |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1767 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1768 |
^ abbrevs |
345 | 1769 |
|
1770 |
" |
|
1771 |
Smalltalk readAbbreviations |
|
1772 |
" |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1773 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1774 |
"Modified: 6.11.1995 / 15:45:48 / cg" |
345 | 1775 |
! |
1776 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1777 |
fileInFileStreamFor:aFileName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1778 |
"search aFileName in some standard places; |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1779 |
return a readonly fileStream or nil if not found. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1780 |
Searches in subdirectories named 'fileIn' in SystemPath" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1781 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1782 |
|aString| |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1783 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1784 |
aString := self getFileInFileName:aFileName. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1785 |
aString notNil ifTrue:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1786 |
^ FileStream readonlyFileNamed:aString |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1787 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1788 |
^ nil |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1789 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1790 |
|
485
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1791 |
libraryFileNameOfClass:aClassOrClassName |
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1792 |
"for a given class, return the name of a classLibrary which contains |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1793 |
binary code for it. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1794 |
Read the libinfo file 'liblist.stc' (which is created during the compilation process) |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1795 |
for an entry for aClassOrClassName. |
485
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1796 |
Search for the className in the first col, and return the value found in |
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1797 |
the 2nd col. |
354 | 1798 |
Return nil if no entry is found. |
1799 |
||
345 | 1800 |
A nil returns means that this class is either built-in or not present |
1801 |
in a package-class library (i.e. either as separate .o or separate .st file). |
|
485
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1802 |
Otherwise, the returned name is the classLibrary object of that class. |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1803 |
The classes code can be loaded from that file if binary loading is supported." |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1804 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1805 |
|aStream line words n aClassName| |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1806 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1807 |
aClassOrClassName isBehavior ifTrue:[ |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1808 |
aClassName := aClassOrClassName name |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1809 |
] ifFalse:[ |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1810 |
aClassName := aClassOrClassName |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1811 |
]. |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1812 |
aClassName := aClassName asString. |
345 | 1813 |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1814 |
#('include/liblist.stc') "/ filenames |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1815 |
with:#(2) "/ column |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1816 |
do:[:fileName :col | |
354 | 1817 |
|
1818 |
aStream := self systemFileStreamFor:fileName. |
|
1819 |
aStream notNil ifTrue:[ |
|
1820 |
[aStream atEnd] whileFalse:[ |
|
1821 |
line := aStream nextLine. |
|
1822 |
line notNil ifTrue:[ |
|
1823 |
(line startsWith:'#') ifFalse:[ |
|
1824 |
words := line asCollectionOfWords. |
|
1825 |
(n := words size) > 1 ifTrue:[ |
|
1826 |
(words at:1) = aClassName ifTrue:[ |
|
1827 |
n >= col ifTrue:[ |
|
1828 |
^ (words at:col) withoutSeparators |
|
1829 |
] |
|
345 | 1830 |
] |
159 | 1831 |
] |
1832 |
] |
|
1833 |
] |
|
357 | 1834 |
]. |
1835 |
aStream close |
|
159 | 1836 |
]. |
345 | 1837 |
]. |
354 | 1838 |
|
345 | 1839 |
^ nil |
1840 |
||
1841 |
" |
|
1842 |
Smalltalk libraryFileNameOfClass:'ClockView' |
|
1843 |
Smalltalk libraryFileNameOfClass:'Bag' |
|
1844 |
" |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1845 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1846 |
"Modified: 6.11.1995 / 15:41:39 / cg" |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1847 |
! |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1848 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1849 |
sourceDirectoryNameOfClass:aClassOrClassName |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1850 |
"for a given class, return the pathname relative to TOP of the classes source code. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1851 |
Read the file 'abbrev.stc' (which is created during the compilation process) |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1852 |
for an entry for aClassOrClassName. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1853 |
Search for the className in the first col, and return the value found in |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1854 |
the 3rd col. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1855 |
Return nil if no entry is found." |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1856 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1857 |
|aStream line words n aClassName| |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1858 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1859 |
aClassOrClassName isBehavior ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1860 |
aClassName := aClassOrClassName name |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1861 |
] ifFalse:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1862 |
aClassName := aClassOrClassName |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1863 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1864 |
aClassName := aClassName asString. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1865 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1866 |
#('include/abbrev.stc') "/ filenames |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1867 |
with:#(3) "/ column |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1868 |
do:[:fileName :col | |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1869 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1870 |
aStream := self systemFileStreamFor:fileName. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1871 |
aStream notNil ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1872 |
[aStream atEnd] whileFalse:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1873 |
line := aStream nextLine. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1874 |
line notNil ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1875 |
(line startsWith:'#') ifFalse:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1876 |
words := line asCollectionOfWords. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1877 |
(n := words size) > 1 ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1878 |
(words at:1) = aClassName ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1879 |
n >= col ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1880 |
^ (words at:col) withoutSeparators |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1881 |
] |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1882 |
] |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1883 |
] |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1884 |
] |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1885 |
] |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1886 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1887 |
aStream close |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1888 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1889 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1890 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1891 |
^ nil |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1892 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1893 |
" |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1894 |
Smalltalk sourceDirectoryNameOfClass:'ClockView' |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1895 |
Smalltalk sourceDirectoryNameOfClass:'Bag' |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1896 |
Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView' |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1897 |
Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass' |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1898 |
" |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1899 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1900 |
"Created: 6.11.1995 / 15:43:30 / cg" |
10 | 1901 |
! |
1902 |
||
202 | 1903 |
filenameAbbreviations |
70 | 1904 |
"return a dictionary containing the classname-to-filename |
1905 |
mappings. (needed for sys5.3 users, where filenames are limited |
|
1906 |
to 14 chars)" |
|
7 | 1907 |
|
70 | 1908 |
CachedAbbreviations isNil ifTrue:[ |
159 | 1909 |
self readAbbreviations |
7 | 1910 |
]. |
70 | 1911 |
^ CachedAbbreviations |
77 | 1912 |
|
122 | 1913 |
"flush with: |
1914 |
||
77 | 1915 |
CachedAbbreviations := nil |
1916 |
" |
|
202 | 1917 |
" |
1918 |
Smalltalk filenameAbbreviations |
|
1919 |
" |
|
1 | 1920 |
! |
1921 |
||
485
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1922 |
fileNameForClass:aClassOrClassName |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1923 |
"return a good filename for aClassOrClassName - |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1924 |
using the abbreviation file if there is one" |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1925 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1926 |
|fileName abbrev aClassName| |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1927 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1928 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1929 |
aClassOrClassName isBehavior ifTrue:[ |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1930 |
aClassName := aClassOrClassName name |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1931 |
] ifFalse:[ |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1932 |
aClassName := aClassOrClassName |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1933 |
]. |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1934 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1935 |
fileName := aClassName asSymbol. |
1 | 1936 |
|
10 | 1937 |
"first look, if the class exists and has a fileName" |
1938 |
||
24 | 1939 |
" later ... - compiler should put the source file name into the class |
485
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1940 |
(Symbol hasInterned:aClassName) ifTrue:[:sym | |
159 | 1941 |
|class| |
10 | 1942 |
|
159 | 1943 |
(Smalltalk includesKey:sym) ifTrue:[ |
1944 |
class := Smalltalk at:sym. |
|
1945 |
class isClass ifTrue:[ |
|
1946 |
abbrev := class classFileName. |
|
1947 |
] |
|
1948 |
] |
|
10 | 1949 |
]. |
1950 |
" |
|
1951 |
||
7 | 1952 |
"look for abbreviation" |
1 | 1953 |
|
202 | 1954 |
abbrev := self filenameAbbreviations at:fileName ifAbsent:[nil]. |
10 | 1955 |
abbrev notNil ifTrue:[^ abbrev]. |
7 | 1956 |
|
10 | 1957 |
"no abbreviation found - if its a short name, take it" |
1958 |
||
1959 |
OperatingSystem maxFileNameLength < (fileName size + 3) ifTrue:[ |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1960 |
"this will only be triggered on sys5.3/DOS type systems" |
216 | 1961 |
self warn:'cant find short for ' , fileName , ' in abbreviation file' |
1 | 1962 |
]. |
485
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1963 |
^ fileName asString |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1964 |
|
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1965 |
" |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1966 |
Smalltalk fileNameForClass:SmallInteger |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1967 |
Smalltalk fileNameForClass:'SmallInteger' |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1968 |
Smalltalk fileNameForClass:'OperatingSystem' |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1969 |
Smalltalk fileNameForClass:'SomeUnknownClass' |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1970 |
" |
99f5376c0c62
allow class as arg to libraryFileName / sourceFileName
Claus Gittinger <cg@exept.de>
parents:
477
diff
changeset
|
1971 |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
1972 |
"Modified: 6.11.1995 / 15:37:33 / cg" |
1 | 1973 |
! |
1974 |
||
2 | 1975 |
classNameForFile:aFileName |
10 | 1976 |
"return the className which corresponds to an abbreviated fileName, |
1977 |
or nil if no special translation applies. The given filename arg should |
|
1978 |
NOT include any suffix such as '.st'." |
|
2 | 1979 |
|
357 | 1980 |
^ self filenameAbbreviations keyAtEqualValue:aFileName ifAbsent:[aFileName]. |
2 | 1981 |
|
329 | 1982 |
" |
1983 |
Smalltalk classNameForFile:'DrawObj' |
|
1984 |
" |
|
2 | 1985 |
! |
1986 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1987 |
secureFileIn:aFileName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1988 |
"read in the named file, looking for it at standard places. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1989 |
Catch any error during fileIn. Return true if ok, false if failed" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1990 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1991 |
(SignalSet |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1992 |
with:AbortSignal |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1993 |
with:Process terminateSignal) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1994 |
handle:[:ex | |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1995 |
ex return |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1996 |
] do:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1997 |
^ self fileIn:aFileName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1998 |
]. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
1999 |
^ false |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2000 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2001 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2002 |
fileIn:aFileName |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2003 |
"read in the named file - look for it in some standard places; |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2004 |
return true if ok, false if failed" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2005 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2006 |
^ self fileIn:aFileName lazy:nil silent:nil logged:false |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2007 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2008 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2009 |
Smalltalk fileIn:'source/TicTacToe.st' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2010 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2011 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2012 |
"Created: 28.10.1995 / 17:06:28 / cg" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2013 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2014 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2015 |
silentFileIn:aFilename |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2016 |
"same as fileIn:, but do not output 'compiled...'-messages on Transcript. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2017 |
Main use is during startup." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2018 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2019 |
|wasSilent| |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2020 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2021 |
wasSilent := self silentLoading:true. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2022 |
[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2023 |
self fileIn:aFilename |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2024 |
] valueNowOrOnUnwindDo:[ |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2025 |
self silentLoading:wasSilent |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2026 |
] |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2027 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2028 |
|
345 | 2029 |
fileInClass:aClassName fromObject:aFileName |
70 | 2030 |
"read in the named object file and dynamic-link it into the system |
2031 |
- look for it in some standard places; |
|
2032 |
return true if ok, false if failed." |
|
1 | 2033 |
|
356 | 2034 |
|path ok| |
329 | 2035 |
|
70 | 2036 |
" |
2037 |
check if the dynamic loader class is in |
|
2038 |
" |
|
390 | 2039 |
(LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false]. |
1 | 2040 |
|
329 | 2041 |
(path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false]. |
356 | 2042 |
ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil. |
2043 |
ok ifTrue:[ |
|
2044 |
Transcript show:' loaded ' , aClassName , ' from ' ; showCr:aFileName. |
|
2045 |
]. |
|
2046 |
^ ok |
|
1 | 2047 |
|
70 | 2048 |
" |
345 | 2049 |
Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so' |
2050 |
Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so' |
|
70 | 2051 |
" |
1 | 2052 |
! |
2053 |
||
400 | 2054 |
fileIn:aFileName logged:logged |
2055 |
"read in the named file - look for it in some standard places; |
|
2056 |
return true if ok, false if failed. |
|
2057 |
The argument logged controls, if the changefile is to be updated." |
|
2058 |
||
2059 |
^ self fileIn:aFileName lazy:nil silent:nil logged:logged |
|
2060 |
||
2061 |
" |
|
2062 |
Smalltalk fileIn:'source/TicTacToe.st' logged:false |
|
2063 |
" |
|
2064 |
! |
|
2065 |
||
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2066 |
fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2067 |
"read sourceCode from aStream; |
400 | 2068 |
return true if ok, false if failed. |
2069 |
If lazy is true, no code is generated for methods, instead stups |
|
2070 |
are created which compile themself when first executed. This allows |
|
2071 |
for much faster fileIn (but slows down the first execution later). |
|
2072 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
2073 |
code which is known to be syntactically correct. |
|
2074 |
If silent is true, no compiler messages are output to the transcript. |
|
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2075 |
Giving nil for silent/lazy will use the current settings. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2076 |
If morePath is nonNil, it is prepended to the systemPath temporarily during the |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2077 |
fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more) |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2078 |
using a relative path." |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2079 |
|
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2080 |
|path wasLazy wasSilent oldSystemPath oldRealPath| |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2081 |
|
1 | 2082 |
aStream isNil ifTrue:[^ false]. |
2083 |
||
329 | 2084 |
lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy]. |
2085 |
silent notNil ifTrue:[wasSilent := self silentLoading:silent]. |
|
2086 |
[ |
|
423 | 2087 |
Class updateChangeFileQuerySignal handle:[:ex | |
421 | 2088 |
ex proceedWith:logged |
423 | 2089 |
] do:[ |
421 | 2090 |
oldSystemPath := SystemPath copy. |
2091 |
morePath notNil ifTrue:[ |
|
423 | 2092 |
SystemPath addFirst:morePath. |
2093 |
oldRealPath := RealSystemPath. |
|
2094 |
RealSystemPath := nil. |
|
421 | 2095 |
]. |
2096 |
aStream fileIn |
|
2097 |
] |
|
329 | 2098 |
] valueNowOrOnUnwindDo:[ |
362 | 2099 |
morePath notNil ifTrue:[ |
2100 |
SystemPath := oldSystemPath. |
|
2101 |
RealSystemPath := oldRealPath. |
|
2102 |
]. |
|
329 | 2103 |
lazy notNil ifTrue:[Compiler compileLazy:wasLazy]. |
2104 |
silent notNil ifTrue:[self silentLoading:wasSilent]. |
|
2105 |
aStream close |
|
2106 |
]. |
|
1 | 2107 |
^ true |
2108 |
||
77 | 2109 |
" |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2110 |
Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2111 |
" |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2112 |
! |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2113 |
|
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2114 |
fileIn:aFileName lazy:lazy silent:silent logged:logged |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2115 |
"read in the named file - look for it in some standard places; |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2116 |
return true if ok, false if failed. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2117 |
If lazy is true, no code is generated for methods, instead stups |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2118 |
are created which compile themself when first executed. This allows |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2119 |
for much faster fileIn (but slows down the first execution later). |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2120 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2121 |
code which is known to be syntactically correct. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2122 |
If silent is true, no compiler messages are output to the transcript. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2123 |
Giving nil for silent/lazy will use the current settings." |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2124 |
|
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2125 |
|aStream path morePath| |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2126 |
|
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2127 |
" |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2128 |
an object or shared object ? |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2129 |
" |
501
1dc925f66637
dont access ObjectFileLoader if nil (on non-dynamic load systems)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2130 |
(ObjectFileLoader notNil |
1dc925f66637
dont access ObjectFileLoader if nil (on non-dynamic load systems)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2131 |
and:[ObjectFileLoader hasValidBinaryExtension:aFileName]) ifTrue:[ |
1dc925f66637
dont access ObjectFileLoader if nil (on non-dynamic load systems)
Claus Gittinger <cg@exept.de>
parents:
491
diff
changeset
|
2132 |
LoadBinaries ifFalse:[^ false]. |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2133 |
path := self getBinaryFileName:aFileName. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2134 |
path isNil ifTrue:[^ false]. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2135 |
^ ObjectFileLoader loadObjectFile:aFileName |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2136 |
]. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2137 |
|
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2138 |
(aFileName startsWith:'source/') ifTrue:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2139 |
aStream := self sourceFileStreamFor:(aFileName copyFrom:8) |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2140 |
] ifFalse:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2141 |
(aFileName startsWith:'fileIn/') ifTrue:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2142 |
aStream := self fileInFileStreamFor:(aFileName copyFrom:8) |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2143 |
] ifFalse:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2144 |
aStream := self systemFileStreamFor:aFileName. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2145 |
(aStream notNil and:[aFileName includes:$/]) ifTrue:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2146 |
"/ temporarily prepend the files directory |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2147 |
"/ to the searchPath. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2148 |
"/ This allows fileIn-driver files to refer to local |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2149 |
"/ files via a relative path, and drivers to fileIn other |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2150 |
"/ drivers ... |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2151 |
morePath := aStream pathName asFilename directoryName. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2152 |
] |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2153 |
] |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2154 |
]. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2155 |
aStream isNil ifTrue:[^ false]. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2156 |
^ self fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2157 |
|
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2158 |
" |
329 | 2159 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true silent:true |
77 | 2160 |
" |
1 | 2161 |
! |
2162 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2163 |
fileIn:aFileName lazy:lazy |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2164 |
"read in the named file - look for it in some standard places; |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2165 |
return true if ok, false if failed. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2166 |
If lazy is true, no code is generated for methods, instead stups |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2167 |
are created which compile themself when first executed. This allows |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2168 |
for much faster fileIn (but slows down the first execution later). |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2169 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2170 |
code which is known to be syntactically correct." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2171 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2172 |
^ self fileIn:aFileName lazy:lazy silent:nil logged:false |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2173 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2174 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2175 |
Smalltalk fileIn:'source/TicTacToe.st' lazy:true |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2176 |
" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2177 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2178 |
"Created: 28.10.1995 / 17:06:36 / cg" |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2179 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2180 |
|
453 | 2181 |
fileIn:aFileName lazy:lazy silent:silent |
2182 |
"read in the named file - look for it in some standard places; |
|
2183 |
return true if ok, false if failed. |
|
2184 |
If lazy is true, no code is generated for methods, instead stups |
|
2185 |
are created which compile themself when first executed. This allows |
|
2186 |
for much faster fileIn (but slows down the first execution later). |
|
2187 |
Since no syntax checks are done when doing lazy fileIn, use this only for |
|
2188 |
code which is known to be syntactically correct. |
|
2189 |
If silent is true, no compiler messages are output to the transcript. |
|
2190 |
Giving nil for silent/lazy will use the current settings." |
|
2191 |
||
2192 |
^ self fileIn:aFileName lazy:lazy silent:silent logged:false |
|
2193 |
||
2194 |
"Created: 28.10.1995 / 17:06:41 / cg" |
|
2195 |
! |
|
2196 |
||
1 | 2197 |
fileInChanges |
2198 |
"read in the last changes file - bringing the system to the state it |
|
70 | 2199 |
had when left the last time. |
2200 |
WARNING: this method is rubbish: it should only read things after the |
|
400 | 2201 |
last '**snapshot**' - entry |
2202 |
(instead of the complete changes file)." |
|
1 | 2203 |
|
70 | 2204 |
" |
400 | 2205 |
do NOT update the changes file now ... |
70 | 2206 |
" |
400 | 2207 |
self fileIn:'changes' logged:false |
1 | 2208 |
|
77 | 2209 |
" |
2210 |
Smalltalk fileInChanges |
|
2211 |
" |
|
1 | 2212 |
! |
2213 |
||
2214 |
fileInClass:aClassName |
|
10 | 2215 |
"find a source/object file for aClassName and -if found - load it. |
95 | 2216 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
2217 |
finally source file (.st) in that order. |
|
70 | 2218 |
The file is first searched for using the class name, then the abbreviated name." |
1 | 2219 |
|
216 | 2220 |
^ self fileInClass:aClassName initialize:true lazy:false silent:false |
2221 |
! |
|
2222 |
||
2223 |
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent |
|
2224 |
"find a source/object file for aClassName and -if found - load it. |
|
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2225 |
search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and |
345 | 2226 |
finally source file (.st), in that order. |
2227 |
The file is first searched for using the class name, then the abbreviated name. |
|
2228 |
The argument doInit controlls if the class should be sent a #initialize after the |
|
2229 |
load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler |
|
2230 |
should not send notes to the transcript." |
|
2231 |
||
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2232 |
|shortName libName newClass ok wasLazy wasSilent sharedLibExtension inStream| |
216 | 2233 |
|
2234 |
wasLazy := Compiler compileLazy:loadLazy. |
|
2235 |
wasSilent := self silentLoading:beSilent. |
|
2236 |
||
7 | 2237 |
[ |
216 | 2238 |
Class withoutUpdatingChangesDo: |
2239 |
[ |
|
329 | 2240 |
ok := false. |
2241 |
||
159 | 2242 |
" |
216 | 2243 |
first, look for a loader-driver file (in fileIn/xxx.ld) |
2244 |
" |
|
329 | 2245 |
(ok := self fileIn:('fileIn/' , aClassName , '.ld') lazy:loadLazy silent:beSilent) |
159 | 2246 |
ifFalse:[ |
216 | 2247 |
shortName := self fileNameForClass:aClassName. |
159 | 2248 |
" |
216 | 2249 |
try abbreviated driver-file (in fileIn/xxx.ld) |
159 | 2250 |
" |
329 | 2251 |
shortName ~= aClassName ifTrue:[ |
2252 |
ok := self fileIn:('fileIn/' , shortName , '.ld') lazy:loadLazy silent:beSilent |
|
2253 |
]. |
|
2254 |
ok ifFalse:[ |
|
216 | 2255 |
" |
345 | 2256 |
then, if dynamic linking is available, |
216 | 2257 |
" |
390 | 2258 |
(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[ |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2259 |
sharedLibExtension := ObjectFileLoader sharedLibraryExtension. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2260 |
|
345 | 2261 |
" |
2262 |
first look for a class packages shared binary in binary/xxx.o |
|
2263 |
" |
|
2264 |
libName := self libraryFileNameOfClass:aClassName. |
|
2265 |
libName notNil ifTrue:[ |
|
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2266 |
(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension)) |
159 | 2267 |
ifFalse:[ |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2268 |
sharedLibExtension ~= '.o' ifTrue:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2269 |
ok := self fileInClass:aClassName fromObject:(libName, '.o') |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2270 |
] |
345 | 2271 |
]. |
2272 |
]. |
|
2273 |
||
2274 |
" |
|
2275 |
then, look for a shared binary in binary/xxx.o |
|
2276 |
" |
|
2277 |
ok ifFalse:[ |
|
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2278 |
(ok := self fileInClass:aClassName fromObject:(aClassName, sharedLibExtension)) |
345 | 2279 |
ifFalse:[ |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2280 |
sharedLibExtension ~= '.o' ifTrue:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2281 |
ok := self fileInClass:aClassName fromObject:(aClassName, '.o') |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2282 |
]. |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2283 |
ok ifFalse:[ |
345 | 2284 |
shortName ~= aClassName ifTrue:[ |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2285 |
(ok := self fileInClass:aClassName fromObject:(shortName, sharedLibExtension)) |
345 | 2286 |
ifFalse:[ |
490
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2287 |
sharedLibExtension ~= '.o' ifTrue:[ |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2288 |
ok := self fileInClass:aClassName fromObject:(shortName, '.o') |
b93a837e8338
hook to autoload via sourcecode manager
Claus Gittinger <cg@exept.de>
parents:
485
diff
changeset
|
2289 |
] |
345 | 2290 |
] |
2291 |
]. |
|
216 | 2292 |
]. |
159 | 2293 |
]. |
2294 |
]. |
|
2295 |
]. |
|
77 | 2296 |
|
216 | 2297 |
" |
2298 |
if that did not work, look for an st-source file ... |
|
2299 |
" |
|
2300 |
ok ifFalse:[ |
|
329 | 2301 |
(ok := self fileIn:(aClassName , '.st') lazy:loadLazy silent:beSilent) |
159 | 2302 |
ifFalse:[ |
329 | 2303 |
shortName ~= aClassName ifTrue:[ |
2304 |
ok := self fileIn:(shortName , '.st') lazy:loadLazy silent:beSilent |
|
2305 |
]. |
|
2306 |
ok ifFalse:[ |
|
216 | 2307 |
" |
2308 |
... and in the standard source-directory |
|
2309 |
" |
|
329 | 2310 |
(ok := self fileIn:('source/' , aClassName , '.st') lazy:loadLazy silent:beSilent) |
216 | 2311 |
ifFalse:[ |
329 | 2312 |
shortName ~= aClassName ifTrue:[ |
2313 |
ok := self fileIn:('source/' , shortName , '.st') lazy:loadLazy silent:beSilent |
|
2314 |
] |
|
216 | 2315 |
] |
159 | 2316 |
] |
2317 |
] |
|
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2318 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2319 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2320 |
" |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2321 |
new: if there is a sourceCodeManager, ask it for the classes sourceCode |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2322 |
" |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2323 |
SourceCodeManager notNil ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2324 |
inStream := SourceCodeManager mostRecentSourceStreamForClassNamed:aClassName. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2325 |
inStream notNil ifTrue:[ |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2326 |
ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2327 |
] |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2328 |
]. |
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2329 |
|
216 | 2330 |
]. |
2331 |
] |
|
2332 |
]. |
|
329 | 2333 |
ok ifTrue:[ |
2334 |
newClass := self at:(aClassName asSymbol). |
|
2335 |
newClass notNil ifTrue:[ |
|
2336 |
doInit ifTrue:[ |
|
2337 |
newClass initialize |
|
2338 |
] |
|
216 | 2339 |
] |
2340 |
]. |
|
2341 |
] valueNowOrOnUnwindDo:[ |
|
2342 |
Compiler compileLazy:wasLazy. |
|
2343 |
self silentLoading:wasSilent |
|
202 | 2344 |
]. |
159 | 2345 |
|
216 | 2346 |
^ newClass |
491
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2347 |
|
a6d3a8151866
new method to return a classes sourceDirectory (from abbrev.stc)
Claus Gittinger <cg@exept.de>
parents:
490
diff
changeset
|
2348 |
"Modified: 6.11.1995 / 15:36:02 / cg" |
191 | 2349 |
! |
2350 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2351 |
fileInClass:aClassName initialize:doInit |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2352 |
"find a source/object file for aClassName and -if found - load it. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2353 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2354 |
finally source file (.st) in that order. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2355 |
The file is first searched for using the class name, then the abbreviated name." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2356 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2357 |
^ self fileInClass:aClassName initialize:doInit lazy:false silent:false |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2358 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2359 |
|
453 | 2360 |
fileInClass:aClassName initialize:doInit lazy:loadLazy |
2361 |
"find a source/object file for aClassName and -if found - load it. |
|
2362 |
search is in some standard places trying driver-file (.ld), object-file (.o) and |
|
2363 |
finally source file (.st) in that order. |
|
2364 |
The file is first searched for using the class name, then the abbreviated name." |
|
2365 |
||
2366 |
^ self fileInClass:aClassName initialize:doInit lazy:loadLazy silent:false |
|
2367 |
! |
|
2368 |
||
191 | 2369 |
compressSources |
2370 |
"compress the sources file, and remove all method source strings |
|
2371 |
from the system and replace them by refs to a string in the source file. |
|
2372 |
This is a bit different in ST/X than in other smalltalks, |
|
2373 |
since we use per-class sourcefiles for the compiled classes, |
|
2374 |
and a mix of in-memory strings and one-for-all sourceFile for |
|
2375 |
incremental compiled methods. |
|
2376 |
Therefore, only those sources which are not coming from compiled |
|
2377 |
methods are put into the 'st.src' file - all others are untouched. |
|
2378 |
This is being automated - so dont care for now." |
|
2379 |
||
2380 |
" |
|
2381 |
first, find all methods which contain either a string-ref |
|
2382 |
or an external string in the 'st.src' file |
|
2383 |
" |
|
202 | 2384 |
|newStream table source pos fileName| |
191 | 2385 |
|
2386 |
newStream := 'src.tmp' asFilename writeStream. |
|
2387 |
newStream isNil ifTrue:[ |
|
2388 |
self error:'cannot create new temporary source file'. |
|
2389 |
^ self |
|
2390 |
]. |
|
2391 |
||
2392 |
table := IdentityDictionary new:100. |
|
2393 |
||
329 | 2394 |
Method allSubInstancesDo:[:aMethod | |
191 | 2395 |
source := nil. |
2396 |
aMethod sourcePosition notNil ifTrue:[ |
|
2397 |
aMethod sourceFilename = 'st.src' ifTrue:[ |
|
2398 |
source := aMethod source. |
|
2399 |
] |
|
2400 |
] ifFalse:[ |
|
2401 |
source := aMethod source |
|
2402 |
]. |
|
2403 |
||
2404 |
source notNil ifTrue:[ |
|
2405 |
pos := newStream position. |
|
2406 |
newStream nextChunkPut:source. |
|
2407 |
||
2408 |
" |
|
2409 |
dont change the methods info - maybe some write error |
|
202 | 2410 |
occurs later, in that case we abort and leave everything |
191 | 2411 |
untouched. |
2412 |
" |
|
2413 |
table at:aMethod put:pos |
|
2414 |
] |
|
2415 |
]. |
|
2416 |
||
2417 |
newStream close. |
|
2418 |
||
2419 |
" |
|
2420 |
now, rename the new source file, |
|
2421 |
" |
|
202 | 2422 |
fileName := (ObjectMemory nameForSources). |
2423 |
('src.tmp' asFilename renameTo:fileName) ifFalse:[ |
|
191 | 2424 |
self error:'cannot rename temporary file to new source file'. |
2425 |
^ self |
|
2426 |
]. |
|
2427 |
||
2428 |
"good - now go over all changed methods, and change their |
|
2429 |
source reference" |
|
2430 |
||
2431 |
table keysAndValuesDo:[:aMethod :pos | |
|
202 | 2432 |
aMethod sourceFilename:fileName position:pos. |
271 | 2433 |
"/ aMethod printNL. |
191 | 2434 |
]. |
2435 |
||
2436 |
" |
|
2437 |
Smalltalk compressSources |
|
2438 |
" |
|
1 | 2439 |
! ! |
2 | 2440 |
|
453 | 2441 |
!Smalltalk class methodsFor:'time-versions'! |
2442 |
||
2443 |
majorVersionNr |
|
2444 |
"return the major version number. |
|
2445 |
This is only incremented for very fundamental changes, |
|
2446 |
which make old object files totally incompatible |
|
2447 |
(for example, if the layout/representation of fundamental |
|
2448 |
classes changes)." |
|
2449 |
||
2450 |
^ 2 |
|
2451 |
||
2452 |
" |
|
2453 |
Smalltalk majorVersionNr |
|
2454 |
" |
|
2455 |
! |
|
2456 |
||
2457 |
minorVersionNr |
|
2458 |
"return the minor version number. |
|
2459 |
This is incremented for changes which make some old object |
|
2460 |
files incompatible, or the protocol changes such that some |
|
2461 |
classes need rework." |
|
2462 |
||
2463 |
^ 10 |
|
2464 |
||
2465 |
" |
|
2466 |
Smalltalk minorVersionNr |
|
2467 |
" |
|
2468 |
! |
|
2469 |
||
2470 |
revisionNr |
|
2471 |
"return the revision number. |
|
2472 |
Incremented for releases which fix bugs/add features |
|
2473 |
and represent a stable workable version which got published |
|
2474 |
to the outside world." |
|
2475 |
||
456 | 2476 |
^ 8 |
453 | 2477 |
|
2478 |
" |
|
2479 |
Smalltalk revisionNr |
|
2480 |
" |
|
2481 |
! |
|
2482 |
||
2483 |
versionString |
|
2484 |
"return the version string" |
|
2485 |
||
2486 |
^ (self majorVersionNr printString , |
|
2487 |
'.', |
|
2488 |
self minorVersionNr printString , |
|
2489 |
'.', |
|
2490 |
self revisionNr printString) |
|
2491 |
||
2492 |
" |
|
2493 |
Smalltalk versionString |
|
2494 |
" |
|
2495 |
! |
|
2496 |
||
2497 |
versionDate |
|
456 | 2498 |
"return the executables build date - thats the date when the smalltalk |
2499 |
executable was built" |
|
453 | 2500 |
%{ |
456 | 2501 |
extern char *__getBuildDateString(); |
2502 |
||
2503 |
RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) ); |
|
2504 |
%} |
|
453 | 2505 |
" |
2506 |
Smalltalk versionDate |
|
2507 |
" |
|
2508 |
! |
|
2509 |
||
2510 |
releaseNr |
|
2511 |
"return the revision number. |
|
2512 |
Incremented for releases which fix bugs/add features." |
|
2513 |
||
2514 |
^ 2 |
|
2515 |
||
2516 |
" |
|
2517 |
Smalltalk releaseNr |
|
2518 |
" |
|
2519 |
! |
|
2520 |
||
2521 |
configuration |
|
2522 |
"for developers only: return the configuration, with which |
|
2523 |
this smalltalk was compiled." |
|
2524 |
||
2525 |
%{ |
|
2526 |
extern char *__getConfigurationString(); |
|
2527 |
||
2528 |
RETURN (__MKSTRING(__getConfigurationString() COMMA_SND)); |
|
2529 |
%} |
|
2530 |
||
2531 |
" |
|
2532 |
Smalltalk configuration |
|
2533 |
" |
|
2534 |
! |
|
2535 |
||
2536 |
copyrightString |
|
2537 |
"return a copyright string" |
|
2538 |
||
2539 |
^ 'Copyright (c) 1988-95 by Claus Gittinger' |
|
2540 |
||
2541 |
" |
|
2542 |
Smalltalk copyrightString |
|
2543 |
" |
|
2544 |
! |
|
2545 |
||
457
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2546 |
timeStamp |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2547 |
"return a string useful for timestamping a file. |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2548 |
The returned string is padded with spaces for a constant |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2549 |
length (to avoid changing a files size in fileOut with unchanged |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2550 |
class)." |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2551 |
|
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2552 |
^ ('''From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on ' |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2553 |
, Date today printString , ' at ' , Time now printString |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2554 |
, '''') paddedTo:80 with:(Character space) |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2555 |
! |
41c73cbee305
change classes versionString when class changes (prepare for sourceCode system)
Claus Gittinger <cg@exept.de>
parents:
456
diff
changeset
|
2556 |
|
453 | 2557 |
hello |
2558 |
"return a greeting string" |
|
2559 |
||
2560 |
"stupid: this should come from a resource file ... |
|
2561 |
but I dont use it here, to allow mini-systems without |
|
2562 |
Resource-stuff." |
|
2563 |
||
2564 |
(Language == #german) ifTrue:[ |
|
2565 |
^ 'Willkommen bei SmallTalk/X - Version ' |
|
2566 |
, self versionString , ' vom ' , self versionDate |
|
2 | 2567 |
]. |
453 | 2568 |
(Language == #french) ifTrue:[ |
2569 |
^ 'Bienvenue ` SmallTalk/X - version ' |
|
2570 |
, self versionString , ' de ' , self versionDate |
|
2571 |
]. |
|
2572 |
^ 'Hello World - here is SmallTalk/X version ' |
|
2573 |
, self versionString , ' of ' , self versionDate |
|
2574 |
||
2575 |
" |
|
2576 |
Smalltalk hello |
|
2577 |
" |
|
2 | 2578 |
! ! |
453 | 2579 |