Smalltalk.st
author Merge Script
Sat, 25 Apr 2015 06:43:41 +0200
branchjv
changeset 18285 7aab8c3dab19
parent 18261 22bdfc405bca
parent 18283 f0c2bf4a129a
child 18292 8d4fe353a2d2
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
5363
0070ef95a033 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
    12
"{ Package: 'stx:libbasic' }"
0070ef95a033 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
    13
17279
5e8cf598ce7e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17095
diff changeset
    14
"{ NameSpace: Smalltalk }"
5e8cf598ce7e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17095
diff changeset
    15
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    16
Object subclass:#Smalltalk
16164
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    17
	instanceVariableNames:''
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    18
	classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    19
		NumberOfClassesHint SystemPath StartupClass StartupSelector
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    20
		StartupArguments CommandLine CommandName CommandLineArguments
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    21
		CachedAbbreviations VerboseLoading SilentLoading Initializing
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    22
		StandAlone HeadlessOperation IsPlugin IsSharedLibraryComponent
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    23
		IsSTScript DebuggingStandAlone LogDoits LoadBinaries
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    24
		RealSystemPath ResourcePath SourcePath BinaryPath FileInPath
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    25
		PackagePath BinaryDirName ResourceDirName SourceDirName
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    26
		BitmapDirName PackageDirName FileInDirName ChangeFileName
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    27
		ImageStartTime ImageRestartTime DemoMode SaveEmergencyImage
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    28
		SpecialObjectArray CallbackSignal ClassesFailedToInitialize
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
    29
		HasNoConsole IgnoreHalt PackageToPathMapping IgnoreAssertions'
16164
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    30
	poolDictionaries:''
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
    31
	category:'System-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    32
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    33
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
    34
Smalltalk comment:''
8845
17288e4e99eb remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents: 8821
diff changeset
    35
!
17288e4e99eb remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents: 8821
diff changeset
    36
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
    37
!Smalltalk class methodsFor:'documentation'!
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    38
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    39
copyright
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
    40
"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    41
 COPYRIGHT (c) 1988 by Claus Gittinger
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
    42
	      All Rights Reserved
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    43
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    44
 This software is furnished under a license and may be used
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    45
 only in accordance with the terms of that license and with the
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    46
 inclusion of the above copyright notice.   This software may not
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    47
 be provided or otherwise made available to, or used by, any
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    48
 other person.  No title to or ownership of the software is
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    49
 hereby transferred.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    50
"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    51
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    52
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    53
documentation
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    54
"
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    55
    This is one of the central classes in the system;
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    56
    it provides all system-startup, shutdown and maintenance support.
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    57
    Also global variables are (conceptionally) kept here.
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    58
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    59
    As you will notice, this is NOT a Dictionary
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    60
    - my implementation of globals is totally different
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    61
      due to the need to be able to access globals from c-code as well,
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    62
      I do not use associations for globals, but instead keep the
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    63
      name<->value relations in the VM and access globals via utility
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    64
      functions found there.
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    65
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    66
    However, it provides the known enumeration protocol.
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    67
    It may change to become a subclass of collection at some time,
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    68
    to inherit more collection stuff ...
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    69
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    70
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    71
    [Instance variables:]
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    72
					none - all handling is done in the VM
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    73
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    74
    [Class variables:]
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    75
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    76
	StartBlocks     <Collection>    blocks to be executed in a separate process after
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    77
					everything has been initialized. These blocks will
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    78
					be deleted after execution and therefore not be
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    79
					executed after an image restart. Initial processes
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    80
					(such as the Launcher) are usually started here.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    81
					These blocks are added by smalltalk.rc/private.rc etc.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    82
					via #addStartBlock during early initialization.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    83
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    84
	ImageStartBlocks
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    85
			<Collection>    blocks to be executed in a separate process after
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    86
					everything has been initialized. These blocks will be
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    87
					executed after an image restart.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    88
					These blocks are usually added by smalltalk_r.rc etc.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    89
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    90
	ExitBlocks      <Collection>    blocks to evaluate before system is
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    91
					left. Not currently used (GNU-ST compatibility).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    92
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    93
	SystemPath      <Collection>    path to search for system files (sources, bitmaps etc)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    94
					Set to a default here, but typically changed from some
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    95
					startup.rc file
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    96
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    97
	PackagePath     <Collection>    path to search for package.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    98
					This is going to replace the above systemPath, and a classes
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
    99
					resources will eventually searched in its package directory.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   100
					This list defines the path, where packages are searched for,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   101
					initially this is something like /opt/smalltalk/packages.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   102
					Set to a default here, but typically changed from some
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   103
					startup.rc file
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   104
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   105
	StartupClass    <Class>         class and selector, where the system starts up
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   106
	StartupSelector <Symbol>        (right after VM initialization)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   107
	StartupArguments <Array>        If an image is saved while those being nonNil,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   108
					the image will come up there.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   109
					Allows for customized images to be generated from a standard ST/X.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   110
					StandAlone programs also set those during initialization.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   111
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   112
	CommandLine          <String>   Unix (OS-) command line
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   113
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   114
	CommandName          <String>   the command (i.e. argv[0])
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   115
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   116
	CommandLineArguments <Array>    Unix (OS-) command line arguments broken into words
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   117
					CommandName has been stripped off.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   118
					(initially set by the VM)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   119
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   120
	SilentLoading   <Boolean>       OBSOLETE:
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   121
					suppresses messages during fileIn and in compiler
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   122
					(can be set to true from a customized main.c)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   123
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   124
	VerboseLoading   <Boolean>      generate messages during fileIn and in compiler
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   125
					(can be set to true from a customized main.c)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   126
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   127
	Initializing    <Boolean>       true while (re-)initializing
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   128
					Controls the behavior of certain error
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   129
					reporters (for example: suppress dialogBoxes)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   130
					while the system is not yet fit for full operation.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   131
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   132
	StandAlone      <Boolean>       true, if this is a standalone app;
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   133
					if true the process scheduler watches for
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   134
					which processes are still running, and
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   135
					exits ST/X, when the last non-background
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   136
					and non-system process exits.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   137
					Can be set in an application-specific startup script,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   138
					or, for standAlone programs, by C-code during initialization.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   139
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   140
	HeadlessOperation               if true, a non-existing Display connection
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   141
			<Boolean>       will NOT lead to an error-exit during startup.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   142
					Default is false.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   143
					Can be set in an application-specific startup script,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   144
					or, for standAlone programs, by C-code during initialization.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   145
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   146
	LogDoits        <Boolean>       if true, doits are also logged in the changes
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   147
					file. Default is false, since the changes file
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   148
					may become huge if every tiny doIt is saved there ...
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   149
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   150
	LoadBinaries    <Boolean>       if true, we attempt to load classes rom a binary
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   151
					file, if present. If false, this is always suppressed.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   152
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   153
	SaveEmergencyImage <Boolean>    if true (the default), an emergency image
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   154
					is saved, if the main Display looses its
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   155
					connection. This is useful if you have a
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   156
					flaky display connection (serial line)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   157
					and want to have your stuff saved automatically
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   158
					in case of a broken connection.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   159
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   160
	IgnoreAssertions  <Boolean>     if true, assertions are ignored (i.e. no errors reported).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   161
					Usually false in the development system, true in a standalone deployed app.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
   162
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   163
    strictly private classVariables (helpers):
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   164
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   165
	CachedClasses   <Collection>    known classes (cached for faster class enumeration)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   166
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   167
	CachedAbbreviations
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   168
			<Dictionary>    className to filename mappings
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   169
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   170
	RealSystemPath  <Collection>    cached collection of directories along the path
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   171
					which really exist. Caching avoids long checks
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   172
					for existing directories on broken NFS volumes.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   173
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   174
	SourcePath      <Collection>    cached names of really existing directories
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   175
					These are remembered, as in NFS systems,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   176
	ResourcePath                    the time to lookup files may become long
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   177
	BinaryPath                      (especially, if some directories are on machines
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   178
	FileInPath                      which are not up ...).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   179
					Therefore, the set of really
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   180
					existing directories is cached when the SystemPath
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   181
					is walked the first time.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   182
					A consequence is that you have to invoke
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   183
					flushSystemPath, when you create any of those
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   184
					directories while running
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   185
					(and want the running ST/X to look there)
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   186
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
   187
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
   188
    [author:]
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   189
	Claus Gittinger
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   190
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   191
    [see also:]
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   192
	ObjectMemory
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   193
	StandaloneStartup
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   194
	GetOpt
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   195
	ReadEvalPrintLoop
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
   196
"
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   197
!
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   198
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   199
readme_resources
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   200
"
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   201
    What is a resource file:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   202
	resource files contain language transformation and sometimes
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   203
	UI-look specifics such as icons etc.
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   204
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   205
    Where are resources stored in the image:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   206
	Resource files are only read on demand (i.e. when needed) and only read once
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   207
	i.e. they are cached in the image).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   208
	The cached data is held in a per-class class-instVar named 'ClassResources'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   209
	With only a few exceptions, the only classes which need resources are the GUI
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   210
	classes under the SimpleView hierarchy.
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   211
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   212
    How does the system find resources:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   213
	The idea is that the system-provided resource files can be overwritten
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   214
	by the user or an application configuration.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   215
	This works via a hierarchy of directories where resources are searched for,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   216
	with the systems standard resource-files being at the end of that chain.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   217
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   218
	When searching for a resource file for class X, the following files are searched
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   219
	in order:
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   220
		{ResourcePath} / resources / X.rs
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   221
		{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   222
		{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   223
"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   224
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   225
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   226
!Smalltalk class methodsFor:'initialization'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   227
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   228
basicInitializeSystem
16180
ddb5cec2ab0b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16170
diff changeset
   229
    "initialize all other classes.
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   230
     This one is the very first entry into the smalltalk world
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   231
     [with error handling, via the initializeSystem],
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   232
     right after startup, usually immediately followed by Smalltalk>>start.
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   233
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   234
     Notice:
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   235
        this is NOT called when an image is restarted; in this
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   236
        case the show starts in Smalltalk>>restart."
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   237
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   238
    Compiler := ByteCodeCompiler.
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   239
    Compiler isNil ifTrue:[
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   240
        "
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   241
         ByteCodeCompiler is not in the system (i.e. has not been linked in)
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   242
         this allows at least immediate evaluations for runtime systems without compiler
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   243
         NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   244
        "
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   245
        Compiler := Parser
16164
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
   246
    ].
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   247
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   248
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   249
    "/ start catching SIGSEGV and SIGBUS
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   250
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   251
    OperatingSystem enableHardSignalInterrupts.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   252
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   253
    self initGlobalsFromEnvironment.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   254
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   255
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   256
    "/ sorry - there are some, which MUST be initialized before ..
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   257
    "/ reason: if any error happens during init, we need Signals, Stdout etc. to be there
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   258
    "/
15265
9a8afa1b41cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15225
diff changeset
   259
    SmallInteger initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   260
    Object initialize.
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   261
    UninterpretedBytes initialize.
16691
2a12b888e973 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16675
diff changeset
   262
    OperatingSystem initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   263
    Stream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   264
    PositionableStream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   265
    Filename initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   266
    ObjectMemory initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   267
    ExternalStream initialize.
12745
e944659a6a52 changed: #basicInitializeSystem
Claus Gittinger <cg@exept.de>
parents: 12744
diff changeset
   268
    ProcessorScheduler initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   269
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   270
    self initStandardStreams.    "/ setup Stdin, Stdout etc.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   271
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   272
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   273
    "/ sorry, path must be set before ...
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   274
    "/ reason: some classes need it during initialize (they might need resources, bitmaps etc)
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   275
    "/
17534
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
   276
    "/ but, on OSX we need the CharacterEncoder to be initialized
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
   277
    CharacterEncoder initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   278
    self initSystemPath.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   279
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   280
    "/
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   281
    "/ in case, someone needs the objectFileLoader early
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   282
    "/
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   283
    ObjectFileLoader notNil ifTrue:[
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   284
        ObjectFileLoader initialize.
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   285
    ].
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   286
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   287
    "/
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   288
    "/ now, finally, initialize all other classes
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   289
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   290
    self initializeModules.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   291
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   292
    ImageStartTime := Timestamp now.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   293
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   294
    self initInterrupts.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   295
    self initUserPreferences.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   296
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   297
    "/ just to make sure: if any prefs affect any resources,
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   298
    "/ flush them here, so they are reread in any case.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   299
    "/ required for some apps, for example to show the menu correctly (see launcher's help menu)
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   300
    ApplicationModel notNil ifTrue:[
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   301
        ApplicationModel flushAllClassResources.
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   302
    ].
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   303
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   304
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   305
    "/ give classes a chance to perform 2nd-level initialization
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   306
    "/ now, we are certain, that all other classes have been initialized
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   307
    "/ (especially: streams and signals can now be used)
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   308
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   309
    ObjectMemory changed:#initialized.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   310
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   311
    "Modified: / 08-01-1997 / 19:58:12 / stefan"
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   312
    "Modified: / 05-12-2006 / 21:48:58 / cg"
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   313
    "Modified: / 24-10-2012 / 18:45:15 / sr"
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   314
!
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   315
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   316
initGlobalsFromEnvironment
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   317
    "setup globals from the shell-environment"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   318
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   319
    |envString i langString terrString|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   320
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   321
    StandAlone isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   322
	StandAlone := false.
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   323
    ].
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
   324
    HeadlessOperation isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   325
	HeadlessOperation := false.
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
   326
    ].
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   327
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   328
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   329
     extract Language and LanguageTerritory from LANG variable.
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   330
     valid are for example:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   331
			    en_en / en
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   332
			    en_us
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   333
			    en_gb
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   334
			    de_de / de
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   335
			    de_at       (for Austria)
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   336
    "
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   337
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   338
    Language := #en.
994
6163ae7aaf9b territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   339
    LanguageTerritory := #us.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   340
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   341
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   342
    "Format of LANG is: language[_territory][.codeset][@modifier]
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   343
	language        ISO-639  Language code
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   344
	territory       ISO-3166 Contry code"
7779
6d88d32bdd64 Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents: 7763
diff changeset
   345
6d88d32bdd64 Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents: 7763
diff changeset
   346
    envString := OperatingSystem getLanguage.
3991
7b53bc45bf91 (isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   347
    envString size > 0 ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   348
	i := envString indexOf:$@.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   349
	(i ~~ 0) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   350
	    LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   351
	    envString := envString copyTo:(i - 1).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   352
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   353
	    LanguageModifier := nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   354
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   355
	i := envString indexOf:$..
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   356
	(i ~~ 0) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   357
	    LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   358
	    envString := envString copyTo:(i - 1).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   359
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   360
	    LanguageCodeset := #'iso8859-1'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   361
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   362
	i := envString indexOf:$_.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   363
	(i == 0) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   364
	    langString := envString.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   365
	    terrString := envString
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   366
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   367
	    langString := envString copyTo:(i - 1).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   368
	    terrString := envString copyFrom:(i + 1)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   369
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   370
	langString := langString asLowercase.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   371
	terrString := terrString asLowercase.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   372
	(langString = 'c' or:[terrString = 'c']) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   373
	    ('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   374
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   375
	    Language := langString asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   376
	    LanguageTerritory := terrString asSymbol
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   377
	]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   378
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   379
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   380
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   381
     Smalltalk initGlobalsFromEnvironment
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   382
    "
994
6163ae7aaf9b territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   383
14011
d33d2c6497f4 changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents: 13998
diff changeset
   384
    "Modified: / 14-02-2012 / 15:25:08 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   385
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   386
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   387
initInterrupts
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   388
    "initialize interrupts"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   389
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   390
    OperatingSystem enableUserInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   391
    OperatingSystem enableHardSignalInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   392
    OperatingSystem enableCrashSignalInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   393
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   394
    ObjectMemory userInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   395
    ObjectMemory signalInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   396
    ObjectMemory recursionInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   397
14805
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   398
    OperatingSystem isOSXlike ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   399
	"/ OSX sends SIGABRT for NSExceptions
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   400
	OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   401
	OperatingSystem enableAbortInterrupts.
14805
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   402
    ].
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   403
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   404
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   405
     Smalltalk initInterrupts
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   406
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   407
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   408
    "Modified: 20.8.1997 / 09:35:49 / stefan"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   409
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   410
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   411
initStandardStreams
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   412
    "initialize some well-known streams"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   413
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   414
    Stdout := NonPositionableExternalStream forStdout.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   415
    Stderr := NonPositionableExternalStream forStderr.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   416
    Stdin := NonPositionableExternalStream forStdin.
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   417
    PrinterStream notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   418
	Printer := PrinterStream defaultPrinter.
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   419
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   420
    Transcript := Stderr
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   421
963
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   422
    "
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   423
     Smalltalk initStandardStreams
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   424
    "
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   425
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   426
    "Modified: / 25-10-2006 / 17:36:46 / cg"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   427
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   428
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   429
initStandardTools
10646
39e8fbfed83c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10645
diff changeset
   430
    "predefine some tools which we might need later
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   431
     - if the view-classes exist,
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   432
       they will redefine Inspector and Debugger for graphical interfaces"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   433
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   434
    Display notNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   435
	InspectorView notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   436
	    Inspector := InspectorView
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   437
	].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   438
	DebugView notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   439
	    Debugger := DebugView
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   440
	].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   441
	"/ Display initialize
13303
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   442
    ].
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   443
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   444
    "/ make the changeFilePath an absolute one,
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   445
    "/ in case some stupid windows fileDialog changes the current directory...
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   446
    ObjectMemory
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   447
	nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   448
			    asAbsoluteFilename pathName
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   449
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   450
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   451
     Smalltalk initStandardTools
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   452
    "
13303
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   453
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   454
    "Modified: / 09-02-2011 / 20:44:47 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   455
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   456
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   457
initSystemPath
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   458
    "setup path where system files are searched for.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   459
     the default path is set to:
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   460
	    .
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   461
	    <directory of exe>       (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   462
	    $HOME                    (if defined)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   463
	    $HOME/.smalltalk         (if defined & existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   464
	    $SMALLTALK_LIBDIR        (if defined & existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   465
	    $STX_LIBDIR              (if defined & existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   466
	    $STX_TOPDIR              (if defined & existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   467
	    REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   468
	    REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir')                  (WIN32 only)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   469
	    <standard places>
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9020
diff changeset
   470
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9020
diff changeset
   471
     standard places (unix):
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   472
	    /opt/smalltalk/<release> (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   473
	    /opt/smalltalk           (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   474
	    /usr/local/lib/smalltalk (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   475
	    /usr/lib/smalltalk       (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   476
	    /lib/smalltalk           (if existing)
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   477
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   478
     win32:
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   479
	    \programs\exept\smalltalk (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   480
	    \programs\smalltalk       (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   481
	    \smalltalk                (if existing)
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   482
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   483
     vms:
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   484
	    $stx:lib                 (if existing)
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   485
	    $stx:root                (if existing)
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   486
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   487
     of course, it is possible to add entries from the 'smalltalk.rc'
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   488
     startup file; add expressions such as:
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   489
	    Smalltalk systemPath addFirst:'/foo/bar/baz'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   490
	or:
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   491
	    Smalltalk systemPath addLast:'/fee/foe/foo'.
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   492
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   493
     However, smalltalk.rc itself must be found along the above path.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   494
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   495
2928
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   496
    ChangeFileName := 'changes'.
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   497
    OperatingSystem isVMSlike ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   498
	BitmapDirName := 'bitmaps.dir'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   499
	BinaryDirName := 'binary.dir'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   500
	SourceDirName := 'source.dir'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   501
	ResourceDirName := 'resources.dir'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   502
	FileInDirName := 'filein.dir'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   503
	PackageDirName := 'packages.dir'.
2928
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   504
    ] ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   505
	BitmapDirName := 'bitmaps'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   506
	BinaryDirName := 'binary'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   507
	SourceDirName := 'source'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   508
	ResourceDirName := 'resources'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   509
	FileInDirName := 'fileIn'.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   510
	PackageDirName := 'packages'.
16234
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   511
    ].
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   512
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   513
    SystemPath isEmptyOrNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   514
	SystemPath := OperatingSystem defaultSystemPath.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   515
	self flushPathCaches
16234
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   516
    ].
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   517
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   518
    PackagePath isEmptyOrNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   519
	PackagePath := OperatingSystem defaultPackagePath.
5144
607e6fe053b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5140
diff changeset
   520
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   521
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   522
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   523
     Smalltalk initSystemPath
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   524
     Smalltalk systemPath
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   525
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   526
     OperatingSystem defaultSystemPath
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   527
     OperatingSystem defaultPackagePath
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   528
    "
5139
135e98726986 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5138
diff changeset
   529
5145
23bca61caa40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
   530
    "Modified: / 24.12.1999 / 00:23:35 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   531
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   532
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   533
initUserPreferences
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   534
    "setup other stuff"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   535
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   536
    LogDoits := false.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   537
    LoadBinaries := false.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   538
    SaveEmergencyImage := (StandAlone ~~ true).
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   539
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   540
    "Modified: / 24.10.1997 / 18:22:47 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   541
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   542
7526
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   543
initializeClass:aClass
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   544
    "sent from VM via #initializeModules"
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   545
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   546
    Error handle:[:ex |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   547
	ObjectMemory printStackBacktrace.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   548
	ClassesFailedToInitialize isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   549
	    ClassesFailedToInitialize := IdentitySet new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   550
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   551
	ClassesFailedToInitialize add:aClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   552
	('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   553
	ex suspendedContext fullPrintAll.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   554
	'------------------------------------------------' errorPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   555
	(Smalltalk commandLineArguments includes:'--debug') ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   556
	    ex reject
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   557
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   558
    ] do:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   559
	aClass initialize
13675
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   560
    ].
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   561
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   562
    "Modified: / 11-09-2011 / 17:01:32 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   563
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   564
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   565
initializeModules
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   566
    "perform module specific initialization and
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   567
     send #initialize to all classes.
16180
ddb5cec2ab0b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16170
diff changeset
   568
     Notice: this is NOT called when an image is restarted"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   569
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   570
    self initializeModulesOnce.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   571
    ClassesFailedToInitialize size > 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   572
	('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   573
	ClassesFailedToInitialize := nil.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   574
	self initializeModulesOnce.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   575
	ClassesFailedToInitialize size > 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   576
	    ('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   577
	]
10122
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   578
    ].
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   579
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   580
    ProjectDefinition initializeAllProjectDefinitions.
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   581
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   582
    "Modified: / 23-10-2006 / 16:40:39 / cg"
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   583
!
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   584
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   585
initializeModulesOnce
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   586
    "perform module specific initialization and
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   587
     send #initialize to all classes.
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   588
     Notice: this is not called when an image is restarted"
4963
308de981ea7d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4959
diff changeset
   589
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   590
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1682
diff changeset
   591
    __init_registered_modules__(3);
4963
308de981ea7d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4959
diff changeset
   592
1481
90a28fd060bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   593
    @global(DemoMode) = __getDemoMode() ? true : false;
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   594
    RETURN (self);
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   595
%}.
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   596
    ^ self primitiveFailed
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   597
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   598
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   599
initializeSystem
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   600
    "initialize all classes; setup dispatcher processes etc.
3499
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   601
     This one is the very first entry into the smalltalk world,
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   602
     right after startup, usually immediately followed by Smalltalk>>start.
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   603
     Here, a few specific initializations are done, then the actual initialization is
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   604
     done inside an error handler in basicInitializeSystem.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
   605
     Notice:
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   606
	this is NOT called when an image is restarted;
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   607
	in this case the show starts in Smalltalk>>restart."
211
58bb873aa83c *** empty log message ***
claus
parents: 202
diff changeset
   608
6841
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   609
    |idx|
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   610
12861
5086a864ae3e changed:
Claus Gittinger <cg@exept.de>
parents: 12813
diff changeset
   611
    NumberOfClassesHint := 10000.
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
   612
3499
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   613
    Initializing := true.
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   614
    AbstractOperatingSystem initializeConcreteClass.
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   615
5400
af8fdc4d3e02 kludge (for rel5)
Claus Gittinger <cg@exept.de>
parents: 5373
diff changeset
   616
    CommandLineArguments isNil ifTrue:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   617
	CommandLineArguments := #('stx').
5400
af8fdc4d3e02 kludge (for rel5)
Claus Gittinger <cg@exept.de>
parents: 5373
diff changeset
   618
    ].
4006
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   619
    CommandLine := CommandLineArguments copy.
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   620
    CommandLineArguments := CommandLineArguments asOrderedCollection.
6842
a5110421e4ab more for standAlone start
Claus Gittinger <cg@exept.de>
parents: 6841
diff changeset
   621
    CommandName := CommandLineArguments removeFirst. "/ the command
4006
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   622
4028
b46539f16af5 added --silentStartup argument
Claus Gittinger <cg@exept.de>
parents: 4026
diff changeset
   623
    SilentLoading := (CommandLineArguments includes:'--silentStartup').
13091
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   624
    VerboseLoading := (CommandLineArguments includes:'--verboseLoading').
348
claus
parents: 345
diff changeset
   625
6841
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   626
    DebuggingStandAlone := false.
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   627
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   628
    StandAlone ifTrue:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   629
	InfoPrinting := false.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   630
	ObjectMemory infoPrinting:false.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   631
	IgnoreAssertions := true.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   632
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   633
	idx := CommandLineArguments indexOf:'--debug'.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   634
	idx ~~ 0 ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   635
	    DebuggingStandAlone := true.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   636
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   637
	DebuggingStandAlone ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   638
	    Inspector := MiniInspector.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   639
	    Debugger := MiniDebugger.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   640
	    IgnoreAssertions := false.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   641
	].
6841
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   642
    ] ifFalse:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   643
	"/
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   644
	"/ define low-level debugging tools - graphical classes are not prepared yet
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   645
	"/ to handle things.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   646
	"/ This will bring us into the MiniDebugger when an error occurs during startup.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   647
	"/
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   648
	Inspector := MiniInspector.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   649
	Debugger := MiniDebugger.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   650
	IgnoreAssertions := false.
14432
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   651
    ].
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   652
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   653
    Error handle:[:ex |
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   654
	StandAlone ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   655
	    DebuggingStandAlone ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   656
		'Startup Error - use --debug command line argument for more info' errorPrintCR.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   657
		Smalltalk exit:1.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   658
	    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   659
	    'Startup Error' errorPrintCR.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   660
	    thisContext fullPrintAll.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   661
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   662
	ex reject.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   663
    ] do:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   664
	self basicInitializeSystem
14432
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   665
    ].
13091
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   666
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   667
    "Modified: / 12-10-2010 / 11:27:47 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   668
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   669
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   670
isInitialized
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   671
    "this returns true, if the system is properly initialized;
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   672
     i.e. false during startup.
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
   673
     Especially, the whole display/viewing stuff and process escheduling
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
   674
     is not working correctly until initialized."
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   675
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   676
    Initializing isNil ifTrue:[^ false]. "/ if called very early
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   677
    ^ Initializing not
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   678
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   679
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   680
reinitStandardStreams
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   681
    "reinitialize some well-known streams.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   682
     Tis must be done very early during startup, to allow for
477
8710aba7876b oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   683
     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
   684
     (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
   685
8710aba7876b oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   686
    Stdout reOpen. Stderr reOpen. Stdin reOpen.
161
ed36169f354d *** empty log message ***
claus
parents: 159
diff changeset
   687
! !
ed36169f354d *** empty log message ***
claus
parents: 159
diff changeset
   688
16593
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   689
!Smalltalk class methodsFor:'Compatibility-GNU'!
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   690
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   691
system:command
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   692
    "GNU-Smalltalk compatibility: execute an OS command"
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   693
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   694
    OperatingSystem executeCommand:command
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   695
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   696
    "
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   697
     Smalltalk system:'ls'
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   698
    "
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   699
! !
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   700
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   701
!Smalltalk class methodsFor:'Compatibility-Squeak'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   702
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   703
beep
17343
ed954add0878 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17328
diff changeset
   704
    "output an audible beep or bell"
ed954add0878 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17328
diff changeset
   705
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   706
    Screen current beep
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   707
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   708
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   709
garbageCollect
15009
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   710
    "for Squeak compatibility"
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   711
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   712
    ObjectMemory garbageCollect
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   713
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   714
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   715
garbageCollectMost
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   716
    "collect recently created garbage; return the amount of freeSpace.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   717
     In ST/X, only the newSpace is collected here, and the sum of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   718
     newSpace + freeListSpace is returned."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   719
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   720
    ObjectMemory scavenge.
15009
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   721
    ^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed)
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   722
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   723
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   724
isMorphic
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   725
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   726
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   727
10844
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   728
platformName
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   729
    "not yet fully implemented (I have to figure out, what squeak returns in each case...)"
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   730
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   731
    ^ OperatingSystem platformName asUppercaseFirst
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   732
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   733
    "
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   734
     Smalltalk platformName -> 'Win32'
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   735
    "
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   736
!
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   737
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   738
registerExternalObject: anObject
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   739
    "Register the given object in the external objects array and return its index.
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   740
     If it is already there, just return its index.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   741
     ExternalObjects are protected from GC and can be accessed easily from
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   742
     primitive code (via the global Smalltalk:SpecialObjectArray)"
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   743
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   744
    | objects firstEmptyIndex obj sz newObjects |
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   745
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   746
    objects := SpecialObjectArray.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   747
    objects isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   748
	objects := Array new:5.
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   749
    ].
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   750
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   751
    "find the first empty slot and look if already registered"
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   752
    firstEmptyIndex := 0.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   753
    1 to: objects size do: [:i |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   754
	obj := objects at: i.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   755
	obj == anObject ifTrue: [^ i].  "object already there, just return its index"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   756
	(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   757
	    firstEmptyIndex := i
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   758
	]
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   759
    ].
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   760
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   761
    "if no empty slots, expand the array"
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   762
    firstEmptyIndex = 0 ifTrue: [
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   763
	sz := objects size.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   764
	newObjects := objects species new: sz + 20.  "grow linearly"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   765
	newObjects replaceFrom: 1 to: sz with: objects startingAt: 1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   766
	firstEmptyIndex := sz + 1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   767
	SpecialObjectArray := newObjects.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   768
	objects := newObjects
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   769
    ].
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   770
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   771
    objects at: firstEmptyIndex put: anObject.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   772
    ^ firstEmptyIndex
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   773
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   774
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   775
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   776
removeClassNamed: aName
17576
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   777
    "Invoked from fileouts: if there is currently a class in the system named aName, then remove it.
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   778
     Also needed by the refactory browser.
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   779
     If anything untoward happens, report it in the Transcript."
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   780
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   781
    | oldClass |
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   782
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   783
    (oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   784
	Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   785
	^ self
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   786
    ].
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   787
    oldClass removeFromSystem
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   788
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   789
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   790
!Smalltalk class methodsFor:'Compatibility-V''Age'!
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   791
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   792
allClassesImplementing:aSelector
12304
b0dc1c58de1a changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents: 12301
diff changeset
   793
    ^ self allClassesForWhich:[:cls | cls includesSelector:aSelector].
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
   794
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
   795
    "Modified: / 10-08-2006 / 12:12:17 / cg"
9090
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   796
!
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   797
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   798
declareConstant:constantName poolName:poolNameArg value:value
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   799
    "visualAge compatible pool variable declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   800
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   801
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   802
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   803
    |ns poolName pool|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   804
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   805
    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   806
    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   807
    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   808
    (ns isNil or:[ns == Smalltalk]) ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   809
	poolName := poolNameArg asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   810
    ] ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   811
	poolName := (ns name,'::',poolNameArg) asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   812
    ].
9090
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   813
    pool := self classNamed:poolName.
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   814
    pool declareConstant:constantName value:value
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   815
!
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   816
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   817
declarePoolDictionary:poolDictionaryNameArg
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   818
    "visualAge compatible pool declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   819
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   820
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   821
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   822
    |ns poolName|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   823
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   824
    poolName := poolDictionaryNameArg asSymbol.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   825
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   826
"/    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   827
"/    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   828
"/    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   829
"/    (ns isNil or:[ns == Smalltalk]) ifTrue:[
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   830
"/        poolName := poolDictionaryNameArg asSymbol
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   831
"/    ] ifFalse:[
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   832
"/        poolName := (ns name,'::',poolDictionaryNameArg) asSymbol
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   833
"/    ].
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   834
    ^ SharedPool subclass:(poolName asSymbol)
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   835
	instanceVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   836
	classVariableNames:''
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   837
	poolDictionaries:''
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   838
	category:'* VAST Pools'
13998
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   839
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   840
    "Modified: / 07-02-2012 / 15:56:16 / cg"
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   841
!
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   842
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   843
declareVariable:varName poolName:poolNameArg
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   844
    "visualAge compatible pool declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   845
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   846
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   847
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   848
    |ns poolName pool|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   849
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   850
    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   851
    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   852
    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   853
    (ns isNil or:[ns == Smalltalk]) ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   854
	poolName := poolNameArg asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   855
    ] ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   856
	poolName := (ns name,'::',poolNameArg) asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   857
    ].
13998
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   858
    pool := self classNamed:poolName.
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   859
    pool declareVariable:varName
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   860
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   861
    "Created: / 07-02-2012 / 15:57:05 / cg"
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   862
! !
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   863
7295
9ddb9543e369 category
Claus Gittinger <cg@exept.de>
parents: 7290
diff changeset
   864
!Smalltalk class methodsFor:'Compatibility-VW5.4'!
6094
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   865
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   866
defineClass:nameSymbol superclass:superclass indexedType:indexed private:private instanceVariableNames:instVars classInstanceVariableNames:classInstVars imports:imports category:category
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   867
    ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   868
	defineClass:nameSymbol
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   869
	superclass:superclass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   870
	indexedType:indexed
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   871
	private:private
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   872
	instanceVariableNames:instVars
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   873
	classInstanceVariableNames:classInstVars
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   874
	imports:imports
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   875
	category:category
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   876
	attributes:nil
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   877
!
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   878
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   879
defineClass:nameSymbol superclass:superclass indexedType:indexed private:private instanceVariableNames:instVars classInstanceVariableNames:classInstVars imports:imports category:category attributes:annotations
6094
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   880
    |newClass|
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   881
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   882
    indexed == #none ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   883
	newClass := superclass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   884
	    subclass:nameSymbol
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   885
	    instanceVariableNames:instVars
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   886
	    classVariableNames:''
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   887
	    poolDictionaries:''
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   888
	    category:category
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   889
	    inEnvironment:self.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   890
	classInstVars size > 0 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   891
	    newClass class instanceVariableNames:classInstVars.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   892
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   893
	^ newClass
6851
91662dfb3e80 Remove debug print.
Stefan Vogel <sv@exept.de>
parents: 6849
diff changeset
   894
    ].
91662dfb3e80 Remove debug print.
Stefan Vogel <sv@exept.de>
parents: 6849
diff changeset
   895
    self shouldImplement.
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   896
!
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   897
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   898
defineNameSpace:nameSymbol private:private imports:imports category:category
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   899
    |newNameSpace|
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   900
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   901
    private ifTrue:[self halt].     "/ what to do ?
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   902
    imports withoutSeparators notEmpty ifTrue:[self halt].     "/ what to do ?
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   903
    newNameSpace := NameSpace name:nameSymbol.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   904
    newNameSpace setCategory:category.
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   905
    ^ newNameSpace
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   906
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   907
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   908
!Smalltalk class methodsFor:'accessing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   909
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   910
associationAt:aKey
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   911
    "return a key-value association for aKey.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   912
     Since ST/X's Smalltalk as no real dictionary, this is
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   913
     simulated here."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   914
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   915
    |val|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   916
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   917
    val := self at:aKey ifAbsent:nil.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   918
    val isNil ifTrue:[^ nil].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   919
    ^ Association key:aKey value:val
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   920
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   921
    "Created: / 1.11.1997 / 13:27:20 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   922
!
3083
451912c492ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
   923
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   924
associationAt:aKey ifAbsent:exceptionBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   925
    "return a key-value association for aKey, or the value
3610
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   926
     from exceptionBlock, if no such key is present.
14973
086ef2bb2007 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14933
diff changeset
   927
     Since ST/X's Smalltalk as no real dictionary, this is simulated here.
086ef2bb2007 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14933
diff changeset
   928
     Warning: this is a comatibility interface only, with a different semantic as
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   929
	      the original ST80 implementation. The returned assoc is created on the fly,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   930
	      and not the one stored in the receiver (there are not assocs there)"
3610
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   931
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   932
    |val|
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   933
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   934
    val := self at:aKey ifAbsent:nil.
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   935
    val isNil ifTrue:[^ exceptionBlock value].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   936
    ^ Association key:aKey value:val
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   937
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   938
    "Created: / 18.6.1998 / 17:05:24 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   939
!
3610
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
   940
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   941
at:aKey
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
   942
    "retrieve the value stored under aKey, a symbol.
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
   943
     Return nil if not present
1956
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
   944
     (this will be changed to trigger an error - better use #at:ifAbsent:)"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   945
16831
596e07380f6f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16803
diff changeset
   946
    aKey class == Symbol ifFalse:[self error:'expected symbol'].
6080
15ea3cbf6003 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
   947
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   948
%{  /* NOCONTEXT */
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   949
    RETURN ( __GLOBAL_GET(aKey) );
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   950
%}.
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   951
    ^ self primitiveFailed
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   952
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   953
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   954
at:aKey ifAbsent:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   955
    "retrieve the value stored at aKey.
7565
cd76db5ee5cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7564
diff changeset
   956
     If there is nothing stored under this key, return the value of
cd76db5ee5cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7564
diff changeset
   957
     the evaluation of aBlock."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   958
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   959
    (self includesKey:aKey) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   960
	^ self at:aKey
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   961
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   962
    ^ aBlock value
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   963
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   964
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   965
     Smalltalk at:#fooBar                       <- returns nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   966
     Smalltalk at:#fooBar ifAbsent:['sorry']    <- no error
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   967
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   968
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
   969
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   970
at:aKey ifAbsentPut:aBlock
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   971
    "return the element indexed by aKey if present,
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   972
     if not present, store the result of evaluating valueBlock
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   973
     under aKey and return it."
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   974
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   975
    ^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ].
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   976
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   977
    "Created: / 29-05-2007 / 12:41:12 / cg"
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   978
!
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
   979
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   980
at:aKey ifPresent:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   981
    "try to retrieve the value stored at aKey.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   982
     If there is nothing stored under this key, do nothing.
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   983
     Otherwise, evaluate aBlock, passing the retrieved value as argument."
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   984
13883
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
   985
    |val|
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
   986
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   987
    (self includesKey:aKey) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   988
	(val := self at:aKey) notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   989
	    ^ aBlock value:val
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   990
	]
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   991
    ].
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   992
    ^ nil
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   993
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
   994
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   995
     Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   996
     Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   997
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   998
13883
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
   999
    "Modified: / 27-12-2011 / 10:14:30 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1000
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1001
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1002
at:aKey put:aValue
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1003
    "store the argument aValue under aKey, a symbol.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1004
     Return aValue (sigh)."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1005
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1006
    |oldValue|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1007
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1008
%{
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1009
    oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0);
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1010
%}.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1011
    CachedClasses notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1012
	oldValue isBehavior ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1013
	    oldValue name == aKey ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1014
		CachedClasses remove:oldValue ifAbsent:[]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1015
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1016
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1017
	aValue isBehavior ifTrue:[
1956
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1018
"/            aValue isMeta ifTrue:[
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1019
"/                "/ this should not happen
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1020
"/                ('SMALLTALK: store a Metaclass: ' , aValue name , ' as ' , aKey) infoPrintCR.
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1021
"/            ].
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1022
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1023
	    aValue name == aKey ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1024
		CachedClasses add:aValue
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1025
	    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1026
		CachedClasses := nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1027
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1028
	].
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1029
    ].
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  1030
    ^ aValue.
1955
276d4ce9b40e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1945
diff changeset
  1031
"/
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1032
"/%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1033
"/    (void) __GLOBAL_SET(aKey, aValue, (OBJ *)0);
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1034
"/%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1035
"/    CachedClasses := nil.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1036
"/    ^ aValue
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1037
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1038
    "Modified: 19.4.1996 / 11:31:49 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1039
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1040
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1041
includesKey:aKey
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1042
    "return true, if the key is known"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1043
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1044
    "/ for debugging - this is a common mistake,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1045
    "/ to try to access a class by nameString, instead
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1046
    "/ of by symbol.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1047
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1048
    "/ aKey class == String ifTrue:[self halt].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1049
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1050
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1051
    RETURN ( __GLOBAL_KEYKNOWN(aKey) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1052
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1053
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1054
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1055
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1056
keyAtValue:anObject
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1057
    "return the symbol under which anObject is stored - or nil"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1058
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1059
    self keysDo:[:aKey |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1060
	(self at:aKey) == anObject ifTrue:[^ aKey]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1061
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1062
    ^ nil
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1063
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1064
    "Smalltalk keyAtValue:Object"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1065
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1066
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1067
keys
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1068
    "return a collection with all keys in the Smalltalk dictionary"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1069
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1070
    |keys|
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1071
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1072
    keys := IdentitySet new.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1073
    self keysDo:[:k | keys add:k].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1074
    ^ keys
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1075
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1076
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1077
removeKey:aKey
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1078
    "remove the association stored under the key-argument from the globals dictionary.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1079
     WARNING:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1080
	this is somewhat dangerous: conceptionally, the association is removed,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1081
	to which machine & byte compiled code refers if it accesses a global.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1082
	If there are still global accesses in some literalArray or from machine-compiled code,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1083
	it continues to reference the globals value via that obsolete association and gets a nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1084
	value.  (which is correct)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1085
	However, if that global is later reintroduced, a new association will be created and
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1086
	the new global now referenced via the new association.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1087
	The old accesses will still see nil, although the globals value is actually non-nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1088
	(this is questionable).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1089
	To avoid this problem, the #removeClass: method never removed the key."
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1090
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1091
    CachedClasses := nil.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1092
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1093
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1094
    RETURN ( __GLOBAL_REMOVE(aKey) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1095
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1096
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1097
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1098
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1099
10538
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1100
startBlocks
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1101
    ^ StartBlocks
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1102
!
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1103
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1104
values
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1105
    "return a collection with all values in the Smalltalk dictionary"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1106
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1107
    |values|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1108
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1109
    values := OrderedCollection new.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1110
    self do:[:v | values add:v].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1111
    ^ values
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1112
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1113
    "Created: 20.6.1997 / 16:58:28 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1114
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1115
13540
37ff6f12f224 changed: #start
Claus Gittinger <cg@exept.de>
parents: 13539
diff changeset
  1116
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1117
!Smalltalk class methodsFor:'browsing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1118
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1119
browseAllCallsOn:aSelectorSymbol
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1120
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1121
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1122
    "startup a browser for all methods sending a particular message"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1123
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1124
    UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1125
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1126
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1127
     Smalltalk browseAllCallsOn:#at:put:
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1128
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1129
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1130
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1131
browseAllSelect:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1132
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1133
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1134
    "startup a browser for all methods for which aBlock returns true"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1135
6020
555c690e6616 UserPreference access
Claus Gittinger <cg@exept.de>
parents: 5940
diff changeset
  1136
    UserPreferences systemBrowserClass browseAllSelect:aBlock
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1137
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1138
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1139
     Smalltalk browseAllSelect:[:m | m literals isNil]
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1140
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1141
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1142
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1143
browseChanges
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1144
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1145
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1146
    "startup a changes browser"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1147
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1148
    ChangesBrowser notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1149
	ChangesBrowser open
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1150
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1151
	self warn:'no ChangesBrowser built in'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1152
    ]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1153
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1154
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1155
     Smalltalk browseChanges
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1156
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1157
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1158
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1159
browseClass:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1160
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1161
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  1162
    "startup a browser on aClass.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1163
     The broser will only show that class (i.e. be a singleClass-browser).
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1164
     See browseInClass: for a full browser, which has aClass selected initially."
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1165
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1166
    UserPreferences systemBrowserClass browseClass:aClass
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1167
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1168
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1169
     Smalltalk browseClass:Array
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1170
    "
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1171
!
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1172
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1173
browseImplementorsMatching:aSelectorSymbolOrMatchPattern
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1174
    "{ Pragma: +optSpace }"
6819
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1175
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1176
    "startup a browser for all methods implementing a message matching"
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1177
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1178
    UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1179
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1180
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1181
     Smalltalk browseImplementorsOf:#'at:put:'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1182
     Smalltalk browseImplementorsMatching:#'at:*'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1183
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1184
!
6819
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1185
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1186
browseImplementorsOf:aSelectorSymbol
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1187
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1188
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1189
    "startup a browser for all methods implementing a particular message"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1190
6020
555c690e6616 UserPreference access
Claus Gittinger <cg@exept.de>
parents: 5940
diff changeset
  1191
    UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1192
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1193
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1194
     Smalltalk browseImplementorsOf:#at:put:
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1195
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1196
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1197
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1198
browseInClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1199
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1200
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1201
    "startup a full browser showing aClass.
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1202
     The browser will be a full browser with aClass initially selekted.
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1203
     See browseClass: for a singleClass browser, which shows only a single class."
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1204
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1205
    UserPreferences systemBrowserClass openInClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1206
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1207
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1208
     Smalltalk browseInClass:Array
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1209
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1210
!
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1211
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1212
browseInClass:aClass selector:selector
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1213
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1214
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1215
    "startup a full browser showing aClass>>selector.
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1216
     The browser will be a full browser with aClass initially selekted.
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1217
     See browseClass: for a singleClass browser, which shows only a single class."
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1218
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1219
    UserPreferences systemBrowserClass openInClass:aClass selector:selector
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1220
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1221
    "
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1222
     Smalltalk browseInClass:Array selector:#at:
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1223
    "
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1224
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1225
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1226
!Smalltalk class methodsFor:'class management'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1227
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1228
changeCategoryOf:aClass to:newCategory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1229
    "change a classes category, add a change record,
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1230
     send change notifications"
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1231
8405
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1232
    |ns oldCategory|
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1233
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1234
    oldCategory := aClass category.
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1235
    oldCategory ~= newCategory ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1236
	aClass category:(newCategory withoutSeparators asSymbol).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1237
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1238
	"notify change of category"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1239
	ns := aClass environment ? self.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1240
	ns changed:#organization with:(aClass -> oldCategory).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1241
	ns ~~ self ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1242
	    self changed:#organization with:(aClass -> oldCategory).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1243
	]
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1244
    ].
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1245
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1246
    "
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1247
     Smalltalk changeCategoryOf:NewApplication to:#myApplications
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1248
    "
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1249
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1250
    "Modified: / 11.2.2000 / 11:36:27 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1251
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1252
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1253
defineNameSpace: name private: private imports: imports category: category attributes: annotations
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1254
    NameSpace name:name
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1255
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1256
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1257
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1258
flushCachedClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1259
    CachedClasses notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1260
	CachedClasses remove:aClass ifAbsent:[].
12700
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1261
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1262
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1263
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1264
flushCachedClasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1265
    CachedClasses := nil.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1266
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1267
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1268
     Smalltalk flushCachedClasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1269
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1270
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1271
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1272
removeClass:aClass
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1273
    "remove the argument, aClass from the smalltalk dictionary;
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1274
     we have to flush the caches since these methods are now void.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1275
     Also, class variables of aClass are removed."
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1276
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1277
    |sym cSym names oldName oldNameSym actualName wrongName ns ons|
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1278
4099
f6984fc5cb6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4096
diff changeset
  1279
    aClass isNil ifTrue:[^ self].
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1280
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1281
    oldName := aClass name.
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1282
    sym := oldNameSym := oldName asSymbol.
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1283
    ((self at:oldNameSym) == aClass) ifFalse:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1284
        "check other name ..."
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1285
        (self includes:aClass) ifFalse:[
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1286
            'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1287
            ^ self
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1288
        ].
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1289
        "
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1290
         the class has changed its name - without telling me ...
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1291
         what should be done in this case ?
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1292
        "
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1293
        'Smalltalk [warning]: class ' errorPrint. oldName errorPrint.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1294
        ' has changed its name' errorPrintCR.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1295
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1296
        "/
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1297
        "/ might be an alias (i.e. removing a compatibility name)
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1298
        "/
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1299
        actualName := self keyAtValue:aClass.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1300
        ('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1301
        sym := actualName asSymbol.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1302
        oldName := actualName asString.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1303
        wrongName := true.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1304
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1305
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1306
    ns := aClass nameSpace.
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1307
    aClass topOwningClass notNil ifTrue:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1308
        ons := aClass topOwningClass nameSpace
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1309
    ].
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1310
    aClass isBuiltInClass ifTrue:[ 
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1311
        self error: 'Cannot remove builtin class!!'.        
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1312
    ].
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1313
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1314
    self at:sym put:nil.    "nil it out for compiled accesses"
878
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1315
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1316
    "/
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1317
    "/ see comment in removeKey: on why we dont remove it here
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1318
    "/
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1319
    "/ self removeKey:sym.     "/ remove key - this actually fails, if there are
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1320
                               "/ still compiled code references."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1321
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1322
    "remove private classes"
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1323
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1324
    aClass privateClassesSorted do:[:somePrivateClass |
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1325
        aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil.
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1326
    ].
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1327
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1328
    "remove class variables"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1329
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1330
    names := aClass classVariableString asCollectionOfWords.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1331
    names do:[:name |
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1332
        cSym := aClass globalKeyForClassVar:name.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1333
        self at:cSym asSymbol put:nil.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1334
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1335
        "/
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1336
        "/ see comment in removeKey: on why we dont remove it here
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1337
        "/
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1338
        "/ self removeKey:cSym
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1339
    ].
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1340
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1341
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1342
"/    actually could get along with less flushing
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1343
"/    (entries for aClass and subclasses only)
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1344
"/    but we have to delay this, until we have the set of subclasses
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1345
"/    at hand - for now, searching for all subclasses is way more
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1346
"/    expensive then cache flushing.
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1347
"/
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1348
"/    aClass allSubclassesDo:[:aSubclass |
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1349
"/        ObjectMemory flushInlineCachesForClass:aSubclass.
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1350
"/        ObjectMemory flushMethodCacheFor:aSubclass
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1351
"/    ].
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1352
"/    ObjectMemory flushInlineCachesForClass:aClass.
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1353
"/    ObjectMemory flushMethodCacheFor:aClass
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1354
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1355
    ObjectMemory flushInlineCaches.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1356
    ObjectMemory flushMethodCache.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1357
7181
7382117bf3fa james' package changes
james
parents: 7126
diff changeset
  1358
    aClass addChangeRecordForClassRemove.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1359
    self changed:#classRemove with:aClass.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1360
7581
6912a7336e15 class category: sends a change notification;
Claus Gittinger <cg@exept.de>
parents: 7572
diff changeset
  1361
    aClass setCategory:#'* removed *'.
1655
fb6ee1b55ec4 use *-categories
Claus Gittinger <cg@exept.de>
parents: 1650
diff changeset
  1362
12700
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1363
"/    self flushCachedClasses.
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1364
"/    Class flushSubclassInfo.
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1365
    self flushCachedClass:aClass.
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1366
    Class flushSubclassInfoFor:aClass superclass.
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1367
    Class flushSubclassInfoFor:aClass.
5326
8950253bef78 flush subclass info when removing classes
ca
parents: 5322
diff changeset
  1368
3627
452f2e1ff1b4 removeClass - care for aliases.
Claus Gittinger <cg@exept.de>
parents: 3626
diff changeset
  1369
    wrongName == true ifTrue:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1370
        "/
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1371
        "/ an alias (i.e. removing a compatibility name)
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1372
        "/
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1373
        "/ check if there are more refs to it ...
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1374
        [self includes:aClass] whileTrue:[
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1375
            actualName := self keyAtValue:aClass.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1376
            ('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1377
                          , ' - remove that binding too.') infoPrintCR.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1378
            self at:actualName put:nil.
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1379
        ].
4724
44793fe70787 recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1380
    ].
44793fe70787 recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1381
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1382
    ns ~~ Smalltalk ifTrue:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1383
        ons notNil ifTrue:[
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1384
            ClassBuilder
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1385
                recompileGlobalAccessorsTo:oldNameSym
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1386
                in:ons
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1387
                except:nil
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1388
        ].
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1389
        (ns notNil and:[ns ~~ ons]) ifTrue:[
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1390
            ClassBuilder
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1391
                recompileGlobalAccessorsTo:oldNameSym
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1392
                in:ns
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1393
                except:nil
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1394
        ].
10182
bcb8791d473b code reuse
Claus Gittinger <cg@exept.de>
parents: 10173
diff changeset
  1395
    ].
bcb8791d473b code reuse
Claus Gittinger <cg@exept.de>
parents: 10173
diff changeset
  1396
bcb8791d473b code reuse
Claus Gittinger <cg@exept.de>
parents: 10173
diff changeset
  1397
    "Modified: / 18-11-2006 / 17:16:31 / cg"
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  1398
    "Modified: / 20-04-2015 / 17:20:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1399
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1400
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1401
renameClass:aClass to:newName
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1402
    "rename aClass to newName. Most of the work is in
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1403
     renaming the classVariables (create & copy over values)
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1404
     and patching the classes methods to access the new variables."
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1405
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1406
    |oldName oldSym newSym names oldCVSym newCVSym value oldNameToNewName
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1407
     oldNameSpace newNameSpace oldBaseName newBaseName privateClasses
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1408
     oldBaseNameWithoutPrefix newBaseNameWithoutPrefix i1 i2 nm ns subns
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1409
     oldMetaclass newMetaclass newCategory|
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1410
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1411
    "/ check for all intermediate namespaces / owning classes
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1412
    i1 := 1.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1413
    i2 := 1.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1414
    ns := self.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1415
    [i2 ~~ 0] whileTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1416
	i2 := newName indexOfSubCollection:'::' startingAt:i1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1417
	i2 ~~ 0 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1418
	    nm := newName copyFrom:i1 to:i2-1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1419
	    ns isNameSpace ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1420
		subns := ns at:nm asSymbol ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1421
		subns isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1422
		    self error:'Nonexisting namespace: ',nm.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1423
		    ^ nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1424
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1425
	    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1426
		subns := ns privateClassesAt:nm asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1427
		subns isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1428
		    self error:'Cannot create a namespace below a class'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1429
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1430
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1431
	    ns := subns.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1432
	    i1 := i2 + 2.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1433
	].
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1434
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1435
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1436
    oldName := aClass name.
6734
dd9fa2d81cb9 use #topNameSpace
Claus Gittinger <cg@exept.de>
parents: 6722
diff changeset
  1437
    oldNameSpace := aClass topNameSpace.
2319
640bb389f90a recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents: 2317
diff changeset
  1438
    oldBaseName := aClass nameWithoutNameSpacePrefix.
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1439
    oldBaseNameWithoutPrefix := aClass nameWithoutPrefix.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1440
    oldSym := oldName asSymbol.
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1441
    privateClasses := aClass privateClassesSorted.
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1442
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1443
    ((self at:oldSym) ~~ aClass) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1444
	'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1445
	^ self
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1446
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1447
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1448
    "/ rename the class
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1449
1847
6e567214b167 care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents: 1758
diff changeset
  1450
    newSym := newName asSymbol.
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1451
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1452
    "/ change the owning class
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1453
    ns isNameSpace ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1454
	aClass isPrivate ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1455
	    aClass class setOwningClass:ns.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1456
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1457
	    "/ sigh - must make a PrivateMetaclass from Metaclass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1458
	    oldMetaclass := aClass class.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1459
	    newMetaclass := PrivateMetaclass new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1460
	    newMetaclass flags:(oldMetaclass flags).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1461
	    newMetaclass setSuperclass:(oldMetaclass superclass).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1462
	    newMetaclass instSize:(oldMetaclass instSize).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1463
	    newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1464
	    newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1465
	    newMetaclass setSoleInstance:aClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1466
	    newMetaclass setOwningClass:ns.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1467
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1468
	    aClass changeClassTo:newMetaclass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1469
	    ObjectMemory flushCaches.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1470
	]
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1471
    ] ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1472
	aClass isPrivate ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1473
	    newCategory := aClass topOwningClass category.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1474
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1475
	    "/ sigh - must make a Metaclass from PrivateMetaclass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1476
	    oldMetaclass := aClass class.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1477
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1478
	    newMetaclass := Metaclass new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1479
	    newMetaclass flags:(oldMetaclass flags).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1480
	    newMetaclass setSuperclass:(oldMetaclass superclass).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1481
	    newMetaclass instSize:(oldMetaclass instSize).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1482
	    newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1483
	    newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1484
	    newMetaclass setSoleInstance:aClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1485
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1486
	    aClass category:newCategory.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1487
	    aClass changeClassTo:newMetaclass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1488
	    ObjectMemory flushCaches.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1489
	]
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1490
    ].
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1491
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1492
    aClass setName:newSym.
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1493
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1494
    "/ store it in Smalltalk
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1495
    self at:oldSym put:nil.
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1496
878
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1497
    "/
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1498
    "/ see comment in #removeKey: on why we dont remove it it here
878
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1499
    "/
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1500
    "/ self removeKey:oldSym.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1501
    self at:newSym put:aClass.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1502
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1503
    "/ create new class variables and copy over values
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1504
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1505
    oldNameToNewName := IdentityDictionary new.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1506
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1507
    names := aClass classVariableString asCollectionOfWords.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1508
    names do:[:name |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1509
	oldCVSym := (oldSym , ':' , name) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1510
	value := self at:oldCVSym.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1511
	self at:oldCVSym put:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1512
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1513
	"/
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1514
	"/ see comment in #removeKey: on why we dont remove it it here
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1515
	"/
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1516
	"/ self removeKey:cSym.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1517
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1518
	newCVSym := (newSym , ':' , name) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1519
	self at:newCVSym put:value.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1520
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1521
	oldNameToNewName at:oldCVSym put:newCVSym.
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1522
    ].
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1523
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1524
    "/ patch methods literal arrays from oldCVname to newCVname
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1526
    oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1527
	aClass withAllSubclasses do:[:aSubClass |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1528
	    Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1529
	    aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1530
		aMethod changeLiteral:oldNameSym to:newNameSym
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1531
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1532
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1533
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1534
	"/ and also in privateClasses ? ...
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1535
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1536
"/        privateClasses size > 0 ifTrue:[
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1537
"/            privateClasses do:[:aPrivateClass |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1538
"/                aPrivateClass withAllSubclasses do:[:aSubClass |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1539
"/                    aSubClass class methodDictionary do:[:aMethod |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1540
"/                        aMethod changeLiteral:oldNameSym to:newNameSym
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1541
"/                    ].
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1542
"/                    aSubClass methodDictionary do:[:aMethod |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1543
"/                        aMethod changeLiteral:oldNameSym to:newNameSym
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1544
"/                    ]
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1545
"/                ].
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1546
"/            ]
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1547
"/        ]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1548
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1549
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1550
    aClass addChangeRecordForClassRename:oldSym to:newSym.
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1551
5333
d80386e06d21 rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  1552
    "/ clear the namespace (for namespace query to work)
d80386e06d21 rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  1553
    aClass setEnvironment:nil.
6734
dd9fa2d81cb9 use #topNameSpace
Claus Gittinger <cg@exept.de>
parents: 6722
diff changeset
  1554
    newNameSpace := aClass topNameSpace.
2405
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1555
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1556
    privateClasses size > 0 ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1557
	"/ must rename privateClasses as well
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1558
	Class withoutUpdatingChangesDo:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1559
	    privateClasses do:[:aPrivateClass |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1560
		self renameClass:aPrivateClass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1561
		     to:(newSym , '::' , aPrivateClass nameWithoutPrefix).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1562
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1563
		Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1564
		aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1565
		aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1566
		aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1567
		aClass theMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol.
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1568
"/                ClassBuilder
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1569
"/                    recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1570
"/                    in:newNameSpace
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1571
"/                    except:nil.
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1572
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1573
	]
2405
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1574
    ].
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1575
2319
640bb389f90a recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents: 2317
diff changeset
  1576
    oldNameSpace ~~ newNameSpace ifTrue:[
5246
2ca7b20c4108 create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents: 5214
diff changeset
  1577
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1578
	"/ all those referencing the class from the old nameSpace
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1579
	"/ must be recompiled ...
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1580
	"/ (to now access the global from smalltalk)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1581
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1582
	oldNameSpace ~~ Smalltalk ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1583
	    Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1584
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1585
	    ClassBuilder
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1586
		recompileGlobalAccessorsTo:oldName asSymbol
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1587
		in:oldNameSpace
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1588
		except:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1589
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1590
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1591
	"/ all referencing the class in the new namespace
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1592
	"/ as well; to now access the new class.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1593
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1594
	(newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1595
	    Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1596
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1597
	    ClassBuilder
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1598
		recompileGlobalAccessorsTo:oldBaseName asSymbol
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1599
		in:newNameSpace
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1600
		except:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1601
	].
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1602
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1603
	"/ all references to a global with my new name in my owning class
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1604
	"/ must now be redirected to myself.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1605
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1606
	aClass isPrivate ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1607
	    newBaseName := aClass nameWithoutNameSpacePrefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1608
	    newBaseNameWithoutPrefix := aClass nameWithoutPrefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1609
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1610
	    Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1611
	    aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1612
	    aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1613
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1614
	    Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1615
	    aClass owningClass recompileMethodsAccessingGlobal:oldBaseName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1616
	    aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1617
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1618
	    Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1619
	    aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1620
	    aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1621
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1622
	    Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1623
	    aClass owningClass recompileMethodsAccessingGlobal:newBaseName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1624
	    aClass owningClass class recompileMethodsAccessingGlobal:newBaseName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1625
	]
4040
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1626
    ].
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1627
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1628
    aClass changed:#definition.
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1629
    "/ because of the change of my superclasses name ...
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1630
    aClass allSubclassesDo:[:subClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1631
	subClass changed:#definition.
7996
facae0a118da when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents: 7992
diff changeset
  1632
    ].
facae0a118da when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents: 7992
diff changeset
  1633
    "/ because of the change of my superclasses name ...
facae0a118da when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents: 7992
diff changeset
  1634
    aClass subclassesDo:[:subClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1635
	subClass addChangeRecordForClass:subClass.
4040
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1636
    ].
5613
b534e427f028 change message when renaming a class
Claus Gittinger <cg@exept.de>
parents: 5611
diff changeset
  1637
    self changed:#definition.
14611
5c3a6b7ed01d class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14589
diff changeset
  1638
    self changed:#classRename with:(Array with:aClass with:oldName).
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1639
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1640
    "Created: / 29-10-1995 / 19:58:32 / cg"
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1641
    "Modified: / 18-06-1996 / 14:20:50 / stefan"
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1642
    "Modified: / 05-09-2006 / 12:52:25 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1643
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1644
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1645
!Smalltalk class methodsFor:'copying'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1646
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1647
deepCopy
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1648
    "redefined to return self - there is only one Smalltalk dictionary"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1649
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1650
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1651
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1652
    "Modified: 18.5.1996 / 12:13:33 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1653
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1654
10952
16d46611f7ae deepCopy change
ab
parents: 10904
diff changeset
  1655
deepCopyUsing:aDictionary postCopySelector:postCopySelector
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1656
    "return a deep copy of the receiver.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1657
     Redefined to return the receiver - there is only one Smalltalk dictionary"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1658
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1659
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1660
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1661
    "Modified: 18.5.1996 / 12:13:36 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1662
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1663
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1664
shallowCopy
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1665
    "redefined to return self - there is only one Smalltalk dictionary"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1666
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1667
    ^ self
1410
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1668
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1669
    "Modified: 18.5.1996 / 12:13:39 / cg"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1670
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1671
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1672
simpleDeepCopy
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1673
    "redefined to return self - there is only one Smalltalk dictionary"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1674
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1675
    ^ self
1410
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1676
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1677
    "Modified: 18.5.1996 / 12:13:42 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1678
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1679
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1680
!Smalltalk class methodsFor:'debugging ST/X'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1681
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1682
compileTrace:aBoolean
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1683
    "dump generated inline code (NOOP if VM was compiled without the trace-debug option)"
7325
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1684
%{
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1685
    extern char __compileTrace__;
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1686
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1687
    __compileTrace__ = (aBoolean == true) ? 1 : 0;
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1688
%}
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1689
    "
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1690
     Smalltalk compileTrace:true
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1691
     Smalltalk compileTrace:false
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1692
    "
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1693
!
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1694
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1695
debugBreakPoint
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1696
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1697
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1698
    "call the dummy debug function, on which a breakpoint
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1699
     can be put in adb, sdb, dbx or gdb.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1700
     WARNING: this method is for debugging only
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1701
	      it will be removed without notice."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1702
%{
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1703
    __PATCHUPCONTEXTS(__context);
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1704
    __debugBreakPoint__();
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1705
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1706
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1707
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1708
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1709
exitWithCoreDump
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1710
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1711
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1712
    "abort program and dump core"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1713
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1714
    OperatingSystem exitWithCoreDump
4096
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1715
    "/ never returns
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1716
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1717
    "Be careful evaluating this
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1718
     Smalltalk exitWithCoreDump
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1719
    "
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1720
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1721
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1722
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1723
fatalAbort
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1724
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1725
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1726
    "report a fatal-error, print a stack backtrace and exit with core dump.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1727
     (You may turn off the stack print with debugPrinting:false)"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1728
%{
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1729
    __fatal0(__context, "fatalAbort");
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1730
    /* NEVER RETURNS */
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1731
%}.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1732
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1733
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1734
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1735
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1736
fatalAbort:aMessage
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1737
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1738
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1739
    "report a fatal-error; print a stack backtrace and exit with core dump
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1740
     (You may turn off the stack print with debugPrinting:false)"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1741
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1742
%{
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1743
    char *msg;
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1744
12481
805176d238d2 change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 12413
diff changeset
  1745
    if (__isStringLike(aMessage))
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1746
	msg = (char *) __stringVal(aMessage);
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1747
    else
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1748
	msg = "fatalAbort";
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1749
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1750
    __fatal0(__context, msg);
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1751
    /* NEVER RETURNS */
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1752
%}.
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1753
    ^ self primitiveFailed
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5427
diff changeset
  1754
!
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5427
diff changeset
  1755
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1756
ignoreHalt
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1757
    "return true, if halts are ignored.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1758
     Usually, this is done in standAlone applications"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1759
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1760
    IgnoreHalt isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1761
	^  self isStandAloneApp
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1762
    ].
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1763
    ^ IgnoreHalt
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1764
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1765
    "Created: / 18-11-2010 / 11:20:16 / cg"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1766
!
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1767
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1768
ignoreHalt:aBoolean
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1769
    "control if halts are to be ignored;
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1770
     usually, this is done in standAlone applications"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1771
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1772
    IgnoreHalt := aBoolean
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1773
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1774
    "
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1775
     Smalltalk ignoreHalt:true.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1776
     self halt.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1777
     Smalltalk ignoreHalt:false.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1778
     self halt.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1779
    "
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1780
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1781
    "Created: / 18-11-2010 / 11:20:27 / cg"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1782
!
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1783
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1784
vmInstructionTrace:aBoolean
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  1785
    self halt:'not yet implemented'
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  1786
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  1787
    "Modified: / 19-01-2012 / 10:15:35 / cg"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1788
! !
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1789
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1790
!Smalltalk class methodsFor:'enumerating'!
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1791
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1792
allBehaviorsDo:aBlock
5580
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  1793
    "evaluate the argument, aBlock for all classes and metaclasses in the system"
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  1794
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  1795
    self allClassesAndMetaclassesDo:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1796
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1797
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  1798
     Smalltalk allBehaviorsDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1799
    "
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1800
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1801
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1802
allClassCategories
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1803
    "return a set of all class categories in the system"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1804
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1805
    |allCategories|
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  1806
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  1807
    allCategories := Set new.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1808
    Smalltalk allClassesDo:[:cls |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1809
	|category|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1810
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1811
	category := cls category.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1812
	category notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1813
	    allCategories add:category.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1814
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1815
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1816
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1817
    ^ allCategories.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1818
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1819
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1820
     Smalltalk allClassCategories
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1821
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1822
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1823
    "Created: / 17.11.2001 / 12:13:09 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1824
!
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  1825
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1826
allClassesAndMetaclassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1827
    "evaluate the argument, aBlock for all classes and metaclasses in the system."
5579
26af506d271e added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents: 5550
diff changeset
  1828
5940
804fb27727a6 oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
  1829
    |already|
804fb27727a6 oops - allClassesAndMetaclassesDo: evaluated block twice for
Claus Gittinger <cg@exept.de>
parents: 5916
diff changeset
  1830
12861
5086a864ae3e changed:
Claus Gittinger <cg@exept.de>
parents: 12813
diff changeset
  1831
    already := IdentitySet new:NumberOfClassesHint*2.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1832
    self allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1833
	|cls|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1834
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1835
	cls := eachClass theNonMetaclass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1836
	(already includes:cls) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1837
	    aBlock value:cls.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1838
	    already add:cls.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1839
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1840
	cls := cls class.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1841
	(already includes:cls) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1842
	    aBlock value:cls.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1843
	    already add:cls.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1844
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1845
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1846
!
5579
26af506d271e added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents: 5550
diff changeset
  1847
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1848
allClassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1849
    "evaluate the argument, aBlock for all classes in the system."
5580
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  1850
5765
152a485288d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5760
diff changeset
  1851
    self allClasses do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1852
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1853
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  1854
     Smalltalk allClassesDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1855
    "
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1856
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1857
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1858
allClassesForWhich:filter
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1859
    "return a collection with all classes in the system,
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1860
     for which filter evaluates to true."
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1861
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1862
    |collectedClasses|
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1863
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1864
    collectedClasses := OrderedCollection new.
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1865
    self allClassesForWhich:filter do:[:cls |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1866
	collectedClasses add:cls
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1867
    ].
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1868
    ^ collectedClasses
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1869
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1870
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1871
     Smalltalk
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1872
	allClassesForWhich:[:cls | cls name startsWith:'Po']
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1873
    "
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1874
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1875
    "Created: / 10-08-2006 / 12:11:31 / cg"
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1876
!
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1877
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1878
allClassesForWhich:filter do:aBlock
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1879
    "evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true."
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1880
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1881
    self allClassesDo:[:cls |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1882
	(filter value:cls) ifTrue:[ aBlock value:cls ].
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1883
    ].
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1884
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1885
    "
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1886
     Smalltalk
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1887
	allClassesForWhich:[:cls | cls name startsWith:'Po']
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1888
	do:[:aClass | Transcript showCR:aClass name]
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1889
    "
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1890
!
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  1891
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1892
allClassesInCategory:aCategory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1893
    "return a collection of for all classes in aCategory;
1299
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1894
     The order of the classes is not defined."
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1895
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1896
    ^ self allClassesForWhich:[:cls | cls category = aCategory]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1897
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1898
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1899
     Smalltalk allClassesInCategory:'Views-Basic'
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1900
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1901
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1902
    "Modified: / 10-08-2006 / 12:13:32 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1903
!
1299
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  1904
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1905
allClassesInCategory:aCategory do:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1906
    "evaluate the argument, aBlock for all classes in the aCategory;
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1907
     The order of the classes is not defined."
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1908
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1909
    aCategory notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1910
	self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1911
    ]
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1912
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1913
    "
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1914
     Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass]
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1915
    "
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1916
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1917
    "Modified: / 09-08-2006 / 17:18:50 / fm"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1918
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1919
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1920
allClassesInCategory:aCategory inOrderDo:aBlock
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1921
    "evaluate the argument, aBlock for all classes in aCategory;
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1922
     superclasses come first - then subclasses"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1923
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1924
    |classes|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1925
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1926
    aCategory notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1927
	classes := OrderedCollection new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1928
	self allClassesInCategory:aCategory do:[:aClass |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1929
	    classes add:aClass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1930
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1931
	classes topologicalSort:[:a :b | b isSubclassOf:a].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1932
	classes do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1933
    ]
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1934
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1935
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  1936
     Smalltalk allClassesInCategory:'Views-Basic' inOrderDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1937
    "
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  1938
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  1939
    "Modified: / 17.11.2001 / 12:18:15 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1940
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1941
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1942
allClassesInOrderDo:aBlock
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1943
    "evaluate the argument, aBlock for all classes in the system;
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1944
     Evaluation order is by inheritance: superclasses come first."
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1945
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1946
    |already|
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1947
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  1948
    already := IdentitySet new:NumberOfClassesHint.
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  1949
    self allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1950
	(already includes:eachClass) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1951
	    eachClass allSuperclasses reverseDo:[:eachSuperClass |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1952
		(already includes:eachSuperClass) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1953
		    already add:eachSuperClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1954
		    aBlock value:eachSuperClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1955
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1956
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1957
	    already add:eachClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1958
	    aBlock value:eachClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  1959
	]
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  1960
    ].
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  1961
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  1962
    "
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  1963
     Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name]
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1964
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1965
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1966
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1967
allClassesInPackage:aPackageID
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1968
    "evaluate the argument, aBlock for all classes a package;
10087
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  1969
     The order of the classes is not defined.
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  1970
     The returned collection may include private classes"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1971
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1972
    ^ self allClassesForWhich:[:cls | cls package = aPackageID]
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1973
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1974
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1975
     Smalltalk allClassesInPackage:'bosch:dapasx'
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1976
    "
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1977
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1978
    "Created: / 10-08-2006 / 12:14:10 / cg"
10087
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  1979
    "Modified: / 12-10-2006 / 23:48:43 / cg"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1980
!
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  1981
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1982
allClassesInPackage:aPackageID do:aBlock
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1983
    "evaluate the argument, aBlock for all classes a package;
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1984
     The order of the classes is not defined."
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1985
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1986
    ^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1987
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1988
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1989
     Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass]
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1990
    "
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1991
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1992
    "Created: / 09-08-2006 / 17:14:17 / fm"
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1993
!
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  1994
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1995
allKeysDo:aBlock
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1996
    "evaluate the argument, aBlock for all keys in the Smalltalk dictionary"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1997
17385
0d98fa1e74ff class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17369
diff changeset
  1998
    self keysDo:aBlock
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1999
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2000
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2001
allMethodCategories
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2002
    "return a set of all method-categories (protocols) in the system"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2003
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2004
    |allCategories|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2005
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2006
    allCategories := Set new.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2007
    Smalltalk allClassesDo:[:cls |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2008
	allCategories addAll:cls categories.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2009
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2010
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2011
    ^ allCategories.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2012
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2013
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2014
     Smalltalk allMethodCategories
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2015
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2016
!
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
  2017
9259
7480ca3bdca9 allMethodsDo: utility
Claus Gittinger <cg@exept.de>
parents: 9254
diff changeset
  2018
allMethodsDo:aBlock
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2019
    "enumerate all methods in all classes"
12000
21c4d24bdd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11977
diff changeset
  2020
9259
7480ca3bdca9 allMethodsDo: utility
Claus Gittinger <cg@exept.de>
parents: 9254
diff changeset
  2021
    Smalltalk allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2022
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2023
	    aBlock value:mthd
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2024
	]
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2025
    ].
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2026
!
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2027
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2028
allMethodsForWhich:aBlock
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2029
    "return a collection of methods for which aBlock returns true"
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2030
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2031
    |coll|
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2032
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2033
    coll := OrderedCollection new.
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2034
    Smalltalk allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2035
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2036
	    (aBlock value:mthd) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2037
		coll add:mthd
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2038
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2039
	]
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2040
    ].
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2041
    ^ coll
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2042
!
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2043
12300
e72e90ea410f changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents: 12299
diff changeset
  2044
allMethodsWithSelectorDo:aTwoArgBlock
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2045
    "enumerate all methods in all classes and evaluate aBlock
12300
e72e90ea410f changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents: 12299
diff changeset
  2046
     with method and selector as arguments."
12299
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2047
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2048
    Smalltalk allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2049
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2050
	    aTwoArgBlock value:mthd value:sel
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2051
	]
12299
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2052
    ].
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2053
!
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2054
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2055
associationsDo:aBlock
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2056
    "evaluate the argument, aBlock for all key/value pairs
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2057
     in the Smalltalk dictionary"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2058
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2059
    self keysDo:[:aKey |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2060
	aBlock value:(aKey -> (self at:aKey))
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2061
    ]
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2062
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2063
    "Smalltalk associationsDo:[:assoc | assoc printCR]"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2064
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2065
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2066
basicKeys
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2067
    "for rel > 5 only"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2068
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2069
    self primitiveFailed
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2070
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2071
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2072
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2073
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2074
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2075
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2076
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2077
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2078
do:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2079
    "evaluate the argument, aBlock for all values in the Smalltalk dictionary"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2080
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2081
    |work|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2082
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2083
%{  /* NOREGISTER - work may not be placed into a register here */
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1682
diff changeset
  2084
    __GLOBALS_DO(&aBlock, &work);
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2085
    RETURN (self);
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2086
%}.
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2087
    self keysDo:[:aKey |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2088
	aBlock value:(self at:aKey)
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2089
    ]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2090
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2091
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2092
keysAndValuesDo:aBlock
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2093
    "evaluate the two-arg block, aBlock for all keys and values"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2094
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2095
    self keysDo:[:aKey |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2096
	aBlock value:aKey value:(self at:aKey)
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2097
    ]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2098
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2099
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2100
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2101
    |collected|
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2102
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2103
    collected := OrderedCollection new.
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2104
    self keysAndValuesDo:[:eachKey :eachValue |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2105
	(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2106
	    collected add:(collectBlockWith2Args value:eachKey value:eachValue)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2107
	].
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2108
    ].
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2109
    ^ collected
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2110
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2111
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2112
     Smalltalk
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2113
	keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2114
	thenCollect:[:nm :val | nm]
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2115
    "
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2116
!
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2117
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2118
keysDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2119
    "evaluate the argument, aBlock for all keys in the Smalltalk dictionary"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2120
    |work|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2121
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2122
%{  /* NOREGISTER - work may not be placed into a register here */
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1682
diff changeset
  2123
    __GLOBALKEYS_DO(&aBlock, &work);
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2124
    RETURN (self);
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2125
%}.
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2126
    self basicKeys do:[:aKey |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2127
	aBlock value:aKey
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2128
    ]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2129
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2130
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2131
!Smalltalk class methodsFor:'message control'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2132
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2133
silentLoading
12408
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2134
    "returns the Silentloading class variable, which globally controls if compilation
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2135
     messages are shown on the transcript during a fileIn."
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2136
10355
b1cb807fd03c Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents: 10329
diff changeset
  2137
     ^ SilentLoading ? false
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2138
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2139
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2140
silentLoading:aBoolean
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2141
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2142
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2143
    "allows access to the Silentloading class variable, which controls
12408
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2144
     messages (especially during fileIn) onto the transcript.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2145
     You can save a snapshot with this flag set to true, which makes
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2146
     the image come up silent. Can also be set, to read in files unlogged."
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2147
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2148
    |prev|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2149
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2150
    prev := SilentLoading.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2151
    SilentLoading := aBoolean.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2152
    ^ prev
12409
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2153
!
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2154
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2155
silentlyLoadingDo:aBlock
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2156
    "evaluates aBlock with silent loading on - no compilation messages (except errors)
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2157
     are shown on the transcript"
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2158
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2159
    |sav|
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2160
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2161
    sav := SilentLoading.
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2162
    SilentLoading := true.
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2163
    aBlock ensure:[ SilentLoading := sav ].
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2164
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2165
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2166
!Smalltalk class methodsFor:'misc accessing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2167
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2168
beHeadless:aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2169
    "set/clear the headlessOperation flag."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2170
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2171
    HeadlessOperation := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2172
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2173
10231
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2174
beSTScript:aBoolean
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2175
    "set/clear the isSTScript flag."
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2176
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2177
    IsSTScript := aBoolean
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2178
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2179
    "Created: / 06-12-2006 / 16:43:36 / cg"
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2180
!
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2181
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2182
standAloneApp:aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2183
    "set/clear the StandAlone flag."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2184
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2185
    StandAlone := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2186
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2187
18197
d3430ee24e46 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17588
diff changeset
  2188
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2189
!Smalltalk class methodsFor:'private-system management-packages'!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2190
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2191
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2192
    "load a package referenced by aPackageString - a string like 'stx:libbasic'.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2193
     The package is either located in packageDirOrStringOrNil, or in the current directory (if nil).
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2194
     Answer true, if the load succeeded, false if it failed"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2195
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2196
    |packageDirOrNil "shLibName"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2197
     binaryClassLibraryFilename projectDefinitionFilename projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2198
     loadOK "exePath" errorInInitialize|
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2199
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2200
    packageDirOrStringOrNil notNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2201
	packageDirOrNil := packageDirOrStringOrNil asFilename.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2202
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2203
    VerboseLoading ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2204
	silent := false
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2205
    ] ifFalse:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2206
	silent := (SilentLoading or:[ StandAlone ]) or:[ InfoPrinting not ].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2207
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2208
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2209
    "For now: have to read the project definition first!!
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2210
     The class library may contain subclasses of classes in prerequisite packages -
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2211
     so the prerequisite packages have to be loaded first"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2212
    "normally there is a project definiton, use that one to pull in the rest"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2213
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2214
    "maybe, it is already in the image"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2215
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2216
    (projectDefinitionClass notNil and:[projectDefinitionClass supportedOnPlatform not]) ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2217
	^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2218
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2219
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2220
    "Is there a shared library (.dll or .so) ?"
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2221
    binaryClassLibraryFilename := ObjectFileLoader
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2222
				    binaryClassFilenameForPackage:aPackageString
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2223
				    inDirectory:packageDirOrNil.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2224
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2225
    (binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2226
	|loadErrorOccurred|
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2227
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2228
	loadErrorOccurred := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2229
	ObjectFileLoader objectFileLoadErrorNotification handle:[:ex |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2230
	    loadErrorOccurred := true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2231
	    ex proceedWith:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2232
	] do:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2233
	    loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2234
	    "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2235
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2236
	(loadOK and:[loadErrorOccurred not]) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2237
	    silent ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2238
		Transcript showCR:('loaded package: ' , aPackageString , ' from binary classLib file: ' , binaryClassLibraryFilename pathName).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2239
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2240
	    "now, all compiled classes have been loaded.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2241
	     keep classes in the package which are autoloaded as autoloaded."
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2242
	    ^ true
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2243
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2244
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2245
	loadErrorOccurred ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2246
	    self breakPoint:#cg.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2247
	    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2248
	    projectDefinitionClass notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2249
		projectDefinitionClass supportedOnPlatform ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2250
		    "/ load prerequisites...
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2251
		    projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2252
		    self breakPoint:#cg.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2253
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2254
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2255
	].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2256
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2257
    packageDirOrNil isNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2258
	^ PackageNotFoundError raiseRequestWith:aPackageString.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2259
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2260
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2261
    "fallback - go through the project definition"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2262
    projectDefinitionClass isNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2263
	projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2264
	"/ try to load the project definition class
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2265
	projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2266
	projectDefinitionFilename exists ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2267
	    projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2268
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2269
	projectDefinitionFilename exists ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2270
	    Class withoutUpdatingChangesDo:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2271
		Smalltalk silentlyLoadingDo:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2272
		    Error handle:[:ex |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2273
			"/ catch error during initialization;
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2274
			ex suspendedContext withAllSendersDo:[:sender |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2275
			    sender selector == #initialize ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2276
				sender receiver isBehavior ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2277
				    sender receiver name = projectDefinitionClassName ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2278
					errorInInitialize := true
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2279
				    ]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2280
				]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2281
			    ]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2282
			].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2283
			errorInInitialize ifFalse:[ ex reject ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2284
		    ] do:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2285
			projectDefinitionFilename fileIn.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2286
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2287
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2288
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2289
	    errorInInitialize ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2290
		Transcript showCR:'Smalltalk [info]: an error happened in #initialize - retry after loading package.'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2291
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2292
	    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2293
	].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2294
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2295
    projectDefinitionClass notNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2296
	projectDefinitionClass autoload.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2297
	projectDefinitionClass supportedOnPlatform ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2298
	    ^ PackageNotCompatibleError raiseRequestWith:aPackageString errorString:' - package is not compatible with this platform'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2299
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2300
	projectDefinitionClass loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2301
	somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2302
	errorInInitialize ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2303
	    Transcript showCR:('Smalltalk [info]: retrying #initialize').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2304
	    projectDefinitionClass initialize.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2305
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2306
	(silent not and:[somethingHasBeenLoaded]) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2307
	    Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2308
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2309
	^ true.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2310
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2311
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2312
    "/ source files-file loading no longer supported
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2313
    "/ however, allow for autoload-stub loaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2314
    doLoadAsAutoloaded ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2315
	self
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2316
	    recursiveInstallAutoloadedClassesFrom:packageDirOrNil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2317
	    rememberIn:(Set new)
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2318
	    maxLevels:2
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2319
	    noAutoload:false
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2320
	    packageTop:packageDirOrNil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2321
	    showSplashInLevels:0.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2322
	^ true
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2323
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2325
    ^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2326
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2327
    "
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2328
     Smalltalk loadPackageWithId:'stx:libbasic'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2329
     Smalltalk loadPackageWithId:'stx:goodies/persistency'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2330
     Smalltalk loadPackageWithId:'exept:ctypes'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2331
    "
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2332
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2333
    "Modified: / 29-07-2011 / 19:55:35 / cg"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2334
!
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2335
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2336
loadExtensionsForPackage:aPackageId
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2337
    | extensionsLoaded |
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2338
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2339
    extensionsLoaded := false.
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2340
    ProgrammingLanguage allDo:[:lang|
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2341
	extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: lang)
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2342
    ].
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2343
    ^ extensionsLoaded
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2344
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2345
    "Modified: / 18-02-2007 / 11:03:26 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2346
    "Modified: / 02-01-2010 / 10:43:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2347
    "Modified (format): / 04-09-2011 / 09:19:24 / cg"
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2348
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2349
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2350
loadExtensionsForPackage:aPackageId language: language
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  2351
    |mgr packageDirName inStream projectDefinition extensionsFilename mod dir
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2352
     extensionsRevisionString extensionsRevisionInfo|
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2353
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2354
    language supportsExtensionMethods ifFalse:[^false].
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2355
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2356
    packageDirName := aPackageId copyReplaceAll:$: with:$/.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2357
    packageDirName := self getPackageFileName:packageDirName.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2358
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2359
    (packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2360
	(self loadExtensionsFromDirectory:packageDirName language: language) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2361
	    ^ true.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2362
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2363
	packageDirName := nil.  "do not try again"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2364
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2365
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2366
    "
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2367
     if there is a sourceCodeManager, ask it first for the extensions
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2368
    "
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2369
    (Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2370
	mgr := AbstractSourceCodeManager managerForPackage: aPackageId
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2371
    ].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2372
    mgr notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2373
	extensionsFilename := 'extensions.' , language sourceFileSuffix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2374
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2375
	projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2376
	projectDefinition notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2377
	    mod := aPackageId asPackageId module.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2378
	    dir := aPackageId asPackageId directory.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2379
	    extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2380
	    extensionsRevisionString notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2381
		extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2382
		extensionsRevisionInfo notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2383
		    extensionsRevisionInfo fileName = extensionsFilename ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2384
			"JV@2011-10-23: following condition is never satisfied for
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2385
			 filed-in packages. The whole scheme of extensionVersion_XXX
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2386
			 works ONLY for compiled packages as it depends on fact, that
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2387
			 extension Init() routine is called AFTER all classes are inited,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2388
			 therefore the extensionVersion_XXX methods from extensions.st
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2389
			 overwrites methods coming from package definition class. All this
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2390
			 is so tricky and error prone, that we have to come up with better
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2391
			 solution!!"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2392
			packageDirName notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2393
			    ^ self loadExtensionsFromDirectory:packageDirName language: language
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2394
			] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2395
			    ^ false
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2396
			]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2397
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2398
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2399
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2400
	    SourceCodeManagerError handle:[:ex |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2401
	    ] do:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2402
		inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2403
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2404
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2405
	inStream isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2406
	    SourceCodeManagerError handle:[:ex |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2407
	    ] do:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2408
		inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2409
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2410
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2411
	inStream notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2412
	    Class withoutUpdatingChangeSetDo:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2413
		inStream fileIn.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2414
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2415
	    inStream close.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2416
	    VerboseLoading ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2417
		Transcript showCR:('loaded extensions for ',aPackageId,' from repository').
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2418
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2419
	    ^ true
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2420
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2421
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2422
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2423
    packageDirName notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2424
	^ self loadExtensionsFromDirectory:packageDirName language: language
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2425
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2426
    ^ false
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2427
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2428
    "Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2429
    "Modified: / 19-03-2011 / 10:03:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  2430
    "Modified: / 04-11-2011 / 13:41:29 / cg"
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2431
    "Modified: / 23-10-2011 / 19:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2432
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2433
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2434
loadExtensionsFromDirectory:packageDirOrString
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2435
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2436
    | extensionsLoaded |
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2437
    extensionsLoaded := false.
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2438
    ProgrammingLanguage allDo:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2439
	[:lang|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2440
	extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: lang)].
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2441
    ^extensionsLoaded
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2442
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2443
    "Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2444
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2445
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2446
loadExtensionsFromDirectory:packageDirOrString language: language
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2447
    |packageDir f|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2448
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2449
    packageDir := packageDirOrString asFilename.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2450
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2451
    f := packageDir / ('extensions.' , language sourceFileSuffix).
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2452
    f exists ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2453
	Class withoutUpdatingChangeSetDo:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2454
	    f fileIn.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2455
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2456
	VerboseLoading ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2457
	    Transcript showCR:('loaded extensions: ' , f pathName).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2458
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2459
	^ true
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2460
    ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2461
    ^ true"/false
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2462
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2463
    "Created: / 02-01-2010 / 10:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  2464
    "Modified: / 04-11-2011 / 13:41:19 / cg"
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2465
    "Modified: / 31-01-2013 / 11:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2466
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2467
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2468
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2469
    "make certain, that some particular package is loaded into the system.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2470
     Return true on success, false otherwise."
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2471
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2472
    |packageId packageString packageDir def sourceCodeManager|
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2473
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2474
    packageString := aPackageStringArg.
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2475
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2476
    "/ a little convenience: so you can stx packages with loadPackage:'goodies/soap'
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2477
    (packageString includes:$:) ifFalse:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2478
	packageString := 'stx:',packageString.
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2479
    ].
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2480
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2481
    "if I am here, so must my package"
14892
77c2f020de5d class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14890
diff changeset
  2482
    packageString = self package ifTrue:[^ true].
13129
0ac3f6a28aaf changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents: 13120
diff changeset
  2483
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2484
    packageId := aPackageStringArg asPackageId.
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2485
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2486
    "/ if there is a projectDefinition, let it load itself...
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2487
    def := packageId projectDefinitionClass.
14833
c718848b1051 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14810
diff changeset
  2488
    (def notNil and:[def isLoaded]) ifTrue:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2489
	def loadAsAutoloaded:doLoadAsAutoloaded.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2490
	^ true.
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2491
    ].
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2492
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2493
    packageDir := self packageDirectoryForPackageId:packageId.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2494
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2495
    [
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2496
	self
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2497
	    loadPackage:packageString
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2498
	    fromDirectory:packageDir
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2499
	    asAutoloaded:doLoadAsAutoloaded.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2500
    ] on:PackageLoadError do:[:ex|
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2501
	AbstractSourceCodeManager notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2502
	    sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2503
	    sourceCodeManager notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2504
		^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2505
	    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2506
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  2507
	ex reject.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2508
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2509
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2510
    ^ true
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2511
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2512
    "
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2513
     Smalltalk loadPackageWithId:'stx:libbasic'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2514
     Smalltalk loadPackageWithId:'stx:goodies/persistency'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2515
     Smalltalk loadPackageWithId:'exept:ctypes'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2516
    "
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2517
13129
0ac3f6a28aaf changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents: 13120
diff changeset
  2518
    "Modified: / 16-11-2010 / 17:42:49 / cg"
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2519
!
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2520
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2521
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2522
    "load all source files found in aDirectory and treat them like
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2523
     a package. Allows for initial import of alien ST-code as a new package.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2524
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2525
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2526
    |p t new anyFail repeatCount|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2527
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2528
    "/ problem: dependencies.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2529
    "/ solution: repeat twice, so that superclasses are present the second time
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2530
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2531
    Class packageQuerySignal answer:packageId asSymbol do:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2532
	|any|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2533
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2534
	repeatCount := 0.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2535
	[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2536
	    repeatCount := repeatCount + 1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2537
	    anyFail := false.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2538
	    aDirectory directoryContents do:[:file |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2539
		|fn|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2540
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2541
		fn := aDirectory / file.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2542
		(fn hasSuffix:'st') ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2543
		    Metaclass confirmationQuerySignal answer:false
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2544
		    do:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2545
			Error
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2546
			    handle:[:ex |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2547
				anyFail := true
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2548
			    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2549
			    do:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2550
				(self fileIn:fn) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2551
				    anyFail := true
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2552
				] ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2553
				    any := true.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2554
				]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2555
			    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2556
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2557
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2558
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2559
	    any ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2560
		^ false "/ no file found
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2561
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2562
	] doWhile:[anyFail and:[repeatCount<2]].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2563
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2564
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2565
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2566
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2567
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2568
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2569
    p directory:aDirectory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2570
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2571
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2572
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2573
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2574
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2575
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2576
    new ifTrue:[Project addLoadedProject:p].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2577
    anyFail ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2578
	^ PackageLoadError raiseRequestWith:packageId.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2579
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2580
    ^ true
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2581
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2582
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2583
loadPackage:packageId fromClassLibrary:aFilename
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2584
    "load a package from a compiled classLib.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2585
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2586
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2587
    |p t new|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2588
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2589
    (self fileIn:aFilename) ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2590
	(self fileInClassLibrary:aFilename) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2591
	    ^ false.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2592
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2593
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2594
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2595
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2596
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2597
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2598
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2599
    p directory:aFilename directory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2600
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2601
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2602
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2603
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2604
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2605
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2606
    new ifTrue:[Project addLoadedProject:p].
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2607
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2608
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2609
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2610
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2611
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2612
    "load a package referenced by aPackageString - a string like 'stx:libbasic'.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2613
     The package is either located in packageDirOrStringOrNil, or in the current directory (if nil).
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2614
     Answer true, if the load succeeded, false if it failed"
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2615
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2616
    |ret|
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2617
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2618
    PackageLoadInProgressQuery
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2619
	answerNotifyLoading:aPackageString asSymbol
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2620
	do:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2621
	    ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2622
	].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2623
    ^ ret
17350
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2624
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2625
    "
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2626
     Smalltalk loadPackage:'stx:goodies/communication'
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2627
    "
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2628
!
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2629
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2630
loadPackage:packageId fromLoadAllFile:aFilename
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2631
    <resource: #obsolete>
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2632
    "load a package from a loadAll - loader script.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2633
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2634
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2635
    |p t new|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2636
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2637
    Metaclass confirmationQuerySignal answer:false
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2638
    do:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2639
	(self fileIn:aFilename) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2640
	    self warn:'Failed to load the package ', packageId printString.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2641
	    ^ false.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2642
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2643
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2644
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2645
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2646
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2647
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2648
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2649
    p directory:aFilename directory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2650
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2651
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2652
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2653
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2654
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2655
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2656
    new ifTrue:[Project addLoadedProject:p].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2657
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2658
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2659
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2660
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2661
    "load a package from a .zip delivery file.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2662
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2663
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2664
    ^ PackageLoadError
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2665
	raiseRequestWith:aPackageId
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2666
	errorString:' - package loading from zip is not yet implemented'.
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2667
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2668
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2669
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2670
    <resource: #obsolete>
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2671
    |abbrevFile packageDir|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2672
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2673
    packageDir := self packageDirectoryForPackageId:aPackageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2674
    packageDir isNil ifTrue:[^ false].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2675
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2676
    "/ abbrev.stc ?
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  2677
    abbrevFile := packageDir / 'abbrev.stc'.
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2678
    abbrevFile exists ifFalse:[^ false].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2679
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2680
    Smalltalk installAutoloadedClassesFrom:abbrevFile pathName.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2681
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2682
    doLoadAsAutoloaded ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2683
	"/ force autoloading...
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2684
	Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2685
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2686
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2687
    self loadExtensionsFromDirectory:packageDir.
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  2688
    VerboseLoading ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2689
	Transcript showCR:('loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName).
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2690
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2691
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2692
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  2693
    "Modified: / 04-11-2011 / 13:43:29 / cg"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2694
! !
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2695
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2696
!Smalltalk class methodsFor:'queries'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2697
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2698
allClasses
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2699
    "return an unordered collection of all classes in the system.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2700
     Only globally anchored classes are returned
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2701
     (i.e. anonymous ones have to be aquired by Behavior allSubInstances)"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2702
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2703
    |classes|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2704
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2705
    "/ you may wonder, what this while is for, here ...
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2706
    "/ the reason is that if we modify the class hierarchy in
4067
732848627915 comment
Claus Gittinger <cg@exept.de>
parents: 4048
diff changeset
  2707
    "/ another view (background fileIn), while building up the
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2708
    "/ cachedClasses set, this may be flushed (invalidated) by the
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2709
    "/ other process in the meanwhile.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2710
    "/ If that happens, we restart the set-building here
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2711
    "/
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2712
    [(classes := CachedClasses) isNil] whileTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2713
	CachedClasses := classes := IdentitySet new:NumberOfClassesHint.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2714
	self keysAndValuesDo:[:eachName :eachGlobal |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2715
	    (eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2716
		"/ sigh - would like to skip over aliases
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2717
		"/ but this cannot be done simply by comparing
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2718
		"/ the classes name against the store-key
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2719
		"/ i.e. cannot do:
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2720
		"/      anObject name == sym ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2721
		"/          classes add:anObject
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2722
		"/      ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2723
		"/ because that would lead to ignore all java
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2724
		"/ classes, which are stored under a different
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2725
		"/ key.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2726
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2727
		(eachGlobal name == eachName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2728
		 or:[eachGlobal isJavaClass]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2729
		    classes add:eachGlobal
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2730
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2731
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2732
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2733
	NumberOfClassesHint := classes size.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2734
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2735
    ^ classes
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2736
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2737
    "
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2738
     CachedClasses := nil.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2739
     Smalltalk allClasses
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2740
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2741
    to get the list sorted by name:
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2742
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2743
     Smalltalk allClasses asSortedCollection:[:a :b | a name < b name]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2744
    "
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2745
13851
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  2746
    "Modified: / 06-12-2011 / 12:41:42 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2747
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2748
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2749
allClassesAndMetaclasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2750
    "return an unordered collection of all classes with their metaclasses in the system."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2751
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2752
    |classes|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2753
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2754
    classes := IdentitySet new:NumberOfClassesHint*2.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2755
    self allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2756
	classes add:(eachClass theNonMetaclass).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2757
	classes add:(eachClass theMetaclass).
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2758
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2759
    ^ classes
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2760
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2761
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2762
allClassesWithAllPrivateClasses
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2763
    "return an unordered collection of all classes in the Smalltalk namespace.
10173
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  2764
     Only globally anchored classes are returned; Namespaces are not included.
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2765
     (i.e. anonymous ones have to be aquired by Behavior allSubInstances)"
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2766
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2767
    ^ self allClasses select:[:aClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2768
	    |owner|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2769
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2770
	    (aClass isRealNameSpace not)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2771
	    and:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2772
		owner := aClass topOwningClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2773
		(owner ? aClass) nameSpace == Smalltalk
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2774
	    ]
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2775
      ]
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2776
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2777
    "
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2778
     Smalltalk allClassesWithAllPrivateClasses
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2779
    "
10173
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  2780
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  2781
    "Modified: / 10-11-2006 / 17:24:00 / cg"
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2782
!
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2783
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2784
allExtensions
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2785
    "return a collection of all extension methods (methods added from another package)"
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2786
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2787
    |methods|
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2788
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2789
    methods := OrderedCollection new.
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2790
    self allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2791
	|classPackage|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2792
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2793
	classPackage := eachClass package.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2794
	eachClass instAndClassMethodsDo:[:mthd |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2795
	    mthd package ~= classPackage ifTrue:[ methods add:mthd ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2796
	].
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2797
    ].
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2798
    ^ methods
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2799
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2800
    "
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2801
     Smalltalk allExtensions
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2802
    "
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2803
!
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  2804
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2805
allExtensionsForPackage:aProjectID
14890
37618c9121f2 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14833
diff changeset
  2806
    "return a collection of all extension methods for a given projectID"
37618c9121f2 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14833
diff changeset
  2807
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2808
    |methods|
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2809
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2810
    methods := OrderedCollection new.
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2811
    self allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2812
	methods addAll:(eachClass extensionsFrom:aProjectID).
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2813
    ].
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2814
    ^ methods
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2815
!
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  2816
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2817
allImplementorsOf:aSelector
12919
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  2818
    "return a collection of classes which implement the given selector"
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  2819
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2820
    |implementors|
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2821
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2822
    implementors := OrderedCollection new.
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2823
    self allClassesDo:[:cls |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2824
	(cls includesSelector:aSelector) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2825
	    implementors add:cls.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2826
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2827
	(cls class includesSelector:aSelector) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2828
	    implementors add:cls class.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2829
	].
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2830
    ].
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2831
    ^ implementors
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2832
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2833
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2834
     Smalltalk allImplementorsOf:#isNil
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2835
     (Smalltalk allImplementorsOf:#add:) size
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2836
    "
12919
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  2837
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  2838
    "Modified: / 07-05-2010 / 10:56:09 / cg"
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2839
!
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  2840
12376
fm
parents: 12358
diff changeset
  2841
allLoadedProjectIDs
fm
parents: 12358
diff changeset
  2842
fm
parents: 12358
diff changeset
  2843
    ^ self allProjectsIdsIncludingUnloadedClasses: false
fm
parents: 12358
diff changeset
  2844
fm
parents: 12358
diff changeset
  2845
fm
parents: 12358
diff changeset
  2846
    "
fm
parents: 12358
diff changeset
  2847
     Smalltalk allLoadedProjectIDs
fm
parents: 12358
diff changeset
  2848
    "
fm
parents: 12358
diff changeset
  2849
!
fm
parents: 12358
diff changeset
  2850
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2851
allProjectIDs
12376
fm
parents: 12358
diff changeset
  2852
fm
parents: 12358
diff changeset
  2853
    ^ self allProjectsIdsIncludingUnloadedClasses: true
fm
parents: 12358
diff changeset
  2854
fm
parents: 12358
diff changeset
  2855
fm
parents: 12358
diff changeset
  2856
    "
fm
parents: 12358
diff changeset
  2857
     Smalltalk allProjectIDs
fm
parents: 12358
diff changeset
  2858
    "
fm
parents: 12358
diff changeset
  2859
!
fm
parents: 12358
diff changeset
  2860
fm
parents: 12358
diff changeset
  2861
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses
fm
parents: 12358
diff changeset
  2862
    "Returns all projects ids.
fm
parents: 12358
diff changeset
  2863
     Excludes projects coming from unloaded classes if includeUnloadedClasses is false.
fm
parents: 12358
diff changeset
  2864
    "
fm
parents: 12358
diff changeset
  2865
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2866
    |allProjects|
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2867
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2868
    allProjects := Set new.
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2869
    self allClassesDo:[:eachClass |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2870
	|cls pkg|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2871
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2872
	eachClass isRealNameSpace ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2873
	    (includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2874
		cls := eachClass theNonMetaclass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2875
		cls isPrivate ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2876
		    cls := cls topOwningClass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2877
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2878
		pkg := cls package.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2879
		pkg size > 0 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2880
		    allProjects add:pkg.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2881
		] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2882
		    "/ for now, nameSpaces are not in any package;
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2883
		    "/ this might change. Then, 0-sized packages are
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2884
		    "/ illegal, and the following should be enabled.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2885
		    "/ self halt
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2886
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2887
		cls isJavaClass ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2888
		    cls instAndClassSelectorsAndMethodsDo:[:sel :mthd |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2889
			allProjects add:mthd package asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2890
		    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2891
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2892
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2893
	].
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2894
    ].
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2895
    allProjects := allProjects asOrderedCollection sort.
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2896
    ^ allProjects
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2897
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2898
    "
12376
fm
parents: 12358
diff changeset
  2899
     Smalltalk allProjectsIdsIncludingUnloadedClasses: true
fm
parents: 12358
diff changeset
  2900
     Smalltalk allProjectsIdsIncludingUnloadedClasses: false
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2901
    "
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2902
!
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  2903
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2904
cellAt:aName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2905
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2906
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2907
    "return the address of a global cell
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2908
     - used internally for compiler only"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2909
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2910
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2911
    RETURN ( __GLOBAL_GETCELL(aName) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2912
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2913
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2914
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2915
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2916
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2917
classCategoryCompletion:aPartialCategory
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2918
    "given a partial class category name, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2919
     2 entries: 1st: the best (longest) match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2920
		2nd: collection consisting of matching categories"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2921
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  2922
    ^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2923
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2924
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2925
     Smalltalk classCategoryCompletion:'Sys'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2926
     Smalltalk classCategoryCompletion:'System'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2927
     Smalltalk classCategoryCompletion:'System-BinaryStorage'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2928
    "
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  2929
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  2930
    "Modified: / 10-08-2006 / 13:06:34 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2931
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2932
8570
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  2933
classNamed:aString
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  2934
    "return the class with name aString, or nil if absent.
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  2935
     To get to the metaClass, append ' class' to the string.
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2936
     To get a nameSpace or private class, prefix the name as required.
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2937
     If a private class of an autoloaded class is referenced, the owning class
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2938
     will be loaded."
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2939
10127
70e1b66ceae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10126
diff changeset
  2940
    |cls sym nonMeta idx prefix rest namespace nsNameSymbol|
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2941
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2942
    "Quick try - if everything is loaded, this will succeed.
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2943
     But be careful, to not invent new symbols ..."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2944
    sym := aString asSymbolIfInterned.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2945
    sym notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2946
	cls := self at:sym ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2947
	cls isBehavior ifTrue:[^ cls].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2948
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2949
1480
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  2950
    (aString endsWith:' class') ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2951
	nonMeta := self classNamed:(aString copyButLast:6).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2952
	nonMeta notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2953
	    ^ nonMeta theMetaclass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2954
	].
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  2955
    ].
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  2956
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  2957
    "no success yet. Try if this is a private class of an autoloaded class"
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2958
    cls isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2959
	idx := aString indexOfSubCollection:'::'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2960
	idx ~~ 0 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2961
	    prefix := aString copyTo:idx-1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2962
	    nsNameSymbol := prefix asSymbolIfInterned.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2963
	    nsNameSymbol notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2964
		rest := aString copyFrom:idx+2.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2965
		namespace := self at:prefix asSymbolIfInterned ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2966
		"namespace may be the owner of a private class.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2967
		 NameSpaces and Behaviors have the same protocol"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2968
		[namespace isBehavior] whileTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2969
		    idx := rest indexOfSubCollection:'::'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2970
		    idx ~~ 0 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2971
			prefix := rest copyTo:idx-1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2972
			rest := rest copyFrom:idx+2.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2973
			"this does an implicit autoload if required"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2974
			namespace := namespace privateClassesAt:prefix.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2975
		    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2976
			namespace isLoaded ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2977
			    cls := namespace privateClassesAt:rest.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2978
			    cls isBehavior ifTrue:[^ cls].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2979
			].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2980
			namespace := nil.   "force exit of loop"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2981
		    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2982
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2983
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  2984
	].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2985
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2986
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2987
    ^ nil
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2988
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2989
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2990
     Smalltalk classNamed:'Object'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2991
     Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2992
     Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2993
     Smalltalk classNamed:'Authentication::BasicAuthenticator'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2994
     Smalltalk classNamed:'fooBar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2995
     Smalltalk classNamed:'true'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2996
     Smalltalk classNamed:'Object class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2997
     Smalltalk classNamed:'Metaclass'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2998
     Smalltalk classNamed:'Array'
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  2999
     Smalltalk classNamed:'Array class'
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3000
    "
644
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3001
9468
2472391c602c bumped revision
Claus Gittinger <cg@exept.de>
parents: 9377
diff changeset
  3002
    "Created: / 24-11-1995 / 17:30:22 / cg"
2472391c602c bumped revision
Claus Gittinger <cg@exept.de>
parents: 9377
diff changeset
  3003
    "Modified: / 19-06-1996 / 14:22:21 / stefan"
10127
70e1b66ceae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10126
diff changeset
  3004
    "Modified: / 23-10-2006 / 18:06:53 / cg"
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3005
    "Modified (comment): / 20-08-2011 / 16:43:07 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3006
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3007
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3008
classNames
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3009
    "return a collection of all classNames in the system"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3010
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3011
    ^ self allClasses collect:[:aClass | aClass name]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3012
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3013
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3014
     Smalltalk classNames
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3015
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3016
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3017
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3018
classnameCompletion:aPartialClassName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3019
    "given a partial classname, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3020
     2 entries: 1st: the best (longest) match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3021
		2nd: collection consisting of matching names"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3022
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3023
    ^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3024
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3025
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3026
classnameCompletion:aPartialClassName inEnvironment:anEnvironment
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3027
    "given a partial classname, return an array consisting of
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3028
     2 entries: 1st: the best (longest) match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3029
		2nd: collection consisting of matching names"
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3030
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3031
    ^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3032
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3033
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3034
     Smalltalk classnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3035
     Smalltalk classnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3036
     Smalltalk classnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3037
     Smalltalk classnameCompletion:'*rray'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3038
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3039
     Smalltalk classnameCompletion:'Arr cl'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3040
     Smalltalk classnameCompletion:'*rray cl'
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3041
    "
644
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3042
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3043
    "Created: 24.11.1995 / 17:24:45 / cg"
2523
04db1fd74e0d try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  3044
    "Modified: 3.4.1997 / 18:25:01 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3045
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3046
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3047
defaultNameSpace
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3048
    "return the default namespace, where new classes are installed,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3049
     if NO special nameSpace handler is present"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3050
9562
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3051
    ^ Project defaultNameSpace.
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3052
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3053
    "Created: / 19-12-1996 / 23:49:25 / cg"
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3054
    "Modified: / 17-08-2006 / 14:01:22 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3055
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3056
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3057
globalNameCompletion:aPartialGlobalName
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3058
    "given a partial globalName, return an array consisting of
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3059
     2 entries: 1st: the best (longest) match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3060
		2nd: collection consisting of matching names"
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3061
12614
b8fca618dcb6 changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents: 12613
diff changeset
  3062
    ^ DoWhatIMeanSupport globalNameCompletion:aPartialGlobalName inEnvironment:self match:true
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3063
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3064
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3065
     Smalltalk globalnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3066
     Smalltalk globalnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3067
     Smalltalk globalnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3068
     Smalltalk globalnameCompletion:'*rray'
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3069
    "
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3070
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3071
    "Created: / 24-11-1995 / 17:24:45 / cg"
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3072
    "Modified: / 10-08-2006 / 13:05:39 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3073
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3074
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3075
globalnameCompletion:aPartialGlobalName
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3076
    "given a partial globalName, return an array consisting of
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3077
     2 entries: 1st: the best (longest) match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3078
		2nd: collection consisting of matching names"
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3079
8358
0afa3ee38c37 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 8317
diff changeset
  3080
    <resource:#obsolete>
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3081
    self obsoleteMethodWarning:'use #globalNameCompletion:'.
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3082
    ^ DoWhatIMeanSupport globalNameCompletion:aPartialGlobalName inEnvironment:self
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3083
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3084
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3085
     Smalltalk globalnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3086
     Smalltalk globalnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3087
     Smalltalk globalnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3088
     Smalltalk globalnameCompletion:'*rray'
5736
d625e5505254 globalNamecompletion
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
  3089
    "
d625e5505254 globalNamecompletion
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
  3090
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3091
    "Created: / 24-11-1995 / 17:24:45 / cg"
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3092
    "Modified: / 10-08-2006 / 13:05:48 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3093
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3094
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  3095
hasClassNamed:aString
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  3096
    Symbol
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3097
	hasInterned:aString
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3098
	ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ].
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3099
    ^ false
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3100
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3101
    "Created: / 26-08-2009 / 11:43:03 / Jaroslav Havlin <havlij6@fel.cvut.cz>"
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3102
    "Modified: / 20-08-2011 / 16:41:31 / cg"
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3103
!
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3104
9290
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3105
hasNameSpaces
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3106
    "can be redefined by dummy namespaces/environments, to suppress
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3107
     the namespace display in a browser (PocketSmalltalk)"
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3108
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3109
    ^ true
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3110
!
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3111
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3112
hasNamespaces
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3113
    "can be redefined by dummy namespaces/environments, to suppress
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3114
     the namespace display in a browser (PocketSmalltalk)"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3115
9290
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3116
    <resource:#obsolete>
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3117
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3118
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3119
10432
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3120
hasSelectorNameSpaces
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3121
    "for now return false
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  3122
     Selector namespaces are being implemented and supported by the VM,
10432
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3123
     but not yet fully supported by all tools...
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3124
     Therefore, for now, do not generate code which uses this feature."
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3125
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3126
    ^ false
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3127
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3128
    "Created: / 05-03-2007 / 13:26:28 / cg"
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3129
!
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3130
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3131
includes:something
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3132
    "this should come from Collection.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3133
     will change the inheritance - Smalltalk is actually a collection"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3134
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3135
    self do:[:element | element = something ifTrue:[^ true]].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3136
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3137
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3138
14987
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3139
includesIdentical:something
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3140
    "this should come from Collection.
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3141
     will change the inheritance - Smalltalk is actually a collection"
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3142
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3143
    self do:[:element | element == something ifTrue:[^ true]].
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3144
    ^ false
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3145
!
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3146
10041
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3147
isBrowserStartable
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3148
    ^ false.
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3149
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3150
    "Created: / 06-10-2006 / 11:46:52 / cg"
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3151
!
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3152
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3153
isNameSpace
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3154
    "return true, if the receiver is a nameSpace."
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3155
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3156
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3157
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3158
    "Created: 11.10.1996 / 18:10:43 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3159
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3160
10169
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3161
isRealNameSpace
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3162
    "return true, if the receiver is a nameSpace, but not Smalltalk (which is also a class)."
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3163
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3164
    ^ false
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3165
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3166
    "Created: / 10-11-2006 / 17:02:19 / cg"
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3167
!
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3168
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3169
isTopLevelNameSpace
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3170
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3171
!
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3172
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3173
isTopLevelNamespace
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3174
    "obsolete - use isTopLevelNameSpace"
5365
95c615a40176 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5363
diff changeset
  3175
7432
155245708ca3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7430
diff changeset
  3176
    <resource:#obsolete>
155245708ca3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7430
diff changeset
  3177
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3178
    self obsoleteMethodWarning:'use #isTopLevelNameSpace'.
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3179
    ^ true
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3180
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3181
    "Created: 11.10.1996 / 18:10:43 / cg"
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3182
!
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3183
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3184
keyIsClassVariableNameKey:aKey
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3185
    |i|
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3186
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3187
    i := aKey lastIndexOf:$:.
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3188
    i ~~ 0 ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3189
	i > 1 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3190
	    (aKey at:(i-1)) == $: ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3191
		^ true.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3192
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3193
	].
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3194
    ].
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3195
    ^ false.
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3196
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3197
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3198
     self keyIsClassVariableNameKey:'foo::bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3199
     self keyIsClassVariableNameKey:'foo:bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3200
     self keyIsClassVariableNameKey:':bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3201
     self keyIsClassVariableNameKey:'::bar'
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3202
    "
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3203
!
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3204
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3205
loadedClassNamed:aString
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3206
    "Same as #classNamed,
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3207
     but a private class of an autoloaded class will not be found."
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3208
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3209
    |cls sym nonMeta|
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3210
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3211
    "Quick try - if everything is loaded, this will succeed.
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3212
     But be careful, to not invent new symbols ..."
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3213
    sym := aString asSymbolIfInterned.
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3214
    sym notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3215
	cls := self at:sym ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3216
	cls isBehavior ifTrue:[^ cls].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3217
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3218
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3219
    (aString endsWith:' class') ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3220
	nonMeta := self loadedClassNamed:(aString copyButLast:6).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3221
	nonMeta notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3222
	    ^ nonMeta theMetaclass
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3223
	].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3224
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3225
    ^ nil
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3226
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3227
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3228
     Smalltalk loadedClassNamed:'Object'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3229
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3230
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3231
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3232
     Smalltalk loadedClassNamed:'fooBar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3233
     Smalltalk loadedClassNamed:'true'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3234
     Smalltalk loadedClassNamed:'Object class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3235
     Smalltalk loadedClassNamed:'Metaclass'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3236
     Smalltalk loadedClassNamed:'Array'
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3237
     Smalltalk loadedClassNamed:'Array class'
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3238
    "
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3239
!
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3240
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3241
methodProtocolCompletion:aPartialProtocolName
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3242
    "given a partial method protocol name, return an array consisting of
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3243
     2 entries: 1st: the best (longest) match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3244
		2nd: collection consisting of matching protocols"
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3245
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3246
    ^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3247
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3248
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3249
     Smalltalk methodProtocolCompletion:'doc'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3250
     Smalltalk methodProtocolCompletion:'docu'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3251
     Smalltalk methodProtocolCompletion:'documenta'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3252
    "
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3253
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3254
    "Modified: / 10-08-2006 / 13:05:20 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3255
!
5505
e99e8e9cbfef added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  3256
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3257
numberOfGlobals
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3258
    "return the number of global variables in the system"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3259
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3260
    |tally "{ Class: SmallInteger }" |
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3261
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3262
    tally := 0.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3263
    self do:[:obj | tally := tally + 1].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3264
    ^ tally
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3265
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3266
    "Smalltalk numberOfGlobals"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3267
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3268
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3269
referencesAny:aCollection
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3270
    "redefined, since the references are only kept in the VM's symbol table"
3260
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3271
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3272
    self keysAndValuesDo:[:key :val |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3273
	aCollection do:[:anObject |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3274
	    (key == anObject) ifTrue:[^ true].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3275
	    (val == anObject ) ifTrue:[^ true].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3276
	]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3277
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3278
    ^ super referencesAny:aCollection
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3279
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3280
    "Created: / 2.2.1998 / 16:01:20 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3281
!
3260
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3282
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3283
referencesDerivedInstanceOf:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3284
    "redefined, since the references are only kept in the VM's symbol table"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3285
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3286
    self keysAndValuesDo:[:key :val |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3287
	(key isKindOf:aClass) ifTrue:[^ true].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3288
	(val isKindOf:aClass) ifTrue:[^ true].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3289
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3290
    ^ super referencesDerivedInstanceOf:aClass
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3291
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3292
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3293
referencesInstanceOf:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3294
    "redefined, since the references are only kept in the VM's symbol table"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3295
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3296
    self keysAndValuesDo:[:key :val |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3297
	(key isMemberOf:aClass) ifTrue:[^ true].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3298
	(val isMemberOf:aClass) ifTrue:[^ true].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3299
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3300
    ^ super referencesInstanceOf:aClass
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3301
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3302
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3303
referencesObject:anObject
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3304
    "redefined, since the references are only kept in the VM's symbol table"
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3305
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3306
    self keysAndValuesDo:[:key :val |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3307
	(key == anObject) ifTrue:[^ true].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3308
	(val == anObject ) ifTrue:[^ true].
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3309
    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3310
    ^ super referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3311
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3312
    "Modified: / 3.2.1998 / 14:22:46 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3313
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3314
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3315
resolveName:aName inClass:aClass
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3316
    "resolve aName as if compiled within aClass;
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3317
     i.e. if it has a private class with this name, return it;
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3318
     if aName is known within the classes namespace, return that.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3319
     Otherwise, return a global with that name.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3320
     This should be used whereever Smalltalk>>at: used to be used,
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3321
     to resolve a global by name."
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3322
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3323
    |nameUsed sym cls ns|
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3324
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3325
    aName isNil ifTrue:[^ nil].
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3326
    aName isBehavior ifTrue:[^ aName].       "/ already resolved
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3327
    nameUsed := aName.
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3328
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3329
    (nameUsed startsWith:'Smalltalk::') ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3330
	nameUsed := nameUsed copyFrom:12.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3331
	^ self at:(nameUsed asSymbol) ifAbsent:nil.
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3332
    ].
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3333
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3334
    sym := nameUsed asSymbol.
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3335
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3336
    cls := aClass privateClassesAt:sym.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3337
    cls notNil ifTrue:[^ cls].
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3338
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3339
    ns := aClass nameSpace.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3340
    (ns notNil and:[ns ~~ Smalltalk]) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3341
	ns isNameSpace ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3342
	    cls := ns at:sym ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3343
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3344
	    cls := ns privateClassesAt:sym
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3345
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3346
	cls notNil ifTrue:[^ cls].
3025
53b114d5be3e added #resolveClassNamed:
ca
parents: 3022
diff changeset
  3347
    ].
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3348
    ^ self at:sym ifAbsent:nil.
4356
54d1f0b81638 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4355
diff changeset
  3349
54d1f0b81638 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4355
diff changeset
  3350
    "Modified: / 9.7.1999 / 01:18:07 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3351
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3352
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3353
selectorCompletion:aPartialSymbolName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3354
    "given a partial selector, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3355
     2 entries: 1st: the longest match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3356
		2nd: collection consisting of matching implemented selectors"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3357
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3358
    ^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3359
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3360
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3361
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3362
    "given a partial selector, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3363
     2 entries: 1st: the longest match
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3364
		2nd: collection consisting of matching implemented selectors"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3365
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3366
    ^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3367
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3368
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3369
     Smalltalk selectorCompletion:'at:p'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3370
     Smalltalk selectorCompletion:'nextP'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3371
     Smalltalk selectorCompletion:'nextp'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3372
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3373
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3374
    "Modified: / 7.6.1996 / 08:44:33 / stefan"
3565
966a108e3765 also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents: 3560
diff changeset
  3375
    "Modified: / 14.6.1998 / 15:54:03 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3376
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3377
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3378
!Smalltalk class methodsFor:'queries-system'!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3379
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3380
dialectName
8736
e6e8a6754506 #dialectName answers a symbol
Stefan Vogel <sv@exept.de>
parents: 8712
diff changeset
  3381
    ^ #SmalltalkX
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3382
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3383
    "
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3384
     Smalltalk dialectName
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3385
    "
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3386
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3387
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3388
dialectReleaseVersion
7348
277bbf3b3de2 category
Claus Gittinger <cg@exept.de>
parents: 7325
diff changeset
  3389
    ^ self versionString
277bbf3b3de2 category
Claus Gittinger <cg@exept.de>
parents: 7325
diff changeset
  3390
277bbf3b3de2 category
Claus Gittinger <cg@exept.de>
parents: 7325
diff changeset
  3391
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3392
     Smalltalk dialectReleaseVersion
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3393
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3394
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3395
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3396
isAmber
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3397
    "is this an Amber Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3398
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3399
     applications - add #isAmber to your Amber Smalltalk,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3400
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3401
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3402
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3403
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3404
    "Created: / 18-12-2013 / 15:43:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3405
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3406
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3407
isDolphinSmalltalk
16803
bd94b8eacd88 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16764
diff changeset
  3408
    "is this a Dolphin Smalltalk system ?
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3409
     Return false here - this may be useful to write portable
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3410
     applications - add #isDolphinSmalltalk to your dolphin,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3411
     returning true there."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3412
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3413
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3414
!
4970
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3415
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3416
isGemStone
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3417
    "is this a GemStone Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3418
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3419
     applications - add #isGemStone to your GemStone/S,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3420
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3421
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3422
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3423
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3424
    "Created: / 18-12-2013 / 15:43:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3425
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3426
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3427
isPharo
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3428
    "is this a Pharo Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3429
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3430
     applications - add #isPharo to your Pharo,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3431
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3432
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3433
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3434
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3435
    "Created: / 18-12-2013 / 15:42:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3436
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3437
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3438
isSmalltalkMT
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3439
    "is this a Smalltalk-MT system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3440
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3441
     applications - add #isSmalltalkMT to your smalltalk-MT,
4970
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3442
     returning true there."
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3443
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3444
    ^ false
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3445
!
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3446
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3447
isSmalltalkV
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3448
    "is this a Smalltalk/V system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3449
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3450
     applications - add #isSmalltalkV to your smalltalkV,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3451
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3452
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3453
    ^ false
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3454
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3455
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3456
isSmalltalkX
16803
bd94b8eacd88 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16764
diff changeset
  3457
    "is this a Smalltalk/X system ?
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3458
     Return true here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3459
     applications - add #isSmalltalkX to your other smalltalks,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3460
     returning false there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3461
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3462
    ^ true
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3463
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3464
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3465
isSqueak
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3466
    "is this a SqueakSmalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3467
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3468
     applications - add #isSqueak to your squeak,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3469
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3470
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3471
    ^ false
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3472
!
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3473
16013
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3474
isSqueakLike
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3475
    "is this a Squeak, Pharo, Cuis or similar Smalltalk system ?
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3476
     Return false here - this may be useful to write portable
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3477
     applications - add #isSqueakLike to your squeak, pharo,...
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3478
     returning true there."
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3479
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3480
    ^ false
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3481
!
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3482
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3483
isVisualAge
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3484
    "is this a VisualAge Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3485
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3486
     applications - add #isVisualAge to your visualAge,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3487
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3488
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3489
    ^ false
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3490
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3491
17369
d50c90bc1a91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17350
diff changeset
  3492
isVisualSmalltalkEnterprise
16843
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3493
    "is this a VSE Smalltalk system ?
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3494
     Return false here - this may be useful to write portable
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3495
     applications - add #isVisualSmallalkEnterprise to your VSE,
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3496
     returning true there."
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3497
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3498
    ^ false
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3499
!
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3500
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3501
isVisualWorks
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3502
    "is this a VisualWorks Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3503
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3504
     applications - add #isVisualWorks to your visualWorks,
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3505
     returning true there."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3506
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3507
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3508
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3509
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3510
!Smalltalk class methodsFor:'startup'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3511
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3512
browserWindowStartup
13056
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3513
    "invoked, when st/x is started as a plugin in a (currently firefox) browser.
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3514
     In contrast to squeak (where a single window is used to show the display bitmap),
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3515
     the browser window is used as a pseudo root-window for a single aplication window.
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3516
     If required, that app must ensure that multiple apps (if any) are setup as a
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3517
     multiwindow application.
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3518
     Actually, control is transferred to PluginSupport, which is suppoesed to know what to do"
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3519
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3520
    |windowIDString numericWindowID windowID params idx process|
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3521
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3522
    idx := CommandLineArguments indexOf:'--browserWindow:'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3523
    windowIDString := CommandLineArguments at:idx+1.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3524
    numericWindowID := Integer fromString:windowIDString.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3525
    windowID := ExternalAddress newAddress:numericWindowID.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3526
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3527
    idx := CommandLineArguments indexOf:'--browserParameters:'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3528
    idx ~~ 0 ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3529
	params := Dictionary new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3530
	(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3531
	    params at:key put:value.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3532
	].
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3533
    ].
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3534
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3535
    'browserWindow is: ' errorPrint. windowID errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3536
    'browserParameters are: ' errorPrint. params errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3537
    'Display is: ' errorPrint. Display errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3538
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3539
    process := [
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3540
	PluginSupport
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3541
	    startInBrowserWithWindowID:windowID
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3542
	    parameters:params.
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3543
    ] newProcess.
9043
e6106f500263 do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents: 9036
diff changeset
  3544
    process priority:(Processor userSchedulingPriority).
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3545
    process name:'browser start handler'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3546
    process beGroupLeader.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3547
    process resume.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3548
    process := nil.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3549
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3550
    Processor dispatchLoop.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3551
    Smalltalk exit.
13056
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3552
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3553
    "Modified: / 11-09-2010 / 14:06:59 / cg"
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3554
!
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3555
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3556
displayInitializationDone
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3557
    "inform the restart, that the display has been initialized"
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3558
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3559
    CallbackSignal raiseRequest.
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3560
!
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3561
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3562
executeStartBlocks
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3563
    |startBlocks|
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3564
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3565
    startBlocks := self startBlocks.
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3566
    startBlocks notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3567
	'Smalltalk [info]: execute startBlocks...' infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3568
	startBlocks do:[:aBlock|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3569
	    Error handle:[:ex |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3570
		InfoPrinting == true ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3571
		    'Smalltalk [warning]: error caught in startBlock: ' infoPrint.
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3572
		    ex description infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3573
		    ex infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3574
		    thisContext fullPrintAll.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3575
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3576
	    ] do: aBlock
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3577
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3578
	startBlocks removeAll.
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3579
    ].
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3580
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3581
    "Created: / 07-01-2012 / 12:58:39 / cg"
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3582
!
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3583
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3584
hideSplashWindow
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3585
%{
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3586
#ifdef WIN32
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3587
    extern void __win32_hideSplashScreen();
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3588
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3589
    __win32_hideSplashScreen();
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3590
#endif
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3591
%}
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3592
!
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3593
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3594
mainStartup:graphicalMode
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3595
    "common start/restart action, if there is a Display, initialize it
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3596
     and start dispatching; otherwise go into a read-eval-print loop."
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3597
9012
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  3598
    |process imageName thisIsARestart idx|
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3599
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3600
    imageName := ObjectMemory imageName.
2249
cdb6c87f0707 send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
  3601
    thisIsARestart := imageName notNil.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3602
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  3603
    graphicalMode ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3604
	Display isNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3605
	    (StartupClass notNil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3606
	    and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3607
		self openDisplay.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3608
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3609
	].
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  3610
    ].
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  3611
10645
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  3612
    StandAlone ifFalse:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3613
	"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3614
	 enable the graphical debugger/inspector
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3615
	 (they could have been (re)defined as autoloaded in the patches file)
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3616
	"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3617
	self initStandardTools.
10645
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  3618
    ].
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  3619
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3620
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3621
     if there is a display, start its event dispatcher
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3622
    "
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3623
    Display notNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3624
	Display deviceIOTimeoutErrorSignal handlerBlock:[:ex |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3625
	    SaveEmergencyImage == true ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3626
		'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3627
		ObjectMemory primSnapShotOn:'crash.img'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3628
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3629
	    'Display [warning]: broken display connection - exit.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3630
	    self exit:11.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3631
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3632
	Display startDispatch.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3633
    ].
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3634
9016
2979527dbdf4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9015
diff changeset
  3635
    idx := CommandLineArguments indexOf:'--browserWindow:'.
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  3636
    IsPlugin := (idx ~~ 0).
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  3637
    IsPlugin ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3638
	'Smalltalk [info]: startup browser window...' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3639
	self browserWindowStartup.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3640
	"/ not reached
9012
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  3641
    ].
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  3642
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3643
    Initializing := false.
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3644
2074
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3645
    "/ start a process, which evaluates all StartBlocks
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3646
    "/ this used to be done right here (in this system-process),
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3647
    "/ but lead to trouble, when it suspended.
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3648
    "/ Therefore, it is now done by an extra user-process.
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3649
7043
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3650
    process := [
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3651
	'Smalltalk [info]: startup process 1 active.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3652
	StartBlocks notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3653
	    self executeStartBlocks.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3654
	    StartBlocks := nil.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3655
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3656
	ImageStartBlocks notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3657
	    'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3658
	    ImageStartBlocks do:[:aBlock|
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3659
		aBlock value
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3660
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3661
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3662
	StandAlone ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3663
	    (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3664
		thisIsARestart ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3665
		    Transcript cr.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3666
		    Transcript showCR:('Smalltalk restarted from:'
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3667
					, imageName
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3668
					, ' (saved '
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3669
					, ObjectMemory imageSaveTime printString
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3670
					, ')' ).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3671
		] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3672
		    Transcript showCR:(self hello).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3673
		    Transcript showCR:(self copyrightString).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3674
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3675
		Transcript cr.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3676
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3677
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3678
	    DemoMode==true ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3679
		Transcript showCR:'*** Restricted use:                              ***'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3680
		Transcript showCR:'*** This program may be used for education only. ***'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3681
		Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE  ***'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3682
		Transcript showCR:'*** for more details.                            ***'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3683
		Transcript cr.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3684
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3685
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3686
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3687
	thisIsARestart ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3688
	    "/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3689
	    "/ the final late notification - users can now assume that
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3690
	    "/ views, forms etc. have been recreated.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3691
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3692
	    ObjectMemory changed:#returnFromSnapshot.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3693
	]
7039
6f1c02381145 Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents: 7000
diff changeset
  3694
7040
d24ef75bc6c3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7039
diff changeset
  3695
    ] newProcess.
d24ef75bc6c3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7039
diff changeset
  3696
9043
e6106f500263 do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents: 9036
diff changeset
  3697
    process priority:(Processor userSchedulingPriority).
7043
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3698
    process name:'start block handler'.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3699
    process beGroupLeader.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3700
    process resume.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3701
    process := nil.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
  3702
10139
a3f6265978ad Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents: 10131
diff changeset
  3703
    ObjectMemory startBackgroundCollectorAt:5.
a3f6265978ad Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents: 10131
diff changeset
  3704
    ObjectMemory startBackgroundFinalizationAt:5.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
  3705
2074
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3706
    "/ start a process, which evaluates the startupClass>>startupSelector
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3707
    "/ message.
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3708
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3709
    (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3710
	"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3711
	 allow more customization by reading an image specific rc-file
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3712
	"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3713
	thisIsARestart ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3714
	    (imageName asFilename hasSuffix:'img') ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3715
		imageName := imageName copyButLast:4
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3716
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3717
	    self fileIn:(imageName , '.rc')
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3718
	].
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3719
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3720
"/        Display notNil ifTrue:[
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3721
"/            Display exitOnLastClose:true.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3722
"/        ].
2086
4a9d8b5cada7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2085
diff changeset
  3723
"/        Processor exitWhenNoMoreUserProcesses:true.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3724
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3725
	process := [
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3726
	    'Smalltalk [info]: startup process 2 active.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3727
	    StandAlone ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3728
		AbortOperationRequest handle:[:ex |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3729
		    'Smalltalk [info]: aborted - exit.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3730
		    OperatingSystem exit:1
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3731
		] do:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3732
		    ('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3733
		    StartupClass perform:StartupSelector withArguments:StartupArguments.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3734
		]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3735
	    ] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3736
		('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3737
		StartupClass perform:StartupSelector withArguments:StartupArguments.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3738
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3739
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3740
	    "/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3741
	    "/ non-GUI apps exit after the startup;
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3742
	    "/ assume that GUI apps have created & opened some view ...
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3743
	    "/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3744
	    Display isNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3745
		'Smalltalk [info]: no Display - exit.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3746
		Smalltalk exit:11.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3747
	    ].
16666
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  3748
"/            "/
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  3749
"/            "/ GUI apps exit after the last user process has finished
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  3750
"/            "/
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  3751
"/            Display exitOnLastClose:true.
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  3752
"/            Processor exitWhenNoMoreUserProcesses:true.
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3753
	] newProcess.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3754
	process priority:(Processor userSchedulingPriority).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3755
	process name:'main'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3756
	process beGroupLeader.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3757
	process resume.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3758
	process := nil.    "do not refer to process"
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3759
    ].
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3760
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3761
    StandAlone ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3762
	Display notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3763
	    FlyByHelp notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3764
		FlyByHelp start
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3765
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3766
	].
16211
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  3767
    ].
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  3768
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  3769
    Display notNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3770
	Display exitOnLastClose:true.
16211
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  3771
    ].
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3772
    "
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3773
     if view-classes exist, start dispatching;
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3774
     otherwise go into a read-eval-print loop
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3775
    "
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3776
    ((Display notNil and:[graphicalMode])
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3777
     or:[process notNil
13851
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  3778
     or:[HeadlessOperation
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  3779
     or:[StandAlone]]]) ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3780
	Processor exitWhenNoMoreUserProcesses:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3781
	Processor dispatchLoop.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3782
	"done - the last process finished"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3783
	'Smalltalk [info]: last process finished - exit.' infoPrintCR.
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3784
    ] ifFalse:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3785
	StandAlone ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3786
	    self readEvalPrint
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  3787
	]
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3788
    ].
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3789
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3790
    self exit
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  3791
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  3792
    "Created: / 18-07-1996 / 21:07:39 / cg"
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  3793
    "Modified: / 09-09-1996 / 17:42:50 / stefan"
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3794
    "Modified: / 07-01-2012 / 12:59:23 / cg"
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3795
!
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3796
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3797
openDisplay
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3798
    "try to open a display connection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3799
     If so, also read display- and keyboard.rc"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3800
13385
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  3801
    |commandName|
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  3802
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  3803
    commandName := Smalltalk commandName.
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  3804
    (commandName, ' [info]: opening display...') infoPrintCR.
10649
82b327ec636d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10646
diff changeset
  3805
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3806
    Display isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3807
	Screen notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3808
	    [
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3809
		Screen openDefaultDisplay:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3810
	    ] on:Screen deviceOpenErrorSignal do:[:ex|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3811
		('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3812
		(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3813
		(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3814
		HeadlessOperation == true ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3815
		    OperatingSystem exit:1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3816
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3817
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3818
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3819
	    Display notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3820
		(self secureFileIn:'display.rc') ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3821
		    "/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3822
		    (self secureFileIn:'keyboard.rc') ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3823
			"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3824
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3825
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3826
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3827
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3828
    ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3829
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3830
    "Created: / 06-12-2006 / 15:38:17 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3831
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3832
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3833
readEvalPrint
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3834
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3835
16090
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  3836
    Transcript showCR:(self hello).
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  3837
    Transcript showCR:(self copyrightString).
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  3838
    Transcript cr.
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  3839
    Transcript showCR:'Read-eval-print loop; exit with "#exit"; help with "?"'.
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  3840
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3841
    ReadEvalPrintLoop new
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3842
	prompt:'ST> ';
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3843
	doChunkFormat:false;
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3844
	error:Stderr;
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  3845
	readEvalPrintLoop
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3846
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3847
    "Modified: / 07-12-2006 / 17:35:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3848
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3849
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3850
restart
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3851
    "startup after an image has been loaded;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3852
     there are three change-notifications made to dependents of ObjectMemory,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3853
     which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3854
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3855
     #earlySystemInstallation is sent for ST80 compatibility
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3856
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3857
     #earlyRestart is send first, nothing has been setup yet.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3858
		   (should be used to flush all device dependent entries)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3859
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3860
     #restarted is send right after.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3861
		   (should be used to recreate external resources (fds, bitmaps etc)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3862
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3863
     #returnFromSnapshot is sent last
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3864
		   (should be used to restart processes, reOpen Streams which cannot
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3865
		    be automatically be reopened (i.e. Sockets, Pipes) and so on.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3866
		   (Notice that positionable fileStreams are already reopened and repositioned)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3867
     "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3868
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3869
    |deb insp transcript idx|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3870
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3871
    "/
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3872
    "/ when we arrive here, all objects from our previous life
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3873
    "/ have been reloaded - however, some may still contain invalid device
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3874
    "/ handles, display information etc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3875
    "/ also, dynamically loaded modules have not yet been reloaded yet.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3876
    "/ and the concrete OS, concrete FileName etc. are still refering to
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3877
    "/ the previous classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3878
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3879
    Initializing := true.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3880
    AbstractOperatingSystem initializeConcreteClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3881
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3882
    ImageRestartTime := Timestamp now.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3883
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3884
    CommandLine := CommandLineArguments copy.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3885
    CommandLineArguments := CommandLineArguments asOrderedCollection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3886
    CommandName := CommandLineArguments removeFirst. "/ the command
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3887
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3888
    idx := CommandLineArguments indexOf:'-q'.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3889
    idx == 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3890
	idx := CommandLineArguments indexOf:'--silent'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3891
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3892
    idx ~~ 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3893
	Object infoPrinting:false.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3894
	ObjectMemory infoPrinting:false.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3895
	CommandLineArguments removeAtIndex:idx.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  3896
    ].
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  3897
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3898
    "/ start catching SIGSEGV and SIGBUS
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3899
    OperatingSystem enableHardSignalInterrupts.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3900
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3901
    "/ reinit Filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3902
    Filename reinitialize.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3903
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3904
    "/ flush cached path directories (may have changed in the meanwhile)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3905
    self flushPathCaches.
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  3906
    self reinitializePackagePath.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3907
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3908
    "/ reinit the default streams: Stdin, Stdout and Stderr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3909
    "/ after that, we can write to stderr.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3910
    self reinitStandardStreams.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3911
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3912
    "/ redirect Transcript to Stderr during startup
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3913
    transcript := Transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3914
    Transcript := Stderr.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3915
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3916
    "/ temporary switch back to dumb interface -
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3917
    "/ to handle errors while view-stuff is not yet reinitialized
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3918
    insp := Inspector.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3919
    deb := Debugger.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3920
    deb notNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3921
	deb reinitialize
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3922
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3923
    Inspector := MiniInspector.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3924
    Debugger := MiniDebugger.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3925
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3926
    "/ reload any dynamically loaded objects.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3927
    "/ this must be done before doing anything else below,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3928
    "/ because the Processor may restart processes which use
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3929
    "/ this code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3930
    "/ Also, a dynamic object might be registered as dependent of
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3931
    "/ ObjectFileLoader; therefore, must reload before doing any notifications.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3932
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3933
    ObjectFileLoader notNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3934
	ObjectFileLoader reloadAllRememberedObjectFiles.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  3935
    ].
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  3936
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3937
    "/ invalidate all display connections.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3938
    "/ This is required to avoid trouble if someone accesses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3939
    "/ a display during early startup.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3940
    Screen notNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3941
	Screen allScreens do:[:eachDisplay |
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3942
	    eachDisplay invalidateConnection.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3943
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3944
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3945
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3946
    ObjectMemory changed:#earlySystemInstallation.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3947
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3948
    "/ reinitialize the Processor - restartable processes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3949
    "/ are now restarted here (but not yet scheduled).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3950
    Processor reinitialize.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3951
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3952
    "/ flush device handles & recreate OS resources (if possible)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3953
    "/ (mostly view/GC/color & font stuff)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3954
    ObjectMemory
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3955
	changed:#earlyRestart; changed:#restarted.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  3956
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3957
    "/ start catching SIGINT and SIGQUIT
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3958
    OperatingSystem enableUserInterrupts.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3959
    OperatingSystem enableCrashSignalInterrupts.
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  3960
    ObjectMemory restoreGarbageCollectorSettings.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3961
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3962
    "/ give user a chance to re-customize things in smalltalk_r.rc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3963
    "/ reading if smalltalk_r.rc may be suppressed by the --faststart argument.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3964
    idx := CommandLineArguments indexOf:'--faststart'.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3965
    idx == 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3966
	idx := CommandLineArguments indexOf:'--fastStart'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3967
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3968
    idx ~~ 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3969
	CommandLineArguments removeAtIndex:idx.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3970
    ] ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3971
	CallbackSignal := QuerySignal new.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3972
	[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3973
	    Class withoutUpdatingChangesDo:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3974
		(self fileIn:(self commandName , '_r.rc')) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3975
		    "no _r.rc file where executable is; try default smalltalk_r.rc"
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3976
		    self fileIn:'smalltalk_r.rc'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3977
		].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3978
	    ]
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3979
	] on:CallbackSignal do:[:ex|
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3980
	    "/ now, display and view-stuff works;
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3981
	    "/ back to the previous debugging interface
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3982
	    Inspector := insp.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3983
	    Debugger := deb.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3984
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3985
	    "/ reinstall Transcript, if not changed during restart.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3986
	    "/ if there was no Transcript, go to stderr
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3987
	    (transcript notNil and:[Transcript == Stderr]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3988
		Transcript := transcript.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3989
	    ].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3990
	    Initializing := false.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3991
	    ex proceed.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3992
	].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  3993
	CallbackSignal := nil.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3994
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3995
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3996
    "/ reinitialization (restart) of Display is normally performed
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3997
    "/ in the restart script. If this has not been run for some reason,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3998
    "/ do in now.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  3999
    Initializing ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4000
	Display notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4001
	    [
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4002
		Display reinitializeFor:Screen defaultDisplayName.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4003
	    ] on:Screen deviceOpenErrorSignal do:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4004
		'Smalltalk [error]: Cannot restart connection to: ' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4005
		Screen defaultDisplayName errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4006
		OperatingSystem exit:1.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4007
	    ].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4008
	].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4009
	"/ now, display and view-stuff works;
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4010
	"/ back to the previous debugging interface
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4011
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4012
	Inspector := insp.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4013
	Debugger := deb.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4014
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4015
	"/ reinstall Transcript, if not changed during restart.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4016
	"/ if there was no Transcript, go to stderr
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4017
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4018
	(transcript notNil and:[Transcript == Stderr]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4019
	    Transcript := transcript.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4020
	].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4021
	Initializing := false.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4022
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4023
    Screen notNil ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4024
	"clean up leftover screens (and views) that haven't been reopened.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4025
	 Operate on a copy, since brokenConnection removes us from AllScreens"
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4026
	Screen allScreens copy do:[:eachDisplay |
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4027
	    eachDisplay isOpen ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4028
		'Smalltalk [info]: cannot reopen secondary display: ' errorPrint.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4029
		eachDisplay errorPrintCR.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4030
		eachDisplay cleanupAfterDispatch; brokenConnection.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4031
	    ]
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4032
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4033
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4034
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4035
    deb := insp := transcript := nil.   "avoid dangling refs"
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4036
    (StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  4037
	self hideSplashWindow.   "/ if there is one, it's now time to hide it
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4038
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4039
    self mainStartup:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4040
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4041
    "Modified: / 03-08-1999 / 09:42:21 / stefan"
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4042
    "Modified: / 29-07-2011 / 17:58:23 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4043
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4044
11399
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4045
showSplashMessage:aString
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4046
    "put the message into the splash screen (if there is one).
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4047
     Use this for messages during startup"
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4048
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4049
    self showSplashMessage:aString color:nil.
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4050
!
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4051
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4052
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil
11389
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4053
    "put the message into the splash screen (if there is one)."
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4054
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4055
%{
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4056
#ifdef WIN32
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4057
    extern void __win32_splashMessage();
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4058
    char *msg = (char *)0;
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4059
    int clr = 0;
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4060
12481
805176d238d2 change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 12413
diff changeset
  4061
    if (__isStringLike(aMessageStringOrNil)) {
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4062
	msg = __stringVal(aMessageStringOrNil);
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4063
    }
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4064
    if (__isSmallInteger(rgbValueOrNil)) {
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4065
	clr = __intVal(rgbValueOrNil);
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4066
	__win32_splashMessageColor(clr);
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4067
    }
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4068
    __win32_splashMessage(msg);
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4069
#endif
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4070
%}
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4071
!
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4072
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4073
splashInfo:aString
11389
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4074
    "like infoPrintCR,
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4075
     but in addition put the message into the splash screen (if there is one).
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4076
     Use this for info messages during startup"
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4077
12883
133a10b7bd12 changed: #splashInfo:
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
  4078
    aString notNil ifTrue:[ aString infoPrintCR ].
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4079
    self showSplashMessage:aString color:nil.
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4080
!
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4081
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4082
start
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4083
    "main startup, if there is a Display, initialize it
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4084
     and start dispatching; otherwise go into a read-eval-print loop."
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4085
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4086
    |idx graphicalMode arg didReadRCFile keepSplashWindow|
960
e3b75f50d0cd changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  4087
e3b75f50d0cd changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  4088
    graphicalMode := true.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4089
    Initializing := true.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4090
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4091
    keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false].
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4092
"/ now done AFTER reading smalltalk.rc
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4093
"/    keepSplashWindow ifFalse:[
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4094
"/        self hideSplashWindow.   "/ if there is one, it's now time to hide it
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4095
"/    ].
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4096
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4097
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4098
     while reading patches- and rc-file, do not add things into change-file
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4099
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4100
    Class withoutUpdatingChangesDo:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4101
	|commandFile defaultRC prevCatchSetting
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4102
	 isEval isPrint isFilter isRepl idxFileArg process|
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4103
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4104
	isEval := isPrint := isFilter := isRepl := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4105
	didReadRCFile := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4106
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4107
	StandAlone ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4108
	    "/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4109
	    "/ look for any '-q', '-e', '-l' or '-f' command line arguments
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4110
	    "/ and handle them;
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4111
	    "/ read startup and patches file
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4112
	    "/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4113
	    idx := CommandLineArguments indexOfAny:#('-R' '--repl').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4114
	    isRepl := (idx ~~ 0).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4115
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4116
	    idx := CommandLineArguments indexOfAny:#('-q' '--silent').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4117
	    idx ~~ 0 ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4118
		Object infoPrinting:false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4119
		ObjectMemory infoPrinting:false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4120
		CommandLineArguments removeAtIndex:idx.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4121
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4122
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4123
	    [
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4124
		idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4125
		idx ~~ 0
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4126
	    ] whileTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4127
		arg := CommandLineArguments at:idx + 1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4128
		CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4129
		self packagePath addLast:arg.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4130
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4131
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4132
	    [
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4133
		idx := CommandLineArguments indexOfAny:#('-l' '--load').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4134
		idx ~~ 0
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4135
	    ] whileTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4136
		arg := CommandLineArguments at:idx + 1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4137
		CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4138
		arg asFilename exists ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4139
		    Smalltalk fileIn:arg
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4140
		] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4141
		    Smalltalk loadPackage:arg
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4142
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4143
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4144
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4145
	    "/ look for a '-e filename' or '--execute filename' argument
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4146
	    "/ this will force fileIn of filename only, no standard startup.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4147
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4148
	    idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4149
	    idx ~~ 0 ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4150
		SilentLoading := true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4151
		CommandName := arg := CommandLineArguments at:idx + 1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4152
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4153
		CommandLineArguments
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4154
		    removeAtIndex:idx+1; removeAtIndex:idx.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4155
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4156
		self startSchedulerAndBackgroundCollector.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4157
		keepSplashWindow ifFalse:[ self hideSplashWindow ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4158
		Initializing := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4159
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4160
		process := [
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4161
		    UserInterrupt handle:[:ex |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4162
			self exit:128+(OperatingSystem sigINT).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4163
		    ] do:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4164
			arg = '-' ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4165
			    self fileInStream:Stdin
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4166
				   lazy:nil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4167
				   silent:nil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4168
				   logged:false
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4169
				   addPath:nil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4170
			] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4171
			    IsSTScript := true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4172
			    self fileIn:arg.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4173
			].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4174
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4175
		    "/ after the script, if Screen has been opened and there are any open windows,
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4176
		    "/ then do not exit
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4177
		    Display notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4178
			Display exitOnLastClose:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4179
			Display checkForEndOfDispatch.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4180
			Processor exitWhenNoMoreUserProcesses:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4181
		    ] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4182
			self exit.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4183
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4184
		] newProcess.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4185
		process priority:(Processor userSchedulingPriority).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4186
		process name:'main'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4187
		process beGroupLeader.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4188
		process resume.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4189
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4190
		Processor dispatchLoop.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4191
		self exit
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4192
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4193
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4194
	    "look for a '-f filename' or '--file filename' argument
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4195
	     if scripting, thisis loaded before -P, -E or-R action.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4196
	     if not scripting, this will force evaluation of filename instead of smalltalk.rc"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4197
	    idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4198
	    (idxFileArg ~~ 0) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4199
		commandFile := CommandLineArguments at:idxFileArg+1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4200
		CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4201
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4202
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4203
	    "/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation)
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4204
	    "/ or -F/--filter or a '--repl' argument
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4205
	    "/ E, P and F this will force evaluation of expr only, no standard startup
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4206
	    "/ repl go into an interactive loop.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4207
	    idx := CommandLineArguments indexOfAny:#('-E' '--eval').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4208
	    (isEval := (idx ~~ 0)) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4209
		idx := CommandLineArguments indexOfAny:#('-P' '--print').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4210
		(isPrint := (idx ~~ 0)) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4211
		    idx := CommandLineArguments indexOfAny:#('-F' '--filter').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4212
		    (isFilter := (idx ~~ 0)) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4213
			idx := CommandLineArguments indexOfAny:#('-R' '--repl').
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4214
			isRepl := (idx ~~ 0)
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4215
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4216
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4217
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4218
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4219
	    (isEval | isPrint | isFilter | isRepl) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4220
		isRepl ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4221
		    CommandLineArguments size <= idx ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4222
			'stx: missing argument after -E/-P/-F' errorPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4223
			self exit:1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4224
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4225
		    arg := CommandLineArguments at:idx + 1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4226
		    CommandLineArguments removeAtIndex:idx+1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4227
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4228
		CommandLineArguments removeAtIndex:idx.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4229
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4230
		self startSchedulerAndBackgroundCollector.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4231
		keepSplashWindow ifFalse:[ self hideSplashWindow ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4232
		Initializing := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4233
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4234
		"/ enable this, so we can provide $1..$n in the script
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4235
		ParserFlags allowDollarInIdentifier:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4236
		ParserFlags warnDollarInIdentifier:false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4237
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4238
		"/ add bindings for arguments
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4239
		CommandLineArguments doWithIndex:[:arg :i |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4240
		    Workspace workspaceVariableAt:('_$',i printString) put:arg.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4241
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4242
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4243
		"/ all of the above allow for a -f file to be loaded before any other action
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4244
		(commandFile notNil) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4245
		    (self secureFileIn:commandFile) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4246
			('Smalltalk [error]: "', commandFile, '" not found.') errorPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4247
			OperatingSystem exit:1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4248
		    ]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4249
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4250
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4251
		isRepl ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4252
		    self readEvalPrint.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4253
		    self exit.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4254
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4255
		process := [
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4256
		    UserInterrupt handle:[:ex |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4257
			self exit:128+(OperatingSystem sigINT).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4258
		    ] do:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4259
			isFilter ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4260
			    "/ --filter - apply code to each input line.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4261
			    "/ compile code only once
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4262
			    Compiler
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4263
				compile:'doIt ',arg
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4264
				forClass:String
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4265
				notifying:(EvalScriptingErrorHandler new source:arg).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4266
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4267
			    [Stdin atEnd] whileFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4268
				|line|
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4269
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4270
				line := Stdin nextLine.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4271
				line doIt.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4272
			    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4273
			] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4274
			    "/ --print or --eval
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4275
			    |rslt|
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4276
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4277
			    rslt := Parser new
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4278
					evaluate:arg
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4279
					notifying:(EvalScriptingErrorHandler new source:arg)
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4280
					compile:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4281
			    isPrint ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4282
				rslt printCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4283
			    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4284
			].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4285
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4286
		    "/ after the script, if Screen has been opened and there are any open windows,
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4287
		    "/ then do not exit
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4288
		    Display notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4289
			Display exitOnLastClose:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4290
			Display checkForEndOfDispatch.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4291
			Processor exitWhenNoMoreUserProcesses:true.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4292
		    ] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4293
			self exit.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4294
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4295
		] newProcess.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4296
		process priority:(Processor userSchedulingPriority).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4297
		process name:'main'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4298
		process beGroupLeader.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4299
		process resume.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4300
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4301
		Processor dispatchLoop.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4302
		self exit
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4303
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4304
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4305
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4306
	commandFile notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4307
	    SilentLoading := true.  "/ suppress the hello & copyright messages
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4308
	    self addStartBlock:
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4309
		[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4310
		    (self secureFileIn:commandFile) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4311
			('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4312
			OperatingSystem exit:1.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4313
		    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4314
		].
16091
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4315
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4316
"/            self startSchedulerAndBackgroundCollector.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4317
"/            keepSplashWindow ifFalse:[ self hideSplashWindow ].
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4318
"/            Initializing := false.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4319
"/
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4320
"/            (self secureFileIn:commandFile) ifFalse:[
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4321
"/                ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4322
"/                OperatingSystem exit:1.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4323
"/            ].
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4324
	] ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4325
	    "/ look for <command>.rc
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4326
	    "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4327
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4328
	    commandFile := self commandName asFilename withSuffix:'rc'.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4329
	    (didReadRCFile := commandFile exists and:[self secureFileIn:commandFile]) ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4330
		StandAlone ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4331
		    defaultRC := 'smalltalk.rc' "/asFilename
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4332
		] ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4333
		    defaultRC := 'stxapp.rc' "/asFilename
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4334
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4335
		"JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4336
		    to be started with different working directory than stx/projects/smalltalk !!!!!!"
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4337
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4338
		"/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4339
		didReadRCFile := (self getSystemFileName:defaultRC) notNil
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4340
				 and:[self secureFileIn:defaultRC].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4341
		didReadRCFile ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4342
		    StandAlone ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4343
			'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4344
			graphicalMode := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4345
		    ]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4346
		]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4347
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4348
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4349
	    "/ ('StandAlone is %1' bindWith:StandAlone) printCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4350
	    "/ ('Headless is %1' bindWith:HeadlessOperation) printCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4351
	    "/ ('Display is %1' bindWith:Display) printCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4352
	    "/ ('Screen is %1' bindWith:Screen) printCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4353
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4354
	    keepSplashWindow ifFalse:[ self hideSplashWindow ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4355
	    didReadRCFile ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4356
		'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4357
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4358
		"/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4359
		"/ No RC file found;
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4360
		"/ Setup more default stuff
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4361
		"/
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4362
		StandAlone ifFalse:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4363
		    "/ its a smalltalk - proceed in interpreter.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4364
		    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4365
		    graphicalMode := false.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4366
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4367
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4368
		"/ setup more defaults...
13537
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4369
"/                ObjectMemory startBackgroundCollectorAt:5.
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4370
"/                ObjectMemory startBackgroundFinalizationAt:5.
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4371
		self addStartBlock:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4372
		    self startSchedulerAndBackgroundCollector
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4373
		].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4374
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4375
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4376
	(CommandLineArguments includes:'--scripting') ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4377
	    self addStartBlock:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4378
		StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4379
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4380
	].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4381
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4382
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  4383
    HeadlessOperation ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4384
	graphicalMode := false.
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4385
    ].
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4386
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4387
    keepSplashWindow ifFalse:[ self hideSplashWindow ].
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4388
    self mainStartup:graphicalMode
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4389
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4390
    "Modified: / 17-12-2013 / 16:44:40 / cg"
13536
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4391
!
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4392
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4393
startSchedulerAndBackgroundCollector
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4394
    Processor startTimeSlicing.
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4395
    Processor supportDynamicPriorities:true.
13537
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4396
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4397
    ObjectMemory startBackgroundCollectorAt:5.
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4398
    ObjectMemory startBackgroundFinalizationAt:5.
13536
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4399
    ObjectMemory backgroundCollectProcess priorityRange:(4 to:9).
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4400
    ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9).
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4401
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4402
    "Created: / 31-07-2011 / 20:01:33 / cg"
11808
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4403
!
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4404
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4405
startStartBlockProcess
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4406
    "at the end of the smalltalk initialization, start all actions that
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4407
     were delayed until the ProcessorScheduler is running in a separate process"
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4408
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4409
    |p|
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4410
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4411
    p :=
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4412
	[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4413
	    self executeStartBlocks.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4414
	] newProcess.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  4415
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  4416
    p
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4417
	priority:(Processor userSchedulingPriority);
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4418
	name:'start block handler';
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4419
	beGroupLeader;
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4420
	resume.
13892
3a39b1ef1d6f changed:
Claus Gittinger <cg@exept.de>
parents: 13883
diff changeset
  4421
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4422
    "Modified: / 07-01-2012 / 12:59:01 / cg"
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4423
! !
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4424
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4425
!Smalltalk class methodsFor:'startup and exit'!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4426
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4427
addExitBlock:aBlock
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4428
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4429
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4430
    "add a block to be executed when Smalltalk finishes.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4431
     This feature is currently not used anywhere - but could be useful for
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4432
     cleanup in stand alone applications.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4433
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4434
     Better use: ObjectMemory>>#addDependent: and handle the change message
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4435
     #aboutToQuit."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4436
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4437
    ExitBlocks isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4438
	ExitBlocks := OrderedCollection with:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4439
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4440
	ExitBlocks add:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4441
    ]
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4442
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4443
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4444
addImageStartBlock:aBlock
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4445
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4446
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4447
    "add a blocks to be executed in a separate process after
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4448
     everything has been initialized.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4449
     These blocks will be executed after an image restart."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4450
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4451
    ImageStartBlocks isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4452
	ImageStartBlocks := OrderedCollection with:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4453
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4454
	ImageStartBlocks add:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4455
    ]
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4456
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4457
    "Created: 9.9.1996 / 16:48:20 / stefan"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4458
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4459
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4460
addStartBlock:aBlock
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4461
    "to be called ONLY during very early startup (before the process scheduler
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4462
     is started) to add a block to be executed in a separate process after
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4463
     everything has been initialized.
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4464
     Used to allow a startup script (which is executed BEFORE the scheduler and
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4465
     UI display is startup up) to add actions which require those subsystems to
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4466
     be operating.
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4467
     These blocks will be executed only once and not be executed after an image restart.
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4468
     Initial processes such as the launcher are usually started here
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4469
     (see smalltalk.rc / private.rc).
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4470
     ONLY to be called from such an rc file."
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4471
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4472
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4473
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4474
    "/ to protect against "mis-users" of this mehtod...
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4475
    Initializing ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4476
	aBlock value
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4477
    ] ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4478
	StartBlocks isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4479
	    StartBlocks := OrderedCollection with:aBlock
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4480
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4481
	    StartBlocks add:aBlock
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4482
	]
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4483
    ].
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4484
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4485
    "Created: / 09-09-1996 / 16:46:53 / stefan"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4486
    "Modified (comment): / 18-08-2011 / 09:18:42 / cg"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4487
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4488
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4489
exit
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4490
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4491
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4492
    "finish the Smalltalk system"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4493
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4494
    self exit:0
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4495
    "not reached"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4496
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4497
    "Be careful evaluating this
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4498
     Smalltalk exit
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4499
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4500
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4501
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4502
exit:statusInteger
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4503
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4504
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4505
    "finish the Smalltalk system"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4506
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4507
    ObjectMemory changed:#aboutToExit.  "/ for ST/X backward compatibility
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4508
    ObjectMemory changed:#aboutToQuit.  "/ for ST-80 compatibility
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4509
    ExitBlocks notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4510
	ExitBlocks do:[:aBlock |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4511
	    aBlock value
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4512
	]
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4513
    ].
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4514
    OperatingSystem exit:statusInteger
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4515
    "not reached"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4516
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4517
    "Be careful evaluating this
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4518
     Smalltalk exit:1
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4519
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4520
! !
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4521
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  4522
!Smalltalk class methodsFor:'startup queries'!
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4523
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4524
commandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4525
    "return the full command line arguments (with which ST/X was started)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4526
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4527
    ^ CommandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4528
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4529
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4530
     Smalltalk commandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4531
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4532
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4533
    "Created: 19.7.1996 / 11:09:06 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4534
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4535
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4536
commandLineArgumentNamed:aString
16110
c17880a91e5e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16100
diff changeset
  4537
    "extract a named argument from the command line arguments.
c17880a91e5e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16100
diff changeset
  4538
     This searches for the given string in the command line and returns the next argument after it."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4539
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4540
    |args index|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4541
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4542
    args := self commandLineArguments.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4543
    index := args indexOf:aString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4544
    (index between:1 and:(args size - 1)) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4545
	^ args at:index+1
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4546
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4547
    ^ nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4548
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4549
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4550
     self commandLineArgumentNamed:'-display'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4551
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4552
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4553
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4554
commandLineArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4555
    "return the user command line arguments;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4556
     This is a collection of strings (separated command line words),
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4557
     from which the internal startup arguments have already been removed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4558
     I.e. if started with: 'smalltalk -I -f xxx foo bar baz',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4559
     the commandLineArguments will be #('foo' 'bar' 'baz').
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4560
     In contrast, the value returned by #commandLine will be the full set of words."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4561
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4562
    ^ CommandLineArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4563
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4564
    "Modified: 19.7.1996 / 11:11:03 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4565
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4566
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4567
commandName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4568
    "return the excutables name - this is normally 'stx',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4569
     but can be something else for standAlone apps."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4570
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4571
    ^ CommandName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4572
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4573
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4574
     Smalltalk commandName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4575
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4576
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4577
    "Modified: 19.7.1996 / 11:11:16 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4578
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4579
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4580
hasNoConsole
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4581
    "return true, if this is a console-less application (i.e. I am winstx)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4582
     i.e. there should be no writing to stdout/stderr"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4583
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4584
    ^ HasNoConsole ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4585
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4586
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4587
     Smalltalk hasNoConsole
9054
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  4588
    "
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  4589
!
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  4590
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4591
ignoreAssertions
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4592
    "return true, if assertions are to be ignored (i.e. not executed).
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4593
     This is false by default in an IDE (i.e. full smalltalk),
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4594
     but can be set to true for standAlone applications
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4595
     (whether that is a good idea and helps, is another question)
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4596
     However, it may make the app a little faster, if assertions are compatational
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4597
     expensive, as they are skipped (the stc compiler is generatig code which skips those)."
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4598
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4599
    ^ IgnoreAssertions ? false
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4600
!
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  4601
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4602
ignoreAssertions:aBoolean
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4603
    "set to true, if assertions are to be ignored (i.e. not executed).
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4604
     This is false by default in an IDE (i.e. full smalltalk),
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4605
     but can be set to true for standAlone applications
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4606
     (whether that is a good idea and helps, is another question)
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4607
     However, it may make the app a little faster, if assertions are compatational
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4608
     expensive, as they are skipped (the stc compiler is generatig code which skips those)."
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4609
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  4610
    IgnoreAssertions := aBoolean
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4611
!
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  4612
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4613
isHeadless
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4614
    "return true, if this is a headless application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4615
     i.e. no default Display connection is required/used"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4616
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4617
    ^ HeadlessOperation ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4618
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4619
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4620
     Smalltalk isHeadless
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4621
    "
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4622
!
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4623
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4624
isPlugin
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4625
    "return true, if this is a plugin application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4626
     i.e. running in a browserWindow"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4627
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4628
    ^ IsPlugin ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4629
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4630
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4631
     Smalltalk isPlugin
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4632
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  4633
!
4957
d2470714f2da headless stuff
Stefan Vogel <sv@exept.de>
parents: 4956
diff changeset
  4634
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4635
isSTScript
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4636
    "return true, if this is stscript. i.e. the stx scripting engine."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4637
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4638
    ^ IsSTScript ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4639
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4640
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4641
     Smalltalk isSTScript
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4642
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4643
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4644
    "Created: / 06-12-2006 / 16:41:21 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4645
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4646
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4647
isSharedLibraryComponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4648
    "return true, if this is a shared library component of another application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4649
     i.e. a dll within another app."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4650
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4651
    ^ IsSharedLibraryComponent ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4652
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4653
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4654
     Smalltalk isSharedLibraryComponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4655
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4656
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4657
    "Created: / 10-08-2006 / 13:09:34 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4658
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4659
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4660
isSmalltalkDevelopmentSystem
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4661
    "return true, if this is a real smalltalk system
17421
9f2dac6c6efb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17399
diff changeset
  4662
     i.e. NOT a stripped or a linked standAlone application (such as the webServer)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4663
     and NOT a plugIn (i.e. running in a browser)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4664
     and NOT a sharedLibrary component (i.e. a dll in another app).
17421
9f2dac6c6efb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17399
diff changeset
  4665
     This is used to determine, whether debugging is possible/desired or not."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4666
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4667
    self isPlugin ifTrue:[^ false].                     "/ I am a browser-plugin
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4668
    self isSharedLibraryComponent ifTrue:[^ false].     "/ I am a COM-ponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4669
    self isSTScript ifTrue:[^ true ].                   "/ I am stScript
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  4670
    ^ self isStandAloneApp not.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4671
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4672
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4673
     Smalltalk isSmalltalkDevelopmentSystem
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4674
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4675
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4676
    "Created: / 10-08-2006 / 13:12:49 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4677
    "Modified: / 06-12-2006 / 16:42:56 / cg"
15565
3dae2c24b592 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15334
diff changeset
  4678
    "Modified (comment): / 27-07-2013 / 15:36:20 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4679
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4680
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4681
isStandAloneApp
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4682
    "return true, if this is a standAlone application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4683
     i.e. a stripped & linked application (such as the webServer)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4684
     in contrast to a full smalltalk (development) system."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4685
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4686
    ^ StandAlone ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4687
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4688
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4689
     Smalltalk isStandAloneApp
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4690
    "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4691
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4692
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4693
isStandAloneDebug
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4694
    "return true, if this is a standAlone application which
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4695
     was started with the -debug option."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4696
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4697
    ^ DebuggingStandAlone ? false
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4698
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4699
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4700
     Smalltalk isStandAloneDebug
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4701
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4702
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4703
    "Created: / 19-01-2012 / 10:17:41 / cg"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4704
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4705
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4706
startupArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4707
    "return the arguments passed to StartupClass when stx gets started.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4708
     Usually these are nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4709
     but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4710
     a simple way to configure and create stand-alone applications"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4711
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4712
    ^ StartupArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4713
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4714
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4715
     Smalltalk startupArguments
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4716
    "
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4717
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4718
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4719
startupClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4720
    "return the class, that will get the start message when smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4721
     starts and its non-nil. Usually this is nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4722
     but saving an image with a non-nil StartupClass/StartupSelector/StartupArgs allows for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4723
     a simple way to configure and create stand-alone applications"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4724
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4725
    ^ StartupClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4726
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4727
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4728
     Smalltalk startupClass
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4729
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  4730
!
8570
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  4731
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4732
startupClass:aClass selector:aSymbol arguments:anArrayOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4733
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4734
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4735
    "set the class, selector and arguments to be performed when smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4736
     starts. Setting those before saving a snapshot, will make the saved
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4737
     image come up executing your application (instead of the normal mainloop)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4738
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4739
    StartupClass := aClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4740
    StartupSelector := aSymbol.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  4741
    StartupArguments := anArrayOrNil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  4742
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  4743
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4744
startupSelector
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4745
    "return the selector, that will be sent to StartupClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4746
     Usually this is nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4747
     but saving an image with a non-nil StartupClass/StartupSelector allows for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4748
     a simple way to configure and create stand-alone applications"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4749
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4750
    ^ StartupSelector
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4751
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4752
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4753
     Smalltalk startupSelector
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4754
    "
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4755
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4756
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4757
wasStartedFromImage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4758
    "return true, if this smalltalk was started from an image,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4759
     as opposed to a fresh and clean startup"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4760
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4761
    ^ ImageRestartTime notNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4762
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4763
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4764
     Smalltalk wasStartedFromImage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4765
    "
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  4766
! !
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  4767
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  4768
!Smalltalk class methodsFor:'system environment'!
1069
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  4769
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4770
language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4771
    "return the language setting"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4772
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4773
    ^ Language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4774
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4775
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4776
     Smalltalk language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4777
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4778
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4779
    "Modified: 26.4.1996 / 17:10:05 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4780
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4781
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4782
language:aLanguageSymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4783
    "set the language - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4784
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4785
    Language := aLanguageSymbol asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4786
    self changed:#Language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4787
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4788
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4789
     Smalltalk language:#de
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4790
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4791
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4792
    "Modified: / 19-10-2006 / 23:17:29 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4793
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4794
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4795
language:aLanguageSymbol territory:aTerritorySymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4796
    "set the language & territory - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4797
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4798
    Language := aLanguageSymbol asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4799
    LanguageTerritory := aTerritorySymbol asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4800
    self changed:#Language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4801
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4802
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4803
     Smalltalk language:#de territory:#de
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4804
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4805
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4806
    "Created: / 19-10-2006 / 22:16:22 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4807
    "Modified: / 19-10-2006 / 23:17:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4808
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4809
13212
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4810
languageAndTerritory
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4811
    "return the language and territory in the format lang-terr (i.e. de-de, en-us)"
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4812
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4813
    ^ Language , '-' , (LanguageTerritory ? Language)
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4814
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4815
    "
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4816
     Smalltalk languageAndTerritory
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4817
    "
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4818
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4819
    "Created: / 16-01-2011 / 10:19:42 / cg"
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4820
!
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  4821
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4822
languageTerritory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4823
    "return the language territory setting"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4824
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4825
    ^ LanguageTerritory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4826
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4827
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4828
languageTerritory:aTerritorySymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4829
    "set the language territory - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4830
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4831
    LanguageTerritory := aTerritorySymbol asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4832
    self changed:#LanguageTerritory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4833
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4834
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4835
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4836
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4837
     Smalltalk languageTerritory:#us.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4838
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4839
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4840
     Smalltalk languageTerritory:#de.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4841
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4842
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4843
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4844
    "Modified: / 19-10-2006 / 23:17:40 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4845
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4846
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4847
setLanguage:aLanguageSymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4848
    "set the language without change notification"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4849
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4850
    Language := aLanguageSymbol.
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4851
!
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4852
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4853
setLanguage:aLanguageSymbol territory:aTerritorySymbol
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4854
    "set the language & territory - no change notification"
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4855
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4856
    Language := aLanguageSymbol asSymbol.
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  4857
    LanguageTerritory := aTerritorySymbol asSymbol.
1069
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  4858
! !
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  4859
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  4860
!Smalltalk class methodsFor:'system management'!
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  4861
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4862
compressSources
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4863
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4864
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4865
    "compress the sources file, and remove all method source strings
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4866
     from the system and replace them by refs to a string in the source file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4867
     This is a bit different in ST/X than in other smalltalks,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4868
     since we use per-class sourcefiles for the compiled classes,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4869
     and a mix of in-memory strings and one-for-all sourceFile for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4870
     incremental compiled methods.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4871
     Therefore, only those sources which are not coming from compiled
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4872
     methods are put into the 'st.src' file - all others are untouched.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4873
     This is being automated - so dont care for now."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4874
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4875
    |newStream table source pos fileName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4876
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4877
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4878
     first, find all methods which contain either a string-ref
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4879
     or an external string in the 'st.src' file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4880
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4881
    newStream := 'src.tmp' asFilename writeStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4882
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4883
    table := IdentityDictionary new:100.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4884
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4885
    Method allSubInstancesDo:[:aMethod |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4886
	source := nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4887
	aMethod sourcePosition notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4888
	    aMethod sourceFilename = 'st.src' ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4889
		source := aMethod source.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4890
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4891
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4892
	    source := aMethod source
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4893
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4894
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4895
	source notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4896
	    pos := newStream position + 1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4897
	    newStream nextChunkPut:source.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4898
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4899
	    "
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4900
	     dont change the methods info - maybe some write error
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4901
	     occurs later, in that case we abort and leave everything
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4902
	     untouched.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4903
	    "
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4904
	    table at:aMethod put:pos
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4905
	]
11655
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  4906
    ].
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  4907
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  4908
    newStream syncData; close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4909
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4910
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4911
     now, rename the new source file,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4912
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4913
    fileName := (ObjectMemory nameForSources).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4914
    'src.tmp' asFilename renameTo:fileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4915
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4916
    "good - now go over all changed methods, and change their
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4917
     source reference"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4918
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4919
    table keysAndValuesDo:[:aMethod :pos |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4920
	aMethod localSourceFilename:fileName position:pos.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4921
"/        aMethod printCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4922
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4923
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4924
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4925
     Smalltalk compressSources
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4926
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4927
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4928
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4929
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4930
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4931
generateSingleSourceFile
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4932
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4933
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4934
    "generate the sources file, and remove all method source strings
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4935
     from the system and replace them by refs to a string in the source file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4936
     This makes the image independent from the per-class source files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4937
     and makes transportation of endUser applications easier, since
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4938
     only 3 files (executable, image and sourceFile) need to be
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4939
     transported."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4940
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4941
    |newStream table source pos fileName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4942
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4943
    newStream := 'src.tmp' asFilename writeStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4944
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4945
    table := IdentityDictionary new:100.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4946
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4947
    Method allSubInstancesDo:[:aMethod |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4948
	source := aMethod source.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4949
	source notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4950
	    pos := newStream position + 1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4951
	    newStream nextChunkPut:source.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4952
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4953
	    "
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4954
	     dont change the methods info - maybe some write error
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4955
	     occurs later, in that case we abort and leave everything
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4956
	     untouched.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4957
	    "
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4958
	    table at:aMethod put:pos
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4959
	]
11655
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  4960
    ].
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  4961
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  4962
    newStream syncData; close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4963
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4964
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4965
     now, rename the new source file,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4966
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4967
    fileName := (ObjectMemory nameForSources).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4968
    'src.tmp' asFilename renameTo:fileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4969
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4970
    "good - now go over all changed methods, and change their
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4971
     source reference"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4972
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4973
    table keysAndValuesDo:[:aMethod :pos |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4974
	aMethod localSourceFilename:fileName position:pos.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4975
"/        aMethod printCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4976
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4977
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4978
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4979
     Smalltalk generateSingleSourceFile
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4980
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4981
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4982
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4983
    "Created: 17.10.1997 / 13:00:56 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4984
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4985
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4986
installAutoloadedClassFromSourceFile:aFilename
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4987
    "install aFilename (which must be a smalltalk source file) as autoloaded class
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4988
     (extract the class definition chunk from the file and create an autoloaded
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4989
      class stub for it)"
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4990
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4991
    |chunks filename|
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4992
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4993
    filename := aFilename asFilename.
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4994
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4995
    ChangeSet::InvalidChangeChunkError handle:[:ex |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4996
	^ self
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  4997
    ] do:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4998
	filename readingFileDo:[:s|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4999
	    chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5000
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5001
    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5002
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5003
    chunks
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5004
	select:[:eachChunk | eachChunk isClassDefinitionChange]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5005
	thenDo:[:eachClassChunk |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5006
		eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5007
	].
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5008
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5009
    "Created: / 01-08-2013 / 16:57:26 / cg"
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5010
!
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5011
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5012
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5013
    "create & install an autoload stub for a class named: clsName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5014
     to be loaded from package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5015
     If revisionOrNil is non-nil, set it up to load exactly that revision
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5016
     (otherwise, the newest revision will be loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5017
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5018
    ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5019
	installAutoloadedClassNamed:clsName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5020
	category:cat
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5021
	package:package
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5022
	revision:revisionOrNil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5023
	numClassInstVars:nil.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5024
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5025
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5026
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5027
    "create & install an autoload stub for a class named: clsName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5028
     to be loaded from package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5029
     If revisionOrNil is non-nil, set it up to load exactly that revision
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5030
     (otherwise, the newest revision will be loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5031
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5032
    |clsSym cls|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5033
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5034
    clsSym := clsName asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5035
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5036
    "/ install if not already compiled-in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5037
    (cls := self at:clsSym) isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5038
	Autoload subclass:clsSym
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5039
	    instanceVariableNames:''
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5040
	    classVariableNames:''
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5041
	    poolDictionaries:''
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5042
	    category:cat
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5043
	    inEnvironment:Smalltalk.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5044
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5045
	cls := self at:clsSym.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5046
	cls isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5047
	    ('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5048
	] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5049
	    cls package:package asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5050
	    revisionOrNil notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5051
		cls setBinaryRevision:revisionOrNil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5052
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5053
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5054
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5055
	"/ class already present - however, if unloaded, check for category/package change
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5056
	cls isLoaded ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5057
	    package ~= cls package ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5058
		cls withoutUpdatingChangesDo:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5059
		    cls package:package asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5060
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5061
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5062
	    cat ~= cls category ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5063
		cls withoutUpdatingChangesDo:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5064
		    cls category:cat.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5065
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5066
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5067
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5068
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5069
    ^ cls.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5070
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5071
    "Created: / 05-11-1998 / 15:10:25 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5072
    "Modified: / 16-01-2007 / 12:56:18 / cg"
11169
32fda240ee57 #installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents: 11153
diff changeset
  5073
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5074
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5075
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5076
installAutoloadedClasses
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5077
    "scan all packages and install all classes found there as
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5078
     autoloaded. This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5079
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5080
    |dirsConsulted|
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5081
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  5082
    LoadInProgressQuery answerNotifyLoadingDo:[
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5083
	dirsConsulted := Set new.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5084
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5085
	"/ along the package-path
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5086
	self packagePath do:[:eachPathComponent |
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5087
	    (dirsConsulted includes:eachPathComponent) ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5088
		self
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5089
		    recursiveInstallAutoloadedClassesFrom:eachPathComponent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5090
		    rememberIn:dirsConsulted
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5091
		    maxLevels:15
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5092
		    noAutoload:false
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5093
		    packageTop:eachPathComponent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5094
		    showSplashInLevels:2.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5095
	    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5096
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5097
	self splashInfo:nil.
17548
e7eab3f01aba class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17534
diff changeset
  5098
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5099
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5100
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5101
     Smalltalk installAutoloadedClasses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5102
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5103
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5104
    "Created: / 14.2.1997 / 17:32:57 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5105
    "Modified: / 13.12.1999 / 11:56:50 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5106
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5107
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5108
installAutoloadedClassesFrom:anAbbrevFilePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5109
    "read the given abbreviation file; install all classes found there as
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5110
     autoloaded. This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5111
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5112
    |f s|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5113
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5114
    f := self getSystemFileName:anAbbrevFilePath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5115
    f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5116
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5117
    f notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5118
	f := f asFilename.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5119
	f isDirectory ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5120
	    f := f construct:'abbrev.stc'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5121
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5122
	[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5123
	    s := f readStream.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5124
	    self installAutoloadedClassesFromStream:s.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5125
	    s close.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5126
	] on:FileStream openErrorSignal
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5127
	do:[:ex| "do nothing"].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5128
    ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5129
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5130
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5131
     Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5132
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5133
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5134
    "Modified: / 5.11.1998 / 15:10:51 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5135
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5136
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5137
installAutoloadedClassesFromAbbrevFile:aFilename
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5138
    aFilename readingFileDo:[:abbrevStream |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5139
	self installAutoloadedClassesFromStream:abbrevStream.
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5140
    ]
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5141
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5142
    "Created: / 29-07-2011 / 20:39:21 / cg"
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5143
!
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5144
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5145
installAutoloadedClassesFromStream:anAbbrevFileStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5146
    "read the given abbreviation file;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5147
     install all classes found there as autoloaded, and also update the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5148
     abbreviation (className-to-fileName mapping) table.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5149
     This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5150
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5151
    |s2 l abbrevFileName info clsName cls abbrev package cat numClassInstVars words w|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5152
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5153
    anAbbrevFileStream isFileStream ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5154
	abbrevFileName := anAbbrevFileStream pathName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5155
	info := 'declared from: ', abbrevFileName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5156
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5157
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5158
    "/ yes, create any required nameSpace, without asking user.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5159
    Class createNameSpaceQuerySignal answer:true do:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5160
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5161
	[anAbbrevFileStream atEnd] whileFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5162
	    l := anAbbrevFileStream nextLine withoutSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5163
	    "Skip empty lines and comments"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5164
	    (l notEmpty and:[l first ~= $#]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5165
		"/ must do it manually, caring for quoted strings.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5166
"/                words := line asCollectionOfWords.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5167
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5168
		words := OrderedCollection new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5169
		s2 := l readStream.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5170
		[s2 atEnd] whileFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5171
		    s2 skipSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5172
		    s2 peek == $' ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5173
			s2 next.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5174
			w := s2 upTo:$'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5175
			s2 skipSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5176
		    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5177
			w := s2 upToSeparator
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5178
		    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5179
		    words add:w
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5180
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5181
		words size < 3 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5182
		    'Smalltalk [warning]: bad abbrev entry' errorPrint.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5183
		    anAbbrevFileStream isFileStream ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5184
			' (in ''' errorPrint.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5185
			anAbbrevFileStream pathName errorPrint.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5186
			''')' errorPrint
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5187
		    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5188
		    ': ' errorPrint. l errorPrintCR
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5189
		] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5190
		    clsName := (words at:1) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5191
		    abbrev := (words at:2).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5192
		    package := (words at:3) asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5193
		    cat := words at:4 ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5194
		    numClassInstVars := words at:5 ifAbsent:'0'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5195
		    numClassInstVars := Integer readFrom:numClassInstVars onError:[0].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5196
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5197
		    (cat size == 0) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5198
			cat := 'autoloaded'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5199
		    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5200
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5201
		    "/ on the fly, update the abbreviations
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5202
		    self setFilename:abbrev forClass:clsName package:package.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5203
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5204
		    "/ '  autoloaded: ' print. clsName print. ' in ' print. cat printCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5205
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5206
		    cls := self
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5207
			installAutoloadedClassNamed:clsName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5208
			category:cat
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5209
			package:package
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5210
			revision:nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5211
			numClassInstVars:numClassInstVars.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5212
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5213
"/                    info notNil ifTrue:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5214
"/                        cls setComment:info.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5215
"/                    ].
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5216
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5217
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5218
	]
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  5219
    ]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5220
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5221
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5222
loadBinaries
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5223
    "return true, if binaries should be loaded into the system,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5224
     false if this should be suppressed. The default is false (for now)."
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5225
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5226
    ^ LoadBinaries
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5227
!
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5228
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5229
loadBinaries:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5230
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5231
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5232
    "turn on/off loading of binary objects"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5233
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5234
    aBoolean ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5235
	(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5236
	    LoadBinaries := true.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5237
	    ^ self
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5238
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5239
	'Smalltalk [info]: this system does not support binary loading' infoPrintCR.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5240
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5241
    LoadBinaries := false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5242
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5243
    "Modified: 10.1.1997 / 15:11:00 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5244
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5245
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5246
logDoits
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5247
    "return true if doits should go into the changes file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5248
     as well as changes - by default, this is off, since
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5249
     it can blow up the changes file enormously ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5250
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5251
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5252
    ^ LogDoits
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5253
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5254
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5255
     LogDoits := false
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5256
     LogDoits := true
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5257
    "
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5258
!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5259
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5260
logDoits:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5261
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5262
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5263
    "turn on/off logging of doits in the changes file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5264
     By default, this is off, since it can blow up the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5265
     changes file enormously ...
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5266
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5267
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5268
    LogDoits := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5269
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5270
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5271
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5272
makeBytecodeMethods
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5273
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5274
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5275
    "walk over all methods and make each a bytecode method
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5276
     iff it does not contain primitive C code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5277
     Experimental and not yet used."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5278
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5279
    Method allSubInstancesDo:[:aMethod |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5280
	|newMethod|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5281
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5282
	aMethod hasPrimitiveCode ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5283
	    newMethod := aMethod asByteCodeMethod.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5284
	    newMethod ~~ aMethod ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5285
		aMethod becomeSameAs:newMethod
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5286
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5287
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5288
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5289
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5290
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5291
     Smalltalk makeBytecodeMethods
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5292
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5293
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5294
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5295
    "Created: 17.10.1997 / 13:52:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5296
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5297
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5298
recursiveInstallAutoloadedClassesFrom:aTopDirectory
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5299
    "scan all packages and install all classes found there as
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5300
     autoloaded. This takes some time ..."
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5301
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5302
    |dirsConsulted|
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5303
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5304
    dirsConsulted := Set new.
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5305
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5306
    self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5307
	recursiveInstallAutoloadedClassesFrom:aTopDirectory
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5308
	rememberIn:dirsConsulted
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5309
	maxLevels:15
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5310
	noAutoload:false
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5311
	packageTop:nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5312
	showSplashInLevels:-1.
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5313
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5314
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5315
    "
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5316
     Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler'
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5317
    "
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5318
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5319
    "Created: / 31-07-2012 / 15:27:40 / cg"
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5320
!
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5321
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5322
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5323
    "read all abbrev.stc files from and under aDirectory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5324
     and install autoloaded classes.
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5325
     If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded,
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5326
     but classes in subdirectories are installed, if the subdirectory contains a file
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5327
     named AUTOLOAD.
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5328
     If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5329
     If a file called NOPACKAGES is found, no further searching is done in that directory or below."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5330
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5331
    self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5332
	recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5333
	maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5334
	showSplashInLevels:0.
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5335
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5336
    "
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5337
     Smalltalk installAutoloadedClasses
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5338
    "
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5339
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5340
    "Modified: / 17-08-2006 / 16:48:43 / cg"
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5341
!
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5342
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  5343
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5344
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5345
showSplashInLevels:showSplashInLevels
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5346
    "read all abbrev.stc files from and under aDirectory
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5347
     and install autoloaded classes.
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5348
     If a file called NOAUTOLOAD is found, no classes there are installed as autoloaded,
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5349
     but classes in subdirectories are installed, if the subdirectory contains a file
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5350
     named AUTOLOAD.
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5351
     If a file called NOSUBAUTOLOAD is found, no classes there and below are installed as autoloaded.
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5352
     If a file called NOPACKAGES is found, no further searching is done in that directory or below."
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5353
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5354
    |dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5355
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5356
    dir := aDirectory asFilename.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5357
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5358
    "/ Care for non-existent directories"
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5359
    dir exists ifFalse:[ ^ self ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5360
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5361
    dirName := dir physicalPathName.            "take care of symbolic links"
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5362
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5363
    (dirsConsulted includes:dirName) ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5364
	^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5365
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5366
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  5367
    (dir / 'NOPACKAGES') exists ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5368
	^ self.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5369
    ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  5370
    (dir / 'NOSUBAUTOLOAD') exists ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5371
	^ self.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5372
    ].
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5373
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5374
    maxLevels == 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5375
	Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName).
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5376
	^ self
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5377
    ].
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5378
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5379
    dirsConsulted add:dirName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5380
    noAutoloadHere := noAutoloadIn.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5381
    noAutoloadHere ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5382
	(dir / 'NOAUTOLOAD') exists ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5383
	    noAutoloadHere := true.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5384
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5385
    ] ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5386
	(dir / 'AUTOLOAD') exists ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5387
	    noAutoloadHere := false.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5388
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5389
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5390
11393
5964970e515c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11392
diff changeset
  5391
    showSplashInLevels >= 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5392
	self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5393
				bindWith:(dirName contractAtBeginningTo:35)).
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5394
    ].
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5395
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5396
    "/
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5397
    "/ suppress installation as autoloaded in this and everything
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5398
    "/ below; however, still traverse the directories to find packages ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5399
    "/
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5400
    haveAbbrevDotSTC := false.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5401
    noAutoloadHere ifFalse:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5402
	[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5403
	    self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc').
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5404
	    haveAbbrevDotSTC := true.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5405
	] on:FileStream openErrorSignal
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5406
	do:[:ex|
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5407
	    "ignore this file"
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5408
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5409
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5410
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5411
    [
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5412
	directoryContents := dir directoryContents.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5413
    ] on:FileStream openErrorSignal do:[:ex|
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5414
	"non-accessable directory: we are done"
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5415
	^ self
16199
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  5416
    ].
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  5417
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  5418
    directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5419
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  5420
    directoryContents removeAllFoundIn:#(
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5421
			    'objbc' 'objvc' 'objmingw'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5422
			    'doc'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5423
			    'CVS'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5424
			    'bitmaps'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5425
			    'resources'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5426
			    'source'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5427
			    'not_delivered'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5428
			    'not_ported'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5429
			).
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  5430
    dir baseName = 'stx' ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5431
	directoryContents removeAllFoundIn:#(
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5432
			    'configurations'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5433
			    'include'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5434
			    'rules'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5435
			    'stc'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5436
			    'support'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5437
			).
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  5438
    ].
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  5439
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  5440
    directoryContents do:[:eachFilenameString |
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5441
	|f|
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5442
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5443
	f := dir / eachFilenameString.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5444
	f isDirectory ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5445
	     self
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5446
		recursiveInstallAutoloadedClassesFrom:f
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5447
		rememberIn:dirsConsulted
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5448
		maxLevels:maxLevels-1
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5449
		noAutoload:noAutoloadHere
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5450
		packageTop:packageTopPath
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5451
		showSplashInLevels:showSplashInLevels - 1.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5452
	] ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5453
	    (noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5454
		f suffix = 'st' ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5455
		    [
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5456
			self installAutoloadedClassFromSourceFile:f.
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5457
			f directory baseName = 'libbasic' ifTrue:[self halt].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5458
		    ] on:FileStream openErrorSignal do:[:ex|
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5459
			"ignore this file, but write a warning"
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5460
			Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description).
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5461
		    ].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5462
		]
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5463
	    ].
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5464
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5465
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5466
11393
5964970e515c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11392
diff changeset
  5467
    showSplashInLevels >= 0 ifTrue:[
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5468
	self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...'
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
  5469
				bindWith:(dirName contractAtBeginningTo:35)).
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5470
    ].
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5471
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5472
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5473
     Smalltalk installAutoloadedClasses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5474
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5475
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5476
    "Modified: / 01-08-2013 / 16:57:49 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5477
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5478
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5479
replaceReferencesTo:anObject with:newRef
12194
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  5480
    "if the receiver refers to the argument, anObject, replace this reference with newRef.
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  5481
     Return true, if any reference was changed.
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  5482
     Notice: this does not change the class-reference."
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  5483
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5484
    |toAdd|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5485
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5486
    toAdd := OrderedCollection new.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5487
    self keysAndValuesDo:[:key :val |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5488
	(key == anObject) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5489
	    self shouldImplement.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5490
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5491
	(val == anObject ) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5492
	    toAdd add:(key -> newRef)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5493
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5494
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5495
    toAdd do:[:each |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5496
	self at:(each key) put:(each value)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5497
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5498
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5499
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5500
saveEmergencyImage:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5501
    "set/clear the flag which controls if ST/X should save an
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5502
     emergency image in case of a broken display connection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5503
     The default is true.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5504
     This may be useful, if you work with an unsecure display
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5505
     (serial line), and want to have a chance of proceeding after
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5506
     a crash. In multiheaded applications, this only affects
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5507
     crashes of the master Display connection (the initial connection);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5508
     errors on other displays are reported to the views and treated
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5509
     like window destroy from the windowManager."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5510
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5511
    SaveEmergencyImage := aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5512
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5513
    "Modified: / 24.10.1997 / 18:22:26 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5514
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5515
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5516
systemOrganization
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5517
    "for partial ST80 compatibility;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5518
     In ST80, Smalltalk organization returns a systemOrganizer, which
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5519
     keeps track of class-categories, while all classes return a classOrganizer
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5520
     from #organization, which keeps track of method categories of that class.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5521
     Since in ST/X, Smalltalk is a class, there is now a conflict.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5522
     To make a workaround possible, use #systemOrganization when porting
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5523
     VW apps to ST/X to get the class-categories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5524
     Read the documentation in SystemOrganizer for more info."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5525
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5526
    ^ SystemOrganizer for:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5527
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5528
    "Created: / 20.6.1998 / 12:24:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5529
    "Modified: / 20.6.1998 / 12:41:34 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5530
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5531
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5532
!Smalltalk class methodsFor:'system management-fileIn'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5533
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5534
fileIn:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5535
    "read in the named file - look for it in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5536
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5537
     This method can load almost anything which makes sense:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5538
	.st    - source files
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5539
	.cls   - binary smalltalk bytecode files
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5540
	.so    - binary compiled machine code class libraries
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5541
	[.class - java bytecode -- soon to come]"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5542
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5543
    ^ self fileIn:aFileName lazy:nil silent:nil logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5544
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5545
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5546
     Smalltalk fileIn:'source/TicTacToe.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5547
     Smalltalk fileIn:'binary/TicTacToe.cls'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5548
     Smalltalk fileIn:'binary/TicTacToe.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5549
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5550
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5551
    "Created: 28.10.1995 / 17:06:28 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5552
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5553
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5554
fileIn:aFileName inPackage:aPackageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5555
    "read in the named file in a packages directory."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5556
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5557
    |dir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5558
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5559
    dir := self getPackageDirectoryForPackage:aPackageID.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5560
    dir isNil ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5561
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5562
    dir := dir asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5563
    ^ (self fileIn:(dir construct:aFileName))
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5564
      or:[ self fileIn:((dir construct:'source') construct:aFileName) ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5565
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5566
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5567
fileIn:aFileName lazy:lazy
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5568
    "read in the named file - look for it in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5569
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5570
     If lazy is true, no code is generated for methods, instead stubs
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5571
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5572
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5573
     Since no syntax checks are done when doing lazy fileIn, use this only for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5574
     code which is known to be syntactically correct."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5575
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5576
    ^ self fileIn:aFileName lazy:lazy silent:nil logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5577
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5578
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5579
     Smalltalk fileIn:'source/TicTacToe.st' lazy:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5580
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5581
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5582
    "Created: 28.10.1995 / 17:06:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5583
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5584
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5585
fileIn:aFileName lazy:lazy silent:silent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5586
    "read in the named file - look for it in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5587
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5588
     If lazy is true, no code is generated for methods, instead stubs
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5589
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5590
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5591
     Since no syntax checks are done when doing lazy fileIn, use this only for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5592
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5593
     If silent is true, no compiler messages are output to the transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5594
     Giving nil for silent/lazy will use the current settings."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5595
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5596
    ^ self fileIn:aFileName lazy:lazy silent:silent logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5597
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5598
    "Created: 28.10.1995 / 17:06:41 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5599
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5600
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5601
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5602
    "read in the named file - look for it in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5603
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5604
     If lazy is true, no code is generated for methods, instead stubs
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5605
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5606
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5607
     Since no syntax checks are done when doing lazy fileIn, use this only for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5608
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5609
     If silent is true, no compiler messages are output to the transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5610
     Giving nil for silent/lazy will use the current settings.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5611
     This method can load almost anything which makes sense:
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5612
	.st    - source files
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5613
	.cls   - binary smalltalk bytecode files
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5614
	.so    - binary compiled machine code class libraries
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5615
	[.class - java bytecode -- soon to come]"
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5616
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  5617
    |fileNameString inStream path morePath bos|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5618
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5619
    fileNameString := aFileNameOrString asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5620
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5621
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5622
     an object or shared object ?
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5623
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5624
    (ObjectFileLoader notNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5625
    and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5626
	"/ LoadBinaries ifFalse:[^ false].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5627
	path := self getBinaryFileName:fileNameString.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5628
	path isNil ifTrue:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5629
	    path := self getSystemFileName:fileNameString.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5630
	].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5631
	path isNil ifTrue:[^ false].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5632
	^ (ObjectFileLoader loadObjectFile:path) notNil
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5633
    ].
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5634
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5635
    inStream := self systemFileStreamFor:fileNameString.
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5636
    inStream isNil ifTrue:[^ false].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5637
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5638
    (fileNameString asFilename hasSuffix:'cls') ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5639
	BinaryObjectStorage notNil ifTrue:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5640
	    [
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5641
		inStream binary.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5642
		bos := BinaryObjectStorage onOld:inStream.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5643
		bos next.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5644
	    ] ensure:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5645
		bos close.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5646
	    ].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5647
	    ^ true
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5648
	].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5649
	^ false
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5650
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5651
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5652
    (fileNameString includes:$/) ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5653
	"/ temporarily prepend the file's directory
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5654
	"/ to the searchPath.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5655
	"/ This allows fileIn-driver files to refer to local
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5656
	"/ files via a relative path, and drivers to fileIn other
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5657
	"/ drivers ...
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  5658
	morePath := inStream pathName asFilename directoryName.
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5659
    ].
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  5660
    ^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5661
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5662
    "
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5663
     Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  5664
     Smalltalk fileIn:'keyboard.rc'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5665
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5666
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5667
    "Modified: / 08-09-2006 / 19:21:16 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5668
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5669
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5670
fileIn:aFileName logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5671
    "read in the named file - look for it in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5672
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5673
     The argument logged controls, if the changefile is to be updated."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5674
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5675
    ^ self fileIn:aFileName lazy:nil silent:nil logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5676
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5677
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5678
     Smalltalk fileIn:'source/TicTacToe.st' logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5679
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5680
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5681
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5682
fileIn:aFileName silent:silent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5683
    "read in the named file - look for it in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5684
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5685
     If silent is true, no compiler messages are output to the transcript."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5686
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5687
    ^ self fileIn:aFileName lazy:nil silent:silent logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5688
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5689
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5690
     Smalltalk fileIn:'source/TicTacToe.st' silent:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5691
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5692
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5693
    "Created: 28.10.1995 / 17:06:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5694
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5695
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5696
fileInChanges
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5697
    "read in the last changes file - bringing the system to the state it
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5698
     had when left the last time.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5699
     WARNING: this method is rubbish: it should only read things after the
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5700
	      last '**snapshot**' - entry
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5701
	      (instead of the complete changes file)."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5702
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5703
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5704
     do NOT update the changes file now ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5705
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5706
    self fileIn:ChangeFileName logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5707
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5708
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5709
     Smalltalk fileInChanges
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5710
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5711
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5712
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5713
fileInClass:aClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5714
    "find a source/object file for aClassName and -if found - load it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5715
     search is in some standard places trying driver-file (.ld), object-file (.o) and
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5716
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5717
     The file is first searched for using the class name, then the abbreviated name."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5718
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5719
    ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5720
	fileInClass:aClassName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5721
	package:nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5722
	initialize:true
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5723
	lazy:false
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5724
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5725
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5726
    "Modified: / 9.1.1998 / 14:41:46 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5727
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5728
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5729
fileInClass:aClassName fromObject:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5730
    "read in the named object file and dynamic-link it into the system
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5731
     - look for it in some standard places.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5732
     Only install the named class from this object file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5733
     Return true if ok, false if failed."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5734
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5735
    |path ok|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5736
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5737
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5738
     check if the dynamic loader class is in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5739
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5740
    (LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5741
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5742
    (path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5743
    ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5744
    ok ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5745
	VerboseLoading ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5746
	    Transcript show:'  loaded ' , aClassName , ' from ' ; showCR:aFileName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5747
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5748
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5749
    ^ ok
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5750
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5751
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5752
     Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5753
     Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5754
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5755
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  5756
    "Modified: / 04-11-2011 / 13:42:24 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5757
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5758
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5759
fileInClass:aClassName initialize:doInit
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5760
    "find a source/object file for aClassName and -if found - load it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5761
     search is in some standard places trying driver-file (.ld), object-file (.o) and
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5762
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5763
     The file is first searched for using the class name, then the abbreviated name."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5764
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5765
    ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5766
	fileInClass:aClassName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5767
	package:nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5768
	initialize:doInit
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5769
	lazy:false
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5770
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5771
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5772
    "Modified: / 9.1.1998 / 14:42:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5773
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5774
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5775
fileInClass:aClassName initialize:doInit lazy:loadLazy
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5776
    "find a source/object file for aClassName and -if found - load it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5777
     search is in some standard places trying driver-file (.ld), object-file (.o) and
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5778
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5779
     The file is first searched for using the class name, then the abbreviated name."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5780
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5781
     ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5782
	fileInClass:aClassName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5783
	package:nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5784
	initialize:doInit
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5785
	lazy:loadLazy
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5786
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5787
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5788
    "Modified: / 9.1.1998 / 14:42:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5789
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5790
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5791
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5792
    "find a source/object file for aClassName and -if found - load it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5793
     Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5794
     finally source file (.st), in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5795
     The file is first searched for using the class name, then the abbreviated name.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5796
     The argument doInit controlls if the class should be sent a #initialize after the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5797
     load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5798
     should not send notes to the transcript; it can be true, false or nil, where
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5799
     nil uses the value from SilentLoading."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5800
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5801
    ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5802
	fileInClass:aClassName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5803
	package:nil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5804
	initialize:doInit
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5805
	lazy:loadLazy
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5806
	silent:beSilent
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5807
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5808
    "Modified: / 9.1.1998 / 14:42:28 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5809
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5810
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5811
fileInClass:aClassName package:package
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5812
    "find a source/object file for aClassName and -if found - load it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5813
     search is in some standard places trying driver-file (.ld), object-file (.o) and
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5814
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5815
     The file is first searched for using the class name, then the abbreviated name."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5816
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5817
    ^ self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5818
	fileInClass:aClassName
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5819
	package:package
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5820
	initialize:true
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5821
	lazy:false
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5822
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5823
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5824
    "Created: / 08-01-2007 / 10:06:09 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5825
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5826
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  5827
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5828
    "find a source/object file for aClassName and -if found - load it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5829
     This is the workhorse for autoloading.
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  5830
     Search is in some standard places, trying driver-file (.ld), object-file (.so / .o) and
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5831
     finally source file (.st), in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5832
     The file is first searched for using the class name, then the abbreviated name.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5833
     The argument doInit controlls if the class should be sent a #initialize after the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5834
     load; loadLazy tells if it should be loaded lazyly. beSilent tells if the compiler
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5835
     should not send notes to the transcript; it can be true, false or nil, where
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5836
     nil uses the value from SilentLoading."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5837
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  5838
    |classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5839
     filenameToSet packageDir packageFile bos|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5840
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  5841
    ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[
17582
4d4475b60428 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17576
diff changeset
  5842
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5843
	wasLazy := Compiler compileLazy:loadLazy.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5844
	beSilent notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5845
	    wasSilent := self silentLoading:beSilent.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5846
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5847
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5848
	classFileName := Smalltalk fileNameForClass:aClassName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5849
	(classFileName = aClassName) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5850
	    "/ no abbrev.stc translation for className
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5851
	    (aClassName includes:$:) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5852
		"/ a nameSpace name
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5853
		alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5854
	    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5855
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5856
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5857
	classFileName asFilename isAbsolute ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5858
	    classFileName asFilename suffix notEmptyOrNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5859
		ok := self fileIn:classFileName lazy:loadLazy silent:beSilent.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5860
	    ] ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5861
		ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5862
	    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5863
	] ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5864
	    classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5865
	    [
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5866
		Class withoutUpdatingChangesDo:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5867
		    |zarFn zar entry|
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5868
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5869
		    ok := false.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5870
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5871
		    package notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5872
			packageDir := package asPackageId projectDirectory.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5873
			"/ packageDir := package asString.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5874
			"/ packageDir := packageDir copyReplaceAll:$: with:$/.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5875
			packageDir isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5876
			    packageDir := self packageDirectoryForPackageId:package
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5877
			].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5878
			packageDir notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5879
			    packageDir := packageDir asFilename.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5880
			].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5881
		    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5882
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5883
		    Class packageQuerySignal answer:package do:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5884
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5885
			 then, if dynamic linking is available,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5886
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5887
			(LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5888
			    sharedLibExtension := ObjectFileLoader sharedLibraryExtension.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5889
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5890
			     first look for a class packages shared binary in binary/xxx.o
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5891
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5892
			    libName := self libraryFileNameOfClass:aClassName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5893
			    libName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5894
				(ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension))
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5895
				ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5896
				    sharedLibExtension ~= '.o' ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5897
					ok := self fileInClass:aClassName fromObject:(libName, '.o')
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5898
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5899
				].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5900
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5901
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5902
			     then, look for a shared binary in binary/xxx.o
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5903
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5904
			    ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5905
				(ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension))
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5906
				ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5907
				    sharedLibExtension ~= '.o' ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5908
					ok := self fileInClass:aClassName fromObject:(classFileName, '.o')
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5909
				    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5910
				    ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5911
					alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5912
					    (ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension))
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5913
					    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5914
						sharedLibExtension ~= '.o' ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5915
						    ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o')
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5916
						]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5917
					    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5918
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5919
				    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5920
				].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5921
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5922
			].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5923
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5924
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5925
			 if that did not work, look for a compiled-bytecode file ...
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5926
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5927
			ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5928
			    (ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5929
			    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5930
				alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5931
				    ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5932
				]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5933
			    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5934
			].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5935
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5936
			 if that did not work, and the classes package is known,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5937
			 look for an st-cls file
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5938
			 in a package subdir of the source-directory ...
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5939
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5940
			ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5941
			    (packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5942
				packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5943
				packageFile isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5944
				    packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5945
				].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5946
				(ok := self fileIn:packageFile lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5947
				ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5948
				    alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5949
					packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5950
					packageFile isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5951
					    packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5952
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5953
					ok := self fileIn:packageFile lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5954
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5955
				].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5956
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5957
				zarFn := self getPackageFileName:(packageDir / 'classes.zip').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5958
				zarFn notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5959
				    zar := ZipArchive oldFileNamed:zarFn.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5960
				    zar notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5961
					entry := zar extract:(classFileName , '.cls').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5962
					(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5963
					    entry := zar extract:(alternativeClassFileName , '.cls').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5964
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5965
					entry notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5966
					    bos := BinaryObjectStorage onOld:(entry asByteArray readStream).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5967
					    bos next.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5968
					    bos close.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5969
					    ok := true
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5970
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5971
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5972
				]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5973
			    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5974
			].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5975
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5976
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5977
			 if that did not work, look for an st-source file ...
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5978
			"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5979
			ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5980
			    filenameToSet := classFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5981
			    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5982
			    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5983
				alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5984
				    filenameToSet := alternativeClassFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5985
				    ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5986
				].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5987
				ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5988
				    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5989
				     ... and in the standard source-directory
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5990
				    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5991
				    filenameToSet := 'source' asFilename / classFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5992
				    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5993
				    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5994
					alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5995
					    filenameToSet := 'source' asFilename / alternativeClassFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5996
					    ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5997
					]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5998
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  5999
				]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6000
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6001
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6002
			     if that did not work, and the classes package is known,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6003
			     look for an st-source file
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6004
			     in a package subdir of the source-directory ...
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6005
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6006
			    ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6007
				packageDir notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6008
				    packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6009
				    packageFile isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6010
					packageFile := (packageDir / 'source' / classFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6011
				    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6012
				    filenameToSet := packageFile.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6013
				    (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6014
				    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6015
					alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6016
					    packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6017
					    packageFile isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6018
						packageFile := (packageDir / 'source' / alternativeClassFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6019
					    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6020
					    filenameToSet := packageFile.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6021
					    ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6022
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6023
					ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6024
					    packageFile := self getPackageSourceFileName:(packageDir / classFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6025
					    packageFile isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6026
						packageFile := (packageDir / classFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6027
					    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6028
					    filenameToSet := packageFile.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6029
					    (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6030
					    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6031
						alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6032
						    packageFile := self getPackageFileName:(packageDir / alternativeClassFileName).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6033
						    packageFile isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6034
							packageFile := packageDir / alternativeClassFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6035
						    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6036
						    filenameToSet := packageFile.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6037
						    ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6038
						].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6039
						ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6040
						    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6041
						     ... and in the standard source-directory
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6042
						    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6043
						    filenameToSet := 'source' asFilename / packageDir / classFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6044
						    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6045
						    ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6046
							alternativeClassFileName notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6047
							    filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6048
							    ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6049
							]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6050
						    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6051
						]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6052
					    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6053
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6054
				    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6055
				]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6056
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6057
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6058
			     if that did not work, and the classes package is known,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6059
			     look for a zipArchive containing a class entry.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6060
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6061
			    ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6062
				packageDir notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6063
				    zarFn := self getPackageFileName:(packageDir / 'source.zip').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6064
				    zarFn isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6065
					zarFn := packageDir withSuffix:'zip'.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6066
					zarFn := self getSourceFileName:zarFn.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6067
				    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6068
				    (zarFn notNil and:[zarFn asFilename exists]) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6069
					zar := ZipArchive oldFileNamed:zarFn.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6070
					zar notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6071
					    entry := zar extract:(classFileName , '.st').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6072
					    (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6073
						entry := zar extract:(alternativeClassFileName , '.st').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6074
					    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6075
					    entry notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6076
						filenameToSet := zarFn.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6077
						ok := self
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6078
							fileInStream:(entry asString readStream)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6079
							lazy:loadLazy
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6080
							silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6081
							logged:false
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6082
							addPath:nil
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6083
					    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6084
					]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6085
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6086
				]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6087
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6088
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6089
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6090
			     if that did not work,
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6091
			     look for a zipArchive containing a class entry.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6092
			    "
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6093
			    ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6094
				zarFn := self getSourceFileName:'source.zip'.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6095
				zarFn notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6096
				    zar := ZipArchive oldFileNamed:zarFn.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6097
				    zar notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6098
					entry := zar extract:(zarFn := classFileName , '.st').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6099
					(entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6100
					    entry := zar extract:(zarFn := alternativeClassFileName , '.st').
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6101
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6102
					entry notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6103
					    filenameToSet := zarFn.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6104
					    ok := self
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6105
						    fileInStream:(entry asString readStream)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6106
						    lazy:loadLazy
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6107
						    silent:beSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6108
						    logged:false
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6109
						    addPath:nil
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6110
					].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6111
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6112
				]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6113
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6114
			    ok ifFalse:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6115
				"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6116
				 if there is a sourceCodeManager, ask it for the classes sourceCode
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6117
				"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6118
				(mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6119
				    inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6120
				    inStream notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6121
					filenameToSet := nil.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6122
					ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6123
				    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6124
				].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6125
			    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6126
			].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6127
		    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6128
		].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6129
	    ] ensure:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6130
		Compiler compileLazy:wasLazy.
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6131
		wasSilent notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6132
		    self silentLoading:wasSilent
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6133
		]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6134
	    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6135
	].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6136
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6137
	ok ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6138
	    newClass := self at:(aClassName asSymbol).
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6139
	    newClass notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6140
		"set the classes name - but do not change if already set"
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6141
		filenameToSet notNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6142
		    newClass getClassFilename isNil ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6143
			newClass setClassFilename:(filenameToSet asFilename baseName)
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6144
		    ].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6145
		].
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6146
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6147
		doInit ifTrue:[
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6148
		    newClass initialize
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6149
		]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6150
	    ]
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
  6151
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6152
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6153
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6154
    ^ newClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6155
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6156
    "Created: / 09-01-1998 / 14:40:32 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6157
    "Modified: / 05-06-1999 / 14:53:01 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6158
    "Modified: / 16-08-2009 / 14:52:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6159
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6160
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6161
fileInClassLibrary:aClassLibraryName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6162
    "find an object file containing a binary class library in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6163
     and load it. This install all of its contained classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6164
     Return true if ok, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6165
     Notice: the argument may not have an extension (by purpose);
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6166
	     the sharedLib extension (.dll / .so / .sl) is added here, to
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6167
	     make the caller independent of the underlying operatingSystem."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6168
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6169
    |path fn|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6170
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6171
    ObjectFileLoader isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6172
	^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6173
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6174
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6175
    fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6176
    fn := fn pathName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6177
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6178
    path := self getBinaryFileName:fn.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6179
    path isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6180
	path := self getSystemFileName:fn.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6181
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6182
    path isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6183
	^ PackageNotFoundError raiseRequestWith:aClassLibraryName.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6184
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6185
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6186
    (ObjectFileLoader loadObjectFile:path) isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6187
	^ PackageLoadError raiseRequestWith:aClassLibraryName.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6188
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6189
    ^ true.
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6190
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6191
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6192
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6193
     Smalltalk fileInClassLibrary:'libtable'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6194
     Smalltalk fileInClassLibrary:'binary/libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6195
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6196
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6197
    "Modified: 8.1.1997 / 17:58:56 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6198
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6199
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6200
fileInClassLibrary:aClassLibraryName inPackage:packageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6201
    "find an object file containing a binary class library in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6202
     and load it. This installs all of its contained classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6203
     Return true if ok, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6204
     Notice: the argument may not have an extension (by purpose);
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6205
	     the sharedLib extension (.dll / .so / .sl) is added here, to
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6206
	     make the caller independent of the underlying operatingSystem."
11689
d08d5db473c5 Find windows DLLs under package\objbc in development environment
Stefan Vogel <sv@exept.de>
parents: 11681
diff changeset
  6207
11690
b48d486944fc fix for previous revision
Stefan Vogel <sv@exept.de>
parents: 11689
diff changeset
  6208
    |baseName handle libraryFilename packagePath|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6209
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6210
    ObjectFileLoader isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6211
	^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader'
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6212
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6213
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6214
    baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6215
    baseName exists ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6216
	"/ load local file first...
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6217
	handle := ObjectFileLoader loadObjectFile:baseName.
12744
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6218
    ].
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6219
    handle isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6220
	packagePath := self getPackageDirectoryForPackage:packageID.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6221
	packagePath isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6222
	    ^ PackageNotFoundError raiseRequestWith:packageID.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6223
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6224
	packagePath := packagePath asFilename.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6225
	libraryFilename := packagePath / baseName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6226
	libraryFilename exists ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6227
	    libraryFilename := nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6228
	    #('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6229
		"in windows, with Borland compiler, DLLs in development environment are under objbc;
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6230
		 with MSVC, they are under objvc"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6231
		libraryFilename isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6232
		    libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6233
		    libraryFilename exists ifFalse:[ libraryFilename := nil ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6234
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6235
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6236
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6237
	(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6238
	    handle := ObjectFileLoader loadObjectFile:libraryFilename pathName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6239
	].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6240
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6241
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6242
    handle isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6243
	^ PackageNotFoundError raiseRequestWith:packageID.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6244
    ].
12744
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6245
"/    handle notNil ifTrue:[
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6246
"/        Transcript showCR:('    Smalltalk: loaded %1.' bindWith:libraryFilename pathName).
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6247
"/    ].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6248
    ^ true.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6249
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6250
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6251
     Smalltalk fileInClassLibrary:'libtable'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6252
     Smalltalk fileInClassLibrary:'binary/libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6253
     Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6254
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6255
13787
1695a24d0fa7 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 13785
diff changeset
  6256
    "Modified: / 08-10-2011 / 00:08:51 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6257
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6258
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6259
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6260
    "Try all available programming languages"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6261
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6262
    |filename|
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6263
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6264
    filename := filenameArg asFilename.
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6265
    ProgrammingLanguage allDo:[:lang| | f |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6266
	f := (filename hasSuffix:lang sourceFileSuffix)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6267
		    ifTrue:[filename]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6268
		    ifFalse:[filename addSuffix:lang sourceFileSuffix].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6269
	(self fileIn:f lazy:loadLazy silent:beSilent)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6270
		ifTrue:[^ true]
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6271
    ].
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6272
    ^ false
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6273
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6274
    "Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6275
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6276
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6277
fileInStream:streamArg
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6278
    ^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6279
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6280
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6281
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6282
    "read sourceCode from aStream;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6283
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6284
     If lazy is true, no code is generated for methods, instead stubs
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6285
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6286
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6287
     Since no syntax checks are done when doing lazy fileIn, use this only for
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6288
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6289
     If silent is true, no compiler messages are output to the transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6290
     Giving nil for silent/lazy will use the current settings.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6291
     If morePath is nonNil, it is prepended to the systemPath temporarily during the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6292
     fileIn. This allows for st-expressions to refer to more files (i.e. fileIn more)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6293
     using a relative path."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6294
11427
ac373ee02301 refactored
Claus Gittinger <cg@exept.de>
parents: 11400
diff changeset
  6295
    |inStream wasLazy wasSilent oldSystemPath oldRealPath|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6296
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6297
    inStream := streamArg.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6298
    inStream isNil ifTrue:[^ false].
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  6299
    inStream := LineNumberReadStream on:inStream.
12611
38d61d374d89 care for nonPositionable stream (stdin) in fileIn
Claus Gittinger <cg@exept.de>
parents: 12557
diff changeset
  6300
    inStream := EncodedStream isNil
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6301
		    ifTrue:[ inStream ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6302
		    ifFalse:[ EncodedStream decodedStreamFor:inStream ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6303
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6304
    lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6305
    silent notNil ifTrue:[wasSilent := self silentLoading:silent].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6306
    morePath notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6307
	oldSystemPath := SystemPath copy.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6308
	SystemPath addFirst:morePath.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6309
	oldRealPath := RealSystemPath.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6310
	RealSystemPath := nil.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6311
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6312
    [
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6313
	(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6314
	    "JV: Changed to give ProgrammingLanguage to choose
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6315
	     proper reader"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6316
	    (ProgrammingLanguage forStream: inStream)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6317
		fileInStream: inStream
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6318
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6319
    ] ensure:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6320
	morePath notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6321
	    "take care, someone could have changed SystemPath during fileIn!!"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6322
	    (SystemPath copyFrom:2) = oldSystemPath ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6323
		SystemPath := oldSystemPath.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6324
		RealSystemPath := oldRealPath.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6325
	    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6326
		(oldSystemPath includes:morePath) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6327
		    SystemPath remove:morePath ifAbsent:[].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6328
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6329
		RealSystemPath := nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6330
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6331
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6332
	lazy notNil ifTrue:[Compiler compileLazy:wasLazy].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6333
	silent notNil ifTrue:[self silentLoading:wasSilent].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6334
	inStream close
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6335
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6336
    ^ true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6337
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6338
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6339
     Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6340
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6341
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6342
    "Modified: / 05-11-1996 / 20:03:35 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6343
    "Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6344
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6345
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6346
isClassLibraryLoaded:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6347
    "return true, if a particular class library is already loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6348
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6349
    ObjectMemory
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6350
	binaryModuleInfo
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6351
	    do:[:entry |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6352
		   entry type == #classLibrary ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6353
		       entry libraryName = name ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6354
			  ^ true        "/ already loaded
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6355
		       ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6356
		   ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6357
	       ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6358
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6359
    ^ false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6360
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6361
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6362
     Smalltalk isClassLibraryLoaded:'libstx_libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6363
     Smalltalk isClassLibraryLoaded:'libstx_libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6364
     Smalltalk isClassLibraryLoaded:'libstx_libboss'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6365
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6366
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6367
    "Modified: / 23-08-2006 / 15:54:46 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6368
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6369
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6370
loadClassLibraryIfAbsent:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6371
    "dynamically load a classLibrary, if not already loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6372
     and the system supports dynamic loading.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6373
     Return true, if the library is loaded, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6374
     This entry is called without system specific filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6375
     extensions - it is portable among different architectures
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6376
     as long as corresponding files (x.so / x.dll / x.sl / x.o)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6377
     are be present ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6378
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6379
    (self isClassLibraryLoaded:name) ifTrue:[ ^ true ].  "/ already loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6380
    ^ self fileInClassLibrary:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6381
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6382
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6383
     Smalltalk loadClassLibraryIfAbsent:'libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6384
     Smalltalk loadClassLibraryIfAbsent:'libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6385
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6386
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6387
    "Modified: 31.10.1996 / 16:57:24 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6388
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6389
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  6390
secureFileIn:aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6391
    "read in the named file, looking for it at standard places.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  6392
     Catch various errors during fileIn.
13000
28bd279e2574 changed: #secureFileIn:
Stefan Vogel <sv@exept.de>
parents: 12919
diff changeset
  6393
     Return true if ok, false if failed"
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  6394
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6395
    |retVal|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6396
16025
f8583a01459e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16013
diff changeset
  6397
    Parser isNil ifTrue:[^ false].      "/ for small stand alone apps.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6398
    retVal := false.
16025
f8583a01459e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16013
diff changeset
  6399
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  6400
    (SignalSet
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6401
	with:AbortOperationRequest
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6402
	with:TerminateProcessRequest
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6403
	with:Parser parseErrorSignal)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6404
	    handle:[:ex | ex return ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6405
	    do:[ retVal := self fileIn:aFileName ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6406
    ^ retVal
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6407
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6408
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6409
silentFileIn:aFilename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6410
    "same as fileIn:, but do not output 'compiled...'-messages on Transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6411
     Main use is during startup."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6412
13353
cf8d1605652f changed: #silentFileIn:
Stefan Vogel <sv@exept.de>
parents: 13323
diff changeset
  6413
    self silentlyLoadingDo:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6414
	self fileIn:aFilename
13353
cf8d1605652f changed: #silentFileIn:
Stefan Vogel <sv@exept.de>
parents: 13323
diff changeset
  6415
    ].
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6416
! !
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6417
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6418
!Smalltalk class methodsFor:'system management-files'!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6419
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6420
bitmapFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6421
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6422
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6423
     Searches in subdirectories named 'bitmaps' in the SystemPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6424
     Notice: this does not look in the package-specific bitmaps directories."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6425
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6426
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6427
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6428
    aString := self getBitmapFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6429
    aString notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6430
	^ aString asFilename readStreamOrNil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6431
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6432
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6433
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6434
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6435
bitmapFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6436
    "backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6437
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6438
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6439
     then in the classes own package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6440
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6441
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6442
    ^ self imageFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6443
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6444
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6445
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6446
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6447
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6448
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6449
bitmapFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6450
    "backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6451
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6452
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6453
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6454
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6455
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6456
    ^ self imageFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6457
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6458
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6459
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6460
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6461
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6462
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6463
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6464
classNameForFile:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6465
    "return the className which corresponds to an abbreviated fileName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6466
     or nil if no special translation applies. The given filename arg may
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6467
     include a '.st' suffix (but no other)."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6468
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6469
    |fn|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6470
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6471
    (aFileName asFilename hasSuffix:'st') ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6472
	fn := aFileName copyButLast:3
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6473
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6474
	fn := aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6475
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6476
    ^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6477
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6478
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6479
     Smalltalk classNameForFile:'DrawObj'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6480
     Smalltalk classNameForFile:'DrawObj.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6481
     Smalltalk classNameForFile:'ArrColl.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6482
     Smalltalk classNameForFile:'ArrColl.chg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6483
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6484
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6485
    "Modified: 11.12.1995 / 14:51:10 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6486
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6487
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6488
constructPathFor:aDirectoryName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6489
    "search for aDirectory in SystemPath;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6490
     return a collection of pathes which include that directory."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6491
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6492
    ^ self realSystemPath select:[:dirName |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6493
	|fullPath|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6494
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6495
	fullPath := dirName asFilename construct:aDirectoryName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6496
	"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6497
	fullPath isDirectory and:[fullPath isReadable]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6498
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6499
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6500
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6501
fileInFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6502
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6503
     search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6504
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6505
     Searches in subdirectories named 'fileIn' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6506
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6507
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6508
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6509
    aString := self getFileInFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6510
    aString notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6511
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6512
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6513
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6514
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  6515
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6516
fileNameForClass:aClassOrClassName
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6517
    "return a actual or expected (or most wanted) filename for aClassOrClassName
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6518
     - only the base name (without directory part) and without suffix."
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6519
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6520
    |cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg |
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6521
12301
5d077b04f6f0 changed: #fileNameForClass:
fm
parents: 12300
diff changeset
  6522
"/  This was added as an extension of libsvn - should be no longer needed
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6523
"/  JV@2012-09-25: but it actually is. The problem is that class filename
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6524
"/  is stored in the class itself and used to generate abbrev.stc and
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6525
"/  prerequisites in makefiles. But if you renamed such a stc-compiled class,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6526
"/  the filename remains the same, but SVN __ALWAYS__ keep container name
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6527
"/  and class name in sync. Therefore build files gets messed up. Indeed, this
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6528
"/  should be fixed in code that files-out the package and generates build files.
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6529
"/  Certainly a hack, but do not remove this until fixed elsewhere
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6530
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6531
    compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'.
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6532
    (compatQuery notNil
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6533
      and:[compatQuery isLoaded
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6534
	and:[compatQuery query not]]) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6535
	    nm := aClassOrClassName isBehavior
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6536
		ifTrue:[aClassOrClassName name]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6537
		ifFalse:[aClassOrClassName].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6538
	    nm := nm copyReplaceAll:$: with:$_ ifNone:nm.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6539
	    ^nm
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6540
    ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6541
16122
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  6542
    "/ Same for another query for new libscm. Here we have to do
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  6543
    "/ this only for packages that are being filed out and NOT for others.
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  6544
    "/ The problem is that this method is also used for getting filenames
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  6545
    "/ of classes OUTSIDE filed-out package when generating makefile dependencies.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6546
    compatQuery := Smalltalk classNamed: 'SCMCompatModeQuery'.
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6547
    (compatQuery notNil
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6548
      and:[compatQuery isLoaded
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6549
	and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6550
	    | compatPkgs |
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6551
	    "/ Originally libscm could only fileout one package at time so
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6552
	    "/ the query answered one package name. However, to support nested
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6553
	    "/ packages, libscm is being rewritten to commit multiple packages
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6554
	    "/ at once, so query answers a collection of packages. The code below
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6555
	    "/ makes sure it works for both.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6556
	    compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6557
	    nm := aClassOrClassName isBehavior
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6558
		ifTrue:[aClassOrClassName name]
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6559
		ifFalse:[aClassOrClassName].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6560
	    cls := Smalltalk at: nm asSymbol.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6561
	    (cls notNil and:[compatPkgs includes: cls package]) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6562
		nm := nm copyReplaceAll:$: with:$_.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6563
		^nm
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6564
	    ].
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6565
    ].
12301
5d077b04f6f0 changed: #fileNameForClass:
fm
parents: 12300
diff changeset
  6566
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6567
    aClassOrClassName isBehavior ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6568
	cls := aClassOrClassName.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6569
    ] ifFalse:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6570
	cls := Smalltalk classNamed:aClassOrClassName.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6571
	cls isNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6572
	    nameWithPrefix := aClassOrClassName.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6573
	    nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1).
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6574
	].
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6575
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6576
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6577
    cls notNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6578
	nonMetaclass := cls theNonMetaclass.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6579
	nm := nonMetaclass getClassFilename.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6580
	nm isNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6581
	    |revisionInfo|
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6582
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6583
	    (revisionInfo := cls revisionInfo) notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6584
		nm := revisionInfo fileName.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6585
	    ].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6586
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6587
	nm notNil ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6588
	    ^ nm asFilename withoutSuffix baseName
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6589
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6590
	nameWithPrefix := nonMetaclass name.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6591
	nameWithoutPrefix := nonMetaclass nameWithoutPrefix.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6592
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6593
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6594
    CachedAbbreviations notNil ifTrue:[
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6595
	nameWithPrefix := nameWithPrefix asSymbol.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6596
	(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6597
	    ^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6598
	].
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6599
	nameWithoutPrefix := nameWithoutPrefix asSymbol.
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6600
	(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6601
	    ^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  6602
	].
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6603
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6604
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6605
    ^ nameWithPrefix copyReplaceAll:$: with:$_
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6606
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6607
    "
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6608
     Smalltalk fileNameForClass:#Complex
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6609
     Smalltalk fileNameForClass:'SmallInteger'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6610
     Smalltalk fileNameForClass:'UnixOperatingSystem'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6611
     Smalltalk fileNameForClass:'Launcher'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6612
     Smalltalk fileNameForClass:'SomeUnknownClass'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6613
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6614
     Smalltalk fileNameForClass:HTML::Encoder
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6615
     Smalltalk fileNameForClass:OSI::FTAMOperation
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6616
     Smalltalk fileNameForClass:'OSI::Foobar'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6617
     Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons)
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6618
     Workflow::UnsuccessfulFinishReasons classFilename
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6619
    "
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6620
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6621
    "Modified: / 06-10-2006 / 16:16:01 / cg"
16122
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  6622
    "Modified: / 23-02-2014 / 10:39:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  6623
    "Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6624
!
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6625
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6626
filenameAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6627
    "return a dictionary containing the classname-to-filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6628
     mappings. (needed for sys5.3 users, where filenames are limited
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6629
     to 14 chars)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6630
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6631
    CachedAbbreviations isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6632
	self readAbbreviations
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6633
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6634
    ^ CachedAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6635
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6636
    "flush with:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6637
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6638
     CachedAbbreviations := nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6639
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6640
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6641
     Smalltalk filenameAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6642
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6643
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6644
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6645
findPackageDirectoryForPackage:aPackage
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6646
    "find a packages directory along a number of standard places"
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6647
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6648
    |relDir|
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6649
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6650
    relDir := Smalltalk relativePackagePathForPackage:aPackage.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6651
    relDir asFilename isAbsolute ifTrue:[^ relDir].
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6652
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6653
    ^ Smalltalk getPackageFileName:relDir.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6654
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6655
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6656
     Smalltalk findPackageDirectoryForPackage:'stx:libview/resources'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6657
     Smalltalk findPackageDirectoryForPackage:'stx:libview'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6658
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6659
!
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  6660
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6661
flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6662
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6663
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6664
    "forget pathCaches - these are collections containing valid directory names,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6665
     where system files (resource, bitmaps etc.) are found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6666
     A flush is only required, if a new system directory has been created while
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6667
     the system is active, and those files should override the others
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6668
     (for example, if you created a private resource directory)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6669
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6670
    RealSystemPath := ResourcePath := SourcePath :=
15332
cc2fb912d04c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15315
diff changeset
  6671
    BinaryPath := FileInPath := nil.
cc2fb912d04c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15315
diff changeset
  6672
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6673
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6674
     Smalltalk flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6675
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6676
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6677
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6678
getBinaryFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6679
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6680
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6681
     (subdirectories named 'binary' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6682
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6683
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6684
    BinaryPath isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6685
	BinaryPath := self constructPathFor:BinaryDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6686
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6687
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6688
    ^ self searchPath:BinaryPath for:aFileName in:BinaryDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6689
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6690
    "Modified: 18.7.1996 / 15:53:49 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6691
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6692
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6693
getBitmapFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6694
    "for backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6695
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6696
     (subdirectories named 'bitmaps' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6697
     Return the pathName or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6698
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6699
    ^ self getBitmapFileName:aFileName forPackage:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6700
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6701
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6702
     Smalltalk getBitmapFileName:'SBrowser.xbm'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6703
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6704
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6705
    "Modified: 18.7.1996 / 15:53:55 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6706
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6707
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6708
getBitmapFileName:aFileName forPackage:aPackageIDOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6709
    "for backward compatibility.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6710
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6711
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6712
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6713
     Return a path or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6714
     Search order is:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6715
	bitmaps/<pkg>/file
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6716
	resources/<pkg>/bitmaps/file
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6717
	<pkg>/bitmaps/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6718
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6719
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6720
    |f dir packageDir pF|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6721
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  6722
    f := aFileName asString withoutPrefix:'bitmaps/'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6723
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6724
    aPackageIDOrNil isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6725
	"/ this will be an error in the future
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6726
"/        'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6727
"/        self halt.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6728
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6729
	pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps').
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6730
	pF notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6731
	    ^ pF.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6732
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6733
	f ~= aFileName ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6734
	    pF := self searchPath:(self realSystemPath) for:f in:('bitmaps').
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6735
	    pF notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6736
		^ pF.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6737
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6738
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6739
	^ nil
11077
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  6740
    ].
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  6741
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  6742
    dir := self projectDirectoryForPackage:aPackageIDOrNil.
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  6743
    dir notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6744
	pF := dir asFilename / f.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6745
	pF exists ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6746
	    ^ pF.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6747
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6748
	pF := dir asFilename / 'bitmaps' /f.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6749
	pF exists ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6750
	    ^ pF.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6751
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6752
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6753
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6754
    packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6755
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6756
    pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6757
    pF notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6758
	^ pF.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6759
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6760
    pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps').
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6761
    pF notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6762
	^ pF.
11077
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  6763
    ].
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  6764
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6765
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6766
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6767
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6768
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6769
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6770
     Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6771
     Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6772
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6773
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6774
    "Modified: / 11-10-2006 / 13:53:18 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6775
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6776
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6777
getFileInFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6778
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6779
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6780
     (subdirectories named 'fileIn' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6781
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6782
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6783
    FileInPath isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6784
	FileInPath := self constructPathFor:FileInDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6785
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6786
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6787
    ^ self searchPath:FileInPath for:aFileName in:FileInDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6788
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6789
    "Modified: 18.7.1996 / 15:53:59 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6790
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6791
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6792
getPackageDirectoryForPackage:aPackageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6793
    "search for a particular package; return its directory, or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6794
     Stand alone applications might get nil, if there are only binaries installed."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6795
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6796
    |checkForPackageDirectory module packageSubDirectory|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6797
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6798
    module := aPackageID asPackageId module.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6799
    packageSubDirectory := aPackageID asPackageId directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6800
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6801
    checkForPackageDirectory :=
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6802
	[:moduleDir |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6803
	    |packageDir|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6804
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6805
	    moduleDir isDirectory ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6806
		packageDir := moduleDir / packageSubDirectory.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6807
		packageDir isDirectory ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6808
		    ^ packageDir
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6809
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6810
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6811
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6812
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6813
    self packagePath do:[:aPath |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6814
	|moduleDir|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6815
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6816
	moduleDir := aPath asFilename / module.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6817
	checkForPackageDirectory value:moduleDir.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6818
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6819
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6820
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6821
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6822
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6823
     Smalltalk getPackageDirectoryForPackage:(Array package)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6824
     Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6825
     Smalltalk getPackageDirectoryForPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6826
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6827
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6828
    "Modified: / 06-10-2006 / 11:49:27 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6829
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6830
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6831
getPackageFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6832
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6833
     (packagePath and subdirectories named 'packages' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6834
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6835
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6836
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6837
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6838
    "/ search along packagePath ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6839
    f := self searchPath:self packagePath for:aFileName in:nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6840
    f isNil ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6841
	"/ search under packages-directory along systemPath ...
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6842
	f := self searchPath:self realSystemPath for:aFileName in:PackageDirName.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6843
	"/ kludge - allow for stx-directory to be named differently
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6844
	f isNil ifTrue:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6845
	    (aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6846
		f := '..' asFilename / '..' / (aFileName copyFrom:5).
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6847
	    ]
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6848
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6849
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6850
    (f notNil and:[(f := f asFilename) exists]) ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6851
	^ f pathName
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  6852
    ].
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  6853
    ^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6854
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6855
    "
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6856
     Smalltalk getPackageFileName:'stx/libview/resources/normal.style'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6857
     Smalltalk getPackageFileName:'stx/libview/styles/normal.style'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  6858
     Smalltalk getPackageFileName:'stx/libview/source.zip'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6859
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6860
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6861
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  6862
getPackageSourceFileName:filenameWithoutSuffixArg
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6863
    "search aFileName in some standard places and try all available languages"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6864
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  6865
    |filenameWithoutSuffix|
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  6866
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  6867
    filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename.
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  6868
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6869
    ProgrammingLanguage
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6870
	allDo:[:lang |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6871
	    |file|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6872
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6873
	    file := self
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6874
		    getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6875
	    file notNil ifTrue:[ ^ file ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6876
	].
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  6877
    ^ nil
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6878
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6879
    "Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6880
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6881
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6882
getResourceFileName:aFileName
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6883
    <resource: #obsolete>
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6884
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6885
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6886
     (subdirectories named 'resources' in SystemPath);
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6887
     return the absolute filename or nil if none is found.
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6888
     Obsolete: you must now provide a package argument."
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6889
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6890
    self obsoleteMethodWarning:'use getResourceFileName:forPackage:'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6891
    ^ self getResourceFileName:aFileName forPackage:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6892
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6893
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6894
     Smalltalk getResourceFileName:'SystemBrowser.rs'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6895
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6896
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6897
    "Modified: 18.7.1996 / 15:54:03 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6898
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6899
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6900
getResourceFileName:aFileName forClass:aClassOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6901
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6902
     (subdirectories named 'resource' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6903
     and in aClasses package directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6904
     Return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6905
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6906
    |pkgOrNil|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6907
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6908
    aClassOrNil notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6909
	pkgOrNil := aClassOrNil package.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6910
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6911
    ^ self getResourceFileName:aFileName forPackage:pkgOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6912
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6913
    "
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  6914
     Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6915
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6916
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6917
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6918
getResourceFileName:aFileName forPackage:aPackageIDOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6919
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6920
     (subdirectories named 'resource' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6921
     and in a packages directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6922
     Return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6923
     Search order is:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6924
	resources/<pkg>/file
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6925
	<pkg>/resources/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6926
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6927
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6928
    |pF f dir packageDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6929
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  6930
    f := aFileName asString withoutPrefix:'resources/'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6931
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6932
    aPackageIDOrNil isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6933
	"/ this will be an error in the future
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6934
"/        'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6935
"/        self halt.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6936
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6937
	pF := self searchPath:(self realSystemPath) for:aFileName in:('resources').
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6938
	pF notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6939
	    ^ pF.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6940
	].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6941
"/        pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/styles').
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6942
"/        pF notNil ifTrue:[
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6943
"/            ^ pF.
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6944
"/        ].
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6945
	f ~= aFileName ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6946
	    pF := self searchPath:(self realSystemPath) for:f in:('resources').
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6947
	    pF notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6948
		^ pF.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6949
	    ].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6950
"/            pF := self searchPath:(self realSystemPath) for:f in:('resources/styles').
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6951
"/            pF notNil ifTrue:[
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6952
"/                ^ pF.
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6953
"/            ].
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6954
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6955
	^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6956
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6957
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6958
    packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6959
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6960
    pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6961
    pF notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6962
	^ pF.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6963
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6964
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6965
    "/ the following code finds the file within the IDE's own hierarchy
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6966
    dir := self projectDirectoryForPackage:aPackageIDOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6967
    dir notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6968
	dir := dir asFilename.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6969
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6970
	(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6971
"/        (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  6972
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6973
	"resolve something like: 'ASN/definition.asn1'"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  6974
	(pF := dir / f) exists ifTrue:[ ^ pF name ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  6975
    ].
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  6976
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6977
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6978
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6979
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6980
     Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6981
     Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview'
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  6982
     Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview'
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  6983
     Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6984
     Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6985
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6986
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6987
    "Modified: / 11-10-2006 / 13:53:43 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6988
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6989
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6990
getSourceFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6991
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6992
     (subdirectories named 'source' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6993
     return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6994
     This is used to find a sourceFile for a methods source,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6995
     if no sourceCodeManager is available."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6996
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6997
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6998
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6999
    SourcePath isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7000
	SourcePath := self constructPathFor:SourceDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7001
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7002
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7003
    "/ first, try a source subdir along the path.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7004
    SourcePath notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7005
	f := self searchPath:SourcePath for:aFileName in:SourceDirName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7006
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7007
    f isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7008
	"/ then, try it itself along the path.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7009
	f := self searchPath:self realSystemPath for:aFileName in:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7010
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7011
    ^ f
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7012
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7013
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7014
     Smalltalk getSourceFileName:'Smalltalk.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7015
     Smalltalk getSourceFileName:'ArrColl.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7016
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7017
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7018
    "Modified: 18.7.1996 / 15:54:07 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7019
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7020
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7021
getSystemFileName:aFileNameOrString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7022
    "search aFileNameOrString in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7023
     return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7024
     see comment in Smalltalk>>initSystemPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7025
     This should be used to access resources such as bitmaps, doc-files,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7026
     and other help files.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7027
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7028
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7029
    "credits for this method go to Markus ...."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7030
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7031
    |fn nameString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7032
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7033
    fn := aFileNameOrString asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7034
    nameString := fn name.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7035
    fn isAbsolute ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7036
	"dont use path for absolute file names"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7037
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7038
	^ nameString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7039
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7040
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7041
    self realSystemPath do:[:dirName |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7042
	|realName|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7043
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7044
	realName := dirName asFilename / nameString.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7045
	"/
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7046
	"/ here, we also return true if its a directory
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7047
	"/ (Even if unreadable).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7048
	"/ It could be that the file itself is still readable.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7049
	"/
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7050
	(realName isDirectory or:[realName isReadable]) ifTrue: [
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7051
	    ^ realName name
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7052
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7053
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7054
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7055
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7056
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7057
     Smalltalk getSystemFileName:'doc/online/english/TOP.html'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7058
     Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7059
     Smalltalk getSystemFileName:'bitmaps/foo'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7060
     Smalltalk getSystemFileName:'resources/View.rs'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7061
     Smalltalk getSystemFileName:'resources/iris.style'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7062
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7063
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7064
    "Modified: / 6.5.1999 / 10:40:37 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7065
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7066
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7067
imageFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7068
    "search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7069
     first in the redefinable bitmaps path, then in the classes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7070
     own package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7071
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7072
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7073
    |classPackage img|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7074
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7075
    classPackage := aClass package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7076
    img := self imageFromFileNamed:aFileName inPackage:classPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7077
    img isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7078
	"/ try under the goodies package ...
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7079
	classPackage ~= 'stx:goodies' ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7080
	    img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7081
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7082
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7083
    ^ img
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7084
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7085
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7086
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7087
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7088
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7089
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7090
imageFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7091
    "search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7092
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7093
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7094
     Return an image or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7095
     Search order is:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7096
	bitmaps/<pkg>/file
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7097
	resources/<pkg>/bitmaps/file
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7098
	<pkg>/bitmaps/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7099
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7100
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7101
    |path|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7102
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7103
    path := self getBitmapFileName:aFileName forPackage:aPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7104
    path notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7105
	^ Image fromFile:path.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7106
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7107
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7108
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7109
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7110
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7111
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7112
     Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7113
     Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7114
     Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7115
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7116
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7117
    "Modified: / 08-09-2006 / 18:02:04 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7118
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7119
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7120
libraryFileNameOfClass:aClassOrClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7121
    "for a given class, return the name of a classLibrary which contains
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7122
     binary code for it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7123
     Read the libinfo file 'liblist.stc' (which is created during the compilation process)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7124
     for an entry for aClassOrClassName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7125
     Search for the className in the first col, and return the value found in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7126
     the 2nd col.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7127
     Return nil if no entry is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7128
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7129
     A nil returns means that this class is either built-in or not present
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7130
     in a package-class library (i.e. either as separate .o or separate .st file).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7131
     Otherwise, the returned name is the classLibrary object of that class.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7132
     The classes code can be loaded from that file if binary loading is supported."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7133
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7134
    |aStream line words n aClassName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7135
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7136
    aClassOrClassName isBehavior ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7137
	aClassName := aClassOrClassName name
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7138
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7139
	aClassName := aClassOrClassName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7140
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7141
    aClassName := aClassName asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7142
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7143
    #('include/liblist.stc')    "/ filenames
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7144
    with:#(2)                   "/ column
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7145
    do:[:fileName :col |
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7146
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7147
	aStream := self systemFileStreamFor:fileName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7148
	aStream notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7149
	    [aStream atEnd] whileFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7150
		line := aStream nextLine.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7151
		line notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7152
		    (line startsWith:'#') ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7153
			words := line asCollectionOfWords.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7154
			(n := words size) > 1 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7155
			    (words at:1) = aClassName ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7156
				n >= col ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7157
				    aStream close.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7158
				    ^ (words at:col) withoutSeparators
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7159
				]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7160
			    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7161
			]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7162
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7163
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7164
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7165
	    aStream close
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7166
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7167
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7168
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7169
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7170
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7171
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7172
     Smalltalk libraryFileNameOfClass:'ClockView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7173
     Smalltalk libraryFileNameOfClass:'Bag'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7174
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7175
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7176
    "Modified: 6.11.1995 / 15:41:39 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7177
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7178
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7179
packagePath
15781
3185deb3a8d2 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15766
diff changeset
  7180
    "return a collection of additional directory names, where smalltalk
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7181
     looks for package directories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7182
     Notice, that directories named 'packages' under the systemPath are
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7183
     always consulted - even if not in the packagePath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7184
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7185
    ^ PackagePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7186
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7187
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7188
     Smalltalk packagePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7189
     Smalltalk packagePath addLast:'/opt/smalltalk'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7190
     Smalltalk packagePath addFirst:'/usr/local/otherPackages'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7191
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7192
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7193
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7194
packagePath:aPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7195
    "set the packagePath;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7196
     a collection of additional directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7197
     looks for package directories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7198
     Notice, that directories named 'packages' under the systemPath are
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7199
     always consulted - even if not in the packagePath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7200
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7201
    PackagePath := aPath asOrderedCollection
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7202
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7203
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7204
     Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages')
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7205
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7206
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7207
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7208
projectDirectoryForClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7209
    "given a class, return the path to its package directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7210
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7211
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7212
    |pkg|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7213
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7214
    pkg := aClass package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7215
    pkg isNil ifTrue:[^ nil].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7216
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7217
    ^ self projectDirectoryForPackage:pkg.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7218
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7219
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7220
     Smalltalk projectDirectoryForClass:Array
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7221
     Smalltalk projectDirectoryForClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7222
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7223
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7224
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7225
projectDirectoryForPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7226
    "given a packageID, return the path to its package directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7227
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7228
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7229
    |prj prjDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7230
16642
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  7231
    ^ aPackage asPackageId packageDirectory.
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  7232
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7233
    "/ there might be a package specific resource directory ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7234
    "/ in the directory, from which the project was loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7235
    prj := Project projectWithId:aPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7236
    prj notNil ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7237
	prjDir := prj directory.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7238
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7239
    (prjDir notNil and:[prjDir asFilename exists]) ifFalse:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7240
	prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/).
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7241
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7242
    ^ prjDir
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7243
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7244
    "
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7245
     Smalltalk projectDirectoryForPackage:'stx:libbasic'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7246
     Smalltalk projectDirectoryForPackage:'exept:smartcard'
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7247
     Smalltalk projectDirectoryForPackage:'stx'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7248
     Smalltalk projectDirectoryForPackage:'bosch'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7249
     Smalltalk projectDirectoryForPackage:'bosch:foo'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7250
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7251
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7252
    "Modified: / 07-10-2006 / 17:45:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7253
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7254
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7255
readAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7256
    "read classname to filename mappings from include/abbrev.stc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7257
     sigh - all for those poor sys5.3 or MSDOS people with short filenames ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7258
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7259
    "since installAutoloadedClasses also reads all abbreviations, use it"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7260
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7261
    CachedAbbreviations := IdentityDictionary new.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7262
    self installAutoloadedClasses.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7263
    ^ CachedAbbreviations.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7264
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7265
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7266
     Smalltalk readAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7267
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7268
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7269
    "Modified: / 10.12.1999 / 17:48:53 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7270
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7271
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7272
readAbbreviationsFromStream:aStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7273
    "read classname to filename mappings from aStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7274
     sigh - all for those poor sys5.3 or MSDOS people with short filenames ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7275
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  7276
    self
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7277
	withAbbreviationsFromStream:aStream
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7278
	do:[:className :abbrev :pkg |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7279
	    self setFilename:abbrev forClass:className package:pkg.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7280
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7281
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7282
    "Modified: / 13.12.1999 / 11:54:17 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7283
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7284
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7285
realSystemPath
16642
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  7286
    "return the realSystemPath - that's the directory names from
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7287
     SystemPath which exist and are readable"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7288
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7289
    |nP|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7290
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7291
    RealSystemPath isNil ifTrue:[
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7292
	OperatingSystem isVMSlike ifTrue:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7293
	    "/ temporary kludge: since we cannot currently
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7294
	    "/ check for existence of a name like 'volume:',
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7295
	    "/ leave those in the Path without a check.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7296
	    RealSystemPath := SystemPath select:[:dirName |  |f|
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7297
		f := dirName asFilename.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7298
		f isVolumeOnly or:[(f isDirectory) and:[f isReadable]]
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7299
	    ]
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7300
	] ifFalse:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7301
	    RealSystemPath := SystemPath
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7302
		select:[:eachDirectoryName |  |f|
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7303
		    f := eachDirectoryName asFilename.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7304
		    (f isDirectory) and:[f isReadable]
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7305
		] thenCollect:[:eachDirectoryName|
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7306
		    eachDirectoryName asFilename pathName.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7307
		].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7308
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7309
	    "/ remove duplicates (but keep order)
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7310
	    nP := OrderedCollection new.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7311
	    RealSystemPath do:[:p |
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7312
		(nP includes:p) ifFalse:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7313
		    nP add:p
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7314
		]
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7315
	    ].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7316
	    (nP includes:'.') ifFalse:[
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7317
		nP add:'.'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7318
	    ].
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7319
	    RealSystemPath := nP.
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7320
	].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7321
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7322
    ^ RealSystemPath
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7323
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7324
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7325
recursiveReadAllAbbreviationsFrom:aDirectory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7326
    self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7327
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7328
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7329
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7330
    "read all abbreviations from and under aDirectory."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7331
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7332
    |abbrevStream dir directoryContents|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7333
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7334
    maxLevels == 0 ifTrue:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7335
"/        'Smalltalk [warning]: max directory nesting reached.' infoPrintCR.
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7336
	^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7337
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7338
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7339
    dir := aDirectory asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7340
    dir exists ifFalse:[^ self].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7341
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7342
    [
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7343
	abbrevStream := (dir / 'abbrev.stc') asFilename readStream.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7344
	self readAbbreviationsFromStream:abbrevStream.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7345
	abbrevStream close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7346
    ] on:FileStream openErrorSignal do:[:ex| "ignore this file"].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7347
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7348
    [
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7349
	directoryContents := dir directoryContents.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7350
    ] on:FileStream openErrorSignal do:[:ex|
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7351
	"non-accessable directory: we are done"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7352
	^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7353
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7354
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7355
    directoryContents do:[:aFilename |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7356
	|f|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7357
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7358
	(#(
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7359
	    'doc'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7360
	    'CVS'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7361
	    'bitmaps'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7362
	    'resources'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7363
	    'source'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7364
	) includes:aFilename) ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7365
	    f := dir / aFilename.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7366
	    f isDirectory ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7367
		self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7368
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7369
	].
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  7370
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7371
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7372
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7373
reinitializePackagePath
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7374
    "{ Pragma: +optSpace }"
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7375
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7376
    PackagePath notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7377
	PackagePath := PackagePath select:[:p | p asFilename exists].
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7378
    ].
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7379
    PackagePath isEmptyOrNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7380
	PackagePath := OperatingSystem defaultPackagePath
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7381
    ].
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7382
!
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  7383
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7384
relativePackagePathForPackage:aPackage
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7385
    |path|
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7386
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7387
    PackageToPathMapping notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7388
	path := PackageToPathMapping at:aPackage ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7389
	PackageToPathMapping notNil ifTrue:[^ path].
13370
Claus Gittinger <cg@exept.de>
parents: 13368
diff changeset
  7390
    ].
Claus Gittinger <cg@exept.de>
parents: 13368
diff changeset
  7391
    ^ aPackage copyReplaceAll:$: with:$/.
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7392
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7393
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7394
     PackageToPathMapping := Dictionary new.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7395
     PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7396
     PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7397
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7398
     Smalltalk relativePackagePathForPackage:'stx:libview/resources'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7399
     Smalltalk relativePackagePathForPackage:'stx:libview'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7400
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7401
!
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7402
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7403
resourceDirectoryForPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7404
    "given a packageID, return the path to its resource directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7405
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7406
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7407
    |prjDir rsrcDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7408
11183
9a4e7475a655 care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents: 11174
diff changeset
  7409
    aPackage notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7410
	prjDir := self projectDirectoryForPackage:aPackage.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7411
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7412
	(prjDir notNil
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7413
	and:[(prjDir := prjDir asFilename) exists
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7414
	and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7415
	    ^ rsrcDir
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7416
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7417
	rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7418
	rsrcDir notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7419
	    ^ rsrcDir asFilename
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7420
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7421
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7422
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7423
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7424
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7425
     Smalltalk resourceDirectoryForPackage:'stx:libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7426
     Smalltalk resourceDirectoryForPackage:'exept:expecco'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7427
     Smalltalk resourceDirectoryForPackage:'exept:smartcard'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7428
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7429
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7430
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7431
resourceFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7432
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7433
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7434
     Searches in subdirectories named 'resource' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7435
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7436
    ^ self resourceFileStreamFor:aFileName forClass:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7437
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7438
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7439
resourceFileStreamFor:aFileName forClass:aClassOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7440
    "search aFileName in some standard places and in the classes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7441
     package-resource directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7442
     Return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7443
     Searches in subdirectories named 'resource' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7444
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7445
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7446
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7447
    aString := self getResourceFileName:aFileName forClass:aClassOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7448
    aString notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7449
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7450
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7451
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7452
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7453
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7454
searchPath:aPath for:aFileName in:aDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7455
    "search aPath for a subdirectory named aDirectory with a file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7456
     named aFileName"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7457
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7458
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7459
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7460
    ((f := aFileName asFilename) isAbsolute
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7461
    or:[f isExplicitRelative]) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7462
	"/
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7463
	"/ dont use path for absolute or explicit .-relative file names
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7464
	"/
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7465
	^ aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7466
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7467
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7468
    aPath notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7469
	aPath do:[:dirName |
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7470
	    |realName dir|
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7471
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7472
	    dir := dirName asFilename.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7473
	    aDirName notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7474
		realName := dir / aDirName / aFileName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7475
	    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7476
		realName := dir / aFileName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7477
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7478
	    (realName isReadable) ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7479
		^ realName name
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7480
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7481
	].
11108
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  7482
    ].
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  7483
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  7484
"/ not needed - executing dir is always in SearchPath
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7485
"/    realName := Filename currentDirectory / aFileName.
11108
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  7486
"/    (realName isReadable) ifTrue:[
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  7487
"/        ^ realName name
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  7488
"/    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7489
    ^ nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7490
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7491
    "Modified: / 29.4.1999 / 15:06:43 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7492
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7493
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7494
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7495
    |classNameSymbol oldAbbrev oldPath newPath cls abbrevs|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7496
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7497
    CachedAbbreviations isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7498
	CachedAbbreviations := IdentityDictionary new.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7499
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7500
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7501
    abbrevs := CachedAbbreviations.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7502
    aClassNameString ~= aFileNameString ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7503
	classNameSymbol := aClassNameString asSymbol.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7504
	oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7505
	oldAbbrev notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7506
	    oldAbbrev ~= aFileNameString ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7507
		oldAbbrev asFilename isAbsolute
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7508
		    ifTrue:[ oldPath := oldAbbrev ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7509
		    ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7510
		aFileNameString asFilename isAbsolute
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7511
		    ifTrue:[ newPath := aFileNameString ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7512
		    ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7513
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7514
		oldPath ~= newPath ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7515
		    StandAlone ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7516
			('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7517
			('Smalltalk [info]: old: ',oldPath) infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7518
			('Smalltalk [info]: new: ',newPath) infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7519
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7520
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7521
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7522
	    "overwrite old abbreviation with new one,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7523
	     to allow fixing of bad abbrev files"
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7524
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7525
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7526
	cls := self classNamed:aFileNameString.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7527
	cls notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7528
	    cls name ~= aClassNameString ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7529
		"/ ok, there is a class named after this abbrev ...
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7530
		"/ this is only a conflict, if the other class has no
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7531
		"/ abbreviation (or the same).
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7532
		(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7533
		    cls isNameSpace ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7534
			aPackageNameString = cls package ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7535
			    StandAlone ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7536
				('Smalltalk [warning]: conflict for: ' , cls name ,
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7537
				    ' in package ' , aPackageNameString) infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7538
				('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7539
				    , ')') infoPrintCR
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7540
			    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7541
			]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7542
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7543
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7544
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7545
	].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7546
	abbrevs at:classNameSymbol put:aFileNameString.
8470
d79e917d4f36 Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents: 8445
diff changeset
  7547
    ]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7548
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7549
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7550
sourceDirectoryNameOfClass:aClassOrClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7551
    "for a given class, return the pathname relative to TOP of the classes source code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7552
     Read the files 'abbrev.stc' and 'liblist.stc' (which are created during the compilation process)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7553
     for an entry for aClassOrClassName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7554
     Search for the className in the first col, and return the value found in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7555
     the 3rd col.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7556
     Return nil if no entry is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7557
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7558
    |aStream line words n aClassName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7559
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7560
    aClassOrClassName isBehavior ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7561
	aClassName := aClassOrClassName name
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7562
    ] ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7563
	aClassName := aClassOrClassName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7564
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7565
    aClassName := aClassName asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7566
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7567
    #('include/abbrev.stc' 'include/liblist.stc')    "/ filenames
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7568
    with:#(3 2)                   "/ column
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7569
    do:[:fileName :col |
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7570
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7571
	aStream := self systemFileStreamFor:fileName.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7572
	aStream notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7573
	    [aStream atEnd] whileFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7574
		line := aStream nextLine.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7575
		line notNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7576
		    (line startsWith:'#') ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7577
			words := line asCollectionOfWords.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7578
			(n := words size) > 1 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7579
			    (words at:1) = aClassName ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7580
				n >= col ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7581
				    aStream close.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7582
				    ^ (words at:col) withoutSeparators
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7583
				]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7584
			    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7585
			]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7586
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7587
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7588
	    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7589
	    aStream close
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7590
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7591
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7592
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7593
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7594
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7595
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7596
     Smalltalk sourceDirectoryNameOfClass:'ClockView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7597
     Smalltalk sourceDirectoryNameOfClass:'Bag'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7598
     Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7599
     Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7600
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7601
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7602
    "Created: 6.11.1995 / 15:43:30 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7603
    "Modified: 9.12.1995 / 23:54:14 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7604
    "Modified: 3.1.1997 / 11:26:44 / stefan"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7605
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7606
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7607
sourceFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7608
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7609
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7610
     Searches in subdirectories named 'source' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7611
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7612
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7613
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7614
    aString := self getSourceFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7615
    aString notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7616
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7617
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7618
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7619
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7620
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7621
systemFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7622
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7623
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7624
     see comment in Smalltalk>>initSystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7625
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7626
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7627
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7628
    aString := self getSystemFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7629
    aString notNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7630
	^ aString asFilename readStreamOrNil
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7631
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7632
    ^ nil
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7633
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7634
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7635
systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7636
    "return a collection of directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7637
     looks for system files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7638
     (usually in subdirs such as resources, bitmaps, source etc.)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7639
     see comment in Smalltalk>>initSystemPath."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7640
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7641
    ^ SystemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7642
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7643
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7644
     Smalltalk systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7645
     Smalltalk systemPath addLast:'someOtherDirectoryPath'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7646
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7647
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7648
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7649
systemPath:aPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7650
    "set the collection of directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7651
     looks for system files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7652
     (usually in subdirs such as resources, bitmaps, source etc.)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7653
     see comment in Smalltalk>>initSystemPath."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7654
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7655
    SystemPath := aPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7656
    self flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7657
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7658
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7659
     Smalltalk systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7660
     Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath')
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7661
    "
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7662
!
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7663
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7664
withAbbreviationsFromStream:aStream do:aBlock
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7665
    "read classname to filename mappings from aStream.
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7666
     Evaluate aBlock for each tuple:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7667
	class-name , abbrev-name, package
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7668
     Sigh - all for those poor sys5.3 or MSDOS people with short filenames..."
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7669
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7670
    |line lineNo words nm abbrev pkg category size s w|
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7671
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7672
    lineNo := 0.
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7673
    [aStream atEnd] whileFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7674
	line := aStream nextLine.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7675
	lineNo := lineNo + 1.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7676
	line notEmptyOrNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7677
	    (line startsWith:'#') ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7678
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7679
		"/ must do it manually, caring for quoted strings.
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7680
"/                words := line asCollectionOfWords.
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  7681
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7682
		words := OrderedCollection new.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7683
		s := line readStream.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7684
		[s atEnd] whileFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7685
		    s skipSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7686
		    s peek == $' ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7687
			s next.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7688
			w := s upTo:$'.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7689
			s skipSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7690
		    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7691
			w := s upToSeparator
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7692
		    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7693
		    words add:w
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7694
		].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7695
		words size >= 3 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7696
		    nm := (words at:1) withoutSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7697
		    abbrev := (words at:2) withoutSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7698
		    pkg := (words at:3) withoutSeparators.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7699
		    aBlock argumentCount = 3 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7700
			aBlock value:nm value:abbrev value:pkg.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7701
		    ] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7702
			words size >= 4 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7703
			    category := words at:4.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7704
			].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7705
			words size = 5 ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7706
			    size := (words at:5) asNumber
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7707
			].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7708
			aBlock value:nm value:abbrev value:pkg value: category value: size
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7709
		    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7710
		] ifFalse:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7711
		    ('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7712
		]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7713
	    ]
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7714
	]
13518
b81bc64782b1 not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents: 13506
diff changeset
  7715
    ].
b81bc64782b1 not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents: 13506
diff changeset
  7716
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7717
    "Modified: / 06-03-2011 / 18:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13546
8993c10243a2 changed: #withAbbreviationsFromStream:do:
Claus Gittinger <cg@exept.de>
parents: 13540
diff changeset
  7718
    "Modified: / 04-08-2011 / 21:35:00 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7719
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7720
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7721
!Smalltalk class methodsFor:'system management-packages'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7722
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7723
isPackageLoaded:aPackageIdOrPackage
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7724
    |projectDefinition|
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7725
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7726
    projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass.
16161
195f2580fa6c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16159
diff changeset
  7727
    ^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]]
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7728
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7729
    "
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7730
     Smalltalk isPackageLoaded:'stx:goodies/persistency'
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7731
     Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7732
     Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling'
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7733
    "
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7734
!
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  7735
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7736
loadPackage:aPackageIdOrPackage
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7737
    "make certain, that some particular package is loaded into the system.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7738
     Return true if loaded, false otherwise."
11668
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7739
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7740
    ^ self loadPackage:aPackageIdOrPackage asAutoloaded:false
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7741
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7742
    "
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7743
     Smalltalk loadPackage:'stx:libbasic'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7744
     Smalltalk loadPackage:'stx:goodies/persistency'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7745
     Smalltalk loadPackage:'cg:cparser'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7746
     Smalltalk loadPackage:'cg:rose'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7747
    "
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7748
!
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  7749
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7750
packageDirectoryForPackageId:aPackageId
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7751
    "used by classes to find the location of their resource- and bitmap directories.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7752
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7753
     Notice that the directory structure is different between the development
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7754
     environment (top for packages is ../../../stx) and delivered stand alone executables,
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7755
     where the top is specified via a shell environment variable, and is typically ../lib.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7756
     At runtime, Smalltalk knows about the systemPath setting."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7757
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7758
    |packageDirName packageDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7759
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  7760
    packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7761
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7762
    packageDir := self getPackageFileName:packageDirName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7763
    packageDir isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7764
	^ nil.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7765
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7766
    ^ packageDir asFilename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7767
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7768
    "
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  7769
     Smalltalk packageDirectoryForPackageId:'stx:libbasic'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7770
     Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7771
     Smalltalk packageDirectoryForPackageId:'exept:ctypes'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7772
    "
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7773
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7774
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7775
unloadPackage:aPackageIdOrPackage
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7776
    |projectDefinition|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7777
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7778
    projectDefinition := aPackageIdOrPackage.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7779
    projectDefinition isProjectDefinition ifFalse:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7780
	projectDefinition := projectDefinition asPackageId projectDefinitionClass.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7781
	projectDefinition isNil ifTrue:[
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7782
	    'Smalltalk [info] trying to unload non-existing package: ' infoPrint. aPackageIdOrPackage infoPrintCR.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7783
	    ^ self.
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7784
	].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7785
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7786
    projectDefinition unloadPackage.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7787
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7788
    "
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7789
     Smalltalk loadPackage:'stx:goodies/persistency'
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7790
     Smalltalk unloadPackage:'stx:goodies/persistency'
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  7791
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7792
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7793
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7794
!Smalltalk class methodsFor:'system management-undeclared variables'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7795
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7796
clearUndeclaredVariables
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7797
    "remove all undeclared variables"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7798
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7799
    (Smalltalk at:#Undeclared) do:[:eachKey |
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7800
	Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7801
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7802
    (Smalltalk at:#Undeclared) removeAll.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7803
    Smalltalk removeKey:#Undeclared.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7804
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7805
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7806
undeclaredPrefix
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7807
    "the prefix used for undeclared variables"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7808
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7809
    ^ 'Undeclared:::'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7810
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7811
    "Created: / 31.10.1997 / 01:13:10 / cg"
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7812
! !
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7813
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7814
!Smalltalk class methodsFor:'time-versions'!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7815
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7816
configuration
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7817
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7818
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7819
    "for developers only: return the configuration, with which
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7820
     this smalltalk was compiled."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7821
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7822
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7823
    extern char *__getConfigurationString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7824
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7825
    RETURN (__MKSTRING(__getConfigurationString() COMMA_SND));
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7826
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7827
    ^ 'unknownOS/unknownCONF:unknownPACK'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7828
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7829
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  7830
     Smalltalk configuration
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7831
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7832
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  7833
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7834
copyrightString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7835
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7836
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7837
    "return a copyright string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7838
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7839
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7840
#ifndef __getCopyrightString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7841
    extern OBJ __getCopyrightString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7842
#endif
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7843
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7844
    RETURN (__getCopyrightString());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7845
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7846
    ^ self primitiveFailed
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7847
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7848
    "
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7849
     Smalltalk copyrightString
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7850
    "
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7851
!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7852
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7853
distributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7854
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7855
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7856
    "return a string describing the distributor of this software"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7857
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7858
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7859
#ifndef __getDistributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7860
    extern OBJ __getDistributorString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7861
#endif
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7862
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7863
    RETURN (__getDistributorString());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7864
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7865
    ^ 'eXept Software AG, Germany'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7866
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7867
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7868
     Smalltalk distributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7869
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7870
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7871
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7872
expirationTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7873
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7874
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7875
    "for developers only: return the time when the system will expire.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7876
     after this time it will not run any longer.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7877
     It returns nil, if no expiration time has been set (system runs forever :-))"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7878
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7879
    |exp|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7880
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7881
%{
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7882
    extern unsigned int __getExpirationTime();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7883
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7884
    exp = __MKUINT(__getExpirationTime());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7885
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7886
    exp == 0 ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7887
	^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7888
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7889
    ^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7890
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7891
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7892
     Smalltalk expirationTime
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7893
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7894
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7895
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7896
fullVersionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7897
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7898
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7899
    "return a full version string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7900
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7901
    ^ 'Smalltalk/X release ' , self versionString , ' of ' , self versionDate
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7902
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7903
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7904
     Smalltalk fullVersionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7905
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7906
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7907
    "Created: / 27.10.1997 / 17:03:09 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7908
    "Modified: / 27.10.1997 / 17:04:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7909
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7910
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7911
hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7912
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7913
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7914
    "return a greeting string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7915
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7916
    "stupid: this should come from a resource file ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7917
     but I dont use it here, to allow mini-systems without
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7918
     Resource-stuff."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7919
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7920
    |proto lang|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7921
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7922
    lang := Language.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7923
    (lang == #de) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7924
	proto := 'Willkommen bei %1 (Version %2 von %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7925
    ] ifFalse:[ (lang == #fr) ifTrue:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  7926
	proto := 'Salut, Bienvenue à %1 (version %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7927
    ] ifFalse:[ (lang == #it) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7928
	proto := 'Ciao, benvenuto al %1 (versione %2 di %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7929
    ] ifFalse:[ (lang == #es) ifTrue:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  7930
"/        proto := 'Hola, bienvenida a %1 (versión %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7931
    ] ifFalse:[ (lang == #es) ifTrue:[
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  7932
"/        proto := 'Oi, benvindo a %1 (versão %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7933
    ] ifFalse:[ (lang == #no) ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7934
	proto := 'Hei, verdenmottakelse til %1 (versjon %2 av %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7935
    ]]]]]].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7936
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7937
    "/ ... more needed here ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7938
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7939
    proto isNil ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7940
	proto := 'Hello World - here is %1 version %2 of %3'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7941
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7942
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7943
    ^ proto bindWith:('SmallTalk/X' allBold)
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7944
		with:(self versionString)
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7945
		with:(self versionDate)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7946
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7947
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7948
     Smalltalk language:#us.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7949
     Smalltalk hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7950
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7951
     Smalltalk language:#de.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7952
     Smalltalk hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7953
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7954
     Smalltalk language:#no.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7955
     Smalltalk hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7956
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7957
     Transcript showCR:(Smalltalk hello)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7958
     Stdout showCR:(Smalltalk hello)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7959
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7960
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7961
    "Modified: 18.5.1996 / 14:25:13 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7962
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7963
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7964
imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7965
    "return a timestamp for the moment when this image was restarted.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7966
     If we do not execute from an image (i.e. fresh start), return nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7967
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7968
    ^ ImageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7969
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7970
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7971
     Smalltalk imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7972
     Smalltalk imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7973
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7974
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7975
    "Created: 13.12.1995 / 17:44:20 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7976
    "Modified: 6.3.1996 / 11:56:35 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7977
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7978
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7979
imageSaveTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7980
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7981
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7982
    "return a timestamp for the moment when this image was saved"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7983
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7984
    ^ ObjectMemory imageSaveTime
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7985
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7986
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7987
imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7988
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7989
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7990
    "return a timestamp for the moment when this system started the first time
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7991
     (i.e. the first initial start without an image)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7992
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7993
    ^ ImageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7994
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7995
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7996
     Smalltalk imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7997
     Smalltalk imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7998
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7999
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8000
    "Created: 13.12.1995 / 17:44:14 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8001
    "Modified: 13.12.1995 / 17:45:47 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8002
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8003
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8004
majorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8005
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8006
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8007
    "return the major version number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8008
     This is only incremented for very fundamental changes,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8009
     which make old object files totally incompatible
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8010
     (for example, if the layout/representation of fundamental
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8011
      classes changes).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8012
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8013
     ST/X revision Naming is:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8014
	<major>.<minor>.<revision>.<release>"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8015
12867
2b9cbcea983b version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents: 12861
diff changeset
  8016
    ^ 6
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8017
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8018
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8019
     Smalltalk majorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8020
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8021
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8022
    "Modified: 8.11.1996 / 19:59:21 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8023
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8024
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8025
minorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8026
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8027
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8028
    "return the minor version number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8029
     This is incremented for changes which make some old object
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8030
     files incompatible, or the protocol changes such that some
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8031
     classes need rework.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8032
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8033
     ST/X revision Naming is:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8034
	<major>.<minor>.<revision>.<release>"
13489
32ea9770aed5 changed:
Claus Gittinger <cg@exept.de>
parents: 13415
diff changeset
  8035
32ea9770aed5 changed:
Claus Gittinger <cg@exept.de>
parents: 13415
diff changeset
  8036
    ^ 2
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8037
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8038
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8039
     Smalltalk minorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8040
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8041
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8042
    "Modified: / 16-08-2006 / 09:37:25 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8043
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8044
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8045
releaseIdentification
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8046
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8047
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8048
    "for developers only: return the release
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8049
     (to further identify the version in case of errors)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8050
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8051
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8052
    extern OBJ __getRel();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8053
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8054
    RETURN (__getRel());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8055
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8056
    ^ 'ST/X_experimental'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8057
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8058
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8059
     Smalltalk releaseIdentification
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8060
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8061
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8062
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8063
releaseNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8064
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8065
14542
8ed2cefffa0c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14529
diff changeset
  8066
    "return the release number.
8ed2cefffa0c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14529
diff changeset
  8067
     Now releaseNr is the build number (BUILD_NUMBER from Jenkins)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8068
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8069
     ST/X revision Naming is:
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8070
	<major>.<minor>.<revision>.<release>"
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8071
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8072
    |releaseNumber|
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8073
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8074
    releaseNumber := Smalltalk versionBuildNumber.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8075
    releaseNumber isEmpty ifTrue:[
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8076
	^ 0.
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8077
    ].
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8078
    ^ releaseNumber
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8079
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8080
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8081
     Smalltalk releaseNr
12867
2b9cbcea983b version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents: 12861
diff changeset
  8082
     Smalltalk versionString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8083
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8084
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8085
    "Created: / 10-12-1995 / 01:42:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8086
    "Modified: / 10-02-2007 / 14:49:51 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8087
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8088
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8089
revisionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8090
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8091
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8092
    "return the revision number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8093
     Incremented for releases which fix bugs/add features
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8094
     and represent a stable workable version which got published
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8095
     to the outside world.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8096
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8097
     ST/X revision Naming is:
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  8098
	<major>.<minor>.<revision>.<release>"
16944
9300b752028f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16893
diff changeset
  8099
9300b752028f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16893
diff changeset
  8100
    ^ 5
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8101
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8102
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8103
     Smalltalk revisionNr
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  8104
     Smalltalk hello string
13014
fe6484596968 changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 13000
diff changeset
  8105
    "
fe6484596968 changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 13000
diff changeset
  8106
14210
06966b03a12c changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 14020
diff changeset
  8107
    "Modified: / 18-07-2012 / 19:09:42 / cg"
14898
5afe1d1f7ffe class: Smalltalk
az
parents: 14892
diff changeset
  8108
    "Modified: / 19-03-2013 / 10:48:59 / az"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8109
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8110
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8111
timeStamp
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8112
    "return a string useful for timestamping a file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8113
     The returned string is padded with spaces for a constant
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8114
     length (to avoid changing a files size in fileOut with unchanged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8115
     class)."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8116
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8117
    ^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8118
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8119
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8120
timeStamp:aStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8121
    "write a string useful for timestamping a file onto aStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8122
     ST80 compatibility"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8123
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8124
    aStream nextPutAll:(self timeStamp).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8125
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8126
    "Created: / 18.6.1998 / 17:22:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8127
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8128
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8129
timeStampString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8130
    "return a string useful for timestamping a file."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8131
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8132
    |dateString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8133
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8134
    dateString := String streamContents:[:s | Date today printOn:s language:#en].  "/ MUST be english !!!!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8135
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8136
    ^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on '
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8137
       , dateString , ' at ' , Time now printString
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8138
       )
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8139
!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8140
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8141
versionBuildNumber
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8142
    "{ Pragma: +optSpace }"
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8143
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8144
    "return the executables build number - that's the jenkins build #.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8145
     Empty if not built by jenkins"
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8146
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8147
%{  /* NOCONTEXT */
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8148
    extern char *__getBuildNumberString();
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8149
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8150
    RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) );
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8151
%}.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8152
    ^ ''
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8153
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8154
    "
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8155
     Smalltalk versionBuildNumber
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8156
    "
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8157
!
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8158
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8159
versionDate
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8160
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8161
14522
ae3c24478338 build number
Claus Gittinger <cg@exept.de>
parents: 14487
diff changeset
  8162
    "return the executables build date - that's the date when the smalltalk
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8163
     executable was built"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8164
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8165
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8166
    extern char *__getBuildDateString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8167
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8168
    RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) );
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8169
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8170
    ^ 'today'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8171
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8172
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  8173
     Smalltalk versionDate
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8174
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8175
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8176
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8177
versionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8178
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8179
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8180
    "return the version string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8181
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8182
    ^ (self majorVersionNr printString ,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8183
       '.',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8184
       self minorVersionNr printString ,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8185
       '.',
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8186
       self revisionNr printString,
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8187
       '.',
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8188
       self releaseNr printString)
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  8189
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8190
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8191
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8192
     Smalltalk versionString
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8193
    "
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8194
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8195
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8196
vmMajorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8197
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8198
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8199
    "return the VMs major version number."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8200
%{
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8201
    RETURN (__mkSmallInteger(4));
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8202
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8203
    ^ 4
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8204
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8205
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8206
     Smalltalk vmMajorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8207
    "
2
claus
parents: 1
diff changeset
  8208
! !
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  8209
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  8210
!Smalltalk class methodsFor:'documentation'!
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 617
diff changeset
  8211
13532
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  8212
version
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
  8213
    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1122 2015-04-24 12:16:27 stefan Exp $'
13532
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  8214
!
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  8215
12172
d90a72004f43 changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents: 12033
diff changeset
  8216
version_CVS
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
  8217
    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.1122 2015-04-24 12:16:27 stefan Exp $'
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8218
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8219
18247
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  8220
version_HG
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  8221
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  8222
    ^ '$Changeset: <not expanded> $'
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  8223
!
3c81bb9bbaea Raise an error on attempt to remove builtin class.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 18200
diff changeset
  8224
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8225
version_SVN
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  8226
    ^ '$ Id: Smalltalk.st 10648 2011-06-23 15:55:10Z vranyj1  $'
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 617
diff changeset
  8227
! !
17534
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
  8228