Smalltalk.st
author Stefan Vogel <sv@exept.de>
Fri, 20 Jan 2017 19:54:34 +0100
changeset 21265 e44b6104a678
parent 21188 1d3c634717b6
child 21292 21faad473411
child 21338 82931ca66d88
permissions -rw-r--r--
#QUALITY by stefan class: Smalltalk changed: #allKeysDo: mark as obsolete
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
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
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
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    17
	instanceVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    18
	classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    19
		NumberOfClassesHint SystemPath StartupClass StartupSelector
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    20
		StartupArguments CommandLine CommandName CommandLineArguments
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    21
		CachedAbbreviations VerboseStartup VerboseLoading Verbose
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    22
		SilentLoading Initializing StandAlone HeadlessOperation IsPlugin
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
    23
		IsSharedLibraryComponent IsSTScript IsRepl DebuggingStandAlone
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    24
		Silent Debugging LogDoits LoadBinaries RealSystemPath
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    25
		ResourcePath SourcePath BinaryPath FileInPath PackagePath
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    26
		BinaryDirName ResourceDirName SourceDirName BitmapDirName
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    27
		PackageDirName FileInDirName ChangeFileName ImageStartTime
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    28
		ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    29
		CallbackSignal ClassesFailedToInitialize HasNoConsole IgnoreHalt
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
    30
		PackageToPathMapping IgnoreAssertions LanguageModifier
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
    31
		LanguageCodeset'
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    32
	poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    33
	category:'System-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    34
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    35
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
    36
Smalltalk comment:''
8845
17288e4e99eb remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents: 8821
diff changeset
    37
!
17288e4e99eb remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents: 8821
diff changeset
    38
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
    39
!Smalltalk class methodsFor:'documentation'!
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    40
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    41
copyright
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
    42
"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    43
 COPYRIGHT (c) 1988 by Claus Gittinger
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    44
	      All Rights Reserved
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    45
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    46
 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
    47
 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
    48
 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
    49
 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
    50
 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
    51
 hereby transferred.
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
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    54
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    55
documentation
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    56
"
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    57
    This is one of the central classes in the system;
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    58
    it provides all system-startup, shutdown and maintenance support.
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    59
    Also global variables are (conceptionally) kept here.
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    60
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    61
    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
    62
    - my implementation of globals is totally different
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    63
      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
    64
      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
    65
      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
    66
      functions found there.
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    67
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    68
    However, it provides the known enumeration protocol.
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    69
    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
    70
    to inherit more collection stuff ...
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    71
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    72
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    73
    [Instance variables:]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    74
					none - all handling is done in the VM
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    75
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    76
    [Class variables:]
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    77
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    78
	StartBlocks     <Collection>    blocks to be executed in a separate process after
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    79
					everything has been initialized. These blocks will
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    80
					be deleted after execution and therefore not be
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    81
					executed after an image restart. Initial processes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    82
					(such as the Launcher) are usually started here.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    83
					These blocks are added by smalltalk.rc/private.rc etc.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    84
					via #addStartBlock during early initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    85
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    86
	ImageStartBlocks
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    87
			<Collection>    blocks to be executed in a separate process after
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    88
					everything has been initialized. These blocks will be
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    89
					executed after an image restart.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    90
					These blocks are usually added by smalltalk_r.rc etc.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    91
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    92
	ExitBlocks      <Collection>    blocks to evaluate before system is
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    93
					left. Not currently used (GNU-ST compatibility).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    94
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    95
	SystemPath      <Collection>    path to search for system files (sources, bitmaps etc)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    96
					Set to a default here, but typically changed from some
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    97
					startup.rc file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    98
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    99
	PackagePath     <Collection>    path to search for package.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   100
					This is going to replace the above systemPath, and a classes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   101
					resources will eventually searched in its package directory.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   102
					This list defines the path, where packages are searched for,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   103
					initially this is something like /opt/smalltalk/packages.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   104
					Set to a default here, but typically changed from some
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   105
					startup.rc file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   106
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   107
	StartupClass    <Class>         class and selector, where the system starts up
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   108
	StartupSelector <Symbol>        (right after VM initialization)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   109
	StartupArguments <Array>        If an image is saved while those being nonNil,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   110
					the image will come up there.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   111
					Allows for customized images to be generated from a standard ST/X.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   112
					StandAlone programs also set those during initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   113
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   114
	CommandLine          <String>   Unix (OS-) command line
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   115
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   116
	CommandName          <String>   the command (i.e. argv[0])
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   117
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   118
	CommandLineArguments <Array>    Unix (OS-) command line arguments broken into words
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   119
					CommandName has been stripped off.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   120
					(initially set by the VM)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   121
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   122
	SilentLoading   <Boolean>       OBSOLETE:
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   123
					suppresses messages during fileIn and in compiler
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   124
					(can be set to true from a customized main.c)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   125
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   126
	VerboseLoading   <Boolean>      generate messages during fileIn and in compiler
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   127
					(can be set to true from a customized main.c)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   128
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   129
	Initializing    <Boolean>       true while (re-)initializing
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   130
					Controls the behavior of certain error
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   131
					reporters (for example: suppress dialogBoxes)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   132
					while the system is not yet fit for full operation.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   133
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   134
	StandAlone      <Boolean>       true, if this is a standalone app;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   135
					if true the process scheduler watches for
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   136
					which processes are still running, and
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   137
					exits ST/X, when the last non-background
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   138
					and non-system process exits.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   139
					Can be set in an application-specific startup script,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   140
					or, for standAlone programs, by C-code during initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   141
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   142
	HeadlessOperation               if true, a non-existing Display connection
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   143
			<Boolean>       will NOT lead to an error-exit during startup.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   144
					Default is false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   145
					Can be set in an application-specific startup script,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   146
					or, for standAlone programs, by C-code during initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   147
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   148
	LogDoits        <Boolean>       if true, doits are also logged in the changes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   149
					file. Default is false, since the changes file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   150
					may become huge if every tiny doIt is saved there ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   151
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   152
	LoadBinaries    <Boolean>       if true, we attempt to load classes rom a binary
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   153
					file, if present. If false, this is always suppressed.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   154
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   155
	SaveEmergencyImage <Boolean>    if true (the default), an emergency image
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   156
					is saved, if the main Display looses its
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   157
					connection. This is useful if you have a
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   158
					flaky display connection (serial line)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   159
					and want to have your stuff saved automatically
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   160
					in case of a broken connection.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   161
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   162
	IgnoreAssertions  <Boolean>     if true, assertions are ignored (i.e. no errors reported).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   163
					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
   164
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   165
    strictly private classVariables (helpers):
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   166
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   167
	CachedClasses   <Collection>    known classes (cached for faster class enumeration)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   168
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   169
	CachedAbbreviations
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   170
			<Dictionary>    className to filename mappings
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   171
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   172
	RealSystemPath  <Collection>    cached collection of directories along the path
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   173
					which really exist. Caching avoids long checks
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   174
					for existing directories on broken NFS volumes.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   175
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   176
	SourcePath      <Collection>    cached names of really existing directories
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   177
					These are remembered, as in NFS systems,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   178
	ResourcePath                    the time to lookup files may become long
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   179
	BinaryPath                      (especially, if some directories are on machines
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   180
	FileInPath                      which are not up ...).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   181
					Therefore, the set of really
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   182
					existing directories is cached when the SystemPath
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   183
					is walked the first time.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   184
					A consequence is that you have to invoke
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   185
					flushSystemPath, when you create any of those
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   186
					directories while running
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   187
					(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
   188
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
   189
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
   190
    [author:]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   191
	Claus Gittinger
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   192
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   193
    [see also:]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   194
	ObjectMemory
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   195
	StandaloneStartup
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   196
	GetOpt
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   197
	ReadEvalPrintLoop
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
   198
"
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   199
!
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
readme_resources
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   202
"
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   203
    What is a resource file:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   204
	resource files contain language transformation and sometimes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   205
	UI-look specifics such as icons etc.
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   206
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   207
    Where are resources stored in the image:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   208
	Resource files are only read on demand (i.e. when needed) and only read once
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   209
	i.e. they are cached in the image).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   210
	The cached data is held in a per-class class-instVar named 'ClassResources'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   211
	With only a few exceptions, the only classes which need resources are the GUI
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   212
	classes under the SimpleView hierarchy.
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   213
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   214
    How does the system find resources:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   215
	The idea is that the system-provided resource files can be overwritten
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   216
	by the user or an application configuration.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   217
	This works via a hierarchy of directories where resources are searched for,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   218
	with the systems standard resource-files being at the end of that chain.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   219
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   220
	When searching for a resource file for class X, the following files are searched
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   221
	in order:
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   222
		{ResourcePath} / resources / X.rs
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   223
		{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   224
		{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   225
"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   226
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   227
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   228
!Smalltalk class methodsFor:'initialization'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   229
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   230
basicInitializeSystem
16180
ddb5cec2ab0b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16170
diff changeset
   231
    "initialize all other classes.
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   232
     This one is the very first entry into the smalltalk world
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   233
     [with error handling, via the initializeSystem],
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   234
     right after startup, usually immediately followed by Smalltalk>>start.
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   235
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   236
     Notice:
19992
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   237
        this is NOT called when an image is restarted; in this
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   238
        case the show starts in Smalltalk>>restart."
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   239
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   240
    OrderedCollection initialize.
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   241
    
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
   242
    Smalltalk at:#Compiler put:ByteCodeCompiler.
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   243
    Compiler isNil ifTrue:[
19992
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   244
        "
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   245
         ByteCodeCompiler is not in the system (i.e. has not been linked in)
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   246
         this allows at least immediate evaluations for runtime systems without compiler
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   247
         NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   248
        "
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
   249
        Smalltalk at:#Compiler put:Parser
16164
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
   250
    ].
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   251
11057
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
    "/ start catching SIGSEGV and SIGBUS
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
    OperatingSystem enableHardSignalInterrupts.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   256
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   257
    self initGlobalsFromEnvironment.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   258
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   259
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   260
    "/ sorry - there are some, which MUST be initialized before ..
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   261
    "/ 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
   262
    "/
15265
9a8afa1b41cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15225
diff changeset
   263
    SmallInteger initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   264
    Object initialize.
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   265
    UninterpretedBytes initialize.
16691
2a12b888e973 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16675
diff changeset
   266
    OperatingSystem initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   267
    Stream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   268
    PositionableStream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   269
    Filename initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   270
    ObjectMemory initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   271
    ExternalStream initialize.
12745
e944659a6a52 changed: #basicInitializeSystem
Claus Gittinger <cg@exept.de>
parents: 12744
diff changeset
   272
    ProcessorScheduler initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   273
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   274
    self initStandardStreams.    "/ setup Stdin, Stdout etc.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   275
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   276
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   277
    "/ sorry, path must be set before ...
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   278
    "/ 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
   279
    "/
17534
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
   280
    "/ but, on OSX we need the CharacterEncoder to be initialized
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
   281
    CharacterEncoder initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   282
    self initSystemPath.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   283
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   284
    "/
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   285
    "/ in case, someone needs the objectFileLoader early
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   286
    "/
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   287
    ObjectFileLoader notNil ifTrue:[
19992
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   288
        ObjectFileLoader initialize.
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   289
    ].
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   290
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   291
    "/
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   292
    "/ now, finally, initialize all other classes
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 initializeModules.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   295
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   296
    ImageStartTime := Timestamp now.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   297
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   298
    self initInterrupts.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   299
    self initUserPreferences.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   300
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   301
    "/ 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
   302
    "/ 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
   303
    "/ 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
   304
    ApplicationModel notNil ifTrue:[
19992
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   305
        ApplicationModel flushAllClassResources.
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   306
    ].
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   307
11057
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
    "/ give classes a chance to perform 2nd-level initialization
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   310
    "/ now, we are certain, that all other classes have been initialized
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   311
    "/ (especially: streams and signals can now be used)
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   312
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   313
    ObjectMemory changed:#initialized.
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
    "Modified: / 08-01-1997 / 19:58:12 / stefan"
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   316
    "Modified: / 05-12-2006 / 21:48:58 / cg"
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   317
    "Modified: / 24-10-2012 / 18:45:15 / sr"
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   318
!
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   319
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   320
initGlobalsFromEnvironment
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   321
    "setup globals from the shell-environment"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   322
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   323
    |envString i langString terrString|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   324
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   325
    StandAlone isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   326
	StandAlone := false.
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   327
    ].
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
   328
    HeadlessOperation isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   329
	HeadlessOperation := false.
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
   330
    ].
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   331
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   332
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   333
     extract Language and LanguageTerritory from LANG variable.
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   334
     valid are for example:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   335
			    en_en / en
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   336
			    en_us
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   337
			    en_gb
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   338
			    de_de / de
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   339
			    de_at       (for Austria)
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   340
    "
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
    Language := #en.
994
6163ae7aaf9b territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   343
    LanguageTerritory := #us.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   344
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   345
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   346
    "Format of LANG is: language[_territory][.codeset][@modifier]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   347
	language        ISO-639  Language code
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   348
	territory       ISO-3166 Contry code"
7779
6d88d32bdd64 Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents: 7763
diff changeset
   349
6d88d32bdd64 Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents: 7763
diff changeset
   350
    envString := OperatingSystem getLanguage.
3991
7b53bc45bf91 (isNil or:[isEmpty ]) -> (size == 0)
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   351
    envString size > 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   352
	i := envString indexOf:$@.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   353
	(i ~~ 0) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   354
	    LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   355
	    envString := envString copyTo:(i - 1).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   356
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   357
	    LanguageModifier := nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   358
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   359
	i := envString indexOf:$..
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   360
	(i ~~ 0) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   361
	    LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   362
	    envString := envString copyTo:(i - 1).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   363
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   364
	    LanguageCodeset := #'iso8859-1'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   365
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   366
	i := envString indexOf:$_.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   367
	(i == 0) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   368
	    langString := envString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   369
	    terrString := envString
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   370
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   371
	    langString := envString copyTo:(i - 1).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   372
	    terrString := envString copyFrom:(i + 1)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   373
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   374
	langString := langString asLowercase.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   375
	terrString := terrString asLowercase.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   376
	(langString = 'c' or:[terrString = 'c']) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   377
	    ('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   378
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   379
	    Language := langString asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   380
	    LanguageTerritory := terrString asSymbol
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   381
	]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   382
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   383
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   384
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   385
     Smalltalk initGlobalsFromEnvironment
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   386
    "
994
6163ae7aaf9b territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   387
14011
d33d2c6497f4 changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents: 13998
diff changeset
   388
    "Modified: / 14-02-2012 / 15:25:08 / cg"
8583
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
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   391
initInterrupts
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   392
    "initialize interrupts"
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
    OperatingSystem enableUserInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   395
    OperatingSystem enableHardSignalInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   396
    OperatingSystem enableCrashSignalInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   397
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   398
    ObjectMemory userInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   399
    ObjectMemory signalInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   400
    ObjectMemory recursionInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   401
14805
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   402
    OperatingSystem isOSXlike ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   403
	"/ OSX sends SIGABRT for NSExceptions
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   404
	OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   405
	OperatingSystem enableAbortInterrupts.
14805
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   406
    ].
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   407
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   408
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   409
     Smalltalk initInterrupts
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   410
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   411
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   412
    "Modified: 20.8.1997 / 09:35:49 / stefan"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   413
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   414
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   415
initStandardStreams
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   416
    "initialize some well-known streams"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   417
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   418
    Stdout := NonPositionableExternalStream forStdout.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   419
    Stderr := NonPositionableExternalStream forStderr.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   420
    Stdin := NonPositionableExternalStream forStdin.
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   421
    PrinterStream notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   422
	Printer := PrinterStream defaultPrinter.
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   423
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   424
    Transcript := Stderr
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   425
963
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   426
    "
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   427
     Smalltalk initStandardStreams
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   428
    "
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   429
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   430
    "Modified: / 25-10-2006 / 17:36:46 / cg"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   431
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   432
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   433
initStandardTools
10646
39e8fbfed83c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10645
diff changeset
   434
    "predefine some tools which we might need later
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   435
     - if the view-classes exist,
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   436
       they will redefine Inspector and Debugger for graphical interfaces"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   437
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   438
    Display notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   439
	InspectorView notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   440
	    Inspector := InspectorView
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   441
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   442
	DebugView notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   443
	    Debugger := DebugView
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   444
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   445
	"/ Display initialize
13303
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   446
    ].
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   447
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   448
    "/ make the changeFilePath an absolute one,
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   449
    "/ in case some stupid windows fileDialog changes the current directory...
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   450
    ObjectMemory
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   451
	nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   452
			    asAbsoluteFilename pathName
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   453
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   454
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   455
     Smalltalk initStandardTools
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   456
    "
13303
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   457
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   458
    "Modified: / 09-02-2011 / 20:44:47 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   459
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   460
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   461
initSystemPath
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   462
    "setup path where system files are searched for.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   463
     the default path is set to:
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   464
            .
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   465
            <directory of exe>       (WIN32 only)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   466
            $HOME                    (if defined)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   467
            $HOME/.smalltalk         (if defined & existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   468
            $SMALLTALK_LIBDIR        (if defined & existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   469
            $STX_LIBDIR              (if defined & existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   470
            $STX_TOPDIR              (if defined & existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   471
            REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   472
            REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir')                  (WIN32 only)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   473
            <standard places>
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9020
diff changeset
   474
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9020
diff changeset
   475
     standard places (unix):
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   476
            /opt/smalltalk/<release> (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   477
            /opt/smalltalk           (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   478
            /usr/local/lib/smalltalk (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   479
            /usr/lib/smalltalk       (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   480
            /lib/smalltalk           (if existing)
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   481
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   482
     win32:
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   483
            \programs\exept\smalltalk (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   484
            \programs\smalltalk       (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   485
            \smalltalk                (if existing)
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   486
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   487
     vms:
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   488
            $stx:lib                 (if existing)
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   489
            $stx:root                (if existing)
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   490
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   491
     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
   492
     startup file; add expressions such as:
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   493
            Smalltalk systemPath addFirst:'/foo/bar/baz'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   494
        or:
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   495
            Smalltalk systemPath addLast:'/fee/foe/foo'.
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   496
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   497
     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
   498
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   499
2928
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   500
    ChangeFileName := 'changes'.
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   501
    OperatingSystem isVMSlike ifTrue:[
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   502
        BitmapDirName := 'bitmaps.dir'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   503
        BinaryDirName := 'binary.dir'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   504
        SourceDirName := 'source.dir'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   505
        ResourceDirName := 'resources.dir'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   506
        FileInDirName := 'filein.dir'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   507
        PackageDirName := 'packages.dir'.
2928
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   508
    ] ifFalse:[
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   509
        BitmapDirName := 'bitmaps'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   510
        BinaryDirName := 'binary'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   511
        SourceDirName := 'source'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   512
        ResourceDirName := 'resources'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   513
        FileInDirName := 'fileIn'.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   514
        PackageDirName := 'packages'.
16234
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   515
    ].
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
    SystemPath isEmptyOrNil ifTrue:[
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   518
        SystemPath := OperatingSystem defaultSystemPath.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   519
        self flushPathCaches
16234
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   520
    ].
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   521
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   522
    PackagePath isEmptyOrNil ifTrue:[
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   523
        PackagePath := OperatingSystem defaultPackagePath.
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   524
    ].
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   525
    self addWorkspaceDirectoryToPackagePath.
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
   526
    self addIdeTopDirectoryToPackagePath.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   527
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   528
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   529
     Smalltalk initSystemPath
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   530
     Smalltalk systemPath
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   531
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
   532
     SystemPath := nil.
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
   533
     PackagePath := nil.
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   534
     OperatingSystem defaultSystemPath
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   535
     OperatingSystem defaultPackagePath
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   536
    "
5139
135e98726986 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5138
diff changeset
   537
5145
23bca61caa40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5144
diff changeset
   538
    "Modified: / 24.12.1999 / 00:23:35 / cg"
8583
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
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   541
initUserPreferences
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   542
    "setup other stuff"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   543
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   544
    LogDoits := false.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   545
    LoadBinaries := false.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   546
    SaveEmergencyImage := (StandAlone ~~ true).
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   547
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   548
    "Modified: / 24.10.1997 / 18:22:47 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   549
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   550
7526
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   551
initializeClass:aClass
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   552
    "sent from VM via #initializeModules"
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   553
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   554
    Error handle:[:ex |
19427
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   555
        ObjectMemory printStackBacktrace.
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   556
        ClassesFailedToInitialize isNil ifTrue:[
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   557
            ClassesFailedToInitialize := IdentitySet new.
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   558
        ].
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   559
        ClassesFailedToInitialize add:aClass.
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   560
        ('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR.
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   561
        ex suspendedContext fullPrintAll.
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   562
        '------------------------------------------------' errorPrintCR.
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   563
        (Debugging == true) ifTrue:[
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   564
            ex reject
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   565
        ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   566
    ] do:[
19427
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   567
        aClass initialize
13675
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   568
    ].
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   569
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   570
    "Modified: / 11-09-2011 / 17:01:32 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   571
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   572
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   573
initializeModules
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   574
    "perform module specific initialization and
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   575
     send #initialize to all classes.
16180
ddb5cec2ab0b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16170
diff changeset
   576
     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
   577
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   578
    self initializeModulesOnce.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   579
    ClassesFailedToInitialize size > 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   580
	('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   581
	ClassesFailedToInitialize := nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   582
	self initializeModulesOnce.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   583
	ClassesFailedToInitialize size > 0 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   584
	    ('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   585
	]
10122
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   586
    ].
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   587
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   588
    ProjectDefinition initializeAllProjectDefinitions.
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   589
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   590
    "Modified: / 23-10-2006 / 16:40:39 / cg"
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   591
!
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   592
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   593
initializeModulesOnce
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   594
    "perform module specific initialization and
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   595
     send #initialize to all classes.
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   596
     Notice: this is not called when an image is restarted"
4963
308de981ea7d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4959
diff changeset
   597
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   598
%{
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   599
#ifdef __SCHTEAM__
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   600
    STClass.initializeAllClasses(__c__);
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   601
    return __c__._RETURN_self();
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   602
#else
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1682
diff changeset
   603
    __init_registered_modules__(3);
4963
308de981ea7d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4959
diff changeset
   604
1481
90a28fd060bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   605
    @global(DemoMode) = __getDemoMode() ? true : false;
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   606
    RETURN (self);
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   607
#endif /* not SCHTEAM */
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   608
%}.
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   609
    ^ self primitiveFailed
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   610
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   611
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   612
initializeSystem
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   613
    "initialize all classes; setup dispatcher processes etc.
3499
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   614
     This one is the very first entry into the smalltalk world,
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   615
     right after startup, usually immediately followed by Smalltalk>>start.
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   616
     Here, a few specific initializations are done, then the actual initialization is
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   617
     done inside an error handler in basicInitializeSystem.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
   618
     Notice:
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   619
        this is called by the VM's main entry. You will not find senders from Smalltalk.
18385
2d0a9c256e0e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18384
diff changeset
   620
     Also Notice:
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   621
        this is NOT called when an image is restarted;
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   622
        in this case the show starts in Smalltalk>>restart."
211
58bb873aa83c *** empty log message ***
claus
parents: 202
diff changeset
   623
19510
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   624
    |idx shellArgs|
6841
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   625
12861
5086a864ae3e changed:
Claus Gittinger <cg@exept.de>
parents: 12813
diff changeset
   626
    NumberOfClassesHint := 10000.
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
   627
3499
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   628
    Initializing := true.
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   629
    AbstractOperatingSystem initializeConcreteClass.
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   630
18307
c1d97d109f88 also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents: 18293
diff changeset
   631
    CommandLineArguments isEmptyOrNil ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   632
        CommandLineArguments := #('stx') asOrderedCollection.
5400
af8fdc4d3e02 kludge (for rel5)
Claus Gittinger <cg@exept.de>
parents: 5373
diff changeset
   633
    ].
4006
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   634
    CommandLine := CommandLineArguments copy.
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   635
    CommandLineArguments := CommandLineArguments asOrderedCollection.
6842
a5110421e4ab more for standAlone start
Claus Gittinger <cg@exept.de>
parents: 6841
diff changeset
   636
    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
   637
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   638
    SilentLoading := Silent := false.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   639
    VerboseLoading := VerboseStartup := Verbose := false.
19427
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   640
    DebuggingStandAlone := Debugging := false.
19510
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   641
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   642
    "/ if no argument was given, look for an environment variable named
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   643
    "/ STX_DEFAULT_ARGS. If set, take that.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   644
    "/ if any argument was given, unless a --noShellArgs argument is given,
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   645
    "/ slice in the value from "STX_MORE_ARGS" at the beginning.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   646
    "/
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   647
    "/ These allow for args like "--quick --infoPrint" to be automatically prepended
19511
96c72a572feb #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19510
diff changeset
   648
    idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs').
19510
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   649
    (idx ~~ 0) ifTrue:[
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   650
        CommandLineArguments removeIndex:idx.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   651
    ] ifFalse:[   
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   652
        CommandLineArguments isEmpty ifTrue:[
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   653
            shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   654
            shellArgs notEmptyOrNil ifTrue:[
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   655
                shellArgs := shellArgs asCollectionOfWords.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   656
                CommandLineArguments addAll:shellArgs.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   657
            ].
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   658
        ] ifFalse:[
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   659
            "/ prepend shell environment args from "STX_ARGS"
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   660
            shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   661
            shellArgs notEmptyOrNil ifTrue:[
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   662
                shellArgs := shellArgs asCollectionOfWords.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   663
                CommandLineArguments addAllFirst:shellArgs.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   664
            ].
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   665
        ].
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   666
    ].
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   667
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   668
    self initializeVerboseFlags.    
14432
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   669
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   670
    Error handle:[:ex |
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   671
        StandAlone ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   672
            DebuggingStandAlone ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   673
                'Startup Error - use "--debug" command line argument for more info' errorPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   674
                Smalltalk exit:1.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   675
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   676
            'Smalltalk [error]: Error during early initialization:' errorPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   677
            thisContext fullPrintAll.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   678
        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   679
        ex reject.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   680
    ] do:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   681
        self basicInitializeSystem
14432
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   682
    ].
13091
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   683
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   684
    "Modified: / 12-10-2010 / 11:27:47 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   685
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   686
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   687
initializeVerboseFlags
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   688
    |idx|
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   689
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   690
    StandAlone ifTrue:[
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   691
        InfoPrinting := false.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   692
        ObjectMemory infoPrinting:false.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   693
        IgnoreAssertions := true.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   694
    ] ifFalse:[
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   695
        IgnoreAssertions := false.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   696
    ].    
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   697
    
19430
2e309bb80f95 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19429
diff changeset
   698
    (idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[
2e309bb80f95 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19429
diff changeset
   699
        IgnoreHalt := true.
2e309bb80f95 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19429
diff changeset
   700
        CommandLineArguments removeIndex:idx
2e309bb80f95 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19429
diff changeset
   701
    ].
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   702
    (idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   703
        IgnoreHalt := false.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   704
        CommandLineArguments removeIndex:idx
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   705
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   706
    (idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   707
        IgnoreAssertions := true.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   708
        CommandLineArguments removeIndex:idx
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   709
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   710
    (idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   711
        IgnoreAssertions := false.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   712
        CommandLineArguments removeIndex:idx
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   713
    ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   714
    (idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   715
        SilentLoading := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   716
        CommandLineArguments removeIndex:idx
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   717
    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   718
    (idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   719
        VerboseLoading := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   720
        CommandLineArguments removeIndex:idx
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   721
    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   722
    (idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   723
        VerboseLoading := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   724
        VerboseStartup := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   725
        CommandLineArguments removeIndex:idx
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   726
    ].
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   727
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   728
    "/ reinterpret those, in case given after the VM options.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   729
    (idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   730
        ObjectMemory debugPrinting:true.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   731
        CommandLineArguments removeIndex:idx
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   732
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   733
    (idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   734
        ObjectMemory infoPrinting:true.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   735
        CommandLineArguments removeIndex:idx
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   736
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   737
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   738
    (idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[
20878
ae8e23d9f65c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20877
diff changeset
   739
        Object infoPrinting:true.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   740
        Verbose := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   741
        VerboseLoading := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   742
        VerboseStartup := true.
20876
9849da11291a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20875
diff changeset
   743
        Logger notNil ifTrue:[
9849da11291a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20875
diff changeset
   744
            Logger loggingThreshold: Logger severityALL.
9849da11291a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20875
diff changeset
   745
        ].    
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   746
        CommandLineArguments removeIndex:idx.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   747
    ].
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   748
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   749
    Silent := false.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   750
    (idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   751
        CommandLineArguments removeIndex:idx.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   752
        Silent := SilentLoading := true.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   753
        Object infoPrinting:false.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   754
        ObjectMemory infoPrinting:false.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   755
        ObjectMemory debugPrinting:false.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   756
        Verbose := VerboseLoading := VerboseStartup := false.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   757
        Logger notNil ifTrue:[
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   758
            Logger loggingThreshold: Logger severityNONE
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   759
        ].    
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   760
    ].
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   761
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   762
    idx := CommandLineArguments indexOf:'--debug'.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   763
    Debugging := (idx ~~ 0).
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   764
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   765
    StandAlone ifTrue:[
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   766
        DebuggingStandAlone := Debugging.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   767
        DebuggingStandAlone ifTrue:[
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   768
            Inspector := MiniInspector.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   769
            Debugger := MiniDebugger.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   770
            IgnoreAssertions := false.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   771
        ].
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   772
    ] ifFalse:[
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   773
        "/
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   774
        "/ define low-level debugging tools - graphical classes are not prepared yet
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   775
        "/ to handle things.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   776
        "/ This will bring us into the MiniDebugger when an error occurs during startup.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   777
        "/
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   778
        Inspector := MiniInspector.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   779
        Debugger := MiniDebugger.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   780
    ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   781
!
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   782
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   783
isInitialized
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   784
    "this returns true, if the system is properly initialized;
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   785
     i.e. false during startup.
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
   786
     Especially, the whole display/viewing stuff and process escheduling
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
   787
     is not working correctly until initialized."
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   788
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   789
    Initializing isNil ifTrue:[^ false]. "/ if called very early
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   790
    ^ Initializing not
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   791
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   792
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   793
reinitStandardStreams
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   794
    "reinitialize some well-known streams.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   795
     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
   796
     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
   797
     (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
   798
8710aba7876b oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   799
    Stdout reOpen. Stderr reOpen. Stdin reOpen.
161
ed36169f354d *** empty log message ***
claus
parents: 159
diff changeset
   800
! !
ed36169f354d *** empty log message ***
claus
parents: 159
diff changeset
   801
16593
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   802
!Smalltalk class methodsFor:'Compatibility-GNU'!
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   803
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   804
system:command
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   805
    "GNU-Smalltalk compatibility: execute an OS command"
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   806
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   807
    OperatingSystem executeCommand:command
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   808
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   809
    "
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   810
     Smalltalk system:'ls'
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   811
    "
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   812
! !
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   813
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   814
!Smalltalk class methodsFor:'Compatibility-Squeak'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   815
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   816
beep
17343
ed954add0878 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17328
diff changeset
   817
    "output an audible beep or bell"
ed954add0878 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17328
diff changeset
   818
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   819
    Screen current beep
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   820
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   821
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   822
garbageCollect
15009
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   823
    "for Squeak compatibility"
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   824
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   825
    ObjectMemory garbageCollect
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   826
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   827
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   828
garbageCollectMost
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   829
    "collect recently created garbage; return the amount of freeSpace.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   830
     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
   831
     newSpace + freeListSpace is returned."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   832
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   833
    ObjectMemory scavenge.
15009
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   834
    ^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed)
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   835
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   836
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   837
isMorphic
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   838
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   839
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   840
10844
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   841
platformName
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   842
    "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
   843
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   844
    ^ OperatingSystem platformName asUppercaseFirst
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   845
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   846
    "
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   847
     Smalltalk platformName -> 'Win32'
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   848
    "
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   849
!
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   850
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   851
registerExternalObject: anObject
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   852
    "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
   853
     If it is already there, just return its index.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   854
     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
   855
     primitive code (via the global Smalltalk:SpecialObjectArray)"
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   856
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   857
    | objects firstEmptyIndex obj sz newObjects |
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   858
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   859
    objects := SpecialObjectArray.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   860
    objects isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   861
	objects := Array new:5.
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   862
    ].
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   863
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   864
    "find the first empty slot and look if already registered"
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   865
    firstEmptyIndex := 0.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   866
    1 to: objects size do: [:i |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   867
	obj := objects at: i.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   868
	obj == anObject ifTrue: [^ i].  "object already there, just return its index"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   869
	(obj == nil and: [firstEmptyIndex = 0]) ifTrue: [
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   870
	    firstEmptyIndex := i
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   871
	]
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   872
    ].
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   873
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   874
    "if no empty slots, expand the array"
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   875
    firstEmptyIndex = 0 ifTrue: [
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   876
	sz := objects size.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   877
	newObjects := objects species new: sz + 20.  "grow linearly"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   878
	newObjects replaceFrom: 1 to: sz with: objects startingAt: 1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   879
	firstEmptyIndex := sz + 1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   880
	SpecialObjectArray := newObjects.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   881
	objects := newObjects
4584
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   882
    ].
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   883
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   884
    objects at: firstEmptyIndex put: anObject.
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   885
    ^ firstEmptyIndex
789c83e8cae0 some squeak compatibility stuff
Claus Gittinger <cg@exept.de>
parents: 4524
diff changeset
   886
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   887
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   888
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   889
removeClassNamed: aName
17576
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   890
    "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
   891
     Also needed by the refactory browser.
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   892
     If anything untoward happens, report it in the Transcript."
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   893
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   894
    | oldClass |
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   895
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   896
    (oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   897
	Transcript showCR: 'Removal of class named ', aName, ' ignored because it does not exist.'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   898
	^ self
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   899
    ].
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   900
    oldClass removeFromSystem
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   901
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   902
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   903
!Smalltalk class methodsFor:'Compatibility-V''Age'!
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   904
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   905
allClassesImplementing:aSelector
12304
b0dc1c58de1a changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents: 12301
diff changeset
   906
    ^ self allClassesForWhich:[:cls | cls includesSelector:aSelector].
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
   907
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
   908
    "Modified: / 10-08-2006 / 12:12:17 / cg"
9090
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   909
!
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   910
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   911
declareConstant:constantName poolName:poolNameArg value:value
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   912
    "visualAge compatible pool variable declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   913
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   914
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   915
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   916
    |ns poolName pool|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   917
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   918
    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   919
    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   920
    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   921
    (ns isNil or:[ns == Smalltalk]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   922
	poolName := poolNameArg asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   923
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   924
	poolName := (ns name,'::',poolNameArg) asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   925
    ].
9090
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   926
    pool := self classNamed:poolName.
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   927
    pool declareConstant:constantName value:value
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   928
!
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   929
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   930
declarePoolDictionary:poolDictionaryNameArg
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   931
    "visualAge compatible pool declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   932
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   933
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   934
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   935
    |ns poolName|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   936
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   937
    poolName := poolDictionaryNameArg asSymbol.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   938
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   939
"/    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   940
"/    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   941
"/    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   942
"/    (ns isNil or:[ns == Smalltalk]) ifTrue:[
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   943
"/        poolName := poolDictionaryNameArg asSymbol
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   944
"/    ] ifFalse:[
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   945
"/        poolName := (ns name,'::',poolDictionaryNameArg) asSymbol
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   946
"/    ].
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   947
    ^ SharedPool subclass:(poolName asSymbol)
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   948
	instanceVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   949
	classVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   950
	poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   951
	category:'* VAST Pools'
13998
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   952
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   953
    "Modified: / 07-02-2012 / 15:56:16 / cg"
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   954
!
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   955
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   956
declareVariable:varName poolName:poolNameArg
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   957
    "visualAge compatible pool declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   958
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   959
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   960
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   961
    |ns poolName pool|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   962
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   963
    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   964
    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   965
    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   966
    (ns isNil or:[ns == Smalltalk]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   967
	poolName := poolNameArg asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   968
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   969
	poolName := (ns name,'::',poolNameArg) asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   970
    ].
13998
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   971
    pool := self classNamed:poolName.
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   972
    pool declareVariable:varName
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   973
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   974
    "Created: / 07-02-2012 / 15:57:05 / cg"
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   975
! !
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   976
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
   977
!Smalltalk class methodsFor:'Compatibility-VW'!
6094
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   978
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   979
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
   980
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   981
	defineClass:nameSymbol
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   982
	superclass:superclass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   983
	indexedType:indexed
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   984
	private:private
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   985
	instanceVariableNames:instVars
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   986
	classInstanceVariableNames:classInstVars
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   987
	imports:imports
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   988
	category:category
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   989
	attributes:nil
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   990
!
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   991
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   992
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
   993
    |newClass|
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   994
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   995
    indexed == #none ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   996
	newClass := superclass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   997
	    subclass:nameSymbol
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   998
	    instanceVariableNames:instVars
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   999
	    classVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1000
	    poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1001
	    category:category
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1002
	    inEnvironment:self.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1003
	classInstVars size > 0 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1004
	    newClass class instanceVariableNames:classInstVars.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1005
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1006
	^ newClass
6851
91662dfb3e80 Remove debug print.
Stefan Vogel <sv@exept.de>
parents: 6849
diff changeset
  1007
    ].
91662dfb3e80 Remove debug print.
Stefan Vogel <sv@exept.de>
parents: 6849
diff changeset
  1008
    self shouldImplement.
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1009
!
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1010
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1011
defineNameSpace:nameSymbol private:private imports:imports category:category
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1012
    |newNameSpace|
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1013
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1014
    private ifTrue:[self halt].     "/ what to do ?
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1015
    imports withoutSeparators notEmpty ifTrue:[self halt].     "/ what to do ?
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1016
    newNameSpace := NameSpace name:nameSymbol.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1017
    newNameSpace setCategory:category.
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1018
    ^ newNameSpace
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1019
!
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1020
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1021
dialectName
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1022
    ^ #SmalltalkX
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1023
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1024
    "
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1025
     Smalltalk dialectName
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1026
    "
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1027
!
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1028
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1029
dialectReleaseVersion
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1030
    ^ self versionString
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1031
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1032
    "
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1033
     Smalltalk dialectReleaseVersion
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1034
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1035
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1036
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1037
!Smalltalk class methodsFor:'accessing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1038
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1039
associationAt:aKey
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1040
    "return a key-value association for aKey.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1041
     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
  1042
     simulated here."
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
    |val|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1045
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1046
    val := self at:aKey ifAbsent:[^ nil].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1047
    ^ Association key:aKey value:val
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1048
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1049
    "Created: / 1.11.1997 / 13:27:20 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1050
!
3083
451912c492ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
  1051
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1052
associationAt:aKey ifAbsent:exceptionBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1053
    "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
  1054
     from exceptionBlock, if no such key is present.
14973
086ef2bb2007 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14933
diff changeset
  1055
     Since ST/X's Smalltalk as no real dictionary, this is simulated here.
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1056
     Warning: this is a compatibility interface only, with a different semantic as
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1057
              the original ST80 implementation. The returned assoc is created on the fly,
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1058
              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
  1059
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
  1060
    |val|
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
  1061
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1062
    val := self at:aKey ifAbsent:[^ exceptionBlock value].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1063
    ^ Association key:aKey value:val
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1064
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1065
    "Created: / 18.6.1998 / 17:05:24 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1066
!
3610
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
  1067
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1068
at:aKey
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1069
    "retrieve the value stored under aKey, a symbol.
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1070
     Return nil if not present
1956
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1071
     (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
  1072
16831
596e07380f6f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16803
diff changeset
  1073
    aKey class == Symbol ifFalse:[self error:'expected symbol'].
6080
15ea3cbf6003 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  1074
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1075
%{  /* NOCONTEXT */
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1076
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1077
    {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1078
	STSymbol keySymbol = aKey.asSTSymbol();
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1079
	STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol);
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1080
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1081
	return context._RETURN( val == null ? Nil : val );
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1082
    }
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1083
    /* NOT REACHED */
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1084
#else
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1085
    RETURN ( __GLOBAL_GET(aKey) );
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1086
#endif
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1087
%}.
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1088
    ^ self primitiveFailed
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1089
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1090
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1091
at:aKey ifAbsent:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1092
    "retrieve the value stored at aKey.
7565
cd76db5ee5cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7564
diff changeset
  1093
     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
  1094
     the evaluation of aBlock."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1095
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1096
    |val|
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1097
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1098
    val := self at:aKey.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1099
    (val notNil or:[self includesKey:aKey]) ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1100
        ^ val
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1101
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1102
    ^ aBlock value
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1103
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1104
    "
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1105
     Smalltalk removeKey:#fooBar.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1106
     Smalltalk at:#fooBar                       <- returns nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1107
     Smalltalk at:#fooBar ifAbsent:['sorry']    <- no error
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
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1110
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1111
at:aKey ifAbsentPut:aBlock
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1112
    "return the element indexed by aKey if present,
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1113
     if not present, store the result of evaluating valueBlock
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1114
     under aKey and return it."
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1115
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1116
    ^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ].
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1117
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1118
    "Created: / 29-05-2007 / 12:41:12 / cg"
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1119
!
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1120
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1121
at:aKey ifPresent:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1122
    "try to retrieve the value stored at aKey.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1123
     If there is nothing stored under this key, do nothing.
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1124
     Otherwise, evaluate aBlock, passing the retrieved value as argument."
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1125
13883
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
  1126
    |val|
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
  1127
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1128
    val := self at:aKey.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1129
    (val notNil or:[self includesKey:aKey]) ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1130
        ^ aBlock value:val.
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1131
    ].
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1132
    ^ nil
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1133
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1134
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1135
     Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1136
     Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what].
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1137
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1138
     Smalltalk at:#fooBar put:nil.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1139
     Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1140
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1141
13883
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
  1142
    "Modified: / 27-12-2011 / 10:14:30 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1143
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1144
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1145
at:aKey put:aValue
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1146
    "store the argument aValue under aKey, a symbol.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1147
     Return aValue (sigh)."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1148
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1149
    |oldValue|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1150
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1151
%{
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1152
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1153
    {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1154
	STSymbol keySymbol = aKey.asSTSymbol();
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1155
	oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue);
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1156
    }
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1157
#else
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1158
    oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0);
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1159
#endif
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1160
%}.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1161
    CachedClasses notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1162
	oldValue isBehavior ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1163
	    oldValue name == aKey ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1164
		CachedClasses remove:oldValue ifAbsent:[]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1165
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1166
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1167
	aValue isBehavior ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1168
	    aValue name == aKey ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1169
		CachedClasses add:aValue
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1170
	    ] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1171
		CachedClasses := nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1172
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1173
	].
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1174
    ].
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  1175
    ^ aValue.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1176
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1177
    "Modified: 19.4.1996 / 11:31:49 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1178
!
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
includesKey:aKey
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1181
    "return true, if the key is known"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1182
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1183
    "/ for debugging - this is a common mistake,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1184
    "/ to try to access a class by nameString, instead
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1185
    "/ of by symbol.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1186
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1187
    "/ aKey class == String ifTrue:[self halt].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1188
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1189
%{  /* NOCONTEXT */
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1190
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1191
    STSymbol keySymbol = aKey.asSTSymbol();
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1192
    return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False);
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1193
    /* NOT REACHED */
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1194
#else
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1195
    RETURN ( __GLOBAL_KEYKNOWN(aKey) );
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1196
#endif
8583
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
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1199
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1200
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1201
keyAtValue:anObject
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1202
    "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
  1203
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1204
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1205
	(self at:aKey) == anObject ifTrue:[^ aKey]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1206
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1207
    ^ nil
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1208
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1209
    "Smalltalk keyAtValue:Object"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1210
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1211
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1212
keys
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1213
    "return a collection with all keys in the Smalltalk dictionary"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1214
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1215
    |keys|
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1216
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1217
    keys := IdentitySet new.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1218
    self keysDo:[:k | keys add:k].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1219
    ^ keys
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1220
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1221
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1222
removeKey:aKey
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1223
    "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
  1224
     WARNING:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1225
	this is somewhat dangerous: conceptionally, the association is removed,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1226
	to which machine & byte compiled code refers if it accesses a global.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1227
	If there are still global accesses in some literalArray or from machine-compiled code,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1228
	it continues to reference the globals value via that obsolete association and gets a nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1229
	value.  (which is correct)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1230
	However, if that global is later reintroduced, a new association will be created and
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1231
	the new global now referenced via the new association.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1232
	The old accesses will still see nil, although the globals value is actually non-nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1233
	(this is questionable).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1234
	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
  1235
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1236
    CachedClasses := nil.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1237
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1238
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1239
    RETURN ( __GLOBAL_REMOVE(aKey) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1240
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1241
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1242
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1243
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1244
10538
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1245
startBlocks
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1246
    ^ StartBlocks
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1247
!
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1248
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1249
values
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1250
    "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
  1251
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1252
    |values|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1253
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1254
    values := OrderedCollection new.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1255
    self do:[:v | values add:v].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1256
    ^ values
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
    "Created: 20.6.1997 / 16:58:28 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1259
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1260
13540
37ff6f12f224 changed: #start
Claus Gittinger <cg@exept.de>
parents: 13539
diff changeset
  1261
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1262
!Smalltalk class methodsFor:'browsing'!
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
browseAllCallsOn:aSelectorSymbol
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1265
    "{ Pragma: +optSpace }"
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
    "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
  1268
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1269
    UserPreferences systemBrowserClass browseAllCallsOn:aSelectorSymbol
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
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1272
     Smalltalk browseAllCallsOn:#at:put:
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1273
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1274
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1275
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1276
browseAllSelect:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1277
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1278
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1279
    "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
  1280
6020
555c690e6616 UserPreference access
Claus Gittinger <cg@exept.de>
parents: 5940
diff changeset
  1281
    UserPreferences systemBrowserClass browseAllSelect:aBlock
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1282
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1283
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1284
     Smalltalk browseAllSelect:[:m | m literals isNil]
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1285
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1286
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1287
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1288
browseChanges
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1289
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1290
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1291
    "startup a changes browser"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1292
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1293
    ChangesBrowser notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1294
	ChangesBrowser open
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1295
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1296
	self warn:'no ChangesBrowser built in'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1297
    ]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1298
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1299
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1300
     Smalltalk browseChanges
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1301
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1302
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1303
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1304
browseClass:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1305
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1306
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  1307
    "startup a browser on aClass.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1308
     The broser will only show that class (i.e. be a singleClass-browser).
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1309
     See browseInClass: for a full browser, which has aClass selected initially."
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1310
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1311
    UserPreferences systemBrowserClass browseClass:aClass
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1312
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1313
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1314
     Smalltalk browseClass:Array
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1315
    "
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1316
!
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1317
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1318
browseImplementorsMatching:aSelectorSymbolOrMatchPattern
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1319
    "{ Pragma: +optSpace }"
6819
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1320
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1321
    "startup a browser for all methods implementing a message matching"
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1322
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1323
    UserPreferences systemBrowserClass browseImplementorsMatching:aSelectorSymbolOrMatchPattern
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1324
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1325
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1326
     Smalltalk browseImplementorsOf:#'at:put:'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1327
     Smalltalk browseImplementorsMatching:#'at:*'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1328
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1329
!
6819
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1330
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1331
browseImplementorsOf:aSelectorSymbol
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1332
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1333
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1334
    "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
  1335
6020
555c690e6616 UserPreference access
Claus Gittinger <cg@exept.de>
parents: 5940
diff changeset
  1336
    UserPreferences systemBrowserClass browseImplementorsOf:aSelectorSymbol
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1337
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1338
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1339
     Smalltalk browseImplementorsOf:#at:put:
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1340
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1341
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1342
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1343
browseInClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1344
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1345
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1346
    "startup a full browser showing aClass.
20207
17e32d469ac6 #OTHER by mawalch
mawalch
parents: 20161
diff changeset
  1347
     The browser will be a full browser with aClass initially selected.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1348
     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
  1349
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1350
    UserPreferences systemBrowserClass openInClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1351
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1352
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1353
     Smalltalk browseInClass:Array
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1354
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1355
!
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1356
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1357
browseInClass:aClass selector:selector
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1358
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1359
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1360
    "startup a full browser showing aClass>>selector.
20207
17e32d469ac6 #OTHER by mawalch
mawalch
parents: 20161
diff changeset
  1361
     The browser will be a full browser with aClass initially selected.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1362
     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
  1363
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1364
    UserPreferences systemBrowserClass openInClass:aClass selector:selector
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1365
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1366
    "
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1367
     Smalltalk browseInClass:Array selector:#at:
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1368
    "
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1369
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1370
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1371
!Smalltalk class methodsFor:'class management'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1372
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1373
basicRemoveClass:aClass
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1374
    "remove the argument, aClass from the smalltalk dictionary;
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1375
     we have to flush the caches since these methods are now void.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1376
     Also, class variables of aClass are removed."
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1377
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1378
    |sym cSym names oldName oldNameSym actualName wrongName|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1379
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1380
    aClass isNil ifTrue:[^ self].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1381
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1382
    oldName := aClass name.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1383
    sym := oldNameSym := oldName asSymbol.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1384
    ((self at:oldNameSym) == aClass) ifFalse:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1385
        "check other name ..."
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1386
        (self includes:aClass) ifFalse:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1387
            'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1388
            ^ self
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1389
        ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1390
        "
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1391
         the class has changed its name - without telling me ...
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1392
         what should be done in this case ?
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1393
        "
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1394
        'Smalltalk [warning]: class ' errorPrint. oldName errorPrint.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1395
        ' has changed its name' errorPrintCR.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1396
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1397
        "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1398
        "/ might be an alias (i.e. removing a compatibility name)
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1399
        "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1400
        actualName := self keyAtValue:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1401
        ('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1402
        sym := actualName asSymbol.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1403
        oldName := actualName asString.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1404
        wrongName := true.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1405
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1406
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1407
    self at:sym put:nil.    "nil it out for compiled accesses"
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1408
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1409
    "/
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1410
    "/ see comment in removeKey: on why we don't remove it here
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1411
    "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1412
    "/ self removeKey:sym.     "/ remove key - this actually fails, if there are
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1413
                               "/ still compiled code references."
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1414
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1415
    "remove private classes"
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1416
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1417
    aClass privateClassesSorted do:[:somePrivateClass |
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1418
        aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1419
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1420
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1421
    "remove class variables"
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1422
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1423
    names := aClass classVariableString asCollectionOfWords.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1424
    names do:[:name |
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1425
        cSym := aClass globalKeyForClassVar:name.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1426
        self at:cSym asSymbol put:nil.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1427
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1428
        "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1429
        "/ see comment in removeKey: on why we dont remove it here
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1430
        "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1431
        "/ self removeKey:cSym
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1432
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1433
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1434
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1435
"/    actually could get along with less flushing
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1436
"/    (entries for aClass and subclasses only)
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1437
"/    but we have to delay this, until we have the set of subclasses
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1438
"/    at hand - for now, searching for all subclasses is way more
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1439
"/    expensive then cache flushing.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1440
"/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1441
"/    aClass allSubclassesDo:[:aSubclass |
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1442
"/        ObjectMemory flushInlineCachesForClass:aSubclass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1443
"/        ObjectMemory flushMethodCacheFor:aSubclass
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1444
"/    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1445
"/    ObjectMemory flushInlineCachesForClass:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1446
"/    ObjectMemory flushMethodCacheFor:aClass
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1447
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1448
    ObjectMemory flushInlineCaches.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1449
    ObjectMemory flushMethodCache.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1450
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1451
    aClass addChangeRecordForClassRemove.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1452
    self changed:#classRemove with:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1453
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1454
    aClass setCategory:#'* removed *'.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1455
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1456
"/    self flushCachedClasses.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1457
"/    Class flushSubclassInfo.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1458
    self flushCachedClass:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1459
    Class flushSubclassInfoFor:aClass superclass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1460
    Class flushSubclassInfoFor:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1461
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1462
    wrongName == true ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1463
        "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1464
        "/ an alias (i.e. removing a compatibility name)
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1465
        "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1466
        "/ check if there are more refs to it ...
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1467
        [self includes:aClass] whileTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1468
            actualName := self keyAtValue:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1469
            ('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1470
                          , ' - remove that binding too.') infoPrintCR.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1471
            self at:actualName put:nil.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1472
        ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1473
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1474
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1475
    "Modified: / 18-11-2006 / 17:16:31 / cg"
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1476
!
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1477
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1478
changeCategoryOf:aClass to:newCategory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1479
    "change a classes category, add a change record,
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1480
     send change notifications"
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1481
8405
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1482
    |ns oldCategory|
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1483
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1484
    oldCategory := aClass category.
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1485
    oldCategory ~= newCategory ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1486
	aClass category:(newCategory withoutSeparators asSymbol).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1487
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1488
	"notify change of category"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1489
	ns := aClass environment ? self.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1490
	ns changed:#organization with:(aClass -> oldCategory).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1491
	ns ~~ self ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1492
	    self changed:#organization with:(aClass -> oldCategory).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1493
	]
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1494
    ].
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1495
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1496
    "
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1497
     Smalltalk changeCategoryOf:NewApplication to:#myApplications
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1498
    "
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1499
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1500
    "Modified: / 11.2.2000 / 11:36:27 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1501
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1502
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1503
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
  1504
    NameSpace name:name
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1505
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1506
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1507
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1508
flushCachedClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1509
    CachedClasses notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1510
	CachedClasses remove:aClass ifAbsent:[].
12700
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1511
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1512
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1513
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1514
flushCachedClasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1515
    CachedClasses := nil.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1516
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1517
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1518
     Smalltalk flushCachedClasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1519
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1520
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1521
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1522
removeClass:aClass
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1523
    "remove the argument, aClass from the smalltalk dictionary;
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1524
     we have to flush the caches since these methods are now void.
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1525
     Also, class variables of aClass are removed.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1526
     Recompile accessors to aClass."
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1527
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1528
    |oldNameSym ns ons|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1529
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1530
    oldNameSym := aClass name asSymbol.
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1531
    ns := aClass nameSpace.
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1532
    aClass topOwningClass notNil ifTrue:[
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1533
        ons := aClass topOwningClass nameSpace
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1534
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1535
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1536
    self basicRemoveClass:aClass.
4724
44793fe70787 recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1537
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1538
    ns ~~ Smalltalk ifTrue:[
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1539
        ons notNil ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1540
            ClassBuilder
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1541
                recompileGlobalAccessorsTo:oldNameSym
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1542
                in:ons
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1543
                except:nil
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1544
        ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1545
        (ns notNil and:[ns ~~ ons]) ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1546
            ClassBuilder
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1547
                recompileGlobalAccessorsTo:oldNameSym
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1548
                in:ns
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1549
                except:nil
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1550
        ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1551
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1552
!
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1553
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1554
removeClasses:aCollectionOfClasses
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1555
    "remove aCollectionOfClasses from the smalltalk dictionary;
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1556
     we have to flush the caches since these methods are now void.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1557
     Also, class variables of aClass are removed.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1558
     Recompile accessors to the classes - after all classes in the collection have been removed."
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1559
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1560
    |tuples|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1561
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1562
    tuples := aCollectionOfClasses collect:[:eachClass|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1563
                Array 
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1564
                    with:eachClass name asSymbol
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1565
                    with:eachClass nameSpace
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1566
                    with:(
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1567
                            eachClass topOwningClass notNil ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1568
                                eachClass topOwningClass nameSpace
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1569
                            ] ifFalse:[nil])
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1570
            ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1571
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1572
    aCollectionOfClasses do:[:eachClass|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1573
        self basicRemoveClass:eachClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1574
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1575
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1576
    tuples do:[:eachClssymNsOnsTuple|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1577
        |oldNameSym ns ons|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1578
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1579
        oldNameSym := eachClssymNsOnsTuple at:1.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1580
        ns := eachClssymNsOnsTuple at:2.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1581
        ons := eachClssymNsOnsTuple at:3.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1582
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1583
        ns ~~ Smalltalk ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1584
            ons notNil ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1585
                ClassBuilder
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1586
                    recompileGlobalAccessorsTo:oldNameSym
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1587
                    in:ons
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1588
                    except:nil
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1589
            ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1590
            (ns notNil and:[ns ~~ ons]) ifTrue:[
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1591
                ClassBuilder
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1592
                    recompileGlobalAccessorsTo:oldNameSym
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1593
                    in:ns
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1594
                    except:nil
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1595
            ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1596
        ]
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1597
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1598
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1599
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1600
renameClass:aClass to:newName
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1601
    "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
  1602
     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
  1603
     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
  1604
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1605
    |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
  1606
     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
  1607
     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
  1608
     oldMetaclass newMetaclass newCategory|
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1609
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1610
    "/ check for all intermediate namespaces / owning classes
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1611
    i1 := 1.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1612
    i2 := 1.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1613
    ns := self.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1614
    [i2 ~~ 0] whileTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1615
        i2 := newName indexOfSubCollection:'::' startingAt:i1.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1616
        i2 ~~ 0 ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1617
            nm := newName copyFrom:i1 to:i2-1.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1618
            ns isNameSpace ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1619
                subns := ns at:nm asSymbol ifAbsent:nil.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1620
                subns isNil ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1621
                    self error:'Nonexisting namespace: ',nm.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1622
                    ^ nil.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1623
                ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1624
            ] ifFalse:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1625
                subns := ns privateClassesAt:nm asSymbol.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1626
                subns isNil ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1627
                    self error:'Cannot create a namespace below a class'
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1628
                ]
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1629
            ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1630
            ns := subns.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1631
            i1 := i2 + 2.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1632
        ].
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1633
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1634
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1635
    oldName := aClass name.
6734
dd9fa2d81cb9 use #topNameSpace
Claus Gittinger <cg@exept.de>
parents: 6722
diff changeset
  1636
    oldNameSpace := aClass topNameSpace.
2319
640bb389f90a recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents: 2317
diff changeset
  1637
    oldBaseName := aClass nameWithoutNameSpacePrefix.
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1638
    oldBaseNameWithoutPrefix := aClass nameWithoutPrefix.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1639
    oldSym := oldName asSymbol.
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1640
    privateClasses := aClass privateClassesSorted.
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1641
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1642
    ((self at:oldSym) ~~ aClass) ifTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1643
        'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1644
        ^ self
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1645
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1646
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1647
    "/ rename the class
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1648
1847
6e567214b167 care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents: 1758
diff changeset
  1649
    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
  1650
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1651
    "/ change the owning class
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1652
    ns isNameSpace ifFalse:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1653
        aClass isPrivate ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1654
            aClass class setOwningClass:ns.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1655
        ] ifFalse:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1656
            "/ sigh - must make a PrivateMetaclass from Metaclass
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1657
            oldMetaclass := aClass class.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1658
            newMetaclass := PrivateMetaclass new.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1659
            newMetaclass flags:(oldMetaclass flags).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1660
            newMetaclass setSuperclass:(oldMetaclass superclass).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1661
            newMetaclass instSize:(oldMetaclass instSize).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1662
            newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1663
            newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1664
            newMetaclass setSoleInstance:aClass.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1665
            newMetaclass setOwningClass:ns.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1666
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1667
            aClass changeClassTo:newMetaclass.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1668
            ObjectMemory flushCaches.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1669
        ]
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1670
    ] ifTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1671
        aClass isPrivate ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1672
            newCategory := aClass topOwningClass category.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1673
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1674
            "/ sigh - must make a Metaclass from PrivateMetaclass
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1675
            oldMetaclass := aClass class.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1676
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1677
            newMetaclass := Metaclass new.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1678
            newMetaclass flags:(oldMetaclass flags).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1679
            newMetaclass setSuperclass:(oldMetaclass superclass).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1680
            newMetaclass instSize:(oldMetaclass instSize).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1681
            newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1682
            newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1683
            newMetaclass setSoleInstance:aClass.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1684
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1685
            aClass category:newCategory.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1686
            aClass changeClassTo:newMetaclass.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1687
            ObjectMemory flushCaches.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1688
        ]
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1689
    ].
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1690
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1691
    aClass setName:newSym.
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1692
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1693
    "/ store it in Smalltalk
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1694
    self at:oldSym put:nil.
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1695
878
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1696
    "/
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1697
    "/ see comment in #removeKey: on why we don't remove it it here
878
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1698
    "/
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1699
    "/ self removeKey:oldSym.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1700
    self at:newSym put:aClass.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1701
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1702
    "/ 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
  1703
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1704
    oldNameToNewName := IdentityDictionary new.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1705
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1706
    names := aClass classVariableString asCollectionOfWords.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1707
    names do:[:name |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1708
        oldCVSym := (oldSym , ':' , name) asSymbol.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1709
        value := self at:oldCVSym.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1710
        self at:oldCVSym put:nil.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1711
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1712
        "/
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1713
        "/ see comment in #removeKey: on why we dont remove it it here
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1714
        "/
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1715
        "/ self removeKey:cSym.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1716
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1717
        newCVSym := (newSym , ':' , name) asSymbol.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1718
        self at:newCVSym put:value.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1719
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1720
        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
  1721
    ].
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1722
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1723
    "/ 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
  1724
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1725
    oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1726
        aClass withAllSubclasses do:[:aSubClass |
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1727
            Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1728
            aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod |
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1729
                aMethod changeLiteral:oldNameSym to:newNameSym
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1730
            ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1731
        ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1732
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1733
        "/ and also in privateClasses ? ...
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1734
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1735
"/        privateClasses size > 0 ifTrue:[
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1736
"/            privateClasses do:[:aPrivateClass |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1737
"/                aPrivateClass withAllSubclasses do:[:aSubClass |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1738
"/                    aSubClass class methodDictionary do:[:aMethod |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1739
"/                        aMethod changeLiteral:oldNameSym to:newNameSym
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1740
"/                    ].
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1741
"/                    aSubClass methodDictionary do:[:aMethod |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1742
"/                        aMethod changeLiteral:oldNameSym to:newNameSym
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1743
"/                    ]
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1744
"/                ].
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1745
"/            ]
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1746
"/        ]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1747
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1748
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1749
    aClass addChangeRecordForClassRename:oldSym to:newSym.
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1750
5333
d80386e06d21 rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  1751
    "/ 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
  1752
    aClass setEnvironment:nil.
6734
dd9fa2d81cb9 use #topNameSpace
Claus Gittinger <cg@exept.de>
parents: 6722
diff changeset
  1753
    newNameSpace := aClass topNameSpace.
2405
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1754
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1755
    privateClasses size > 0 ifTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1756
        "/ must rename privateClasses as well
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1757
        Class withoutUpdatingChangesDo:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1758
            privateClasses do:[:aPrivateClass |
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1759
                self renameClass:aPrivateClass
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1760
                     to:(newSym , '::' , aPrivateClass nameWithoutPrefix).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1761
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1762
                Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1763
                aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1764
                aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1765
                aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1766
                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
  1767
"/                ClassBuilder
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1768
"/                    recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1769
"/                    in:newNameSpace
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1770
"/                    except:nil.
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1771
            ]
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1772
        ]
2405
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1773
    ].
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1774
2319
640bb389f90a recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents: 2317
diff changeset
  1775
    oldNameSpace ~~ newNameSpace ifTrue:[
5246
2ca7b20c4108 create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents: 5214
diff changeset
  1776
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1777
        "/ all those referencing the class from the old nameSpace
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1778
        "/ must be recompiled ...
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1779
        "/ (to now access the global from smalltalk)
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1780
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1781
        oldNameSpace ~~ Smalltalk ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1782
            Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1783
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1784
            ClassBuilder
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1785
                recompileGlobalAccessorsTo:oldName asSymbol
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1786
                in:oldNameSpace
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1787
                except:nil.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1788
        ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1789
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1790
        "/ all referencing the class in the new namespace
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1791
        "/ as well; to now access the new class.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1792
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1793
        (newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1794
            Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1795
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1796
            ClassBuilder
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1797
                recompileGlobalAccessorsTo:oldBaseName asSymbol
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1798
                in:newNameSpace
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1799
                except:nil.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1800
        ].
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1801
    ] ifFalse:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1802
        "/ all references to a global with my new name in my owning class
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1803
        "/ must now be redirected to myself.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1804
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1805
        aClass isPrivate ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1806
            newBaseName := aClass nameWithoutNameSpacePrefix.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1807
            newBaseNameWithoutPrefix := aClass nameWithoutPrefix.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1808
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1809
            Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1810
            aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1811
            aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1812
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1813
            Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1814
            aClass owningClass recompileMethodsAccessingGlobal:oldBaseName.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1815
            aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1816
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1817
            Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1818
            aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1819
            aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1820
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1821
            Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1822
            aClass owningClass recompileMethodsAccessingGlobal:newBaseName.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1823
            aClass owningClass class recompileMethodsAccessingGlobal:newBaseName.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1824
        ]
4040
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1825
    ].
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1826
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1827
    aClass changed:#definition.
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1828
    "/ 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
  1829
    aClass allSubclassesDo:[:subClass |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1830
        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
  1831
    ].
facae0a118da when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents: 7992
diff changeset
  1832
    "/ 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
  1833
    aClass subclassesDo:[:subClass |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1834
        subClass addChangeRecordForClass:subClass.
4040
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1835
    ].
5613
b534e427f028 change message when renaming a class
Claus Gittinger <cg@exept.de>
parents: 5611
diff changeset
  1836
    self changed:#definition.
14611
5c3a6b7ed01d class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14589
diff changeset
  1837
    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
  1838
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1839
    "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
  1840
    "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
  1841
    "Modified: / 05-09-2006 / 12:52:25 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1842
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1843
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1844
!Smalltalk class methodsFor:'copying'!
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
deepCopy
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1847
    "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
  1848
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1849
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1850
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1851
    "Modified: 18.5.1996 / 12:13:33 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1852
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1853
10952
16d46611f7ae deepCopy change
ab
parents: 10904
diff changeset
  1854
deepCopyUsing:aDictionary postCopySelector:postCopySelector
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1855
    "return a deep copy of the receiver.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1856
     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
  1857
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1858
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1859
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1860
    "Modified: 18.5.1996 / 12:13:36 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1861
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1862
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1863
shallowCopy
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1864
    "redefined to return self - there is only one Smalltalk dictionary"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1865
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1866
    ^ self
1410
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1867
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1868
    "Modified: 18.5.1996 / 12:13:39 / cg"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1869
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1870
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1871
simpleDeepCopy
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1872
    "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
  1873
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1874
    ^ self
1410
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1875
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1876
    "Modified: 18.5.1996 / 12:13:42 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1877
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1878
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1879
!Smalltalk class methodsFor:'debugging ST/X'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1880
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1881
compileTrace:aBoolean
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1882
    "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
  1883
%{
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1884
    extern char __compileTrace__;
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1885
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1886
    __compileTrace__ = (aBoolean == true) ? 1 : 0;
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1887
%}
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1888
    "
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1889
     Smalltalk compileTrace:true
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1890
     Smalltalk compileTrace:false
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1891
    "
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1892
!
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1893
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1894
debugBreakPoint
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1895
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1896
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1897
    "call the dummy debug function, on which a breakpoint
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1898
     can be put in adb, sdb, dbx or gdb.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1899
     WARNING: this method is for debugging only
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1900
	      it will be removed without notice."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1901
%{
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1902
    __PATCHUPCONTEXTS(__context);
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1903
    __debugBreakPoint__();
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1904
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1905
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1906
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1907
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1908
exitWithCoreDump
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1909
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1910
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1911
    "abort the program and dump core"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1912
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1913
    OperatingSystem exitWithCoreDump
4096
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1914
    "/ never returns
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1915
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1916
    "Be careful evaluating this:
4096
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1917
     Smalltalk exitWithCoreDump
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1918
    "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1919
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1920
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1921
fatalAbort
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1922
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1923
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1924
    "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
  1925
     (You may turn off the stack print with debugPrinting:false)"
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1926
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1927
    self fatalAbort:'fatalAbort'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1928
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1929
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1930
fatalAbort:aMessage
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1931
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1932
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1933
    "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
  1934
     (You may turn off the stack print with debugPrinting:false)"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1935
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1936
%{
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1937
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1938
    STMain.fatalAbort( aMessage );
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1939
    /* NOT REACHED */
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1940
#else
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1941
    char *msg;
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1942
12481
805176d238d2 change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 12413
diff changeset
  1943
    if (__isStringLike(aMessage))
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1944
	msg = (char *) __stringVal(aMessage);
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1945
    else
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1946
	msg = "fatalAbort";
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1947
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1948
    __fatal0(__context, msg);
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1949
    /* NEVER RETURNS */
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1950
#endif
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1951
%}.
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1952
    ^ self primitiveFailed
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5427
diff changeset
  1953
!
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5427
diff changeset
  1954
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1955
ignoreHalt
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1956
    "return true, if halts are ignored.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1957
     Usually, this is done in standAlone applications"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1958
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1959
    IgnoreHalt isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1960
	^  self isStandAloneApp
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1961
    ].
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1962
    ^ IgnoreHalt
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1963
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1964
    "Created: / 18-11-2010 / 11:20:16 / cg"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1965
!
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1966
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1967
ignoreHalt:aBoolean
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1968
    "control if halts are to be ignored;
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1969
     usually, this is done in standAlone applications"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1970
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1971
    IgnoreHalt := aBoolean
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1972
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1973
    "
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1974
     Smalltalk ignoreHalt:true.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1975
     self halt.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1976
     Smalltalk ignoreHalt:false.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1977
     self halt.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1978
    "
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1979
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1980
    "Created: / 18-11-2010 / 11:20:27 / cg"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1981
!
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1982
18329
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1983
verbose
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1984
    ^ Verbose
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1985
!
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1986
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1987
verbose:aBoolean
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1988
    Verbose := aBoolean
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1989
!
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  1990
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1991
vmInstructionTrace:aBoolean
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  1992
    self halt:'not yet implemented'
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  1993
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  1994
    "Modified: / 19-01-2012 / 10:15:35 / cg"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1995
! !
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1996
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1997
!Smalltalk class methodsFor:'enumerating'!
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1998
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1999
allBehaviorsDo:aBlock
5580
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  2000
    "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
  2001
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  2002
    self allClassesAndMetaclassesDo:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2003
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2004
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2005
     Smalltalk allBehaviorsDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2006
    "
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2007
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2008
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2009
allClassCategories
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2010
    "return a set of all class categories in the system"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2011
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2012
    |allCategories|
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2013
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2014
    allCategories := Set new.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2015
    Smalltalk allClassesDo:[:cls |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2016
	|category|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2017
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2018
	category := cls category.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2019
	category notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2020
	    allCategories add:category.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2021
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2022
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2023
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2024
    ^ allCategories.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2025
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2026
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2027
     Smalltalk allClassCategories
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2028
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2029
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2030
    "Created: / 17.11.2001 / 12:13:09 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2031
!
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2032
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2033
allClassesAndMetaclassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2034
    "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
  2035
21108
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2036
    |already numClassesHintTimes2|
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2037
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2038
    numClassesHintTimes2 := NumberOfClassesHint*2.
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2039
    already := IdentitySet new:numClassesHintTimes2.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2040
    self allClassesDo:[:eachClass |
21109
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2041
        |theNonMeta theMeta|
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2042
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2043
        theNonMeta := eachClass theNonMetaclass.
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2044
        (already includes:theNonMeta) ifFalse:[
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2045
            aBlock value:theNonMeta.
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2046
            already add:theNonMeta.
20556
d6f5739ac631 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 20294
diff changeset
  2047
        ].
21109
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2048
        theMeta := theNonMeta class.
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2049
        (already includes:theMeta) ifFalse:[
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2050
            aBlock value:theMeta.
1a34b9b12b7d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21108
diff changeset
  2051
            already add:theMeta.
20556
d6f5739ac631 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 20294
diff changeset
  2052
        ].
21108
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2053
        already size > numClassesHintTimes2 ifTrue:[
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2054
            NumberOfClassesHint := (already size // 2) + 10
20556
d6f5739ac631 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 20294
diff changeset
  2055
        ].    
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2056
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2057
!
5579
26af506d271e added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents: 5550
diff changeset
  2058
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2059
allClassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2060
    "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
  2061
5765
152a485288d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5760
diff changeset
  2062
    self allClasses do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2063
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2064
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2065
     Smalltalk allClassesDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2066
    "
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2067
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2068
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2069
allClassesForWhich:filter
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2070
    "return a collection with all classes in the system,
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2071
     for which filter evaluates to true."
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2072
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2073
    |collectedClasses|
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2074
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2075
    collectedClasses := OrderedCollection new.
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2076
    self allClassesForWhich:filter do:[:cls |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2077
	collectedClasses add:cls
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2078
    ].
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2079
    ^ collectedClasses
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2080
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2081
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2082
     Smalltalk
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2083
	allClassesForWhich:[:cls | cls name startsWith:'Po']
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2084
    "
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2085
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2086
    "Created: / 10-08-2006 / 12:11:31 / cg"
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2087
!
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2088
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2089
allClassesForWhich:filter do:aBlock
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2090
    "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
  2091
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2092
    self allClassesDo:[:cls |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2093
	(filter value:cls) ifTrue:[ aBlock value:cls ].
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2094
    ].
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2095
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2096
    "
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2097
     Smalltalk
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2098
	allClassesForWhich:[:cls | cls name startsWith:'Po']
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2099
	do:[:aClass | Transcript showCR:aClass name]
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2100
    "
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2101
!
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2102
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2103
allClassesInCategory:aCategory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2104
    "return a collection of for all classes in aCategory;
1299
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2105
     The order of the classes is not defined."
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2106
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2107
    ^ self allClassesForWhich:[:cls | cls category = aCategory]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2108
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2109
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2110
     Smalltalk allClassesInCategory:'Views-Basic'
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2111
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2112
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2113
    "Modified: / 10-08-2006 / 12:13:32 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2114
!
1299
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2115
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2116
allClassesInCategory:aCategory do:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2117
    "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
  2118
     The order of the classes is not defined."
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2119
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2120
    aCategory notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2121
	self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2122
    ]
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2123
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2124
    "
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2125
     Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass]
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2126
    "
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2127
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2128
    "Modified: / 09-08-2006 / 17:18:50 / fm"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2129
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2130
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2131
allClassesInCategory:aCategory inOrderDo:aBlock
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2132
    "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
  2133
     superclasses come first - then subclasses"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2134
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2135
    |classes|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2136
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2137
    aCategory notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2138
	classes := OrderedCollection new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2139
	self allClassesInCategory:aCategory do:[:aClass |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2140
	    classes add:aClass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2141
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2142
	classes topologicalSort:[:a :b | b isSubclassOf:a].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2143
	classes do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2144
    ]
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2145
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2146
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2147
     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
  2148
    "
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2149
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2150
    "Modified: / 17.11.2001 / 12:18:15 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2151
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2152
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2153
allClassesInOrderDo:aBlock
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2154
    "evaluate the argument, aBlock for all classes in the system;
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2155
     Evaluation order is by inheritance: superclasses come first."
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2156
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2157
    |already|
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2158
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2159
    already := IdentitySet new:NumberOfClassesHint.
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2160
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2161
	(already includes:eachClass) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2162
	    eachClass allSuperclasses reverseDo:[:eachSuperClass |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2163
		(already includes:eachSuperClass) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2164
		    already add:eachSuperClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2165
		    aBlock value:eachSuperClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2166
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2167
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2168
	    already add:eachClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2169
	    aBlock value:eachClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2170
	]
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2171
    ].
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2172
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2173
    "
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2174
     Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name]
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2175
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2176
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2177
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2178
allClassesInPackage:aPackageID
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2179
    "evaluate the argument, aBlock for all classes a package;
10087
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  2180
     The order of the classes is not defined.
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  2181
     The returned collection may include private classes"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2182
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2183
    ^ self allClassesForWhich:[:cls | cls package = aPackageID]
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2184
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2185
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2186
     Smalltalk allClassesInPackage:'bosch:dapasx'
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2187
    "
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2188
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2189
    "Created: / 10-08-2006 / 12:14:10 / cg"
10087
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  2190
    "Modified: / 12-10-2006 / 23:48:43 / cg"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2191
!
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2192
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2193
allClassesInPackage:aPackageID do:aBlock
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2194
    "evaluate the argument, aBlock for all classes a package;
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2195
     The order of the classes is not defined."
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2196
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2197
    ^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2198
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2199
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2200
     Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass]
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2201
    "
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2202
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2203
    "Created: / 09-08-2006 / 17:14:17 / fm"
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2204
!
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2205
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2206
allKeysDo:aBlock
20988
9d8802a18388 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20899
diff changeset
  2207
    <resource: #obsolete>
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2208
    "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
  2209
21265
e44b6104a678 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21188
diff changeset
  2210
    self obsoleteMethodWarning:'please use #keysDo:'.
17385
0d98fa1e74ff class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17369
diff changeset
  2211
    self keysDo:aBlock
21265
e44b6104a678 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21188
diff changeset
  2212
e44b6104a678 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21188
diff changeset
  2213
    "Modified: / 20-01-2017 / 17:52:40 / stefan"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2214
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2215
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2216
allMethodCategories
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2217
    "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
  2218
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2219
    |allCategories|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2220
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2221
    allCategories := Set new.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2222
    Smalltalk allClassesDo:[:cls |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2223
	allCategories addAll:cls categories.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2224
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2225
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2226
    ^ allCategories.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2227
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2228
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2229
     Smalltalk allMethodCategories
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2230
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2231
!
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
  2232
9259
7480ca3bdca9 allMethodsDo: utility
Claus Gittinger <cg@exept.de>
parents: 9254
diff changeset
  2233
allMethodsDo:aBlock
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2234
    "enumerate all methods in all classes"
12000
21c4d24bdd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11977
diff changeset
  2235
9259
7480ca3bdca9 allMethodsDo: utility
Claus Gittinger <cg@exept.de>
parents: 9254
diff changeset
  2236
    Smalltalk allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2237
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2238
	    aBlock value:mthd
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2239
	]
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2240
    ].
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2241
!
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2242
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2243
allMethodsForWhich:aBlock
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2244
    "return a collection of methods for which aBlock returns true"
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2245
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2246
    |coll|
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2247
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2248
    coll := OrderedCollection new.
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2249
    Smalltalk allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2250
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2251
	    (aBlock value:mthd) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2252
		coll add:mthd
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2253
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2254
	]
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2255
    ].
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2256
    ^ coll
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2257
!
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2258
12300
e72e90ea410f changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents: 12299
diff changeset
  2259
allMethodsWithSelectorDo:aTwoArgBlock
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2260
    "enumerate all methods in all classes and evaluate aBlock
12300
e72e90ea410f changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents: 12299
diff changeset
  2261
     with method and selector as arguments."
12299
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2262
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2263
    Smalltalk allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2264
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2265
	    aTwoArgBlock value:mthd value:sel
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2266
	]
12299
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2267
    ].
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2268
!
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2269
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2270
associationsDo:aBlock
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2271
    "evaluate the argument, aBlock for all key/value pairs
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2272
     in the Smalltalk dictionary"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2273
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2274
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2275
	aBlock value:(aKey -> (self at:aKey))
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2276
    ]
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2277
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2278
    "Smalltalk associationsDo:[:assoc | assoc printCR]"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2279
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2280
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2281
basicKeys
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2282
    "for rel > 5 only"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2283
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2284
%{
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2285
#ifdef __SCHTEAM__
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2286
    STObject[] keys = STSmalltalkEnvironment.GetKeyVector();
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2287
    return __c__._RETURN( new STVector(keys) );
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2288
#endif
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2289
%}.
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2290
    self primitiveFailed
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2291
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2292
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2293
do:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2294
    "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
  2295
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2296
    |work|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2297
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2298
%{  /* 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
  2299
    __GLOBALS_DO(&aBlock, &work);
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2300
    RETURN (self);
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2301
%}.
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2302
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2303
	aBlock value:(self at:aKey)
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2304
    ]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2305
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2306
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2307
keysAndValuesDo:aBlock
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2308
    "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
  2309
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2310
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2311
	aBlock value:aKey value:(self at:aKey)
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2312
    ]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2313
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2314
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2315
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2316
    |collected|
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2317
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2318
    collected := OrderedCollection new.
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2319
    self keysAndValuesDo:[:eachKey :eachValue |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2320
	(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2321
	    collected add:(collectBlockWith2Args value:eachKey value:eachValue)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2322
	].
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2323
    ].
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2324
    ^ collected
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2325
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2326
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2327
     Smalltalk
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2328
	keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2329
	thenCollect:[:nm :val | nm]
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2330
    "
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2331
!
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2332
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2333
keysDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2334
    "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
  2335
    |work|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2336
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2337
%{  /* 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
  2338
    __GLOBALKEYS_DO(&aBlock, &work);
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2339
    RETURN (self);
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2340
%}.
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2341
    self basicKeys do:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2342
	aBlock value:aKey
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2343
    ]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2344
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2345
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2346
!Smalltalk class methodsFor:'message control'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2347
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2348
silentLoading
12408
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2349
    "returns the Silentloading class variable, which globally controls if compilation
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2350
     messages are shown on the transcript during a fileIn."
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2351
10355
b1cb807fd03c Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents: 10329
diff changeset
  2352
     ^ SilentLoading ? false
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2353
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2354
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2355
silentLoading:aBoolean
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2356
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2357
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2358
    "allows access to the Silentloading class variable, which controls
12408
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2359
     messages (especially during fileIn) onto the transcript.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2360
     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
  2361
     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
  2362
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2363
    |prev|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2364
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2365
    prev := SilentLoading.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2366
    SilentLoading := aBoolean.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2367
    ^ prev
12409
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2368
!
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2369
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2370
silentlyLoadingDo:aBlock
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2371
    "evaluates aBlock with silent loading on - no compilation messages (except errors)
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2372
     are shown on the transcript"
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2373
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2374
    |sav|
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2375
20719
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  2376
    Smalltalk verbose ifTrue:[
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  2377
        aBlock value.
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  2378
        ^ self.
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  2379
    ].
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  2380
    
12409
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2381
    sav := SilentLoading.
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2382
    SilentLoading := true.
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2383
    aBlock ensure:[ SilentLoading := sav ].
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2384
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2385
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2386
!Smalltalk class methodsFor:'misc accessing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2387
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2388
beHeadless:aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2389
    "set/clear the headlessOperation flag."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2390
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2391
    HeadlessOperation := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2392
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2393
10231
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2394
beSTScript:aBoolean
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2395
    "set/clear the isSTScript flag."
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2396
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2397
    IsSTScript := aBoolean
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2398
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2399
    "Created: / 06-12-2006 / 16:43:36 / cg"
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2400
!
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2401
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2402
standAloneApp:aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2403
    "set/clear the StandAlone flag."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2404
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2405
    StandAlone := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2406
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2407
18197
d3430ee24e46 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17588
diff changeset
  2408
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2409
!Smalltalk class methodsFor:'private-system management-packages'!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2410
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2411
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2412
    "load a package referenced by aPackageString - a string like 'stx:libbasic'.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2413
     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
  2414
     Answer true, if the load succeeded, false if it failed"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2415
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2416
    |packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename 
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2417
     projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2418
     loadOK errorInInitialize|
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2419
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2420
    packageDirOrStringOrNil notNil ifTrue:[
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2421
        packageDirOrNil := packageDirOrStringOrNil asFilename.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2422
    ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2423
    silent := VerboseLoading not 
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2424
                and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2425
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2426
    "For now: have to read the project definition first!!
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2427
     The class library may contain subclasses of classes in prerequisite packages -
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2428
     so the prerequisite packages have to be loaded first.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2429
     Normally there is a project definiton, use that one to pull in the rest"
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2430
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2431
    "maybe, it is already in the image"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2432
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
19906
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2433
    projectDefinitionClass notNil ifTrue:[
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2434
        projectDefinitionClass checkForLoad.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2435
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2436
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2437
    "Is there a shared library (.dll or .so) ?"
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2438
    binaryClassLibraryFilename := ObjectFileLoader
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2439
                                    binaryClassFilenameForPackage:aPackageString
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2440
                                    inDirectory:packageDirOrNil.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2441
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2442
    (binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2443
        |loadErrorOccurred|
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2444
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2445
        loadErrorOccurred := false.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2446
        ObjectFileLoader objectFileLoadErrorNotification handle:[:ex |
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2447
            loadErrorOccurred := true.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2448
            ex proceedWith:true.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2449
        ] do:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2450
            loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2451
            "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2452
        ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2453
        (loadOK and:[loadErrorOccurred not]) ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2454
            "now, all compiled classes have been loaded.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2455
             keep classes in the package which are autoloaded as autoloaded."
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2456
            ^ true
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2457
        ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2458
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2459
        loadErrorOccurred ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2460
            self breakPoint:#cg.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2461
            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2462
            projectDefinitionClass notNil ifTrue:[
19907
eb0cff0b7f67 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19906
diff changeset
  2463
                projectDefinitionClass
eb0cff0b7f67 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19906
diff changeset
  2464
                    checkForLoad; 
eb0cff0b7f67 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19906
diff changeset
  2465
                    loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2466
            ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2467
        ].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2468
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2469
    packageDirOrNil isNil ifTrue:[
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2470
        ^ PackageNotFoundError raiseRequestWith:aPackageString.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2471
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2472
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2473
    "fallback - go through the project definition"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2474
    projectDefinitionClass isNil ifTrue:[
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2475
        projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2476
        "/ try to load the project definition class
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2477
        projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2478
        projectDefinitionFilename exists ifFalse:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2479
            projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2480
        ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2481
        projectDefinitionFilename exists ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2482
            Class withoutUpdatingChangesDo:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2483
                Smalltalk silentlyLoadingDo:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2484
                    Error handle:[:ex |
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2485
                        "/ catch error during initialization;
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2486
                        ex suspendedContext withAllSendersDo:[:sender |
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2487
                            (sender selector == #initialize 
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2488
                                and:[sender receiver isBehavior 
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2489
                                and:[sender receiver name = projectDefinitionClassName]]
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2490
                            ) ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2491
                                errorInInitialize := true
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2492
                            ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2493
                        ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2494
                        errorInInitialize ifFalse:[ ex reject ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2495
                    ] do:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2496
                        projectDefinitionFilename fileIn.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2497
                    ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2498
                ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2499
            ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2500
            errorInInitialize ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2501
                Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2502
            ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2503
            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2504
        ].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2505
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2506
    projectDefinitionClass notNil ifTrue:[
19906
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2507
        projectDefinitionClass
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2508
            autoload;
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2509
            checkForLoad;
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2510
            loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2511
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2512
        somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2513
        errorInInitialize ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2514
            Transcript showCR:('Smalltalk [info]: retrying #initialize').
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2515
            projectDefinitionClass initialize.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2516
        ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2517
        (silent not and:[somethingHasBeenLoaded]) ifTrue:[
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2518
            Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2519
        ].
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2520
        ^ true.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2521
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2522
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2523
    "/ source files-file loading no longer supported
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2524
    "/ however, allow for autoload-stub loaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2525
    doLoadAsAutoloaded ifTrue:[
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2526
        self
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2527
            recursiveInstallAutoloadedClassesFrom:packageDirOrNil
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2528
            rememberIn:Set new
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2529
            maxLevels:2
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2530
            noAutoload:false
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2531
            packageTop:packageDirOrNil
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2532
            showSplashInLevels:0.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2533
        ^ true
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2534
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2535
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2536
    ^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2537
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2538
    "
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2539
     Smalltalk loadPackageWithId:'stx:libbasic'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2540
     Smalltalk loadPackageWithId:'stx:goodies/persistency'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2541
     Smalltalk loadPackageWithId:'exept:ctypes'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2542
    "
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2543
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2544
    "Modified: / 29-07-2011 / 19:55:35 / cg"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2545
!
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2546
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2547
loadExtensionsForPackage:aPackageId
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2548
    | extensionsLoaded |
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2549
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2550
    extensionsLoaded := false.
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2551
    ProgrammingLanguage allDo:[:programmingLanguage|
19856
c1e41278b22e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19788
diff changeset
  2552
        "/ evaluating or here - want all extensions to be loaded    
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2553
        extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage)
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2554
    ].
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2555
    ^ extensionsLoaded
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2556
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2557
    "Modified: / 18-02-2007 / 11:03:26 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2558
    "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
  2559
    "Modified (format): / 04-09-2011 / 09:19:24 / cg"
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2560
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2561
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2562
loadExtensionsForPackage:aPackageId language: programmingLanguage
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  2563
    |mgr packageDirName inStream projectDefinition extensionsFilename mod dir
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2564
     extensionsRevisionString extensionsRevisionInfo|
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2565
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2566
    programmingLanguage supportsExtensionMethods ifFalse:[^false].
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2567
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2568
    packageDirName := aPackageId copyReplaceAll:$: with:$/.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2569
    packageDirName := self getPackageFileName:packageDirName.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2570
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2571
    (packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2572
        (self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2573
            ^ true.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2574
        ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2575
        packageDirName := nil.  "do not try again"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2576
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2577
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2578
    "
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2579
     if there is a sourceCodeManager, ask it first for the extensions
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2580
    "
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2581
    (Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2582
        mgr := AbstractSourceCodeManager managerForPackage: aPackageId
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2583
    ].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2584
    mgr notNil ifTrue:[
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2585
        extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2586
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2587
        projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2588
        projectDefinition notNil ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2589
            mod := aPackageId asPackageId module.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2590
            dir := aPackageId asPackageId directory.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2591
            extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2592
            extensionsRevisionString notNil ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2593
                extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2594
                extensionsRevisionInfo notNil ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2595
                    extensionsRevisionInfo fileName = extensionsFilename ifFalse:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2596
                        "JV@2011-10-23: following condition is never satisfied for
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2597
                         filed-in packages. The whole scheme of extensionVersion_XXX
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2598
                         works ONLY for compiled packages as it depends on fact, that
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2599
                         extension Init() routine is called AFTER all classes are inited,
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2600
                         therefore the extensionVersion_XXX methods from extensions.st
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2601
                         overwrites methods coming from package definition class. All this
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2602
                         is so tricky and error prone, that we have to come up with better
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2603
                         solution!!"
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2604
                        packageDirName notNil ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2605
                            ^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2606
                        ] ifFalse:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2607
                            ^ false
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2608
                        ]
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2609
                    ]
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2610
                ]
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2611
            ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2612
            SourceCodeManagerError handle:[:ex |
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2613
            ] do:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2614
                inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2615
            ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2616
        ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2617
        inStream isNil ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2618
            SourceCodeManagerError handle:[:ex |
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2619
            ] do:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2620
                inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2621
            ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2622
        ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2623
        inStream notNil ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2624
            Class withoutUpdatingChangeSetDo:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2625
                inStream fileIn.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2626
            ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2627
            inStream close.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2628
            VerboseLoading ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2629
                Transcript showCR:('loaded extensions for ',aPackageId,' from repository').
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2630
            ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2631
            ^ true
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2632
        ]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2633
    ].
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
    packageDirName notNil ifTrue:[
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2636
        ^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2637
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2638
    ^ false
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2639
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2640
    "Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2641
    "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
  2642
    "Modified: / 04-11-2011 / 13:41:29 / cg"
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2643
    "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
  2644
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2645
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2646
loadExtensionsFromDirectory:packageDirOrString
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2647
    | extensionsLoaded |
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2648
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2649
    extensionsLoaded := false.
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2650
    ProgrammingLanguage allDo:[:programmingLanguage|
19856
c1e41278b22e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19788
diff changeset
  2651
        "/ evaluating or here - want all extensions to be loaded    
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2652
        extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage)
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2653
    ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2654
    ^ extensionsLoaded
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2655
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2656
    "Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2657
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2658
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2659
loadExtensionsFromDirectory:packageDirOrString language: language
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2660
    |packageDir f|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2661
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2662
    packageDir := packageDirOrString asFilename.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2663
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2664
    f := packageDir / ('extensions.' , language sourceFileSuffix).
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2665
    f exists ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2666
	Class withoutUpdatingChangeSetDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2667
	    f fileIn.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2668
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2669
	VerboseLoading ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2670
	    Transcript showCR:('loaded extensions: ' , f pathName).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2671
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2672
	^ true
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2673
    ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2674
    ^ true"/false
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2675
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2676
    "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
  2677
    "Modified: / 04-11-2011 / 13:41:19 / cg"
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2678
    "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
  2679
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2680
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2681
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2682
    "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
  2683
     Return true on success, false otherwise."
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2684
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2685
    |packageId packageString packageDir def sourceCodeManager|
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2686
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2687
    packageString := aPackageStringArg.
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2688
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2689
    "/ a little convenience: so you can stx packages with loadPackage:'goodies/soap'
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2690
    (packageString includes:$:) ifFalse:[
19919
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2691
        packageString := 'stx:',packageString.
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2692
    ].
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2693
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2694
    "if I am here, so must my package"
14892
77c2f020de5d class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14890
diff changeset
  2695
    packageString = self package ifTrue:[^ true].
13129
0ac3f6a28aaf changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents: 13120
diff changeset
  2696
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2697
    packageId := aPackageStringArg asPackageId.
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2698
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2699
    "/ if there is a projectDefinition, let it load itself...
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2700
    def := packageId projectDefinitionClass.
14833
c718848b1051 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14810
diff changeset
  2701
    (def notNil and:[def isLoaded]) ifTrue:[
19919
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2702
        def loadAsAutoloaded:doLoadAsAutoloaded.
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2703
        ^ true.
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2704
    ].
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2705
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2706
    packageDir := self packageDirectoryForPackageId:packageId.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2707
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2708
    [
19919
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2709
        self
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2710
            loadPackage:packageString
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2711
            fromDirectory:packageDir
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2712
            asAutoloaded:doLoadAsAutoloaded.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2713
    ] on:PackageLoadError do:[:ex|
19919
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2714
        ex creator ~~ PackageNotCompatibleError ifTrue:[
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2715
            AbstractSourceCodeManager notNil ifTrue:[
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2716
                sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString.
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2717
                sourceCodeManager notNil ifTrue:[
21188
1d3c634717b6 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21109
diff changeset
  2718
                    PackageLoadError handle:[:ex2 |
1d3c634717b6 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21109
diff changeset
  2719
                        ex reject
1d3c634717b6 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21109
diff changeset
  2720
                    ] do:[    
1d3c634717b6 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21109
diff changeset
  2721
                        ^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded
1d3c634717b6 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21109
diff changeset
  2722
                    ].
19919
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2723
                ].
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2724
            ].
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2725
        ].
298d23c7785b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 19911
diff changeset
  2726
        ex reject.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2727
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2728
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2729
    ^ true
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2730
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2731
    "
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2732
     Smalltalk loadPackageWithId:'stx:libbasic'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2733
     Smalltalk loadPackageWithId:'stx:goodies/persistency'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2734
     Smalltalk loadPackageWithId:'exept:ctypes'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2735
    "
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2736
13129
0ac3f6a28aaf changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents: 13120
diff changeset
  2737
    "Modified: / 16-11-2010 / 17:42:49 / cg"
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2738
!
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2739
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2740
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2741
    "load all source files found in aDirectory and treat them like
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2742
     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
  2743
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2744
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2745
    |p t new anyFail repeatCount|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2746
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2747
    "/ problem: dependencies.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2748
    "/ solution: repeat twice, so that superclasses are present the second time
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2749
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2750
    Class packageQuerySignal answer:packageId asSymbol do:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2751
	|any|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2752
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2753
	repeatCount := 0.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2754
	[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2755
	    repeatCount := repeatCount + 1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2756
	    anyFail := false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2757
	    aDirectory directoryContents do:[:file |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2758
		|fn|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2759
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2760
		fn := aDirectory / file.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2761
		(fn hasSuffix:'st') ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2762
		    Metaclass confirmationQuerySignal answer:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2763
		    do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2764
			Error
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2765
			    handle:[:ex |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2766
				anyFail := true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2767
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2768
			    do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2769
				(self fileIn:fn) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2770
				    anyFail := true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2771
				] ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2772
				    any := true.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2773
				]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2774
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2775
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2776
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2777
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2778
	    any ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2779
		^ false "/ no file found
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2780
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2781
	] doWhile:[anyFail and:[repeatCount<2]].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2782
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2783
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2784
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2785
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2786
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2787
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2788
    p directory:aDirectory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2789
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2790
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2791
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2792
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2793
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2794
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2795
    new ifTrue:[Project addLoadedProject:p].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2796
    anyFail ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2797
	^ PackageLoadError raiseRequestWith:packageId.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2798
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2799
    ^ true
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2800
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2801
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2802
loadPackage:packageId fromClassLibrary:aFilename
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2803
    "load a package from a compiled classLib.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2804
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2805
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2806
    |p t new|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2807
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2808
    (self fileIn:aFilename) ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2809
	(self fileInClassLibrary:aFilename) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2810
	    ^ false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2811
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2812
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2813
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2814
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2815
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2816
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2817
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2818
    p directory:aFilename directory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2819
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2820
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2821
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2822
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2823
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2824
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2825
    new ifTrue:[Project addLoadedProject:p].
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2826
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2827
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2828
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2829
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2830
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2831
    "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
  2832
     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
  2833
     Answer true, if the load succeeded, false if it failed"
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2834
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2835
    |ret|
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2836
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2837
    PackageLoadInProgressQuery
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2838
	answerNotifyLoading:aPackageString asSymbol
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2839
	do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2840
	    ret := self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2841
	].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2842
    ^ ret
17350
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2843
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2844
    "
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2845
     Smalltalk loadPackage:'stx:goodies/communication'
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2846
    "
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2847
!
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2848
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2849
loadPackage:packageId fromLoadAllFile:aFilename
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2850
    <resource: #obsolete>
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2851
    "load a package from a loadAll - loader script.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2852
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2853
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2854
    |p t new|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2855
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2856
    Metaclass confirmationQuerySignal answer:false
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2857
    do:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2858
	(self fileIn:aFilename) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2859
	    self warn:'Failed to load the package ', packageId printString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2860
	    ^ false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2861
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2862
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2863
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2864
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2865
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2866
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2867
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2868
    p directory:aFilename directory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2869
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2870
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2871
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2872
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2873
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2874
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2875
    new ifTrue:[Project addLoadedProject:p].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2876
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2877
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2878
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2879
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2880
    "load a package from a .zip delivery file.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2881
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2882
19906
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2883
    PackageLoadError
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2884
        raiseWith:aPackageId
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2885
        errorString:' - package loading from zip is not yet implemented'.
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2886
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2887
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2888
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2889
    <resource: #obsolete>
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2890
    |abbrevFile packageDir|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2891
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2892
    packageDir := self packageDirectoryForPackageId:aPackageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2893
    packageDir isNil ifTrue:[^ false].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2894
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2895
    "/ abbrev.stc ?
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  2896
    abbrevFile := packageDir / 'abbrev.stc'.
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2897
    abbrevFile exists ifFalse:[^ false].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2898
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2899
    Smalltalk installAutoloadedClassesFrom:abbrevFile pathName.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2900
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2901
    doLoadAsAutoloaded ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2902
	"/ force autoloading...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2903
	Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2904
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2905
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2906
    self loadExtensionsFromDirectory:packageDir.
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  2907
    VerboseLoading ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2908
	Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageId , ' from abbrev file: ' , abbrevFile pathName).
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2909
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2910
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2911
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  2912
    "Modified: / 04-11-2011 / 13:43:29 / cg"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2913
! !
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2914
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2915
!Smalltalk class methodsFor:'queries'!
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
allClasses
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2918
    "return an unordered collection of all classes in the system.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2919
     Only globally anchored classes are returned
20122
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2920
     (i.e. anonymous ones have to be acquired by Behavior allSubInstances)"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2921
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2922
    |classes|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2923
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2924
    "/ 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
  2925
    "/ the reason is that if we modify the class hierarchy in
4067
732848627915 comment
Claus Gittinger <cg@exept.de>
parents: 4048
diff changeset
  2926
    "/ another view (background fileIn), while building up the
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2927
    "/ cachedClasses set, this may be flushed (invalidated) by the
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2928
    "/ other process in the meanwhile.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2929
    "/ If that happens, we restart the set-building here
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2930
    "/
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2931
    [(classes := CachedClasses) isNil] whileTrue:[
20122
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2932
        CachedClasses := classes := IdentitySet new:NumberOfClassesHint.
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2933
        self keysAndValuesDo:[:eachName :eachGlobal |
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2934
            (eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2935
                "/ sigh - would like to skip over aliases
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2936
                "/ but this cannot be done simply by comparing
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2937
                "/ the classes name against the store-key
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2938
                "/ i.e. cannot do:
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2939
                "/      anObject name == sym ifTrue:[
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2940
                "/          classes add:anObject
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2941
                "/      ]
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2942
                "/ because that would lead to ignore all java
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2943
                "/ classes, which are stored under a different
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2944
                "/ key.
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2945
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2946
                (eachGlobal name == eachName
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2947
                 or:[eachGlobal isJavaClass]) ifTrue:[
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2948
                    classes add:eachGlobal
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2949
                ].
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2950
            ]
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2951
        ].
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2952
        NumberOfClassesHint := classes size.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2953
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2954
    ^ classes
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2955
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2956
    "
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2957
     CachedClasses := nil.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2958
     Smalltalk allClasses
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2959
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2960
    to get the list sorted by name:
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2961
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2962
     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
  2963
    "
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  2964
13851
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  2965
    "Modified: / 06-12-2011 / 12:41:42 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2966
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2967
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2968
allClassesAndMetaclasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2969
    "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
  2970
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2971
    |classes|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2972
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2973
    classes := IdentitySet new:NumberOfClassesHint*2.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2974
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2975
	classes add:(eachClass theNonMetaclass).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2976
	classes add:(eachClass theMetaclass).
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2977
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2978
    ^ classes
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2979
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2980
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2981
allClassesWithAllPrivateClasses
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2982
    "return an unordered collection of all classes in the Smalltalk namespace.
10173
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  2983
     Only globally anchored classes are returned; Namespaces are not included.
20122
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2984
     (i.e. anonymous ones have to be acquired by Behavior allSubInstances)"
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2985
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2986
    ^ self allClasses select:[:aClass |
20122
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2987
            |owner|
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2988
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2989
            (aClass isRealNameSpace not)
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2990
            and:[
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2991
                owner := aClass topOwningClass.
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2992
                (owner ? aClass) nameSpace == Smalltalk
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  2993
            ]
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2994
      ]
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2995
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2996
    "
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2997
     Smalltalk allClassesWithAllPrivateClasses
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  2998
    "
10173
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  2999
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  3000
    "Modified: / 10-11-2006 / 17:24:00 / cg"
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3001
!
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3002
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3003
allExtensions
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3004
    "return a collection of all extension methods (methods added from another package)"
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3005
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3006
    |methods|
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3007
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3008
    methods := OrderedCollection new.
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3009
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3010
	|classPackage|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3011
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3012
	classPackage := eachClass package.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3013
	eachClass instAndClassMethodsDo:[:mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3014
	    mthd package ~= classPackage ifTrue:[ methods add:mthd ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3015
	].
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3016
    ].
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3017
    ^ methods
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3018
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3019
    "
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3020
     Smalltalk allExtensions
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3021
    "
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3022
!
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3023
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3024
allExtensionsForPackage:aProjectID
14890
37618c9121f2 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14833
diff changeset
  3025
    "return a collection of all extension methods for a given projectID"
37618c9121f2 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14833
diff changeset
  3026
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3027
    |methods|
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3028
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3029
    methods := OrderedCollection new.
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3030
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3031
	methods addAll:(eachClass extensionsFrom:aProjectID).
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3032
    ].
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3033
    ^ methods
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3034
!
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3035
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3036
allImplementorsOf:aSelector
12919
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  3037
    "return a collection of classes which implement the given selector"
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  3038
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3039
    |implementors|
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3040
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3041
    implementors := OrderedCollection new.
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3042
    self allImplementorsOf:aSelector do:[:cls | implementors add:cls].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3043
    ^ implementors
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3044
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3045
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3046
     Smalltalk allImplementorsOf:#isNil   
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3047
     (Smalltalk allImplementorsOf:#add:) size 
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3048
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3049
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3050
    "Modified: / 30-04-2016 / 17:37:39 / cg"
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3051
!
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3052
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3053
allImplementorsOf:aSelector do:aBlock
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3054
    "enumerate all classes which implement the given selector"
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3055
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3056
    self allClassesDo:[:cls |
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3057
        (cls includesSelector:aSelector) ifTrue:[
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3058
            aBlock value:cls.
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3059
        ].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3060
        (cls class includesSelector:aSelector) ifTrue:[
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3061
            aBlock value:cls class.
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3062
        ].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3063
    ].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3064
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3065
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3066
     Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls]
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3067
     Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls]
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3068
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3069
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3070
    "Created: / 30-04-2016 / 17:36:45 / cg"
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3071
!
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3072
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3073
allLoadedPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3074
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3075
    ^ self allPackageIdsIncludingUnloadedClasses: false
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3076
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3077
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3078
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3079
     Smalltalk allLoadedPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3080
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3081
!
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3082
12376
fm
parents: 12358
diff changeset
  3083
allLoadedProjectIDs
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3084
    <resource: #obsolete>
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3085
    self obsoleteMethodWarning:'use allLoadedPackageIDs'.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3086
    ^ self allPackageIdsIncludingUnloadedClasses: false
12376
fm
parents: 12358
diff changeset
  3087
fm
parents: 12358
diff changeset
  3088
fm
parents: 12358
diff changeset
  3089
    "
fm
parents: 12358
diff changeset
  3090
     Smalltalk allLoadedProjectIDs
fm
parents: 12358
diff changeset
  3091
    "
fm
parents: 12358
diff changeset
  3092
!
fm
parents: 12358
diff changeset
  3093
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3094
allPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3095
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3096
    ^ self allPackageIdsIncludingUnloadedClasses: true
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3097
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3098
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3099
     Smalltalk allPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3100
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3101
!
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3102
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3103
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3104
    "Returns all package ids.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3105
     Excludes packages coming from unloaded classes if includeUnloadedClasses is false.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3106
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3107
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3108
    |allProjects|
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3109
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3110
    allProjects := Set new.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3111
    self allClassesDo:[:eachClass |
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3112
        |cls pkg|
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3113
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3114
        eachClass isRealNameSpace ifFalse:[
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3115
            (includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3116
                cls := eachClass theNonMetaclass.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3117
                cls isPrivate ifTrue:[
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3118
                    cls := cls topOwningClass
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3119
                ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3120
                pkg := cls package.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3121
                pkg size > 0 ifTrue:[
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3122
                    allProjects add:pkg.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3123
                ] ifFalse:[
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3124
                    "/ for now, nameSpaces are not in any package;
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3125
                    "/ this might change. Then, 0-sized packages are
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3126
                    "/ illegal, and the following should be enabled.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3127
                    "/ self halt
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3128
                ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3129
                cls isJavaClass ifFalse:[
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3130
                    cls instAndClassSelectorsAndMethodsDo:[:sel :mthd |
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3131
                        allProjects add:mthd package asSymbol.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3132
                    ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3133
                ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3134
            ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3135
        ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3136
    ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3137
    allProjects := allProjects asOrderedCollection sort.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3138
    ^ allProjects
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3139
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3140
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3141
     Smalltalk allProjectsIdsIncludingUnloadedClasses: true
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3142
     Smalltalk allProjectsIdsIncludingUnloadedClasses: false
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3143
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3144
!
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3145
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3146
allProjectIDs
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3147
    <resource: #obsolete>
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3148
    self obsoleteMethodWarning:'use allPackageIDs'.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3149
    ^ self allPackageIDs
12376
fm
parents: 12358
diff changeset
  3150
fm
parents: 12358
diff changeset
  3151
    "
fm
parents: 12358
diff changeset
  3152
     Smalltalk allProjectIDs
fm
parents: 12358
diff changeset
  3153
    "
fm
parents: 12358
diff changeset
  3154
!
fm
parents: 12358
diff changeset
  3155
fm
parents: 12358
diff changeset
  3156
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3157
    <resource: #obsolete>
12376
fm
parents: 12358
diff changeset
  3158
    "Returns all projects ids.
fm
parents: 12358
diff changeset
  3159
     Excludes projects coming from unloaded classes if includeUnloadedClasses is false.
fm
parents: 12358
diff changeset
  3160
    "
fm
parents: 12358
diff changeset
  3161
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3162
    self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3163
    ^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3164
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3165
    "
12376
fm
parents: 12358
diff changeset
  3166
     Smalltalk allProjectsIdsIncludingUnloadedClasses: true
fm
parents: 12358
diff changeset
  3167
     Smalltalk allProjectsIdsIncludingUnloadedClasses: false
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3168
    "
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3169
!
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3170
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3171
cellAt:aName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3172
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3173
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3174
    "return the address of a global cell
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3175
     - used internally for compiler only"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3176
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3177
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3178
    RETURN ( __GLOBAL_GETCELL(aName) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3179
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3180
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3181
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3182
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3183
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3184
classCategoryCompletion:aPartialCategory
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3185
    "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
  3186
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3187
		2nd: collection consisting of matching categories"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3188
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3189
    ^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3190
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3191
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3192
     Smalltalk classCategoryCompletion:'Sys'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3193
     Smalltalk classCategoryCompletion:'System'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3194
     Smalltalk classCategoryCompletion:'System-BinaryStorage'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3195
    "
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3196
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3197
    "Modified: / 10-08-2006 / 13:06:34 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3198
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3199
8570
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  3200
classNamed:aString
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  3201
    "return the class with name aString, or nil if absent.
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  3202
     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
  3203
     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
  3204
     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
  3205
     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
  3206
10127
70e1b66ceae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10126
diff changeset
  3207
    |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
  3208
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3209
    "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
  3210
     But be careful, to not invent new symbols ..."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3211
    sym := aString asSymbolIfInterned.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3212
    sym notNil ifTrue:[
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3213
        cls := self at:sym ifAbsent:nil.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3214
        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
  3215
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3216
1480
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  3217
    (aString endsWith:' class') ifTrue:[
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3218
        nonMeta := self classNamed:(aString copyButLast:6).
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3219
        nonMeta notNil ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3220
            ^ nonMeta theMetaclass
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3221
        ].
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3222
        ^ nil.
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3223
    ].
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3224
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3225
    "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
  3226
    cls isNil ifTrue:[
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3227
        idx := aString indexOfSubCollection:'::'.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3228
        idx ~~ 0 ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3229
            prefix := aString copyTo:idx-1.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3230
            nsNameSymbol := prefix asSymbolIfInterned.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3231
            nsNameSymbol notNil ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3232
                rest := aString copyFrom:idx+2.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3233
                namespace := self at:prefix asSymbolIfInterned ifAbsent:nil.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3234
                "namespace may be the owner of a private class.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3235
                 NameSpaces and Behaviors have the same protocol"
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3236
                [namespace isBehavior] whileTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3237
                    idx := rest indexOfSubCollection:'::'.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3238
                    idx ~~ 0 ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3239
                        prefix := rest copyTo:idx-1.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3240
                        rest := rest copyFrom:idx+2.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3241
                        "this does an implicit autoload if required"
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3242
                        namespace := namespace privateClassesAt:prefix.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3243
                    ] ifFalse:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3244
                        namespace isLoaded ifTrue:[
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3245
                            cls := namespace privateClassesAt:rest.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3246
                            cls isBehavior ifTrue:[^ cls].
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3247
                        ].
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3248
                        namespace := nil.   "force exit of loop"
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3249
                    ].
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3250
                ].
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3251
            ].
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  3252
        ].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3253
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3254
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3255
    ^ nil
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3256
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3257
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3258
     Smalltalk classNamed:'Object'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3259
     Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3260
     Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3261
     Smalltalk classNamed:'Authentication::BasicAuthenticator'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3262
     Smalltalk classNamed:'fooBar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3263
     Smalltalk classNamed:'true'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3264
     Smalltalk classNamed:'Object class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3265
     Smalltalk classNamed:'Metaclass'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3266
     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
  3267
     Smalltalk classNamed:'Array class'
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3268
    "
644
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3269
9468
2472391c602c bumped revision
Claus Gittinger <cg@exept.de>
parents: 9377
diff changeset
  3270
    "Created: / 24-11-1995 / 17:30:22 / cg"
2472391c602c bumped revision
Claus Gittinger <cg@exept.de>
parents: 9377
diff changeset
  3271
    "Modified: / 19-06-1996 / 14:22:21 / stefan"
10127
70e1b66ceae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10126
diff changeset
  3272
    "Modified: / 23-10-2006 / 18:06:53 / cg"
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3273
    "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
  3274
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3275
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3276
classNames
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3277
    "return a collection of all classNames in the system"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3278
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3279
    ^ self allClasses collect:[:aClass | aClass name]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3280
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3281
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3282
     Smalltalk classNames
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3283
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3284
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3285
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3286
classnameCompletion:aPartialClassName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3287
    "given a partial classname, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3288
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3289
		2nd: collection consisting of matching names"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3290
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3291
    ^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3292
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3293
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3294
classnameCompletion:aPartialClassName inEnvironment:anEnvironment
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3295
    "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
  3296
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3297
		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
  3298
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3299
    ^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3300
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3301
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3302
     Smalltalk classnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3303
     Smalltalk classnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3304
     Smalltalk classnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3305
     Smalltalk classnameCompletion:'*rray'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3306
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3307
     Smalltalk classnameCompletion:'Arr cl'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3308
     Smalltalk classnameCompletion:'*rray cl'
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3309
    "
644
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3310
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3311
    "Created: 24.11.1995 / 17:24:45 / cg"
2523
04db1fd74e0d try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  3312
    "Modified: 3.4.1997 / 18:25:01 / cg"
8583
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
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3315
defaultNameSpace
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3316
    "return the default namespace, where new classes are installed,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3317
     if NO special nameSpace handler is present"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3318
9562
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3319
    ^ Project defaultNameSpace.
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3320
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3321
    "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
  3322
    "Modified: / 17-08-2006 / 14:01:22 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3323
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3324
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3325
globalNameCompletion:aPartialGlobalName
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3326
    "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
  3327
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3328
		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
  3329
12614
b8fca618dcb6 changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents: 12613
diff changeset
  3330
    ^ 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
  3331
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3332
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3333
     Smalltalk globalnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3334
     Smalltalk globalnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3335
     Smalltalk globalnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3336
     Smalltalk globalnameCompletion:'*rray'
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3337
    "
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3338
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3339
    "Created: / 24-11-1995 / 17:24:45 / cg"
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3340
    "Modified: / 10-08-2006 / 13:05:39 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3341
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3342
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3343
globalnameCompletion:aPartialGlobalName
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3344
    "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
  3345
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3346
		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
  3347
8358
0afa3ee38c37 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 8317
diff changeset
  3348
    <resource:#obsolete>
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3349
    self obsoleteMethodWarning:'use #globalNameCompletion:'.
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3350
    ^ 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
  3351
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3352
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3353
     Smalltalk globalnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3354
     Smalltalk globalnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3355
     Smalltalk globalnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3356
     Smalltalk globalnameCompletion:'*rray'
5736
d625e5505254 globalNamecompletion
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
  3357
    "
d625e5505254 globalNamecompletion
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
  3358
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3359
    "Created: / 24-11-1995 / 17:24:45 / cg"
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3360
    "Modified: / 10-08-2006 / 13:05:48 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3361
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3362
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  3363
hasClassNamed:aString
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  3364
    Symbol
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3365
	hasInterned:aString
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3366
	ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ].
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3367
    ^ false
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3368
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3369
    "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
  3370
    "Modified: / 20-08-2011 / 16:41:31 / cg"
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3371
!
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3372
9290
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3373
hasNameSpaces
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3374
    "can be redefined by dummy namespaces/environments, to suppress
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3375
     the namespace display in a browser (PocketSmalltalk)"
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3376
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3377
    ^ true
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3378
!
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3379
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3380
hasNamespaces
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3381
    "can be redefined by dummy namespaces/environments, to suppress
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3382
     the namespace display in a browser (PocketSmalltalk)"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3383
9290
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3384
    <resource:#obsolete>
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3385
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3386
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3387
10432
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3388
hasSelectorNameSpaces
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3389
    "for now return false
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  3390
     Selector namespaces are being implemented and supported by the VM,
10432
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3391
     but not yet fully supported by all tools...
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3392
     Therefore, for now, do not generate code which uses this feature."
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3393
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3394
    ^ false
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3395
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3396
    "Created: / 05-03-2007 / 13:26:28 / cg"
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3397
!
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3398
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3399
includes:something
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3400
    "this should come from Collection.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3401
     will change the inheritance - Smalltalk is actually a collection"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3402
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3403
    self do:[:element | element = something ifTrue:[^ true]].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3404
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3405
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3406
14987
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3407
includesIdentical:something
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3408
    "this should come from Collection.
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3409
     will change the inheritance - Smalltalk is actually a collection"
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3410
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3411
    self do:[:element | element == something ifTrue:[^ true]].
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3412
    ^ false
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3413
!
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3414
10041
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3415
isBrowserStartable
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3416
    ^ false.
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3417
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3418
    "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
  3419
!
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3420
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3421
isNameSpace
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3422
    "return true, if the receiver is a nameSpace."
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3423
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3424
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3425
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3426
    "Created: 11.10.1996 / 18:10:43 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3427
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3428
10169
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3429
isRealNameSpace
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3430
    "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
  3431
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3432
    ^ false
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3433
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3434
    "Created: / 10-11-2006 / 17:02:19 / cg"
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3435
!
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3436
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3437
isTopLevelNameSpace
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3438
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3439
!
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3440
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3441
isTopLevelNamespace
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3442
    "obsolete - use isTopLevelNameSpace"
5365
95c615a40176 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5363
diff changeset
  3443
7432
155245708ca3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7430
diff changeset
  3444
    <resource:#obsolete>
155245708ca3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7430
diff changeset
  3445
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3446
    self obsoleteMethodWarning:'use #isTopLevelNameSpace'.
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3447
    ^ true
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3448
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3449
    "Created: 11.10.1996 / 18:10:43 / cg"
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3450
!
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3451
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3452
keyIsClassVariableNameKey:aKey
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3453
    |i|
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3454
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3455
    i := aKey lastIndexOf:$:.
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3456
    i ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3457
	i > 1 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3458
	    (aKey at:(i-1)) == $: ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3459
		^ true.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3460
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3461
	].
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3462
    ].
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3463
    ^ false.
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3464
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3465
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3466
     self keyIsClassVariableNameKey:'foo::bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3467
     self keyIsClassVariableNameKey:'foo:bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3468
     self keyIsClassVariableNameKey:':bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3469
     self keyIsClassVariableNameKey:'::bar'
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3470
    "
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3471
!
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3472
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3473
loadedClassNamed:aString
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3474
    "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
  3475
     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
  3476
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3477
    |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
  3478
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3479
    "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
  3480
     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
  3481
    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
  3482
    sym notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3483
	cls := self at:sym ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3484
	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
  3485
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3486
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3487
    (aString endsWith:' class') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3488
	nonMeta := self loadedClassNamed:(aString copyButLast:6).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3489
	nonMeta notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3490
	    ^ nonMeta theMetaclass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3491
	].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3492
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3493
    ^ nil
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3494
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3495
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3496
     Smalltalk loadedClassNamed:'Object'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3497
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3498
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3499
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3500
     Smalltalk loadedClassNamed:'fooBar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3501
     Smalltalk loadedClassNamed:'true'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3502
     Smalltalk loadedClassNamed:'Object class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3503
     Smalltalk loadedClassNamed:'Metaclass'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3504
     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
  3505
     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
  3506
    "
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3507
!
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3508
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3509
methodProtocolCompletion:aPartialProtocolName
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3510
    "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
  3511
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3512
		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
  3513
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3514
    ^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3515
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3516
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3517
     Smalltalk methodProtocolCompletion:'doc'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3518
     Smalltalk methodProtocolCompletion:'docu'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3519
     Smalltalk methodProtocolCompletion:'documenta'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3520
    "
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3521
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3522
    "Modified: / 10-08-2006 / 13:05:20 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3523
!
5505
e99e8e9cbfef added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  3524
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3525
numberOfGlobals
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3526
    "return the number of global variables in the system"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3527
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3528
    |tally "{ Class: SmallInteger }" |
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3529
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3530
    tally := 0.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3531
    self do:[:obj | tally := tally + 1].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3532
    ^ tally
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3533
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3534
    "Smalltalk numberOfGlobals"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3535
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3536
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3537
referencesAny:aCollection
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3538
    "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
  3539
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3540
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3541
	aCollection do:[:anObject |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3542
	    (key == anObject) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3543
	    (val == anObject ) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3544
	]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3545
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3546
    ^ super referencesAny:aCollection
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3547
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3548
    "Created: / 2.2.1998 / 16:01:20 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3549
!
3260
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3550
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3551
referencesDerivedInstanceOf:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3552
    "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
  3553
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3554
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3555
	(key isKindOf:aClass) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3556
	(val isKindOf:aClass) ifTrue:[^ true].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3557
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3558
    ^ super referencesDerivedInstanceOf:aClass
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3559
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3560
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3561
referencesInstanceOf:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3562
    "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
  3563
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3564
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3565
	(key isMemberOf:aClass) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3566
	(val isMemberOf:aClass) ifTrue:[^ true].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3567
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3568
    ^ super referencesInstanceOf:aClass
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3569
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3570
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3571
referencesObject:anObject
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3572
    "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
  3573
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3574
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3575
	(key == anObject) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3576
	(val == anObject ) ifTrue:[^ true].
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3577
    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3578
    ^ super referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3579
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3580
    "Modified: / 3.2.1998 / 14:22:46 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3581
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3582
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3583
resolveName:aName inClass:aClass
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3584
    "resolve aName as if compiled within aClass;
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3585
     i.e. if it has a private class with this name, return it;
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3586
     if aName is known within the classes namespace, return that.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3587
     Otherwise, return a global with that name.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3588
     This should be used whereever Smalltalk>>at: used to be used,
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3589
     to resolve a global by name."
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3590
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3591
    |nameUsed sym cls ns|
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3592
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3593
    aName isNil ifTrue:[^ nil].
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3594
    aName isBehavior ifTrue:[^ aName].       "/ already resolved
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3595
    nameUsed := aName.
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3596
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3597
    (nameUsed startsWith:'Smalltalk::') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3598
	nameUsed := nameUsed copyFrom:12.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3599
	^ self at:(nameUsed asSymbol) ifAbsent:nil.
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3600
    ].
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3601
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3602
    sym := nameUsed asSymbol.
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3603
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3604
    cls := aClass privateClassesAt:sym.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3605
    cls notNil ifTrue:[^ cls].
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3606
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3607
    ns := aClass nameSpace.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3608
    (ns notNil and:[ns ~~ Smalltalk]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3609
	ns isNameSpace ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3610
	    cls := ns at:sym ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3611
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3612
	    cls := ns privateClassesAt:sym
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3613
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3614
	cls notNil ifTrue:[^ cls].
3025
53b114d5be3e added #resolveClassNamed:
ca
parents: 3022
diff changeset
  3615
    ].
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3616
    ^ self at:sym ifAbsent:nil.
4356
54d1f0b81638 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4355
diff changeset
  3617
54d1f0b81638 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4355
diff changeset
  3618
    "Modified: / 9.7.1999 / 01:18:07 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3619
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3620
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3621
selectorCompletion:aPartialSymbolName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3622
    "given a partial selector, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3623
     2 entries: 1st: the longest match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3624
		2nd: collection consisting of matching implemented selectors"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3625
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3626
    ^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3627
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3628
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3629
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3630
    "given a partial selector, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3631
     2 entries: 1st: the longest match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3632
		2nd: collection consisting of matching implemented selectors"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3633
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3634
    ^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3635
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3636
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3637
     Smalltalk selectorCompletion:'at:p'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3638
     Smalltalk selectorCompletion:'nextP'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3639
     Smalltalk selectorCompletion:'nextp'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3640
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3641
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3642
    "Modified: / 7.6.1996 / 08:44:33 / stefan"
3565
966a108e3765 also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents: 3560
diff changeset
  3643
    "Modified: / 14.6.1998 / 15:54:03 / cg"
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3644
!
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3645
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3646
someImplementorOf:aSelector
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3647
    "return any class, which implement the given selector. Nil if there is none.
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3648
     (useful to search, if there is one at all)"
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3649
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3650
    self allImplementorsOf:aSelector do:[:cls | ^ cls].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3651
    ^ nil.
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3652
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3653
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3654
     Smalltalk someImplementorOf:#isNil
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3655
     Smalltalk someImplementorOf:#add:
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3656
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3657
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3658
    "Created: / 30-04-2016 / 17:39:19 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3659
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3660
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3661
!Smalltalk class methodsFor:'queries-system'!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3662
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3663
isAmber
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3664
    "is this an Amber Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3665
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3666
     applications - add #isAmber to your Amber Smalltalk,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3667
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3668
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3669
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3670
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3671
    "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
  3672
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3673
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3674
isDolphinSmalltalk
16803
bd94b8eacd88 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16764
diff changeset
  3675
    "is this a Dolphin Smalltalk system ?
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3676
     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
  3677
     applications - add #isDolphinSmalltalk to your dolphin,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3678
     returning true there."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3679
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3680
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3681
!
4970
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3682
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3683
isGemStone
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3684
    "is this a GemStone Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3685
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3686
     applications - add #isGemStone to your GemStone/S,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3687
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3688
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3689
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3690
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3691
    "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
  3692
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3693
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3694
isPharo
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3695
    "is this a Pharo Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3696
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3697
     applications - add #isPharo to your Pharo,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3698
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3699
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3700
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3701
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3702
    "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
  3703
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3704
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3705
isSmalltalkMT
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3706
    "is this a Smalltalk-MT system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3707
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3708
     applications - add #isSmalltalkMT to your smalltalk-MT,
4970
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3709
     returning true there."
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3710
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3711
    ^ false
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3712
!
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3713
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3714
isSmalltalkV
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3715
    "is this a Smalltalk/V system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3716
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3717
     applications - add #isSmalltalkV to your smalltalkV,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3718
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3719
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3720
    ^ false
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3721
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3722
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3723
isSmalltalkX
16803
bd94b8eacd88 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16764
diff changeset
  3724
    "is this a Smalltalk/X system ?
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3725
     Return true here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3726
     applications - add #isSmalltalkX to your other smalltalks,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3727
     returning false there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3728
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3729
    ^ true
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3730
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3731
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3732
isSqueak
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3733
    "is this a SqueakSmalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3734
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3735
     applications - add #isSqueak to your squeak,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3736
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3737
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3738
    ^ false
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3739
!
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3740
16013
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3741
isSqueakLike
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3742
    "is this a Squeak, Pharo, Cuis or similar Smalltalk system ?
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3743
     Return false here - this may be useful to write portable
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3744
     applications - add #isSqueakLike to your squeak, pharo,...
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3745
     returning true there."
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3746
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3747
    ^ false
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3748
!
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3749
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3750
isVisualAge
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3751
    "is this a VisualAge Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3752
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3753
     applications - add #isVisualAge to your visualAge,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3754
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3755
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3756
    ^ false
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3757
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3758
17369
d50c90bc1a91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17350
diff changeset
  3759
isVisualSmalltalkEnterprise
16843
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3760
    "is this a VSE Smalltalk system ?
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3761
     Return false here - this may be useful to write portable
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3762
     applications - add #isVisualSmallalkEnterprise to your VSE,
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3763
     returning true there."
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3764
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3765
    ^ false
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3766
!
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3767
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3768
isVisualWorks
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3769
    "is this a VisualWorks Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3770
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3771
     applications - add #isVisualWorks to your visualWorks,
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3772
     returning true there."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3773
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3774
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3775
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3776
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3777
!Smalltalk class methodsFor:'startup'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3778
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3779
browserWindowStartup
13056
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3780
    "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
  3781
     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
  3782
     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
  3783
     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
  3784
     multiwindow application.
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3785
     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
  3786
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3787
    |windowIDString numericWindowID windowID params idx process|
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3788
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3789
    idx := CommandLineArguments indexOf:'--browserWindow:'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3790
    windowIDString := CommandLineArguments at:idx+1.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3791
    numericWindowID := Integer fromString:windowIDString.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3792
    windowID := ExternalAddress newAddress:numericWindowID.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3793
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3794
    idx := CommandLineArguments indexOf:'--browserParameters:'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3795
    idx ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3796
	params := Dictionary new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3797
	(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3798
	    params at:key put:value.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3799
	].
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3800
    ].
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3801
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3802
    'browserWindow is: ' errorPrint. windowID errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3803
    'browserParameters are: ' errorPrint. params errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3804
    'Display is: ' errorPrint. Display errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3805
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3806
    process := [
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3807
	PluginSupport
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3808
	    startInBrowserWithWindowID:windowID
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3809
	    parameters:params.
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3810
    ] newProcess.
9043
e6106f500263 do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents: 9036
diff changeset
  3811
    process priority:(Processor userSchedulingPriority).
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3812
    process name:'browser start handler'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3813
    process beGroupLeader.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3814
    process resume.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3815
    process := nil.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3816
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3817
    Processor dispatchLoop.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3818
    Smalltalk exit.
13056
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3819
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3820
    "Modified: / 11-09-2010 / 14:06:59 / cg"
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3821
!
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3822
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3823
defineCommandLineAsWorkspaceVariablesForScripts
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3824
    "/ enable this, so we can provide _$1.._$n in the script
20858
ffcbac4dd7ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20857
diff changeset
  3825
    ParserFlags allowUnderscoreInIdentifier:true.
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3826
    ParserFlags allowDollarInIdentifier:true.
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3827
    ParserFlags warnDollarInIdentifier:false.
20858
ffcbac4dd7ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20857
diff changeset
  3828
    ParserFlags warnUnderscoreInIdentifier:false.
20859
b4091df11596 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20858
diff changeset
  3829
    ParserFlags allowOldStyleAssignment:false.
b4091df11596 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20858
diff changeset
  3830
    
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3831
    "/ add bindings for arguments
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3832
    Workspace workspaceVariableAt:('_$0') put:CommandName.
20857
e13cdc7188f1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20856
diff changeset
  3833
    Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size.
20860
216e672e8d44 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20859
diff changeset
  3834
    Workspace workspaceVariableAt:('_$$') put:CommandLineArguments.
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3835
    CommandLineArguments doWithIndex:[:arg :i |
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3836
        Workspace workspaceVariableAt:('_$',i printString) put:arg.
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3837
    ].
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3838
!
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3839
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3840
displayInitializationDone
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3841
    "inform the restart, that the display has been initialized"
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3842
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3843
    CallbackSignal raiseRequest.
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3844
!
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3845
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3846
executeStartBlocks
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3847
    |startBlocks|
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3848
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3849
    startBlocks := self startBlocks.
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3850
    startBlocks notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3851
	'Smalltalk [info]: execute startBlocks...' infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3852
	startBlocks do:[:aBlock|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3853
	    Error handle:[:ex |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3854
		InfoPrinting == true ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3855
		    'Smalltalk [warning]: error caught in startBlock: ' infoPrint.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3856
		    ex description infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3857
		    ex infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3858
		    thisContext fullPrintAll.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3859
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3860
	    ] do: aBlock
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3861
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3862
	startBlocks removeAll.
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3863
    ].
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3864
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3865
    "Created: / 07-01-2012 / 12:58:39 / cg"
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3866
!
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  3867
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3868
hideSplashWindow
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3869
%{
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3870
#ifdef WIN32
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3871
    extern void __win32_hideSplashScreen();
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3872
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3873
    __win32_hideSplashScreen();
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3874
#endif
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3875
%}
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3876
!
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  3877
20720
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3878
lateOpenDisplay
20737
cbaefc448648 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20720
diff changeset
  3879
    "this is called when a view is opened without a display being already opened."
20720
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3880
    
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3881
    Smalltalk openDisplay.
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3882
    Display notNil ifTrue:[ 
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  3883
        IsRepl ifFalse:[
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  3884
            Display exitOnLastClose:true.
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  3885
        ].
20827
efb00b398fc8 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20811
diff changeset
  3886
        "/ Processor exitWhenNoMoreUserProcesses:true.
20720
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3887
    ].            
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3888
!
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  3889
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3890
mainStartup:graphicalMode
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3891
    "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
  3892
     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
  3893
9012
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  3894
    |process imageName thisIsARestart idx|
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3895
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3896
    imageName := ObjectMemory imageName.
2249
cdb6c87f0707 send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
  3897
    thisIsARestart := imageName notNil.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3898
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3899
    true "graphicalMode" ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3900
        Display isNil ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3901
            (StartupClass notNil
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3902
            and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3903
                self openDisplay.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3904
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3905
        ].
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  3906
    ].
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  3907
10645
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  3908
    StandAlone ifFalse:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3909
        "
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3910
         enable the graphical debugger/inspector
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3911
         (they could have been (re)defined as autoloaded in the patches file)
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3912
        "
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3913
        self initStandardTools.
10645
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  3914
    ].
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  3915
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3916
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3917
     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
  3918
    "
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3919
    Display notNil ifTrue:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3920
        Display deviceIOTimeoutErrorSignal handlerBlock:[:ex |
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3921
            SaveEmergencyImage == true ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3922
                'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3923
                ObjectMemory primSnapShotOn:'crash.img'.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3924
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3925
            'Display [warning]: broken display connection - exit.' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3926
            self exit:11.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3927
        ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3928
        Display startDispatch.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3929
    ].
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3930
9016
2979527dbdf4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9015
diff changeset
  3931
    idx := CommandLineArguments indexOf:'--browserWindow:'.
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  3932
    IsPlugin := (idx ~~ 0).
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  3933
    IsPlugin ifTrue:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3934
        'Smalltalk [info]: startup browser window...' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3935
        self browserWindowStartup.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3936
        "/ not reached
9012
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  3937
    ].
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  3938
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3939
    Initializing := false.
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  3940
2074
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  3941
    "/ 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
  3942
    "/ 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
  3943
    "/ 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
  3944
    "/ 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
  3945
7043
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3946
    process := [
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3947
        'Smalltalk [info]: startup process 1 active.' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3948
        StartBlocks notNil ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3949
            self executeStartBlocks.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3950
            StartBlocks := nil.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3951
        ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3952
        ImageStartBlocks notNil ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3953
            'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3954
            ImageStartBlocks do:[:aBlock|
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3955
                aBlock value
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3956
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3957
        ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3958
        StandAlone ifFalse:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3959
            (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false"
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3960
                thisIsARestart ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3961
                    Transcript cr.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3962
                    Transcript showCR:('Smalltalk restarted from:'
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3963
                                        , imageName
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3964
                                        , ' (saved '
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3965
                                        , ObjectMemory imageSaveTime printString
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3966
                                        , ')' ).
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3967
                ] ifFalse:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3968
                    Transcript showCR:(self hello).
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3969
                    Transcript showCR:(self copyrightString).
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3970
                ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3971
                Transcript cr.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3972
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3973
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3974
            DemoMode==true ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3975
                Transcript showCR:'*** Restricted use:                              ***'.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3976
                Transcript showCR:'*** This program may be used for education only. ***'.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3977
                Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE  ***'.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3978
                Transcript showCR:'*** for more details.                            ***'.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3979
                Transcript cr.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3980
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3981
        ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3982
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3983
        thisIsARestart ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3984
            "/
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3985
            "/ the final late notification - users can now assume that
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3986
            "/ views, forms etc. have been recreated.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3987
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3988
            ObjectMemory changed:#returnFromSnapshot.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  3989
        ]
7039
6f1c02381145 Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents: 7000
diff changeset
  3990
7040
d24ef75bc6c3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7039
diff changeset
  3991
    ] newProcess.
d24ef75bc6c3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7039
diff changeset
  3992
9043
e6106f500263 do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents: 9036
diff changeset
  3993
    process priority:(Processor userSchedulingPriority).
7043
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3994
    process name:'start block handler'.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3995
    process beGroupLeader.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3996
    process resume.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  3997
    process := nil.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
  3998
10139
a3f6265978ad Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents: 10131
diff changeset
  3999
    ObjectMemory startBackgroundCollectorAt:5.
a3f6265978ad Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents: 10131
diff changeset
  4000
    ObjectMemory startBackgroundFinalizationAt:5.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
  4001
2074
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4002
    "/ 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
  4003
    "/ message.
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4004
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4005
    (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4006
        "
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4007
         allow more customization by reading an image specific rc-file
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4008
        "
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4009
        thisIsARestart ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4010
            (imageName asFilename hasSuffix:'img') ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4011
                imageName := imageName copyButLast:4
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4012
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4013
            self fileIn:(imageName , '.rc')
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4014
        ].
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4015
20746
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4016
        Display notNil ifTrue:[
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4017
            Display exitOnLastClose:true.
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4018
        ].
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4019
        Processor exitWhenNoMoreUserProcesses:true.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4020
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4021
        process := [
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4022
            'Smalltalk [info]: startup process 2 active.' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4023
            StandAlone ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4024
                AbortOperationRequest handle:[:ex |
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4025
                    'Smalltalk [info]: aborted - exit.' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4026
                    OperatingSystem exit:1
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4027
                ] do:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4028
                    ('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4029
                    StartupClass perform:StartupSelector withArguments:StartupArguments.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4030
                ]
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4031
            ] ifFalse:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4032
                ('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4033
                StartupClass perform:StartupSelector withArguments:StartupArguments.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4034
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4035
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4036
            "/
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4037
            "/ non-GUI apps exit after the startup;
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4038
            "/ assume that GUI apps have created & opened some view ...
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4039
            "/
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4040
            Display isNil ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4041
                'Smalltalk [info]: no Display - exit.' infoPrintCR.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4042
                Smalltalk exit:11.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4043
            ].
16666
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4044
"/            "/
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4045
"/            "/ GUI apps exit after the last user process has finished
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4046
"/            "/
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4047
"/            Display exitOnLastClose:true.
20746
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4048
            Processor exitWhenNoMoreUserProcesses:true.
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4049
        ] newProcess.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4050
        process priority:(Processor userSchedulingPriority).
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4051
        process name:'main'.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4052
        process beGroupLeader.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4053
        process resume.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4054
        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
  4055
    ].
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4056
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4057
    StandAlone ifTrue:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4058
        Display notNil ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4059
            FlyByHelp notNil ifTrue:[
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4060
                FlyByHelp start
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4061
            ].
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4062
        ].
16211
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  4063
    ].
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  4064
20746
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4065
"/    Display notNil ifTrue:[
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4066
"/        Display exitOnLastClose:true.
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4067
"/    ].
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4068
    "
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4069
     if view-classes exist, start dispatching;
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4070
     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
  4071
    "
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4072
    ((Display notNil and:[graphicalMode])
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4073
     or:[process notNil
13851
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  4074
     or:[HeadlessOperation
20827
efb00b398fc8 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20811
diff changeset
  4075
     or:[StandAlone]]]
efb00b398fc8 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20811
diff changeset
  4076
    ) ifTrue:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4077
        Processor exitWhenNoMoreUserProcesses:true.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4078
        Processor dispatchLoop.
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4079
        "done - the last process finished"
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4080
        '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
  4081
    ] ifFalse:[
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4082
        StandAlone ifFalse:[
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4083
            self readEvalPrintLoop
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4084
        ]
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4085
    ].
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4086
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4087
    self exit
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4088
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4089
    "Created: / 18-07-1996 / 21:07:39 / cg"
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4090
    "Modified: / 09-09-1996 / 17:42:50 / stefan"
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4091
    "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
  4092
!
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4093
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4094
openDisplay
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4095
    "try to open a display connection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4096
     If so, also read display- and keyboard.rc"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4097
13385
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4098
    |commandName|
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4099
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4100
    commandName := Smalltalk commandName.
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4101
    (commandName, ' [info]: opening display...') infoPrintCR.
10649
82b327ec636d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10646
diff changeset
  4102
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4103
    Display isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4104
	Screen notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4105
	    [
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4106
		Screen openDefaultDisplay:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4107
	    ] on:Screen deviceOpenErrorSignal do:[:ex|
19984
584c3db7e691 *** empty log message ***
sr
parents: 19974
diff changeset
  4108
                "do not use #errorPrintCR, it is no error, when an app supports display and no display.
584c3db7e691 *** empty log message ***
sr
parents: 19974
diff changeset
  4109
                 in case shell exec 'app --version' we do not want this error string as part of the output"
584c3db7e691 *** empty log message ***
sr
parents: 19974
diff changeset
  4110
                ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR.
584c3db7e691 *** empty log message ***
sr
parents: 19974
diff changeset
  4111
"/                ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) errorPrintCR.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4112
		(commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4113
		(commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4114
		HeadlessOperation == true ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4115
		    OperatingSystem exit:1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4116
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4117
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4118
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4119
	    Display notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4120
		(self secureFileIn:'display.rc') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4121
		    "/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4122
		    (self secureFileIn:'keyboard.rc') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4123
			"/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4124
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4125
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4126
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4127
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4128
    ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4129
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4130
    "Created: / 06-12-2006 / 15:38:17 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4131
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4132
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4133
providingDisplayDo:aBlock
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4134
    "/ provide a Display, if needed
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4135
    (Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex |
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4136
        Display isNil ifTrue:[ self lateOpenDisplay ].
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4137
        ex proceedWith:Display.    
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4138
    ] do:aBlock    
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4139
!
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4140
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4141
readEvalPrintLoop
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4142
    "say hello, then go into a read-eval-print loop"
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4143
    
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4144
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4145
16090
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  4146
    Transcript showCR:(self hello).
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  4147
    Transcript showCR:(self copyrightString).
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  4148
    Transcript cr.
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  4149
    Transcript showCR:'Read-eval-print loop; exit with "#exit"; help with "?"'.
fb49d4924dc7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16083
diff changeset
  4150
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4151
    ReadEvalPrintLoop new
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4152
        prompt:'ST> ';
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4153
        doChunkFormat:false;
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4154
        error:Stderr;
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4155
        readEvalPrintLoop
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4156
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4157
    "Modified: / 07-12-2006 / 17:35:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4158
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4159
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4160
restart
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4161
    "startup after an image has been loaded;
18385
2d0a9c256e0e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18384
diff changeset
  4162
     This is called by the VM's main entry - you should not find senders from Smalltalk.
2d0a9c256e0e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18384
diff changeset
  4163
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4164
     there are three change-notifications made to dependents of ObjectMemory,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4165
     which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4166
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4167
     #earlySystemInstallation is sent for ST80 compatibility
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4168
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4169
     #earlyRestart is send first, nothing has been setup yet.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4170
		   (should be used to flush all device dependent entries)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4171
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4172
     #restarted is send right after.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4173
		   (should be used to recreate external resources (fds, bitmaps etc)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4174
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4175
     #returnFromSnapshot is sent last
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4176
		   (should be used to restart processes, reOpen Streams which cannot
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4177
		    be automatically be reopened (i.e. Sockets, Pipes) and so on.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4178
		   (Notice that positionable fileStreams are already reopened and repositioned)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4179
     "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4180
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4181
    |deb insp transcript idx|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4182
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4183
    "/
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4184
    "/ when we arrive here, all objects from our previous life
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4185
    "/ have been reloaded - however, some may still contain invalid device
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4186
    "/ handles, display information etc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4187
    "/ also, dynamically loaded modules have not yet been reloaded yet.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4188
    "/ and the concrete OS, concrete FileName etc. are still refering to
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4189
    "/ the previous classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4190
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4191
    Initializing := true.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4192
    AbstractOperatingSystem initializeConcreteClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4193
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4194
    ImageRestartTime := Timestamp now.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4195
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4196
    CommandLine := CommandLineArguments copy.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4197
    CommandLineArguments := CommandLineArguments asOrderedCollection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4198
    CommandName := CommandLineArguments removeFirst. "/ the command
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4199
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4200
    idx := CommandLineArguments indexOf:'-q'.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4201
    idx == 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4202
	idx := CommandLineArguments indexOf:'--silent'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4203
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4204
    idx ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4205
	Object infoPrinting:false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4206
	ObjectMemory infoPrinting:false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4207
	CommandLineArguments removeAtIndex:idx.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4208
    ].
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4209
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4210
    "/ start catching SIGSEGV and SIGBUS
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4211
    OperatingSystem enableHardSignalInterrupts.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4212
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4213
    "/ reinit Filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4214
    Filename reinitialize.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4215
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4216
    "/ flush cached path directories (may have changed in the meanwhile)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4217
    self flushPathCaches.
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  4218
    self reinitializePackagePath.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4219
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4220
    "/ reinit the default streams: Stdin, Stdout and Stderr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4221
    "/ after that, we can write to stderr.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4222
    self reinitStandardStreams.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4223
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4224
    "/ redirect Transcript to Stderr during startup
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4225
    transcript := Transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4226
    Transcript := Stderr.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4227
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4228
    "/ temporary switch back to dumb interface -
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4229
    "/ to handle errors while view-stuff is not yet reinitialized
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4230
    insp := Inspector.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4231
    deb := Debugger.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4232
    deb notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4233
	deb reinitialize
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4234
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4235
    Inspector := MiniInspector.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4236
    Debugger := MiniDebugger.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4237
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4238
    "/ reload any dynamically loaded objects.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4239
    "/ this must be done before doing anything else below,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4240
    "/ because the Processor may restart processes which use
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4241
    "/ this code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4242
    "/ Also, a dynamic object might be registered as dependent of
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4243
    "/ ObjectFileLoader; therefore, must reload before doing any notifications.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4244
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4245
    ObjectFileLoader notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4246
	ObjectFileLoader reloadAllRememberedObjectFiles.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4247
    ].
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4248
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4249
    "/ invalidate all display connections.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4250
    "/ This is required to avoid trouble if someone accesses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4251
    "/ a display during early startup.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4252
    Screen notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4253
	Screen allScreens do:[:eachDisplay |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4254
	    eachDisplay invalidateConnection.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4255
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4256
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4257
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4258
    ObjectMemory changed:#earlySystemInstallation.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4259
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4260
    "/ reinitialize the Processor - restartable processes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4261
    "/ are now restarted here (but not yet scheduled).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4262
    Processor reinitialize.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4263
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4264
    "/ flush device handles & recreate OS resources (if possible)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4265
    "/ (mostly view/GC/color & font stuff)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4266
    ObjectMemory
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4267
	changed:#earlyRestart; changed:#restarted.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4268
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4269
    "/ start catching SIGINT and SIGQUIT
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4270
    OperatingSystem enableUserInterrupts.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4271
    OperatingSystem enableCrashSignalInterrupts.
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  4272
    ObjectMemory restoreGarbageCollectorSettings.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4273
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4274
    "/ 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
  4275
    "/ 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
  4276
    idx := CommandLineArguments indexOf:'--faststart'.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4277
    idx == 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4278
	idx := CommandLineArguments indexOf:'--fastStart'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4279
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4280
    idx ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4281
	CommandLineArguments removeAtIndex:idx.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4282
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4283
	CallbackSignal := QuerySignal new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4284
	[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4285
	    Class withoutUpdatingChangesDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4286
		(self fileIn:(self commandName , '_r.rc')) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4287
		    "no _r.rc file where executable is; try default smalltalk_r.rc"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4288
		    self fileIn:'smalltalk_r.rc'
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4289
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4290
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4291
	] on:CallbackSignal do:[:ex|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4292
	    "/ now, display and view-stuff works;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4293
	    "/ back to the previous debugging interface
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4294
	    Inspector := insp.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4295
	    Debugger := deb.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4296
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4297
	    "/ reinstall Transcript, if not changed during restart.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4298
	    "/ if there was no Transcript, go to stderr
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4299
	    (transcript notNil and:[Transcript == Stderr]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4300
		Transcript := transcript.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4301
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4302
	    Initializing := false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4303
	    ex proceed.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4304
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4305
	CallbackSignal := nil.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4306
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4307
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4308
    "/ reinitialization (restart) of Display is normally performed
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4309
    "/ 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
  4310
    "/ do in now.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4311
    Initializing ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4312
	Display notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4313
	    [
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4314
		Display reinitializeFor:Screen defaultDisplayName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4315
	    ] on:Screen deviceOpenErrorSignal do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4316
		'Smalltalk [error]: Cannot restart connection to: ' errorPrint.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4317
		Screen defaultDisplayName errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4318
		OperatingSystem exit:1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4319
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4320
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4321
	"/ now, display and view-stuff works;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4322
	"/ back to the previous debugging interface
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4323
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4324
	Inspector := insp.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4325
	Debugger := deb.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4326
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4327
	"/ reinstall Transcript, if not changed during restart.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4328
	"/ if there was no Transcript, go to stderr
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4329
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4330
	(transcript notNil and:[Transcript == Stderr]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4331
	    Transcript := transcript.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4332
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4333
	Initializing := false.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4334
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4335
    Screen notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4336
	"clean up leftover screens (and views) that haven't been reopened.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4337
	 Operate on a copy, since brokenConnection removes us from AllScreens"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4338
	Screen allScreens copy do:[:eachDisplay |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4339
	    eachDisplay isOpen ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4340
		'Smalltalk [info]: cannot reopen secondary display: ' errorPrint.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4341
		eachDisplay errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4342
		eachDisplay cleanupAfterDispatch; brokenConnection.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4343
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4344
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4345
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4346
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4347
    deb := insp := transcript := nil.   "avoid dangling refs"
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4348
    (StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4349
	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
  4350
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4351
    self mainStartup:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4352
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4353
    "Modified: / 03-08-1999 / 09:42:21 / stefan"
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4354
    "Modified: / 29-07-2011 / 17:58:23 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4355
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4356
11399
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4357
showSplashMessage:aString
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4358
    "put the message into the splash screen (if there is one).
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4359
     Use this for messages during startup"
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4360
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4361
    self showSplashMessage:aString color:nil.
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4362
!
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4363
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4364
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil
11389
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4365
    "put the message into the splash screen (if there is one)."
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4366
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4367
%{
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4368
#ifdef WIN32
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4369
    extern void __win32_splashMessage();
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4370
    char *msg = (char *)0;
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4371
    int clr = 0;
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4372
12481
805176d238d2 change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 12413
diff changeset
  4373
    if (__isStringLike(aMessageStringOrNil)) {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4374
	msg = __stringVal(aMessageStringOrNil);
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4375
    }
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4376
    if (__isSmallInteger(rgbValueOrNil)) {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4377
	clr = __intVal(rgbValueOrNil);
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4378
	__win32_splashMessageColor(clr);
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4379
    }
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4380
    __win32_splashMessage(msg);
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4381
#endif
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4382
%}
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4383
!
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4384
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4385
splashInfo:aString
11389
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4386
    "like infoPrintCR,
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4387
     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
  4388
     Use this for info messages during startup"
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4389
12883
133a10b7bd12 changed: #splashInfo:
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
  4390
    aString notNil ifTrue:[ aString infoPrintCR ].
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4391
    self showSplashMessage:aString color:nil.
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4392
!
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4393
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4394
start
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4395
    "low level entry from the VM's main.
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4396
     After initializeSystem, this is the very first real entry into the Smalltalk world.
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4397
     Analyzes the command line and checks what to do 
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4398
     (i.e. script/repl/eval or full blown IDE).
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4399
     Also handles --load and various debug options.
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4400
     Caveat: 
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4401
        this has become too complicated and desperately needs a rewrite.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4402
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4403
     Also:
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4404
        Be very careful when changing things here; 
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4405
        especially be careful to ensure that the scripting options are robust against any
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4406
        missing packages; so the error handlers should not depend on any stream, logger etc. features.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4407
     "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4408
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4409
    |idx graphicalMode arg didReadRCFile keepSplashWindow|
960
e3b75f50d0cd changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  4410
19597
435f19b58541 #FEATURE by sr
sr
parents: 19589
diff changeset
  4411
    graphicalMode := Smalltalk isSmalltalkDevelopmentSystem.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4412
    Initializing := true.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4413
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4414
    keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false].
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4415
21016
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4416
    idx := CommandLineArguments indexOf:'--debug'.
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4417
    (idx ~~ 0) ifTrue:[
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4418
        CommandLineArguments removeAtIndex:idx.    
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4419
    ].    
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4420
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4421
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4422
     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
  4423
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4424
    Class withoutUpdatingChangesDo:[
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4425
        |commandFiles rcFile defaultRC prevCatchSetting
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4426
         isEval isPrint isFilter isRepl isRunMain idxFileArg process|
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4427
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4428
        isEval := isPrint := isFilter := isRepl := isRunMain := false.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4429
        didReadRCFile := false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4430
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4431
        StandAlone ifFalse:[
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
  4432
            "/ self initializeVerboseFlags.
20878
ae8e23d9f65c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20877
diff changeset
  4433
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4434
            "/
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4435
            "/ look for any '-q', '-e', '-l' or '-f' command line arguments
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4436
            "/ and handle them;
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4437
            "/ read startup and patches file
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4438
            "/
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4439
            idx := CommandLineArguments indexOfAny:#('-R' '--repl').
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4440
            isRepl := IsRepl := (idx ~~ 0).
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4441
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4442
            idx := CommandLineArguments indexOfAny:#('-q' '--silent').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4443
            idx ~~ 0 ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4444
                Object infoPrinting:false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4445
                ObjectMemory infoPrinting:false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4446
                CommandLineArguments removeAtIndex:idx.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4447
                SilentLoading := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4448
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4449
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4450
            [
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4451
                idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4452
                idx ~~ 0
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4453
            ] whileTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4454
                arg := CommandLineArguments at:idx + 1.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4455
                CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
20853
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4456
                (arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each |
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4457
                    self packagePath addLast:each.                    
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4458
                    VerboseStartup ifTrue:[
20853
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4459
                        ('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR.
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4460
                    ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4461
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4462
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4463
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4464
            [
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4465
                idx := CommandLineArguments indexOfAny:#('-l' '--load').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4466
                idx ~~ 0
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4467
            ] whileTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4468
                arg := CommandLineArguments at:idx + 1.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4469
                CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
20719
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4470
                Smalltalk silentlyLoadingDo:[
20853
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4471
                    (arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each |
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4472
                        each asFilename exists ifTrue:[
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4473
                            (VerboseStartup | VerboseLoading) ifTrue:[
20853
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4474
                                ('Smalltalk [info]: loading file: "', each, '".') infoPrintCR.
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4475
                            ].
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4476
                            Smalltalk fileIn:each
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4477
                        ] ifFalse:[
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4478
                            (VerboseStartup | VerboseLoading) ifTrue:[
20853
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4479
                                ('Smalltalk [info]: loading package: "', each, '".') infoPrintCR.
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4480
                            ].
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4481
                            Smalltalk loadPackage:each
9cc798fa81e0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20841
diff changeset
  4482
                        ].
20719
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4483
                    ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4484
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4485
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4486
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4487
            "/ look for a '-e filename' or '--execute filename' or '--script filename' argument
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4488
            "/ this will force fileIn of filename only, no standard startup.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4489
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4490
            idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4491
            idx ~~ 0 ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4492
                SilentLoading := true.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4493
                CommandName := arg := CommandLineArguments at:idx + 1.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4494
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4495
                CommandLineArguments
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4496
                    removeAtIndex:idx+1; removeAtIndex:idx.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4497
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4498
                self startSchedulerAndBackgroundCollector.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4499
                keepSplashWindow ifFalse:[ self hideSplashWindow ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4500
                Initializing := false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4501
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4502
                process := [
20867
3c79bf1f52ee #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20860
diff changeset
  4503
                    Processor exitWhenNoMoreUserProcesses:true.
3c79bf1f52ee #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20860
diff changeset
  4504
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  4505
                    "/ set workspace variables
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  4506
                    self defineCommandLineAsWorkspaceVariablesForScripts.
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  4507
                    
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4508
                    "/ provide a Display, if needed
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4509
                    self providingDisplayDo:[
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4510
                        VerboseStartup ifTrue:[
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4511
                            ('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR.
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4512
                        ].
20854
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4513
                        NoHandlerError handle:[:ex |
21018
f8a78e675125 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21016
diff changeset
  4514
                            Debugging == true ifTrue:[
21019
dc5142562d79 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21018
diff changeset
  4515
                                MiniDebugger enterException:ex.
21018
f8a78e675125 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21016
diff changeset
  4516
                            ] ifFalse:[
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4517
                                Silent ifFalse:[
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4518
                                    'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4519
                                ].
20854
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4520
                                (VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4521
                                    ex suspendedContext fullPrintAll.
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4522
                                ].
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4523
                                self exit:1.
20854
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4524
                            ].
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4525
                            self exit:1.
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4526
                            "/ ex reject.
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4527
                        ] do:[
20854
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4528
                            UserInterrupt handle:[:ex |
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4529
                                Debugging == true ifTrue:[
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4530
                                    'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR.
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4531
                                    "/ thisContext fullPrintAll.
21019
dc5142562d79 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21018
diff changeset
  4532
                                    MiniDebugger enterException:ex.
20854
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4533
                                    ex proceed.
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4534
                                ].    
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4535
                                Silent ifFalse:[ 'user interrupt.' errorPrintCR ].
20854
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4536
                                self exit:128+(OperatingSystem sigINT).
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4537
                            ] do:[
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4538
                                arg = '-' ifTrue:[
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4539
                                    self fileInStream:Stdin
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4540
                                           lazy:nil
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4541
                                           silent:nil
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4542
                                           logged:false
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4543
                                           addPath:nil
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4544
                                ] ifFalse:[
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4545
                                    IsSTScript := true.
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4546
                                    Smalltalk silentlyLoadingDo:[
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4547
                                        self fileIn:arg.
90b191e5945d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20853
diff changeset
  4548
                                    ].
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4549
                                ].
20719
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4550
                            ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4551
                        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4552
                    ].
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4553
                    
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4554
                    "/ after the script, if Screen has been opened and there are any open windows,
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4555
                    "/ then do not exit
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4556
false ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4557
                    Display notNil ifTrue:[
20737
cbaefc448648 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20720
diff changeset
  4558
                        Processor exitWhenNoMoreUserProcesses:true.
20746
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4559
                        "/ Display exitOnLastClose:true.
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4560
                        "/ Display checkForEndOfDispatch.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4561
                    ] ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4562
                        self exit.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4563
                    ].
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4564
].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4565
                ] newProcess.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4566
                process priority:(Processor userSchedulingPriority).
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4567
                process name:'main'.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4568
                process beGroupLeader.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4569
                process resume.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4570
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4571
                Processor dispatchLoop.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4572
                self exit
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4573
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4574
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4575
            "look for a '-f filename' or '--file filename' argument
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4576
             if scripting, these are loaded before -P, -E or -R action.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4577
             if not scripting, this will force evaluation of filename instead of smalltalk.rc"
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4578
            [
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4579
                idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file').
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4580
                (idxFileArg ~~ 0)
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4581
            ] whileTrue:[
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4582
                commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ].
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4583
                commandFiles add:(CommandLineArguments at:idxFileArg+1).
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4584
                CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4585
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4586
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4587
            "/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation)
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4588
            "/ or -F/--filter or a '--repl' argument
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4589
            "/ E, P and F this will force evaluation of expr only, no standard startup
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4590
            "/ repl go into an interactive loop.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4591
            idx := CommandLineArguments indexOfAny:#('-E' '--eval').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4592
            (isEval := (idx ~~ 0)) ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4593
                idx := CommandLineArguments indexOfAny:#('-P' '--print').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4594
                (isPrint := (idx ~~ 0)) ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4595
                    idx := CommandLineArguments indexOfAny:#('-F' '--filter').
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4596
                    (isFilter := (idx ~~ 0)) ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4597
                        idx := CommandLineArguments indexOfAny:#('-R' '--repl').
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4598
                        (isRepl := (idx ~~ 0)) ifFalse:[   
20716
22b66345ba2e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20715
diff changeset
  4599
                            idx := CommandLineArguments indexOfAny:#('--run').
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4600
                            isRunMain := (idx ~~ 0)
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4601
                        ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4602
                    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4603
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4604
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4605
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4606
            (isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4607
                |args|
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4608
                
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4609
                VerboseStartup ifTrue:[
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4610
                    ('Smalltalk [info]: eval/filter/print or repl') infoPrintCR.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4611
                ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4612
                isRepl ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4613
                    CommandLineArguments size <= idx ifTrue:[
20717
e1080ea0677a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20716
diff changeset
  4614
                        StandAlone := true.
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4615
                        self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4616
                    ].
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4617
                    isFilter ifTrue:[
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4618
                        args := CommandLineArguments copyFrom:idx + 1.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4619
                        CommandLineArguments removeFromIndex:idx+1.
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4620
                        VerboseStartup ifTrue:[
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4621
                            ('Smalltalk [info]: filter expression(s): ') infoPrint.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4622
                            args infoPrintCR.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4623
                        ].
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4624
                    ] ifFalse:[
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4625
                        arg := CommandLineArguments at:idx + 1.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4626
                        CommandLineArguments removeAtIndex:idx+1.
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4627
                        VerboseStartup ifTrue:[
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4628
                            ('Smalltalk [info]: eval expression: ') infoPrint.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4629
                            arg infoPrintCR.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4630
                        ].
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4631
                    ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4632
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4633
                CommandLineArguments removeAtIndex:idx.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4634
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4635
                self startSchedulerAndBackgroundCollector.
21015
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4636
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4637
                keepSplashWindow ifFalse:[ self hideSplashWindow ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4638
                Initializing := false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4639
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  4640
                "/ set workspace variables
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  4641
                self defineCommandLineAsWorkspaceVariablesForScripts.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4642
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4643
                "/ all of the above allow for a -f file to be loaded before any other action
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4644
                (commandFiles notEmptyOrNil) ifTrue:[
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4645
                    commandFiles do:[:commandFile |
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4646
                        (VerboseStartup | VerboseLoading) ifTrue:[
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4647
                            ('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR.
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4648
                        ].
20719
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4649
                        Smalltalk silentlyLoadingDo:[
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4650
                            (self secureFileIn:commandFile) ifFalse:[
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4651
                                StandAlone := true.
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4652
                                self exitWithErrorMessage:('"', commandFile, '" not found.').
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  4653
                            ]
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4654
                        ]
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4655
                    ]
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4656
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4657
20772
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4658
                isRepl ifFalse:[
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4659
                    Debugging == true ifFalse:[
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4660
                        "/ remove the Debugger
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4661
                        Debugger := nil.
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4662
                    ].
20761
da3f3479c4c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20759
diff changeset
  4663
                ].
da3f3479c4c4 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20759
diff changeset
  4664
                
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4665
                process := [
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4666
                    self providingDisplayDo:[
20772
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4667
                        isRepl ifTrue:[
20830
4482bd38c3aa #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20829
diff changeset
  4668
                            Processor exitWhenNoMoreUserProcesses:false.
20829
7f1419b0b7b3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20828
diff changeset
  4669
                            Processor activeProcess name:'repl'.
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4670
                            self readEvalPrintLoop.
20772
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4671
                            self exit.
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4672
                        ].
20885
19e2872c4c50 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20880
diff changeset
  4673
                        
20868
45600d443847 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20867
diff changeset
  4674
                        Processor exitWhenNoMoreUserProcesses:true.
20772
374ee2f2f883 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20767
diff changeset
  4675
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4676
                        NoHandlerError handle:[:ex |
21018
f8a78e675125 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21016
diff changeset
  4677
                            Debugging == true ifTrue:[
21019
dc5142562d79 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21018
diff changeset
  4678
                                MiniDebugger enterException:ex.
21018
f8a78e675125 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21016
diff changeset
  4679
                            ] ifFalse:[
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4680
                                Silent ifFalse:[
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4681
                                    'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4682
                                ].    
20767
5f69cd58b976 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20766
diff changeset
  4683
                                (VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[
20766
7a01da364910 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20765
diff changeset
  4684
                                    ex suspendedContext fullPrintAll.
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4685
                                ].
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4686
                                self exit:1.
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4687
                            ].
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4688
                            self exit:1.
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4689
                            "/ ex reject.
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4690
                        ] do:[
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4691
                            UserInterrupt handle:[:ex |
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4692
                                Debugging == true ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4693
                                    'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4694
                                    "/ thisContext fullPrintAll.
21019
dc5142562d79 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21018
diff changeset
  4695
                                    MiniDebugger enterException:ex.
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4696
                                    ex proceed.
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4697
                                ].
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4698
                                Silent ifFalse:[ 'user interrupt.' errorPrintCR ].
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4699
                                self exit:128+(OperatingSystem sigINT).
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4700
                            ] do:[
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4701
                                |filterCode filterStart filterEnd|
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4702
                                
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4703
                                isFilter ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4704
                                    "/ --filter - apply code to each input line.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4705
                                    "/ compile code only once
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4706
                                    (args size == 1) ifTrue:[
21015
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4707
                                        VerboseStartup ifTrue:[
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4708
                                            'Smalltalk [info]: filter 1-arg' infoPrintCR.
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4709
                                        ].
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4710
                                        filterCode := args at:1.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4711
                                    ] ifFalse:[
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4712
                                        (args size == 3) ifTrue:[
21015
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4713
                                            VerboseStartup ifTrue:[
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4714
                                                'Smalltalk [info]: filter 3-arg' infoPrintCR.
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4715
                                            ].
21010
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4716
                                            filterStart := args at:1.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4717
                                            filterCode := args at:2.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4718
                                            filterEnd := args at:3.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4719
                                        ] ifFalse:[
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4720
                                            StandAlone := true.
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4721
                                            self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)'
9efae8a7600b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20988
diff changeset
  4722
                                        ].
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4723
                                    ].    
21015
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4724
                                    filterStart notEmptyOrNil ifTrue:[ 
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4725
                                        VerboseStartup ifTrue:[
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4726
                                            ('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR.
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4727
                                        ].
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4728
                                        Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart) 
ed6b8a2db66a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21014
diff changeset
  4729
                                    ].    
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4730
                                    VerboseStartup ifTrue:[
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4731
                                        ('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4732
                                    ].
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4733
                                    Compiler
21013
ba1733da301b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21012
diff changeset
  4734
                                        compile:'doIt:line ',filterCode
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4735
                                        forClass:String
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4736
                                        notifying:(EvalScriptingErrorHandler new source:filterCode).
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4737
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4738
                                    [Stdin atEnd] whileFalse:[
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4739
                                        |line|
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4740
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4741
                                        line := Stdin nextLine.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4742
                                        line doIt:line.
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4743
                                    ].
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4744
                                    filterEnd notEmptyOrNil ifTrue:[ 
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4745
                                        VerboseStartup ifTrue:[
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4746
                                            ('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR.
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4747
                                        ].
21014
5862c432360a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21013
diff changeset
  4748
                                        Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd) 
21011
00319cafe394 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21010
diff changeset
  4749
                                    ].    
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4750
                                ] ifFalse:[
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4751
                                    (isPrint | isEval) ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4752
                                        "/ --print or --eval
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4753
                                        |rslt|
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4754
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4755
                                        rslt := Parser new
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4756
                                                    evaluate:arg
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4757
                                                    notifying:(EvalScriptingErrorHandler new source:arg)
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4758
                                                    compile:true.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4759
                                        isPrint ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4760
                                            rslt printCR.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4761
                                        ].
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4762
                                    ] ifFalse:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4763
                                        "/ --run <className>
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4764
                                        |className class|
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4766
                                        className := arg.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4767
                                        class := Smalltalk classNamed:className.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4768
                                        class isNil ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4769
                                            StandAlone := true.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4770
                                            self exitWithErrorMessage:'no such class: "', className, '".'
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4771
                                        ].
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4772
                                        (class respondsTo:#main:) ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4773
                                            class main:CommandLineArguments.
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4774
                                        ] ifFalse:[    
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4775
                                            (class respondsTo:#main) ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4776
                                                class main.
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4777
                                            ] ifFalse:[    
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4778
                                                (class respondsTo:#start) ifTrue:[
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4779
                                                    class start.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4780
                                                ] ifFalse:[    
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4781
                                                    StandAlone := true.
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4782
                                                    self exitWithErrorMessage:'class has no "main:", "main" or "start" method.'
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4783
                                                ].    
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4784
                                            ].    
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4785
                                        ].    
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4786
                                    ].    
20765
7894c699d784 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20761
diff changeset
  4787
                                ].
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4788
                            ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4789
                        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4790
                    ].
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4791
                    
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4792
                    "/ after the script, if Screen has been opened and there are any open windows,
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4793
                    "/ then do not exit
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4794
false ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4795
                    Display notNil ifTrue:[
20743
979e7c632580 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20737
diff changeset
  4796
                        Processor exitWhenNoMoreUserProcesses:true.
20746
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4797
                        "/ Display exitOnLastClose:true.
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4798
                        "/ Display checkForEndOfDispatch.
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4799
                        VerboseStartup ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4800
                            ('Smalltalk [info]: display opened.') infoPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4801
                        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4802
                    ] ifFalse:[
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4803
                        VerboseStartup ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4804
                            ('Smalltalk [info]: no display - exit after script.') infoPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4805
                        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4806
                        self exit.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4807
                    ].
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4808
].
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4809
                    VerboseStartup ifTrue:[
20828
1d6a3001e15b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20827
diff changeset
  4810
                        ('Smalltalk [info]: script/repl/eval finished.') infoPrintCR.
1d6a3001e15b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20827
diff changeset
  4811
                    ].
1d6a3001e15b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20827
diff changeset
  4812
                    
20759
cf0febc47067 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20758
diff changeset
  4813
                ] newProcess.    
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4814
                process priority:(Processor userSchedulingPriority).
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4815
                process name:'main'.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4816
                process beGroupLeader.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4817
                process resume.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4818
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4819
                Processor dispatchLoop.
20880
645955edb8d3 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20878
diff changeset
  4820
                VerboseStartup ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4821
                    ('Smalltalk [info]: exit normally.') infoPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4822
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4823
                self exit
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4824
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4825
        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4826
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4827
        commandFiles notNil ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4828
            SilentLoading := true.  "/ suppress the hello & copyright messages
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4829
            self addStartBlock:
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4830
                [
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4831
                    commandFiles do:[:commandFile |
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4832
                        (self secureFileIn:commandFile) ifFalse:[
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  4833
                            self exitWithErrorMessage:('startup file "', commandFile, '" not found.').
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4834
                        ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4835
                    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4836
                ].
16091
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4837
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4838
"/            self startSchedulerAndBackgroundCollector.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4839
"/            keepSplashWindow ifFalse:[ self hideSplashWindow ].
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4840
"/            Initializing := false.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4841
"/
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4842
"/            (self secureFileIn:commandFile) ifFalse:[
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4843
"/                ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4844
"/                OperatingSystem exit:1.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  4845
"/            ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4846
        ] ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4847
            "/ look for <command>.rc
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4848
            "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4849
20714
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4850
            rcFile := self commandName asFilename withSuffix:'rc'.
ad4ac81bea09 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20663
diff changeset
  4851
            (didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4852
                StandAlone ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4853
                    defaultRC := 'smalltalk.rc' "/asFilename
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4854
                ] ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4855
                    defaultRC := 'stxapp.rc' "/asFilename
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4856
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4857
                "JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4858
                    to be started with different working directory than stx/projects/smalltalk !!!!!!"
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4859
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4860
                "/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4861
                didReadRCFile := (self getSystemFileName:defaultRC) notNil
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4862
                                 and:[self secureFileIn:defaultRC].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4863
                didReadRCFile ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4864
                    StandAlone ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4865
                        'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4866
                        graphicalMode := false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4867
                    ]
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4868
                ]
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4869
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4870
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4871
            "/ ('StandAlone is %1' bindWith:StandAlone) printCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4872
            "/ ('Headless is %1' bindWith:HeadlessOperation) printCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4873
            "/ ('Display is %1' bindWith:Display) printCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4874
            "/ ('Screen is %1' bindWith:Screen) printCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4875
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4876
            keepSplashWindow ifFalse:[ self hideSplashWindow ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4877
            didReadRCFile ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4878
                'private.rc' asFilename exists ifTrue:[ self secureFileIn:'private.rc' ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4879
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4880
                "/
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4881
                "/ No RC file found;
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4882
                "/ Setup more default stuff
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4883
                "/
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4884
                StandAlone ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4885
                    "/ its a smalltalk - proceed in interpreter.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4886
                    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4887
                    graphicalMode := false.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4888
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4889
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4890
                "/ setup more defaults...
13537
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4891
"/                ObjectMemory startBackgroundCollectorAt:5.
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4892
"/                ObjectMemory startBackgroundFinalizationAt:5.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4893
                self addStartBlock:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4894
                    self startSchedulerAndBackgroundCollector
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4895
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4896
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4897
        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4898
        (CommandLineArguments includes:'--scripting') ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4899
            self addStartBlock:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4900
                StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4901
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4902
        ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4903
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4904
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  4905
    HeadlessOperation ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  4906
        graphicalMode := false.
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4907
    ].
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4908
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4909
    keepSplashWindow ifFalse:[ self hideSplashWindow ].
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4910
    self mainStartup:graphicalMode
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4911
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4912
    "Modified: / 17-12-2013 / 16:44:40 / cg"
13536
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4913
!
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4914
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4915
startSchedulerAndBackgroundCollector
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4916
    Processor startTimeSlicing.
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4917
    Processor supportDynamicPriorities:true.
13537
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4918
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4919
    ObjectMemory startBackgroundCollectorAt:5.
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  4920
    ObjectMemory startBackgroundFinalizationAt:5.
13536
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4921
    ObjectMemory backgroundCollectProcess priorityRange:(4 to:9).
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4922
    ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9).
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4923
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  4924
    "Created: / 31-07-2011 / 20:01:33 / cg"
11808
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4925
!
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4926
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4927
startStartBlockProcess
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4928
    "at the end of the smalltalk initialization, start all actions that
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4929
     were delayed until the ProcessorScheduler is running in a separate process"
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4930
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4931
    |p|
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4932
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  4933
    p :=
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4934
	[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4935
	    self executeStartBlocks.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4936
	] newProcess.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  4937
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  4938
    p
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4939
	priority:(Processor userSchedulingPriority);
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4940
	name:'start block handler';
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4941
	beGroupLeader;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4942
	resume.
13892
3a39b1ef1d6f changed:
Claus Gittinger <cg@exept.de>
parents: 13883
diff changeset
  4943
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4944
    "Modified: / 07-01-2012 / 12:59:01 / cg"
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4945
! !
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  4946
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4947
!Smalltalk class methodsFor:'startup and exit'!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4948
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4949
addExitBlock:aBlock
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4950
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4951
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4952
    "add a block to be executed when Smalltalk finishes.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4953
     This feature is currently not used anywhere - but could be useful for
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4954
     cleanup in stand alone applications.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4955
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4956
     Better use: ObjectMemory>>#addDependent: and handle the change message
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4957
     #aboutToQuit."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4958
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4959
    ExitBlocks isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4960
	ExitBlocks := OrderedCollection with:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4961
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4962
	ExitBlocks add:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4963
    ]
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4964
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4965
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4966
addImageStartBlock:aBlock
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4967
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4968
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4969
    "add a blocks to be executed in a separate process after
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4970
     everything has been initialized.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4971
     These blocks will be executed after an image restart."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4972
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4973
    ImageStartBlocks isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4974
	ImageStartBlocks := OrderedCollection with:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4975
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4976
	ImageStartBlocks add:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4977
    ]
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4978
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4979
    "Created: 9.9.1996 / 16:48:20 / stefan"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4980
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4981
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4982
addStartBlock:aBlock
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4983
    "to be called ONLY during very early startup (before the process scheduler
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4984
     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
  4985
     everything has been initialized.
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4986
     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
  4987
     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
  4988
     be operating.
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4989
     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
  4990
     Initial processes such as the launcher are usually started here
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4991
     (see smalltalk.rc / private.rc).
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4992
     ONLY to be called from such an rc file."
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4993
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4994
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  4995
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4996
    "/ to protect against "mis-users" of this mehtod...
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  4997
    Initializing ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4998
	aBlock value
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  4999
    ] ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5000
	StartBlocks isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5001
	    StartBlocks := OrderedCollection with:aBlock
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5002
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5003
	    StartBlocks add:aBlock
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5004
	]
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5005
    ].
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5006
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5007
    "Created: / 09-09-1996 / 16:46:53 / stefan"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5008
    "Modified (comment): / 18-08-2011 / 09:18:42 / cg"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5009
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5010
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5011
exit
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5012
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5013
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5014
    "finish the Smalltalk system"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5015
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5016
    self exit:0
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5017
    "not reached"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5018
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5019
    "Be careful evaluating this
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5020
     Smalltalk exit
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5021
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5022
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5023
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5024
exit:statusInteger
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5025
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5026
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5027
    "finish the Smalltalk system"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5028
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5029
    ObjectMemory changed:#aboutToExit.  "/ for ST/X backward compatibility
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5030
    ObjectMemory changed:#aboutToQuit.  "/ for ST-80 compatibility
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5031
    ExitBlocks notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5032
	ExitBlocks do:[:aBlock |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5033
	    aBlock value
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5034
	]
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5035
    ].
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5036
    OperatingSystem exit:statusInteger
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5037
    "not reached"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5038
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5039
    "Be careful evaluating this
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5040
     Smalltalk exit:1
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5041
    "
19014
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5042
!
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5043
19958
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5044
exitIfStandalone
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5045
    "if this is a standalone application, exit.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5046
     Otherwise give a warning and abort.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5047
     Call this in your code instead of Smalltalk exit,
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5048
     so the code can be tested in the IDE without danger of shuttong down ST/X"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5049
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5050
    "{ Pragma: +optSpace }"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5051
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5052
    self exitIfStandalone:0
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5053
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5054
    "Created: / 06-06-2016 / 14:56:49 / cg"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5055
!
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5056
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5057
exitIfStandalone:statusInteger
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5058
    "if this is a standalone application, exit.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5059
     Otherwise give a warning and abort.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5060
     Call this in your code instead of Smalltalk exit,
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5061
     so the code can be tested in the IDE without danger of shuttong down ST/X"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5062
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5063
    "{ Pragma: +optSpace }"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5064
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5065
    Smalltalk isStandAloneApp ifTrue:[
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5066
        self exit:statusInteger
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5067
    ] ifFalse:[
20572
46cece0d82ed #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20565
diff changeset
  5068
        self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'.
20565
6c2a63cd3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20557
diff changeset
  5069
        AbortOperationRequest raise.
19958
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5070
    ]
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5071
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5072
    "
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5073
     Smalltalk exitIfStandalone:1
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5074
    "
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5075
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5076
    "Created: / 06-06-2016 / 14:56:00 / cg"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5077
!
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5078
19014
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5079
exitOrError:exitCode
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5080
    "exit only if running as standalone application.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5081
     Raise an error in the development system.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5082
     Useful for testing standalone apps which should not kill
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5083
     your development system."
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5084
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5085
    self isStandAloneApp ifTrue:[
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5086
        self exit:exitCode.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5087
    ].
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5088
    self error:'standalone smalltalk would exit here with exit code: ', exitCode printString.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5089
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5090
    "
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5091
     self exitOrError:0
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5092
    "
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5093
!
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5094
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5095
exitWithErrorMessage:msg
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5096
    ('Smalltalk [error]: ',msg) errorPrintCR.
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5097
    self exitOrError:1
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5098
! !
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5099
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  5100
!Smalltalk class methodsFor:'startup queries'!
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5101
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5102
commandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5103
    "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
  5104
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5105
    ^ CommandLine
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
     Smalltalk commandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5109
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5110
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5111
    "Created: 19.7.1996 / 11:09:06 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5112
!
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
commandLineArgumentNamed:aString
16110
c17880a91e5e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16100
diff changeset
  5115
    "extract a named argument from the command line arguments.
c17880a91e5e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16100
diff changeset
  5116
     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
  5117
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5118
    |args index|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5119
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5120
    args := self commandLineArguments.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5121
    index := args indexOf:aString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5122
    (index between:1 and:(args size - 1)) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5123
	^ args at:index+1
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5124
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5125
    ^ nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5126
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5127
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5128
     self commandLineArgumentNamed:'-display'
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5132
commandLineArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5133
    "return the user command line arguments;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5134
     This is a collection of strings (separated command line words),
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5135
     from which the internal startup arguments have already been removed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5136
     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
  5137
     the commandLineArguments will be #('foo' 'bar' 'baz').
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5138
     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
  5139
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5140
    ^ CommandLineArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5141
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5142
    "Modified: 19.7.1996 / 11:11:03 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5143
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5144
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5145
commandName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5146
    "return the excutables name - this is normally 'stx',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5147
     but can be something else for standAlone apps."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5148
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5149
    ^ CommandName.
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5152
     Smalltalk commandName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5153
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5154
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5155
    "Modified: 19.7.1996 / 11:11:16 / cg"
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
hasNoConsole
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5159
    "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
  5160
     i.e. there should be no writing to stdout/stderr"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5161
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5162
    ^ HasNoConsole ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5163
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5164
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5165
     Smalltalk hasNoConsole
9054
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  5166
    "
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  5167
!
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  5168
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5169
ignoreAssertions
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5170
    "return true, if assertions are to be ignored (i.e. not executed).
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5171
     This is false by default in an IDE (i.e. full smalltalk),
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5172
     but can be set to true for standAlone applications
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5173
     (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
  5174
     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
  5175
     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
  5176
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  5177
    ^ IgnoreAssertions ? false
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5178
!
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5179
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5180
ignoreAssertions:aBoolean
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5181
    "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
  5182
     This is false by default in an IDE (i.e. full smalltalk),
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5183
     but can be set to true for standAlone applications
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5184
     (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
  5185
     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
  5186
     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
  5187
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  5188
    IgnoreAssertions := aBoolean
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5189
!
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5190
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5191
isHeadless
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5192
    "return true, if this is a headless application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5193
     i.e. no default Display connection is required/used"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5194
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5195
    ^ HeadlessOperation ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5196
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5197
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5198
     Smalltalk isHeadless
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5199
    "
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5200
!
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5201
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5202
isPlugin
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5203
    "return true, if this is a plugin application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5204
     i.e. running in a browserWindow"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5205
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5206
    ^ IsPlugin ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5207
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5208
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5209
     Smalltalk isPlugin
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5210
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5211
!
4957
d2470714f2da headless stuff
Stefan Vogel <sv@exept.de>
parents: 4956
diff changeset
  5212
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5213
isSTScript
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5214
    "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
  5215
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5216
    ^ IsSTScript ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5217
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5218
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5219
     Smalltalk isSTScript
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5220
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5221
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5222
    "Created: / 06-12-2006 / 16:41:21 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5223
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5224
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5225
isSharedLibraryComponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5226
    "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
  5227
     i.e. a dll within another app."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5228
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5229
    ^ IsSharedLibraryComponent ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5230
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
     Smalltalk isSharedLibraryComponent
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5235
    "Created: / 10-08-2006 / 13:09:34 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5236
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5237
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5238
isSmalltalkDevelopmentSystem
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5239
    "return true, if this is a real smalltalk system
17421
9f2dac6c6efb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17399
diff changeset
  5240
     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
  5241
     and NOT a plugIn (i.e. running in a browser)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5242
     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
  5243
     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
  5244
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5245
    self isPlugin ifTrue:[^ false].                     "/ I am a browser-plugin
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5246
    self isSharedLibraryComponent ifTrue:[^ false].     "/ I am a COM-ponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5247
    self isSTScript ifTrue:[^ true ].                   "/ I am stScript
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  5248
    ^ self isStandAloneApp not.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5249
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
     Smalltalk isSmalltalkDevelopmentSystem
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5252
    "
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
    "Created: / 10-08-2006 / 13:12:49 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5255
    "Modified: / 06-12-2006 / 16:42:56 / cg"
15565
3dae2c24b592 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15334
diff changeset
  5256
    "Modified (comment): / 27-07-2013 / 15:36:20 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5257
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5258
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5259
isStandAloneApp
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5260
    "return true, if this is a standAlone application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5261
     i.e. a stripped & linked application (such as the webServer)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5262
     in contrast to a full smalltalk (development) system."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5263
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5264
    ^ StandAlone ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5265
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5266
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5267
     Smalltalk isStandAloneApp
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5268
    "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  5269
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  5270
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5271
isStandAloneDebug
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5272
    "return true, if this is a standAlone application which
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5273
     was started with the -debug option."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5274
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5275
    ^ DebuggingStandAlone ? false
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5276
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5277
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5278
     Smalltalk isStandAloneDebug
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5279
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5280
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5281
    "Created: / 19-01-2012 / 10:17:41 / cg"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5282
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5283
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5284
startupArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5285
    "return the arguments passed to StartupClass when stx gets started.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5286
     Usually these are nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5287
     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
  5288
     a simple way to configure and create stand-alone applications"
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
    ^ StartupArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5291
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5292
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5293
     Smalltalk startupArguments
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5294
    "
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5295
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5296
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5297
startupClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5298
    "return the class, that will get the start message when smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5299
     starts and its non-nil. Usually this is nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5300
     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
  5301
     a simple way to configure and create stand-alone applications"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5302
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5303
    ^ StartupClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5304
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5305
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5306
     Smalltalk startupClass
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5307
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5308
!
8570
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  5309
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5310
startupClass:aClass selector:aSymbol arguments:anArrayOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5311
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5312
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5313
    "set the class, selector and arguments to be performed when smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5314
     starts. Setting those before saving a snapshot, will make the saved
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5315
     image come up executing your application (instead of the normal mainloop)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5316
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5317
    StartupClass := aClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5318
    StartupSelector := aSymbol.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5319
    StartupArguments := anArrayOrNil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5320
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5321
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5322
startupSelector
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5323
    "return the selector, that will be sent to StartupClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5324
     Usually this is nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5325
     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
  5326
     a simple way to configure and create stand-alone applications"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5327
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5328
    ^ StartupSelector
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5329
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5330
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5331
     Smalltalk startupSelector
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5332
    "
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5333
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5334
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5335
wasStartedFromImage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5336
    "return true, if this smalltalk was started from an image,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5337
     as opposed to a fresh and clean startup"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5338
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5339
    ^ ImageRestartTime notNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5340
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5341
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5342
     Smalltalk wasStartedFromImage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5343
    "
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  5344
! !
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  5345
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  5346
!Smalltalk class methodsFor:'system environment'!
1069
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  5347
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5348
language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5349
    "return the language setting"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5350
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5351
    ^ Language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5352
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5353
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5354
     Smalltalk language
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5357
    "Modified: 26.4.1996 / 17:10:05 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5358
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5359
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5360
language:aLanguageSymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5361
    "set the language - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5362
18733
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5363
    aLanguageSymbol ~= Language ifTrue:[
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5364
        Language := aLanguageSymbol asSymbol.
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5365
        self changed:#Language
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5366
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5367
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5368
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5369
     Smalltalk language:#de
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5370
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5371
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5372
    "Modified: / 19-10-2006 / 23:17:29 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5373
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5374
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5375
language:aLanguageSymbol territory:aTerritorySymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5376
    "set the language & territory - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5377
18733
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5378
    ((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5379
        Language := aLanguageSymbol asSymbol.
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5380
        LanguageTerritory := aTerritorySymbol asSymbol.
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5381
        self changed:#Language
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5382
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5383
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5384
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5385
     Smalltalk language:#de territory:#de
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5386
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5387
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5388
    "Created: / 19-10-2006 / 22:16:22 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5389
    "Modified: / 19-10-2006 / 23:17:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5390
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5391
13212
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5392
languageAndTerritory
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5393
    "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
  5394
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5395
    ^ Language , '-' , (LanguageTerritory ? Language)
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5396
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5397
    "
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5398
     Smalltalk languageAndTerritory
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5399
    "
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5400
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5401
    "Created: / 16-01-2011 / 10:19:42 / cg"
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5402
!
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5403
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5404
languageCodeset
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5405
    ^ LanguageCodeset
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5406
!
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5407
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5408
languageModifier
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5409
    ^ LanguageModifier
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5410
!
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5411
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5412
languageTerritory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5413
    "return the language territory setting"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5414
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5415
    ^ LanguageTerritory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5416
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5417
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5418
languageTerritory:aTerritorySymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5419
    "set the language territory - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5420
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  5421
    aTerritorySymbol ~= LanguageTerritory ifTrue:[
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  5422
        LanguageTerritory := aTerritorySymbol asSymbol.
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  5423
        self changed:#LanguageTerritory
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  5424
    ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  5425
    
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5426
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5427
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5428
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5429
     Smalltalk languageTerritory:#us.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5430
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5431
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5432
     Smalltalk languageTerritory:#de.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5433
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5434
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5435
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5436
    "Modified: / 19-10-2006 / 23:17:40 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5437
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5438
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5439
setLanguage:aLanguageSymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5440
    "set the language without change notification"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5441
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5442
    Language := aLanguageSymbol.
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5443
!
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5444
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5445
setLanguage:aLanguageSymbol territory:aTerritorySymbol
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5446
    "set the language & territory - no change notification"
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5447
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5448
    Language := aLanguageSymbol asSymbol.
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5449
    LanguageTerritory := aTerritorySymbol asSymbol.
1069
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  5450
! !
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  5451
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  5452
!Smalltalk class methodsFor:'system management'!
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  5453
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5454
compressSources
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5455
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5456
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5457
    "compress the sources file, and remove all method source strings
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5458
     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
  5459
     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
  5460
     since we use per-class sourcefiles for the compiled classes,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5461
     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
  5462
     incremental compiled methods.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5463
     Therefore, only those sources which are not coming from compiled
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5464
     methods are put into the 'st.src' file - all others are untouched.
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5465
     This is being automated - so don't care for now."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5466
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5467
    |newStream table source pos fileName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5468
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5469
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5470
     first, find all methods which contain either a string-ref
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5471
     or an external string in the 'st.src' file
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
    newStream := 'src.tmp' asFilename writeStream.
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
    table := IdentityDictionary new:100.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5476
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5477
    Method allSubInstancesDo:[:aMethod |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5478
        source := nil.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5479
        aMethod sourcePosition notNil ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5480
            aMethod sourceFilename = 'st.src' ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5481
                source := aMethod source.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5482
            ]
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5483
        ] ifFalse:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5484
            source := aMethod source
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5485
        ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5486
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5487
        source notNil ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5488
            pos := newStream position + 1.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5489
            newStream nextChunkPut:source.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5490
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5491
            "
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5492
             dont change the methods info - maybe some write error
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5493
             occurs later, in that case we abort and leave everything
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5494
             untouched.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5495
            "
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5496
            table at:aMethod put:pos
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5497
        ]
11655
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5498
    ].
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5499
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5500
    newStream syncData; close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5501
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5502
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5503
     now, rename the new source file,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5504
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5505
    fileName := (ObjectMemory nameForSources).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5506
    'src.tmp' asFilename renameTo:fileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5507
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5508
    "good - now go over all changed methods, and change their
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5509
     source reference"
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
    table keysAndValuesDo:[:aMethod :pos |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5512
        aMethod localSourceFilename:fileName position:pos.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5513
"/        aMethod printCR.
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5517
     Smalltalk compressSources
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5518
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5519
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5520
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5521
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5522
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5523
generateSingleSourceFile
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5524
    "{ Pragma: +optSpace }"
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
    "generate the sources file, and remove all method source strings
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5527
     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
  5528
     This makes the image independent from the per-class source files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5529
     and makes transportation of endUser applications easier, since
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5530
     only 3 files (executable, image and sourceFile) need to be
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5531
     transported."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5532
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5533
    |newStream table source pos fileName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5534
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5535
    newStream := 'src.tmp' asFilename writeStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5536
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5537
    table := IdentityDictionary new:100.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5538
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5539
    Method allSubInstancesDo:[:aMethod |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5540
        source := aMethod source.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5541
        source notNil ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5542
            pos := newStream position + 1.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5543
            newStream nextChunkPut:source.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5544
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5545
            "
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5546
             don't change the methods info - maybe some write error
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5547
             occurs later, in that case we abort and leave everything
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5548
             untouched.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5549
            "
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5550
            table at:aMethod put:pos
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5551
        ]
11655
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5552
    ].
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5553
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5554
    newStream syncData; close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5555
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
     now, rename the new source file,
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
    fileName := (ObjectMemory nameForSources).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5560
    'src.tmp' asFilename renameTo:fileName.
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
    "good - now go over all changed methods, and change their
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5563
     source reference"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5564
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5565
    table keysAndValuesDo:[:aMethod :pos |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  5566
        aMethod localSourceFilename:fileName position:pos.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5567
"/        aMethod printCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5568
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5569
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5570
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5571
     Smalltalk generateSingleSourceFile
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5572
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5573
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5574
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5575
    "Created: 17.10.1997 / 13:00:56 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5576
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5577
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5578
installAutoloadedClassFromSourceFile:aFilename
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5579
    "install aFilename (which must be a smalltalk source file) as autoloaded class
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5580
     (extract the class definition chunk from the file and create an autoloaded
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5581
      class stub for it)"
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5582
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5583
    |chunks filename|
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5584
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5585
    filename := aFilename asFilename.
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5586
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5587
    ChangeSet::InvalidChangeChunkError handle:[:ex |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5588
	^ self
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5589
    ] do:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5590
	filename readingFileDo:[:s|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5591
	    chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5592
	].
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5593
    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5594
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5595
    chunks
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5596
	select:[:eachChunk | eachChunk isClassDefinitionChange]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5597
	thenDo:[:eachClassChunk |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5598
		eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5599
	].
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5600
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5601
    "Created: / 01-08-2013 / 16:57:26 / cg"
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5602
!
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5603
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5604
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5605
    "create & install an autoload stub for a class named: clsName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5606
     to be loaded from package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5607
     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
  5608
     (otherwise, the newest revision will be loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5609
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5610
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5611
	installAutoloadedClassNamed:clsName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5612
	category:cat
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5613
	package:package
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5614
	revision:revisionOrNil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5615
	numClassInstVars:nil.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5616
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5617
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5618
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5619
    "create & install an autoload stub for a class named: clsName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5620
     to be loaded from package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5621
     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
  5622
     (otherwise, the newest revision will be loaded"
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
    |clsSym cls|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5625
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5626
    clsSym := clsName asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5627
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5628
    "/ install if not already compiled-in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5629
    (cls := self at:clsSym) isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5630
	Autoload subclass:clsSym
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5631
	    instanceVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5632
	    classVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5633
	    poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5634
	    category:cat
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5635
	    inEnvironment:Smalltalk.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5636
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5637
	cls := self at:clsSym.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5638
	cls isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5639
	    ('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5640
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5641
	    cls package:package asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5642
	    revisionOrNil notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5643
		cls setBinaryRevision:revisionOrNil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5644
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5645
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5646
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5647
	"/ class already present - however, if unloaded, check for category/package change
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5648
	cls isLoaded ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5649
	    package ~= cls package ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5650
		cls withoutUpdatingChangesDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5651
		    cls package:package asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5652
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5653
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5654
	    cat ~= cls category ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5655
		cls withoutUpdatingChangesDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5656
		    cls category:cat.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5657
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5658
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5659
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5660
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5661
    ^ cls.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5662
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5663
    "Created: / 05-11-1998 / 15:10:25 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5664
    "Modified: / 16-01-2007 / 12:56:18 / cg"
11169
32fda240ee57 #installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents: 11153
diff changeset
  5665
10641
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5668
installAutoloadedClasses
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5669
    "scan all packages and install all classes found there as
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5670
     autoloaded. This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5671
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5672
    |dirsConsulted|
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5673
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  5674
    LoadInProgressQuery answerNotifyLoadingDo:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5675
	dirsConsulted := Set new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5676
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5677
	"/ along the package-path
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5678
	self packagePath do:[:eachPathComponent |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5679
	    (dirsConsulted includes:eachPathComponent) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5680
		self
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5681
		    recursiveInstallAutoloadedClassesFrom:eachPathComponent
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5682
		    rememberIn:dirsConsulted
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5683
		    maxLevels:15
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5684
		    noAutoload:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5685
		    packageTop:eachPathComponent
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5686
		    showSplashInLevels:2.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5687
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5688
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5689
	self splashInfo:nil.
17548
e7eab3f01aba class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17534
diff changeset
  5690
    ].
10641
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
     Smalltalk installAutoloadedClasses
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
    "Created: / 14.2.1997 / 17:32:57 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5697
    "Modified: / 13.12.1999 / 11:56:50 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5698
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5699
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5700
installAutoloadedClassesFrom:anAbbrevFilePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5701
    "read the given abbreviation file; install all classes found there as
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5702
     autoloaded. This takes some time ..."
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
    |f s|
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
    f := self getSystemFileName:anAbbrevFilePath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5707
    f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5708
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5709
    f notNil ifTrue:[
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5710
        f := f asFilename.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5711
        f isDirectory ifTrue:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5712
            f := f construct:'abbrev.stc'
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5713
        ].
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5714
        [
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5715
            s := f readStream.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5716
            self installAutoloadedClassesFromStream:s.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5717
            s close.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5718
        ] on:FileStream openErrorSignal
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5719
        do:[:ex| "do nothing"].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5720
    ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5721
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5722
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5723
     Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc'
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5724
     Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc'
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5727
    "Modified: / 5.11.1998 / 15:10:51 / cg"
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
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5730
installAutoloadedClassesFromAbbrevFile:aFilename
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5731
    aFilename readingFileDo:[:abbrevStream |
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5732
        self installAutoloadedClassesFromStream:abbrevStream.
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5733
    ]
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5734
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5735
    "
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5736
     self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename)
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5737
    "
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5738
    
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5739
    "Created: / 29-07-2011 / 20:39:21 / cg"
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5740
!
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5741
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5742
installAutoloadedClassesFromStream:anAbbrevFileStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5743
    "read the given abbreviation file;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5744
     install all classes found there as autoloaded, and also update the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5745
     abbreviation (className-to-fileName mapping) table.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5746
     This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5747
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5748
    |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
  5749
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5750
    anAbbrevFileStream isFileStream ifTrue:[
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5751
        abbrevFileName := anAbbrevFileStream pathName.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5752
        info := 'declared from: ', abbrevFileName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5753
    ].
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
    "/ yes, create any required nameSpace, without asking user.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5756
    Class createNameSpaceQuerySignal answer:true do:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5757
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5758
        [anAbbrevFileStream atEnd] whileFalse:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5759
            l := anAbbrevFileStream nextLine withoutSeparators.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5760
            "Skip empty lines and comments"
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5761
            (l notEmpty and:[l first ~= $#]) ifTrue:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5762
                "/ must do it manually, caring for quoted strings.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5763
"/                words := line asCollectionOfWords.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5764
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5765
                words := OrderedCollection new.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5766
                s2 := l readStream.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5767
                [s2 atEnd] whileFalse:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5768
                    s2 skipSeparators.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5769
                    s2 peek == $' ifTrue:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5770
                        s2 next.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5771
                        w := s2 upTo:$'.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5772
                        s2 skipSeparators.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5773
                    ] ifFalse:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5774
                        w := s2 upToSeparator
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5775
                    ].
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5776
                    words add:w
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5777
                ].
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5778
                words size < 3 ifTrue:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5779
                    'Smalltalk [warning]: bad abbrev entry' errorPrint.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5780
                    anAbbrevFileStream isFileStream ifTrue:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5781
                        ' (in ''' errorPrint.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5782
                        anAbbrevFileStream pathName errorPrint.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5783
                        ''')' errorPrint
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5784
                    ].
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5785
                    ': ' errorPrint. l errorPrintCR
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5786
                ] ifFalse:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5787
                    clsName := (words at:1) asSymbol.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5788
                    abbrev := (words at:2).
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5789
                    package := (words at:3) asSymbol.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5790
                    cat := words at:4 ifAbsent:nil.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5791
                    numClassInstVars := words at:5 ifAbsent:'0'.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5792
                    numClassInstVars := Integer readFrom:numClassInstVars onError:[0].
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5793
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5794
                    (cat size == 0) ifTrue:[
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5795
                        cat := 'autoloaded'
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5796
                    ].
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5797
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5798
                    "/ on the fly, update the abbreviations
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5799
                    self setFilename:abbrev forClass:clsName package:package.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5800
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5801
                    "/ '  autoloaded: ' print. clsName print. ' in ' print. cat printCR.
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5802
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5803
                    cls := self
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5804
                        installAutoloadedClassNamed:clsName
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5805
                        category:cat
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5806
                        package:package
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5807
                        revision:nil
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5808
                        numClassInstVars:numClassInstVars.
10641
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
"/                    info notNil ifTrue:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5811
"/                        cls setComment:info.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5812
"/                    ].
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5813
                ]
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5814
            ]
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5815
        ]
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  5816
    ]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5817
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5818
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5819
loadBinaries
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5820
    "return true, if binaries should be loaded into the system,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5821
     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
  5822
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5823
    ^ LoadBinaries
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5824
!
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5825
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5826
loadBinaries:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5827
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5828
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5829
    "turn on/off loading of binary objects"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5830
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5831
    aBoolean ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5832
	(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5833
	    LoadBinaries := true.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5834
	    ^ self
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5835
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5836
	'Smalltalk [info]: this system does not support binary loading' infoPrintCR.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5837
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5838
    LoadBinaries := false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5839
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5840
    "Modified: 10.1.1997 / 15:11:00 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5841
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5842
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5843
logDoits
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5844
    "return true if doits should go into the changes file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5845
     as well as changes - by default, this is off, since
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5846
     it can blow up the changes file enormously ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5847
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5848
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5849
    ^ LogDoits
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5850
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5851
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5852
     LogDoits := false
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5853
     LogDoits := true
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5854
    "
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5855
!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  5856
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5857
logDoits:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5858
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5859
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5860
    "turn on/off logging of doits in the changes file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5861
     By default, this is off, since it can blow up the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5862
     changes file enormously ...
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5863
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5864
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5865
    LogDoits := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5866
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5867
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5868
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5869
makeBytecodeMethods
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5870
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5871
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5872
    "walk over all methods and make each a bytecode method
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5873
     iff it does not contain primitive C code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5874
     Experimental and not yet used."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5875
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5876
    Method allSubInstancesDo:[:aMethod |
18707
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5877
        |newMethod|
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5878
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5879
        aMethod hasPrimitiveCode ifFalse:[
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5880
"/            aMethod errorPrintCR.
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5881
            newMethod := aMethod asByteCodeMethod.
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5882
            newMethod ~~ aMethod ifTrue:[
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5883
                newMethod isNil ifTrue:[
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5884
                    'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR.
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5885
                ] ifFalse:[
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5886
                    aMethod becomeSameAs:newMethod
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5887
                ].
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5888
            ]
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5889
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5890
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5891
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5892
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5893
     Smalltalk makeBytecodeMethods
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5894
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5895
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5896
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5897
    "Created: 17.10.1997 / 13:52:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5898
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5899
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5900
recursiveInstallAutoloadedClassesFrom:aTopDirectory
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5901
    "scan all packages and install all classes found there as
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5902
     autoloaded. This takes some time ..."
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5903
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5904
    |dirsConsulted|
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5905
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5906
    dirsConsulted := Set new.
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5907
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5908
    self
18707
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5909
        recursiveInstallAutoloadedClassesFrom:aTopDirectory
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5910
        rememberIn:dirsConsulted
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5911
        maxLevels:15
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5912
        noAutoload:false
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5913
        packageTop:nil
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  5914
        showSplashInLevels:-1.
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5915
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5916
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5917
    "
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5918
     Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler'
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5919
    "
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5920
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5921
    "Created: / 31-07-2012 / 15:27:40 / cg"
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5922
!
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  5923
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5924
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5925
    "read all abbrev.stc files from and under aDirectory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5926
     and install autoloaded classes.
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5927
     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
  5928
     but classes in subdirectories are installed, if the subdirectory contains a file
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5929
     named AUTOLOAD.
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5930
     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
  5931
     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
  5932
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5933
    self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5934
	recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5935
	maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5936
	showSplashInLevels:0.
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5937
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5938
    "
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5939
     Smalltalk installAutoloadedClasses
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5940
    "
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5941
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5942
    "Modified: / 17-08-2006 / 16:48:43 / cg"
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5943
!
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5944
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  5945
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5946
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5947
showSplashInLevels:showSplashInLevels
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5948
    "read all abbrev.stc files from and under aDirectory
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  5949
     and install autoloaded classes.
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5950
     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
  5951
     but classes in subdirectories are installed, if the subdirectory contains a file
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5952
     named AUTOLOAD.
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5953
     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
  5954
     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
  5955
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5956
    |dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5957
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5958
    dir := aDirectory asFilename.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5959
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5960
    "/ Care for non-existent directories"
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5961
    dir exists ifFalse:[ ^ self ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  5962
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5963
    dirName := dir physicalPathName.            "take care of symbolic links"
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5964
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5965
    (dirsConsulted includes:dirName) ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5966
        ^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5967
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5968
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  5969
    (dir / 'NOPACKAGES') exists ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5970
        ^ self.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5971
    ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  5972
    (dir / 'NOSUBAUTOLOAD') exists ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5973
        ^ self.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5974
    ].
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5975
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5976
    maxLevels == 0 ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5977
        Transcript showCR:('Autoload: max directory nesting reached in %1' bindWith:dir pathName).
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5978
        ^ self
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5979
    ].
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5980
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  5981
    dirsConsulted add:dirName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5982
    noAutoloadHere := noAutoloadIn.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5983
    noAutoloadHere ifFalse:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5984
        (dir / 'NOAUTOLOAD') exists ifTrue:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5985
            noAutoloadHere := true.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5986
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5987
    ] ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5988
        (dir / 'AUTOLOAD') exists ifTrue:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5989
            noAutoloadHere := false.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5990
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5991
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5992
11393
5964970e515c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11392
diff changeset
  5993
    showSplashInLevels >= 0 ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5994
        self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  5995
                                bindWith:(dirName contractAtBeginningTo:35)).
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5996
    ].
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  5997
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5998
    "/
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5999
    "/ suppress installation as autoloaded in this and everything
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6000
    "/ below; however, still traverse the directories to find packages ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6001
    "/
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  6002
    haveAbbrevDotSTC := false.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6003
    noAutoloadHere ifFalse:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6004
        [
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6005
            self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc').
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6006
            haveAbbrevDotSTC := true.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6007
        ] on:FileStream openErrorSignal
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6008
        do:[:ex|
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6009
            "ignore this file"
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6010
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6011
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6012
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6013
    [
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6014
        directoryContents := dir directoryContents.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6015
    ] on:FileStream openErrorSignal do:[:ex|
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6016
        "non-accessible directory: we are done"
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6017
        ^ self
16199
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  6018
    ].
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  6019
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  6020
    directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6021
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6022
    directoryContents removeAllFoundIn:#(
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6023
                            'objbc' 'objvc' 'objmingw'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6024
                            'doc'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6025
                            'CVS'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6026
                            'bitmaps'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6027
                            'resources'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6028
                            'source'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6029
                            'not_delivered'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6030
                            'not_ported'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6031
                        ).
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6032
    dir baseName = 'stx' ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6033
        directoryContents removeAllFoundIn:#(
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6034
                            'configurations'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6035
                            'include'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6036
                            'rules'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6037
                            'stc'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6038
                            'support'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6039
                        ).
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6040
    ].
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6041
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6042
    directoryContents do:[:eachFilenameString |
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6043
        |f|
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6044
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6045
        f := dir / eachFilenameString.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6046
        f isDirectory ifTrue:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6047
             self
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6048
                recursiveInstallAutoloadedClassesFrom:f
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6049
                rememberIn:dirsConsulted
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6050
                maxLevels:maxLevels-1
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6051
                noAutoload:noAutoloadHere
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6052
                packageTop:packageTopPath
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6053
                showSplashInLevels:showSplashInLevels - 1.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6054
        ] ifFalse:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6055
            (noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6056
                f suffix = 'st' ifTrue:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6057
                    [
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6058
                        self installAutoloadedClassFromSourceFile:f.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6059
                        f directory baseName = 'libbasic' ifTrue:[self halt].
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6060
                    ] on:FileStream openErrorSignal do:[:ex|
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6061
                        "ignore this file, but write a warning"
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6062
                        Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description).
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6063
                    ].
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6064
                ]
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6065
            ].
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6066
        ]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6067
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6068
11393
5964970e515c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11392
diff changeset
  6069
    showSplashInLevels >= 0 ifTrue:[
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6070
        self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  6071
                                bindWith:(dirName contractAtBeginningTo:35)).
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6072
    ].
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6073
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6074
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6075
     Smalltalk installAutoloadedClasses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6076
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6077
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  6078
    "Modified: / 01-08-2013 / 16:57:49 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6079
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6080
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6081
replaceReferencesTo:anObject with:newRef
12194
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  6082
    "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
  6083
     Return true, if any reference was changed.
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  6084
     Notice: this does not change the class-reference."
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  6085
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6086
    |toAdd|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6087
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6088
    toAdd := OrderedCollection new.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6089
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6090
	(key == anObject) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6091
	    self shouldImplement.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6092
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6093
	(val == anObject ) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6094
	    toAdd add:(key -> newRef)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6095
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6096
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6097
    toAdd do:[:each |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6098
	self at:(each key) put:(each value)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6099
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6100
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6101
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6102
saveEmergencyImage:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6103
    "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
  6104
     emergency image in case of a broken display connection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6105
     The default is true.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6106
     This may be useful, if you work with an unsecure display
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6107
     (serial line), and want to have a chance of proceeding after
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6108
     a crash. In multiheaded applications, this only affects
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6109
     crashes of the master Display connection (the initial connection);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6110
     errors on other displays are reported to the views and treated
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6111
     like window destroy from the windowManager."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6112
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6113
    SaveEmergencyImage := aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6114
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6115
    "Modified: / 24.10.1997 / 18:22:26 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6116
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6117
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6118
systemOrganization
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6119
    "for partial ST80 compatibility;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6120
     In ST80, Smalltalk organization returns a systemOrganizer, which
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6121
     keeps track of class-categories, while all classes return a classOrganizer
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6122
     from #organization, which keeps track of method categories of that class.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6123
     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
  6124
     To make a workaround possible, use #systemOrganization when porting
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6125
     VW apps to ST/X to get the class-categories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6126
     Read the documentation in SystemOrganizer for more info."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6127
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6128
    ^ SystemOrganizer for:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6129
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6130
    "Created: / 20.6.1998 / 12:24:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6131
    "Modified: / 20.6.1998 / 12:41:34 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6132
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6133
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6134
!Smalltalk class methodsFor:'system management-fileIn'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6135
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6136
fileIn:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6137
    "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
  6138
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6139
     This method can load almost anything which makes sense:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6140
	.st    - source files
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6141
	.cls   - binary smalltalk bytecode files
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6142
	.so    - binary compiled machine code class libraries
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6143
	[.class - java bytecode -- soon to come]"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6144
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6145
    ^ self fileIn:aFileName lazy:nil silent:nil logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6146
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6147
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6148
     Smalltalk fileIn:'source/TicTacToe.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6149
     Smalltalk fileIn:'binary/TicTacToe.cls'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6150
     Smalltalk fileIn:'binary/TicTacToe.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6151
    "
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
    "Created: 28.10.1995 / 17:06:28 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6154
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6155
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6156
fileIn:aFileName inPackage:aPackageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6157
    "read in the named file in a packages directory."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6158
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6159
    |dir|
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
    dir := self getPackageDirectoryForPackage:aPackageID.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6162
    dir isNil ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6163
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6164
    dir := dir asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6165
    ^ (self fileIn:(dir construct:aFileName))
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6166
      or:[ self fileIn:((dir construct:'source') construct:aFileName) ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6167
!
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
fileIn:aFileName lazy:lazy
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6170
    "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
  6171
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6172
     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
  6173
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6174
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6175
     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
  6176
     code which is known to be syntactically correct."
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
    ^ self fileIn:aFileName lazy:lazy silent:nil logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6179
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6180
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6181
     Smalltalk fileIn:'source/TicTacToe.st' lazy:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6182
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6183
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6184
    "Created: 28.10.1995 / 17:06:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6185
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6186
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6187
fileIn:aFileName lazy:lazy silent:silent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6188
    "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
  6189
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6190
     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
  6191
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6192
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6193
     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
  6194
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6195
     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
  6196
     Giving nil for silent/lazy will use the current settings."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6197
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6198
    ^ self fileIn:aFileName lazy:lazy silent:silent logged:false
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
    "Created: 28.10.1995 / 17:06:41 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6201
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6202
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6203
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6204
    "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
  6205
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6206
     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
  6207
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6208
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6209
     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
  6210
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6211
     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
  6212
     Giving nil for silent/lazy will use the current settings.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6213
     This method can load almost anything which makes sense:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6214
	.st    - source files
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6215
	.cls   - binary smalltalk bytecode files
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6216
	.so    - binary compiled machine code class libraries
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6217
	[.class - java bytecode -- soon to come]"
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6218
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  6219
    |fileNameString inStream path morePath bos|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6220
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6221
    fileNameString := aFileNameOrString asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6222
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6223
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6224
     an object or shared object ?
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6225
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6226
    (ObjectFileLoader notNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6227
    and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6228
	"/ LoadBinaries ifFalse:[^ false].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6229
	path := self getBinaryFileName:fileNameString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6230
	path isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6231
	    path := self getSystemFileName:fileNameString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6232
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6233
	path isNil ifTrue:[^ false].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6234
	^ (ObjectFileLoader loadObjectFile:path) notNil
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6235
    ].
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6236
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6237
    inStream := self systemFileStreamFor:fileNameString.
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6238
    inStream isNil ifTrue:[^ false].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6239
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6240
    (fileNameString asFilename hasSuffix:'cls') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6241
	BinaryObjectStorage notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6242
	    [
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6243
		inStream binary.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6244
		bos := BinaryObjectStorage onOld:inStream.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6245
		bos next.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6246
	    ] ensure:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6247
		bos close.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6248
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6249
	    ^ true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6250
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6251
	^ false
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6252
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6253
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6254
    (fileNameString includes:$/) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6255
	"/ temporarily prepend the file's directory
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6256
	"/ to the searchPath.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6257
	"/ This allows fileIn-driver files to refer to local
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6258
	"/ files via a relative path, and drivers to fileIn other
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6259
	"/ drivers ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6260
	morePath := inStream pathName asFilename directoryName.
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6261
    ].
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  6262
    ^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6263
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6264
    "
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6265
     Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6266
     Smalltalk fileIn:'keyboard.rc'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6267
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6268
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6269
    "Modified: / 08-09-2006 / 19:21:16 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6270
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6271
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6272
fileIn:aFileName logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6273
    "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
  6274
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6275
     The argument logged controls, if the changefile is to be updated."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6276
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6277
    ^ self fileIn:aFileName lazy:nil silent:nil logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6278
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
     Smalltalk fileIn:'source/TicTacToe.st' logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6281
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6282
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6283
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6284
fileIn:aFileName silent:silent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6285
    "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
  6286
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6287
     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
  6288
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6289
    ^ self fileIn:aFileName lazy:nil silent:silent logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6290
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6291
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6292
     Smalltalk fileIn:'source/TicTacToe.st' silent:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6293
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6294
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6295
    "Created: 28.10.1995 / 17:06:36 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6298
fileInChanges
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6299
    "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
  6300
     had when left the last time.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6301
     WARNING: this method is rubbish: it should only read things after the
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6302
	      last '**snapshot**' - entry
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6303
	      (instead of the complete changes file)."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6304
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6305
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6306
     do NOT update the changes file now ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6307
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6308
    self fileIn:ChangeFileName logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6309
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6310
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  6311
     Smalltalk fileInChanges
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6312
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6313
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6314
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6315
fileInClass:aClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6316
    "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
  6317
     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
  6318
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6319
     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
  6320
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6321
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6322
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6323
	package:nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6324
	initialize:true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6325
	lazy:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6326
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6327
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6328
    "Modified: / 9.1.1998 / 14:41:46 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6329
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6330
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6331
fileInClass:aClassName fromObject:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6332
    "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
  6333
     - look for it in some standard places.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6334
     Only install the named class from this object file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6335
     Return true if ok, false if failed."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6336
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6337
    |path ok|
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6340
     check if the dynamic loader class is in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6341
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6342
    (LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6343
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6344
    (path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6345
    ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6346
    ok ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6347
	VerboseLoading ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6348
	    Transcript show:'  loaded ' , aClassName , ' from ' ; showCR:aFileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6349
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6350
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6351
    ^ ok
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6352
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6353
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6354
     Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6355
     Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6356
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6357
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  6358
    "Modified: / 04-11-2011 / 13:42:24 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6359
!
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
fileInClass:aClassName initialize:doInit
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6362
    "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
  6363
     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
  6364
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6365
     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
  6366
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6367
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6368
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6369
	package:nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6370
	initialize:doInit
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6371
	lazy:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6372
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6373
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6374
    "Modified: / 9.1.1998 / 14:42:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6375
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6376
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6377
fileInClass:aClassName initialize:doInit lazy:loadLazy
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6378
    "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
  6379
     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
  6380
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6381
     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
  6382
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6383
     ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6384
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6385
	package:nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6386
	initialize:doInit
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6387
	lazy:loadLazy
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6388
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6389
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6390
    "Modified: / 9.1.1998 / 14:42:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6391
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6392
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6393
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6394
    "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
  6395
     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
  6396
     finally source file (.st), in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6397
     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
  6398
     The argument doInit controlls if the class should be sent a #initialize after the
19867
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6399
     load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6400
     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
  6401
     nil uses the value from SilentLoading."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6402
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6403
    ^ self
19867
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6404
        fileInClass:aClassName
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6405
        package:nil
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6406
        initialize:doInit
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6407
        lazy:loadLazy
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6408
        silent:beSilent
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6409
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6410
    "Modified: / 9.1.1998 / 14:42:28 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6411
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6412
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6413
fileInClass:aClassName package:package
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6414
    "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
  6415
     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
  6416
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6417
     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
  6418
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6419
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6420
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6421
	package:package
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6422
	initialize:true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6423
	lazy:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6424
	silent:nil
10641
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
    "Created: / 08-01-2007 / 10:06:09 / cg"
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
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  6429
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6430
    "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
  6431
     This is the workhorse for autoloading.
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  6432
     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
  6433
     finally source file (.st), in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6434
     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
  6435
     The argument doInit controlls if the class should be sent a #initialize after the
19867
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6436
     load; loadLazy tells if it should be loaded lazily. beSilent tells if the compiler
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6437
     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
  6438
     nil uses the value from SilentLoading."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6439
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  6440
    |classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibExtension inStream mgr
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6441
     filenameToSet packageDir packageFile bos|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6442
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  6443
    ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[
17582
4d4475b60428 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17576
diff changeset
  6444
19867
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6445
        wasLazy := Compiler compileLazy:loadLazy.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6446
        beSilent notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6447
            wasSilent := self silentLoading:beSilent.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6448
        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6449
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6450
        classFileName := Smalltalk fileNameForClass:aClassName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6451
        (classFileName = aClassName) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6452
            "/ no abbrev.stc translation for className
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6453
            (aClassName includes:$:) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6454
                "/ a nameSpace name
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6455
                alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6456
            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6457
        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6458
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6459
        classFileName asFilename isAbsolute ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6460
            classFileName asFilename suffix notEmptyOrNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6461
                ok := self fileIn:classFileName lazy:loadLazy silent:beSilent.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6462
            ] ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6463
                ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6464
            ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6465
        ] ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6466
            classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6467
            [
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6468
                Class withoutUpdatingChangesDo:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6469
                    |zarFn zar entry|
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6470
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6471
                    ok := false.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6472
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6473
                    package notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6474
                        packageDir := package asPackageId packageDirectory.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6475
                        "/ packageDir := package asString.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6476
                        "/ packageDir := packageDir copyReplaceAll:$: with:$/.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6477
                        packageDir isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6478
                            packageDir := self packageDirectoryForPackageId:package
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6479
                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6480
                        packageDir notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6481
                            packageDir := packageDir asFilename.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6482
                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6483
                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6484
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6485
                    Class packageQuerySignal answer:package do:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6486
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6487
                         then, if dynamic linking is available,
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6488
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6489
                        (LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6490
                            sharedLibExtension := ObjectFileLoader sharedLibraryExtension.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6491
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6492
                             first look for a class packages shared binary in binary/xxx.o
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6493
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6494
                            libName := self libraryFileNameOfClass:aClassName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6495
                            libName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6496
                                (ok := self fileInClass:aClassName fromObject:(libName, sharedLibExtension))
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6497
                                ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6498
                                    sharedLibExtension ~= '.o' ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6499
                                        ok := self fileInClass:aClassName fromObject:(libName, '.o')
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6500
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6501
                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6502
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6503
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6504
                             then, look for a shared binary in binary/xxx.o
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6505
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6506
                            ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6507
                                (ok := self fileInClass:aClassName fromObject:(classFileName, sharedLibExtension))
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6508
                                ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6509
                                    sharedLibExtension ~= '.o' ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6510
                                        ok := self fileInClass:aClassName fromObject:(classFileName, '.o')
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6511
                                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6512
                                    ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6513
                                        alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6514
                                            (ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, sharedLibExtension))
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6515
                                            ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6516
                                                sharedLibExtension ~= '.o' ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6517
                                                    ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o')
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6518
                                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6519
                                            ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6520
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6521
                                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6522
                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6523
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6524
                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6525
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6526
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6527
                         if that did not work, look for a compiled-bytecode file ...
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6528
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6529
                        ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6530
                            (ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6531
                            ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6532
                                alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6533
                                    ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6534
                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6535
                            ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6536
                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6537
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6538
                         if that did not work, and the classes package is known,
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6539
                         look for an st-cls file
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6540
                         in a package subdir of the source-directory ...
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6541
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6542
                        ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6543
                            (packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6544
                                packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6545
                                packageFile isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6546
                                    packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6547
                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6548
                                (ok := self fileIn:packageFile lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6549
                                ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6550
                                    alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6551
                                        packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6552
                                        packageFile isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6553
                                            packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6554
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6555
                                        ok := self fileIn:packageFile lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6556
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6557
                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6558
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6559
                                zarFn := self getPackageFileName:(packageDir / 'classes.zip').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6560
                                zarFn notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6561
                                    zar := ZipArchive oldFileNamed:zarFn.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6562
                                    zar notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6563
                                        entry := zar extract:(classFileName , '.cls').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6564
                                        (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6565
                                            entry := zar extract:(alternativeClassFileName , '.cls').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6566
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6567
                                        entry notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6568
                                            bos := BinaryObjectStorage onOld:(entry asByteArray readStream).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6569
                                            bos next.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6570
                                            bos close.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6571
                                            ok := true
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6572
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6573
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6574
                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6575
                            ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6576
                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6577
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6578
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6579
                         if that did not work, look for an st-source file ...
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6580
                        "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6581
                        ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6582
                            filenameToSet := classFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6583
                            (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6584
                            ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6585
                                alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6586
                                    filenameToSet := alternativeClassFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6587
                                    ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6588
                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6589
                                ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6590
                                    "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6591
                                     ... and in the standard source-directory
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6592
                                    "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6593
                                    filenameToSet := 'source' asFilename / classFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6594
                                    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6595
                                    ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6596
                                        alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6597
                                            filenameToSet := 'source' asFilename / alternativeClassFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6598
                                            ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6599
                                        ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6600
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6601
                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6602
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6603
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6604
                             if that did not work, and the classes package is known,
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6605
                             look for an st-source file
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6606
                             in a package subdir of the source-directory ...
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6607
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6608
                            ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6609
                                packageDir notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6610
                                    packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6611
                                    packageFile isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6612
                                        packageFile := (packageDir / 'source' / classFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6613
                                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6614
                                    filenameToSet := packageFile.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6615
                                    (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6616
                                    ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6617
                                        alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6618
                                            packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6619
                                            packageFile isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6620
                                                packageFile := (packageDir / 'source' / alternativeClassFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6621
                                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6622
                                            filenameToSet := packageFile.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6623
                                            ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6624
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6625
                                        ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6626
                                            packageFile := self getPackageSourceFileName:(packageDir / classFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6627
                                            packageFile isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6628
                                                packageFile := (packageDir / classFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6629
                                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6630
                                            filenameToSet := packageFile.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6631
                                            (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6632
                                            ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6633
                                                alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6634
                                                    packageFile := self getPackageFileName:(packageDir / alternativeClassFileName).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6635
                                                    packageFile isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6636
                                                        packageFile := packageDir / alternativeClassFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6637
                                                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6638
                                                    filenameToSet := packageFile.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6639
                                                    ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6640
                                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6641
                                                ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6642
                                                    "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6643
                                                     ... and in the standard source-directory
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6644
                                                    "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6645
                                                    filenameToSet := 'source' asFilename / packageDir / classFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6646
                                                    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6647
                                                    ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6648
                                                        alternativeClassFileName notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6649
                                                            filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6650
                                                            ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6651
                                                        ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6652
                                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6653
                                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6654
                                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6655
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6656
                                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6657
                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6658
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6659
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6660
                             if that did not work, and the classes package is known,
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6661
                             look for a zipArchive containing a class entry.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6662
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6663
                            ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6664
                                packageDir notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6665
                                    zarFn := self getPackageFileName:(packageDir / 'source.zip').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6666
                                    zarFn isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6667
                                        zarFn := packageDir withSuffix:'zip'.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6668
                                        zarFn := self getSourceFileName:zarFn.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6669
                                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6670
                                    (zarFn notNil and:[zarFn asFilename exists]) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6671
                                        zar := ZipArchive oldFileNamed:zarFn.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6672
                                        zar notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6673
                                            entry := zar extract:(classFileName , '.st').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6674
                                            (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6675
                                                entry := zar extract:(alternativeClassFileName , '.st').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6676
                                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6677
                                            entry notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6678
                                                filenameToSet := zarFn.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6679
                                                ok := self
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6680
                                                        fileInStream:(entry asString readStream)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6681
                                                        lazy:loadLazy
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6682
                                                        silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6683
                                                        logged:false
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6684
                                                        addPath:nil
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6685
                                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6686
                                        ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6687
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6688
                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6689
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6690
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6691
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6692
                             if that did not work,
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6693
                             look for a zipArchive containing a class entry.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6694
                            "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6695
                            ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6696
                                zarFn := self getSourceFileName:'source.zip'.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6697
                                zarFn notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6698
                                    zar := ZipArchive oldFileNamed:zarFn.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6699
                                    zar notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6700
                                        entry := zar extract:(zarFn := classFileName , '.st').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6701
                                        (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6702
                                            entry := zar extract:(zarFn := alternativeClassFileName , '.st').
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6703
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6704
                                        entry notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6705
                                            filenameToSet := zarFn.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6706
                                            ok := self
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6707
                                                    fileInStream:(entry asString readStream)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6708
                                                    lazy:loadLazy
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6709
                                                    silent:beSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6710
                                                    logged:false
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6711
                                                    addPath:nil
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6712
                                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6713
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6714
                                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6715
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6716
                            ok ifFalse:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6717
                                "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6718
                                 if there is a sourceCodeManager, ask it for the classes sourceCode
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6719
                                "
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6720
                                (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6721
                                    inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6722
                                    inStream notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6723
                                        filenameToSet := nil.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6724
                                        ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6725
                                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6726
                                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6727
                            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6728
                        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6729
                    ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6730
                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6731
            ] ensure:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6732
                Compiler compileLazy:wasLazy.
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6733
                wasSilent notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6734
                    self silentLoading:wasSilent
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6735
                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6736
            ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6737
        ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6738
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6739
        ok ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6740
            newClass := self at:(aClassName asSymbol).
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6741
            newClass notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6742
                "set the classes name - but do not change if already set"
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6743
                filenameToSet notNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6744
                    newClass getClassFilename isNil ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6745
                        newClass setClassFilename:(filenameToSet asFilename baseName)
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6746
                    ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6747
                ].
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6748
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6749
                doInit ifTrue:[
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6750
                    newClass initialize
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6751
                ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6752
            ]
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6753
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6754
    ].
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
    ^ newClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6757
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6758
    "Created: / 09-01-1998 / 14:40:32 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6759
    "Modified: / 05-06-1999 / 14:53:01 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6760
    "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
  6761
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6762
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6763
fileInClassLibrary:aClassLibraryName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6764
    "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
  6765
     and load it. This install all of its contained classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6766
     Return true if ok, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6767
     Notice: the argument may not have an extension (by purpose);
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6768
	     the sharedLib extension (.dll / .so / .sl) is added here, to
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6769
	     make the caller independent of the underlying operatingSystem."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6770
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6771
    |path fn|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6772
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6773
    ObjectFileLoader isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6774
	^ PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader'.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6775
    ].
10641
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
    fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6778
    fn := fn pathName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6779
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6780
    path := self getBinaryFileName:fn.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6781
    path isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6782
	path := self getSystemFileName:fn.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6783
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6784
    path isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6785
	^ PackageNotFoundError raiseRequestWith:aClassLibraryName.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6786
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6787
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6788
    (ObjectFileLoader loadObjectFile:path) isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6789
	^ PackageLoadError raiseRequestWith:aClassLibraryName.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6790
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6791
    ^ true.
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6792
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6793
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6794
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6795
     Smalltalk fileInClassLibrary:'libtable'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6796
     Smalltalk fileInClassLibrary:'binary/libwidg3'
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6799
    "Modified: 8.1.1997 / 17:58:56 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6802
fileInClassLibrary:aClassLibraryName inPackage:packageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6803
    "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
  6804
     and load it. This installs all of its contained classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6805
     Return true if ok, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6806
     Notice: the argument may not have an extension (by purpose);
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6807
	     the sharedLib extension (.dll / .so / .sl) is added here, to
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6808
	     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
  6809
11690
b48d486944fc fix for previous revision
Stefan Vogel <sv@exept.de>
parents: 11689
diff changeset
  6810
    |baseName handle libraryFilename packagePath|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6811
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6812
    ObjectFileLoader isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6813
	^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader'
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6814
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6815
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6816
    baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6817
    baseName exists ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6818
	"/ load local file first...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6819
	handle := ObjectFileLoader loadObjectFile:baseName.
12744
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6820
    ].
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6821
    handle isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6822
	packagePath := self getPackageDirectoryForPackage:packageID.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6823
	packagePath isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6824
	    ^ PackageNotFoundError raiseRequestWith:packageID.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6825
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6826
	packagePath := packagePath asFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6827
	libraryFilename := packagePath / baseName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6828
	libraryFilename exists ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6829
	    libraryFilename := nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6830
	    #('objbc' 'objvc') do:[:eachPossibleCompiledCodeDir |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6831
		"in windows, with Borland compiler, DLLs in development environment are under objbc;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6832
		 with MSVC, they are under objvc"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6833
		libraryFilename isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6834
		    libraryFilename := packagePath / eachPossibleCompiledCodeDir / baseName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6835
		    libraryFilename exists ifFalse:[ libraryFilename := nil ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6836
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6837
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6838
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6839
	(libraryFilename notNil and:[libraryFilename exists]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6840
	    handle := ObjectFileLoader loadObjectFile:libraryFilename pathName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6841
	].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6842
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6843
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6844
    handle isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6845
	^ PackageNotFoundError raiseRequestWith:packageID.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6846
    ].
12744
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6847
"/    handle notNil ifTrue:[
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6848
"/        Transcript showCR:('    Smalltalk: loaded %1.' bindWith:libraryFilename pathName).
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  6849
"/    ].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  6850
    ^ true.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6851
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6852
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6853
     Smalltalk fileInClassLibrary:'libtable'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6854
     Smalltalk fileInClassLibrary:'binary/libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6855
     Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6856
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6857
13787
1695a24d0fa7 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 13785
diff changeset
  6858
    "Modified: / 08-10-2011 / 00:08:51 / cg"
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
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6861
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent
18560
a37464a68e70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18385
diff changeset
  6862
    "Try all available programming languages for a matching suffix"
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6863
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6864
    |filename|
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6865
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6866
    filename := filenameArg asFilename.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6867
"/    ProgrammingLanguage allDo:[:lang|
18572
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6868
"/        | f |
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6869
"/
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6870
"/        "/ cg: changed: did try all languages to load (eg. wether suffix matched or not.
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6871
"/        "/ I don't think, that is a good idea, as all of them languages might start parsing...
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6872
"/        (filename hasSuffix:lang sourceFileSuffix) ifTrue:[
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6873
"/            (self fileIn:f lazy:loadLazy silent:beSilent) ifTrue:[
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6874
"/                ^ true
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6875
"/            ].
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6876
"/        ]
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6877
"/    ].
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6878
"/ revert to old code to get stuff running again- please review - (autoload problems)
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6879
    ProgrammingLanguage allDo:[:lang| | f |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6880
	f := (filename hasSuffix:lang sourceFileSuffix)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6881
		    ifTrue:[filename]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6882
		    ifFalse:[filename addSuffix:lang sourceFileSuffix].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6883
	(self fileIn:f lazy:loadLazy silent:beSilent)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6884
		ifTrue:[^ true]
18572
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6885
    ].
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  6886
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  6887
    ^ false
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6888
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6889
    "Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6890
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6891
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6892
fileInStream:streamArg
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6893
    ^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6894
!
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
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6897
    "read sourceCode from aStream;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6898
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6899
     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
  6900
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6901
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6902
     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
  6903
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6904
     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
  6905
     Giving nil for silent/lazy will use the current settings.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6906
     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
  6907
     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
  6908
     using a relative path."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6909
11427
ac373ee02301 refactored
Claus Gittinger <cg@exept.de>
parents: 11400
diff changeset
  6910
    |inStream wasLazy wasSilent oldSystemPath oldRealPath|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6911
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6912
    inStream := streamArg.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6913
    inStream isNil ifTrue:[^ false].
19385
0c655478e4bd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19187
diff changeset
  6914
    inStream isLineNumberReadStream ifFalse:[
20588
04ef338c0179 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20572
diff changeset
  6915
        LineNumberReadStream notNil ifTrue:[
04ef338c0179 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20572
diff changeset
  6916
            "/ sigh - is in libbasic2, which is not always present
04ef338c0179 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20572
diff changeset
  6917
            inStream := LineNumberReadStream on:inStream.
04ef338c0179 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 20572
diff changeset
  6918
        ].
19385
0c655478e4bd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19187
diff changeset
  6919
    ].
12611
38d61d374d89 care for nonPositionable stream (stdin) in fileIn
Claus Gittinger <cg@exept.de>
parents: 12557
diff changeset
  6920
    inStream := EncodedStream isNil
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6921
                    ifTrue:[ inStream ]
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6922
                    ifFalse:[ EncodedStream decodedStreamFor:inStream ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6923
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6924
    lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6925
    silent notNil ifTrue:[wasSilent := self silentLoading:silent].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6926
    morePath notNil ifTrue:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6927
        oldSystemPath := SystemPath copy.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6928
        SystemPath addFirst:morePath.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6929
        oldRealPath := RealSystemPath.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6930
        RealSystemPath := nil.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6931
    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6932
    
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6933
    [
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6934
        (Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6935
            "JV: Changed to give ProgrammingLanguage to choose
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6936
             proper reader"
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6937
            (ProgrammingLanguage forStream: inStream) fileInStream: inStream
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6938
        ]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6939
    ] ensure:[
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6940
        morePath notNil ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6941
            "take care, someone could have changed SystemPath during fileIn!!"
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6942
            (SystemPath copyFrom:2) = oldSystemPath ifTrue:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6943
                SystemPath := oldSystemPath.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6944
                RealSystemPath := oldRealPath.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6945
            ] ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6946
                (oldSystemPath includes:morePath) ifFalse:[
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6947
                    SystemPath remove:morePath ifAbsent:[].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6948
                ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6949
                RealSystemPath := nil.
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6950
            ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6951
        ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6952
        lazy notNil ifTrue:[Compiler compileLazy:wasLazy].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6953
        silent notNil ifTrue:[self silentLoading:wasSilent].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  6954
        inStream close
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6955
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6956
    ^ true
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6959
     Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6960
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6961
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6962
    "Modified: / 05-11-1996 / 20:03:35 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  6963
    "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
  6964
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6965
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6966
isClassLibraryLoaded:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6967
    "return true, if a particular class library is already loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6968
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6969
    ObjectMemory
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6970
	binaryModuleInfo
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6971
	    do:[:entry |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6972
		   entry type == #classLibrary ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6973
		       entry libraryName = name ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6974
			  ^ true        "/ already loaded
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6975
		       ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6976
		   ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6977
	       ].
10641
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
    ^ false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6980
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6981
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6982
     Smalltalk isClassLibraryLoaded:'libstx_libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6983
     Smalltalk isClassLibraryLoaded:'libstx_libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6984
     Smalltalk isClassLibraryLoaded:'libstx_libboss'
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: / 23-08-2006 / 15:54:46 / 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
loadClassLibraryIfAbsent:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6991
    "dynamically load a classLibrary, if not already loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6992
     and the system supports dynamic loading.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6993
     Return true, if the library is loaded, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6994
     This entry is called without system specific filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6995
     extensions - it is portable among different architectures
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6996
     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
  6997
     are be present ..."
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
    (self isClassLibraryLoaded:name) ifTrue:[ ^ true ].  "/ already loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7000
    ^ self fileInClassLibrary:name
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
     Smalltalk loadClassLibraryIfAbsent:'libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7004
     Smalltalk loadClassLibraryIfAbsent:'libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7005
    "
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
    "Modified: 31.10.1996 / 16:57:24 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7008
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7009
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7010
secureFileIn:aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7011
    "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
  7012
     Catch various errors during fileIn.
13000
28bd279e2574 changed: #secureFileIn:
Stefan Vogel <sv@exept.de>
parents: 12919
diff changeset
  7013
     Return true if ok, false if failed"
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7014
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7015
    |retVal|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7016
16025
f8583a01459e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16013
diff changeset
  7017
    Parser isNil ifTrue:[^ false].      "/ for small stand alone apps.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7018
    retVal := false.
16025
f8583a01459e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16013
diff changeset
  7019
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7020
    (SignalSet
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7021
	with:AbortOperationRequest
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7022
	with:TerminateProcessRequest
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7023
	with:Parser parseErrorSignal)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7024
	    handle:[:ex | ex return ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7025
	    do:[ retVal := self fileIn:aFileName ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7026
    ^ retVal
10641
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
silentFileIn:aFilename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7030
    "same as fileIn:, but do not output 'compiled...'-messages on Transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7031
     Main use is during startup."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7032
13353
cf8d1605652f changed: #silentFileIn:
Stefan Vogel <sv@exept.de>
parents: 13323
diff changeset
  7033
    self silentlyLoadingDo:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7034
	self fileIn:aFilename
13353
cf8d1605652f changed: #silentFileIn:
Stefan Vogel <sv@exept.de>
parents: 13323
diff changeset
  7035
    ].
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7036
! !
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7037
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7038
!Smalltalk class methodsFor:'system management-files'!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7039
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7040
addIdeTopDirectoryToPackagePath
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7041
    "{ Pragma: +optSpace }"
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7042
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7043
    |topDirectory|
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7044
    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7045
    (topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7046
        topDirectory := topDirectory asFilename.
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7047
        (topDirectory directory / 'stc') exists ifTrue:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7048
            topDirectory := topDirectory directory.
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7049
        ] ifFalse:[    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7050
            (topDirectory directory directory / 'stc') exists ifTrue:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7051
                topDirectory := topDirectory directory directory.
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7052
            ] ifFalse:[    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7053
                (topDirectory directory directory directory / 'stc') exists ifTrue:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7054
                    topDirectory := topDirectory directory directory directory.
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7055
                ] ifFalse:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7056
                    topDirectory := nil
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7057
                ].    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7058
            ].    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7059
        ].    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7060
        topDirectory notNil ifTrue:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7061
            "/ one above "stx"
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7062
            topDirectory := topDirectory directory pathName. 
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7063
            (PackagePath includes:topDirectory) ifFalse:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7064
                PackagePath add:topDirectory
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7065
            ]    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7066
        ]    
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7067
    ].
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7068
!
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7069
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7070
addWorkspaceDirectoryToPackagePath
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7071
    "{ Pragma: +optSpace }"
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7072
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7073
    |workspaceDirectory|
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7074
    
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7075
    (workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7076
        (workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7077
            workspaceDirectory := workspaceDirectory pathName. 
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7078
            (PackagePath includes:workspaceDirectory) ifFalse:[
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7079
                PackagePath addFirst:workspaceDirectory
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7080
            ]    
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7081
        ]    
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7082
    ].
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7083
!
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7084
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7085
bitmapFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7086
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7087
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7088
     Searches in subdirectories named 'bitmaps' in the SystemPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7089
     Notice: this does not look in the package-specific bitmaps directories."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7090
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7091
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7092
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7093
    aString := self getBitmapFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7094
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7095
	^ aString asFilename readStreamOrNil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7096
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7097
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7098
!
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
bitmapFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7101
    "backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7102
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7103
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7104
     then in the classes own package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7105
     Return an image or nil."
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
    ^ self imageFromFileNamed:aFileName forClass:aClass
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 bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7111
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7112
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7113
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7114
bitmapFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7115
    "backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7116
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7117
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7118
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7119
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7120
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7121
    ^ self imageFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7122
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7123
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7124
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7125
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7126
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7127
!
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
classNameForFile:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7130
    "return the className which corresponds to an abbreviated fileName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7131
     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
  7132
     include a '.st' suffix (but no other)."
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
    |fn|
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
    (aFileName asFilename hasSuffix:'st') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7137
	fn := aFileName copyButLast:3
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7138
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7139
	fn := aFileName
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
    ^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn].
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7144
     Smalltalk classNameForFile:'DrawObj'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7145
     Smalltalk classNameForFile:'DrawObj.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7146
     Smalltalk classNameForFile:'ArrColl.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7147
     Smalltalk classNameForFile:'ArrColl.chg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7148
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7149
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7150
    "Modified: 11.12.1995 / 14:51:10 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7151
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7152
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7153
constructPathFor:aDirectoryName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7154
    "search for aDirectory in SystemPath;
20294
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7155
     return a collection of paths which include that directory."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7156
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7157
    ^ self realSystemPath select:[:dirName |
20294
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7158
        |fullPath|
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7159
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7160
        fullPath := dirName asFilename construct:aDirectoryName.
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7161
        "/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]]
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7162
        fullPath isDirectory and:[fullPath isReadable]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7163
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7164
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7165
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7166
fileInFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7167
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7168
     search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7169
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7170
     Searches in subdirectories named 'fileIn' in SystemPath"
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
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7173
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7174
    aString := self getFileInFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7175
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7176
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7177
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7178
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7179
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7180
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7181
fileNameForClass:aClassOrClassName
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7182
    "return a actual or expected (or most wanted) filename for aClassOrClassName
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7183
     - only the base name (without directory part) and without suffix."
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7184
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7185
    |cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg |
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7186
12301
5d077b04f6f0 changed: #fileNameForClass:
fm
parents: 12300
diff changeset
  7187
"/  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
  7188
"/  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
  7189
"/  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
  7190
"/  prerequisites in makefiles. But if you renamed such a stc-compiled class,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7191
"/  the filename remains the same, but SVN __ALWAYS__ keep container name
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7192
"/  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
  7193
"/  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
  7194
"/  Certainly a hack, but do not remove this until fixed elsewhere
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7195
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7196
    compatQuery := Smalltalk classNamed: 'SVN::CompatModeQuery'.
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7197
    (compatQuery notNil
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7198
      and:[compatQuery isLoaded
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7199
	and:[compatQuery query not]]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7200
	    nm := aClassOrClassName isBehavior
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7201
		ifTrue:[aClassOrClassName name]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7202
		ifFalse:[aClassOrClassName].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7203
	    nm := nm copyReplaceAll:$: with:$_ ifNone:nm.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7204
	    ^nm
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7205
    ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7206
16122
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  7207
    "/ 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
  7208
    "/ 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
  7209
    "/ 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
  7210
    "/ of classes OUTSIDE filed-out package when generating makefile dependencies.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7211
    compatQuery := Smalltalk classNamed: 'SCMCompatModeQuery'.
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7212
    (compatQuery notNil
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7213
      and:[compatQuery isLoaded
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7214
	and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7215
	    | compatPkgs |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7216
	    "/ Originally libscm could only fileout one package at time so
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7217
	    "/ the query answered one package name. However, to support nested
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7218
	    "/ packages, libscm is being rewritten to commit multiple packages
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7219
	    "/ at once, so query answers a collection of packages. The code below
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7220
	    "/ makes sure it works for both.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7221
	    compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7222
	    nm := aClassOrClassName isBehavior
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7223
		ifTrue:[aClassOrClassName name]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7224
		ifFalse:[aClassOrClassName].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7225
	    cls := Smalltalk at: nm asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7226
	    (cls notNil and:[compatPkgs includes: cls package]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7227
		nm := nm copyReplaceAll:$: with:$_.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7228
		^nm
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7229
	    ].
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7230
    ].
12301
5d077b04f6f0 changed: #fileNameForClass:
fm
parents: 12300
diff changeset
  7231
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7232
    aClassOrClassName isBehavior ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7233
	cls := aClassOrClassName.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7234
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7235
	cls := Smalltalk classNamed:aClassOrClassName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7236
	cls isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7237
	    nameWithPrefix := aClassOrClassName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7238
	    nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7239
	].
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7240
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7241
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7242
    cls notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7243
	nonMetaclass := cls theNonMetaclass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7244
	nm := nonMetaclass getClassFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7245
	nm isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7246
	    |revisionInfo|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7247
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7248
	    (revisionInfo := cls revisionInfo) notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7249
		nm := revisionInfo fileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7250
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7251
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7252
	nm notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7253
	    ^ nm asFilename withoutSuffix baseName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7254
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7255
	nameWithPrefix := nonMetaclass name.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7256
	nameWithoutPrefix := nonMetaclass nameWithoutPrefix.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7257
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7258
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7259
    CachedAbbreviations notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7260
	nameWithPrefix := nameWithPrefix asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7261
	(CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7262
	    ^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7263
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7264
	nameWithoutPrefix := nameWithoutPrefix asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7265
	(CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7266
	    ^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7267
	].
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7268
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7269
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7270
    ^ nameWithPrefix copyReplaceAll:$: with:$_
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7271
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7272
    "
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7273
     Smalltalk fileNameForClass:#Complex
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7274
     Smalltalk fileNameForClass:'SmallInteger'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7275
     Smalltalk fileNameForClass:'UnixOperatingSystem'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7276
     Smalltalk fileNameForClass:'Launcher'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7277
     Smalltalk fileNameForClass:'SomeUnknownClass'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7278
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7279
     Smalltalk fileNameForClass:HTML::Encoder
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7280
     Smalltalk fileNameForClass:OSI::FTAMOperation
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7281
     Smalltalk fileNameForClass:'OSI::Foobar'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7282
     Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons)
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7283
     Workflow::UnsuccessfulFinishReasons classFilename
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7284
    "
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7285
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7286
    "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
  7287
    "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
  7288
    "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
  7289
!
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7290
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7291
filenameAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7292
    "return a dictionary containing the classname-to-filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7293
     mappings. (needed for sys5.3 users, where filenames are limited
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7294
     to 14 chars)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7295
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7296
    CachedAbbreviations isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7297
	self readAbbreviations
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7298
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7299
    ^ CachedAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7300
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7301
    "flush with:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7302
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7303
     CachedAbbreviations := nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7304
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7305
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7306
     Smalltalk filenameAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7307
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7308
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7309
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7310
findPackageDirectoryForPackage:aPackage
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7311
    "find a packages directory along a number of standard places"
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7312
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7313
    |relDir|
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7314
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7315
    relDir := Smalltalk relativePackagePathForPackage:aPackage.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7316
    relDir asFilename isAbsolute ifTrue:[^ relDir].
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7317
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7318
    ^ Smalltalk getPackageFileName:relDir.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7319
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7320
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7321
     Smalltalk findPackageDirectoryForPackage:'stx:libview/resources'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7322
     Smalltalk findPackageDirectoryForPackage:'stx:libview'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7323
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7324
!
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7325
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7326
flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7327
    "{ Pragma: +optSpace }"
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
    "forget pathCaches - these are collections containing valid directory names,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7330
     where system files (resource, bitmaps etc.) are found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7331
     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
  7332
     the system is active, and those files should override the others
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7333
     (for example, if you created a private resource directory)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7334
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7335
    RealSystemPath := ResourcePath := SourcePath :=
15332
cc2fb912d04c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15315
diff changeset
  7336
    BinaryPath := FileInPath := nil.
cc2fb912d04c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15315
diff changeset
  7337
10641
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
     Smalltalk flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7340
    "
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7343
getBinaryFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7344
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7345
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7346
     (subdirectories named 'binary' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7347
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7348
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7349
    BinaryPath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7350
	BinaryPath := self constructPathFor:BinaryDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7351
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7352
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7353
    ^ self searchPath:BinaryPath for:aFileName in:BinaryDirName
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
    "Modified: 18.7.1996 / 15:53:49 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7356
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7357
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7358
getBitmapFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7359
    "for backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7360
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7361
     (subdirectories named 'bitmaps' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7362
     Return the pathName or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7363
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7364
    ^ self getBitmapFileName:aFileName forPackage:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7365
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7366
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7367
     Smalltalk getBitmapFileName:'SBrowser.xbm'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7368
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7369
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7370
    "Modified: 18.7.1996 / 15:53:55 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7371
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7372
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7373
getBitmapFileName:aFileName forPackage:aPackageIDOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7374
    "for backward compatibility.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7375
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7376
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7377
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7378
     Return a path or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7379
     Search order is:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7380
	bitmaps/<pkg>/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7381
	resources/<pkg>/bitmaps/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7382
	<pkg>/bitmaps/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7383
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7384
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7385
    |f dir packageDir pF|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7386
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  7387
    f := aFileName asString withoutPrefix:'bitmaps/'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7388
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7389
    aPackageIDOrNil isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7390
	"/ this will be an error in the future
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7391
"/        'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7392
"/        self halt.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7393
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7394
	pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps').
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7395
	pF notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7396
	    ^ pF.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7397
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7398
	f ~= aFileName ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7399
	    pF := self searchPath:(self realSystemPath) for:f in:('bitmaps').
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7400
	    pF notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7401
		^ pF.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7402
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7403
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7404
	^ nil
11077
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7405
    ].
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7406
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7407
    dir := self projectDirectoryForPackage:aPackageIDOrNil.
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7408
    dir notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7409
	pF := dir asFilename / f.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7410
	pF exists ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7411
	    ^ pF.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7412
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7413
	pF := dir asFilename / 'bitmaps' /f.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7414
	pF exists ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7415
	    ^ pF.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7416
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7417
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7418
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7419
    packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7420
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7421
    pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7422
    pF notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7423
	^ pF.
10641
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
    pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir,'/bitmaps').
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7426
    pF notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7427
	^ pF.
11077
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7428
    ].
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7429
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7430
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7431
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7432
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7433
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7434
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7435
     Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7436
     Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg'
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
    "Modified: / 11-10-2006 / 13:53:18 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7440
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7441
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7442
getFileInFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7443
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7444
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7445
     (subdirectories named 'fileIn' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7446
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7447
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7448
    FileInPath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7449
	FileInPath := self constructPathFor:FileInDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7450
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7451
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7452
    ^ self searchPath:FileInPath for:aFileName in:FileInDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7453
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7454
    "Modified: 18.7.1996 / 15:53:59 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7455
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7456
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7457
getPackageDirectoryForPackage:aPackageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7458
    "search for a particular package; return its directory, or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7459
     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
  7460
19121
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7461
    |packageId checkForPackageDirectory module packageSubDirectory|
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7462
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7463
    packageId := aPackageID asPackageId.
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7464
    module := packageId module.
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7465
    packageSubDirectory := packageId directory.
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
    checkForPackageDirectory :=
19121
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7468
        [:moduleDir |
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7469
            |packageDir|
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7470
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7471
            moduleDir isDirectory ifTrue:[
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7472
                packageDir := moduleDir / packageSubDirectory.
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7473
                packageDir isDirectory ifTrue:[
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7474
                    ^ packageDir
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7475
                ]
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7476
            ].
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7477
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7478
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7479
    self packagePath do:[:aPath |
19121
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7480
        |moduleDir|
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7481
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7482
        moduleDir := aPath asFilename / module.
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7483
        checkForPackageDirectory value:moduleDir.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7484
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7485
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7486
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7487
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7488
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7489
     Smalltalk getPackageDirectoryForPackage:(Array package)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7490
     Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7491
     Smalltalk getPackageDirectoryForPackage:'stx:libview'
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
    "Modified: / 06-10-2006 / 11:49:27 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7495
!
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
getPackageFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7498
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7499
     (packagePath and subdirectories named 'packages' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7500
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7501
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7502
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7503
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7504
    "/ search along packagePath ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7505
    f := self searchPath:self packagePath for:aFileName in:nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7506
    f isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7507
	"/ search under packages-directory along systemPath ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7508
	f := self searchPath:self realSystemPath for:aFileName in:PackageDirName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7509
	"/ kludge - allow for stx-directory to be named differently
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7510
	f isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7511
	    (aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7512
		f := '..' asFilename / '..' / (aFileName copyFrom:5).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7513
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7514
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7515
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7516
    (f notNil and:[(f := f asFilename) exists]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7517
	^ f pathName
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7518
    ].
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7519
    ^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7520
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7521
    "
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7522
     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
  7523
     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
  7524
     Smalltalk getPackageFileName:'stx/libview/source.zip'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7525
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7526
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7527
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7528
getPackageSourceFileName:filenameWithoutSuffixArg
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7529
    "search aFileName in some standard places and try all available languages"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7530
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7531
    |filenameWithoutSuffix|
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7532
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7533
    filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename.
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7534
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7535
    ProgrammingLanguage
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7536
	allDo:[:lang |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7537
	    |file|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7538
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7539
	    file := self
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7540
		    getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7541
	    file notNil ifTrue:[ ^ file ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7542
	].
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7543
    ^ nil
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7544
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7545
    "Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7546
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7547
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7548
getResourceFileName:aFileName
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7549
    <resource: #obsolete>
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7550
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7551
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7552
     (subdirectories named 'resources' in SystemPath);
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7553
     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
  7554
     Obsolete: you must now provide a package argument."
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7555
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7556
    self obsoleteMethodWarning:'use getResourceFileName:forPackage:'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7557
    ^ self getResourceFileName:aFileName forPackage:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7558
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
     Smalltalk getResourceFileName:'SystemBrowser.rs'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7561
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7562
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7563
    "Modified: 18.7.1996 / 15:54:03 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7566
getResourceFileName:aFileName forClass:aClassOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7567
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7568
     (subdirectories named 'resource' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7569
     and in aClasses package directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7570
     Return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7571
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7572
    |pkgOrNil|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7573
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7574
    aClassOrNil notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7575
	pkgOrNil := aClassOrNil package.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7576
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7577
    ^ self getResourceFileName:aFileName forPackage:pkgOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7578
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7579
    "
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7580
     Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7581
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7582
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7583
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7584
getResourceFileName:aFileName forPackage:aPackageIDOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7585
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7586
     (subdirectories named 'resource' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7587
     and in a packages directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7588
     Return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7589
     Search order is:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7590
	resources/<pkg>/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7591
	<pkg>/resources/file
10641
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7594
    |pF f dir packageDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7595
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  7596
    f := aFileName asString withoutPrefix:'resources/'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7597
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7598
    aPackageIDOrNil isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7599
	"/ this will be an error in the future
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7600
"/        'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7601
"/        self halt.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7602
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7603
	pF := self searchPath:(self realSystemPath) for:aFileName in:('resources').
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7604
	pF notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7605
	    ^ pF.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7606
	].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7607
"/        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
  7608
"/        pF notNil ifTrue:[
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7609
"/            ^ pF.
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7610
"/        ].
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7611
	f ~= aFileName ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7612
	    pF := self searchPath:(self realSystemPath) for:f in:('resources').
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7613
	    pF notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7614
		^ pF.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7615
	    ].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7616
"/            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
  7617
"/            pF notNil ifTrue:[
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7618
"/                ^ pF.
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7619
"/            ].
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7620
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7621
	^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7622
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7623
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7624
    packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/.
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
    pF := self searchPath:(self realSystemPath) for:aFileName in:('resources/',packageDir).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7627
    pF notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7628
	^ pF.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7629
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7630
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7631
    "/ 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
  7632
    dir := self projectDirectoryForPackage:aPackageIDOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7633
    dir notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7634
	dir := dir asFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7635
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7636
	(pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7637
"/        (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7638
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7639
	"resolve something like: 'ASN/definition.asn1'"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7640
	(pF := dir / f) exists ifTrue:[ ^ pF name ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7641
    ].
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7642
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7643
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7644
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7645
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7646
     Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7647
     Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview'
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7648
     Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview'
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7649
     Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7650
     Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7651
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7652
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7653
    "Modified: / 11-10-2006 / 13:53:43 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7656
getSourceFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7657
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7658
     (subdirectories named 'source' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7659
     return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7660
     This is used to find a sourceFile for a methods source,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7661
     if no sourceCodeManager is available."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7662
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7663
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7664
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7665
    SourcePath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7666
	SourcePath := self constructPathFor:SourceDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7667
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7668
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7669
    "/ first, try a source subdir along the path.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7670
    SourcePath notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7671
	f := self searchPath:SourcePath for:aFileName in:SourceDirName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7672
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7673
    f isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7674
	"/ then, try it itself along the path.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7675
	f := self searchPath:self realSystemPath for:aFileName in:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7676
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7677
    ^ f
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7678
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7679
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7680
     Smalltalk getSourceFileName:'Smalltalk.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7681
     Smalltalk getSourceFileName:'ArrColl.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7682
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7683
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7684
    "Modified: 18.7.1996 / 15:54:07 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7685
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7686
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7687
getSystemFileName:aFileNameOrString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7688
    "search aFileNameOrString in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7689
     return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7690
     see comment in Smalltalk>>initSystemPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7691
     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
  7692
     and other help files.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7693
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7694
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7695
    "credits for this method go to Markus ...."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7696
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7697
    |fn nameString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7698
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7699
    fn := aFileNameOrString asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7700
    nameString := fn name.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7701
    fn isAbsolute ifTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7702
        "don't use path for absolute file names"
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7703
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7704
        ^ nameString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7705
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7706
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7707
    self realSystemPath do:[:dirName |
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7708
        |realName|
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7709
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7710
        realName := dirName asFilename / nameString.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7711
        "/
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7712
        "/ here, we also return true if its a directory
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7713
        "/ (Even if unreadable).
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7714
        "/ It could be that the file itself is still readable.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7715
        "/
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7716
        (realName isDirectory or:[realName isReadable]) ifTrue: [
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7717
            ^ realName name
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  7718
        ]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7719
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7720
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7721
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7722
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7723
     Smalltalk getSystemFileName:'doc/online/english/TOP.html'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7724
     Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7725
     Smalltalk getSystemFileName:'bitmaps/foo'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7726
     Smalltalk getSystemFileName:'resources/View.rs'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7727
     Smalltalk getSystemFileName:'resources/iris.style'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7728
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7729
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7730
    "Modified: / 6.5.1999 / 10:40:37 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7731
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7732
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7733
imageFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7734
    "search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7735
     first in the redefinable bitmaps path, then in the classes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7736
     own package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7737
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7738
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7739
    |classPackage img|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7740
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7741
    classPackage := aClass package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7742
    img := self imageFromFileNamed:aFileName inPackage:classPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7743
    img isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7744
	"/ try under the goodies package ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7745
	classPackage ~= 'stx:goodies' ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7746
	    img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7747
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7748
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7749
    ^ img
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7750
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7751
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7752
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7753
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7754
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7755
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7756
imageFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7757
    "search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7758
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7759
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7760
     Return an image or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7761
     Search order is:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7762
	bitmaps/<pkg>/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7763
	resources/<pkg>/bitmaps/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7764
	<pkg>/bitmaps/file
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7767
    |path|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7768
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7769
    path := self getBitmapFileName:aFileName forPackage:aPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7770
    path notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7771
	^ Image fromFile:path.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7772
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7773
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7774
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7775
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7776
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7777
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7778
     Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7779
     Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7780
     Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7781
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7782
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7783
    "Modified: / 08-09-2006 / 18:02:04 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7784
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7785
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7786
libraryFileNameOfClass:aClassOrClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7787
    "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
  7788
     binary code for it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7789
     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
  7790
     for an entry for aClassOrClassName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7791
     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
  7792
     the 2nd col.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7793
     Return nil if no entry is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7794
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7795
     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
  7796
     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
  7797
     Otherwise, the returned name is the classLibrary object of that class.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7798
     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
  7799
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7800
    |aStream line words n aClassName|
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
    aClassOrClassName isBehavior ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7803
	aClassName := aClassOrClassName name
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7804
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7805
	aClassName := aClassOrClassName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7806
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7807
    aClassName := aClassName asString.
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
    #('include/liblist.stc')    "/ filenames
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7810
    with:#(2)                   "/ column
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7811
    do:[:fileName :col |
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7812
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7813
	aStream := self systemFileStreamFor:fileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7814
	aStream notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7815
	    [aStream atEnd] whileFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7816
		line := aStream nextLine.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7817
		line notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7818
		    (line startsWith:'#') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7819
			words := line asCollectionOfWords.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7820
			(n := words size) > 1 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7821
			    (words at:1) = aClassName ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7822
				n >= col ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7823
				    aStream close.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7824
				    ^ (words at:col) withoutSeparators
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7825
				]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7826
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7827
			]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7828
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7829
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7830
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7831
	    aStream close
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7832
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7833
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7834
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7835
    ^ nil
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7838
     Smalltalk libraryFileNameOfClass:'ClockView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7839
     Smalltalk libraryFileNameOfClass:'Bag'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7840
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7841
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7842
    "Modified: 6.11.1995 / 15:41:39 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7845
packagePath
15781
3185deb3a8d2 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15766
diff changeset
  7846
    "return a collection of additional directory names, where smalltalk
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7847
     looks for package directories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7848
     Notice, that directories named 'packages' under the systemPath are
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7849
     always consulted - even if not in the packagePath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7850
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
  7851
    ^ PackagePath ? #()
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7852
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7853
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7854
     Smalltalk packagePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7855
     Smalltalk packagePath addLast:'/opt/smalltalk'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7856
     Smalltalk packagePath addFirst:'/usr/local/otherPackages'
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
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7859
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7860
packagePath:aPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7861
    "set the packagePath;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7862
     a collection of additional directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7863
     looks for package directories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7864
     Notice, that directories named 'packages' under the systemPath are
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7865
     always consulted - even if not in the packagePath"
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
    PackagePath := aPath asOrderedCollection
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7868
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
     Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages')
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
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7873
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7874
projectDirectoryForClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7875
    "given a class, return the path to its package directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7876
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7877
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7878
    |pkg|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7879
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7880
    pkg := aClass package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7881
    pkg isNil ifTrue:[^ nil].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7882
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7883
    ^ self projectDirectoryForPackage:pkg.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7884
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
     Smalltalk projectDirectoryForClass:Array
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7887
     Smalltalk projectDirectoryForClass:View
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
!
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
projectDirectoryForPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7892
    "given a packageID, return the path to its package directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7893
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7894
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7895
    |prj prjDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7896
16642
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  7897
    ^ aPackage asPackageId packageDirectory.
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  7898
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7899
    "/ there might be a package specific resource directory ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7900
    "/ in the directory, from which the project was loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7901
    prj := Project projectWithId:aPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7902
    prj notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7903
	prjDir := prj directory.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7904
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7905
    (prjDir notNil and:[prjDir asFilename exists]) ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7906
	prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/).
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7907
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7908
    ^ prjDir
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
    "
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7911
     Smalltalk projectDirectoryForPackage:'stx:libbasic'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7912
     Smalltalk projectDirectoryForPackage:'exept:smartcard'
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7913
     Smalltalk projectDirectoryForPackage:'stx'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7914
     Smalltalk projectDirectoryForPackage:'bosch'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7915
     Smalltalk projectDirectoryForPackage:'bosch:foo'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7916
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7917
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7918
    "Modified: / 07-10-2006 / 17:45:58 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7921
readAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7922
    "read classname to filename mappings from include/abbrev.stc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7923
     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
  7924
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7925
    "since installAutoloadedClasses also reads all abbreviations, use it"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7926
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7927
    CachedAbbreviations := IdentityDictionary new.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7928
    self installAutoloadedClasses.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7929
    ^ CachedAbbreviations.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7930
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7931
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7932
     Smalltalk readAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7933
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7934
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7935
    "Modified: / 10.12.1999 / 17:48:53 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7938
readAbbreviationsFromStream:aStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7939
    "read classname to filename mappings from aStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7940
     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
  7941
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  7942
    self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7943
	withAbbreviationsFromStream:aStream
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7944
	do:[:className :abbrev :pkg |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7945
	    self setFilename:abbrev forClass:className package:pkg.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7946
	].
10641
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
    "Modified: / 13.12.1999 / 11:54:17 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7949
!
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
realSystemPath
16642
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  7952
    "return the realSystemPath - that's the directory names from
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7953
     SystemPath which exist and are readable"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7954
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7955
    |nP|
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
    RealSystemPath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7958
	OperatingSystem isVMSlike ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7959
	    "/ temporary kludge: since we cannot currently
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7960
	    "/ check for existence of a name like 'volume:',
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7961
	    "/ leave those in the Path without a check.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7962
	    RealSystemPath := SystemPath select:[:dirName |  |f|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7963
		f := dirName asFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7964
		f isVolumeOnly or:[(f isDirectory) and:[f isReadable]]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7965
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7966
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7967
	    RealSystemPath := SystemPath
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7968
		select:[:eachDirectoryName |  |f|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7969
		    f := eachDirectoryName asFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7970
		    (f isDirectory) and:[f isReadable]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7971
		] thenCollect:[:eachDirectoryName|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7972
		    eachDirectoryName asFilename pathName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7973
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7974
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7975
	    "/ remove duplicates (but keep order)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7976
	    nP := OrderedCollection new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7977
	    RealSystemPath do:[:p |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7978
		(nP includes:p) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7979
		    nP add:p
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7980
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7981
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7982
	    (nP includes:'.') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7983
		nP add:'.'
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7984
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7985
	    RealSystemPath := nP.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7986
	].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7987
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  7988
    ^ RealSystemPath
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7989
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7990
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7991
recursiveReadAllAbbreviationsFrom:aDirectory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7992
    self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7993
!
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
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7996
    "read all abbreviations from and under aDirectory."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7997
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7998
    |abbrevStream dir directoryContents|
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
    maxLevels == 0 ifTrue:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8001
"/        'Smalltalk [warning]: max directory nesting reached.' infoPrintCR.
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8002
        ^ self
10641
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8005
    dir := aDirectory asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8006
    dir exists ifFalse:[^ self].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8007
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8008
    [
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8009
        abbrevStream := (dir / 'abbrev.stc') asFilename readStream.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8010
        self readAbbreviationsFromStream:abbrevStream.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8011
        abbrevStream close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8012
    ] on:FileStream openErrorSignal do:[:ex| "ignore this file"].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8013
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8014
    [
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8015
        directoryContents := dir directoryContents.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8016
    ] on:FileStream openErrorSignal do:[:ex|
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8017
        "non-accessible directory: we are done"
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8018
        ^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8019
    ].
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
    directoryContents do:[:aFilename |
19117
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8022
        |f|
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8023
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8024
        (#(
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8025
            'doc'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8026
            'CVS'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8027
            'bitmaps'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8028
            'resources'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8029
            'source'
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8030
        ) includes:aFilename) ifFalse:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8031
            f := dir / aFilename.
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8032
            f isDirectory ifTrue:[
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8033
                self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8034
            ]
e0cde133ba64 #DOCUMENTATION
mawalch
parents: 19014
diff changeset
  8035
        ].
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  8036
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8037
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8038
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8039
reinitializePackagePath
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8040
    "{ Pragma: +optSpace }"
20207
17e32d469ac6 #OTHER by mawalch
mawalch
parents: 20161
diff changeset
  8041
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8042
    PackagePath notNil ifTrue:[
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  8043
        PackagePath := PackagePath select:[:p | p asFilename exists].
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8044
    ].
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8045
    PackagePath isEmptyOrNil ifTrue:[
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  8046
        PackagePath := OperatingSystem defaultPackagePath
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  8047
    ].
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  8048
    self addWorkspaceDirectoryToPackagePath.
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8049
!
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8050
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8051
relativePackagePathForPackage:aPackage
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8052
    |path|
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8053
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8054
    PackageToPathMapping notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8055
	path := PackageToPathMapping at:aPackage ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8056
	PackageToPathMapping notNil ifTrue:[^ path].
13370
Claus Gittinger <cg@exept.de>
parents: 13368
diff changeset
  8057
    ].
Claus Gittinger <cg@exept.de>
parents: 13368
diff changeset
  8058
    ^ aPackage copyReplaceAll:$: with:$/.
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8059
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8060
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8061
     PackageToPathMapping := Dictionary new.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8062
     PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8063
     PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8064
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8065
     Smalltalk relativePackagePathForPackage:'stx:libview/resources'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8066
     Smalltalk relativePackagePathForPackage:'stx:libview'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8067
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8068
!
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8069
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8070
resourceDirectoryForPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8071
    "given a packageID, return the path to its resource directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8072
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8073
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8074
    |prjDir rsrcDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8075
11183
9a4e7475a655 care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents: 11174
diff changeset
  8076
    aPackage notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8077
	prjDir := self projectDirectoryForPackage:aPackage.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8078
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8079
	(prjDir notNil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8080
	and:[(prjDir := prjDir asFilename) exists
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8081
	and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8082
	    ^ rsrcDir
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8083
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8084
	rsrcDir := self getSystemFileName:('resources/' , (aPackage copyReplaceAll:$: with:$/)).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8085
	rsrcDir notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8086
	    ^ rsrcDir asFilename
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8087
	].
10641
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
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8090
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
     Smalltalk resourceDirectoryForPackage:'stx:libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8093
     Smalltalk resourceDirectoryForPackage:'exept:expecco'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8094
     Smalltalk resourceDirectoryForPackage:'exept:smartcard'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8095
    "
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8098
resourceFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8099
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8100
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8101
     Searches in subdirectories named 'resource' in SystemPath"
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
    ^ self resourceFileStreamFor:aFileName forClass:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8104
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8105
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8106
resourceFileStreamFor:aFileName forClass:aClassOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8107
    "search aFileName in some standard places and in the classes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8108
     package-resource directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8109
     Return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8110
     Searches in subdirectories named 'resource' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8111
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8112
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8113
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8114
    aString := self getResourceFileName:aFileName forClass:aClassOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8115
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8116
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8117
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8118
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8119
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8120
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8121
searchPath:aPath for:aFileName in:aDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8122
    "search aPath for a subdirectory named aDirectory with a file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8123
     named aFileName"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8124
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8125
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8126
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8127
    ((f := aFileName asFilename) isAbsolute
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8128
    or:[f isExplicitRelative]) ifTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8129
        "/
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8130
        "/ don't use path for absolute or explicit .-relative file names
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8131
        "/
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8132
        ^ aFileName
10641
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8135
    aPath notNil ifTrue:[
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8136
        aPath do:[:dirName |
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8137
            |realName dir|
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8138
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8139
            dir := dirName asFilename.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8140
            aDirName notNil ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8141
                realName := dir / aDirName / aFileName.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8142
            ] ifFalse:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8143
                realName := dir / aFileName.
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8144
            ].
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8145
            (realName isReadable) ifTrue:[
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8146
                ^ realName name
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8147
            ]
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  8148
        ].
11108
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8149
    ].
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8150
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8151
"/ not needed - executing dir is always in SearchPath
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  8152
"/    realName := Filename currentDirectory / aFileName.
11108
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8153
"/    (realName isReadable) ifTrue:[
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8154
"/        ^ realName name
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8155
"/    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8156
    ^ nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8157
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8158
    "Modified: / 29.4.1999 / 15:06:43 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8159
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8160
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8161
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8162
    |classNameSymbol oldAbbrev oldPath newPath cls abbrevs|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8163
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8164
    CachedAbbreviations isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8165
	CachedAbbreviations := IdentityDictionary new.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8166
    ].
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
    abbrevs := CachedAbbreviations.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8169
    aClassNameString ~= aFileNameString ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8170
	classNameSymbol := aClassNameString asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8171
	oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8172
	oldAbbrev notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8173
	    oldAbbrev ~= aFileNameString ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8174
		oldAbbrev asFilename isAbsolute
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8175
		    ifTrue:[ oldPath := oldAbbrev ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8176
		    ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8177
		aFileNameString asFilename isAbsolute
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8178
		    ifTrue:[ newPath := aFileNameString ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8179
		    ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8180
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8181
		oldPath ~= newPath ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8182
		    StandAlone ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8183
			('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8184
			('Smalltalk [info]: old: ',oldPath) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8185
			('Smalltalk [info]: new: ',newPath) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8186
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8187
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8188
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8189
	    "overwrite old abbreviation with new one,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8190
	     to allow fixing of bad abbrev files"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8191
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8192
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8193
	cls := self classNamed:aFileNameString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8194
	cls notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8195
	    cls name ~= aClassNameString ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8196
		"/ ok, there is a class named after this abbrev ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8197
		"/ this is only a conflict, if the other class has no
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8198
		"/ abbreviation (or the same).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8199
		(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8200
		    cls isNameSpace ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8201
			aPackageNameString = cls package ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8202
			    StandAlone ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8203
				('Smalltalk [warning]: conflict for: ' , cls name ,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8204
				    ' in package ' , aPackageNameString) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8205
				('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8206
				    , ')') infoPrintCR
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8207
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8208
			]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8209
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8210
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8211
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8212
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8213
	abbrevs at:classNameSymbol put:aFileNameString.
8470
d79e917d4f36 Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents: 8445
diff changeset
  8214
    ]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8215
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8216
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8217
sourceDirectoryNameOfClass:aClassOrClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8218
    "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
  8219
     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
  8220
     for an entry for aClassOrClassName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8221
     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
  8222
     the 3rd col.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8223
     Return nil if no entry is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8224
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8225
    |aStream line words n aClassName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8226
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8227
    aClassOrClassName isBehavior ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8228
	aClassName := aClassOrClassName name
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8229
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8230
	aClassName := aClassOrClassName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8231
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8232
    aClassName := aClassName asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8233
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8234
    #('include/abbrev.stc' 'include/liblist.stc')    "/ filenames
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8235
    with:#(3 2)                   "/ column
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8236
    do:[:fileName :col |
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8237
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8238
	aStream := self systemFileStreamFor:fileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8239
	aStream notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8240
	    [aStream atEnd] whileFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8241
		line := aStream nextLine.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8242
		line notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8243
		    (line startsWith:'#') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8244
			words := line asCollectionOfWords.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8245
			(n := words size) > 1 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8246
			    (words at:1) = aClassName ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8247
				n >= col ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8248
				    aStream close.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8249
				    ^ (words at:col) withoutSeparators
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8250
				]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8251
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8252
			]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8253
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8254
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8255
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8256
	    aStream close
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8257
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8258
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8259
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8260
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8261
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8262
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8263
     Smalltalk sourceDirectoryNameOfClass:'ClockView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8264
     Smalltalk sourceDirectoryNameOfClass:'Bag'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8265
     Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8266
     Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8267
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8268
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8269
    "Created: 6.11.1995 / 15:43:30 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8270
    "Modified: 9.12.1995 / 23:54:14 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8271
    "Modified: 3.1.1997 / 11:26:44 / stefan"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8272
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8273
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8274
sourceFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8275
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8276
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8277
     Searches in subdirectories named 'source' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8278
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8279
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8280
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8281
    aString := self getSourceFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8282
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8283
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8284
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8285
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8286
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8287
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8288
systemFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8289
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8290
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8291
     see comment in Smalltalk>>initSystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8292
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8293
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8294
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8295
    aString := self getSystemFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8296
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8297
	^ aString asFilename readStreamOrNil
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8298
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8299
    ^ nil
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8300
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8301
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8302
systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8303
    "return a collection of directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8304
     looks for system files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8305
     (usually in subdirs such as resources, bitmaps, source etc.)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8306
     see comment in Smalltalk>>initSystemPath."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8307
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
  8308
    ^ SystemPath ? #()
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8309
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8310
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8311
     Smalltalk systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8312
     Smalltalk systemPath addLast:'someOtherDirectoryPath'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8313
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8314
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8315
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8316
systemPath:aPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8317
    "set the collection of directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8318
     looks for system files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8319
     (usually in subdirs such as resources, bitmaps, source etc.)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8320
     see comment in Smalltalk>>initSystemPath."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8321
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8322
    SystemPath := aPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8323
    self flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8324
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8325
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8326
     Smalltalk systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8327
     Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath')
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8328
    "
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8329
!
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8330
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8331
withAbbreviationsFromStream:aStream do:aBlock
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8332
    "read classname to filename mappings from aStream.
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8333
     Evaluate aBlock for each tuple:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8334
	class-name , abbrev-name, package
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8335
     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
  8336
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8337
    |line lineNo words nm abbrev pkg category size s w|
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8338
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8339
    lineNo := 0.
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8340
    [aStream atEnd] whileFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8341
	line := aStream nextLine.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8342
	lineNo := lineNo + 1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8343
	line notEmptyOrNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8344
	    (line startsWith:'#') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8345
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8346
		"/ must do it manually, caring for quoted strings.
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8347
"/                words := line asCollectionOfWords.
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8348
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8349
		words := OrderedCollection new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8350
		s := line readStream.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8351
		[s atEnd] whileFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8352
		    s skipSeparators.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8353
		    s peek == $' ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8354
			s next.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8355
			w := s upTo:$'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8356
			s skipSeparators.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8357
		    ] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8358
			w := s upToSeparator
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8359
		    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8360
		    words add:w
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8361
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8362
		words size >= 3 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8363
		    nm := (words at:1) withoutSeparators.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8364
		    abbrev := (words at:2) withoutSeparators.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8365
		    pkg := (words at:3) withoutSeparators.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8366
		    aBlock argumentCount = 3 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8367
			aBlock value:nm value:abbrev value:pkg.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8368
		    ] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8369
			words size >= 4 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8370
			    category := words at:4.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8371
			].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8372
			words size = 5 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8373
			    size := (words at:5) asNumber
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8374
			].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8375
			aBlock value:nm value:abbrev value:pkg value: category value: size
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8376
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8377
		] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8378
		    ('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8379
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8380
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8381
	]
13518
b81bc64782b1 not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents: 13506
diff changeset
  8382
    ].
b81bc64782b1 not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents: 13506
diff changeset
  8383
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8384
    "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
  8385
    "Modified: / 04-08-2011 / 21:35:00 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8386
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8387
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8388
!Smalltalk class methodsFor:'system management-packages'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8389
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8390
isPackageLoaded:aPackageIdOrPackage
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8391
    |projectDefinition|
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8392
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8393
    projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass.
16161
195f2580fa6c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16159
diff changeset
  8394
    ^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]]
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8395
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8396
    "
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8397
     Smalltalk isPackageLoaded:'stx:goodies/persistency'
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8398
     Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8399
     Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling'
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8400
    "
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8401
!
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8402
20898
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8403
knownLoadablePackagesDo:aBlock
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8404
    "enumerate loadable packages from the packages folder."
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8405
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8406
    Smalltalk realSystemPath do:[:dirName |
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8407
        |packageDir|
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8408
        
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8409
        packageDir := dirName asFilename / 'packages'.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8410
        (packageDir exists and:[packageDir isDirectory]) ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8411
            packageDir directoryContentsAsFilenames sort do:[:fn |
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8412
                |item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded 
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8413
                 defClass target type nameComponents packageName packageID|
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8414
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8415
                ((fn suffix = 'mcz') 
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8416
                or:[ fn isDirectory   
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8417
                or:[ (fn baseName startsWith:'.')   
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8418
                or:[ (fn baseName = 'README') ]]]) ifFalse:[    
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8419
                    base := fn withoutSuffix baseName.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8420
                    (base startsWith:'lib') ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8421
                        nm := (base copyFrom:4).
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8422
                        fn suffix notEmptyOrNil ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8423
                            type := #library.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8424
                        ] ifFalse:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8425
                            type := #application.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8426
                        ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8427
                    ] ifFalse:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8428
                        nm := base.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8429
                        type := #application.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8430
                    ].
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8431
20899
e81f16882160 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20898
diff changeset
  8432
                    (base ~= 'librun') ifTrue:[
20898
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8433
                        (fn suffix = 'mcz') ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8434
                            packageName := fn withoutSuffix.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8435
                            target := fn.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8436
                        ] ifFalse:[ 
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8437
                            ( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8438
                                (base startsWith:'lib') ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8439
                                    nm := base copyFrom:4.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8440
                                ] ifFalse:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8441
                                    nm := base.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8442
                                ].    
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8443
                            ]. 
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8444
                            nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8445
                            packageName := nameComponents first.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8446
                            nameComponents size > 1 ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8447
                                packageName := packageName,':',((nameComponents from:2) asStringWith:'/')
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8448
                            ]. 
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8449
                        ].
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8450
                        packageName notNil ifTrue:[
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8451
                            aBlock value:packageName value:type value:fn .
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8452
                        ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8453
                    ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8454
                ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8455
            ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8456
        ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8457
    ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8458
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8459
    "
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8460
     Smalltalk knownLoadablePackagesDo:[:packageID :type :path |
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8461
         Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path.
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8462
     ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8463
    "
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8464
!
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8465
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8466
loadPackage:aPackageIdOrPackage
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8467
    "make certain, that some particular package is loaded into the system.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8468
     Return true if loaded, false otherwise."
11668
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8469
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8470
    ^ self loadPackage:aPackageIdOrPackage asAutoloaded:false
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8471
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8472
    "
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8473
     Smalltalk loadPackage:'stx:libbasic'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8474
     Smalltalk loadPackage:'stx:goodies/persistency'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8475
     Smalltalk loadPackage:'cg:cparser'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8476
     Smalltalk loadPackage:'cg:rose'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8477
    "
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8478
!
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8479
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8480
packageDirectoryForPackageId:aPackageId
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8481
    "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
  8482
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8483
     Notice that the directory structure is different between the development
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8484
     environment (top for packages is ../../../stx) and delivered stand alone executables,
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8485
     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
  8486
     At runtime, Smalltalk knows about the systemPath setting."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8487
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8488
    |packageDirName packageDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8489
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  8490
    packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8491
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8492
    packageDir := self getPackageFileName:packageDirName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8493
    packageDir isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8494
	^ nil.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8495
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8496
    ^ packageDir asFilename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8497
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8498
    "
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  8499
     Smalltalk packageDirectoryForPackageId:'stx:libbasic'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8500
     Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8501
     Smalltalk packageDirectoryForPackageId:'exept:ctypes'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8502
    "
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8503
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8504
18794
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8505
requirePackage:aPackageIdOrPackage
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8506
    "make certain, that some particular package is loaded into the system.
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8507
     Return true if loaded, false otherwise.
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8508
     Just an alias which is easier to remember"
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8509
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8510
    ^ self loadPackage:aPackageIdOrPackage
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8511
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8512
    "
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8513
     Smalltalk loadPackage:'stx:libbasic'
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8514
     Smalltalk loadPackage:'stx:goodies/persistency'
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8515
     Smalltalk loadPackage:'cg:cparser'
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8516
     Smalltalk loadPackage:'cg:rose'
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8517
    "
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8518
!
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8519
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8520
unloadPackage:aPackageIdOrPackage
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8521
    |projectDefinition|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8522
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8523
    projectDefinition := aPackageIdOrPackage.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8524
    projectDefinition isProjectDefinition ifFalse:[
20603
4159bb976528 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20588
diff changeset
  8525
        projectDefinition := projectDefinition asPackageId projectDefinitionClass.
4159bb976528 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20588
diff changeset
  8526
        projectDefinition isNil ifTrue:[
4159bb976528 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20588
diff changeset
  8527
            Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage.
4159bb976528 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20588
diff changeset
  8528
            ^ self.
4159bb976528 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20588
diff changeset
  8529
        ].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8530
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8531
    projectDefinition unloadPackage.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8532
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8533
    "
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8534
     Smalltalk loadPackage:'stx:goodies/persistency'
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8535
     Smalltalk unloadPackage:'stx:goodies/persistency'
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8536
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8537
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8538
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8539
!Smalltalk class methodsFor:'system management-undeclared variables'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8540
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8541
clearUndeclaredVariables
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8542
    "remove all undeclared variables"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8543
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8544
    (Smalltalk at:#Undeclared) do:[:eachKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8545
	Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8546
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8547
    (Smalltalk at:#Undeclared) removeAll.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8548
    Smalltalk removeKey:#Undeclared.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8549
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8550
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8551
undeclaredPrefix
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8552
    "the prefix used for undeclared variables"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8553
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8554
    ^ 'Undeclared:::'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8555
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8556
    "Created: / 31.10.1997 / 01:13:10 / cg"
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8557
! !
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8558
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8559
!Smalltalk class methodsFor:'time-versions'!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8560
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8561
configuration
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8562
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8563
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8564
    "for developers only: return the configuration, with which
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8565
     this smalltalk was compiled."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8566
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8567
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8568
    extern char *__getConfigurationString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8569
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8570
    RETURN (__MKSTRING(__getConfigurationString() COMMA_SND));
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8571
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8572
    ^ 'unknownOS/unknownCONF:unknownPACK'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8573
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8574
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  8575
     Smalltalk configuration
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8576
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8577
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  8578
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8579
copyrightString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8580
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8581
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8582
    "return a copyright string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8583
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8584
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8585
#ifndef __getCopyrightString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8586
    extern OBJ __getCopyrightString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8587
#endif
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8588
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8589
    RETURN (__getCopyrightString());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8590
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8591
    ^ self primitiveFailed
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8592
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8593
    "
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8594
     Smalltalk copyrightString
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8595
    "
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8596
!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8597
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8598
distributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8599
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8600
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8601
    "return a string describing the distributor of this software"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8602
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8603
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8604
#ifndef __getDistributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8605
    extern OBJ __getDistributorString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8606
#endif
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8607
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8608
    RETURN (__getDistributorString());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8609
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8610
    ^ 'eXept Software AG, Germany'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8611
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8612
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8613
     Smalltalk distributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8614
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8615
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8616
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8617
expirationTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8618
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8619
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8620
    "for developers only: return the time when the system will expire.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8621
     after this time it will not run any longer.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8622
     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
  8623
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8624
    |exp|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8625
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8626
%{
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8627
    extern unsigned int __getExpirationTime();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8628
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8629
    exp = __MKUINT(__getExpirationTime());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8630
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8631
    exp == 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8632
	^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8633
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8634
    ^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8635
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8636
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8637
     Smalltalk expirationTime
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8638
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8639
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8640
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8641
fullVersionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8642
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8643
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8644
    "return a full version string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8645
19516
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8646
    ^ 'Smalltalk/X release %1%2 of %3'
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8647
        bindWith:(self versionString)
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8648
        with:((ExternalAddress pointerSize == 8)
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8649
                        ifTrue:[' (64bit)']
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8650
                        ifFalse:[''])
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8651
        with:(self versionDate)
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8652
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8653
    "
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8654
     Smalltalk fullVersionString 
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8655
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8656
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8657
    "Created: / 27.10.1997 / 17:03:09 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8658
    "Modified: / 27.10.1997 / 17:04:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8659
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8660
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8661
hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8662
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8663
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8664
    "return a greeting string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8665
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8666
    "stupid: this should come from a resource file ...
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  8667
     but I don't use it here, to allow mini-systems without
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8668
     Resource-stuff."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8669
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8670
    |proto lang bit bitsPerWordString|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8671
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8672
    lang := Language.
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8673
    bit := 'bit'.
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8674
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8675
    (lang == #de) ifTrue:[
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8676
        proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8677
    ] ifFalse:[ (lang == #fr) ifTrue:[
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
  8678
        proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8679
    ] ifFalse:[ (lang == #it) ifTrue:[
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8680
        proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8681
    ] ifFalse:[ (lang == #es) ifTrue:[
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8682
        proto := 'Hola, bienvenida a %1 (%4version %2 de %3)'
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  8683
    ] ifFalse:[ (lang == #pt) ifTrue:[
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
  8684
        proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8685
    ] ifFalse:[ (lang == #no) ifTrue:[
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8686
        proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8687
    ]]]]]].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8688
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8689
    "/ ... more needed here ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8690
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8691
    proto isNil ifTrue:[
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8692
        proto := 'Hello World - welcome to %1 (%4version %2 of %3)'.
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8693
    ].
19492
8422ce672a77 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19475
diff changeset
  8694
    ExternalAddress pointerSize ~~ 4 ifTrue:[
8422ce672a77 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19475
diff changeset
  8695
        bitsPerWordString := (ExternalAddress pointerSize * 8) printString,bit,' '.
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8696
    ] ifFalse:[
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8697
        bitsPerWordString := ''
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8698
    ].        
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8699
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8700
    ^ proto bindWith:('SmallTalk/X' allBold)
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  8701
                with:(self versionString)
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  8702
                with:(self versionDate)
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8703
                with:bitsPerWordString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8704
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8705
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8706
     Smalltalk language:#us.
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8707
     Smalltalk hello 
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8708
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8709
     Smalltalk language:#de.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8710
     Smalltalk hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8711
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8712
     Smalltalk language:#no.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8713
     Smalltalk hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8714
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8715
     Transcript showCR:(Smalltalk hello)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8716
     Stdout showCR:(Smalltalk hello)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8717
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8718
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8719
    "Modified: 18.5.1996 / 14:25:13 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8720
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8721
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8722
imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8723
    "return a timestamp for the moment when this image was restarted.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8724
     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
  8725
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8726
    ^ ImageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8727
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8728
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8729
     Smalltalk imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8730
     Smalltalk imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8731
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8732
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8733
    "Created: 13.12.1995 / 17:44:20 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8734
    "Modified: 6.3.1996 / 11:56:35 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8735
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8736
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8737
imageSaveTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8738
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8739
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8740
    "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
  8741
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8742
    ^ ObjectMemory imageSaveTime
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8743
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8744
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8745
imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8746
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8747
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8748
    "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
  8749
     (i.e. the first initial start without an image)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8750
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8751
    ^ ImageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8752
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8753
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8754
     Smalltalk imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8755
     Smalltalk imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8756
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8757
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8758
    "Created: 13.12.1995 / 17:44:14 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8759
    "Modified: 13.12.1995 / 17:45:47 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8760
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8761
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8762
majorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8763
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8764
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8765
    "return the major version number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8766
     This is only incremented for very fundamental changes,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8767
     which make old object files totally incompatible
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8768
     (for example, if the layout/representation of fundamental
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8769
      classes changes).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8770
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8771
     ST/X revision Naming is:
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8772
        <major>.<minor>.<revision>.<release>"
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8773
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8774
    ^ 7
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8775
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8776
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8777
     Smalltalk majorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8778
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8779
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8780
    "Modified: / 09-06-2016 / 16:28:40 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8781
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8782
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8783
minorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8784
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8785
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8786
    "return the minor version number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8787
     This is incremented for changes which make some old object
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8788
     files incompatible, or the protocol changes such that some
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8789
     classes need rework.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8790
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8791
     ST/X revision Naming is:
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8792
        <major>.<minor>.<revision>.<release>"
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8793
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8794
    ^ 1
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8795
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8796
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8797
     Smalltalk minorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8798
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8799
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8800
    "Modified: / 09-06-2016 / 16:28:45 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8801
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8802
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8803
releaseIdentification
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8804
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8805
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8806
    "for developers only: return the release
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8807
     (to further identify the version in case of errors)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8808
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8809
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8810
    extern OBJ __getRel();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8811
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8812
    RETURN (__getRel());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8813
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8814
    ^ 'ST/X_experimental'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8815
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8816
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8817
     Smalltalk releaseIdentification
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8818
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8819
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8820
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8821
releaseNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8822
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8823
14542
8ed2cefffa0c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14529
diff changeset
  8824
    "return the release number.
8ed2cefffa0c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14529
diff changeset
  8825
     Now releaseNr is the build number (BUILD_NUMBER from Jenkins)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8826
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8827
     ST/X revision Naming is:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8828
	<major>.<minor>.<revision>.<release>"
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8829
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8830
    |releaseNumber|
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8831
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8832
    releaseNumber := Smalltalk versionBuildNumber.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8833
    releaseNumber isEmpty ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8834
	^ 0.
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8835
    ].
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8836
    ^ releaseNumber
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8837
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8838
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8839
     Smalltalk releaseNr
12867
2b9cbcea983b version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents: 12861
diff changeset
  8840
     Smalltalk versionString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8841
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8842
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8843
    "Created: / 10-12-1995 / 01:42:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8844
    "Modified: / 10-02-2007 / 14:49:51 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8845
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8846
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8847
revisionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8848
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8849
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8850
    "return the revision number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8851
     Incremented for releases which fix bugs/add features
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8852
     and represent a stable workable version which got published
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8853
     to the outside world.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8854
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8855
     ST/X revision Naming is:
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8856
        <major>.<minor>.<revision>.<release>"
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8857
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8858
    ^ 0
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8859
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8860
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8861
     Smalltalk revisionNr
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  8862
     Smalltalk hello string
13014
fe6484596968 changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 13000
diff changeset
  8863
    "
fe6484596968 changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 13000
diff changeset
  8864
14898
5afe1d1f7ffe class: Smalltalk
az
parents: 14892
diff changeset
  8865
    "Modified: / 19-03-2013 / 10:48:59 / az"
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  8866
    "Modified: / 09-06-2016 / 16:28:57 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8867
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8868
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8869
timeStamp
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8870
    "return a string useful for timestamping a file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8871
     The returned string is padded with spaces for a constant
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8872
     length (to avoid changing a files size in fileOut with unchanged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8873
     class)."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8874
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8875
    ^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8876
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8877
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8878
timeStamp:aStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8879
    "write a string useful for timestamping a file onto aStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8880
     ST80 compatibility"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8881
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8882
    aStream nextPutAll:(self timeStamp).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8883
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8884
    "Created: / 18.6.1998 / 17:22:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8885
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8886
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8887
timeStampString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8888
    "return a string useful for timestamping a file."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8889
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8890
    |dateString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8891
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8892
    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
  8893
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8894
    ^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on '
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8895
       , dateString , ' at ' , Time now printString
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8896
       )
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8897
!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8898
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8899
versionBuildNumber
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8900
    "{ Pragma: +optSpace }"
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8901
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8902
    "return the executables build number - that's the jenkins build #.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8903
     Empty if not built by jenkins"
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8904
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8905
%{  /* NOCONTEXT */
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8906
    extern char *__getBuildNumberString();
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8907
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8908
    RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) );
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8909
%}.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8910
    ^ ''
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8911
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8912
    "
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8913
     Smalltalk versionBuildNumber
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8914
    "
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8915
!
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8916
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8917
versionDate
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8918
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8919
14522
ae3c24478338 build number
Claus Gittinger <cg@exept.de>
parents: 14487
diff changeset
  8920
    "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
  8921
     executable was built"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8922
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8923
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8924
    extern char *__getBuildDateString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8925
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8926
    RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) );
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8927
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8928
    ^ 'today'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8929
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8930
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  8931
     Smalltalk versionDate
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8932
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8933
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8934
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8935
versionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8936
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8937
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8938
    "return the version string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8939
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8940
    ^ (self majorVersionNr printString ,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8941
       '.',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8942
       self minorVersionNr printString ,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8943
       '.',
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8944
       self revisionNr printString,
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8945
       '.',
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  8946
       self releaseNr printString)
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  8947
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8948
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8949
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8950
     Smalltalk versionString
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8951
    "
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8952
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8953
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8954
vmMajorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8955
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8956
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8957
    "return the VMs major version number."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8958
%{
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8959
    RETURN (__mkSmallInteger(4));
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8960
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8961
    ^ 4
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8962
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8963
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8964
     Smalltalk vmMajorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8965
    "
2
claus
parents: 1
diff changeset
  8966
! !
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  8967
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  8968
!Smalltalk class methodsFor:'documentation'!
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 617
diff changeset
  8969
13532
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  8970
version
18560
a37464a68e70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18385
diff changeset
  8971
    ^ '$Header$'
13532
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  8972
!
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  8973
12172
d90a72004f43 changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents: 12033
diff changeset
  8974
version_CVS
18560
a37464a68e70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18385
diff changeset
  8975
    ^ '$Header$'
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8976
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8977
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8978
version_SVN
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  8979
    ^ '$ 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
  8980
! !
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
  8981