Smalltalk.st
author Claus Gittinger <cg@exept.de>
Fri, 06 Mar 2020 19:35:24 +0100
changeset 25326 162966c92640
parent 25292 baed06d0d302
child 25333 b501078702f8
permissions -rw-r--r--
#DOCUMENTATION by cg class: Smalltalk class comment/format in: #setLanguage:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
     1
"{ Encoding: utf8 }"
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
     2
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     3
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1988 by Claus Gittinger
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
     5
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
"
5363
0070ef95a033 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
    14
"{ Package: 'stx:libbasic' }"
0070ef95a033 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5333
diff changeset
    15
17279
5e8cf598ce7e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17095
diff changeset
    16
"{ NameSpace: Smalltalk }"
5e8cf598ce7e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17095
diff changeset
    17
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
Object subclass:#Smalltalk
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    19
	instanceVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    20
	classVariableNames:'StartBlocks ImageStartBlocks ExitBlocks CachedClasses
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    21
		NumberOfClassesHint SystemPath StartupClass StartupSelector
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    22
		StartupArguments CommandLine CommandName CommandLineArguments
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    23
		CachedAbbreviations VerboseStartup VerboseLoading Verbose
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    24
		SilentLoading Initializing StandAlone HeadlessOperation IsPlugin
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
    25
		IsSharedLibraryComponent IsSTScript IsRepl DebuggingStandAlone
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    26
		Silent Debugging LogDoits LoadBinaries RealSystemPath
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    27
		ResourcePath SourcePath BinaryPath FileInPath PackagePath
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    28
		BinaryDirName ResourceDirName SourceDirName BitmapDirName
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    29
		PackageDirName FileInDirName ChangeFileName ImageStartTime
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    30
		ImageRestartTime DemoMode SaveEmergencyImage SpecialObjectArray
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
    31
		CallbackSignal ClassesFailedToInitialize HasNoConsole IgnoreHalt
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
    32
		PackageToPathMapping IgnoreAssertions LanguageModifier
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
    33
		LanguageCodeset'
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    34
	poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    35
	category:'System-Support'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    36
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    37
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
    38
Smalltalk comment:''
8845
17288e4e99eb remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents: 8821
diff changeset
    39
!
17288e4e99eb remember, where autoload decl came from
Claus Gittinger <cg@exept.de>
parents: 8821
diff changeset
    40
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
    41
!Smalltalk class methodsFor:'documentation'!
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    42
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    43
copyright
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
    44
"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    45
 COPYRIGHT (c) 1988 by Claus Gittinger
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    46
	      All Rights Reserved
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    47
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    48
 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
    49
 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
    50
 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
    51
 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
    52
 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
    53
 hereby transferred.
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
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    56
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
    57
documentation
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    58
"
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    59
    This is one of the central classes in the system;
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    60
    it provides all system-startup, shutdown and maintenance support.
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    61
    Also global variables are (conceptionally) kept here.
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    62
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    63
    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
    64
    - my implementation of globals is totally different
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    65
      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
    66
      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
    67
      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
    68
      functions found there.
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    69
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    70
    However, it provides the known enumeration protocol.
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
    71
    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
    72
    to inherit more collection stuff ...
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
    73
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
    74
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    75
    [Instance variables:]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    76
					none - all handling is done in the VM
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    77
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    78
    [Class variables:]
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
    79
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    80
	StartBlocks     <Collection>    blocks to be executed in a separate process after
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    81
					everything has been initialized. These blocks will
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    82
					be deleted after execution and therefore not be
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    83
					executed after an image restart. Initial processes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    84
					(such as the Launcher) are usually started here.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    85
					These blocks are added by smalltalk.rc/private.rc etc.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    86
					via #addStartBlock during early initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    87
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    88
	ImageStartBlocks
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    89
			<Collection>    blocks to be executed in a separate process after
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    90
					everything has been initialized. These blocks will be
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    91
					executed after an image restart.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    92
					These blocks are usually added by smalltalk_r.rc etc.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    93
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    94
	ExitBlocks      <Collection>    blocks to evaluate before system is
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    95
					left. Not currently used (GNU-ST compatibility).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    96
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    97
	SystemPath      <Collection>    path to search for system files (sources, bitmaps etc)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    98
					Set to a default here, but typically changed from some
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
    99
					startup.rc file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   100
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   101
	PackagePath     <Collection>    path to search for package.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   102
					This is going to replace the above systemPath, and a classes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   103
					resources will eventually searched in its package directory.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   104
					This list defines the path, where packages are searched for,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   105
					initially this is something like /opt/smalltalk/packages.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   106
					Set to a default here, but typically changed from some
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   107
					startup.rc file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   108
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   109
	StartupClass    <Class>         class and selector, where the system starts up
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   110
	StartupSelector <Symbol>        (right after VM initialization)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   111
	StartupArguments <Array>        If an image is saved while those being nonNil,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   112
					the image will come up there.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   113
					Allows for customized images to be generated from a standard ST/X.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   114
					StandAlone programs also set those during initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   115
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   116
	CommandLine          <String>   Unix (OS-) command line
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   117
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   118
	CommandName          <String>   the command (i.e. argv[0])
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   119
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   120
	CommandLineArguments <Array>    Unix (OS-) command line arguments broken into words
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   121
					CommandName has been stripped off.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   122
					(initially set by the VM)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   123
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   124
	SilentLoading   <Boolean>       OBSOLETE:
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   125
					suppresses messages during fileIn and in compiler
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   126
					(can be set to true from a customized main.c)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   127
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   128
	VerboseLoading   <Boolean>      generate messages during fileIn and in compiler
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   129
					(can be set to true from a customized main.c)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   130
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   131
	Initializing    <Boolean>       true while (re-)initializing
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   132
					Controls the behavior of certain error
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   133
					reporters (for example: suppress dialogBoxes)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   134
					while the system is not yet fit for full operation.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   135
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   136
	StandAlone      <Boolean>       true, if this is a standalone app;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   137
					if true the process scheduler watches for
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   138
					which processes are still running, and
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   139
					exits ST/X, when the last non-background
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   140
					and non-system process exits.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   141
					Can be set in an application-specific startup script,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   142
					or, for standAlone programs, by C-code during initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   143
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   144
	HeadlessOperation               if true, a non-existing Display connection
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   145
			<Boolean>       will NOT lead to an error-exit during startup.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   146
					Default is false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   147
					Can be set in an application-specific startup script,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   148
					or, for standAlone programs, by C-code during initialization.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   149
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   150
	LogDoits        <Boolean>       if true, doits are also logged in the changes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   151
					file. Default is false, since the changes file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   152
					may become huge if every tiny doIt is saved there ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   153
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   154
	LoadBinaries    <Boolean>       if true, we attempt to load classes rom a binary
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   155
					file, if present. If false, this is always suppressed.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   156
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   157
	SaveEmergencyImage <Boolean>    if true (the default), an emergency image
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   158
					is saved, if the main Display looses its
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   159
					connection. This is useful if you have a
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   160
					flaky display connection (serial line)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   161
					and want to have your stuff saved automatically
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   162
					in case of a broken connection.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   163
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   164
	IgnoreAssertions  <Boolean>     if true, assertions are ignored (i.e. no errors reported).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   165
					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
   166
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   167
    strictly private classVariables (helpers):
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
   168
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   169
	CachedClasses   <Collection>    known classes (cached for faster class enumeration)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   170
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   171
	CachedAbbreviations
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   172
			<Dictionary>    className to filename mappings
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   173
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   174
	RealSystemPath  <Collection>    cached collection of directories along the path
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   175
					which really exist. Caching avoids long checks
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   176
					for existing directories on broken NFS volumes.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   177
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   178
	SourcePath      <Collection>    cached names of really existing directories
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   179
					These are remembered, as in NFS systems,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   180
	ResourcePath                    the time to lookup files may become long
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   181
	BinaryPath                      (especially, if some directories are on machines
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   182
	FileInPath                      which are not up ...).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   183
					Therefore, the set of really
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   184
					existing directories is cached when the SystemPath
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   185
					is walked the first time.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   186
					A consequence is that you have to invoke
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   187
					flushSystemPath, when you create any of those
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   188
					directories while running
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   189
					(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
   190
1286
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
   191
4270a0b4917d documentation
Claus Gittinger <cg@exept.de>
parents: 1222
diff changeset
   192
    [author:]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   193
	Claus Gittinger
3062
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   194
5b8a2aa07108 write an emergency snapshot image,
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
   195
    [see also:]
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   196
	ObjectMemory
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   197
	StandaloneStartup
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   198
	GetOpt
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   199
	ReadEvalPrintLoop
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
   200
"
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   201
!
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
readme_resources
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   204
"
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   205
    What is a resource file:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   206
	resource files contain language transformation and sometimes
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   207
	UI-look specifics such as icons etc.
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   208
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   209
    Where are resources stored in the image:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   210
	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
   211
	i.e. they are cached in the image).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   212
	The cached data is held in a per-class class-instVar named 'ClassResources'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   213
	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
   214
	classes under the SimpleView hierarchy.
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   215
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   216
    How does the system find resources:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   217
	The idea is that the system-provided resource files can be overwritten
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   218
	by the user or an application configuration.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   219
	This works via a hierarchy of directories where resources are searched for,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   220
	with the systems standard resource-files being at the end of that chain.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   221
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   222
	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
   223
	in order:
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   224
		{ResourcePath} / resources / X.rs
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   225
		{SystemPath} / (CLASSES-PACKAGE-PATH) / X.rs
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   226
		{ResourcePath} / (CLASSES-PACKAGE-PATH) / X.rs
8945
519d441bdcb4 resources: also search for
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   227
"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   228
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   229
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   230
!Smalltalk class methodsFor:'initialization'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   231
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   232
basicInitializeSystem
16180
ddb5cec2ab0b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16170
diff changeset
   233
    "initialize all other classes.
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   234
     This one is the very first entry into the smalltalk world
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   235
     [with error handling, via the initializeSystem],
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   236
     right after startup, usually immediately followed by Smalltalk>>start.
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   237
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   238
     Notice:
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   239
        this is NOT called when an image is restarted; in this
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   240
        case the show starts in Smalltalk>>restart."
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   241
23670
12331a3a54a0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23628
diff changeset
   242
    "/ 'basicInitializeSystem' infoPrintCR.
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   243
    
19992
635ac6a17b68 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19984
diff changeset
   244
    OrderedCollection initialize.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   245
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
   246
    Smalltalk at:#Compiler put:ByteCodeCompiler.
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   247
    Compiler isNil ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   248
        "
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   249
         ByteCodeCompiler is not in the system (i.e. has not been linked in)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   250
         this allows at least immediate evaluations for runtime systems without compiler
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   251
         NOTICE: a parser is always needed, otherwise we cannot read resource files etc.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   252
        "
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   253
        Smalltalk at:#Compiler put:Parser
16164
5d9fdce75cd1 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16161
diff changeset
   254
    ].
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
   255
11057
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
    "/ start catching SIGSEGV and SIGBUS
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
    OperatingSystem enableHardSignalInterrupts.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   260
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   261
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   262
    "/ sorry - there are some, which MUST be initialized before ..
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   263
    "/ 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
   264
    "/
15265
9a8afa1b41cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15225
diff changeset
   265
    SmallInteger initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   266
    Object initialize.
18283
f0c2bf4a129a class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18251
diff changeset
   267
    UninterpretedBytes initialize.
21599
32f9f39dedce #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21592
diff changeset
   268
    ProcessorScheduler initialize.          "make sure Processor exists (RecursionLock needs it)"
16691
2a12b888e973 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16675
diff changeset
   269
    OperatingSystem initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   270
    Stream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   271
    PositionableStream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   272
    Filename initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   273
    ObjectMemory initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   274
    ExternalStream initialize.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   275
24872
3d3b861fa248 #BUGFIX by Stefan Reise
sr
parents: 24807
diff changeset
   276
    self initGlobalsFromEnvironment.
3d3b861fa248 #BUGFIX by Stefan Reise
sr
parents: 24807
diff changeset
   277
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   278
    self initStandardStreams.    "/ setup Stdin, Stdout etc.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   279
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   280
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   281
    "/ sorry, path must be set before ...
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   282
    "/ 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
   283
    "/
17534
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
   284
    "/ but, on OSX we need the CharacterEncoder to be initialized
66817b8c13a3 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17439
diff changeset
   285
    CharacterEncoder initialize.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   286
    self initSystemPath.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   287
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   288
    "/
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   289
    "/ in case, someone needs the objectFileLoader early
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   290
    "/
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   291
    ObjectFileLoader notNil ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   292
        ObjectFileLoader initialize.
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   293
    ].
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   294
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   295
    "/
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   296
    "/ now, finally, initialize all other classes
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 initializeModules.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   299
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   300
    ImageStartTime := Timestamp now.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   301
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   302
    self initInterrupts.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   303
    self initUserPreferences.
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   304
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   305
    "/ 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
   306
    "/ 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
   307
    "/ 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
   308
    ApplicationModel notNil ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   309
        ApplicationModel flushAllClassResources.
16675
39e0cf323c6b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16668
diff changeset
   310
    ].
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
   311
11057
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
    "/ give classes a chance to perform 2nd-level initialization
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   314
    "/ now, we are certain, that all other classes have been initialized
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   315
    "/ (especially: streams and signals can now be used)
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   316
    "/
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   317
    ObjectMemory changed:#initialized.
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
    "Modified: / 05-12-2006 / 21:48:58 / cg"
14427
37ef5d66ea2a changed: #basicInitializeSystem
sr
parents: 14426
diff changeset
   320
    "Modified: / 24-10-2012 / 18:45:15 / sr"
21599
32f9f39dedce #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21592
diff changeset
   321
    "Modified: / 27-02-2017 / 20:39:14 / stefan"
23670
12331a3a54a0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23628
diff changeset
   322
    "Modified: / 06-02-2019 / 18:01:17 / Claus Gittinger"
24872
3d3b861fa248 #BUGFIX by Stefan Reise
sr
parents: 24807
diff changeset
   323
    "Modified: / 29-10-2019 / 16:47:26 / Stefan Reise"
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   324
!
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   325
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   326
initGlobalsFromEnvironment
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   327
    "setup globals from the shell-environment"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   328
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   329
    |envString i langString terrString|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   330
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   331
    StandAlone isNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   332
	StandAlone := false.
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   333
    ].
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
   334
    HeadlessOperation isNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   335
	HeadlessOperation := false.
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
   336
    ].
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
   337
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   338
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   339
     extract Language and LanguageTerritory from LANG variable.
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   340
     valid are for example:
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   341
			    en_en / en
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   342
			    en_us
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   343
			    en_gb
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   344
			    de_de / de
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   345
			    de_at       (for Austria)
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   346
    "
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   347
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   348
    Language := #en.
994
6163ae7aaf9b territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   349
    LanguageTerritory := #us.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   350
5846
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   351
a972d0e7e06b Parsing of de_DE
Stefan Vogel <sv@exept.de>
parents: 5841
diff changeset
   352
    "Format of LANG is: language[_territory][.codeset][@modifier]
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   353
	language        ISO-639  Language code
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   354
	territory       ISO-3166 Contry code"
7779
6d88d32bdd64 Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents: 7763
diff changeset
   355
6d88d32bdd64 Language stuff: use OperatingSystem>>getLanguage to get
Stefan Vogel <sv@exept.de>
parents: 7763
diff changeset
   356
    envString := OperatingSystem getLanguage.
21928
b14c2d0608e0 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21782
diff changeset
   357
    envString notEmptyOrNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   358
	i := envString indexOf:$@.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   359
	(i ~~ 0) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   360
	    LanguageModifier := (envString copyFrom:(i + 1)) asLowercase asSymbol.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   361
	    envString := envString copyTo:(i - 1).
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   362
	] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   363
	    LanguageModifier := nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   364
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   365
	i := envString indexOf:$..
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   366
	(i ~~ 0) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   367
	    LanguageCodeset := (envString copyFrom:(i + 1)) asLowercase asSymbol.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   368
	    envString := envString copyTo:(i - 1).
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   369
	] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   370
	    LanguageCodeset := #'iso8859-1'.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   371
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   372
	i := envString indexOf:$_.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   373
	(i == 0) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   374
	    langString := envString.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   375
	    terrString := envString
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   376
	] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   377
	    langString := envString copyTo:(i - 1).
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   378
	    terrString := envString copyFrom:(i + 1)
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   379
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   380
	langString := langString asLowercase.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   381
	terrString := terrString asLowercase.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   382
	(langString = 'c' or:[terrString = 'c']) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   383
	    ('Smalltalk [info]: ignoring wrong LANG setting (',langString,'_',terrString,') - using english') infoPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   384
	] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   385
	    Language := langString asSymbol.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   386
	    LanguageTerritory := terrString asSymbol
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   387
	]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   388
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   389
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   390
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   391
     Smalltalk initGlobalsFromEnvironment
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   392
    "
994
6163ae7aaf9b territory defaults to #us (instead of #usa)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   393
14011
d33d2c6497f4 changed: #initGlobalsFromEnvironment
Claus Gittinger <cg@exept.de>
parents: 13998
diff changeset
   394
    "Modified: / 14-02-2012 / 15:25:08 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   395
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   396
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   397
initInterrupts
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   398
    "initialize interrupts"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   399
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   400
    OperatingSystem enableUserInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   401
    OperatingSystem enableHardSignalInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   402
    OperatingSystem enableCrashSignalInterrupts.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   403
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   404
    ObjectMemory userInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   405
    ObjectMemory signalInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   406
    ObjectMemory recursionInterruptHandler:self.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   407
14805
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   408
    OperatingSystem isOSXlike ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   409
	"/ OSX sends SIGABRT for NSExceptions
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   410
	OperatingSystem operatingSystemSignal:(OperatingSystem sigABRT) install:NSException.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   411
	OperatingSystem enableAbortInterrupts.
14805
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   412
    ].
33c5758318a6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14793
diff changeset
   413
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   414
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   415
     Smalltalk initInterrupts
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   416
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   417
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   418
    "Modified: 20.8.1997 / 09:35:49 / stefan"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   419
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   420
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   421
initStandardStreams
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   422
    "initialize some well-known streams"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   423
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   424
    Stdout := NonPositionableExternalStream forStdout.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   425
    Stderr := NonPositionableExternalStream forStderr.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   426
    Stdin := NonPositionableExternalStream forStdin.
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   427
    PrinterStream notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   428
	Printer := PrinterStream defaultPrinter.
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   429
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   430
    Transcript := Stderr
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   431
963
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   432
    "
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   433
     Smalltalk initStandardStreams
fef0f2ed2709 more for standAlone (nonGraphical) mode
Claus Gittinger <cg@exept.de>
parents: 962
diff changeset
   434
    "
10145
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   435
cca90547778e allow for different OS's to initialize the Printer differently
Claus Gittinger <cg@exept.de>
parents: 10143
diff changeset
   436
    "Modified: / 25-10-2006 / 17:36:46 / cg"
617
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
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   439
initStandardTools
10646
39e8fbfed83c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10645
diff changeset
   440
    "predefine some tools which we might need later
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   441
     - if the view-classes exist,
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   442
       they will redefine Inspector and Debugger for graphical interfaces"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   443
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   444
    Display notNil ifTrue:[
24062
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   445
        InspectorView notNil ifTrue:[
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   446
            Inspector := InspectorView
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   447
        ].
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   448
        DebugView notNil ifTrue:[
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   449
            Debugger := DebugView
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   450
        ].
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   451
        "/ Display initialize
13303
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   452
    ].
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   453
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   454
    "/ make the changeFilePath an absolute one,
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   455
    "/ in case some stupid windows fileDialog changes the current directory...
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   456
    ObjectMemory
24062
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   457
        nameForChanges:(Filename currentDirectory / ObjectMemory nameForChangesLocal) pathName
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   458
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
     Smalltalk initStandardTools
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   461
    "
13303
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   462
1aa90c41dd35 changed: #initStandardTools
Claus Gittinger <cg@exept.de>
parents: 13212
diff changeset
   463
    "Modified: / 09-02-2011 / 20:44:47 / cg"
24062
d95c06ef5614 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23873
diff changeset
   464
    "Modified: / 11-04-2019 / 18:07:24 / Stefan Vogel"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   465
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   466
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   467
initSystemPath
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   468
    "setup path where system files are searched for.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   469
     the default path is set to:
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   470
            .
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   471
            <directory of exe>       (WIN32 only)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   472
            $HOME                    (if defined)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   473
            $HOME/.smalltalk         (if defined & existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   474
            $SMALLTALK_LIBDIR        (if defined & existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   475
            $STX_LIBDIR              (if defined & existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   476
            $STX_TOPDIR              (if defined & existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   477
            REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\<CurrentVersion>\LibDir') (WIN32 only)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   478
            REGISTRY('HKEY_LOCAL_MACHINE\Software\eXept\Smalltalk/X\LibDir')                  (WIN32 only)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   479
            <standard places>
9021
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9020
diff changeset
   480
6541db62a929 systemPath setup changed
Claus Gittinger <cg@exept.de>
parents: 9020
diff changeset
   481
     standard places (unix):
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   482
            /opt/smalltalk/<release> (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   483
            /opt/smalltalk           (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   484
            /usr/local/lib/smalltalk (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   485
            /usr/lib/smalltalk       (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   486
            /lib/smalltalk           (if existing)
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   487
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   488
     win32:
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   489
            \programs\exept\smalltalk (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   490
            \programs\smalltalk       (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   491
            \smalltalk                (if existing)
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   492
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   493
     vms:
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   494
            $stx:lib                 (if existing)
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   495
            $stx:root                (if existing)
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   496
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   497
     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
   498
     startup file; add expressions such as:
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   499
            Smalltalk systemPath addFirst:'/foo/bar/baz'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   500
        or:
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   501
            Smalltalk systemPath addLast:'/fee/foe/foo'.
4001
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   502
fa75465bd263 made systemPath setup OS-specific
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
   503
     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
   504
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   505
2928
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   506
    ChangeFileName := 'changes'.
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   507
    OperatingSystem isVMSlike ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   508
        BitmapDirName := 'bitmaps.dir'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   509
        BinaryDirName := 'binary.dir'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   510
        SourceDirName := 'source.dir'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   511
        ResourceDirName := 'resources.dir'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   512
        FileInDirName := 'filein.dir'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   513
        PackageDirName := 'packages.dir'.
2928
39c23e287c81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2912
diff changeset
   514
    ] ifFalse:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   515
        BitmapDirName := 'bitmaps'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   516
        BinaryDirName := 'binary'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   517
        SourceDirName := 'source'.
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
   518
        "/ ResourceDirName := 'resources'.
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   519
        ResourceDirName := '.resources'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   520
        FileInDirName := 'fileIn'.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   521
        PackageDirName := 'packages'.
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
   522
        OperatingSystem isOSXlike ifTrue:[
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
   523
            PackageDirName := 'Packages'.
23470
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
   524
            ResourceDirName := '../Resources'.
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
   525
        ].
23462
3936518a03ef #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23450
diff changeset
   526
        OperatingSystem isMSWINDOWSlike ifTrue:[
3936518a03ef #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23450
diff changeset
   527
            ResourceDirName := 'resources'.
3936518a03ef #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23450
diff changeset
   528
        ].
16234
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   529
    ].
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   530
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   531
    SystemPath isEmptyOrNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   532
        SystemPath := OperatingSystem defaultSystemPath.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   533
        self flushPathCaches
16234
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   534
    ].
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   535
ea850c2ab6bc class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16211
diff changeset
   536
    PackagePath isEmptyOrNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
   537
        PackagePath := OperatingSystem defaultPackagePath.
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   538
    ].
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
   539
    self addWorkspaceDirectoryToPackagePath.
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
   540
    self addIdeTopDirectoryToPackagePath.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   541
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   542
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   543
     Smalltalk initSystemPath
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   544
     Smalltalk systemPath
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   545
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
   546
     SystemPath := nil.
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
   547
     PackagePath := nil.
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   548
     OperatingSystem defaultSystemPath
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
   549
     OperatingSystem defaultPackagePath
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   550
    "
5139
135e98726986 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5138
diff changeset
   551
23462
3936518a03ef #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23450
diff changeset
   552
    "Modified: / 24-12-1999 / 00:23:35 / cg"
23470
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
   553
    "Modified: / 25-10-2018 / 23:51:35 / Claus Gittinger"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   554
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   555
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   556
initUserPreferences
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   557
    "setup other stuff"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   558
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   559
    LogDoits := false.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   560
    LoadBinaries := false.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   561
    SaveEmergencyImage := (StandAlone ~~ true).
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   562
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   563
    "Modified: / 24.10.1997 / 18:22:47 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   564
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   565
7526
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   566
initializeClass:aClass
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   567
    "sent from VM via #initializeModules"
97c36c93e3d9 *** empty log message ***
penk
parents: 7525
diff changeset
   568
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   569
    Error handle:[:ex |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   570
	ObjectMemory printStackBacktrace.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   571
	ClassesFailedToInitialize isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   572
	    ClassesFailedToInitialize := IdentitySet new.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   573
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   574
	ClassesFailedToInitialize add:aClass.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   575
	('Smalltalk [warning]: error during initialize of ' , aClass name,': ', ex description printString) errorPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   576
	ex suspendedContext fullPrintAll.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   577
	'------------------------------------------------' errorPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   578
	(Debugging == true) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   579
	    ex reject
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   580
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   581
    ] do:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   582
	aClass initialize
13675
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   583
    ].
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   584
b5730280715d changed: #initializeClass:
Claus Gittinger <cg@exept.de>
parents: 13621
diff changeset
   585
    "Modified: / 11-09-2011 / 17:01:32 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   586
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   587
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   588
initializeModules
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   589
    "perform module specific initialization and
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   590
     send #initialize to all classes.
16180
ddb5cec2ab0b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16170
diff changeset
   591
     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
   592
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   593
    self initializeModulesOnce.
23773
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   594
    ClassesFailedToInitialize notEmptyOrNil ifTrue:[
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   595
        ('Smalltalk [info]: retry initialization of failed class(es)...') infoPrintCR.
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   596
        ClassesFailedToInitialize := nil.
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   597
        self initializeModulesOnce.
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   598
        ClassesFailedToInitialize notEmptyOrNil ifTrue:[
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   599
            ('Smalltalk [error]: class(es) persist to fail during initialize') errorPrintCR.
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   600
        ]
10122
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   601
    ].
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   602
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   603
    ProjectDefinition initializeAllProjectDefinitions.
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   604
697f05af913b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10118
diff changeset
   605
    "Modified: / 23-10-2006 / 16:40:39 / cg"
23773
a505a886fb49 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23748
diff changeset
   606
    "Modified: / 22-02-2019 / 16:36:52 / Stefan Vogel"
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   607
!
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   608
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   609
initializeModulesOnce
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   610
    "perform module specific initialization and
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   611
     send #initialize to all classes.
7527
00be4f63fa1d *** empty log message ***
penk
parents: 7526
diff changeset
   612
     Notice: this is not called when an image is restarted"
4963
308de981ea7d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4959
diff changeset
   613
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   614
%{
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   615
#ifdef __SCHTEAM__
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   616
    STClass.initializeAllClasses(__c__);
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   617
    return __c__._RETURN_self();
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   618
#else
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1682
diff changeset
   619
    __init_registered_modules__(3);
4963
308de981ea7d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4959
diff changeset
   620
1481
90a28fd060bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
   621
    @global(DemoMode) = __getDemoMode() ? true : false;
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   622
    RETURN (self);
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
   623
#endif /* not SCHTEAM */
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   624
%}.
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
   625
    ^ self primitiveFailed
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   626
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   627
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   628
initializeSystem
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   629
    "initialize all classes; setup dispatcher processes etc.
3499
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   630
     This one is the very first entry into the smalltalk world,
16655
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   631
     right after startup, usually immediately followed by Smalltalk>>start.
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   632
     Here, a few specific initializations are done, then the actual initialization is
14df7efaf339 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16642
diff changeset
   633
     done inside an error handler in basicInitializeSystem.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
   634
     Notice:
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   635
        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
   636
     Also Notice:
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   637
        this is NOT called when an image is restarted;
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   638
        in this case the show starts in Smalltalk>>restart."
211
58bb873aa83c *** empty log message ***
claus
parents: 202
diff changeset
   639
19510
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   640
    |idx shellArgs|
6841
37bc69fc9240 set StandAlone flag earlier (during initSystem);
Claus Gittinger <cg@exept.de>
parents: 6837
diff changeset
   641
12861
5086a864ae3e changed:
Claus Gittinger <cg@exept.de>
parents: 12813
diff changeset
   642
    NumberOfClassesHint := 10000.
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
   643
3499
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   644
    Initializing := true.
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   645
    AbstractOperatingSystem initializeConcreteClass.
5f8715a97ff5 switching to OS-subclasses
Claus Gittinger <cg@exept.de>
parents: 3492
diff changeset
   646
18307
c1d97d109f88 also care for empty cmd-line args (could be empty OrderedCollection)
Claus Gittinger <cg@exept.de>
parents: 18293
diff changeset
   647
    CommandLineArguments isEmptyOrNil ifTrue:[
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   648
        CommandLineArguments := #('stx') asOrderedCollection.
5400
af8fdc4d3e02 kludge (for rel5)
Claus Gittinger <cg@exept.de>
parents: 5373
diff changeset
   649
    ].
4006
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   650
    CommandLine := CommandLineArguments copy.
c7ad38c52eb9 must set CommandLineArguments earlier (to be available in initializeSystem)
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
   651
    CommandLineArguments := CommandLineArguments asOrderedCollection.
6842
a5110421e4ab more for standAlone start
Claus Gittinger <cg@exept.de>
parents: 6841
diff changeset
   652
    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
   653
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   654
    SilentLoading := Silent := false.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   655
    VerboseLoading := VerboseStartup := Verbose := false.
19427
cde32174b580 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19426
diff changeset
   656
    DebuggingStandAlone := Debugging := false.
19510
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   657
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   658
    "/ if no argument was given, look for an environment variable named
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   659
    "/ STX_DEFAULT_ARGS. If set, take that.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   660
    "/ if any argument was given, unless a --noShellArgs argument is given,
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   661
    "/ slice in the value from "STX_MORE_ARGS" at the beginning.
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   662
    "/
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   663
    "/ These allow for args like "--quick --infoPrint" to be automatically prepended
19511
96c72a572feb #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 19510
diff changeset
   664
    idx := CommandLineArguments indexOfAny:#('--noShellArgs' '--noshellargs').
19510
80255da5931a #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19492
diff changeset
   665
    (idx ~~ 0) ifTrue:[
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   666
        CommandLineArguments removeIndex:idx.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   667
    ] ifFalse:[
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   668
        CommandLineArguments isEmpty ifTrue:[
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   669
            shellArgs := OperatingSystem getEnvironment:'STX_DEFAULT_ARGS'.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   670
            shellArgs notEmptyOrNil ifTrue:[
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   671
                shellArgs := shellArgs asCollectionOfWords.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   672
                CommandLineArguments addAll:shellArgs.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   673
            ].
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   674
        ] ifFalse:[
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   675
            "/ prepend shell environment args from "STX_ARGS"
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   676
            shellArgs := OperatingSystem getEnvironment:'STX_MORE_ARGS'.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   677
            shellArgs notEmptyOrNil ifTrue:[
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   678
                shellArgs := shellArgs asCollectionOfWords.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   679
                CommandLineArguments addAllFirst:shellArgs.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   680
            ].
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   681
        ].
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   682
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   683
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   684
    self initializeVerboseFlags.
14432
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   685
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   686
    Error handle:[:ex |
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   687
        StandAlone ifTrue:[
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   688
            DebuggingStandAlone ifFalse:[
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   689
                'Startup Error - use "--debug" command line argument for more info' errorPrintCR.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   690
                Smalltalk exit:1.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   691
            ].
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   692
            'Smalltalk [error]: Error during early initialization:' errorPrintCR.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   693
            thisContext fullPrintAll.
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   694
        ].
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   695
        ex reject.
11057
a87e5e1574ca startup error handling
Claus Gittinger <cg@exept.de>
parents: 11054
diff changeset
   696
    ] do:[
25108
69be6667933a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25104
diff changeset
   697
        self basicInitializeSystem
14432
ac02f979ac12 debugging code removed
Claus Gittinger <cg@exept.de>
parents: 14431
diff changeset
   698
    ].
13091
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   699
bc840cd6f1ae --verboseLoading command line arg (shlib loading trace)
Claus Gittinger <cg@exept.de>
parents: 13061
diff changeset
   700
    "Modified: / 12-10-2010 / 11:27:47 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   701
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   702
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   703
initializeVerboseFlags
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   704
    |idx|
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   705
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   706
    StandAlone ifTrue:[
23677
1543d88d416d #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23670
diff changeset
   707
        InfoPrinting := Verbose := false.
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   708
        ObjectMemory infoPrinting:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   709
        IgnoreAssertions := true.
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   710
    ] ifFalse:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   711
        IgnoreAssertions := false.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   712
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
   713
19430
2e309bb80f95 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19429
diff changeset
   714
    (idx := CommandLineArguments indexOf:'--ignoreHalt') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   715
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   716
        IgnoreHalt := true.
19430
2e309bb80f95 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19429
diff changeset
   717
    ].
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   718
    (idx := CommandLineArguments indexOf:'--noIgnoreHalt') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   719
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   720
        IgnoreHalt := false.
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   721
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   722
    (idx := CommandLineArguments indexOf:'--ignoreAssert') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   723
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   724
        IgnoreAssertions := true.
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   725
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   726
    (idx := CommandLineArguments indexOf:'--noIgnoreAssert') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   727
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   728
        IgnoreAssertions := false.
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   729
    ].
22314
2c625b367211 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22241
diff changeset
   730
    (idx := CommandLineArguments indexOf:'--assert') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   731
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   732
        IgnoreAssertions := false.
22314
2c625b367211 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22241
diff changeset
   733
    ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   734
    (idx := CommandLineArguments indexOf:'--silentStartup') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   735
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   736
        SilentLoading := true.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   737
    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   738
    (idx := CommandLineArguments indexOf:'--verboseLoading') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   739
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   740
        VerboseLoading := true.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   741
    ].
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   742
    (idx := CommandLineArguments indexOf:'--verboseStartup') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   743
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   744
        VerboseLoading := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   745
        VerboseStartup := true.
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   746
    ].
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   747
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   748
    "/ reinterpret those, in case given after the VM options.
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   749
    (idx := CommandLineArguments indexOf:'--debugPrint') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   750
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   751
        ObjectMemory debugPrinting:true.
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   752
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   753
    (idx := CommandLineArguments indexOf:'--infoPrint') ~~ 0 ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   754
        CommandLineArguments removeIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   755
        ObjectMemory infoPrinting:true.
23679
3f4a3d56ed3e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23678
diff changeset
   756
        Object infoPrinting:true.
20855
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   757
    ].
4f5dd0743af3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20854
diff changeset
   758
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   759
    (idx := CommandLineArguments indexOf:'--verbose') ~~ 0 ifTrue:[
23679
3f4a3d56ed3e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23678
diff changeset
   760
        StandAlone ifFalse:[ CommandLineArguments removeIndex:idx ].
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   761
        Object infoPrinting:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   762
        Verbose := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   763
        VerboseLoading := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   764
        VerboseStartup := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   765
        Logger notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   766
            Logger loggingThreshold: Logger severityALL.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   767
        ].
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   768
    ].
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   769
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   770
    Silent := false.
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
   771
    (idx := CommandLineArguments indexOf:'--silent') ~~ 0 ifTrue:[
23679
3f4a3d56ed3e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23678
diff changeset
   772
        StandAlone ifFalse:[ CommandLineArguments removeIndex:idx ].
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   773
        Silent := SilentLoading := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   774
        Object infoPrinting:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   775
        ObjectMemory infoPrinting:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   776
        ObjectMemory debugPrinting:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   777
        Verbose := VerboseLoading := VerboseStartup := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   778
        Logger notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   779
            Logger loggingThreshold: Logger severityNONE
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   780
        ].
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   781
    ].
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   782
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   783
    idx := CommandLineArguments indexOf:'--debug'.
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   784
    Debugging := (idx ~~ 0).
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   785
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   786
    StandAlone ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   787
        DebuggingStandAlone := Debugging.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   788
        DebuggingStandAlone ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   789
            Inspector := MiniInspector.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   790
            Debugger := MiniDebugger.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   791
            IgnoreAssertions := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   792
        ].
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   793
    ] ifFalse:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   794
        "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   795
        "/ define low-level debugging tools - graphical classes are not prepared yet
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   796
        "/ to handle things.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   797
        "/ This will bring us into the MiniDebugger when an error occurs during startup.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   798
        "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   799
        Inspector := MiniInspector.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
   800
        Debugger := MiniDebugger.
21021
1f8d5bc2a53e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21020
diff changeset
   801
    ].
22314
2c625b367211 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22241
diff changeset
   802
2c625b367211 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22241
diff changeset
   803
    "Modified: / 12-10-2017 / 17:48:11 / cg"
23679
3f4a3d56ed3e #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23678
diff changeset
   804
    "Modified: / 06-02-2019 / 21:15:30 / Claus Gittinger"
18669
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   805
!
11586f97d3ec class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18668
diff changeset
   806
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   807
isInitialized
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   808
    "this returns true, if the system is properly initialized;
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
   809
     i.e. false during startup.
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
   810
     Especially, the whole display/viewing stuff and process escheduling
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
   811
     is not working correctly until initialized."
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   812
18251
9b7f8e531a16 isInitialized query during very early start
Claus Gittinger <cg@exept.de>
parents: 18248
diff changeset
   813
    Initializing isNil ifTrue:[^ false]. "/ if called very early
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   814
    ^ Initializing not
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   815
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   816
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   817
reinitStandardStreams
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   818
    "reinitialize some well-known streams.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   819
     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
   820
     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
   821
     (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
   822
8710aba7876b oops - making id's real objects requires a store macro
Claus Gittinger <cg@exept.de>
parents: 457
diff changeset
   823
    Stdout reOpen. Stderr reOpen. Stdin reOpen.
161
ed36169f354d *** empty log message ***
claus
parents: 159
diff changeset
   824
! !
ed36169f354d *** empty log message ***
claus
parents: 159
diff changeset
   825
16593
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   826
!Smalltalk class methodsFor:'Compatibility-GNU'!
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   827
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   828
system:command
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   829
    "GNU-Smalltalk compatibility: execute an OS command"
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   830
23714
bf5edd45306c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23683
diff changeset
   831
    ^ OperatingSystem executeCommand:command
16593
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   832
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   833
    "
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   834
     Smalltalk system:'ls'
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   835
    "
23714
bf5edd45306c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23683
diff changeset
   836
bf5edd45306c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23683
diff changeset
   837
    "Modified: / 10-02-2019 / 22:49:39 / Claus Gittinger"
16593
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   838
! !
aa343f9d9918 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16582
diff changeset
   839
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   840
!Smalltalk class methodsFor:'Compatibility-Squeak'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   841
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   842
beep
17343
ed954add0878 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17328
diff changeset
   843
    "output an audible beep or bell"
ed954add0878 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17328
diff changeset
   844
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   845
    Screen current beep
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   846
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   847
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   848
garbageCollect
15009
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   849
    "for Squeak compatibility"
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   850
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   851
    ObjectMemory garbageCollect
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   852
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   853
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   854
garbageCollectMost
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   855
    "collect recently created garbage; return the amount of freeSpace.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   856
     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
   857
     newSpace + freeListSpace is returned."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   858
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   859
    ObjectMemory scavenge.
15009
cd08c3e66a57 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14987
diff changeset
   860
    ^ ObjectMemory freeSpace + (ObjectMemory newSpaceSize - ObjectMemory newSpaceUsed)
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   861
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   862
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   863
isMorphic
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   864
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   865
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   866
10844
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   867
platformName
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   868
    "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
   869
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   870
    ^ OperatingSystem platformName asUppercaseFirst
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   871
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   872
    "
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   873
     Smalltalk platformName -> 'Win32'
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   874
    "
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   875
!
348d03bba747 squeak compatibility
Claus Gittinger <cg@exept.de>
parents: 10738
diff changeset
   876
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   877
removeClassNamed: aName
17576
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   878
    "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
   879
     Also needed by the refactory browser.
2d611305d7e6 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17548
diff changeset
   880
     If anything untoward happens, report it in the Transcript."
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   881
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   882
    | oldClass |
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   883
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   884
    (oldClass := self at: aName asSymbol ifAbsent: [nil]) isNil ifTrue:[
24414
e8fbf21c73b9 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24405
diff changeset
   885
        Transcript showCR:'Removal of class named %1 ignored because it does not exist.' with:aName.
e8fbf21c73b9 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24405
diff changeset
   886
        ^ self
12358
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   887
    ].
686986c54ccc added: #removeClassNamed:
Claus Gittinger <cg@exept.de>
parents: 12352
diff changeset
   888
    oldClass removeFromSystem
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   889
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   890
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
   891
!Smalltalk class methodsFor:'Compatibility-V''Age'!
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   892
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   893
allClassesImplementing:aSelector
12304
b0dc1c58de1a changed: #allClassesImplementing:
Claus Gittinger <cg@exept.de>
parents: 12301
diff changeset
   894
    ^ self allClassesForWhich:[:cls | cls includesSelector:aSelector].
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
   895
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
   896
    "Modified: / 10-08-2006 / 12:12:17 / cg"
9090
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   897
!
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   898
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   899
declareConstant:constantName poolName:poolNameArg value:value
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   900
    "visualAge compatible pool variable declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   901
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   902
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   903
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   904
    |ns poolName pool|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   905
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   906
    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   907
    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   908
    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   909
    (ns isNil or:[ns == Smalltalk]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   910
	poolName := poolNameArg asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   911
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   912
	poolName := (ns name,'::',poolNameArg) asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   913
    ].
9090
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   914
    pool := self classNamed:poolName.
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   915
    pool declareConstant:constantName value:value
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   916
!
19cfbd910506 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9082
diff changeset
   917
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   918
declarePoolDictionary:poolDictionaryNameArg
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   919
    "visualAge compatible pool declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   920
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   921
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   922
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   923
    |ns poolName|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   924
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   925
    poolName := poolDictionaryNameArg asSymbol.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   926
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   927
"/    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   928
"/    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   929
"/    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   930
"/    (ns isNil or:[ns == Smalltalk]) ifTrue:[
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   931
"/        poolName := poolDictionaryNameArg asSymbol
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   932
"/    ] ifFalse:[
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   933
"/        poolName := (ns name,'::',poolDictionaryNameArg) asSymbol
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
    ^ SharedPool subclass:(poolName asSymbol)
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   936
	instanceVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   937
	classVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   938
	poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   939
	category:'* VAST Pools'
13998
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   940
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   941
    "Modified: / 07-02-2012 / 15:56:16 / cg"
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   942
!
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   943
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   944
declareVariable:varName poolName:poolNameArg
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   945
    "visualAge compatible pool declaration.
16562
Claus Gittinger <cg@exept.de>
parents: 16504
diff changeset
   946
     called when a V'age application is filed in
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   947
     (or one of its changes is accepted via the change browser)"
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   948
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   949
    |ns poolName pool|
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   950
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   951
    "/ when coming from the change-browser,
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   952
    "/ a namespace override may be given...
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   953
    ns := Class nameSpaceQuerySignal query.
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   954
    (ns isNil or:[ns == Smalltalk]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   955
	poolName := poolNameArg asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   956
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   957
	poolName := (ns name,'::',poolNameArg) asSymbol
16459
447b9acb8163 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16269
diff changeset
   958
    ].
13998
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   959
    pool := self classNamed:poolName.
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   960
    pool declareVariable:varName
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   961
890d42903662 added: #declareVariable:poolName:
Claus Gittinger <cg@exept.de>
parents: 13958
diff changeset
   962
    "Created: / 07-02-2012 / 15:57:05 / cg"
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   963
! !
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
   964
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
   965
!Smalltalk class methodsFor:'Compatibility-VW'!
6094
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   966
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
   967
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
   968
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   969
	defineClass:nameSymbol
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   970
	superclass:superclass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   971
	indexedType:indexed
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   972
	private:private
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   973
	instanceVariableNames:instVars
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   974
	classInstanceVariableNames:classInstVars
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   975
	imports:imports
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   976
	category:category
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
   977
	attributes:nil
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   978
!
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   979
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
   980
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
   981
    |newClass|
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   982
79ebf84b51bd first attempt in supporting vw5.4 definitions
Claus Gittinger <cg@exept.de>
parents: 6080
diff changeset
   983
    indexed == #none ifTrue:[
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   984
        newClass := superclass
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   985
            subclass:nameSymbol
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   986
            instanceVariableNames:instVars
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   987
            classVariableNames:''
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   988
            poolDictionaries:''
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   989
            category:category
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   990
            inEnvironment:self.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   991
        classInstVars size ~~ 0 ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   992
            newClass class instanceVariableNames:classInstVars.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   993
        ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   994
        ^ newClass
6851
91662dfb3e80 Remove debug print.
Stefan Vogel <sv@exept.de>
parents: 6849
diff changeset
   995
    ].
91662dfb3e80 Remove debug print.
Stefan Vogel <sv@exept.de>
parents: 6849
diff changeset
   996
    self shouldImplement.
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   997
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
   998
    "Modified: / 01-03-2019 / 16:11:54 / Claus Gittinger"
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
   999
!
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1000
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1001
defineNameSpace:nameSymbol private:private imports:imports category:category
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1002
    |newNameSpace|
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1003
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1004
    private ifTrue:[self halt].     "/ what to do ?
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1005
    imports withoutSeparators notEmpty ifTrue:[self halt].     "/ what to do ?
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1006
    newNameSpace := NameSpace name:nameSymbol.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1007
    newNameSpace setCategory:category.
12033
Claus Gittinger <cg@exept.de>
parents: 12023
diff changeset
  1008
    ^ newNameSpace
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1009
!
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1010
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1011
dialectName
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1012
    ^ #SmalltalkX
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1013
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1014
    "
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1015
     Smalltalk dialectName
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1016
    "
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1017
!
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1018
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1019
dialectReleaseVersion
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1020
    ^ self versionString
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1021
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1022
    "
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1023
     Smalltalk dialectReleaseVersion
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1024
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1025
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1026
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1027
!Smalltalk class methodsFor:'accessing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1028
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1029
associationAt:aKey
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1030
    "return a key-value association for aKey.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1031
     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
  1032
     simulated here."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1033
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1034
    |val|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1035
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1036
    val := self at:aKey ifAbsent:[^ nil].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1037
    ^ Association key:aKey value:val
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
    "Created: / 1.11.1997 / 13:27:20 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1040
!
3083
451912c492ae checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3062
diff changeset
  1041
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1042
associationAt:aKey ifAbsent:exceptionBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1043
    "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
  1044
     from exceptionBlock, if no such key is present.
14973
086ef2bb2007 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14933
diff changeset
  1045
     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
  1046
     Warning: this is a compatibility interface only, with a different semantic as
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1047
	      the original ST80 implementation. The returned assoc is created on the fly,
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1048
	      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
  1049
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
  1050
    |val|
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
  1051
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1052
    val := self at:aKey ifAbsent:[^ exceptionBlock value].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1053
    ^ Association key:aKey value:val
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1054
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1055
    "Created: / 18.6.1998 / 17:05:24 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1056
!
3610
12f32c1fe72b added #associationAt:ifAbsent: for ST80 compatibility.
Claus Gittinger <cg@exept.de>
parents: 3565
diff changeset
  1057
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1058
at:aKey
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1059
    "retrieve the value stored under aKey, a symbol.
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1060
     Return nil if not present
1956
4eed0b627d52 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1955
diff changeset
  1061
     (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
  1062
16831
596e07380f6f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16803
diff changeset
  1063
    aKey class == Symbol ifFalse:[self error:'expected symbol'].
6080
15ea3cbf6003 renamed: #allSelectorsAndMethodsDo: into: #instAndClassSelectorsAndMethodsDo:
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  1064
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1065
%{  /* NOCONTEXT */
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1066
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1067
    {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1068
	STSymbol keySymbol = aKey.asSTSymbol();
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1069
	STObject val = STSmalltalkEnvironment.GetResolvedBindingOrNull(keySymbol);
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1070
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1071
	return context._RETURN( val == null ? Nil : val );
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1072
    }
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1073
    /* NOT REACHED */
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1074
#else
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1075
    RETURN ( __GLOBAL_GET(aKey) );
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1076
#endif
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  1077
%}.
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1078
    ^ self primitiveFailed
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1079
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1080
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1081
at:aKey ifAbsent:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1082
    "retrieve the value stored at aKey.
7565
cd76db5ee5cd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7564
diff changeset
  1083
     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
  1084
     the evaluation of aBlock."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1085
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1086
    |val|
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1087
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1088
    val := self at:aKey.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1089
    (val notNil or:[self includesKey:aKey]) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1090
	^ val
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1091
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1092
    ^ aBlock value
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1093
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1094
    "
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1095
     Smalltalk removeKey:#fooBar.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1096
     Smalltalk at:#fooBar                       <- returns nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1097
     Smalltalk at:#fooBar ifAbsent:['sorry']    <- no error
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1098
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1099
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1100
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1101
at:aKey ifAbsentPut:aBlock
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1102
    "return the element indexed by aKey if present,
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1103
     if not present, store the result of evaluating valueBlock
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1104
     under aKey and return it."
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1105
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1106
    ^ self at:aKey ifAbsent:[ self at:aKey put:aBlock value ].
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1107
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1108
    "Created: / 29-05-2007 / 12:41:12 / cg"
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1109
!
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  1110
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1111
at:aKey ifPresent:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1112
    "try to retrieve the value stored at aKey.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1113
     If there is nothing stored under this key, do nothing.
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1114
     Otherwise, evaluate aBlock, passing the retrieved value as argument."
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1115
13883
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
  1116
    |val|
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
  1117
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1118
    val := self at:aKey.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1119
    (val notNil or:[self includesKey:aKey]) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1120
	^ aBlock value:val.
4870
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1121
    ].
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1122
    ^ nil
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1123
3f6a8c368925 added #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 4846
diff changeset
  1124
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1125
     Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1126
     Smalltalk at:#Object ifPresent:[:what | Transcript showCR:what].
20161
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1127
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1128
     Smalltalk at:#fooBar put:nil.
64cc230c5a10 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 20122
diff changeset
  1129
     Smalltalk at:#fooBar ifPresent:[:what | Transcript showCR:what].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1130
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1131
13883
73d2c22a5438 changed: #at:ifPresent:
Claus Gittinger <cg@exept.de>
parents: 13851
diff changeset
  1132
    "Modified: / 27-12-2011 / 10:14:30 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1133
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1134
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1135
at:aKey put:aValue
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1136
    "store the argument aValue under aKey, a symbol.
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1137
     Return aValue (sigh)."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1138
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1139
    |oldValue|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1140
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1141
%{
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1142
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1143
    {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1144
	STSymbol keySymbol = aKey.asSTSymbol();
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1145
	oldValue = STSmalltalkEnvironment.SetBinding(keySymbol, aValue);
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1146
    }
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1147
#else
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1148
    oldValue = __GLOBAL_SET(aKey, aValue, (OBJ *)0);
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1149
#endif
453
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
    CachedClasses notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1152
	oldValue isBehavior ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1153
	    oldValue name == aKey ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1154
		CachedClasses remove:oldValue ifAbsent:[]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1155
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1156
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1157
	aValue isBehavior ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1158
	    aValue name == aKey ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1159
		CachedClasses add:aValue
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1160
	    ] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1161
		CachedClasses := nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1162
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1163
	].
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1164
    ].
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  1165
    ^ aValue.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1166
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1167
    "Modified: 19.4.1996 / 11:31:49 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1168
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1169
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1170
includesKey:aKey
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1171
    "return true, if the key is known"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1172
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1173
    "/ for debugging - this is a common mistake,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1174
    "/ to try to access a class by nameString, instead
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1175
    "/ of by symbol.
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
    "/ aKey class == String ifTrue:[self halt].
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
%{  /* NOCONTEXT */
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1180
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1181
    STSymbol keySymbol = aKey.asSTSymbol();
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1182
    return __c__._RETURN( STSmalltalkEnvironment.HasBinding(keySymbol) ? STObject.True : STObject.False);
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1183
    /* NOT REACHED */
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1184
#else
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1185
    RETURN ( __GLOBAL_KEYKNOWN(aKey) );
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1186
#endif
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1187
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1188
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1189
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1190
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1191
keyAtValue:anObject
21365
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1192
    "return the symbol under which anObject is stored - or nil.
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1193
     This is a slow access, since the receiver is searched sequentially.
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1194
     NOTICE:
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1195
	The value is searched using identity compare"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1196
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1197
    self keysDo:[:aKey |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1198
	(self at:aKey) == anObject ifTrue:[^ aKey]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1199
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1200
    ^ nil
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1201
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1202
    "Smalltalk keyAtValue:Object"
21365
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1203
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1204
    "Modified (comment): / 07-02-2017 / 11:06:21 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1205
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1206
21363
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1207
keyAtValue:anObject ifAbsent:exceptionValue
21365
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1208
    "return the symbol under which anObject is stored - or the value from exceptionValue.
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1209
     This is a slow access, since the receiver is searched sequentially.
730217a3920c #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21363
diff changeset
  1210
     NOTICE:
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1211
	The value is searched using identity compare"
21363
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1212
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1213
    self keysDo:[:aKey |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1214
	(self at:aKey) == anObject ifTrue:[^ aKey]
21363
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1215
    ].
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1216
    ^ exceptionValue value
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1217
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1218
    "
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1219
     Smalltalk keyAtValue:Object ifAbsent:#foo
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1220
     Smalltalk keyAtValue:1234 ifAbsent:#foo
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1221
    "
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1222
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1223
    "Created: / 07-02-2017 / 10:58:51 / cg"
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1224
!
dbd8602f07b1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21338
diff changeset
  1225
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1226
keys
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1227
    "return a collection with all keys in the Smalltalk dictionary"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1228
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1229
    |keys|
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1230
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1231
    keys := IdentitySet new.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1232
    self keysDo:[:k | keys add:k].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1233
    ^ keys
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1234
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1235
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1236
removeKey:aKey
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1237
    "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
  1238
     WARNING:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1239
	this is somewhat dangerous: conceptionally, the association is removed,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1240
	to which machine & byte compiled code refers if it accesses a global.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1241
	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
  1242
	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
  1243
	value.  (which is correct)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1244
	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
  1245
	the new global now referenced via the new association.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1246
	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
  1247
	(this is questionable).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1248
	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
  1249
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1250
    CachedClasses := nil.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1251
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1252
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1253
    RETURN ( __GLOBAL_REMOVE(aKey) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1254
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1255
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1256
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1257
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1258
10538
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1259
startBlocks
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1260
    ^ StartBlocks
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1261
!
7db2e140567f #startBlocks
Stefan Vogel <sv@exept.de>
parents: 10471
diff changeset
  1262
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1263
values
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1264
    "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
  1265
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1266
    |values|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1267
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1268
    values := OrderedCollection new.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1269
    self do:[:v | values add:v].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1270
    ^ values
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1271
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1272
    "Created: 20.6.1997 / 16:58:28 / cg"
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
13540
37ff6f12f224 changed: #start
Claus Gittinger <cg@exept.de>
parents: 13539
diff changeset
  1275
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1276
!Smalltalk class methodsFor:'browsing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1277
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1278
browseAllCallsOn:aSelectorSymbol
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1279
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1280
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1281
    "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
  1282
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1283
    SystemBrowser default browseAllCallsOn:aSelectorSymbol
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1284
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1285
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1286
     Smalltalk browseAllCallsOn:#at:put:
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1287
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1288
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1289
    "Modified: / 01-09-2017 / 14:21:31 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1290
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1291
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1292
browseAllSelect:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1293
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1294
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1295
    "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
  1296
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1297
    SystemBrowser default browseAllSelect:aBlock
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1298
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1299
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1300
     Smalltalk browseAllSelect:[:m | m literals isNil]
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1301
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1302
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1303
    "Modified: / 01-09-2017 / 14:21:34 / cg"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1304
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1305
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1306
browseChanges
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1307
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1308
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1309
    "startup a changes browser"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1310
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1311
    ChangesBrowser notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1312
	ChangesBrowser open
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1313
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1314
	self warn:'no ChangesBrowser built in'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1315
    ]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1316
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1317
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1318
     Smalltalk browseChanges
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1319
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1320
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1321
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1322
browseClass:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1323
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1324
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  1325
    "startup a browser on aClass.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1326
     The broser will only show that class (i.e. be a singleClass-browser).
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1327
     See browseInClass: for a full browser, which has aClass selected initially."
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1328
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1329
    SystemBrowser default browseClass:aClass
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1330
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1331
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1332
     Smalltalk browseClass:Array
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1333
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1334
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1335
    "Modified: / 01-09-2017 / 14:21:37 / cg"
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1336
!
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1337
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1338
browseImplementorsMatching:aSelectorSymbolOrMatchPattern
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1339
    "{ Pragma: +optSpace }"
6819
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1340
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1341
    "startup a browser for all methods implementing a message matching"
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1342
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1343
    SystemBrowser default browseImplementorsMatching:aSelectorSymbolOrMatchPattern
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1344
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1345
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1346
     Smalltalk browseImplementorsOf:#'at:put:'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1347
     Smalltalk browseImplementorsMatching:#'at:*'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1348
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1349
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1350
    "Modified: / 01-09-2017 / 14:21:39 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1351
!
6819
6b7885c187d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6806
diff changeset
  1352
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1353
browseImplementorsOf:aSelectorSymbol
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1354
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1355
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1356
    "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
  1357
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1358
    SystemBrowser default browseImplementorsOf:aSelectorSymbol
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1359
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1360
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1361
     Smalltalk browseImplementorsOf:#at:put:
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1362
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1363
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1364
    "Modified: / 01-09-2017 / 14:21:42 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1365
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1366
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1367
browseInClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1368
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1369
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1370
    "startup a full browser showing aClass.
20207
17e32d469ac6 #OTHER by mawalch
mawalch
parents: 20161
diff changeset
  1371
     The browser will be a full browser with aClass initially selected.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1372
     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
  1373
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1374
    SystemBrowser default openInClass:aClass
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1375
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1376
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1377
     Smalltalk browseInClass:Array
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1378
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1379
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1380
    "Modified: / 01-09-2017 / 14:21:46 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1381
!
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1382
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1383
browseInClass:aClass selector:selector
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1384
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1385
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1386
    "startup a full browser showing aClass>>selector.
20207
17e32d469ac6 #OTHER by mawalch
mawalch
parents: 20161
diff changeset
  1387
     The browser will be a full browser with aClass initially selected.
11150
be60e4505904 comments
Claus Gittinger <cg@exept.de>
parents: 11108
diff changeset
  1388
     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
  1389
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1390
    SystemBrowser default openInClass:aClass selector:selector
6970
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1391
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1392
    "
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1393
     Smalltalk browseInClass:Array selector:#at:
ac358e651731 more browsing
Claus Gittinger <cg@exept.de>
parents: 6929
diff changeset
  1394
    "
22241
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1395
65d1ed21a2a3 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22147
diff changeset
  1396
    "Modified: / 01-09-2017 / 14:21:49 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1397
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1398
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1399
!Smalltalk class methodsFor:'class management'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1400
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1401
basicRemoveClass:aClass
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1402
    "remove the argument, aClass from the smalltalk dictionary;
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1403
     we have to flush the caches since these methods are now void.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1404
     Also, class variables of aClass are removed."
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
    |sym cSym names oldName oldNameSym actualName wrongName|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1407
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1408
    aClass isNil ifTrue:[^ self].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1409
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1410
    oldName := aClass name.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1411
    sym := oldNameSym := oldName asSymbol.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1412
    ((self at:oldNameSym) == aClass) ifFalse:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1413
	"check other name ..."
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1414
	(self includes:aClass) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1415
	    'Smalltalk [warning]: no such class: ' errorPrint. oldName errorPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1416
	    ^ self
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1417
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1418
	"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1419
	 the class has changed its name - without telling me ...
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1420
	 what should be done in this case ?
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1421
	"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1422
	'Smalltalk [warning]: class ' errorPrint. oldName errorPrint.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1423
	' has changed its name' errorPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1424
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1425
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1426
	"/ might be an alias (i.e. removing a compatibility name)
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1427
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1428
	actualName := self keyAtValue:aClass.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1429
	('Smalltalk [info]: ' , oldName , ' is actually stored as ' , actualName , '.') infoPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1430
	sym := actualName asSymbol.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1431
	oldName := actualName asString.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1432
	wrongName := true.
18732
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
    self at:sym put:nil.    "nil it out for compiled accesses"
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1436
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1437
    "/
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1438
    "/ 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
  1439
    "/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1440
    "/ self removeKey:sym.     "/ remove key - this actually fails, if there are
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1441
			       "/ still compiled code references."
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1442
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1443
    "remove private classes"
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
    aClass privateClassesSorted do:[:somePrivateClass |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1446
	aClass privateClassesAt:(somePrivateClass nameWithoutPrefix) asSymbol put:nil.
18732
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
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1449
    "remove class variables"
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
    names := aClass classVariableString asCollectionOfWords.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1452
    names do:[:name |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1453
	cSym := aClass globalKeyForClassVar:name.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1454
	self at:cSym asSymbol put:nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1455
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1456
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1457
	"/ see comment in removeKey: on why we dont remove it here
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1458
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1459
	"/ self removeKey:cSym
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1460
    ].
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
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1463
"/    actually could get along with less flushing
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1464
"/    (entries for aClass and subclasses only)
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1465
"/    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
  1466
"/    at hand - for now, searching for all subclasses is way more
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1467
"/    expensive then cache flushing.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1468
"/
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1469
"/    aClass allSubclassesDo:[:aSubclass |
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1470
"/        ObjectMemory flushInlineCachesForClass:aSubclass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1471
"/        ObjectMemory flushMethodCacheFor:aSubclass
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
"/    ObjectMemory flushInlineCachesForClass:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1474
"/    ObjectMemory flushMethodCacheFor:aClass
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1475
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1476
    ObjectMemory flushInlineCaches.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1477
    ObjectMemory flushMethodCache.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1478
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1479
    aClass addChangeRecordForClassRemove.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1480
    self changed:#classRemove with:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1481
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1482
    aClass setCategory:#'* removed *'.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1483
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1484
"/    self flushCachedClasses.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1485
"/    Class flushSubclassInfo.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1486
    self flushCachedClass:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1487
    Class flushSubclassInfoFor:aClass superclass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1488
    Class flushSubclassInfoFor:aClass.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1489
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1490
    wrongName == true ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1491
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1492
	"/ an alias (i.e. removing a compatibility name)
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1493
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1494
	"/ check if there are more refs to it ...
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1495
	[self includes:aClass] whileTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1496
	    actualName := self keyAtValue:aClass.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1497
	    ('Smalltalk [info]: ' , aClass name , ' is also registered under the name ' , actualName
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1498
			  , ' - remove that binding too.') infoPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1499
	    self at:actualName put:nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1500
	].
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1501
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1502
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1503
    "Modified: / 18-11-2006 / 17:16:31 / cg"
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1504
!
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1505
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1506
changeCategoryOf:aClass to:newCategory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1507
    "change a classes category, add a change record,
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1508
     send change notifications"
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1509
8405
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1510
    |ns oldCategory|
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1511
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1512
    oldCategory := aClass category.
079fd61dc699 *** empty log message ***
ca
parents: 8383
diff changeset
  1513
    oldCategory ~= newCategory ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1514
	aClass category:(newCategory withoutSeparators asSymbol).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1515
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1516
	"notify change of category"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1517
	ns := aClass environment ? self.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1518
	ns changed:#organization with:(aClass -> oldCategory).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1519
	ns ~~ self ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1520
	    self changed:#organization with:(aClass -> oldCategory).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1521
	]
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1522
    ].
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1523
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1524
    "
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1525
     Smalltalk changeCategoryOf:NewApplication to:#myApplications
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1526
    "
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1527
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1528
    "Modified: / 11.2.2000 / 11:36:27 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1529
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1530
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1531
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
  1532
    NameSpace name:name
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1533
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1534
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1535
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1536
flushCachedClass:aClass
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1537
    CachedClasses notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1538
	CachedClasses remove:aClass ifAbsent:[].
12700
5af24c64fbed changed:
Claus Gittinger <cg@exept.de>
parents: 12645
diff changeset
  1539
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1540
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1541
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1542
flushCachedClasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1543
    CachedClasses := nil.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1544
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1545
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1546
     Smalltalk flushCachedClasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1547
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1548
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1549
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1550
removeClass:aClass
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1551
    "remove the argument, aClass from the smalltalk dictionary;
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1552
     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
  1553
     Also, class variables of aClass are removed.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1554
     Recompile accessors to aClass."
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1555
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1556
    |oldNameSym ns ons|
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1557
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1558
    oldNameSym := aClass name asSymbol.
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1559
    ns := aClass nameSpace.
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1560
    aClass topOwningClass notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1561
	ons := aClass topOwningClass nameSpace
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1562
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1563
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1564
    self basicRemoveClass:aClass.
4724
44793fe70787 recompile ns classes after a class remove
Claus Gittinger <cg@exept.de>
parents: 4723
diff changeset
  1565
4781
631eb425ea4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4770
diff changeset
  1566
    ns ~~ Smalltalk ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1567
	ons notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1568
	    ClassBuilder
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1569
		recompileGlobalAccessorsTo:oldNameSym
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1570
		in:ons
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1571
		except:nil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1572
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1573
	(ns notNil and:[ns ~~ ons]) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1574
	    ClassBuilder
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1575
		recompileGlobalAccessorsTo:oldNameSym
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1576
		in:ns
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1577
		except:nil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1578
	].
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1579
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1580
!
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1581
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1582
removeClasses:aCollectionOfClasses
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1583
    "remove aCollectionOfClasses from the smalltalk dictionary;
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1584
     we have to flush the caches since these methods are now void.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1585
     Also, class variables of aClass are removed.
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1586
     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
  1587
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1588
    |tuples|
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
    tuples := aCollectionOfClasses collect:[:eachClass|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1591
		Array
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1592
		    with:eachClass name asSymbol
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1593
		    with:eachClass nameSpace
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1594
		    with:(
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1595
			    eachClass topOwningClass notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1596
				eachClass topOwningClass nameSpace
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1597
			    ] ifFalse:[nil])
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1598
	    ].
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1599
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1600
    aCollectionOfClasses do:[:eachClass|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1601
	self basicRemoveClass:eachClass.
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1602
    ].
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1603
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1604
    tuples do:[:eachClssymNsOnsTuple|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1605
	|oldNameSym ns ons|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1606
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1607
	oldNameSym := eachClssymNsOnsTuple at:1.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1608
	ns := eachClssymNsOnsTuple at:2.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1609
	ons := eachClssymNsOnsTuple at:3.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1610
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1611
	ns ~~ Smalltalk ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1612
	    ons notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1613
		ClassBuilder
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1614
		    recompileGlobalAccessorsTo:oldNameSym
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1615
		    in:ons
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1616
		    except:nil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1617
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1618
	    (ns notNil and:[ns ~~ ons]) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1619
		ClassBuilder
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1620
		    recompileGlobalAccessorsTo:oldNameSym
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1621
		    in:ns
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1622
		    except:nil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1623
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  1624
	]
18732
34212221028c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18707
diff changeset
  1625
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1626
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1627
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1628
renameClass:aClass to:newName
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1629
    "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
  1630
     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
  1631
     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
  1632
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1633
    |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
  1634
     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
  1635
     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
  1636
     oldMetaclass newMetaclass newCategory|
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1637
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1638
    "/ check for all intermediate namespaces / owning classes
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1639
    i1 := 1.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1640
    i2 := 1.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1641
    ns := self.
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1642
    [i2 ~~ 0] whileTrue:[
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1643
        i2 := newName indexOfSubCollection:'::' startingAt:i1.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1644
        i2 ~~ 0 ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1645
            nm := newName copyFrom:i1 to:i2-1.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1646
            ns isNameSpace ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1647
                subns := ns at:nm asSymbol ifAbsent:nil.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1648
                subns isNil ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1649
                    self error:'Nonexisting namespace: ',nm.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1650
                    ^ nil.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1651
                ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1652
            ] ifFalse:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1653
                subns := ns privateClassesAt:nm asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1654
                subns isNil ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1655
                    self error:'Cannot create a namespace below a class'
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1656
                ]
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1657
            ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1658
            ns := subns.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1659
            i1 := i2 + 2.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1660
        ].
5253
c6b2933882fe rename with namespace involved;
Claus Gittinger <cg@exept.de>
parents: 5247
diff changeset
  1661
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1662
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1663
    oldName := aClass name.
6734
dd9fa2d81cb9 use #topNameSpace
Claus Gittinger <cg@exept.de>
parents: 6722
diff changeset
  1664
    oldNameSpace := aClass topNameSpace.
2319
640bb389f90a recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents: 2317
diff changeset
  1665
    oldBaseName := aClass nameWithoutNameSpacePrefix.
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1666
    oldBaseNameWithoutPrefix := aClass nameWithoutPrefix.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1667
    oldSym := oldName asSymbol.
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1668
    privateClasses := aClass privateClassesSorted.
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1669
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1670
    ((self at:oldSym) ~~ aClass) ifTrue:[
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1671
        'Smalltalk [warning]: rename failed - name is different from key' errorPrintCR.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1672
        ^ self
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1673
    ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1674
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1675
    "/ rename the class
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1676
1847
6e567214b167 care for className being a symbol, when renaming classes
Claus Gittinger <cg@exept.de>
parents: 1758
diff changeset
  1677
    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
  1678
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1679
    "/ change the owning class
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1680
    ns isNameSpace ifFalse:[
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1681
        aClass isPrivate ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1682
            aClass class setOwningClass:ns.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1683
        ] ifFalse:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1684
            "/ sigh - must make a PrivateMetaclass from Metaclass
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1685
            oldMetaclass := aClass class.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1686
            newMetaclass := PrivateMetaclass new.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1687
            newMetaclass flags:(oldMetaclass flags).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1688
            newMetaclass setSuperclass:(oldMetaclass superclass).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1689
            newMetaclass instSize:(oldMetaclass instSize).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1690
            newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1691
            newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1692
            newMetaclass setSoleInstance:aClass.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1693
            newMetaclass setOwningClass:ns.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1694
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1695
            aClass changeClassTo:newMetaclass.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1696
            ObjectMemory flushCaches.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1697
        ]
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1698
    ] ifTrue:[
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1699
        aClass isPrivate ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1700
            newCategory := aClass topOwningClass category.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1701
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1702
            "/ sigh - must make a Metaclass from PrivateMetaclass
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1703
            oldMetaclass := aClass class.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1704
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1705
            newMetaclass := Metaclass new.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1706
            newMetaclass flags:(oldMetaclass flags).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1707
            newMetaclass setSuperclass:(oldMetaclass superclass).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1708
            newMetaclass instSize:(oldMetaclass instSize).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1709
            newMetaclass setInstanceVariableString:(oldMetaclass instanceVariableString).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1710
            newMetaclass setMethodDictionary:(oldMetaclass methodDictionary).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1711
            newMetaclass setSoleInstance:aClass.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1712
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1713
            aClass category:newCategory.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1714
            aClass changeClassTo:newMetaclass.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1715
            ObjectMemory flushCaches.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1716
        ]
5610
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1717
    ].
af0d91fe32fc rename fixed (if it implies a nameSpace or ownership change)
Claus Gittinger <cg@exept.de>
parents: 5601
diff changeset
  1718
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1719
    aClass setName:newSym.
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1720
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1721
    "/ store it in Smalltalk
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1722
    self at:oldSym put:nil.
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  1723
878
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1724
    "/
20811
f372f9dccfb2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20772
diff changeset
  1725
    "/ 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
  1726
    "/
c09b016c6674 do not remove a global-assoc when classes are removed (see comment there)
Claus Gittinger <cg@exept.de>
parents: 857
diff changeset
  1727
    "/ self removeKey:oldSym.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1728
    self at:newSym put:aClass.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1729
1525
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1730
    "/ 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
  1731
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1732
    oldNameToNewName := IdentityDictionary new.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1733
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1734
    names := aClass classVariableString asCollectionOfWords.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1735
    names do:[:name |
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1736
        oldCVSym := (oldSym , ':' , name) asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1737
        value := self at:oldCVSym.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1738
        self at:oldCVSym put:nil.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1739
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1740
        "/
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1741
        "/ see comment in #removeKey: on why we dont remove it it here
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1742
        "/
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1743
        "/ self removeKey:cSym.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1744
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1745
        newCVSym := (newSym , ':' , name) asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1746
        self at:newCVSym put:value.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1747
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1748
        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
  1749
    ].
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1750
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1751
    "/ 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
  1752
935b12ecf8ff in renameClass: patch literals of all methods to access the renamed
Claus Gittinger <cg@exept.de>
parents: 1481
diff changeset
  1753
    oldNameToNewName keysAndValuesDo:[:oldNameSym :newNameSym |
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1754
        aClass withAllSubclasses do:[:aSubClass |
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1755
            Transcript showCR:'changing global accesses from ''' , oldNameSym , ''' into ''' , newNameSym , ''' in class: ''' , aSubClass name , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1756
            aSubClass instAndClassSelectorsAndMethodsDo:[:sel :aMethod |
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1757
                aMethod changeLiteral:oldNameSym to:newNameSym
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1758
            ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1759
        ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1760
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1761
        "/ and also in privateClasses ? ...
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1762
2485
9f4a11a4521f new #privateClasses semantic
Claus Gittinger <cg@exept.de>
parents: 2476
diff changeset
  1763
"/        privateClasses size > 0 ifTrue:[
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1764
"/            privateClasses do:[:aPrivateClass |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1765
"/                aPrivateClass withAllSubclasses do:[:aSubClass |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1766
"/                    aSubClass class methodDictionary do:[:aMethod |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1767
"/                        aMethod changeLiteral:oldNameSym to:newNameSym
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1768
"/                    ].
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1769
"/                    aSubClass methodDictionary do:[:aMethod |
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1770
"/                        aMethod changeLiteral:oldNameSym to:newNameSym
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1771
"/                    ]
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1772
"/                ].
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1773
"/            ]
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1774
"/        ]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1775
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1776
2270
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1777
    aClass addChangeRecordForClassRename:oldSym to:newSym.
76c239686353 when renaming a class, also rename any private classes.
Claus Gittinger <cg@exept.de>
parents: 2249
diff changeset
  1778
5333
d80386e06d21 rename into other namespace did not work
Claus Gittinger <cg@exept.de>
parents: 5328
diff changeset
  1779
    "/ 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
  1780
    aClass setEnvironment:nil.
6734
dd9fa2d81cb9 use #topNameSpace
Claus Gittinger <cg@exept.de>
parents: 6722
diff changeset
  1781
    newNameSpace := aClass topNameSpace.
2405
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1782
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1783
    privateClasses size ~~ 0 ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1784
        "/ must rename privateClasses as well
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1785
        Class withoutUpdatingChangesDo:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1786
            privateClasses do:[:aPrivateClass |
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1787
                self renameClass:aPrivateClass
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1788
                     to:(newSym , '::' , aPrivateClass nameWithoutPrefix).
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1790
                Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldName , '::' , aPrivateClass nameWithoutPrefix , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1791
                aClass theNonMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1792
                aClass theMetaclass recompileMethodsAccessingGlobal:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1793
                aClass theNonMetaclass recompileMethodsAccessingGlobal:(aPrivateClass nameWithoutPrefix) asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1794
                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
  1795
"/                ClassBuilder
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1796
"/                    recompileGlobalAccessorsTo:(oldName , '::' , aPrivateClass nameWithoutPrefix) asSymbol
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  1797
"/                    in:newNameSpace
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1798
"/                    except:nil.
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1799
            ]
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1800
        ]
2405
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1801
    ].
939f4e751ef3 dont forget to rename private classes as well.
Claus Gittinger <cg@exept.de>
parents: 2379
diff changeset
  1802
2319
640bb389f90a recompile when moving classes across namespaces
Claus Gittinger <cg@exept.de>
parents: 2317
diff changeset
  1803
    oldNameSpace ~~ newNameSpace ifTrue:[
5246
2ca7b20c4108 create namespaces as requried, when renaming a class
Claus Gittinger <cg@exept.de>
parents: 5214
diff changeset
  1804
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1805
        "/ all those referencing the class from the old nameSpace
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1806
        "/ must be recompiled ...
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1807
        "/ (to now access the global from smalltalk)
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1808
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1809
        oldNameSpace ~~ Smalltalk ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1810
            Transcript showCR:'recompiling methods in ''' , oldNameSpace name , ''' accessing ''' , oldName , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1811
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1812
            ClassBuilder
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1813
                recompileGlobalAccessorsTo:oldName asSymbol
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1814
                in:oldNameSpace
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1815
                except:nil.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1816
        ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1817
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1818
        "/ all referencing the class in the new namespace
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1819
        "/ as well; to now access the new class.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1820
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1821
        (newNameSpace notNil and:[newNameSpace ~~ Smalltalk]) ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1822
            Transcript showCR:'recompiling methods in ''' , newNameSpace name , ''' accessing ''' , oldBaseName , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1823
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1824
            ClassBuilder
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1825
                recompileGlobalAccessorsTo:oldBaseName asSymbol
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1826
                in:newNameSpace
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1827
                except:nil.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1828
        ].
3698
8bce45214d24 fixed renaming of a private class (must recompile owner)
Claus Gittinger <cg@exept.de>
parents: 3678
diff changeset
  1829
    ] ifFalse:[
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1830
        "/ all references to a global with my new name in my owning class
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1831
        "/ must now be redirected to myself.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1832
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1833
        aClass isPrivate ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1834
            newBaseName := aClass nameWithoutNameSpacePrefix.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1835
            newBaseNameWithoutPrefix := aClass nameWithoutPrefix.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1836
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1837
            Transcript showCR:'recompiling methods accessing ''' , oldBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1838
            aClass owningClass recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1839
            aClass owningClass class recompileMethodsAccessingGlobal:oldBaseNameWithoutPrefix.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1840
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1841
            Transcript showCR:'recompiling methods accessing ''' , oldBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1842
            aClass owningClass recompileMethodsAccessingGlobal:oldBaseName.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1843
            aClass owningClass class recompileMethodsAccessingGlobal:oldBaseName.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1844
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1845
            Transcript showCR:'recompiling methods accessing ''' , newBaseNameWithoutPrefix , ''' in: ''' , aClass owningClass name , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1846
            aClass owningClass recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1847
            aClass owningClass class recompileMethodsAccessingGlobal:newBaseNameWithoutPrefix.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1848
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1849
            Transcript showCR:'recompiling methods accessing ''' , newBaseName , ''' in: ''' , aClass owningClass name , ''' ...'.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1850
            aClass owningClass recompileMethodsAccessingGlobal:newBaseName.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1851
            aClass owningClass class recompileMethodsAccessingGlobal:newBaseName.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1852
        ]
4040
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1853
    ].
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1854
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1855
    aClass changed:#definition.
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1856
    "/ 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
  1857
    aClass allSubclassesDo:[:subClass |
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1858
        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
  1859
    ].
facae0a118da when a class is renamed, add change records for all subclasses
Claus Gittinger <cg@exept.de>
parents: 7992
diff changeset
  1860
    "/ 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
  1861
    aClass subclassesDo:[:subClass |
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1862
        subClass addChangeRecordForClass:subClass.
4040
b27f87d9772d must send a change-notifiction, when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 4028
diff changeset
  1863
    ].
5613
b534e427f028 change message when renaming a class
Claus Gittinger <cg@exept.de>
parents: 5611
diff changeset
  1864
    self changed:#definition.
14611
5c3a6b7ed01d class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14589
diff changeset
  1865
    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
  1866
9822
38acd1c5eeab recompile methods which access private classes when renaming a class.
Claus Gittinger <cg@exept.de>
parents: 9819
diff changeset
  1867
    "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
  1868
    "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
  1869
    "Modified: / 05-09-2006 / 12:52:25 / cg"
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  1870
    "Modified: / 01-03-2019 / 16:12:03 / Claus Gittinger"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1871
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1872
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1873
!Smalltalk class methodsFor:'copying'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1874
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1875
deepCopy
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1876
    "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
  1877
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1878
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1879
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1880
    "Modified: 18.5.1996 / 12:13:33 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1881
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1882
10952
16d46611f7ae deepCopy change
ab
parents: 10904
diff changeset
  1883
deepCopyUsing:aDictionary postCopySelector:postCopySelector
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1884
    "return a deep copy of the receiver.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1885
     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
  1886
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1887
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1888
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1889
    "Modified: 18.5.1996 / 12:13:36 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1890
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1891
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1892
shallowCopy
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1893
    "redefined to return self - there is only one Smalltalk dictionary"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1894
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1895
    ^ self
1410
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1896
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1897
    "Modified: 18.5.1996 / 12:13:39 / cg"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1898
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1899
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1900
simpleDeepCopy
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1901
    "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
  1902
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1903
    ^ self
1410
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1904
518bf8454809 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1307
diff changeset
  1905
    "Modified: 18.5.1996 / 12:13:42 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1906
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1907
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  1908
!Smalltalk class methodsFor:'debugging ST/X'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1909
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1910
compileTrace:aBoolean
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1911
    "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
  1912
%{
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1913
    extern char __compileTrace__;
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1914
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1915
    __compileTrace__ = (aBoolean == true) ? 1 : 0;
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1916
%}
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1917
    "
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1918
     Smalltalk compileTrace:true
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1919
     Smalltalk compileTrace:false
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1920
    "
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1921
!
f424d3e7978f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7295
diff changeset
  1922
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1923
debugBreakPoint
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1924
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1925
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1926
    "call the dummy debug function, on which a breakpoint
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1927
     can be put in adb, sdb, dbx or gdb.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1928
     WARNING: this method is for debugging only
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1929
	      it will be removed without notice."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1930
%{
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1931
    __PATCHUPCONTEXTS(__context);
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1932
    __debugBreakPoint__();
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1933
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1934
    ^ self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1935
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  1936
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1937
exitWithCoreDump
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1938
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1939
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1940
    "abort the program and dump core"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1941
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1942
    OperatingSystem exitWithCoreDump
4096
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1943
    "/ never returns
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1944
20755
8266a42d28e3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20746
diff changeset
  1945
    "Be careful evaluating this:
4096
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1946
     Smalltalk exitWithCoreDump
d292495070db exitWithCoreDump was duplicate
Claus Gittinger <cg@exept.de>
parents: 4067
diff changeset
  1947
    "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1948
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1949
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1950
fatalAbort
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1951
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1952
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1953
    "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
  1954
     (You may turn off the stack print with debugPrinting:false)"
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1955
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1956
    self fatalAbort:'fatalAbort'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  1957
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1958
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1959
fatalAbort:aMessage
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1960
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1961
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  1962
    "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
  1963
     (You may turn off the stack print with debugPrinting:false)"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1964
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1965
%{
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1966
#ifdef __SCHTEAM__
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1967
    STMain.fatalAbort( aMessage );
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1968
    /* NOT REACHED */
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1969
#else
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1970
    char *msg;
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1971
12481
805176d238d2 change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 12413
diff changeset
  1972
    if (__isStringLike(aMessage))
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1973
	msg = (char *) __stringVal(aMessage);
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1974
    else
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  1975
	msg = "fatalAbort";
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1976
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1977
    __fatal0(__context, msg);
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  1978
    /* NEVER RETURNS */
18287
ec8170701a7e steam code
Claus Gittinger <cg@exept.de>
parents: 18283
diff changeset
  1979
#endif
5410
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1980
%}.
859c010edb47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  1981
    ^ self primitiveFailed
5441
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5427
diff changeset
  1982
!
e88302747bbd rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5427
diff changeset
  1983
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1984
ignoreHalt
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1985
    "return true, if halts are ignored.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1986
     Usually, this is done in standAlone applications"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1987
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1988
    IgnoreHalt isNil ifTrue:[
23678
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  1989
        ^ self isStandAloneApp
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1990
    ].
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1991
    ^ IgnoreHalt
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1992
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1993
    "Created: / 18-11-2010 / 11:20:16 / cg"
23678
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  1994
    "Modified: / 06-02-2019 / 20:39:16 / Claus Gittinger"
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1995
!
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1996
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1997
ignoreHalt:aBoolean
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  1998
    "control if halts are to be ignored;
13135
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  1999
     usually, this is done in standAlone applications"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2000
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2001
    IgnoreHalt := aBoolean
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2002
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2003
    "
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2004
     Smalltalk ignoreHalt:true.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2005
     self halt.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2006
     Smalltalk ignoreHalt:false.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2007
     self halt.
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2008
    "
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2009
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2010
    "Created: / 18-11-2010 / 11:20:27 / cg"
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2011
!
1031ffdd98fd ignoreHalt is now a classVar
Claus Gittinger <cg@exept.de>
parents: 13129
diff changeset
  2012
23678
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2013
silent
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2014
    "returns the Silent class variable."
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2015
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2016
     ^ Silent ? false
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2017
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2018
    "Created: / 06-02-2019 / 20:36:51 / Claus Gittinger"
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2019
!
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2020
18329
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2021
verbose
23678
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2022
    ^ Verbose ? false
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2023
acb36818ea6b #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23677
diff changeset
  2024
    "Modified: / 06-02-2019 / 20:38:44 / Claus Gittinger"
18329
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2025
!
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2026
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2027
verbose:aBoolean
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2028
    Verbose := aBoolean
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2029
!
c7764438ff70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18326
diff changeset
  2030
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2031
vmInstructionTrace:aBoolean
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  2032
    self halt:'not yet implemented'
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  2033
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  2034
    "Modified: / 19-01-2012 / 10:15:35 / cg"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2035
! !
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2036
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2037
!Smalltalk class methodsFor:'enumerating'!
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2038
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2039
allBehaviorsDo:aBlock
5580
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  2040
    "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
  2041
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  2042
    self allClassesAndMetaclassesDo:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2043
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2044
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2045
     Smalltalk allBehaviorsDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2046
    "
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2047
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2048
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2049
allClassCategories
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2050
    "return a set of all class categories in the system"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2051
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2052
    |allCategories|
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2053
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2054
    allCategories := Set new.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2055
    Smalltalk allClassesDo:[:cls |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2056
	|category|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2057
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2058
	category := cls category.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2059
	category notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2060
	    allCategories add:category.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2061
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2062
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2063
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2064
    ^ allCategories.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2065
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2066
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2067
     Smalltalk allClassCategories
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2068
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2069
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2070
    "Created: / 17.11.2001 / 12:13:09 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2071
!
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2072
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2073
allClassesAndMetaclassesDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2074
    "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
  2075
21108
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2076
    |already numClassesHintTimes2|
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2077
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2078
    numClassesHintTimes2 := NumberOfClassesHint*2.
e179d871a1cb #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21022
diff changeset
  2079
    already := IdentitySet new:numClassesHintTimes2.
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2080
    self allClassesDo:[:eachClass |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2081
	|theNonMeta theMeta|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2082
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2083
	theNonMeta := eachClass theNonMetaclass.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2084
	(already includes:theNonMeta) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2085
	    aBlock value:theNonMeta.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2086
	    already add:theNonMeta.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2087
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2088
	theMeta := theNonMeta class.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2089
	(already includes:theMeta) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2090
	    aBlock value:theMeta.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2091
	    already add:theMeta.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2092
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2093
	already size > numClassesHintTimes2 ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2094
	    NumberOfClassesHint := (already size // 2) + 10
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2095
	].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2096
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2097
!
5579
26af506d271e added #allClassesAndMetaclasses
Claus Gittinger <cg@exept.de>
parents: 5550
diff changeset
  2098
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2099
allClassesDo:aBlock
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2100
    "evaluate the argument, aBlock for all classes in the system.
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2101
     Enumerates non-meta classes only - not metaclasses"
5580
374e843aa424 allBehaviorsDo now enumerates both classes and metaclasses
Claus Gittinger <cg@exept.de>
parents: 5579
diff changeset
  2102
5765
152a485288d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5760
diff changeset
  2103
    self allClasses do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2104
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2105
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2106
     Smalltalk allClassesDo:[:aClass | aClass name printCR]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2107
    "
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2108
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2109
    "Modified (comment): / 19-02-2017 / 12:38:17 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2110
!
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2111
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2112
allClassesForWhich:filter
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2113
    "return a collection with all classes in the system,
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2114
     for which filter evaluates to true.
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2115
     Enumerates non-meta classes only - not metaclasses"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2116
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2117
    |collectedClasses|
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2118
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2119
    collectedClasses := OrderedCollection new.
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2120
    self allClassesForWhich:filter do:[:cls |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2121
	collectedClasses add:cls
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2122
    ].
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2123
    ^ collectedClasses
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2124
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2125
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2126
     Smalltalk
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2127
	allClassesForWhich:[:cls | cls name startsWith:'Po']
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2128
    "
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2129
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2130
    "Created: / 10-08-2006 / 12:11:31 / cg"
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2131
    "Modified (comment): / 19-02-2017 / 12:37:49 / cg"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2132
!
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2133
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2134
allClassesForWhich:filter do:aBlock
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2135
    "evaluate the argument, aBlock for all classes in the system, for which filter evaluates to true.
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2136
     Enumerates non-meta classes only - not metaclasses"
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2137
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2138
    self allClassesDo:[:cls |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2139
	(filter value:cls) ifTrue:[ aBlock value:cls ].
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2140
    ].
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2141
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2142
    "
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2143
     Smalltalk
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2144
	allClassesForWhich:[:cls | cls name startsWith:'Po']
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2145
	do:[:aClass | Transcript showCR:aClass name]
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2146
    "
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2147
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  2148
    "Modified (comment): / 19-02-2017 / 12:37:59 / cg"
9292
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2149
!
55e130e5f24b +allClassesForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 9290
diff changeset
  2150
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2151
allClassesInCategory:aCategory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2152
    "return a collection of for all classes in aCategory;
1299
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2153
     The order of the classes is not defined."
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2154
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2155
    ^ self allClassesForWhich:[:cls | cls category = aCategory]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2156
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2157
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2158
     Smalltalk allClassesInCategory:'Views-Basic'
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2159
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2160
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2161
    "Modified: / 10-08-2006 / 12:13:32 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2162
!
1299
8f49ec04c9f8 documentation
Claus Gittinger <cg@exept.de>
parents: 1286
diff changeset
  2163
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2164
allClassesInCategory:aCategory do:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2165
    "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
  2166
     The order of the classes is not defined."
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2167
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2168
    aCategory notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2169
	self allClassesForWhich:[:cls | cls category = aCategory] do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2170
    ]
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2171
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2172
    "
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2173
     Smalltalk allClassesInCategory:'Views-Basic' do:[:aClass | Transcript showCR:aClass]
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2174
    "
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2175
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2176
    "Modified: / 09-08-2006 / 17:18:50 / fm"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2177
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2178
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2179
allClassesInCategory:aCategory inOrderDo:aBlock
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2180
    "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
  2181
     superclasses come first - then subclasses"
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2182
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2183
    |classes|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2184
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2185
    aCategory notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2186
	classes := OrderedCollection new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2187
	self allClassesInCategory:aCategory do:[:aClass |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2188
	    classes add:aClass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2189
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2190
	classes topologicalSort:[:a :b | b isSubclassOf:a].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2191
	classes do:aBlock
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2192
    ]
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2193
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2194
    "
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2195
     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
  2196
    "
6217
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2197
e0f4f3959c49 reuse allClassesInCategory-stuff
Claus Gittinger <cg@exept.de>
parents: 6188
diff changeset
  2198
    "Modified: / 17.11.2001 / 12:18:15 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2199
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2200
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2201
allClassesInOrderDo:aBlock
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2202
    "evaluate the argument, aBlock for all classes in the system;
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2203
     Evaluation order is by inheritance: superclasses come first."
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2204
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2205
    |already|
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2206
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2207
    already := IdentitySet new:NumberOfClassesHint.
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2208
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2209
	(already includes:eachClass) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2210
	    eachClass allSuperclasses reverseDo:[:eachSuperClass |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2211
		(already includes:eachSuperClass) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2212
		    already add:eachSuperClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2213
		    aBlock value:eachSuperClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2214
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2215
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2216
	    already add:eachClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2217
	    aBlock value:eachClass.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2218
	]
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2219
    ].
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2220
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2221
    "
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  2222
     Smalltalk allClassesInOrderDo:[:aClass | Transcript showCR:aClass name]
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2223
    "
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
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2226
allClassesInPackage:aPackageID
24112
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2227
    "evaluate the argument, aBlock for all classes in a package;
10087
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  2228
     The order of the classes is not defined.
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  2229
     The returned collection may include private classes"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2230
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2231
    ^ self allClassesForWhich:[:cls | cls package = aPackageID]
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2232
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2233
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2234
     Smalltalk allClassesInPackage:'bosch:dapasx'
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2235
    "
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2236
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2237
    "Created: / 10-08-2006 / 12:14:10 / cg"
10087
eb69f28fda88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10072
diff changeset
  2238
    "Modified: / 12-10-2006 / 23:48:43 / cg"
24112
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2239
    "Modified (comment): / 08-05-2019 / 10:56:53 / Claus Gittinger"
9506
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2240
!
93a214ce5997 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9496
diff changeset
  2241
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2242
allClassesInPackage:aPackageID do:aBlock
24112
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2243
    "evaluate the argument, aBlock for all classes in a package;
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2244
     The order of the classes is not defined."
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2245
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2246
    ^ self allClassesForWhich:[:cls | cls package = aPackageID] do:aBlock
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2247
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2248
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2249
     Smalltalk allClassesInPackage:'bosch:dapasx' do:[:aClass | Transcript showCR:aClass]
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2250
    "
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2251
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2252
    "Created: / 09-08-2006 / 17:14:17 / fm"
24112
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2253
    "Modified (comment): / 08-05-2019 / 10:56:50 / Claus Gittinger"
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2254
!
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2255
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2256
allClassesMatchingCategory:aCategoryPattern
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2257
    "return a collection of for all classes matching aCategoryPattern;
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2258
     The order of the classes is not defined."
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2259
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2260
    ^ self allClassesForWhich:[:cls | aCategoryPattern match:cls category]
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2261
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2262
    "
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2263
     Smalltalk allClassesInCategory:'Collections-Arrayed'
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2264
     Smalltalk allClassesMatchingCategory:'Collections-*'
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2265
    "
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2266
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2267
    "Created: / 08-05-2019 / 10:54:47 / Claus Gittinger"
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2268
!
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2269
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2270
allClassesMatchingPackage:aPackageIDPattern
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2271
    "evaluate the argument, aBlock for all classes matching packagePattern;
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2272
     The order of the classes is not defined.
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2273
     The returned collection may include private classes"
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2274
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2275
    ^ self allClassesForWhich:[:cls | aPackageIDPattern match:cls package]
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2276
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2277
    "
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2278
     Smalltalk allClassesInPackage:'exept:bridgeFramework'
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2279
     Smalltalk allClassesMatchingPackage:'exept:bridgeFramework*'
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2280
    "
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2281
4f6e91819fad #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24094
diff changeset
  2282
    "Created: / 08-05-2019 / 10:56:10 / Claus Gittinger"
9490
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2283
!
b49c5629be33 *** empty log message ***
fm
parents: 9468
diff changeset
  2284
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2285
allKeysDo:aBlock
20988
9d8802a18388 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20899
diff changeset
  2286
    <resource: #obsolete>
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2287
    "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
  2288
21265
e44b6104a678 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21188
diff changeset
  2289
    self obsoleteMethodWarning:'please use #keysDo:'.
17385
0d98fa1e74ff class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17369
diff changeset
  2290
    self keysDo:aBlock
21265
e44b6104a678 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21188
diff changeset
  2291
e44b6104a678 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21188
diff changeset
  2292
    "Modified: / 20-01-2017 / 17:52:40 / stefan"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2293
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2294
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2295
allMethodCategories
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2296
    "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
  2297
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2298
    |allCategories|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2299
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2300
    allCategories := Set new.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2301
    Smalltalk allClassesDo:[:cls |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2302
	allCategories addAll:cls methodCategories.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2303
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2304
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2305
    ^ allCategories.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2306
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2307
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2308
     Smalltalk allMethodCategories
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2309
    "
21980
85b7b4da26f0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21928
diff changeset
  2310
85b7b4da26f0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21928
diff changeset
  2311
    "Modified: / 05-07-2017 / 10:51:50 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2312
!
6722
8388292bc41d allClassesImplementing & allMethodCategories
Claus Gittinger <cg@exept.de>
parents: 6715
diff changeset
  2313
9259
7480ca3bdca9 allMethodsDo: utility
Claus Gittinger <cg@exept.de>
parents: 9254
diff changeset
  2314
allMethodsDo:aBlock
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2315
    "enumerate all methods in all classes"
12000
21c4d24bdd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11977
diff changeset
  2316
9259
7480ca3bdca9 allMethodsDo: utility
Claus Gittinger <cg@exept.de>
parents: 9254
diff changeset
  2317
    Smalltalk allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2318
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2319
	    aBlock value:mthd
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2320
	]
12298
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2321
    ].
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2322
!
c7d9adb49803 code cleanup
Claus Gittinger <cg@exept.de>
parents: 12287
diff changeset
  2323
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2324
allMethodsForWhich:aBlock
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2325
    "return a collection of methods for which aBlock returns true"
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2326
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2327
    |coll|
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2328
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2329
    coll := OrderedCollection new.
22015
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2330
    self allMethodsForWhich:aBlock do:[:mthd | coll add:mthd].
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2331
    ^ coll
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2332
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2333
    "
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2334
     Smalltalk allMethodsForWhich:[:m | m isObsolete].
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2335
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2336
     Smalltalk allMethodsForWhich:#isObsolete.
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2337
    "
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2338
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2339
    "Modified (comment): / 14-07-2017 / 10:52:54 / cg"
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2340
!
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2341
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2342
allMethodsForWhich:aCheckBlock do:actionBlock
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2343
    "enumerate methods for which aCheckBlock returns true"
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2344
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2345
    Smalltalk allClassesDo:[:eachClass |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2346
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2347
	    (aCheckBlock value:mthd) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2348
		actionBlock value:mthd
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2349
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2350
	]
22015
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2351
    ].
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2352
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2353
    "
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2354
     Smalltalk allMethodsForWhich:[:m | m isObsolete] do:[:m | Transcript showCR:m].
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2355
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2356
     Smalltalk allMethodsForWhich:#isObsolete do:[:m | Transcript showCR:m].
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2357
    "
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2358
ebbcacdfac77 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21980
diff changeset
  2359
    "Created: / 14-07-2017 / 10:51:53 / cg"
14933
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2360
!
d8b62f31acf5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 14914
diff changeset
  2361
12300
e72e90ea410f changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents: 12299
diff changeset
  2362
allMethodsWithSelectorDo:aTwoArgBlock
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2363
    "enumerate all methods in all classes and evaluate aBlock
12300
e72e90ea410f changed: #allMethodsWithSelectorDo:
Claus Gittinger <cg@exept.de>
parents: 12299
diff changeset
  2364
     with method and selector as arguments."
12299
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2365
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2366
    Smalltalk allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2367
	eachClass instAndClassSelectorsAndMethodsDo:[:sel :mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2368
	    aTwoArgBlock value:mthd value:sel
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2369
	]
12299
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2370
    ].
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2371
!
3ed13f5685b9 added: #allMethodsForWhich:do:
Claus Gittinger <cg@exept.de>
parents: 12298
diff changeset
  2372
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2373
associationsDo:aBlock
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2374
    "evaluate the argument, aBlock for all key/value pairs
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2375
     in the Smalltalk dictionary"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2376
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2377
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2378
	aBlock value:(aKey -> (self at:aKey))
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2379
    ]
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2380
2588
090cf1da8036 handle abort signal in readEvalPrint loop
Claus Gittinger <cg@exept.de>
parents: 2572
diff changeset
  2381
    "Smalltalk associationsDo:[:assoc | assoc printCR]"
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2382
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2383
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2384
basicKeys
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2385
    "for rel > 5 only"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2386
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2387
%{
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2388
#ifdef __SCHTEAM__
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2389
    STObject[] keys = STSmalltalkEnvironment.GetKeyVector();
18349
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2390
    return __c__._RETURN( new STVector(keys) );
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2391
#endif
b5180d38c630 comments only
Claus Gittinger <cg@exept.de>
parents: 18329
diff changeset
  2392
%}.
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2393
    self primitiveFailed
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2394
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2395
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2396
do:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2397
    "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
  2398
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2399
    |work|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2400
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2401
%{  /* 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
  2402
    __GLOBALS_DO(&aBlock, &work);
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2403
    RETURN (self);
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2404
%}.
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2405
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2406
	aBlock value:(self at:aKey)
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2407
    ]
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2408
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2409
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2410
keysAndValuesDo:aBlock
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2411
    "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
  2412
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2413
    self keysDo:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2414
	aBlock value:aKey value:(self at:aKey)
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2415
    ]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2416
!
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2417
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2418
keysAndValuesSelect:selectBlockWith2Args thenCollect:collectBlockWith2Args
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2419
    |collected|
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2420
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2421
    collected := OrderedCollection new.
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2422
    self keysAndValuesDo:[:eachKey :eachValue |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2423
	(selectBlockWith2Args value:eachKey value:eachValue) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2424
	    collected add:(collectBlockWith2Args value:eachKey value:eachValue)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2425
	].
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2426
    ].
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2427
    ^ collected
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2428
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2429
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  2430
     Smalltalk
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2431
	keysAndValuesSelect:[:nm :val | (nm startsWith:'Ab') and:[val notNil]]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2432
	thenCollect:[:nm :val | nm]
9077
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2433
    "
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2434
!
327b64542a83 +keysAndValuesSelect:thenCollect:
Claus Gittinger <cg@exept.de>
parents: 9054
diff changeset
  2435
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2436
keysDo:aBlock
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2437
    "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
  2438
    |work|
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2439
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  2440
%{  /* 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
  2441
    __GLOBALKEYS_DO(&aBlock, &work);
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2442
    RETURN (self);
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2443
%}.
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2444
    self basicKeys do:[:aKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2445
	aBlock value:aKey
5406
4a6995b61c0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5400
diff changeset
  2446
    ]
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2447
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2448
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2449
!Smalltalk class methodsFor:'message control'!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2450
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2451
silentLoading
12408
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2452
    "returns the Silentloading class variable, which globally controls if compilation
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2453
     messages are shown on the transcript during a fileIn."
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2454
10355
b1cb807fd03c Make sure, that #silentLoading does not return nil
Stefan Vogel <sv@exept.de>
parents: 10329
diff changeset
  2455
     ^ SilentLoading ? false
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2456
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2457
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2458
silentLoading:aBoolean
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2459
    "{ Pragma: +optSpace }"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2460
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  2461
    "allows access to the Silentloading class variable, which controls
12408
6075522e358d changed:
Claus Gittinger <cg@exept.de>
parents: 12377
diff changeset
  2462
     messages (especially during fileIn) onto the transcript.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2463
     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
  2464
     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
  2465
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2466
    |prev|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2467
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2468
    prev := SilentLoading.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2469
    SilentLoading := aBoolean.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2470
    ^ prev
12409
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2471
!
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2472
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2473
silentlyLoadingDo:aBlock
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2474
    "evaluates aBlock with silent loading on - no compilation messages (except errors)
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2475
     are shown on the transcript"
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2476
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2477
    |sav|
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2478
20719
1e5ad2bff672 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20718
diff changeset
  2479
    Smalltalk verbose ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2480
	^ aBlock value.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2481
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2482
12409
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2483
    sav := SilentLoading.
f414f3b7e6a0 added: #silentlyLoadingDo:
Claus Gittinger <cg@exept.de>
parents: 12408
diff changeset
  2484
    SilentLoading := true.
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  2485
    ^ aBlock ensure:[ SilentLoading := sav ].
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  2486
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  2487
    "Modified: / 23-04-2018 / 16:56:40 / stefan"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2488
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  2489
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2490
!Smalltalk class methodsFor:'misc accessing'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2491
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2492
beHeadless:aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2493
    "set/clear the headlessOperation flag."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2494
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2495
    HeadlessOperation := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2496
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2497
10231
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2498
beSTScript:aBoolean
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2499
    "set/clear the isSTScript flag."
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2500
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2501
    IsSTScript := aBoolean
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2502
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2503
    "Created: / 06-12-2006 / 16:43:36 / cg"
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2504
!
905030724b3d +isSTScript query.
Claus Gittinger <cg@exept.de>
parents: 10229
diff changeset
  2505
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2506
standAloneApp:aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2507
    "set/clear the StandAlone flag."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2508
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2509
    StandAlone := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2510
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  2511
18197
d3430ee24e46 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17588
diff changeset
  2512
24799
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2513
!Smalltalk class methodsFor:'patch support'!
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2514
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2515
checkClass:classOrClassname forVersion:versionString 
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2516
    "when installing patches, check that the class named by classOrClassname exists
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2517
     and that the version is <= versionString.
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2518
     Raise an exception, if one of the conditions is not met."
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2519
    
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2520
    |class|
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2521
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2522
    classOrClassname isBehavior ifTrue:[
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2523
        class := classOrClassname.
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2524
    ] ifFalse:[
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2525
        class := Smalltalk classNamed:classOrClassname.
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2526
        class isNil ifTrue:[
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2527
            InvalidPatchError 
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2528
                raiseErrorString:('patch is for non-existent class %1 (probably for a plugin that is not installed)' 
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2529
                        bindWith:classOrClassname).
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2530
        ].
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2531
    ].
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2532
    (versionString compareAsVersionNumberWith:class revision) < 0 ifTrue:[
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2533
        InvalidPatchError 
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2534
            raiseErrorString:('patch is for older version (%1) of class %2' 
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2535
                    bindWith:versionString
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2536
                    with:classOrClassname).
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2537
    ].
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2538
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2539
    "
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2540
       self checkClass:#Smalltalk forVersion:'200.1'.
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2541
       self checkClass:#Smalltalk forVersion:'1.1'.
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2542
       self checkClass:#Bla forVersion:'1.1'.
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2543
    "
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2544
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2545
    "Created: / 18-09-2019 / 16:49:48 / Stefan Vogel"
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2546
    "Modified (comment): / 20-09-2019 / 10:30:21 / Stefan Vogel"
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2547
! !
a6a33fc6a3c3 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 24741
diff changeset
  2548
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2549
!Smalltalk class methodsFor:'private-system management-packages'!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2550
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2551
basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2552
    "load a package referenced by aPackageString - a string like 'stx:libbasic'.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2553
     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
  2554
     Answer true, if the load succeeded, false if it failed"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2555
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2556
    |packageDirOrNil binaryClassLibraryFilename projectDefinitionFilename
19589
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2557
     projectDefinitionClass projectDefinitionClassName silent somethingHasBeenLoaded
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2558
     loadOK errorInInitialize|
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2559
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2560
    packageDirOrStringOrNil notNil ifTrue:[
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2561
        packageDirOrNil := packageDirOrStringOrNil asFilename.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2562
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2563
    silent := VerboseLoading not
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2564
                and:[SilentLoading or:[StandAlone or:[InfoPrinting not]]].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2565
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2566
    "For now: have to read the project definition first!!
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2567
     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
  2568
     so the prerequisite packages have to be loaded first.
3f183fdea754 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19516
diff changeset
  2569
     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
  2570
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2571
    "maybe, it is already in the image"
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2572
    projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
19906
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  2573
    projectDefinitionClass notNil ifTrue:[
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2574
        projectDefinitionClass checkForLoad.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2575
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2576
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2577
    "Is there a shared library (.dll or .so) ?"
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  2578
    binaryClassLibraryFilename := ObjectFileLoader
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2579
                                    binaryClassFilenameForPackage:aPackageString
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2580
                                    inDirectory:packageDirOrNil.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2581
24123
d3c4267aa343 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24112
diff changeset
  2582
    errorInInitialize := false.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2583
    (binaryClassLibraryFilename notNil and:[binaryClassLibraryFilename exists]) ifTrue:[
23873
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2584
        |loadErrorOccurred|
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2585
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2586
        loadErrorOccurred := loadOK := false.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2587
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2588
        [
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2589
            loadOK := (ObjectFileLoader loadObjectFile:binaryClassLibraryFilename) notNil.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2590
            "/ loadOK := self loadPackage:aPackageString fromClassLibrary:binaryClassLibraryFilename.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2591
        ] on:PackageNotCompatibleError do:[:ex|
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2592
            ex reject.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2593
        ] on:ObjectFileLoader objectFileLoadErrorNotification do:[:ex|
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2594
            loadErrorOccurred := true.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2595
            ex proceedWith:true.
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2596
        ].
23873
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2597
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2598
        (loadOK and:[loadErrorOccurred not]) ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2599
            "now, all compiled classes have been loaded.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2600
             keep classes in the package which are autoloaded as autoloaded."
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2601
            ^ true
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2602
        ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2603
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2604
        loadErrorOccurred ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2605
            self breakPoint:#cg.
23873
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2606
            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2607
            projectDefinitionClass notNil ifTrue:[
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2608
                projectDefinitionClass
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2609
                    checkForLoad;
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2610
                    loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2611
            ].
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2612
        ].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2613
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2614
    packageDirOrNil isNil ifTrue:[
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2615
        ^ PackageNotFoundError raiseRequestWith:aPackageString.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2616
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2617
23748
d1263269ea99 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23747
diff changeset
  2618
    "fallback - go through the project definition,
d1263269ea99 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23747
diff changeset
  2619
     loading that from source, if available"
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2620
    projectDefinitionClass isNil ifTrue:[
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2621
        projectDefinitionClassName := ProjectDefinition projectDefinitionClassNameForDefinitionOf:aPackageString.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2622
        "/ try to load the project definition class
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2623
        projectDefinitionFilename := (packageDirOrNil / projectDefinitionClassName) withSuffix:'st'.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2624
        projectDefinitionFilename exists ifFalse:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2625
            projectDefinitionFilename := (packageDirOrNil / 'source' / projectDefinitionClassName) withSuffix:'st'.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2626
        ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2627
        projectDefinitionFilename exists ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2628
            Class withoutUpdatingChangesDo:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2629
                Smalltalk silentlyLoadingDo:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2630
                    Error handle:[:ex |
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2631
                        "/ catch error during initialization;
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2632
                        ex suspendedContext withAllSendersDo:[:sender |
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2633
                            (sender selector == #initialize
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2634
                                and:[sender receiver isBehavior
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2635
                                and:[sender receiver name = projectDefinitionClassName]]
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2636
                            ) ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2637
                                errorInInitialize := true
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2638
                            ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2639
                        ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2640
                        errorInInitialize ifFalse:[ ex reject ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2641
                    ] do:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2642
                        projectDefinitionFilename fileIn.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2643
                    ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2644
                ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2645
            ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2646
            errorInInitialize ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2647
                Transcript showCR:'Smalltalk [warning]: an error happened in #initialize - retry after loading package.'.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2648
            ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2649
            projectDefinitionClass := ProjectDefinition definitionClassForPackage:aPackageString.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2650
        ].
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2651
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2652
    projectDefinitionClass notNil ifTrue:[
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2653
        projectDefinitionClass
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2654
            autoload;
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2655
            checkForLoad;
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2656
            loadPreRequisitesAsAutoloaded:doLoadAsAutoloaded.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2657
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2658
        somethingHasBeenLoaded := projectDefinitionClass loadAsAutoloaded:doLoadAsAutoloaded.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2659
        errorInInitialize ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2660
            Transcript showCR:('Smalltalk [info]: retrying #initialize').
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2661
            projectDefinitionClass initialize.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2662
        ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2663
        (silent not and:[somethingHasBeenLoaded]) ifTrue:[
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2664
            Transcript showCR:('Smalltalk [info]: loaded package: ' , aPackageString , ' from project definition').
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2665
        ].
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2666
        ^ true.
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2667
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2668
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2669
    "/ source files-file loading no longer supported
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2670
    "/ however, allow for autoload-stub loaded
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2671
    doLoadAsAutoloaded ifTrue:[
23747
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2672
        self
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2673
            recursiveInstallAutoloadedClassesFrom:packageDirOrNil
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2674
            rememberIn:Set new
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2675
            maxLevels:2
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2676
            noAutoload:false
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2677
            packageTop:packageDirOrNil
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2678
            showSplashInLevels:0.
1564174fb846 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23714
diff changeset
  2679
        ^ true
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2680
    ].
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2681
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2682
    ^ PackageNotFoundError raiseRequestWith:aPackageString errorString:' - no projectDef, dll or loadAll found'.
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2683
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2684
    "
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2685
     Smalltalk loadPackageWithId:'stx:libbasic'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2686
     Smalltalk loadPackageWithId:'stx:goodies/persistency'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2687
     Smalltalk loadPackageWithId:'exept:ctypes'
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2688
    "
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2689
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2690
    "Modified: / 29-07-2011 / 19:55:35 / cg"
23873
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2691
    "Modified: / 12-03-2019 / 18:44:50 / Stefan Vogel"
24123
d3c4267aa343 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24112
diff changeset
  2692
    "Modified: / 15-05-2019 / 17:03:09 / Claus Gittinger"
17324
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2693
!
d9f975e060fb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17322
diff changeset
  2694
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2695
loadExtensionsForPackage:aPackageId
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2696
    | extensionsLoaded |
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2697
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2698
    extensionsLoaded := false.
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2699
    ProgrammingLanguage allDo:[:programmingLanguage|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2700
	"/ evaluating or here - want all extensions to be loaded
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2701
	extensionsLoaded := extensionsLoaded | (self loadExtensionsForPackage:aPackageId language: programmingLanguage)
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2702
    ].
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2703
    ^ extensionsLoaded
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2704
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2705
    "Modified: / 18-02-2007 / 11:03:26 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2706
    "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
  2707
    "Modified (format): / 04-09-2011 / 09:19:24 / cg"
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2708
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2709
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2710
loadExtensionsForPackage:aPackageId language: programmingLanguage
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  2711
    |mgr packageDirName inStream projectDefinition extensionsFilename mod dir
13621
85297bc6cfa8 comment/format in: #loadExtensionsForPackage:
Claus Gittinger <cg@exept.de>
parents: 13602
diff changeset
  2712
     extensionsRevisionString extensionsRevisionInfo|
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2713
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2714
    programmingLanguage supportsExtensionMethods ifFalse:[^false].
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2715
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2716
    packageDirName := aPackageId copyReplaceAll:$: with:$/.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2717
    packageDirName := self getPackageFileName:packageDirName.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2718
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2719
    (packageDirName notNil and:[Class tryLocalSourceFirst]) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2720
	(self loadExtensionsFromDirectory:packageDirName language: programmingLanguage) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2721
	    ^ true.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2722
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2723
	packageDirName := nil.  "do not try again"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2724
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2725
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2726
    "
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2727
     if there is a sourceCodeManager, ask it first for the extensions
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2728
    "
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2729
    (Smalltalk at:#AbstractSourceCodeManager) notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2730
	mgr := AbstractSourceCodeManager managerForPackage: aPackageId
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2731
    ].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2732
    mgr notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2733
	extensionsFilename := 'extensions.' , programmingLanguage sourceFileSuffix.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2734
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2735
	projectDefinition := ProjectDefinition definitionClassForPackage:aPackageId.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2736
	projectDefinition notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2737
	    mod := aPackageId asPackageId module.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2738
	    dir := aPackageId asPackageId directory.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2739
	    extensionsRevisionString := projectDefinition perform:(mgr nameOfVersionMethodForExtensions) ifNotUnderstood:nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2740
	    extensionsRevisionString notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2741
		extensionsRevisionInfo := mgr revisionInfoFromString:extensionsRevisionString inClass:nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2742
		extensionsRevisionInfo notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2743
		    extensionsRevisionInfo fileName = extensionsFilename ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2744
			"JV@2011-10-23: following condition is never satisfied for
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2745
			 filed-in packages. The whole scheme of extensionVersion_XXX
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2746
			 works ONLY for compiled packages as it depends on fact, that
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2747
			 extension Init() routine is called AFTER all classes are inited,
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2748
			 therefore the extensionVersion_XXX methods from extensions.st
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2749
			 overwrites methods coming from package definition class. All this
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2750
			 is so tricky and error prone, that we have to come up with better
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2751
			 solution!!"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2752
			packageDirName notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2753
			    ^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2754
			] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2755
			    ^ false
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2756
			]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2757
		    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2758
		]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2759
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2760
	    SourceCodeManagerError handle:[:ex |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2761
	    ] do:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2762
		inStream := mgr streamForExtensionFile:extensionsFilename package:aPackageId directory:dir module:mod cache:true.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2763
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2764
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2765
	inStream isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2766
	    SourceCodeManagerError handle:[:ex |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2767
	    ] do:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2768
		inStream := mgr getMostRecentSourceStreamForFile:extensionsFilename inPackage:aPackageId.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2769
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2770
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2771
	inStream notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2772
	    Class withoutUpdatingChangeSetDo:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2773
		inStream fileIn.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2774
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2775
	    inStream close.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2776
	    VerboseLoading ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2777
		Transcript showCR:('loaded extensions for ',aPackageId,' from repository').
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2778
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2779
	    ^ true
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2780
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2781
    ].
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
    packageDirName notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2784
	^ self loadExtensionsFromDirectory:packageDirName language: programmingLanguage
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2785
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2786
    ^ false
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2787
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2788
    "Created: / 02-01-2010 / 10:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2789
    "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
  2790
    "Modified: / 04-11-2011 / 13:41:29 / cg"
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2791
    "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
  2792
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2793
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2794
loadExtensionsFromDirectory:packageDirOrString
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2795
    | extensionsLoaded |
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2796
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2797
    extensionsLoaded := false.
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2798
    ProgrammingLanguage allDo:[:programmingLanguage|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2799
	"/ evaluating or here - want all extensions to be loaded
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2800
	extensionsLoaded := extensionsLoaded | (self loadExtensionsFromDirectory: packageDirOrString language: programmingLanguage)
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2801
    ].
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  2802
    ^ extensionsLoaded
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2803
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2804
    "Modified: / 02-01-2010 / 10:40:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2805
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2806
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2807
loadExtensionsFromDirectory:packageDirOrString language: language
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2808
    |packageDir f|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2809
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2810
    packageDir := packageDirOrString asFilename.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2811
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2812
    f := packageDir / ('extensions.' , language sourceFileSuffix).
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2813
    f exists ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2814
	Class withoutUpdatingChangeSetDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2815
	    f fileIn.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2816
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2817
	VerboseLoading ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2818
	    Transcript showCR:('loaded extensions: ' , f pathName).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2819
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2820
	^ true
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2821
    ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2822
    ^ true"/false
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2823
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  2824
    "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
  2825
    "Modified: / 04-11-2011 / 13:41:19 / cg"
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  2826
    "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
  2827
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2828
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2829
loadPackage:aPackageStringArg asAutoloaded:doLoadAsAutoloaded
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2830
    "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
  2831
     Return true on success, false otherwise."
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2832
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2833
    |packageId packageString packageDir def sourceCodeManager|
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2834
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2835
    packageString := aPackageStringArg.
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2836
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2837
    "/ a little convenience: so you can stx packages with loadPackage:'goodies/soap'
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2838
    (packageString includes:$:) ifFalse:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2839
	packageString := 'stx:',packageString.
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2840
    ].
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2841
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2842
    "if I am here, so must my package"
14892
77c2f020de5d class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14890
diff changeset
  2843
    packageString = self package ifTrue:[^ true].
13129
0ac3f6a28aaf changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents: 13120
diff changeset
  2844
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2845
    packageId := aPackageStringArg asPackageId.
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  2846
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2847
    "/ if there is a projectDefinition, let it load itself...
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2848
    def := packageId projectDefinitionClass.
14833
c718848b1051 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14810
diff changeset
  2849
    (def notNil and:[def isLoaded]) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2850
	def loadAsAutoloaded:doLoadAsAutoloaded.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2851
	^ true.
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2852
    ].
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2853
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  2854
    packageDir := self packageDirectoryForPackageId:packageId.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2855
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2856
    [
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2857
	self
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2858
	    loadPackage:packageString
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2859
	    fromDirectory:packageDir
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2860
	    asAutoloaded:doLoadAsAutoloaded.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2861
    ] on:PackageLoadError do:[:ex|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2862
	ex creator ~~ PackageNotCompatibleError ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2863
	    AbstractSourceCodeManager notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2864
		sourceCodeManager := AbstractSourceCodeManager sourceCodeManagerForPackage:packageString.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2865
		sourceCodeManager notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2866
		    PackageLoadError handle:[:ex2 |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2867
			ex reject
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2868
		    ] do:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2869
			^ sourceCodeManager loadPackageWithId:packageString fromRepositoryAsAutoloaded:doLoadAsAutoloaded
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2870
		    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2871
		].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2872
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2873
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  2874
	ex reject.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2875
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2876
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2877
    ^ true
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2878
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2879
    "
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2880
     Smalltalk loadPackageWithId:'stx:libbasic'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2881
     Smalltalk loadPackageWithId:'stx:goodies/persistency'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2882
     Smalltalk loadPackageWithId:'exept:ctypes'
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2883
    "
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2884
13129
0ac3f6a28aaf changed: #loadPackage:asAutoloaded:
Claus Gittinger <cg@exept.de>
parents: 13120
diff changeset
  2885
    "Modified: / 16-11-2010 / 17:42:49 / cg"
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2886
!
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2887
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2888
loadPackage:packageId fromAllSourceFilesInDirectory:aDirectory
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2889
    "load all source files found in aDirectory and treat them like
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2890
     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
  2891
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2892
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2893
    |p t new anyFail repeatCount|
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
    "/ problem: dependencies.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2896
    "/ solution: repeat twice, so that superclasses are present the second time
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2897
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2898
    Class packageQuerySignal answer:packageId asSymbol do:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2899
	|any|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2900
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2901
	repeatCount := 0.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2902
	[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2903
	    repeatCount := repeatCount + 1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2904
	    anyFail := false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2905
	    aDirectory directoryContents do:[:file |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2906
		|fn|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2907
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2908
		fn := aDirectory / file.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2909
		(fn hasSuffix:'st') ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2910
		    Metaclass confirmationQuerySignal answer:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2911
		    do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2912
			Error
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2913
			    handle:[:ex |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2914
				anyFail := true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2915
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2916
			    do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2917
				(self fileIn:fn) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2918
				    anyFail := true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2919
				] ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2920
				    any := true.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2921
				]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2922
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2923
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2924
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2925
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2926
	    any ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2927
		^ false "/ no file found
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2928
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2929
	] doWhile:[anyFail and:[repeatCount<2]].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2930
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2931
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2932
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2933
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2934
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2935
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2936
    p directory:aDirectory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2937
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2938
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2939
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2940
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2941
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2942
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2943
    new ifTrue:[Project addLoadedProject:p].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2944
    anyFail ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  2945
	^ PackageLoadError raiseRequestWith:packageId.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2946
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  2947
    ^ true
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2948
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2949
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2950
loadPackage:packageId fromClassLibrary:aFilename
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2951
    "load a package from a compiled classLib.
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  2952
     Raise an error if not ok (only returns false if the error is proceeded)
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2953
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2954
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2955
    |p t new|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2956
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2957
    (self fileIn:aFilename) ifFalse:[
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  2958
        (self fileInClassLibrary:aFilename) ifFalse:[
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  2959
            ^ false.
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  2960
        ]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2961
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2962
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2963
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2964
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2965
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2966
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2967
    p directory:aFilename directory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2968
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2969
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2970
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2971
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2972
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2973
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2974
    new ifTrue:[Project addLoadedProject:p].
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2975
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2976
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2977
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2978
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2979
loadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2980
    "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
  2981
     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
  2982
     Answer true, if the load succeeded, false if it failed"
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  2983
23873
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2984
    ^ PackageLoadInProgressQuery
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2985
        answerNotifyLoading:aPackageString asSymbol
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2986
        do:[
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2987
            self basicLoadPackage:aPackageString fromDirectory:packageDirOrStringOrNil asAutoloaded:doLoadAsAutoloaded
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2988
        ].
17350
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2989
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2990
    "
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2991
     Smalltalk loadPackage:'stx:goodies/communication'
bec30c95e2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17345
diff changeset
  2992
    "
23873
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2993
58b25e1974cc #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23789
diff changeset
  2994
    "Modified: / 12-03-2019 / 17:51:58 / Stefan Vogel"
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2995
!
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2996
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2997
loadPackage:packageId fromLoadAllFile:aFilename
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  2998
    <resource: #obsolete>
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  2999
    "load a package from a loadAll - loader script.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3000
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3001
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3002
    |p t new|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3003
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3004
    Metaclass confirmationQuerySignal answer:false
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3005
    do:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3006
	(self fileIn:aFilename) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3007
	    self warn:'Failed to load the package ', packageId printString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3008
	    ^ false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3009
	]
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3010
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3011
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3012
    new := (p := Project projectWithId:packageId) isNil.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3013
    new ifTrue:[ p := Project new].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3014
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3015
    p name:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3016
    p directory:aFilename directory.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3017
    p package:packageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3018
    t := packageId asCollectionOfSubstringsSeparatedByAny:'/\:'.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3019
    p repositoryModule:(t first).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3020
    p repositoryDirectory:(packageId copyFrom:t first size + 2).
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3021
    p isLoaded:true.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3022
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3023
    new ifTrue:[Project addLoadedProject:p].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3024
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3025
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3026
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3027
loadPackage:aPackageId fromZIPArchive:f asAutoloaded:doLoadAsAutoloaded
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3028
    "load a package from a .zip delivery file.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3029
     Experimental."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3030
19906
8da8da09ec14 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19867
diff changeset
  3031
    PackageLoadError
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3032
	raiseWith:aPackageId
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3033
	errorString:' - package loading from zip is not yet implemented'.
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3034
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3035
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3036
loadPackageFromAbbrevFile:aPackageId asAutoloaded:doLoadAsAutoloaded
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  3037
    <resource: #obsolete>
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3038
    |abbrevFile packageDir|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3039
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3040
    packageDir := self packageDirectoryForPackageId:aPackageId.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3041
    packageDir isNil ifTrue:[^ false].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3042
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3043
    "/ abbrev.stc ?
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  3044
    abbrevFile := packageDir / 'abbrev.stc'.
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3045
    abbrevFile exists ifFalse:[^ false].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3046
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3047
    Smalltalk installAutoloadedClassesFrom:abbrevFile pathName.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3048
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3049
    doLoadAsAutoloaded ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3050
	"/ force autoloading...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3051
	Smalltalk allClassesInPackage:aPackageId do:[:eachClass | eachClass autoload].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3052
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3053
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3054
    self loadExtensionsFromDirectory:packageDir.
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  3055
    VerboseLoading ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3056
	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
  3057
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3058
    ^ true
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3059
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  3060
    "Modified: / 04-11-2011 / 13:43:29 / cg"
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3061
! !
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  3062
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3063
!Smalltalk class methodsFor:'queries'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3064
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3065
allClasses
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3066
    "return an unordered collection of all classes in the system.
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3067
     Only globally anchored classes are returned
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  3068
     (i.e. anonymous ones have to be acquired by Behavior allSubInstances).
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  3069
     Enumerates non-meta classes only - not metaclasses"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3070
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3071
    |classes|
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3072
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  3073
    "/ 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
  3074
    "/ the reason is that if we modify the class hierarchy in
4067
732848627915 comment
Claus Gittinger <cg@exept.de>
parents: 4048
diff changeset
  3075
    "/ another view (background fileIn), while building up the
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3076
    "/ cachedClasses set, this may be flushed (invalidated) by the
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3077
    "/ other process in the meanwhile.
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3078
    "/ If that happens, we restart the set-building here
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3079
    "/
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3080
    [(classes := CachedClasses) isNil] whileTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3081
	CachedClasses := classes := IdentitySet new:NumberOfClassesHint.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3082
	self keysAndValuesDo:[:eachName :eachGlobal |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3083
	    (eachGlobal notNil and:[eachGlobal isBehavior]) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3084
		"/ sigh - would like to skip over aliases
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3085
		"/ but this cannot be done simply by comparing
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3086
		"/ the classes name against the store-key
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3087
		"/ i.e. cannot do:
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3088
		"/      anObject name == sym ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3089
		"/          classes add:anObject
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3090
		"/      ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3091
		"/ because that would lead to ignore all java
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3092
		"/ classes, which are stored under a different
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3093
		"/ key.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3094
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3095
		(eachGlobal name == eachName
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3096
		 or:[eachGlobal isJavaClass]) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3097
		    classes add:eachGlobal
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3098
		].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3099
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3100
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3101
	NumberOfClassesHint := classes size.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3102
    ].
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3103
    ^ classes
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3104
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  3105
    "
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  3106
     CachedClasses := nil.
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3107
     Smalltalk allClasses
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  3108
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  3109
    to get the list sorted by name:
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  3110
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  3111
     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
  3112
    "
745
d16f199a1551 added imageStart & restart timestamps
Claus Gittinger <cg@exept.de>
parents: 736
diff changeset
  3113
13851
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  3114
    "Modified: / 06-12-2011 / 12:41:42 / cg"
21489
2c4c8ccda384 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21458
diff changeset
  3115
    "Modified (comment): / 19-02-2017 / 12:38:42 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3116
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3117
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3118
allClassesAndMetaclasses
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3119
    "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
  3120
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3121
    |classes|
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3122
8964
91b012315d91 Avoid rehashing of sets in #allClasses..
Stefan Vogel <sv@exept.de>
parents: 8960
diff changeset
  3123
    classes := IdentitySet new:NumberOfClassesHint*2.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3124
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3125
	classes add:(eachClass theNonMetaclass).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3126
	classes add:(eachClass theMetaclass).
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3127
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3128
    ^ classes
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3129
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3130
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3131
allClassesWithAllPrivateClasses
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3132
    "return an unordered collection of all classes in the Smalltalk namespace.
10173
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  3133
     Only globally anchored classes are returned; Namespaces are not included.
20122
fa7bde6ba891 #OTHER by mawalch
mawalch
parents: 19992
diff changeset
  3134
     (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
  3135
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3136
    ^ self allClasses select:[:aClass |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3137
	    |owner|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3138
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3139
	    (aClass isRealNameSpace not)
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3140
	    and:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3141
		owner := aClass topOwningClass.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3142
		(owner ? aClass) nameSpace == Smalltalk
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3143
	    ]
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3144
      ]
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3145
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3146
    "
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3147
     Smalltalk allClassesWithAllPrivateClasses
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3148
    "
10173
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  3149
765b385fd1b8 changed #listAtCategoryNamed:
Claus Gittinger <cg@exept.de>
parents: 10169
diff changeset
  3150
    "Modified: / 10-11-2006 / 17:24:00 / cg"
4642
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3151
!
fa212209890c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4630
diff changeset
  3152
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3153
allExtensions
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3154
    "return a collection of all extension methods (methods added from another package)"
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3155
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3156
    |methods|
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3157
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3158
    methods := OrderedCollection new.
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3159
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3160
	|classPackage|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3161
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3162
	classPackage := eachClass package.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3163
	eachClass instAndClassMethodsDo:[:mthd |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3164
	    mthd package ~= classPackage ifTrue:[ methods add:mthd ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3165
	].
15068
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3166
    ].
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3167
    ^ methods
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3168
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3169
    "
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3170
     Smalltalk allExtensions
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3171
    "
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3172
!
e9075c481268 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15009
diff changeset
  3173
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3174
allExtensionsForPackage:aProjectID
14890
37618c9121f2 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14833
diff changeset
  3175
    "return a collection of all extension methods for a given projectID"
37618c9121f2 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14833
diff changeset
  3176
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3177
    |methods|
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3178
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3179
    methods := OrderedCollection new.
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3180
    self allClassesDo:[:eachClass |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3181
	methods addAll:(eachClass extensionsFrom:aProjectID).
11153
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3182
    ].
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3183
    ^ methods
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3184
!
ec11603c6e7e code reuse
Claus Gittinger <cg@exept.de>
parents: 11150
diff changeset
  3185
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3186
allImplementorsOf:aSelector
12919
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  3187
    "return a collection of classes which implement the given selector"
a7ea070197c9 comment/format in: #allImplementorsOf:
Claus Gittinger <cg@exept.de>
parents: 12911
diff changeset
  3188
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3189
    |implementors|
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3190
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3191
    implementors := OrderedCollection new.
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3192
    self allImplementorsOf:aSelector do:[:cls | implementors add:cls].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3193
    ^ implementors
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3194
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3195
    "
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3196
     Smalltalk allImplementorsOf:#isNil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3197
     (Smalltalk allImplementorsOf:#add:) size
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3198
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3199
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3200
    "Modified: / 30-04-2016 / 17:37:39 / cg"
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3201
!
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3202
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3203
allImplementorsOf:aSelector do:aBlock
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3204
    "enumerate all classes which implement the given selector"
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3205
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3206
    self allClassesDo:[:cls |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3207
	(cls includesSelector:aSelector) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3208
	    aBlock value:cls.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3209
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3210
	(cls class includesSelector:aSelector) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3211
	    aBlock value:cls class.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3212
	].
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3213
    ].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3214
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3215
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3216
     Smalltalk allImplementorsOf:#isNil do:[:cls | Transcript showCR:cls]
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3217
     Smalltalk allImplementorsOf:#add: do:[:cls | Transcript showCR:cls]
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3218
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3219
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3220
    "Created: / 30-04-2016 / 17:36:45 / cg"
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3221
!
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3222
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3223
allLoadedPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3224
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3225
    ^ self allPackageIdsIncludingUnloadedClasses: false
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3226
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3227
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3228
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3229
     Smalltalk allLoadedPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3230
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3231
!
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3232
12376
fm
parents: 12358
diff changeset
  3233
allLoadedProjectIDs
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3234
    <resource: #obsolete>
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3235
    self obsoleteMethodWarning:'use allLoadedPackageIDs'.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3236
    ^ self allPackageIdsIncludingUnloadedClasses: false
12376
fm
parents: 12358
diff changeset
  3237
fm
parents: 12358
diff changeset
  3238
fm
parents: 12358
diff changeset
  3239
    "
fm
parents: 12358
diff changeset
  3240
     Smalltalk allLoadedProjectIDs
fm
parents: 12358
diff changeset
  3241
    "
fm
parents: 12358
diff changeset
  3242
!
fm
parents: 12358
diff changeset
  3243
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3244
allPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3245
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3246
    ^ self allPackageIdsIncludingUnloadedClasses: true
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3247
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3248
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3249
     Smalltalk allPackageIDs
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3250
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3251
!
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3252
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3253
allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3254
    "Returns all package ids.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3255
     Excludes packages coming from unloaded classes if includeUnloadedClasses is false.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3256
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3257
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3258
    |allProjects|
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3259
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3260
    allProjects := Set new.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3261
    self allClassesDo:[:eachClass |
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3262
        |cls pkg|
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3263
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3264
        eachClass isRealNameSpace ifFalse:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3265
            (includeUnloadedClasses or:[eachClass isLoaded]) ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3266
                cls := eachClass theNonMetaclass.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3267
                cls isPrivate ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3268
                    cls := cls topOwningClass
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3269
                ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3270
                pkg := cls package.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3271
                pkg size ~~ 0 ifTrue:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3272
                    allProjects add:pkg.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3273
                ] ifFalse:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3274
                    "/ for now, nameSpaces are not in any package;
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3275
                    "/ this might change. Then, 0-sized packages are
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3276
                    "/ illegal, and the following should be enabled.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3277
                    "/ self halt
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3278
                ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3279
                cls isJavaClass ifFalse:[
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3280
                    cls instAndClassSelectorsAndMethodsDo:[:sel :mthd |
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3281
                        allProjects add:mthd package asSymbol.
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3282
                    ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3283
                ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3284
            ].
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3285
        ].
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3286
    ].
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3287
    allProjects := allProjects asOrderedCollection sort.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3288
    ^ allProjects
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3289
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3290
    "
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3291
     Smalltalk allProjectsIdsIncludingUnloadedClasses: true
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3292
     Smalltalk allProjectsIdsIncludingUnloadedClasses: false
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3293
    "
23789
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3294
afa1be88c07e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23773
diff changeset
  3295
    "Modified: / 01-03-2019 / 16:11:49 / Claus Gittinger"
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3296
!
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3297
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3298
allProjectIDs
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3299
    <resource: #obsolete>
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3300
    self obsoleteMethodWarning:'use allPackageIDs'.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3301
    ^ self allPackageIDs
12376
fm
parents: 12358
diff changeset
  3302
fm
parents: 12358
diff changeset
  3303
    "
fm
parents: 12358
diff changeset
  3304
     Smalltalk allProjectIDs
fm
parents: 12358
diff changeset
  3305
    "
fm
parents: 12358
diff changeset
  3306
!
fm
parents: 12358
diff changeset
  3307
fm
parents: 12358
diff changeset
  3308
allProjectsIdsIncludingUnloadedClasses: includeUnloadedClasses
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3309
    <resource: #obsolete>
12376
fm
parents: 12358
diff changeset
  3310
    "Returns all projects ids.
fm
parents: 12358
diff changeset
  3311
     Excludes projects coming from unloaded classes if includeUnloadedClasses is false.
fm
parents: 12358
diff changeset
  3312
    "
fm
parents: 12358
diff changeset
  3313
19475
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3314
    self obsoleteMethodWarning:'use allPackageIdsIncludingUnloadedClasses:'.
33b989d0287a #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19430
diff changeset
  3315
    ^ self allPackageIdsIncludingUnloadedClasses: includeUnloadedClasses
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3316
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3317
    "
12376
fm
parents: 12358
diff changeset
  3318
     Smalltalk allProjectsIdsIncludingUnloadedClasses: true
fm
parents: 12358
diff changeset
  3319
     Smalltalk allProjectsIdsIncludingUnloadedClasses: false
9254
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3320
    "
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3321
!
9fc5d873b646 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9252
diff changeset
  3322
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3323
cellAt:aName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3324
    "{ Pragma: +optSpace }"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3325
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3326
    "return the address of a global cell
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3327
     - used internally for compiler only"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3328
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3329
%{  /* NOCONTEXT */
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3330
    RETURN ( __GLOBAL_GETCELL(aName) );
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3331
%}.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3332
    ^ self primitiveFailed
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3333
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3334
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3335
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3336
classCategoryCompletion:aPartialCategory
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3337
    "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
  3338
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3339
		2nd: collection consisting of matching categories"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3340
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3341
    ^ DoWhatIMeanSupport classCategoryCompletion:aPartialCategory inEnvironment:self
8583
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
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3344
     Smalltalk classCategoryCompletion:'Sys'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3345
     Smalltalk classCategoryCompletion:'System'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3346
     Smalltalk classCategoryCompletion:'System-BinaryStorage'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3347
    "
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3348
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3349
    "Modified: / 10-08-2006 / 13:06:34 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3350
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3351
8570
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  3352
classNamed:aString
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  3353
    "return the class with name aString, or nil if absent.
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  3354
     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
  3355
     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
  3356
     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
  3357
     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
  3358
10127
70e1b66ceae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10126
diff changeset
  3359
    |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
  3360
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3361
    "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
  3362
     But be careful, to not invent new symbols ..."
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3363
    sym := aString asSymbolIfInterned.
22650
580198cee5f9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22636
diff changeset
  3364
    sym isSymbol ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3365
	cls := self at:sym ifAbsent:nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3366
	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
  3367
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3368
1480
df0bea6285f8 Change the name of a classes Metaclass from e.g. "SmallIntegerclass" to
Stefan Vogel <sv@exept.de>
parents: 1461
diff changeset
  3369
    (aString endsWith:' class') ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3370
	nonMeta := self classNamed:(aString copyButLast:6).
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3371
	nonMeta notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3372
	    ^ nonMeta theMetaclass
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3373
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3374
	^ nil.
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3375
    ].
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3376
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3377
    "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
  3378
    cls isNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3379
	idx := aString indexOfSubCollection:'::'.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3380
	idx ~~ 0 ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3381
	    prefix := aString copyTo:idx-1.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3382
	    nsNameSymbol := prefix asSymbolIfInterned.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3383
	    nsNameSymbol notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3384
		rest := aString copyFrom:idx+2.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3385
		namespace := self at:prefix asSymbolIfInterned ifAbsent:nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3386
		"namespace may be the owner of a private class.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3387
		 NameSpaces and Behaviors have the same protocol"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3388
		[namespace isBehavior] whileTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3389
		    idx := rest indexOfSubCollection:'::'.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3390
		    idx ~~ 0 ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3391
			prefix := rest copyTo:idx-1.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3392
			rest := rest copyFrom:idx+2.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3393
			"this does an implicit autoload if required"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3394
			namespace := namespace privateClassesAt:prefix.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3395
		    ] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3396
			namespace isLoaded ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3397
			    cls := namespace privateClassesAt:rest.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3398
			    cls isBehavior ifTrue:[^ cls].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3399
			].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3400
			namespace := nil.   "force exit of loop"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3401
		    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3402
		].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3403
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3404
	].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3405
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3406
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3407
    ^ nil
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3408
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3409
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3410
     Smalltalk classNamed:'Object'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3411
     Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3412
     Smalltalk classNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3413
     Smalltalk classNamed:'Authentication::BasicAuthenticator'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3414
     Smalltalk classNamed:'fooBar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3415
     Smalltalk classNamed:'true'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3416
     Smalltalk classNamed:'Object class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3417
     Smalltalk classNamed:'Metaclass'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3418
     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
  3419
     Smalltalk classNamed:'Array class'
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3420
    "
644
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3421
9468
2472391c602c bumped revision
Claus Gittinger <cg@exept.de>
parents: 9377
diff changeset
  3422
    "Created: / 24-11-1995 / 17:30:22 / cg"
2472391c602c bumped revision
Claus Gittinger <cg@exept.de>
parents: 9377
diff changeset
  3423
    "Modified: / 19-06-1996 / 14:22:21 / stefan"
10127
70e1b66ceae1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10126
diff changeset
  3424
    "Modified: / 23-10-2006 / 18:06:53 / cg"
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3425
    "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
  3426
!
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
classNames
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3429
    "return a collection of all classNames in the system"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3430
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3431
    ^ self allClasses collect:[:aClass | aClass name]
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3432
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3433
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3434
     Smalltalk classNames
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3435
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3436
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3437
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3438
classnameCompletion:aPartialClassName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3439
    "given a partial classname, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3440
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3441
		2nd: collection consisting of matching names"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3442
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3443
    ^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3444
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3445
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3446
classnameCompletion:aPartialClassName inEnvironment:anEnvironment
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3447
    "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
  3448
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3449
		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
  3450
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3451
    ^ DoWhatIMeanSupport classnameCompletion:aPartialClassName inEnvironment:anEnvironment
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3452
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3453
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3454
     Smalltalk classnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3455
     Smalltalk classnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3456
     Smalltalk classnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3457
     Smalltalk classnameCompletion:'*rray'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3458
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3459
     Smalltalk classnameCompletion:'Arr cl'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3460
     Smalltalk classnameCompletion:'*rray cl'
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3461
    "
644
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3462
9363244ef25d classNamed: fixed for metaclasses; handle matchCharacters in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 630
diff changeset
  3463
    "Created: 24.11.1995 / 17:24:45 / cg"
2523
04db1fd74e0d try ignoring case in classNameCompletion
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  3464
    "Modified: 3.4.1997 / 18:25:01 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3465
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3466
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3467
defaultNameSpace
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3468
    "return the default namespace, where new classes are installed,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3469
     if NO special nameSpace handler is present"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3470
9562
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3471
    ^ Project defaultNameSpace.
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3472
7d36dbb02bb3 code cleanup - remove old obsolete Project code
Claus Gittinger <cg@exept.de>
parents: 9550
diff changeset
  3473
    "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
  3474
    "Modified: / 17-08-2006 / 14:01:22 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3475
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3476
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3477
globalNameCompletion:aPartialGlobalName
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3478
    "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
  3479
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3480
		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
  3481
12614
b8fca618dcb6 changed: #globalNameCompletion:
Claus Gittinger <cg@exept.de>
parents: 12613
diff changeset
  3482
    ^ 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
  3483
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3484
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3485
     Smalltalk globalnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3486
     Smalltalk globalnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3487
     Smalltalk globalnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3488
     Smalltalk globalnameCompletion:'*rray'
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3489
    "
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3490
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3491
    "Created: / 24-11-1995 / 17:24:45 / cg"
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3492
    "Modified: / 10-08-2006 / 13:05:39 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3493
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3494
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3495
globalnameCompletion:aPartialGlobalName
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3496
    "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
  3497
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3498
		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
  3499
8358
0afa3ee38c37 Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 8317
diff changeset
  3500
    <resource:#obsolete>
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3501
    self obsoleteMethodWarning:'use #globalNameCompletion:'.
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3502
    ^ 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
  3503
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3504
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3505
     Smalltalk globalnameCompletion:'Arr'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3506
     Smalltalk globalnameCompletion:'Arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3507
     Smalltalk globalnameCompletion:'arra'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3508
     Smalltalk globalnameCompletion:'*rray'
5736
d625e5505254 globalNamecompletion
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
  3509
    "
d625e5505254 globalNamecompletion
Claus Gittinger <cg@exept.de>
parents: 5716
diff changeset
  3510
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3511
    "Created: / 24-11-1995 / 17:24:45 / cg"
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3512
    "Modified: / 10-08-2006 / 13:05:48 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3513
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3514
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  3515
hasClassNamed:aString
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  3516
    Symbol
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3517
	hasInterned:aString
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3518
	ifTrue:[:aSymbol | ^ (self at:aSymbol ifAbsent:[ nil ]) isClass ].
13602
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3519
    ^ false
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3520
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3521
    "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
  3522
    "Modified: / 20-08-2011 / 16:41:31 / cg"
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3523
!
5fe3c7ce7d7e comment/format in: #classNamed:
Claus Gittinger <cg@exept.de>
parents: 13601
diff changeset
  3524
9290
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3525
hasNameSpaces
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3526
    "can be redefined by dummy namespaces/environments, to suppress
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3527
     the namespace display in a browser (PocketSmalltalk)"
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3528
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3529
    ^ true
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3530
!
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3531
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3532
hasNamespaces
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3533
    "can be redefined by dummy namespaces/environments, to suppress
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3534
     the namespace display in a browser (PocketSmalltalk)"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3535
9290
a7119f29fe2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9259
diff changeset
  3536
    <resource:#obsolete>
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3537
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3538
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3539
10432
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3540
hasSelectorNameSpaces
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3541
    "for now return false
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  3542
     Selector namespaces are being implemented and supported by the VM,
10432
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3543
     but not yet fully supported by all tools...
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3544
     Therefore, for now, do not generate code which uses this feature."
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3545
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3546
    ^ false
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3547
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3548
    "Created: / 05-03-2007 / 13:26:28 / cg"
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3549
!
9d0a4de5e69c preps for selectorNamespaces.
Claus Gittinger <cg@exept.de>
parents: 10429
diff changeset
  3550
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3551
includes:something
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3552
    "this should come from Collection.
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3553
     will change the inheritance - Smalltalk is actually a collection"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3554
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3555
    self do:[:element | element = something ifTrue:[^ true]].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3556
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3557
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3558
14987
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3559
includesIdentical:something
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3560
    "this should come from Collection.
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3561
     will change the inheritance - Smalltalk is actually a collection"
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3562
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3563
    self do:[:element | element == something ifTrue:[^ true]].
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3564
    ^ false
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3565
!
48fe827c49b5 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14973
diff changeset
  3566
10041
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3567
isBrowserStartable
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3568
    ^ false.
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3569
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3570
    "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
  3571
!
1ef0cb09523b protocol for startability via browser slightly changed
Claus Gittinger <cg@exept.de>
parents: 9937
diff changeset
  3572
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3573
isNameSpace
9227
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3574
    "return true, if the receiver is a nameSpace."
3aca7dee958d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9211
diff changeset
  3575
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3576
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3577
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3578
    "Created: 11.10.1996 / 18:10:43 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3579
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3580
10169
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3581
isRealNameSpace
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3582
    "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
  3583
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3584
    ^ false
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3585
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3586
    "Created: / 10-11-2006 / 17:02:19 / cg"
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3587
!
142f2de83007 +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10162
diff changeset
  3588
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3589
isTopLevelNameSpace
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3590
    ^ true
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3591
!
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3592
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3593
isTopLevelNamespace
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3594
    "obsolete - use isTopLevelNameSpace"
5365
95c615a40176 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5363
diff changeset
  3595
7432
155245708ca3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7430
diff changeset
  3596
    <resource:#obsolete>
155245708ca3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7430
diff changeset
  3597
7999
475bba3ead9a moved all input completion methods from Smalltalk to DoWhatIMeanSupport.
Claus Gittinger <cg@exept.de>
parents: 7996
diff changeset
  3598
    self obsoleteMethodWarning:'use #isTopLevelNameSpace'.
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3599
    ^ true
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3600
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3601
    "Created: 11.10.1996 / 18:10:43 / cg"
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3602
!
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  3603
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3604
keyIsClassVariableNameKey:aKey
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3605
    |i|
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3606
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3607
    i := aKey lastIndexOf:$:.
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3608
    i ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3609
	i > 1 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3610
	    (aKey at:(i-1)) == $: ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3611
		^ true.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3612
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3613
	].
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3614
    ].
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3615
    ^ false.
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3616
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3617
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3618
     self keyIsClassVariableNameKey:'foo::bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3619
     self keyIsClassVariableNameKey:'foo:bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3620
     self keyIsClassVariableNameKey:':bar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3621
     self keyIsClassVariableNameKey:'::bar'
9081
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3622
    "
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3623
!
c957b05ad97f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9080
diff changeset
  3624
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3625
loadedClassNamed:aString
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3626
    "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
  3627
     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
  3628
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3629
    |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
  3630
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3631
    "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
  3632
     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
  3633
    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
  3634
    sym notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3635
	cls := self at:sym ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3636
	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
  3637
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3638
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3639
    (aString endsWith:' class') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3640
	nonMeta := self loadedClassNamed:(aString copyButLast:6).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3641
	nonMeta notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3642
	    ^ nonMeta theMetaclass
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3643
	].
9374
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3644
    ].
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3645
    ^ nil
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3646
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3647
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3648
     Smalltalk loadedClassNamed:'Object'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3649
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3650
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator::BasicAuthenticationData class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3651
     Smalltalk loadedClassNamed:'Authentication::BasicAuthenticator'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3652
     Smalltalk loadedClassNamed:'fooBar'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3653
     Smalltalk loadedClassNamed:'true'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3654
     Smalltalk loadedClassNamed:'Object class'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3655
     Smalltalk loadedClassNamed:'Metaclass'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3656
     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
  3657
     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
  3658
    "
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3659
!
8198d65aadd3 #classNamed: now loads autoloaded classes if a (possibly) private class of an
Stefan Vogel <sv@exept.de>
parents: 9292
diff changeset
  3660
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3661
methodProtocolCompletion:aPartialProtocolName
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3662
    "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
  3663
     2 entries: 1st: the best (longest) match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3664
		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
  3665
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3666
    ^ DoWhatIMeanSupport methodProtocolCompletion:aPartialProtocolName inEnvironment:self
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3667
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3668
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3669
     Smalltalk methodProtocolCompletion:'doc'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3670
     Smalltalk methodProtocolCompletion:'docu'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3671
     Smalltalk methodProtocolCompletion:'documenta'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3672
    "
9508
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3673
564f30f49b1b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9506
diff changeset
  3674
    "Modified: / 10-08-2006 / 13:05:20 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3675
!
5505
e99e8e9cbfef added #methodProtocolCompletion:
Claus Gittinger <cg@exept.de>
parents: 5504
diff changeset
  3676
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3677
numberOfGlobals
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3678
    "return the number of global variables in the system"
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3679
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3680
    |tally "{ Class: SmallInteger }" |
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3681
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3682
    tally := 0.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3683
    self do:[:obj | tally := tally + 1].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3684
    ^ tally
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3685
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3686
    "Smalltalk numberOfGlobals"
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3687
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3688
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3689
referencesAny:aCollection
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3690
    "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
  3691
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3692
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3693
	aCollection do:[:anObject |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3694
	    (key == anObject) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3695
	    (val == anObject ) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3696
	]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3697
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3698
    ^ super referencesAny:aCollection
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3699
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3700
    "Created: / 2.2.1998 / 16:01:20 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3701
!
3260
10e5199831ee added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3155
diff changeset
  3702
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3703
referencesDerivedInstanceOf:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3704
    "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
  3705
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3706
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3707
	(key isKindOf:aClass) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3708
	(val isKindOf:aClass) ifTrue:[^ true].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3709
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3710
    ^ super referencesDerivedInstanceOf:aClass
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3711
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3712
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3713
referencesInstanceOf:aClass
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3714
    "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
  3715
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3716
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3717
	(key isMemberOf:aClass) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3718
	(val isMemberOf:aClass) ifTrue:[^ true].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3719
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3720
    ^ super referencesInstanceOf:aClass
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3721
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  3722
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3723
referencesObject:anObject
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3724
    "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
  3725
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3726
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3727
	(key == anObject) ifTrue:[^ true].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3728
	(val == anObject ) ifTrue:[^ true].
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3729
    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3730
    ^ super referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  3731
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3732
    "Modified: / 3.2.1998 / 14:22:46 / cg"
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3733
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3734
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3735
resolveName:aName inClass:aClass
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3736
    "resolve aName as if compiled within aClass;
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3737
     i.e. if it has a private class with this name, return it;
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3738
     if aName is known within the classes namespace, return that.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3739
     Otherwise, return a global with that name.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3740
     This should be used whereever Smalltalk>>at: used to be used,
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3741
     to resolve a global by name."
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3742
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3743
    |nameUsed sym cls ns|
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3744
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3745
    aName isNil ifTrue:[^ nil].
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3746
    aName isBehavior ifTrue:[^ aName].       "/ already resolved
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3747
    nameUsed := aName.
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3748
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3749
    (nameUsed startsWith:'Smalltalk::') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3750
	nameUsed := nameUsed copyFrom:12.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3751
	^ self at:(nameUsed asSymbol) ifAbsent:nil.
15766
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3752
    ].
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3753
e922cc8885de class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15741
diff changeset
  3754
    sym := nameUsed asSymbol.
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3755
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3756
    cls := aClass privateClassesAt:sym.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3757
    cls notNil ifTrue:[^ cls].
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3758
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3759
    ns := aClass nameSpace.
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3760
    (ns notNil and:[ns ~~ Smalltalk]) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3761
	ns isNameSpace ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3762
	    cls := ns at:sym ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3763
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3764
	    cls := ns privateClassesAt:sym
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3765
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3766
	cls notNil ifTrue:[^ cls].
3025
53b114d5be3e added #resolveClassNamed:
ca
parents: 3022
diff changeset
  3767
    ].
3026
7e1d4efc5ba5 *** empty log message ***
ca
parents: 3025
diff changeset
  3768
    ^ self at:sym ifAbsent:nil.
4356
54d1f0b81638 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4355
diff changeset
  3769
54d1f0b81638 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4355
diff changeset
  3770
    "Modified: / 9.7.1999 / 01:18:07 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3771
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3772
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3773
selectorCompletion:aPartialSymbolName
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3774
    "given a partial selector, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3775
     2 entries: 1st: the longest match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3776
		2nd: collection consisting of matching implemented selectors"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3777
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3778
    ^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:self
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3779
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3780
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3781
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3782
    "given a partial selector, return an array consisting of
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3783
     2 entries: 1st: the longest match
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3784
		2nd: collection consisting of matching implemented selectors"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3785
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3786
    ^ DoWhatIMeanSupport selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3787
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3788
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3789
     Smalltalk selectorCompletion:'at:p'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3790
     Smalltalk selectorCompletion:'nextP'
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  3791
     Smalltalk selectorCompletion:'nextp'
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3792
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3793
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3794
    "Modified: / 7.6.1996 / 08:44:33 / stefan"
3565
966a108e3765 also do caseless selectorCompletion
Claus Gittinger <cg@exept.de>
parents: 3560
diff changeset
  3795
    "Modified: / 14.6.1998 / 15:54:03 / cg"
19681
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3796
!
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3797
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3798
someImplementorOf:aSelector
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3799
    "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
  3800
     (useful to search, if there is one at all)"
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3801
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3802
    self allImplementorsOf:aSelector do:[:cls | ^ cls].
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3803
    ^ nil.
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3804
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3805
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3806
     Smalltalk someImplementorOf:#isNil
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3807
     Smalltalk someImplementorOf:#add:
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3808
    "
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3809
ec20967ae600 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19597
diff changeset
  3810
    "Created: / 30-04-2016 / 17:39:19 / cg"
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3811
! !
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  3812
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3813
!Smalltalk class methodsFor:'queries-system'!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3814
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3815
isAmber
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3816
    "is this an Amber Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3817
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3818
     applications - add #isAmber to your Amber Smalltalk,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3819
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3820
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3821
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3822
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3823
    "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
  3824
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3825
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3826
isDolphinSmalltalk
16803
bd94b8eacd88 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16764
diff changeset
  3827
    "is this a Dolphin Smalltalk system ?
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3828
     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
  3829
     applications - add #isDolphinSmalltalk to your dolphin,
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3830
     returning true there."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3831
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3832
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3833
!
4970
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3834
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3835
isGemStone
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3836
    "is this a GemStone Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3837
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3838
     applications - add #isGemStone to your GemStone/S,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3839
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3840
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3841
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3842
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3843
    "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
  3844
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3845
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3846
isPharo
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3847
    "is this a Pharo Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3848
     Return false here - this may be useful to write portable
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3849
     applications - add #isPharo to your Pharo,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3850
     returning true there."
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3851
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3852
    ^ false
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3853
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3854
    "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
  3855
!
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  3856
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3857
isSmalltalkMT
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3858
    "is this a Smalltalk-MT system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3859
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3860
     applications - add #isSmalltalkMT to your smalltalk-MT,
4970
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3861
     returning true there."
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3862
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3863
    ^ false
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3864
!
c5ab8ead5b8e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4963
diff changeset
  3865
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3866
isSmalltalkV
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3867
    "is this a Smalltalk/V system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3868
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3869
     applications - add #isSmalltalkV to your smalltalkV,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3870
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3871
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3872
    ^ false
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3873
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3874
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3875
isSmalltalkX
16803
bd94b8eacd88 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16764
diff changeset
  3876
    "is this a Smalltalk/X system ?
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3877
     Return true here - this may be useful to write portable
22799
5cc8b7ebdd62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22793
diff changeset
  3878
     applications.
5cc8b7ebdd62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22793
diff changeset
  3879
     Add #isSmalltalkX to your other smalltalks, returning false there.
5cc8b7ebdd62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22793
diff changeset
  3880
     Notice: the ST/X compilers know about this, and inline the code
5cc8b7ebdd62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22793
diff changeset
  3881
     (not generating code for the false branch).
5cc8b7ebdd62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22793
diff changeset
  3882
     So in ST/X, this check costs you absolutely nothing."
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3883
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3884
    ^ true
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3885
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3886
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3887
isSqueak
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3888
    "is this a SqueakSmalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3889
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3890
     applications - add #isSqueak to your squeak,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3891
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3892
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3893
    ^ false
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3894
!
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3895
16013
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3896
isSqueakLike
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3897
    "is this a Squeak, Pharo, Cuis or similar Smalltalk system ?
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3898
     Return false here - this may be useful to write portable
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3899
     applications - add #isSqueakLike to your squeak, pharo,...
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3900
     returning true there."
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3901
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3902
    ^ false
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3903
!
1c60a86125e7 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15980
diff changeset
  3904
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3905
isVisualAge
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3906
    "is this a VisualAge Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3907
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3908
     applications - add #isVisualAge to your visualAge,
4431
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3909
     returning true there."
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3910
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3911
    ^ false
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3912
!
1c7ee9a97eda *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4430
diff changeset
  3913
17369
d50c90bc1a91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17350
diff changeset
  3914
isVisualSmalltalkEnterprise
16843
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3915
    "is this a VSE Smalltalk system ?
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3916
     Return false here - this may be useful to write portable
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3917
     applications - add #isVisualSmallalkEnterprise to your VSE,
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3918
     returning true there."
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3919
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3920
    ^ false
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3921
!
88fc65939c60 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16831
diff changeset
  3922
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3923
isVisualWorks
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3924
    "is this a VisualWorks Smalltalk system ?
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  3925
     Return false here - this may be useful to write portable
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3926
     applications - add #isVisualWorks to your visualWorks,
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3927
     returning true there."
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3928
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3929
    ^ false
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3930
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3931
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  3932
!Smalltalk class methodsFor:'startup'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3933
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3934
browserWindowStartup
13056
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3935
    "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
  3936
     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
  3937
     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
  3938
     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
  3939
     multiwindow application.
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3940
     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
  3941
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3942
    |windowIDString numericWindowID windowID params idx process|
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3943
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3944
    idx := CommandLineArguments indexOf:'--browserWindow:'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3945
    windowIDString := CommandLineArguments at:idx+1.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3946
    numericWindowID := Integer fromString:windowIDString.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3947
    windowID := ExternalAddress newAddress:numericWindowID.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3948
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3949
    idx := CommandLineArguments indexOf:'--browserParameters:'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3950
    idx ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3951
	params := Dictionary new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3952
	(CommandLineArguments copyFrom:idx+1) pairWiseDo:[:key :value |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3953
	    params at:key put:value.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3954
	].
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3955
    ].
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3956
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3957
    'browserWindow is: ' errorPrint. windowID errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3958
    'browserParameters are: ' errorPrint. params errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3959
    'Display is: ' errorPrint. Display errorPrintCR.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3960
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3961
    process := [
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3962
	PluginSupport
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3963
	    startInBrowserWithWindowID:windowID
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  3964
	    parameters:params.
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3965
    ] newProcess.
9043
e6106f500263 do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents: 9036
diff changeset
  3966
    process priority:(Processor userSchedulingPriority).
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3967
    process name:'browser start handler'.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3968
    process beGroupLeader.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3969
    process resume.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3970
    process := nil.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3971
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3972
    Processor dispatchLoop.
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3973
    Smalltalk exit.
13056
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3974
1fa92a4cd9cc comment in #browserWindowStartup
Claus Gittinger <cg@exept.de>
parents: 13014
diff changeset
  3975
    "Modified: / 11-09-2010 / 14:06:59 / cg"
9032
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3976
!
ef419ad5e15a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9030
diff changeset
  3977
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3978
defineCommandLineAsWorkspaceVariablesForScripts
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3979
    "/ 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
  3980
    ParserFlags allowUnderscoreInIdentifier:true.
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3981
    ParserFlags allowDollarInIdentifier:true.
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3982
    ParserFlags warnDollarInIdentifier:false.
20858
ffcbac4dd7ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20857
diff changeset
  3983
    ParserFlags warnUnderscoreInIdentifier:false.
20859
b4091df11596 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20858
diff changeset
  3984
    ParserFlags allowOldStyleAssignment:false.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3985
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3986
    "/ add bindings for arguments
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3987
    Workspace workspaceVariableAt:('_$0') put:CommandName.
20857
e13cdc7188f1 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20856
diff changeset
  3988
    Workspace workspaceVariableAt:('_$n') put:CommandLineArguments size.
20860
216e672e8d44 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20859
diff changeset
  3989
    Workspace workspaceVariableAt:('_$$') put:CommandLineArguments.
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3990
    CommandLineArguments doWithIndex:[:arg :i |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  3991
	Workspace workspaceVariableAt:('_$',i printString) put:arg.
20856
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3992
    ].
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3993
!
f665f0659097 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20855
diff changeset
  3994
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3995
displayInitializationDone
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  3996
    "inform the restart, that the display has been initialized"
6559
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3997
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3998
    CallbackSignal raiseRequest.
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  3999
!
2ec6d0d1b821 Changed Workstation initialization
Stefan Vogel <sv@exept.de>
parents: 6539
diff changeset
  4000
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4001
executeStartBlocks
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4002
    |startBlocks|
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4003
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4004
    startBlocks := self startBlocks.
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4005
    startBlocks notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4006
	'Smalltalk [info]: execute startBlocks...' infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4007
	startBlocks do:[:aBlock|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4008
	    Error handle:[:ex |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4009
		InfoPrinting == true ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4010
		    'Smalltalk [warning]: error caught in startBlock: ' infoPrint.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4011
		    ex description infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4012
		    ex infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4013
		    thisContext fullPrintAll.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4014
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4015
	    ] do: aBlock
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4016
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4017
	startBlocks removeAll.
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4018
    ].
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4019
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4020
    "Created: / 07-01-2012 / 12:58:39 / cg"
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4021
!
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  4022
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4023
hideSplashWindow
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4024
%{
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4025
#ifdef WIN32
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4026
    extern void __win32_hideSplashScreen();
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4027
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4028
    __win32_hideSplashScreen();
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4029
#endif
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4030
%}
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4031
!
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  4032
20720
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  4033
lateOpenDisplay
20737
cbaefc448648 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20720
diff changeset
  4034
    "this is called when a view is opened without a display being already opened."
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4035
22636
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4036
    |display|
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4037
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4038
    display := Smalltalk openDisplay.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4039
    display notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4040
	IsRepl ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4041
	    display exitOnLastClose:true.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4042
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4043
	"/ Processor exitWhenNoMoreUserProcesses:true.
22636
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4044
    ].
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4045
    ^ display
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4046
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4047
    "Modified: / 20-03-2018 / 12:43:29 / stefan"
20720
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  4048
!
7e060ec1953c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20719
diff changeset
  4049
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4050
mainStartup:graphicalMode
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4051
    "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
  4052
     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
  4053
9012
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  4054
    |process imageName thisIsARestart idx|
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4055
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4056
    VerboseStartup ifTrue:['mainStartup...' infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4057
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4058
    imageName := ObjectMemory imageName.
2249
cdb6c87f0707 send returnFromSnapshot notification later -
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
  4059
    thisIsARestart := imageName notNil.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4060
19788
5b67ddd14655 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 19681
diff changeset
  4061
    true "graphicalMode" ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4062
        Display isNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4063
            (StartupClass notNil
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4064
            and:[ (StartupClass perform:#isHeadless ifNotUnderstood:false) ]) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4065
                self openDisplay.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4066
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4067
        ].
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  4068
    ].
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  4069
10645
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  4070
    StandAlone ifFalse:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4071
        "
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4072
         enable the graphical debugger/inspector
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4073
         (they could have been (re)defined as autoloaded in the patches file)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4074
        "
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4075
        VerboseStartup ifTrue:['initStandardTools...' infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4076
        self initStandardTools.
10645
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  4077
    ].
48da7d0c8fb5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10644
diff changeset
  4078
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4079
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  4080
     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
  4081
    "
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4082
    Display notNil ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4083
        Display deviceIOTimeoutErrorSignal handlerBlock:[:ex |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4084
            SaveEmergencyImage == true ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4085
                'Display [warning]: broken display connection - emergency save in ''crash.img''.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4086
                ObjectMemory primSnapShotOn:'crash.img'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4087
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4088
            'Display [warning]: broken display connection - exit.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4089
            self exit:11.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4090
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4091
        VerboseStartup ifTrue:['display-dispatch...' infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4092
        Display startDispatch.
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4093
    ].
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4094
9016
2979527dbdf4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9015
diff changeset
  4095
    idx := CommandLineArguments indexOf:'--browserWindow:'.
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4096
    IsPlugin := (idx ~~ 0).
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  4097
    IsPlugin ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4098
        'Smalltalk [info]: startup browser window...' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4099
        self browserWindowStartup.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4100
        "/ not reached
9012
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  4101
    ].
43ef70cac099 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9011
diff changeset
  4102
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4103
    Initializing := false.
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4104
2074
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4105
    "/ 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
  4106
    "/ 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
  4107
    "/ 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
  4108
    "/ 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
  4109
7043
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  4110
    process := [
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4111
        VerboseStartup ifTrue:[ 'Smalltalk [info]: startup process 1 active.' infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4112
        StartBlocks notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4113
            self executeStartBlocks.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4114
            StartBlocks := nil.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4115
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4116
        ImageStartBlocks notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4117
            VerboseStartup ifTrue:[ 'Smalltalk [info]: execute imageStartBlocks...' infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4118
            ImageStartBlocks do:[:aBlock|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4119
                VerboseStartup ifTrue:[ ('Smalltalk [info]: startBlock: %1...' bindWith:aBlock) infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4120
                aBlock value
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4121
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4122
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4123
        StandAlone ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4124
            (SilentLoading == true) ifFalse:[   "i.e. undefined counts as false"
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4125
                thisIsARestart ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4126
                    Transcript cr.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4127
                    Transcript showCR:('Smalltalk restarted from:'
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4128
                                        , imageName
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4129
                                        , ' (saved '
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4130
                                        , ObjectMemory imageSaveTime printString
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4131
                                        , ')' ).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4132
                ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4133
                    Transcript showCR:(self hello).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4134
                    Transcript showCR:(self copyrightString).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4135
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4136
                Transcript cr.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4137
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4138
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4139
            DemoMode==true ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4140
                Transcript showCR:'*** Restricted use:                              ***'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4141
                Transcript showCR:'*** This program may be used for education only. ***'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4142
                Transcript showCR:'*** Please read the files COPYRIGHT and LICENSE  ***'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4143
                Transcript showCR:'*** for more details.                            ***'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4144
                Transcript cr.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4145
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4146
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4147
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4148
        thisIsARestart ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4149
            "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4150
            "/ the final late notification - users can now assume that
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4151
            "/ views, forms etc. have been recreated.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4152
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4153
            ObjectMemory changed:#returnFromSnapshot.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4154
        ]
7039
6f1c02381145 Do not keep reference to start block handler process.
Stefan Vogel <sv@exept.de>
parents: 7000
diff changeset
  4155
7040
d24ef75bc6c3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7039
diff changeset
  4156
    ] newProcess.
d24ef75bc6c3 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 7039
diff changeset
  4157
9043
e6106f500263 do not use numeric process prios
Claus Gittinger <cg@exept.de>
parents: 9036
diff changeset
  4158
    process priority:(Processor userSchedulingPriority).
7043
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  4159
    process name:'start block handler'.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  4160
    process beGroupLeader.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  4161
    process resume.
d88be9c553d2 Release references to processes in #mainStartup:
Stefan Vogel <sv@exept.de>
parents: 7040
diff changeset
  4162
    process := nil.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
  4163
10139
a3f6265978ad Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents: 10131
diff changeset
  4164
    ObjectMemory startBackgroundCollectorAt:5.
a3f6265978ad Start bachgroundCollector and -Finalizer in mainStartup
Stefan Vogel <sv@exept.de>
parents: 10131
diff changeset
  4165
    ObjectMemory startBackgroundFinalizationAt:5.
1650
b4b36961d1bc Add StartBlocks and ImageStartBlocks.
Stefan Vogel <sv@exept.de>
parents: 1647
diff changeset
  4166
2074
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4167
    "/ 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
  4168
    "/ message.
01f7e1396c18 fixed standalone startup (broke when startupblocks where invented ...)
Claus Gittinger <cg@exept.de>
parents: 2050
diff changeset
  4169
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4170
    (StartupClass notNil and:[StartupSelector notNil]) ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4171
        "
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4172
         allow more customization by reading an image specific rc-file
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4173
        "
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4174
        thisIsARestart ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4175
            (imageName asFilename hasSuffix:'img') ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4176
                imageName := imageName copyButLast:4
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4177
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4178
            self fileIn:(imageName , '.rc')
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4179
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4180
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4181
        Display notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4182
            Display exitOnLastClose:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4183
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4184
        Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4185
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4186
        process := [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4187
            'Smalltalk [info]: startup process 2 active.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4188
            StandAlone ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4189
                AbortOperationRequest handle:[:ex |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4190
                    'Smalltalk [info]: aborted - exit.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4191
                    OperatingSystem exit:1
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4192
                ] do:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4193
                    ('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (1)') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4194
                    StartupClass perform:StartupSelector withArguments:StartupArguments.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4195
                ]
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4196
            ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4197
                ('Smalltalk [info]: call ',StartupSelector,' of ',StartupClass name,' (2)') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4198
                StartupClass perform:StartupSelector withArguments:StartupArguments.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4199
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4200
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4201
            "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4202
            "/ non-GUI apps exit after the startup;
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4203
            "/ assume that GUI apps have created & opened some view ...
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4204
            "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4205
            Display isNil ifTrue:[
24136
0f13645d4faf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24123
diff changeset
  4206
                (StartupClass perform:#isHeadless ifNotUnderstood:false) ifTrue:[
24094
76558849874f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24062
diff changeset
  4207
                    Smalltalk exit:0.
76558849874f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24062
diff changeset
  4208
                ].    
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4209
                'Smalltalk [info]: no Display - exit.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4210
                Smalltalk exit:11.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4211
            ].
16666
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4212
"/            "/
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4213
"/            "/ GUI apps exit after the last user process has finished
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4214
"/            "/
c343b9e62a1a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16655
diff changeset
  4215
"/            Display exitOnLastClose:true.
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4216
            Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4217
        ] newProcess.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4218
        process priority:(Processor userSchedulingPriority).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4219
        process name:'main'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4220
        process beGroupLeader.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4221
        process resume.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4222
        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
  4223
    ].
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4224
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4225
    StandAlone ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4226
        Display notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4227
            FlyByHelp notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4228
                FlyByHelp start
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4229
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4230
        ].
16211
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  4231
    ].
656bd37ab2a4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16199
diff changeset
  4232
20746
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4233
"/    Display notNil ifTrue:[
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4234
"/        Display exitOnLastClose:true.
1dcfc78996ef #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20743
diff changeset
  4235
"/    ].
21592
abc75cdd7f65 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21586
diff changeset
  4236
    OperatingSystem finishLaunching.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4237
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4238
    "
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4239
     if view-classes exist, start dispatching;
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4240
     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
  4241
    "
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4242
    ((Display notNil and:[graphicalMode])
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4243
     or:[process notNil
13851
5ab434e0a636 changed: #mainStartup: for scripting stand alone apps
Claus Gittinger <cg@exept.de>
parents: 13850
diff changeset
  4244
     or:[HeadlessOperation
20827
efb00b398fc8 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20811
diff changeset
  4245
     or:[StandAlone]]]
efb00b398fc8 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 20811
diff changeset
  4246
    ) ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4247
        Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4248
        Processor dispatchLoop.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4249
        "done - the last process finished"
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4250
        '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
  4251
    ] ifFalse:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4252
        StandAlone ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4253
            self readEvalPrintLoop
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4254
        ]
11681
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4255
    ].
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4256
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4257
    self exit
4c274a7ef60c Fix stc compile error in prev change
Stefan Vogel <sv@exept.de>
parents: 11679
diff changeset
  4258
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4259
    "Created: / 18-07-1996 / 21:07:39 / cg"
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4260
    "Modified: / 09-09-1996 / 17:42:50 / stefan"
21592
abc75cdd7f65 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21586
diff changeset
  4261
    "Modified: / 28-02-2017 / 10:59:43 / cg"
24136
0f13645d4faf #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 24123
diff changeset
  4262
    "Modified: / 23-05-2019 / 11:24:37 / Claus Gittinger"
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4263
!
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  4264
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4265
openDisplay
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4266
    "try to open a display connection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4267
     If so, also read display- and keyboard.rc"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4268
13385
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4269
    |commandName|
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4270
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4271
    commandName := Smalltalk commandName.
0fa57f2d37f2 changed: #openDisplay
Stefan Vogel <sv@exept.de>
parents: 13370
diff changeset
  4272
    (commandName, ' [info]: opening display...') infoPrintCR.
10649
82b327ec636d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10646
diff changeset
  4273
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4274
    Display isNil ifTrue:[
25114
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4275
        Screen notNil ifTrue:[
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4276
            [
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4277
                Screen openDefaultDisplay:nil.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4278
            ] on:Screen deviceOpenErrorSignal do:[:ex|
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4279
                "do not use #errorPrintCR, it is no error, when an app supports display and no display is present.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4280
                 In case of shell exec 'app --version' we do not want this error string as part of the output"
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4281
                ('%1 [error]: No display connection to: %2' bindWith:commandName with:ex parameter) infoPrintCR "errorPrintCR".
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4282
                (commandName, ' [info]: Either set the DISPLAY environment variable,') infoPrintCR.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4283
                (commandName, ' [info]: or start smalltalk with a -display argument.') infoPrintCR.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4284
                (HeadlessOperation ? false) ifFalse:[
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4285
                    OperatingSystem exit:1.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4286
                ].
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4287
            ].
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4288
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4289
            Display notNil ifTrue:[
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4290
                (self secureFileIn:'display.rc') ifFalse:[
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4291
                    "/ 'Smalltalk [warning]: no display.rc found; screen setting might be wrong.' errorPrintCR.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4292
                    (self secureFileIn:'keyboard.rc') ifFalse:[
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4293
                        "/ 'Smalltalk [warning]: no keyboard.rc found; shortkey setting might be wrong.' errorPrintCR.
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4294
                    ]
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4295
                ]
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4296
            ].
2da8de7f0bd2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25113
diff changeset
  4297
        ]
22636
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4298
    ].
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4299
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4300
    ^ Display
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4301
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4302
    "Created: / 06-12-2006 / 15:38:17 / cg"
22636
7607be4b8c15 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22572
diff changeset
  4303
    "Modified: / 20-03-2018 / 12:39:55 / stefan"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4304
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4305
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4306
providingDisplayDo:aBlock
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4307
    "/ provide a Display, if needed
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4308
    (Smalltalk at:#Screen) currentScreenQuerySignal handle:[:ex |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4309
	Display isNil ifTrue:[ self lateOpenDisplay ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4310
	ex proceedWith:Display.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4311
    ] do:aBlock
20757
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4312
!
b41faaeaf46e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20755
diff changeset
  4313
20832
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4314
readEvalPrintLoop
81f3da354a97 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20831
diff changeset
  4315
    "say hello, then go into a read-eval-print loop"
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4316
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4317
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4318
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4319
    |repl|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4320
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4321
    repl := ReadEvalPrintLoop new.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4322
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4323
    SilentLoading == true ifTrue:[
22792
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4324
        repl answerPrompt:''.
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4325
        repl prompt:''.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4326
    ] ifFalse:[
22792
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4327
        Transcript showCR:(self hello).
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4328
        Transcript showCR:(self copyrightString).
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4329
        Transcript cr.
22793
d825d0de0d94 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22792
diff changeset
  4330
        Transcript showCR:'Read-eval-print loop.'.
d825d0de0d94 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22792
diff changeset
  4331
        Transcript showCR:'(exit with "#exit" or EOF; help with "?"; expressions are terminated with ".")'.
22792
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4332
        repl prompt:'STX> '.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4333
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4334
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4335
    repl
22792
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4336
        doChunkFormat:false;
22831
754ac658dc28 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 22799
diff changeset
  4337
        errorStream:Stderr;
22792
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  4338
        readEvalPrintLoop
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4339
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4340
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4341
restart
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4342
    "startup after an image has been loaded;
18385
2d0a9c256e0e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18384
diff changeset
  4343
     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
  4344
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4345
     there are three change-notifications made to dependents of ObjectMemory,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4346
     which allow a stepwise re-init: #earlyRestart, #restarted and #returnFromSnapshot.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4347
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4348
     #earlySystemInstallation is sent for ST80 compatibility
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4349
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4350
     #earlyRestart is send first, nothing has been setup yet.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4351
		   (should be used to flush all device dependent entries)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4352
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4353
     #restarted is send right after.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4354
		   (should be used to recreate external resources (fds, bitmaps etc)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4355
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4356
     #returnFromSnapshot is sent last
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4357
		   (should be used to restart processes, reOpen Streams which cannot
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4358
		    be automatically be reopened (i.e. Sockets, Pipes) and so on.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4359
		   (Notice that positionable fileStreams are already reopened and repositioned)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4360
     "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4361
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4362
    |deb insp transcript idx|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4363
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4364
    "/
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4365
    "/ when we arrive here, all objects from our previous life
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4366
    "/ have been reloaded - however, some may still contain invalid device
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4367
    "/ handles, display information etc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4368
    "/ also, dynamically loaded modules have not yet been reloaded yet.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4369
    "/ and the concrete OS, concrete FileName etc. are still refering to
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4370
    "/ the previous classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4371
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4372
    Initializing := true.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4373
    AbstractOperatingSystem initializeConcreteClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4374
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4375
    ImageRestartTime := Timestamp now.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4376
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4377
    CommandLine := CommandLineArguments copy.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4378
    CommandLineArguments := CommandLineArguments asOrderedCollection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4379
    CommandName := CommandLineArguments removeFirst. "/ the command
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4380
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4381
    idx := CommandLineArguments indexOf:'-q'.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4382
    idx == 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4383
	idx := CommandLineArguments indexOf:'--silent'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4384
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4385
    idx ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4386
	Object infoPrinting:false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4387
	ObjectMemory infoPrinting:false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4388
	CommandLineArguments removeAtIndex:idx.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4389
    ].
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4390
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4391
    "/ start catching SIGSEGV and SIGBUS
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4392
    OperatingSystem enableHardSignalInterrupts.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4393
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4394
    "/ reinit Filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4395
    Filename reinitialize.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4396
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4397
    "/ flush cached path directories (may have changed in the meanwhile)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4398
    self flushPathCaches.
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  4399
    self reinitializePackagePath.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4400
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4401
    "/ reinit the default streams: Stdin, Stdout and Stderr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4402
    "/ after that, we can write to stderr.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4403
    self reinitStandardStreams.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4404
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4405
    "/ redirect Transcript to Stderr during startup
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4406
    transcript := Transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4407
    Transcript := Stderr.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4408
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4409
    "/ temporary switch back to dumb interface -
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4410
    "/ to handle errors while view-stuff is not yet reinitialized
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4411
    insp := Inspector.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4412
    deb := Debugger.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4413
    deb notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4414
	deb reinitialize
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4415
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4416
    Inspector := MiniInspector.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4417
    Debugger := MiniDebugger.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4418
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4419
    "/ reload any dynamically loaded objects.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4420
    "/ this must be done before doing anything else below,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4421
    "/ because the Processor may restart processes which use
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4422
    "/ this code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4423
    "/ Also, a dynamic object might be registered as dependent of
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4424
    "/ ObjectFileLoader; therefore, must reload before doing any notifications.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4425
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4426
    ObjectFileLoader notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4427
	ObjectFileLoader reloadAllRememberedObjectFiles.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4428
    ].
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4429
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4430
    "/ invalidate all display connections.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4431
    "/ This is required to avoid trouble if someone accesses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4432
    "/ a display during early startup.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4433
    Screen notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4434
	Screen allScreens do:[:eachDisplay |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4435
	    eachDisplay invalidateConnection.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4436
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4437
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4438
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4439
    ObjectMemory changed:#earlySystemInstallation.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4440
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4441
    "/ reinitialize the Processor - restartable processes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4442
    "/ are now restarted here (but not yet scheduled).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4443
    Processor reinitialize.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4444
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4445
    "/ flush device handles & recreate OS resources (if possible)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4446
    "/ (mostly view/GC/color & font stuff)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4447
    ObjectMemory
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4448
	changed:#earlyRestart; changed:#restarted.
16269
b5bc3b162a92 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16252
diff changeset
  4449
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4450
    "/ start catching SIGINT and SIGQUIT
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4451
    OperatingSystem enableUserInterrupts.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4452
    OperatingSystem enableCrashSignalInterrupts.
12782
226df0172288 changed: #restart
Stefan Vogel <sv@exept.de>
parents: 12780
diff changeset
  4453
    ObjectMemory restoreGarbageCollectorSettings.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4454
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4455
    "/ 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
  4456
    "/ 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
  4457
    idx := CommandLineArguments indexOf:'--faststart'.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4458
    idx == 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4459
	idx := CommandLineArguments indexOf:'--fastStart'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4460
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4461
    idx ~~ 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4462
	CommandLineArguments removeAtIndex:idx.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4463
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4464
	CallbackSignal := QuerySignal new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4465
	[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4466
	    Class withoutUpdatingChangesDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4467
		(self fileIn:(self commandName , '_r.rc')) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4468
		    "no _r.rc file where executable is; try default smalltalk_r.rc"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4469
		    self fileIn:'smalltalk_r.rc'
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4470
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4471
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4472
	] on:CallbackSignal do:[:ex|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4473
	    "/ now, display and view-stuff works;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4474
	    "/ back to the previous debugging interface
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4475
	    Inspector := insp.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4476
	    Debugger := deb.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4477
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4478
	    "/ reinstall Transcript, if not changed during restart.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4479
	    "/ if there was no Transcript, go to stderr
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4480
	    (transcript notNil and:[Transcript == Stderr]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4481
		Transcript := transcript.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4482
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4483
	    Initializing := false.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4484
	    ex proceed.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4485
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4486
	CallbackSignal := nil.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4487
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4488
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4489
    "/ reinitialization (restart) of Display is normally performed
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4490
    "/ 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
  4491
    "/ do in now.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4492
    Initializing ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4493
	Display notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4494
	    [
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4495
		Display reinitializeFor:Screen defaultDisplayName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4496
	    ] on:Screen deviceOpenErrorSignal do:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4497
		'Smalltalk [error]: Cannot restart connection to: ' errorPrint.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4498
		Screen defaultDisplayName errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4499
		OperatingSystem exit:1.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4500
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4501
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4502
	"/ now, display and view-stuff works;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4503
	"/ back to the previous debugging interface
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4504
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4505
	Inspector := insp.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4506
	Debugger := deb.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4507
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4508
	"/ reinstall Transcript, if not changed during restart.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4509
	"/ if there was no Transcript, go to stderr
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4510
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4511
	(transcript notNil and:[Transcript == Stderr]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4512
	    Transcript := transcript.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4513
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4514
	Initializing := false.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4515
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4516
    Screen notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4517
	"clean up leftover screens (and views) that haven't been reopened.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4518
	 Operate on a copy, since brokenConnection removes us from AllScreens"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4519
	Screen allScreens copy do:[:eachDisplay |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4520
	    eachDisplay isOpen ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4521
		'Smalltalk [info]: cannot reopen secondary display: ' errorPrint.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4522
		eachDisplay errorPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4523
		eachDisplay cleanupAfterDispatch; brokenConnection.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4524
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4525
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4526
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4527
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4528
    deb := insp := transcript := nil.   "avoid dangling refs"
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4529
    (StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false]) ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4530
	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
  4531
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4532
    self mainStartup:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  4533
13526
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4534
    "Modified: / 03-08-1999 / 09:42:21 / stefan"
cfa0ed74dd6f changed:
Claus Gittinger <cg@exept.de>
parents: 13518
diff changeset
  4535
    "Modified: / 29-07-2011 / 17:58:23 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4536
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4537
11399
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4538
showSplashMessage:aString
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4539
    "put the message into the splash screen (if there is one).
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4540
     Use this for messages during startup"
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4541
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4542
    self showSplashMessage:aString color:nil.
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4543
!
19962a6e2972 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11393
diff changeset
  4544
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4545
showSplashMessage:aMessageStringOrNil color:rgbValueOrNil
11389
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4546
    "put the message into the splash screen (if there is one)."
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4547
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4548
%{
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4549
#ifdef WIN32
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4550
    extern void __win32_splashMessage();
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4551
    char *msg = (char *)0;
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4552
    int clr = 0;
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4553
12481
805176d238d2 change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents: 12413
diff changeset
  4554
    if (__isStringLike(aMessageStringOrNil)) {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4555
	msg = __stringVal(aMessageStringOrNil);
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4556
    }
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4557
    if (__isSmallInteger(rgbValueOrNil)) {
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4558
	clr = __intVal(rgbValueOrNil);
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  4559
	__win32_splashMessageColor(clr);
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4560
    }
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4561
    __win32_splashMessage(msg);
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4562
#endif
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4563
%}
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4564
!
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4565
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4566
splashInfo:aString
11389
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4567
    "like infoPrintCR,
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4568
     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
  4569
     Use this for info messages during startup"
4f63adbf978a comments
Claus Gittinger <cg@exept.de>
parents: 11388
diff changeset
  4570
12883
133a10b7bd12 changed: #splashInfo:
Claus Gittinger <cg@exept.de>
parents: 12867
diff changeset
  4571
    aString notNil ifTrue:[ aString infoPrintCR ].
11388
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4572
    self showSplashMessage:aString color:nil.
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4573
!
292d92d3ed5e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11387
diff changeset
  4574
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  4575
start
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4576
    "low level entry from the VM's main.
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4577
     After initializeSystem, this is the very first real entry into the Smalltalk world.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4578
     Analyzes the command line and checks what to do
20831
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4579
     (i.e. script/repl/eval or full blown IDE).
020ba0f38412 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20830
diff changeset
  4580
     Also handles --load and various debug options.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4581
     Caveat:
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4582
        this has become too complicated and desperately needs a rewrite.
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4583
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4584
     Also:
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4585
        Be very careful when changing things here;
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4586
        especially be careful to ensure that the scripting options are robust against any
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4587
        missing packages; so the error handlers should not depend on any stream, logger etc. features.
21020
55d520adcce5 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21019
diff changeset
  4588
     "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4589
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  4590
    |idx graphicalMode arg didReadRCFile keepSplashWindow|
960
e3b75f50d0cd changes for standAlone operation
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
  4591
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4592
    VerboseStartup ifTrue:['start...' infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4593
19597
435f19b58541 #FEATURE by sr
sr
parents: 19589
diff changeset
  4594
    graphicalMode := Smalltalk isSmalltalkDevelopmentSystem.
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4595
    Initializing := true.
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4596
25116
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4597
    keepSplashWindow := false.
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4598
    StartupClass notNil ifTrue:[
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4599
        keepSplashWindow := StartupClass perform:#keepSplashWindowOpen ifNotUnderstood:[false].
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4600
    ].
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4601
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4602
    StartupClass isNil ifTrue:[
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4603
        "/ not for end user apps
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4604
        idx := CommandLineArguments indexOf:'--version'.
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4605
        idx ~~ 0 ifTrue:[
25192
7e8d07778259 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25176
diff changeset
  4606
            self versionString _printCR.
25116
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4607
            self exit:0.
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4608
        ].
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4609
    ].
aa3a98621b0a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 25114
diff changeset
  4610
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4611
    "/ remove possibly leftover --debug arg (not removed in initVerboseFlags, for whatever reason)
21016
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4612
    idx := CommandLineArguments indexOf:'--debug'.
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4613
    (idx ~~ 0) ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4614
        CommandLineArguments removeAtIndex:idx.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  4615
    ].
21016
94e96557d795 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21015
diff changeset
  4616
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4617
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4618
     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
  4619
    "
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  4620
    Class withoutUpdatingChangesDo:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4621
        |commandFiles rcFile defaultRC prevCatchSetting
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4622
         isEval isPrint isFilter isRepl isRunMain idxFileArg process|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4623
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4624
        isEval := isPrint := isFilter := isRepl := isRunMain := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4625
        didReadRCFile := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4626
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4627
        StandAlone ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4628
            "/ self initializeVerboseFlags.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4629
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4630
            "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4631
            "/ look for any '-q', '-e', '-l' or '-f' command line arguments
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4632
            "/ and handle them;
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4633
            "/ read startup and patches file
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4634
            "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4635
            idx := CommandLineArguments indexOfAny:#('-R' '--repl').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4636
            isRepl := IsRepl := (idx ~~ 0).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4637
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4638
            idx := CommandLineArguments indexOfAny:#('-q' '--silent').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4639
            idx ~~ 0 ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4640
                Object infoPrinting:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4641
                ObjectMemory infoPrinting:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4642
                CommandLineArguments removeAtIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4643
                SilentLoading := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4644
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4645
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4646
            [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4647
                idx := CommandLineArguments indexOfAny:#('-pp' '--packagePath').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4648
                idx ~~ 0
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4649
            ] whileTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4650
                arg := CommandLineArguments at:idx + 1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4651
                CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4652
                (arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4653
                    self packagePath addLast:each.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4654
                    VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4655
                        ('Smalltalk [info]: add to packagePath: "', arg, '".') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4656
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4657
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4658
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4659
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4660
            [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4661
                idx := CommandLineArguments indexOfAny:#('-l' '--load').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4662
                idx ~~ 0
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4663
            ] whileTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4664
                arg := CommandLineArguments at:idx + 1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4665
                CommandLineArguments removeAtIndex:idx+1; removeAtIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4666
                Smalltalk silentlyLoadingDo:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4667
                    (arg asCollectionOfSubstringsSeparatedByAny:',;') do:[:each |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4668
                        each asFilename exists ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4669
                            (VerboseStartup | VerboseLoading) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4670
                                ('Smalltalk [info]: loading file: "', each, '".') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4671
                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4672
                            Smalltalk fileIn:each
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4673
                        ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4674
                            (VerboseStartup | VerboseLoading) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4675
                                ('Smalltalk [info]: loading package: "', each, '".') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4676
                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4677
                            Smalltalk loadPackage:each
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4678
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4679
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4680
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4681
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4682
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4683
            "/ look for a '-e filename' or '--execute filename' or '--script filename' argument
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4684
            "/ this will force fileIn of filename only, no standard startup.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4685
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4686
            idx := CommandLineArguments indexOfAny:#('-e' '--execute' '--script').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4687
            idx ~~ 0 ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4688
                SilentLoading := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4689
                CommandName := arg := CommandLineArguments at:idx + 1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4690
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4691
                CommandLineArguments
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4692
                    removeAtIndex:idx+1; removeAtIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4693
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4694
                self startSchedulerAndBackgroundCollector.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4695
                keepSplashWindow ifFalse:[ self hideSplashWindow ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4696
                Initializing := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4697
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4698
                process := [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4699
                    Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4700
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4701
                    "/ set workspace variables
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4702
                    self defineCommandLineAsWorkspaceVariablesForScripts.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4703
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4704
                    "/ provide a Display, if needed
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4705
                    self providingDisplayDo:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4706
                        VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4707
                            ('Smalltalk [info]: reading script from: "', arg, '".') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4708
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4709
                        NoHandlerError handle:[:ex |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4710
                            Debugging == true ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4711
                                MiniDebugger enterException:ex.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4712
                            ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4713
                                Silent ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4714
                                    'Smalltalk [error]: ' _errorPrint. ex exception description _errorPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4715
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4716
                                (VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4717
                                    ex suspendedContext fullPrintAll.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4718
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4719
                                self exit:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4720
                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4721
                            self exit:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4722
                            "/ ex reject.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4723
                        ] do:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4724
                            UserInterrupt handle:[:ex |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4725
                                Debugging == true ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4726
                                    'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4727
                                    "/ thisContext fullPrintAll.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4728
                                    MiniDebugger enterException:ex.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4729
                                    ex proceed.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4730
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4731
                                Silent ifFalse:[ 'user interrupt.' errorPrintCR ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4732
                                self exit:128+(OperatingSystem sigINT).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4733
                            ] do:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4734
                                |cmdStream result|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4735
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4736
                                arg = '-' ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4737
                                    cmdStream := Stdin.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4738
                                ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4739
                                    IsSTScript := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4740
                                    cmdStream := arg asFilename readStream.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4741
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4742
                                result := [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4743
                                    self fileInStream:cmdStream
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4744
                                           lazy:nil
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4745
                                           silent:self verbose not
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4746
                                           logged:false
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4747
                                           addPath:nil
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4748
                                ] ensure:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4749
                                    IsSTScript ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4750
                                        "/ do not close Stdin
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4751
                                        cmdStream close.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4752
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4753
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4754
                                result ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4755
                                    self exit:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4756
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4757
                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4758
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4759
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4760
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4761
                    "/ after the script, if Screen has been opened and there are any open windows,
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4762
                    "/ then do not exit
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4763
false ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4764
                    Display notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4765
                        Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4766
                        "/ Display exitOnLastClose:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4767
                        "/ Display checkForEndOfDispatch.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4768
                    ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4769
                        self exit.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4770
                    ].
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4771
].
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4772
                ] newProcess.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4773
                process priority:(Processor userSchedulingPriority).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4774
                process name:'main'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4775
                process beGroupLeader.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4776
                process resume.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4777
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4778
                Processor dispatchLoop.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4779
                self exit
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4780
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4781
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4782
            "look for a '-f filename' or '--file filename' argument
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4783
             if scripting, these are loaded before -P, -E or -R action.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4784
             if not scripting, this will force evaluation of filename instead of smalltalk.rc"
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4785
            [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4786
                idxFileArg := CommandLineArguments indexOfAny:#('-f' '--file').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4787
                (idxFileArg ~~ 0)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4788
            ] whileTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4789
                commandFiles isNil ifTrue:[ commandFiles := OrderedCollection new ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4790
                commandFiles add:(CommandLineArguments at:idxFileArg+1).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4791
                CommandLineArguments removeAtIndex:idxFileArg+1; removeAtIndex:idxFileArg.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4792
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4793
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4794
            "/ look for a '-E expr' or '--eval expr' argument (-P or --print to print the result of evaluation)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4795
            "/ or -F/--filter or a '--repl' argument
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4796
            "/ E, P and F this will force evaluation of expr only, no standard startup
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4797
            "/ repl go into an interactive loop.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4798
            idx := CommandLineArguments indexOfAny:#('-E' '--eval').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4799
            (isEval := (idx ~~ 0)) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4800
                idx := CommandLineArguments indexOfAny:#('-P' '--print').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4801
                (isPrint := (idx ~~ 0)) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4802
                    idx := CommandLineArguments indexOfAny:#('-F' '--filter').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4803
                    (isFilter := (idx ~~ 0)) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4804
                        idx := CommandLineArguments indexOfAny:#('-R' '--repl').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4805
                        (isRepl := (idx ~~ 0)) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4806
                            idx := CommandLineArguments indexOfAny:#('--run').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4807
                            isRunMain := (idx ~~ 0)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4808
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4809
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4810
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4811
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4812
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4813
            (isEval | isPrint | isFilter | isRepl | isRunMain) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4814
                |args|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4815
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4816
                VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4817
                    ('Smalltalk [info]: eval/filter/print or repl') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4818
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4819
                isRepl ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4820
                    CommandLineArguments size <= idx ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4821
                        StandAlone := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4822
                        self exitWithErrorMessage:'missing argument after -E/-P/-F/--run.'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4823
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4824
                    isFilter ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4825
                        args := CommandLineArguments copyFrom:idx + 1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4826
                        CommandLineArguments removeFromIndex:idx+1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4827
                        VerboseStartup ifTrue:[
25192
7e8d07778259 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25176
diff changeset
  4828
                            ('Smalltalk [info]: filter expression(s): ') infoPrint. args infoPrintCR.
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4829
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4830
                    ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4831
                        arg := CommandLineArguments at:idx + 1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4832
                        CommandLineArguments removeAtIndex:idx+1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4833
                        VerboseStartup ifTrue:[
25192
7e8d07778259 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25176
diff changeset
  4834
                            ('Smalltalk [info]: eval expression: ') infoPrint. arg infoPrintCR.
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4835
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4836
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4837
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4838
                CommandLineArguments removeAtIndex:idx.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4839
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4840
                self startSchedulerAndBackgroundCollector.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4841
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4842
                keepSplashWindow ifFalse:[ self hideSplashWindow ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4843
                Initializing := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4844
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4845
                "/ set workspace variables
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4846
                self defineCommandLineAsWorkspaceVariablesForScripts.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4847
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4848
                "/ all of the above allow for a -f file to be loaded before any other action
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4849
                (commandFiles notEmptyOrNil) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4850
                    commandFiles do:[:commandFile |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4851
                        (VerboseStartup | VerboseLoading) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4852
                            ('Smalltalk [info]: reading command file from: "', commandFile, '".') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4853
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4854
                        Smalltalk silentlyLoadingDo:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4855
                            (self secureFileIn:commandFile) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4856
                                StandAlone := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4857
                                self exitWithErrorMessage:('"', commandFile, '" not found.').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4858
                            ]
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4859
                        ]
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4860
                    ]
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4861
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4862
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4863
                isRepl ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4864
                    Debugging == true ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4865
                        "/ remove the Debugger
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4866
                        Debugger := nil.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4867
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4868
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4869
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4870
                process := [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4871
                    self providingDisplayDo:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4872
                        isRepl ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4873
                            Processor exitWhenNoMoreUserProcesses:false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4874
                            Processor activeProcess name:'repl'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4875
                            self readEvalPrintLoop.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4876
                            self exit.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4877
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4878
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4879
                        Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4880
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4881
                        NoHandlerError handle:[:ex |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4882
                            Debugging == true ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4883
                                MiniDebugger enterException:ex.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4884
                            ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4885
                                Silent ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4886
                                    'Smalltalk [error]: ' _errorPrint. ex description _errorPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4887
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4888
                                (VerboseStartup or:[ObjectMemory debugPrinting]) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4889
                                    ex suspendedContext fullPrintAll.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4890
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4891
                                self exit:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4892
                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4893
                            self exit:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4894
                            "/ ex reject.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4895
                        ] do:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4896
                            UserInterrupt handle:[:ex |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4897
                                Debugging == true ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4898
                                    'user interrupt (type "c" to continue; "x" to exit; "?" for help).' errorPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4899
                                    "/ thisContext fullPrintAll.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4900
                                    MiniDebugger enterException:ex.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4901
                                    ex proceed.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4902
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4903
                                Silent ifFalse:[ 'user interrupt.' errorPrintCR ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4904
                                self exit:128+(OperatingSystem sigINT).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4905
                            ] do:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4906
                                |filterCode filterStart filterEnd|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4907
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4908
                                isFilter ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4909
                                    "/ --filter - apply code to each input line.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4910
                                    "/ compile code only once
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4911
                                    (args size == 1) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4912
                                        VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4913
                                            'Smalltalk [info]: filter 1-arg' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4914
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4915
                                        filterCode := args at:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4916
                                    ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4917
                                        (args size == 3) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4918
                                            VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4919
                                                'Smalltalk [info]: filter 3-arg' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4920
                                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4921
                                            filterStart := args at:1.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4922
                                            filterCode := args at:2.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4923
                                            filterEnd := args at:3.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4924
                                        ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4925
                                            StandAlone := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4926
                                            self exitWithErrorMessage:'--filter must be followed by 1 or 3 expression arg(s)'
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4927
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4928
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4929
                                    filterStart notEmptyOrNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4930
                                        VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4931
                                            ('Smalltalk [info]: eval: "', filterStart, '"...') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4932
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4933
                                        Compiler evaluate:filterStart notifying:(EvalScriptingErrorHandler new source:filterStart)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4934
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4935
                                    VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4936
                                        ('Smalltalk [info]: compile: "', filterCode, '"...') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4937
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4938
                                    Compiler
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4939
                                        compile:'doIt:line ',filterCode
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4940
                                        forClass:String
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4941
                                        notifying:(EvalScriptingErrorHandler new source:filterCode).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4942
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4943
                                    [Stdin atEnd] whileFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4944
                                        |line|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4945
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4946
                                        line := Stdin nextLine.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4947
                                        line doIt:line.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4948
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4949
                                    filterEnd notEmptyOrNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4950
                                        VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4951
                                            ('Smalltalk [info]: eval: "', filterEnd, '"...') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4952
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4953
                                        Compiler evaluate:filterEnd notifying:(EvalScriptingErrorHandler new source:filterEnd)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4954
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4955
                                ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4956
                                    (isPrint | isEval) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4957
                                        "/ --print or --eval
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4958
                                        |rslt|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4959
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4960
                                        rslt := Parser new
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4961
                                                    evaluate:arg
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4962
                                                    notifying:(EvalScriptingErrorHandler new source:arg)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4963
                                                    compile:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4964
                                        isPrint ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4965
                                            rslt printCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4966
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4967
                                    ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4968
                                        "/ --run <className>
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4969
                                        |className class|
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4970
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4971
                                        className := arg.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4972
                                        class := Smalltalk classNamed:className.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4973
                                        class isNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4974
                                            StandAlone := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4975
                                            self exitWithErrorMessage:'no such class: "', className, '".'
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4976
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4977
                                        (class respondsTo:#main:) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4978
                                            class main:CommandLineArguments.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4979
                                        ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4980
                                            (class respondsTo:#main) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4981
                                                class main.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4982
                                            ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4983
                                                (class respondsTo:#start) ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4984
                                                    class start.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4985
                                                ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4986
                                                    StandAlone := true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4987
                                                    self exitWithErrorMessage:'class has no "main:", "main" or "start" method.'
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4988
                                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4989
                                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4990
                                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4991
                                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4992
                                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4993
                            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4994
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4995
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4996
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4997
                    "/ after the script, if Screen has been opened and there are any open windows,
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  4998
                    "/ then do not exit
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  4999
false ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5000
                    Display notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5001
                        Processor exitWhenNoMoreUserProcesses:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5002
                        "/ Display exitOnLastClose:true.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5003
                        "/ Display checkForEndOfDispatch.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5004
                        VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5005
                            ('Smalltalk [info]: display opened.') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5006
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5007
                    ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5008
                        VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5009
                            ('Smalltalk [info]: no display - exit after script.') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5010
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5011
                        self exit.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5012
                    ].
20758
212ca877b8af #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20757
diff changeset
  5013
].
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5014
                    VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5015
                        ('Smalltalk [info]: script/repl/eval finished.') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5016
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5017
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5018
                ] newProcess.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5019
                process priority:(Processor userSchedulingPriority).
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5020
                process name:'main'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5021
                process beGroupLeader.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5022
                process resume.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5023
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5024
                Processor dispatchLoop.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5025
                VerboseStartup ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5026
                    ('Smalltalk [info]: exit normally.') infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5027
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5028
                self exit
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5029
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5030
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5031
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5032
        commandFiles notNil ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5033
            SilentLoading := true.  "/ suppress the hello & copyright messages
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5034
            self addStartBlock:
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5035
                [
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5036
                    commandFiles do:[:commandFile |
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5037
                        VerboseStartup ifTrue:[('filing in %1' bindWith:commandFile) infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5038
                        (self secureFileIn:commandFile) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5039
                            self exitWithErrorMessage:('startup file "', commandFile, '" not found.').
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5040
                        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5041
                    ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5042
                ].
16091
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5043
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5044
"/            self startSchedulerAndBackgroundCollector.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5045
"/            keepSplashWindow ifFalse:[ self hideSplashWindow ].
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5046
"/            Initializing := false.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5047
"/
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5048
"/            (self secureFileIn:commandFile) ifFalse:[
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5049
"/                ('Smalltalk [error]: startup file "', commandFile, '" not found.') errorPrintCR.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5050
"/                OperatingSystem exit:1.
775b7b8d2571 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16090
diff changeset
  5051
"/            ].
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5052
        ] ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5053
            "/ look for <command>.rc
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5054
            "/ if not found, read smalltalk.rc (or stxapp.rc for standAlone operation)
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5055
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5056
            rcFile := self commandName asFilename withSuffix:'rc'.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5057
            VerboseStartup ifTrue:[('filing in %1' bindWith:rcFile) infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5058
            (didReadRCFile := rcFile exists and:[self secureFileIn:rcFile]) ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5059
                StandAlone ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5060
                    defaultRC := 'smalltalk.rc' "/asFilename
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5061
                ] ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5062
                    defaultRC := 'stxapp.rc' "/asFilename
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5063
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5064
                "JV@2011-11-01: DO NOT check defaultRC exist - this prevents smalltalk to
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5065
                    to be started with different working directory than stx/projects/smalltalk !!!!!!"
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5066
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5067
                "/didReadRCFile := defaultRC exists and:[self secureFileIn:defaultRC].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5068
                VerboseStartup ifTrue:[('filing in %1' bindWith:defaultRC) infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5069
                didReadRCFile := (self getSystemFileName:defaultRC) notNil
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5070
                                 and:[self secureFileIn:defaultRC].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5071
                didReadRCFile ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5072
                    StandAlone ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5073
                        'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5074
                        graphicalMode := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5075
                    ]
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5076
                ]
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5077
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5078
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5079
            "/ ('StandAlone is %1' bindWith:StandAlone) printCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5080
            "/ ('Headless is %1' bindWith:HeadlessOperation) printCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5081
            "/ ('Display is %1' bindWith:Display) printCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5082
            "/ ('Screen is %1' bindWith:Screen) printCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5083
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5084
            keepSplashWindow ifFalse:[ self hideSplashWindow ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5085
            didReadRCFile ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5086
                'private.rc' asFilename exists ifTrue:[ 
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5087
                    VerboseStartup ifTrue:[('filing in private.rc') infoPrintCR].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5088
                    self secureFileIn:'private.rc' 
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5089
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5090
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5091
                "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5092
                "/ No RC file found;
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5093
                "/ Setup more default stuff
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5094
                "/
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5095
                StandAlone ifFalse:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5096
                    "/ its a smalltalk - proceed in interpreter.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5097
                    'Smalltalk [warning]: no startup rc-file found. Going into line-by-line interpreter.' infoPrintCR.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5098
                    graphicalMode := false.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5099
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5100
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5101
                "/ setup more defaults...
13537
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  5102
"/                ObjectMemory startBackgroundCollectorAt:5.
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  5103
"/                ObjectMemory startBackgroundFinalizationAt:5.
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5104
                self addStartBlock:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5105
                    self startSchedulerAndBackgroundCollector
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5106
                ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5107
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5108
        ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5109
        (CommandLineArguments includes:'--scripting') ifTrue:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5110
            self addStartBlock:[
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5111
                StandaloneStartup handleScriptingOptionsFromArguments:CommandLineArguments.
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5112
            ].
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5113
        ].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  5114
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  5115
10644
a67765a8a0d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10643
diff changeset
  5116
    HeadlessOperation ifTrue:[
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5117
        graphicalMode := false.
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  5118
    ].
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  5119
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  5120
    keepSplashWindow ifFalse:[ self hideSplashWindow ].
1578
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  5121
    self mainStartup:graphicalMode
9df8cc1ec5c4 start & restart actions merged into a common method.
Claus Gittinger <cg@exept.de>
parents: 1573
diff changeset
  5122
15872
605d272f5e1c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15783
diff changeset
  5123
    "Modified: / 17-12-2013 / 16:44:40 / cg"
22147
998484c2c1a3 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22015
diff changeset
  5124
    "Modified: / 01-08-2017 / 11:08:47 / stefan"
23628
8a9baee8f42a #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 23588
diff changeset
  5125
    "Modified: / 22-01-2019 / 14:01:44 / Claus Gittinger"
13536
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5126
!
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5127
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5128
startSchedulerAndBackgroundCollector
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5129
    Processor startTimeSlicing.
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5130
    Processor supportDynamicPriorities:true.
13537
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  5131
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  5132
    ObjectMemory startBackgroundCollectorAt:5.
647c75f02ce7 changed:
Claus Gittinger <cg@exept.de>
parents: 13536
diff changeset
  5133
    ObjectMemory startBackgroundFinalizationAt:5.
13536
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5134
    ObjectMemory backgroundCollectProcess priorityRange:(4 to:9).
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5135
    ObjectMemory backgroundFinalizationProcess priorityRange:(4 to:9).
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5136
839fe9c57304 added: #startSchedulerAndBackgroundCollector
Claus Gittinger <cg@exept.de>
parents: 13532
diff changeset
  5137
    "Created: / 31-07-2011 / 20:01:33 / cg"
11808
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5138
!
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5139
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5140
startStartBlockProcess
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5141
    "at the end of the smalltalk initialization, start all actions that
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5142
     were delayed until the ProcessorScheduler is running in a separate process"
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5143
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5144
    |p|
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5145
14b417cf2b51 Define #startStartBlockProcess
Stefan Vogel <sv@exept.de>
parents: 11690
diff changeset
  5146
    p :=
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5147
	[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5148
	    self executeStartBlocks.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5149
	] newProcess.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  5150
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  5151
    p
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5152
	priority:(Processor userSchedulingPriority);
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5153
	name:'start block handler';
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5154
	beGroupLeader;
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5155
	resume.
13892
3a39b1ef1d6f changed:
Claus Gittinger <cg@exept.de>
parents: 13883
diff changeset
  5156
13893
580686880e8f added: #executeStartBlocks
Claus Gittinger <cg@exept.de>
parents: 13892
diff changeset
  5157
    "Modified: / 07-01-2012 / 12:59:01 / cg"
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5158
! !
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5159
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5160
!Smalltalk class methodsFor:'startup and exit'!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5161
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5162
addExitBlock:aBlock
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5163
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5164
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5165
    "add a block to be executed when Smalltalk finishes.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5166
     This feature is currently not used anywhere - but could be useful for
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5167
     cleanup in stand alone applications.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5168
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5169
     Better use: ObjectMemory>>#addDependent: and handle the change message
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5170
     #aboutToQuit."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5171
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5172
    ExitBlocks isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5173
	ExitBlocks := OrderedCollection with:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5174
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5175
	ExitBlocks add:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5176
    ]
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5177
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5178
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5179
addImageStartBlock:aBlock
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5180
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5181
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5182
    "add a blocks to be executed in a separate process after
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5183
     everything has been initialized.
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5184
     These blocks will be executed after an image restart."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5185
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5186
    ImageStartBlocks isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5187
	ImageStartBlocks := OrderedCollection with:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5188
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5189
	ImageStartBlocks add:aBlock
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5190
    ]
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5191
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5192
    "Created: 9.9.1996 / 16:48:20 / stefan"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5193
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5194
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5195
addStartBlock:aBlock
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5196
    "to be called ONLY during very early startup (before the process scheduler
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5197
     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
  5198
     everything has been initialized.
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5199
     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
  5200
     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
  5201
     be operating.
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5202
     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
  5203
     Initial processes such as the launcher are usually started here
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5204
     (see smalltalk.rc / private.rc).
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5205
     ONLY to be called from such an rc file."
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5206
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5207
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5208
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5209
    "/ to protect against "mis-users" of this mehtod...
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5210
    Initializing ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5211
	aBlock value
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5212
    ] ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5213
	StartBlocks isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5214
	    StartBlocks := OrderedCollection with:aBlock
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5215
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5216
	    StartBlocks add:aBlock
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5217
	]
15980
83b70fa9bf0a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15958
diff changeset
  5218
    ].
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5219
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5220
    "Created: / 09-09-1996 / 16:46:53 / stefan"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5221
    "Modified (comment): / 18-08-2011 / 09:18:42 / cg"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5222
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5223
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5224
exit
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5225
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5226
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5227
    "finish the Smalltalk system"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5228
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5229
    self exit:0
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5230
    "not reached"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5231
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5232
    "Be careful evaluating this
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5233
     Smalltalk exit
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5234
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5235
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5236
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5237
exit:statusInteger
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5238
    "{ Pragma: +optSpace }"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5239
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5240
    "finish the Smalltalk system"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5241
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5242
    ObjectMemory changed:#aboutToExit.  "/ for ST/X backward compatibility
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5243
    ObjectMemory changed:#aboutToQuit.  "/ for ST-80 compatibility
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5244
    ExitBlocks notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5245
	ExitBlocks do:[:aBlock |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5246
	    aBlock value
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5247
	]
21782
05d815aaf51d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21599
diff changeset
  5248
    ].
05d815aaf51d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21599
diff changeset
  5249
    Display notNil ifTrue:[ Display closeConnection ].
05d815aaf51d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21599
diff changeset
  5250
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5251
    OperatingSystem exit:statusInteger
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5252
    "not reached"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5253
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5254
    "Be careful evaluating this
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5255
     Smalltalk exit:1
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5256
    "
21782
05d815aaf51d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21599
diff changeset
  5257
05d815aaf51d #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 21599
diff changeset
  5258
    "Modified: / 30-05-2017 / 21:36:35 / cg"
19014
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5259
!
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5260
19958
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5261
exitIfStandalone
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5262
    "if this is a standalone application, exit.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5263
     Otherwise give a warning and abort.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5264
     Call this in your code instead of Smalltalk exit,
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5265
     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
  5266
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5267
    "{ Pragma: +optSpace }"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5268
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5269
    self exitIfStandalone:0
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5270
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5271
    "Created: / 06-06-2016 / 14:56:49 / cg"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5272
!
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5273
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5274
exitIfStandalone:statusInteger
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5275
    "if this is a standalone application, exit.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5276
     Otherwise give a warning and abort.
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5277
     Call this in your code instead of Smalltalk exit,
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5278
     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
  5279
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5280
    "{ Pragma: +optSpace }"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5281
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5282
    Smalltalk isStandAloneApp ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5283
	self exit:statusInteger
19958
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5284
    ] ifFalse:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5285
	self warn:'Application asks Smalltalk to exit (this is suppressed in IDE).'.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5286
	AbortOperationRequest raise.
19958
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5287
    ]
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5288
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5289
    "
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5290
     Smalltalk exitIfStandalone:1
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5291
    "
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5292
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5293
    "Created: / 06-06-2016 / 14:56:00 / cg"
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5294
!
8d7c3bde4483 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19919
diff changeset
  5295
19014
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5296
exitOrError:exitCode
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5297
    "exit only if running as standalone application.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5298
     Raise an error in the development system.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5299
     Useful for testing standalone apps which should not kill
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5300
     your development system."
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5301
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5302
    self isStandAloneApp ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5303
	self exit:exitCode.
19014
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5304
    ].
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5305
    self error:'standalone smalltalk would exit here with exit code: ', exitCode printString.
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5306
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5307
    "
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5308
     self exitOrError:0
8056dc26f7d7 #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18924
diff changeset
  5309
    "
20715
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5310
!
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5311
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5312
exitWithErrorMessage:msg
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5313
    ('Smalltalk [error]: ',msg) errorPrintCR.
07093a7832f0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20714
diff changeset
  5314
    self exitOrError:1
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5315
! !
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5316
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  5317
!Smalltalk class methodsFor:'startup queries'!
1097
14711c00f386 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1095
diff changeset
  5318
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5319
commandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5320
    "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
  5321
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5322
    ^ CommandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5323
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5324
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5325
     Smalltalk commandLine
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5326
    "
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
    "Created: 19.7.1996 / 11:09:06 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5331
commandLineArgumentNamed:aString
16110
c17880a91e5e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16100
diff changeset
  5332
    "extract a named argument from the command line arguments.
c17880a91e5e class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16100
diff changeset
  5333
     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
  5334
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5335
    |args index|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5336
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5337
    args := self commandLineArguments.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5338
    index := args indexOf:aString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5339
    (index between:1 and:(args size - 1)) ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5340
	^ args at:index+1
10641
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
    ^ nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5343
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5344
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5345
     self commandLineArgumentNamed:'-display'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5346
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5347
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5348
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5349
commandLineArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5350
    "return the user command line arguments;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5351
     This is a collection of strings (separated command line words),
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5352
     from which the internal startup arguments have already been removed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5353
     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
  5354
     the commandLineArguments will be #('foo' 'bar' 'baz').
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5355
     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
  5356
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5357
    ^ CommandLineArguments
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
    "Modified: 19.7.1996 / 11:11:03 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5360
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5361
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5362
commandName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5363
    "return the excutables name - this is normally 'stx',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5364
     but can be something else for standAlone apps."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5365
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5366
    ^ CommandName.
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 commandName
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.7.1996 / 11:11:16 / 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
hasNoConsole
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5376
    "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
  5377
     i.e. there should be no writing to stdout/stderr"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5378
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5379
    ^ HasNoConsole ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5380
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5381
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5382
     Smalltalk hasNoConsole
9054
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  5383
    "
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  5384
!
d9de09e49007 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9047
diff changeset
  5385
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5386
ignoreAssertions
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5387
    "return true, if assertions are to be ignored (i.e. not executed).
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5388
     This is false by default in an IDE (i.e. full smalltalk),
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5389
     but can be set to true for standAlone applications
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5390
     (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
  5391
     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
  5392
     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
  5393
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  5394
    ^ IgnoreAssertions ? false
17435
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5395
!
6057cb39678c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17434
diff changeset
  5396
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5397
ignoreAssertions:aBoolean
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5398
    "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
  5399
     This is false by default in an IDE (i.e. full smalltalk),
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5400
     but can be set to true for standAlone applications
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5401
     (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
  5402
     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
  5403
     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
  5404
17439
1928276a394c added class variable IgnoreAssertions
Claus Gittinger <cg@exept.de>
parents: 17438
diff changeset
  5405
    IgnoreAssertions := aBoolean
17438
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5406
!
fa80b8989917 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17436
diff changeset
  5407
22679
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5408
isDebuggableApp
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5409
    "return true, if we want to see a Debugger, MiniDebugger or extended debugging output
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5410
     in some situations."
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5411
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5412
    ^ self isStandAloneApp not or:[self isStandAloneDebug].
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5413
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5414
    "
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5415
     Smalltalk isDebuggableApp
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5416
    "
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5417
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5418
    "Created: / 19-04-2018 / 10:30:17 / stefan"
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5419
!
be7996acb8aa #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22650
diff changeset
  5420
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5421
isHeadless
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5422
    "return true, if this is a headless application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5423
     i.e. no default Display connection is required/used"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5424
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5425
    ^ HeadlessOperation ? false
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
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5428
     Smalltalk isHeadless
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5429
    "
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5430
!
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5431
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5432
isPlugin
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5433
    "return true, if this is a plugin application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5434
     i.e. running in a browserWindow"
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
    ^ IsPlugin ? false
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
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5439
     Smalltalk isPlugin
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5440
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5441
!
4957
d2470714f2da headless stuff
Stefan Vogel <sv@exept.de>
parents: 4956
diff changeset
  5442
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5443
isSTScript
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5444
    "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
  5445
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5446
    ^ IsSTScript ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5447
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5448
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5449
     Smalltalk isSTScript
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5450
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5451
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5452
    "Created: / 06-12-2006 / 16:41:21 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5453
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5454
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5455
isSharedLibraryComponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5456
    "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
  5457
     i.e. a dll within another app."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5458
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5459
    ^ IsSharedLibraryComponent ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5460
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5461
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5462
     Smalltalk isSharedLibraryComponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5463
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5464
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5465
    "Created: / 10-08-2006 / 13:09:34 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5468
isSmalltalkDevelopmentSystem
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5469
    "return true, if this is a real smalltalk system
17421
9f2dac6c6efb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17399
diff changeset
  5470
     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
  5471
     and NOT a plugIn (i.e. running in a browser)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5472
     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
  5473
     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
  5474
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5475
    self isPlugin ifTrue:[^ false].                     "/ I am a browser-plugin
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5476
    self isSharedLibraryComponent ifTrue:[^ false].     "/ I am a COM-ponent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5477
    self isSTScript ifTrue:[^ true ].                   "/ I am stScript
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  5478
    ^ self isStandAloneApp not.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5479
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5480
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5481
     Smalltalk isSmalltalkDevelopmentSystem
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5482
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5483
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5484
    "Created: / 10-08-2006 / 13:12:49 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5485
    "Modified: / 06-12-2006 / 16:42:56 / cg"
15565
3dae2c24b592 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15334
diff changeset
  5486
    "Modified (comment): / 27-07-2013 / 15:36:20 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5487
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5488
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5489
isStandAloneApp
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5490
    "return true, if this is a standAlone application
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5491
     i.e. a stripped & linked application (such as the webServer)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5492
     in contrast to a full smalltalk (development) system."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5493
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5494
    ^ StandAlone ? false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5495
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5496
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5497
     Smalltalk isStandAloneApp
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5498
    "
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  5499
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  5500
13947
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5501
isStandAloneDebug
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5502
    "return true, if this is a standAlone application which
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5503
     was started with the -debug option."
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5504
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5505
    ^ DebuggingStandAlone ? false
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5506
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5507
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5508
     Smalltalk isStandAloneDebug
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5509
    "
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5510
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5511
    "Created: / 19-01-2012 / 10:17:41 / cg"
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5512
!
efccef803a92 added: #isStandAloneDebug
Claus Gittinger <cg@exept.de>
parents: 13893
diff changeset
  5513
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5514
startupArguments
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5515
    "return the arguments passed to StartupClass when stx gets started.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5516
     Usually these are nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5517
     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
  5518
     a simple way to configure and create stand-alone applications"
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
    ^ StartupArguments
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
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5523
     Smalltalk startupArguments
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5524
    "
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5525
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5526
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5527
startupClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5528
    "return the class, that will get the start message when smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5529
     starts and its non-nil. Usually this is nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5530
     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
  5531
     a simple way to configure and create stand-alone applications"
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
    ^ StartupClass
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
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5536
     Smalltalk startupClass
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5537
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5538
!
8570
0a7f80cc592f version bump
ca
parents: 8567
diff changeset
  5539
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5540
startupClass:aClass selector:aSymbol arguments:anArrayOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5541
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5542
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5543
    "set the class, selector and arguments to be performed when smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5544
     starts. Setting those before saving a snapshot, will make the saved
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5545
     image come up executing your application (instead of the normal mainloop)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5546
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5547
    StartupClass := aClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5548
    StartupSelector := aSymbol.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5549
    StartupArguments := anArrayOrNil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5550
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5551
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5552
startupSelector
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5553
    "return the selector, that will be sent to StartupClass.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5554
     Usually this is nil,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5555
     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
  5556
     a simple way to configure and create stand-alone applications"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5557
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5558
    ^ StartupSelector
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5559
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5560
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  5561
     Smalltalk startupSelector
9029
09b858d6135d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9028
diff changeset
  5562
    "
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5563
!
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
wasStartedFromImage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5566
    "return true, if this smalltalk was started from an image,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5567
     as opposed to a fresh and clean startup"
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
    ^ ImageRestartTime notNil
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5572
     Smalltalk wasStartedFromImage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5573
    "
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  5574
! !
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  5575
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  5576
!Smalltalk class methodsFor:'system environment'!
1069
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  5577
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5578
language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5579
    "return the language setting"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5580
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5581
    ^ Language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5582
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5583
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5584
     Smalltalk language
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5585
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5586
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5587
    "Modified: 26.4.1996 / 17:10:05 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5588
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5589
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5590
language:aLanguageSymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5591
    "set the language - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5592
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5593
    aLanguageSymbol size = 2 ifFalse:[ self halt:'bad language' ].
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5594
18733
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5595
    aLanguageSymbol ~= Language ifTrue:[
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5596
        Language := aLanguageSymbol asSymbol.
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5597
        self changed:#Language
18733
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5598
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5599
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5600
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5601
     Smalltalk language:#de
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5602
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5603
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5604
    "Modified: / 19-10-2006 / 23:17:29 / cg"
21928
b14c2d0608e0 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21782
diff changeset
  5605
    "Modified: / 29-06-2017 / 15:05:04 / stefan"
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5606
    "Modified: / 13-12-2019 / 13:18:24 / Stefan Reise"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5607
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5608
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5609
language:aLanguageSymbol territory:aTerritorySymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5610
    "set the language & territory - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5611
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5612
    aLanguageSymbol size = 2 ifFalse:[ self halt:'bad language' ].
18733
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5613
    ((Language ~= aLanguageSymbol) or:[ LanguageTerritory ~= aTerritorySymbol]) ifTrue:[
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5614
        Language := aLanguageSymbol asSymbol.
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5615
        LanguageTerritory := aTerritorySymbol asSymbol.
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5616
        self changed:#Language
18733
20fc1bb8fe15 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18732
diff changeset
  5617
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5618
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5619
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5620
     Smalltalk language:#de territory:#de
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5621
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5622
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5623
    "Created: / 19-10-2006 / 22:16:22 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5624
    "Modified: / 19-10-2006 / 23:17:36 / cg"
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5625
    "Modified: / 13-12-2019 / 13:18:32 / Stefan Reise"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5626
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5627
13212
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5628
languageAndTerritory
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5629
    "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
  5630
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5631
    ^ Language , '-' , (LanguageTerritory ? Language)
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5632
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5633
    "
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5634
     Smalltalk languageAndTerritory
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5635
    "
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5636
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5637
    "Created: / 16-01-2011 / 10:19:42 / cg"
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5638
!
e75edfda9b2e added: #languageAndTerritory
Claus Gittinger <cg@exept.de>
parents: 13135
diff changeset
  5639
20615
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5640
languageCodeset
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5641
    ^ LanguageCodeset
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5642
!
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5643
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5644
languageModifier
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5645
    ^ LanguageModifier
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5646
!
8fbfa364a4aa #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20603
diff changeset
  5647
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5648
languageTerritory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5649
    "return the language territory setting"
7563
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5650
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5651
    ^ LanguageTerritory
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5652
!
Claus Gittinger <cg@exept.de>
parents: 7561
diff changeset
  5653
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5654
languageTerritory:aTerritorySymbol
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5655
    "set the language territory - send out change notifications"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5656
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5657
    aTerritorySymbol size = 2 ifFalse:[ self halt:'bad language' ].
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  5658
    aTerritorySymbol ~= LanguageTerritory ifTrue:[
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5659
        LanguageTerritory := aTerritorySymbol asSymbol.
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5660
        self changed:#LanguageTerritory
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5661
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5662
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5663
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5664
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5665
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5666
     Smalltalk languageTerritory:#us.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5667
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5668
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5669
     Smalltalk languageTerritory:#de.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5670
     Time now
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5671
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5672
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5673
    "Modified: / 19-10-2006 / 23:17:40 / cg"
25104
9625a3c8851e #BUGFIX by Stefan Reise
sr
parents: 24884
diff changeset
  5674
    "Modified: / 13-12-2019 / 13:18:39 / Stefan Reise"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5675
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5676
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5677
setLanguage:aLanguageSymbol
25326
162966c92640 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25292
diff changeset
  5678
    "set the language - without change notification"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5679
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5680
    Language := aLanguageSymbol.
10991
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5681
!
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5682
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5683
setLanguage:aLanguageSymbol territory:aTerritorySymbol
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5684
    "set the language & territory - no change notification"
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5685
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5686
    Language := aLanguageSymbol asSymbol.
98fe8942f27e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10971
diff changeset
  5687
    LanguageTerritory := aTerritorySymbol asSymbol.
1069
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  5688
! !
72db6bd8ce0a category changes
Claus Gittinger <cg@exept.de>
parents: 1004
diff changeset
  5689
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  5690
!Smalltalk class methodsFor:'system management'!
70
73055652dd21 *** empty log message ***
claus
parents: 62
diff changeset
  5691
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5692
compressSources
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5693
    "{ Pragma: +optSpace }"
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
    "compress the sources file, and remove all method source strings
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5696
     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
  5697
     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
  5698
     since we use per-class sourcefiles for the compiled classes,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5699
     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
  5700
     incremental compiled methods.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5701
     Therefore, only those sources which are not coming from compiled
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5702
     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
  5703
     This is being automated - so don't care for now."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5704
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5705
    |newStream table source pos fileName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5706
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5707
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5708
     first, find all methods which contain either a string-ref
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5709
     or an external string in the 'st.src' file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5710
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5711
    newStream := 'src.tmp' asFilename writeStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5712
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5713
    table := IdentityDictionary new:100.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5714
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5715
    Method allSubInstancesDo:[:aMethod |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5716
	source := nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5717
	aMethod sourcePosition notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5718
	    aMethod sourceFilename = 'st.src' ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5719
		source := aMethod source.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5720
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5721
	] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5722
	    source := aMethod source
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5723
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5724
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5725
	source notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5726
	    pos := newStream position + 1.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5727
	    newStream nextChunkPut:source.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5728
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5729
	    "
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5730
	     dont change the methods info - maybe some write error
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5731
	     occurs later, in that case we abort and leave everything
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5732
	     untouched.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5733
	    "
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5734
	    table at:aMethod put:pos
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5735
	]
11655
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5736
    ].
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5737
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5738
    newStream syncData; close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5739
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5740
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5741
     now, rename the new source file,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5742
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5743
    fileName := (ObjectMemory nameForSources).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5744
    'src.tmp' asFilename renameTo:fileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5745
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5746
    "good - now go over all changed methods, and change their
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5747
     source reference"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5748
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5749
    table keysAndValuesDo:[:aMethod :pos |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5750
	aMethod localSourceFilename:fileName position:pos.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5751
"/        aMethod printCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5752
    ].
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
     Smalltalk compressSources
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5756
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5757
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5758
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5759
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5760
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5761
generateSingleSourceFile
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5762
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5763
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5764
    "generate the sources file, and remove all method source strings
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5765
     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
  5766
     This makes the image independent from the per-class source files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5767
     and makes transportation of endUser applications easier, since
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5768
     only 3 files (executable, image and sourceFile) need to be
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5769
     transported."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5770
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5771
    |newStream table source pos fileName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5772
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5773
    newStream := 'src.tmp' asFilename writeStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5774
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5775
    table := IdentityDictionary new:100.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5776
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5777
    Method allSubInstancesDo:[:aMethod |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5778
	source := aMethod source.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5779
	source notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5780
	    pos := newStream position + 1.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5781
	    newStream nextChunkPut:source.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5782
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5783
	    "
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5784
	     don't change the method's info - maybe some write error
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5785
	     occurs later, in that case we abort and leave everything
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5786
	     untouched.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5787
	    "
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5788
	    table at:aMethod put:pos
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5789
	]
11655
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5790
    ].
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5791
4306fb61b9f8 sync common source file before replacing the old copy
Stefan Vogel <sv@exept.de>
parents: 11624
diff changeset
  5792
    newStream syncData; close.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5793
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5794
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5795
     now, rename the new source file,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5796
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5797
    fileName := (ObjectMemory nameForSources).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5798
    'src.tmp' asFilename renameTo:fileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5799
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5800
    "good - now go over all changed methods, and change their
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5801
     source reference"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5802
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5803
    table keysAndValuesDo:[:aMethod :pos |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5804
	aMethod localSourceFilename:fileName position:pos.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5805
"/        aMethod printCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5806
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5807
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5808
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5809
     Smalltalk generateSingleSourceFile
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5810
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5811
22373
99d8da048a8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22314
diff changeset
  5812
    "Modified: / 16-01-1997 / 01:25:58 / cg"
99d8da048a8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22314
diff changeset
  5813
    "Created: / 17-10-1997 / 13:00:56 / cg"
99d8da048a8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22314
diff changeset
  5814
    "Modified (comment): / 21-11-2017 / 13:08:41 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5815
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5816
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5817
installAutoloadedClassFromSourceFile:aFilename
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5818
    "install aFilename (which must be a smalltalk source file) as autoloaded class
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5819
     (extract the class definition chunk from the file and create an autoloaded
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5820
      class stub for it)"
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5821
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5822
    |chunks filename|
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5823
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5824
    filename := aFilename asFilename.
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5825
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5826
    ChangeSet::InvalidChangeChunkError handle:[:ex |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5827
	^ self
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5828
    ] do:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5829
	filename readingFileDo:[:s|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5830
	    chunks := ChangeSet fromStream:s while:[:chunk | chunk isMethodChange not].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5831
	].
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5832
    ].
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5833
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  5834
    chunks
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5835
	select:[:eachChunk | eachChunk isClassDefinitionChange]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5836
	thenDo:[:eachClassChunk |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5837
		eachClassChunk installAsAutoloadedClassIfPublicWithFilename:filename asAbsoluteFilename "withoutSuffix" name "baseName"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5838
	].
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5839
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5840
    "Created: / 01-08-2013 / 16:57:26 / cg"
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5841
!
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  5842
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5843
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5844
    "create & install an autoload stub for a class named: clsName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5845
     to be loaded from package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5846
     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
  5847
     (otherwise, the newest revision will be loaded"
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
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5850
	installAutoloadedClassNamed:clsName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5851
	category:cat
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5852
	package:package
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5853
	revision:revisionOrNil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5854
	numClassInstVars:nil.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5855
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  5856
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5857
installAutoloadedClassNamed:clsName category:cat package:package revision:revisionOrNil numClassInstVars:numClassInstVarsOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5858
    "create & install an autoload stub for a class named: clsName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5859
     to be loaded from package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5860
     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
  5861
     (otherwise, the newest revision will be loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5862
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5863
    |clsSym cls|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5864
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5865
    clsSym := clsName asSymbol.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5866
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5867
    "/ install if not already compiled-in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5868
    (cls := self at:clsSym) isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5869
	Autoload subclass:clsSym
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5870
	    instanceVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5871
	    classVariableNames:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5872
	    poolDictionaries:''
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5873
	    category:cat
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5874
	    inEnvironment:Smalltalk.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5875
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5876
	cls := self at:clsSym.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5877
	cls isNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5878
	    ('Smalltalk [warning]: failed to install ' , clsName , ' as autoloaded.') infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5879
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5880
	    cls package:package asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5881
	    revisionOrNil notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5882
		cls setBinaryRevision:revisionOrNil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5883
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5884
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5885
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5886
	"/ class already present - however, if unloaded, check for category/package change
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5887
	cls isLoaded ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5888
	    package ~= cls package ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5889
		cls withoutUpdatingChangesDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5890
		    cls package:package asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5891
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5892
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5893
	    cat ~= cls category ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5894
		cls withoutUpdatingChangesDo:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5895
		    cls category:cat.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5896
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5897
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5898
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5899
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5900
    ^ cls.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5901
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5902
    "Created: / 05-11-1998 / 15:10:25 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5903
    "Modified: / 16-01-2007 / 12:56:18 / cg"
11169
32fda240ee57 #installAutoloadedClassNamed:category:package:revision:numClassInstVars:
Stefan Vogel <sv@exept.de>
parents: 11153
diff changeset
  5904
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5905
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5906
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5907
installAutoloadedClasses
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5908
    "scan all packages and install all classes found there as
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5909
     autoloaded. This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5910
11679
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5911
    |dirsConsulted|
69e588cca61f Do not use relative pathnames when searching for packages, etc.
Stefan Vogel <sv@exept.de>
parents: 11670
diff changeset
  5912
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  5913
    LoadInProgressQuery answerNotifyLoadingDo:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5914
	dirsConsulted := Set new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5915
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5916
	"/ along the package-path
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5917
	self packagePath do:[:eachPathComponent |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5918
	    (dirsConsulted includes:eachPathComponent) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5919
		self
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5920
		    recursiveInstallAutoloadedClassesFrom:eachPathComponent
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5921
		    rememberIn:dirsConsulted
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5922
		    maxLevels:15
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5923
		    noAutoload:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5924
		    packageTop:eachPathComponent
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5925
		    showSplashInLevels:2.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5926
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5927
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  5928
	self splashInfo:nil.
17548
e7eab3f01aba class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17534
diff changeset
  5929
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5930
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5931
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5932
     Smalltalk installAutoloadedClasses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5933
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5934
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5935
    "Created: / 14.2.1997 / 17:32:57 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5936
    "Modified: / 13.12.1999 / 11:56:50 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5937
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5938
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5939
installAutoloadedClassesFrom:anAbbrevFilePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5940
    "read the given abbreviation file; install all classes found there as
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5941
     autoloaded. This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5942
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5943
    |f s|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5944
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5945
    f := self getSystemFileName:anAbbrevFilePath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5946
    f isNil ifTrue:[f := self getPackageFileName:anAbbrevFilePath].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5947
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5948
    f notNil ifTrue:[
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5949
        f := f asFilename.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5950
        f isDirectory ifTrue:[
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5951
            f := f construct:'abbrev.stc'
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5952
        ].
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5953
        [
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5954
            s := f readStream.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5955
            self installAutoloadedClassesFromStream:s.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5956
            s close.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5957
        ] on:OpenError
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  5958
        do:[:ex| "do nothing"].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5959
    ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5960
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5961
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5962
     Smalltalk installAutoloadedClassesFrom:'include/abbrev.stc'
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5963
     Smalltalk installAutoloadedClassesFrom:'../../goodies/communication/abbrev.stc'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5964
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5965
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5966
    "Modified: / 5.11.1998 / 15:10:51 / cg"
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
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5969
installAutoloadedClassesFromAbbrevFile:aFilename
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5970
    aFilename readingFileDo:[:abbrevStream |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5971
	self installAutoloadedClassesFromStream:abbrevStream.
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5972
    ]
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5973
19911
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5974
    "
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5975
     self installAutoloadedClassesFromAbbrevFile:('../../goodies/communication/abbrev.stc' asFilename)
0b24a97a0bb7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19907
diff changeset
  5976
    "
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  5977
13531
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5978
    "Created: / 29-07-2011 / 20:39:21 / cg"
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5979
!
6ab20c7e1dec added: #installAutoloadedClassesFromAbbrevFile:
Claus Gittinger <cg@exept.de>
parents: 13529
diff changeset
  5980
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5981
installAutoloadedClassesFromStream:anAbbrevFileStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5982
    "read the given abbreviation file;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5983
     install all classes found there as autoloaded, and also update the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5984
     abbreviation (className-to-fileName mapping) table.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5985
     This takes some time ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5986
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5987
    |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
  5988
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5989
    anAbbrevFileStream isFileStream ifTrue:[
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  5990
        abbrevFileName := anAbbrevFileStream pathName.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  5991
        info := 'declared from: ', abbrevFileName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5992
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5993
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5994
    "/ yes, create any required nameSpace, without asking user.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5995
    Class createNameSpaceQuerySignal answer:true do:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  5996
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  5997
        [anAbbrevFileStream atEnd] whileFalse:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  5998
            l := anAbbrevFileStream nextLine withoutSeparators.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  5999
            "Skip empty lines and comments"
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6000
            (l notEmpty and:[l first ~= $#]) ifTrue:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6001
                "/ must do it manually, caring for quoted strings.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6002
"/                words := line asCollectionOfWords.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6003
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6004
                words := OrderedCollection new.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6005
                s2 := l readStream.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6006
                [s2 atEnd] whileFalse:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6007
                    s2 skipSeparators == $' ifTrue:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6008
                        s2 next.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6009
                        w := s2 upTo:$'.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6010
                        s2 skipSeparators.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6011
                    ] ifFalse:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6012
                        w := s2 upToSeparator
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6013
                    ].
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6014
                    words add:w
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6015
                ].
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6016
                words size < 3 ifTrue:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6017
                    'Smalltalk [warning]: bad abbrev entry' errorPrint.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6018
                    anAbbrevFileStream isFileStream ifTrue:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6019
                        ' (in ''' errorPrint.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6020
                        anAbbrevFileStream pathName errorPrint.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6021
                        ''')' errorPrint
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6022
                    ].
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6023
                    ': ' errorPrint. l errorPrintCR
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6024
                ] ifFalse:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6025
                    clsName := (words at:1) asSymbol.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6026
                    abbrev := (words at:2).
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6027
                    package := (words at:3) asSymbol.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6028
                    cat := words at:4 ifAbsent:nil.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6029
                    numClassInstVars := words at:5 ifAbsent:'0'.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6030
                    numClassInstVars := Integer readFrom:numClassInstVars onError:[0].
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6031
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6032
                    (cat size == 0) ifTrue:[
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6033
                        cat := 'autoloaded'
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6034
                    ].
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6035
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6036
                    "/ on the fly, update the abbreviations
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6037
                    self setFilename:abbrev forClass:clsName package:package.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6038
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6039
                    "/ '  autoloaded: ' print. clsName print. ' in ' print. cat printCR.
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6040
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6041
                    cls := self
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6042
                        installAutoloadedClassNamed:clsName
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6043
                        category:cat
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6044
                        package:package
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6045
                        revision:nil
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6046
                        numClassInstVars:numClassInstVars.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6047
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6048
"/                    info notNil ifTrue:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6049
"/                        cls setComment:info.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6050
"/                    ].
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6051
                ]
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6052
            ]
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6053
        ]
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  6054
    ]
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6055
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  6056
    "Modified: / 28-09-2019 / 15:22:03 / Stefan Vogel"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6057
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6058
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6059
loadBinaries
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6060
    "return true, if binaries should be loaded into the system,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6061
     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
  6062
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6063
    ^ LoadBinaries
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6064
!
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6065
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6066
loadBinaries:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6067
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6068
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6069
    "turn on/off loading of binary objects"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6070
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6071
    aBoolean ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6072
	(ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6073
	    LoadBinaries := true.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6074
	    ^ self
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6075
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6076
	'Smalltalk [info]: this system does not support binary loading' infoPrintCR.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6077
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6078
    LoadBinaries := false
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
    "Modified: 10.1.1997 / 15:11:00 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6081
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6082
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6083
logDoits
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6084
    "return true if doits should go into the changes file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6085
     as well as changes - by default, this is off, since
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6086
     it can blow up the changes file enormously ...
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6089
    ^ LogDoits
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6090
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6091
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6092
     LogDoits := false
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6093
     LogDoits := true
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6094
    "
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6095
!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  6096
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6097
logDoits:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6098
    "{ Pragma: +optSpace }"
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
    "turn on/off logging of doits in the changes file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6101
     By default, this is off, since it can blow up the
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6102
     changes file enormously ...
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6103
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6104
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6105
    LogDoits := aBoolean
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6106
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6107
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6108
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6109
makeBytecodeMethods
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6110
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6111
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6112
    "walk over all methods and make each a bytecode method
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6113
     iff it does not contain primitive C code.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6114
     Experimental and not yet used."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6115
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6116
    Method allSubInstancesDo:[:aMethod |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6117
	|newMethod|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6118
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6119
	aMethod hasPrimitiveCode ifFalse:[
18707
05a44da3c940 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 18669
diff changeset
  6120
"/            aMethod errorPrintCR.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6121
	    newMethod := aMethod asByteCodeMethod.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6122
	    newMethod ~~ aMethod ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6123
		newMethod isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6124
		    'Smalltalk>>makeBytecodeMethods could nor recompile: ' errorPrint. aMethod errorPrintCR.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6125
		] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6126
		    aMethod becomeSameAs:newMethod
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6127
		].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6128
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6129
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6130
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6131
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6132
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6133
     Smalltalk makeBytecodeMethods
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6134
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6135
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6136
    "Modified: 16.1.1997 / 01:25:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6137
    "Created: 17.10.1997 / 13:52:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6138
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6139
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6140
recursiveInstallAutoloadedClassesFrom:aTopDirectory
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6141
    "scan all packages and install all classes found there as
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6142
     autoloaded. This takes some time ..."
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6143
23408
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6144
    self recursiveInstallAutoloadedClassesFrom:aTopDirectory maxLevels:15
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6145
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6146
    "
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6147
     Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler'
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6148
    "
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6149
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6150
    "Created: / 31-07-2012 / 15:27:40 / cg"
23408
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6151
    "Modified: / 09-10-2018 / 11:10:25 / Claus Gittinger"
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6152
!
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6153
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6154
recursiveInstallAutoloadedClassesFrom:aTopDirectory maxLevels:maxLevels
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6155
    "scan all packages and install all classes found there as
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6156
     autoloaded. This takes some time ..."
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6157
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6158
    |dirsConsulted|
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6159
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6160
    dirsConsulted := Set new.
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6161
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6162
    self
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6163
        recursiveInstallAutoloadedClassesFrom:aTopDirectory
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6164
        rememberIn:dirsConsulted
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6165
        maxLevels:maxLevels
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6166
        noAutoload:false
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6167
        packageTop:nil
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6168
        showSplashInLevels:-1.
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6169
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6170
    "
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6171
     Smalltalk recursiveInstallAutoloadedClassesFrom:'..\..\..\cg\private\euler'
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6172
    "
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6173
559e80ba680d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23177
diff changeset
  6174
    "Created: / 09-10-2018 / 11:10:06 / Claus Gittinger"
14269
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6175
!
b540d11186f4 added: #recursiveInstallAutoloadedClassesFrom:
Claus Gittinger <cg@exept.de>
parents: 14210
diff changeset
  6176
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6177
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6178
    "read all abbrev.stc files from and under aDirectory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6179
     and install autoloaded classes.
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6180
     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
  6181
     but classes in subdirectories are installed, if the subdirectory contains a file
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6182
     named AUTOLOAD.
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6183
     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
  6184
     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
  6185
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6186
    self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6187
	recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6188
	maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6189
	showSplashInLevels:0.
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6190
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6191
    "
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6192
     Smalltalk installAutoloadedClasses
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6193
    "
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6194
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6195
    "Modified: / 17-08-2006 / 16:48:43 / cg"
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6196
!
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6197
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  6198
recursiveInstallAutoloadedClassesFrom:aDirectory rememberIn:dirsConsulted
11391
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6199
maxLevels:maxLevels noAutoload:noAutoloadIn packageTop:packageTopPath
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6200
showSplashInLevels:showSplashInLevels
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6201
    "read all abbrev.stc files from and under aDirectory
529c3e286e9c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11389
diff changeset
  6202
     and install autoloaded classes.
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6203
     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
  6204
     but classes in subdirectories are installed, if the subdirectory contains a file
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6205
     named AUTOLOAD.
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6206
     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
  6207
     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
  6208
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6209
    |dir noAutoloadHere dirName directoryContents haveAbbrevDotSTC|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6210
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6211
    dir := aDirectory asFilename.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6212
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6213
    "/ Care for non-existent directories"
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6214
    dir exists ifFalse:[ ^ self ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  6215
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6216
    dirName := dir physicalPathName.            "take care of symbolic links"
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6217
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6218
    (dirsConsulted includes:dirName) ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6219
        ^ self
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
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  6222
    (dir / 'NOPACKAGES') exists ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6223
        ^ self.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6224
    ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  6225
    (dir / 'NOSUBAUTOLOAD') exists ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6226
        ^ self.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6227
    ].
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6228
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6229
    maxLevels == 0 ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6230
        Transcript showCR:'Autoload: max directory nesting reached in %1' with:dir pathName.
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6231
        ^ self
15783
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6232
    ].
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6233
647ea33569b6 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15781
diff changeset
  6234
    dirsConsulted add:dirName.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6235
    noAutoloadHere := noAutoloadIn.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6236
    noAutoloadHere ifFalse:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6237
        (dir / 'NOAUTOLOAD') exists ifTrue:[
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6238
            noAutoloadHere := true.
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6239
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6240
    ] ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6241
        (dir / 'AUTOLOAD') exists ifTrue:[
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6242
            noAutoloadHere := false.
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6243
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6244
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6245
11393
5964970e515c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11392
diff changeset
  6246
    showSplashInLevels >= 0 ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6247
        self showSplashMessage:('Smalltalk [info]: installing autoloaded classes found under "%1"...'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6248
                                bindWith:(dirName contractAtBeginningTo:35)).
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6249
    ].
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6250
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6251
    "/
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6252
    "/ suppress installation as autoloaded in this and everything
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6253
    "/ below; however, still traverse the directories to find packages ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6254
    "/
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  6255
    haveAbbrevDotSTC := false.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6256
    noAutoloadHere ifFalse:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6257
        [
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6258
            self installAutoloadedClassesFromAbbrevFile:(dir / 'abbrev.stc').
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6259
            haveAbbrevDotSTC := true.
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  6260
        ] on:OpenError do:[:ex|
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6261
            "ignore this file"
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6262
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6263
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6264
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6265
    [
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6266
        directoryContents := dir directoryContents.
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  6267
    ] on:OpenError do:[:ex|
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6268
        "non-accessible directory: we are done"
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6269
        ^ self
16199
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  6270
    ].
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  6271
86aeff99ebb4 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16180
diff changeset
  6272
    directoryContents := directoryContents select:[:fn | (fn startsWith:'.') not] as:Set.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6273
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6274
    directoryContents removeAllFoundIn:#(
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6275
                            'objbc' 'objvc' 'objmingw'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6276
                            'doc'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6277
                            'CVS'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6278
                            'bitmaps'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6279
                            'resources'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6280
                            'source'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6281
                            'not_delivered'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6282
                            'not_ported'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6283
                        ).
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6284
    dir baseName = 'stx' ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6285
        directoryContents removeAllFoundIn:#(
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6286
                            'configurations'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6287
                            'include'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6288
                            'rules'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6289
                            'stc'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6290
                            'support'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6291
                        ).
12911
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6292
    ].
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6293
0822e257daeb comment/format in: #installAutoloadedClasses
Stefan Vogel <sv@exept.de>
parents: 12883
diff changeset
  6294
    directoryContents do:[:eachFilenameString |
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6295
        |f|
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6296
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6297
        f := dir / eachFilenameString.
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6298
        f isDirectory ifTrue:[
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6299
             self
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6300
                recursiveInstallAutoloadedClassesFrom:f
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6301
                rememberIn:dirsConsulted
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6302
                maxLevels:maxLevels-1
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6303
                noAutoload:noAutoloadHere
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6304
                packageTop:packageTopPath
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6305
                showSplashInLevels:showSplashInLevels - 1.
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6306
        ] ifFalse:[
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6307
            (noAutoloadHere not and:[haveAbbrevDotSTC not]) ifTrue:[
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6308
                f suffix = 'st' ifTrue:[
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6309
                    [
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6310
                        self installAutoloadedClassFromSourceFile:f.
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6311
                        f directory baseName = 'libbasic' ifTrue:[self halt].
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  6312
                    ] on:OpenError do:[:ex|
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6313
                        "ignore this file, but write a warning"
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6314
                        Transcript showCR:('Autoload: cannot install %1. (%2)' bindWith:f pathName with:ex description).
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6315
                    ].
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6316
                ]
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6317
            ].
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6318
        ]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6319
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6320
11393
5964970e515c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11392
diff changeset
  6321
    showSplashInLevels >= 0 ifTrue:[
24417
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6322
        self showSplashMessage:('Smalltalk [info]: installing autoloaded classes from "%1"...'
03b083548da2 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24414
diff changeset
  6323
                                bindWith:(dirName contractAtBeginningTo:35)).
11392
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6324
    ].
8c606db1cd2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11391
diff changeset
  6325
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6326
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6327
     Smalltalk installAutoloadedClasses
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6328
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6329
15596
6e05c159e789 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15594
diff changeset
  6330
    "Modified: / 01-08-2013 / 16:57:49 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6331
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6332
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6333
replaceReferencesTo:anObject with:newRef
12194
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  6334
    "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
  6335
     Return true, if any reference was changed.
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  6336
     Notice: this does not change the class-reference."
208afdcf182b comment/format in: #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 12172
diff changeset
  6337
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6338
    |toAdd|
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
    toAdd := OrderedCollection new.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6341
    self keysAndValuesDo:[:key :val |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6342
	(key == anObject) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6343
	    self shouldImplement.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6344
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6345
	(val == anObject ) ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6346
	    toAdd add:(key -> newRef)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6347
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6348
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6349
    toAdd do:[:each |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6350
	self at:(each key) put:(each value)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6351
    ].
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
saveEmergencyImage:aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6355
    "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
  6356
     emergency image in case of a broken display connection.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6357
     The default is true.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6358
     This may be useful, if you work with an unsecure display
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6359
     (serial line), and want to have a chance of proceeding after
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6360
     a crash. In multiheaded applications, this only affects
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6361
     crashes of the master Display connection (the initial connection);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6362
     errors on other displays are reported to the views and treated
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6363
     like window destroy from the windowManager."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6364
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6365
    SaveEmergencyImage := aBoolean
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6366
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6367
    "Modified: / 24.10.1997 / 18:22:26 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6368
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6369
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6370
systemOrganization
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6371
    "for partial ST80 compatibility;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6372
     In ST80, Smalltalk organization returns a systemOrganizer, which
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6373
     keeps track of class-categories, while all classes return a classOrganizer
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6374
     from #organization, which keeps track of method categories of that class.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6375
     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
  6376
     To make a workaround possible, use #systemOrganization when porting
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6377
     VW apps to ST/X to get the class-categories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6378
     Read the documentation in SystemOrganizer for more info."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6379
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6380
    ^ SystemOrganizer for:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6381
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6382
    "Created: / 20.6.1998 / 12:24:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6383
    "Modified: / 20.6.1998 / 12:41:34 / cg"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6384
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6385
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6386
!Smalltalk class methodsFor:'system management-fileIn'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6387
23419
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6388
fileIn:aFileNameOrString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6389
    "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
  6390
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6391
     This method can load almost anything which makes sense:
23419
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6392
        .st    - source files
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6393
        .cls   - binary smalltalk bytecode files
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6394
        .so    - binary compiled machine code class libraries
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6395
        [.class - java bytecode -- soon to come]"
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6396
90b6b18e27de #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23414
diff changeset
  6397
    ^ self fileIn:aFileNameOrString lazy:nil silent:nil logged:false
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6398
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6399
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6400
     Smalltalk fileIn:'source/TicTacToe.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6401
     Smalltalk fileIn:'binary/TicTacToe.cls'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6402
     Smalltalk fileIn:'binary/TicTacToe.so'
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  6403
     Smalltalk fileIn:'foo.st'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6404
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6405
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6406
    "Created: 28.10.1995 / 17:06:28 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6407
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6408
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6409
fileIn:aFileName inPackage:aPackageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6410
    "read in the named file in a packages directory."
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
    |dir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6413
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6414
    dir := self getPackageDirectoryForPackage:aPackageID.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6415
    dir isNil ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6416
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6417
    dir := dir asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6418
    ^ (self fileIn:(dir construct:aFileName))
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6419
      or:[ self fileIn:((dir construct:'source') construct:aFileName) ]
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6420
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6421
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6422
fileIn:aFileName lazy:lazy
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6423
    "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
  6424
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6425
     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
  6426
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6427
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6428
     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
  6429
     code which is known to be syntactically correct."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6430
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6431
    ^ self fileIn:aFileName lazy:lazy silent:nil logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6432
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6433
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6434
     Smalltalk fileIn:'source/TicTacToe.st' lazy:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6435
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6436
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6437
    "Created: 28.10.1995 / 17:06:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6438
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6439
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6440
fileIn:aFileName lazy:lazy silent:silent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6441
    "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
  6442
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6443
     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
  6444
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6445
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6446
     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
  6447
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6448
     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
  6449
     Giving nil for silent/lazy will use the current settings."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6450
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6451
    ^ self fileIn:aFileName lazy:lazy silent:silent logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6452
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6453
    "Created: 28.10.1995 / 17:06:41 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6454
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6455
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6456
fileIn:aFileNameOrString lazy:lazy silent:silent logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6457
    "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
  6458
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6459
     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
  6460
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6461
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6462
     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
  6463
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6464
     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
  6465
     Giving nil for silent/lazy will use the current settings.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6466
     This method can load almost anything which makes sense:
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6467
	.st    - source files
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6468
	.cls   - binary smalltalk bytecode files
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6469
	.so    - binary compiled machine code class libraries
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6470
	[.class - java bytecode -- soon to come]"
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6471
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  6472
    |fileNameString inStream path morePath bos|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6473
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6474
    fileNameString := aFileNameOrString asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6475
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6476
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6477
     an object or shared object ?
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6478
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6479
    (ObjectFileLoader notNil
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  6480
     and:[ObjectFileLoader hasValidBinaryExtension:fileNameString]) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6481
	"/ LoadBinaries ifFalse:[^ false].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6482
	path := self getBinaryFileName:fileNameString.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6483
	path isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6484
	    path := self getSystemFileName:fileNameString.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6485
	    path isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6486
		^ false
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6487
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6488
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6489
	^ (ObjectFileLoader loadObjectFile:path) notNil
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6490
    ].
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6491
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6492
    inStream := self systemFileStreamFor:fileNameString.
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6493
    inStream isNil ifTrue:[^ false].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6494
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  6495
    (aFileNameOrString asFilename hasSuffix:'cls') ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6496
	BinaryObjectStorage isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6497
	    ^ false.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6498
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6499
	[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6500
	    inStream binary.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6501
	    bos := BinaryObjectStorage onOld:inStream.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6502
	    bos next.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6503
	] ensure:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6504
	    bos close.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6505
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6506
	^ true
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6507
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6508
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6509
    (fileNameString includes:$/) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6510
	"/ temporarily prepend the file's directory
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6511
	"/ to the searchPath.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6512
	"/ This allows fileIn-driver files to refer to local
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6513
	"/ files via a relative path, and drivers to fileIn other
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6514
	"/ drivers ...
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6515
	morePath := inStream fileName directoryName.
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6516
    ].
15665
eb289b107887 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15616
diff changeset
  6517
    ^ self fileInStream:inStream lazy:lazy silent:silent logged:logged addPath:morePath
15594
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6518
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6519
    "
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6520
     Smalltalk fileIn:'clients/TicTacToe/TicTacToe.st' lazy:true silent:true
0bddb6eb353b class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15565
diff changeset
  6521
     Smalltalk fileIn:'keyboard.rc'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6522
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6523
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6524
    "Modified: / 08-09-2006 / 19:21:16 / cg"
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  6525
    "Modified: / 23-04-2018 / 17:05:33 / stefan"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6526
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6527
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6528
fileIn:aFileName logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6529
    "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
  6530
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6531
     The argument logged controls, if the changefile is to be updated."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6532
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6533
    ^ self fileIn:aFileName lazy:nil silent:nil logged:logged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6534
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6535
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6536
     Smalltalk fileIn:'source/TicTacToe.st' logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6537
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6538
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6539
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6540
fileIn:aFileName silent:silent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6541
    "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
  6542
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6543
     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
  6544
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6545
    ^ self fileIn:aFileName lazy:nil silent:silent logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6546
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6547
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6548
     Smalltalk fileIn:'source/TicTacToe.st' silent:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6549
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6550
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6551
    "Created: 28.10.1995 / 17:06:36 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6552
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6553
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6554
fileInChanges
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6555
    "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
  6556
     had when left the last time.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6557
     WARNING: this method is rubbish: it should only read things after the
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6558
	      last '**snapshot**' - entry
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6559
	      (instead of the complete changes file)."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6560
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6561
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6562
     do NOT update the changes file now ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6563
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6564
    self fileIn:ChangeFileName logged:false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6565
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6566
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  6567
     Smalltalk fileInChanges
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6568
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  6569
!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  6570
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6571
fileInClass:aClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6572
    "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
  6573
     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
  6574
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6575
     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
  6576
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6577
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6578
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6579
	package:nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6580
	initialize:true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6581
	lazy:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6582
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6583
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6584
    "Modified: / 9.1.1998 / 14:41:46 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6585
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6586
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6587
fileInClass:aClassName fromObject:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6588
    "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
  6589
     - look for it in some standard places.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6590
     Only install the named class from this object file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6591
     Return true if ok, false if failed."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6592
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6593
    |path ok|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6594
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6595
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6596
     check if the dynamic loader class is in
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6597
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6598
    (LoadBinaries not or:[ObjectFileLoader isNil]) ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6599
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6600
    (path := self getBinaryFileName:aFileName) isNil ifTrue:[^ false].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6601
    ok := (ObjectFileLoader loadClass:aClassName fromObjectFile:path) notNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6602
    ok ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6603
	VerboseLoading ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6604
	    Transcript show:'  loaded ' , aClassName , ' from ' ; showCR:aFileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6605
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6606
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6607
    ^ ok
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6608
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6609
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6610
     Smalltalk fileInClass:'AbstractPath' fromObject:'../../goodies/Paths/AbstrPath.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6611
     Smalltalk fileInClass:'ClockView' fromObject:'../../libwidg3/libwidg3.so'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6612
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6613
13814
3d547c0d4634 changed:5 methods
Claus Gittinger <cg@exept.de>
parents: 13787
diff changeset
  6614
    "Modified: / 04-11-2011 / 13:42:24 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6615
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6616
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6617
fileInClass:aClassName initialize:doInit
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6618
    "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
  6619
     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
  6620
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6621
     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
  6622
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6623
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6624
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6625
	package:nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6626
	initialize:doInit
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6627
	lazy:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6628
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6629
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6630
    "Modified: / 9.1.1998 / 14:42:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6631
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6632
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6633
fileInClass:aClassName initialize:doInit lazy:loadLazy
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6634
    "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
  6635
     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
  6636
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6637
     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
  6638
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6639
     ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6640
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6641
	package:nil
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6642
	initialize:doInit
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6643
	lazy:loadLazy
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6644
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6645
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6646
    "Modified: / 9.1.1998 / 14:42:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6647
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6648
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6649
fileInClass:aClassName initialize:doInit lazy:loadLazy silent:beSilent
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6650
    "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
  6651
     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
  6652
     finally source file (.st), in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6653
     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
  6654
     The argument doInit controlls if the class should be sent a #initialize after the
19867
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6655
     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
  6656
     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
  6657
     nil uses the value from SilentLoading."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6658
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6659
    ^ self
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6660
	fileInClass:aClassName
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6661
	package:nil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6662
	initialize:doInit
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6663
	lazy:loadLazy
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  6664
	silent:beSilent
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6665
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6666
    "Modified: / 9.1.1998 / 14:42:28 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6667
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6668
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6669
fileInClass:aClassName package:package
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6670
    "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
  6671
     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
  6672
     finally source file (.st) in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6673
     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
  6674
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6675
    ^ self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6676
	fileInClass:aClassName
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6677
	package:package
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6678
	initialize:true
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6679
	lazy:false
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  6680
	silent:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6681
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6682
    "Created: / 08-01-2007 / 10:06:09 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6683
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6684
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  6685
fileInClass:aClassName package:package initialize:doInit lazy:loadLazy silent:beSilent
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6686
    "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
  6687
     This is the workhorse for autoloading.
10999
e5cfd06920ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10998
diff changeset
  6688
     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
  6689
     finally source file (.st), in that order.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6690
     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
  6691
     The argument doInit controlls if the class should be sent a #initialize after the
19867
4671f92c1f8c #OTHER by mawalch
mawalch
parents: 19856
diff changeset
  6692
     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
  6693
     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
  6694
     nil uses the value from SilentLoading."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6695
22955
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6696
    |classFileName alternativeClassFileName libName newClass ok wasLazy wasSilent sharedLibSuffix inStream mgr
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6697
     filenameToSet packageDir packageFile bos|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  6698
17588
05b944f08b13 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17582
diff changeset
  6699
    ClassLoadInProgressQuery answerNotifyLoading:aClassName do:[
17582
4d4475b60428 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 17576
diff changeset
  6700
22955
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6701
        wasLazy := Compiler compileLazy:loadLazy.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6702
        beSilent notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6703
            wasSilent := self silentLoading:beSilent.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6704
        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6705
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6706
        classFileName := Smalltalk fileNameForClass:aClassName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6707
        (classFileName = aClassName) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6708
            "/ no abbrev.stc translation for className
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6709
            (aClassName includes:$:) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6710
                "/ a nameSpace name
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6711
                alternativeClassFileName := classFileName copyFrom:(classFileName lastIndexOf:$:)+1
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6712
            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6713
        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6714
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6715
        classFileName asFilename isAbsolute ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6716
            classFileName asFilename suffix notEmptyOrNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6717
                ok := self fileIn:classFileName lazy:loadLazy silent:beSilent.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6718
            ] ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6719
                ok := self fileInSourceFile:classFileName lazy:loadLazy silent:beSilent.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6720
            ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6721
        ] ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6722
            classFileName := classFileName copyReplaceAll:$: with:$_ ifNone:classFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6723
            [
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6724
                Class withoutUpdatingChangesDo:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6725
                    |zarFn zar entry|
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6726
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6727
                    ok := false.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6728
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6729
                    package notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6730
                        packageDir := package asPackageId packageDirectory.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6731
                        "/ packageDir := package asString.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6732
                        "/ packageDir := packageDir copyReplaceAll:$: with:$/.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6733
                        packageDir isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6734
                            packageDir := self packageDirectoryForPackageId:package
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6735
                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6736
                        packageDir notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6737
                            packageDir := packageDir asFilename.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6738
                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6739
                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6740
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6741
                    Class packageQuerySignal answer:package do:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6742
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6743
                         then, if dynamic linking is available,
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6744
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6745
                        (LoadBinaries and:[ObjectFileLoader notNil]) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6746
                            sharedLibSuffix := ObjectFileLoader sharedLibrarySuffix.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6747
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6748
                             first look for a class packages shared binary in binary/xxx.o
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6749
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6750
                            libName := self libraryFileNameOfClass:aClassName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6751
                            libName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6752
                                (ok := self fileInClass:aClassName fromObject:(libName asFilename withSuffix:sharedLibSuffix) name)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6753
                                ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6754
                                    sharedLibSuffix ~= 'o' ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6755
                                        ok := self fileInClass:aClassName fromObject:(libName, '.o')
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6756
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6757
                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6758
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6759
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6760
                             then, look for a shared binary in binary/xxx.o
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6761
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6762
                            ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6763
                                (ok := self fileInClass:aClassName fromObject:(classFileName asFilename withSuffix:sharedLibSuffix) name)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6764
                                ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6765
                                    sharedLibSuffix ~= 'o' ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6766
                                        ok := self fileInClass:aClassName fromObject:(classFileName, '.o')
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6767
                                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6768
                                    ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6769
                                        alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6770
                                            (ok := self fileInClass:aClassName fromObject:(alternativeClassFileName asFilename withSuffix:sharedLibSuffix) name)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6771
                                            ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6772
                                                sharedLibSuffix ~= 'o' ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6773
                                                    ok := self fileInClass:aClassName fromObject:(alternativeClassFileName, '.o')
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6774
                                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6775
                                            ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6776
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6777
                                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6778
                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6779
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6780
                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6781
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6782
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6783
                         if that did not work, look for a compiled-bytecode file ...
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6784
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6785
                        ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6786
                            (ok := self fileIn:(classFileName , '.cls') lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6787
                            ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6788
                                alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6789
                                    ok := self fileIn:(alternativeClassFileName , '.cls') lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6790
                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6791
                            ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6792
                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6793
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6794
                         if that did not work, and the classes package is known,
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6795
                         look for an st-cls file
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6796
                         in a package subdir of the source-directory ...
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6797
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6798
                        ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6799
                            (packageDir notNil and:[BinaryObjectStorage notNil]) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6800
                                packageFile := self getPackageFileName:((packageDir / 'classes' / classFileName) addSuffix:'cls').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6801
                                packageFile isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6802
                                    packageFile := (packageDir / 'classes' / classFileName) addSuffix:'cls'.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6803
                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6804
                                (ok := self fileIn:packageFile lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6805
                                ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6806
                                    alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6807
                                        packageFile := self getPackageFileName:((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6808
                                        packageFile isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6809
                                            packageFile := ((packageDir / 'classes' / alternativeClassFileName) addSuffix:'cls').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6810
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6811
                                        ok := self fileIn:packageFile lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6812
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6813
                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6814
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6815
                                zarFn := self getPackageFileName:(packageDir / 'classes.zip').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6816
                                zarFn notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6817
                                    zar := ZipArchive oldFileNamed:zarFn.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6818
                                    zar notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6819
                                        entry := zar extract:(classFileName , '.cls').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6820
                                        (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6821
                                            entry := zar extract:(alternativeClassFileName , '.cls').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6822
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6823
                                        entry notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6824
                                            bos := BinaryObjectStorage onOld:(entry asByteArray readStream).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6825
                                            bos next.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6826
                                            bos close.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6827
                                            ok := true
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6828
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6829
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6830
                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6831
                            ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6832
                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6833
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6834
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6835
                         if that did not work, look for an st-source file ...
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6836
                        "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6837
                        ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6838
                            filenameToSet := classFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6839
                            (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6840
                            ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6841
                                alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6842
                                    filenameToSet := alternativeClassFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6843
                                    ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6844
                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6845
                                ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6846
                                    "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6847
                                     ... and in the standard source-directory
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6848
                                    "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6849
                                    filenameToSet := 'source' asFilename / classFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6850
                                    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6851
                                    ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6852
                                        alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6853
                                            filenameToSet := 'source' asFilename / alternativeClassFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6854
                                            ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6855
                                        ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6856
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6857
                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6858
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6859
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6860
                             if that did not work, and the classes package is known,
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6861
                             look for an st-source file
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6862
                             in a package subdir of the source-directory ...
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6863
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6864
                            ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6865
                                packageDir notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6866
                                    packageFile := self getPackageSourceFileName:(packageDir / 'source' / classFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6867
                                    packageFile isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6868
                                        packageFile := (packageDir / 'source' / classFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6869
                                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6870
                                    filenameToSet := packageFile.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6871
                                    (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6872
                                    ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6873
                                        alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6874
                                            packageFile := self getPackageSourceFileName:(packageDir / 'source' / alternativeClassFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6875
                                            packageFile isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6876
                                                packageFile := (packageDir / 'source' / alternativeClassFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6877
                                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6878
                                            filenameToSet := packageFile.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6879
                                            ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6880
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6881
                                        ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6882
                                            packageFile := self getPackageSourceFileName:(packageDir / classFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6883
                                            packageFile isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6884
                                                packageFile := (packageDir / classFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6885
                                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6886
                                            filenameToSet := packageFile.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6887
                                            (ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6888
                                            ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6889
                                                alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6890
                                                    packageFile := self getPackageFileName:(packageDir / alternativeClassFileName).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6891
                                                    packageFile isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6892
                                                        packageFile := packageDir / alternativeClassFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6893
                                                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6894
                                                    filenameToSet := packageFile.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6895
                                                    ok := self fileInSourceFile:packageFile lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6896
                                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6897
                                                ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6898
                                                    "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6899
                                                     ... and in the standard source-directory
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6900
                                                    "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6901
                                                    filenameToSet := 'source' asFilename / packageDir / classFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6902
                                                    (ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6903
                                                    ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6904
                                                        alternativeClassFileName notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6905
                                                            filenameToSet := 'source' asFilename / packageDir / alternativeClassFileName.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6906
                                                            ok := self fileInSourceFile:filenameToSet lazy:loadLazy silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6907
                                                        ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6908
                                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6909
                                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6910
                                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6911
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6912
                                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6913
                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6914
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6915
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6916
                             if that did not work, and the classes package is known,
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6917
                             look for a zipArchive containing a class entry.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6918
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6919
                            ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6920
                                packageDir notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6921
                                    zarFn := self getPackageFileName:(packageDir / 'source.zip').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6922
                                    zarFn isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6923
                                        zarFn := packageDir withSuffix:'zip'.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6924
                                        zarFn := self getSourceFileName:zarFn.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6925
                                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6926
                                    (zarFn notNil and:[zarFn asFilename exists]) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6927
                                        zar := ZipArchive oldFileNamed:zarFn.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6928
                                        zar notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6929
                                            entry := zar extract:(classFileName , '.st').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6930
                                            (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6931
                                                entry := zar extract:(alternativeClassFileName , '.st').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6932
                                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6933
                                            entry notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6934
                                                filenameToSet := zarFn.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6935
                                                ok := self
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6936
                                                        fileInStream:(entry asString readStream)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6937
                                                        lazy:loadLazy
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6938
                                                        silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6939
                                                        logged:false
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6940
                                                        addPath:nil
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6941
                                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6942
                                        ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6943
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6944
                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6945
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6946
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6947
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6948
                             if that did not work,
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6949
                             look for a zipArchive containing a class entry.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6950
                            "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6951
                            ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6952
                                zarFn := self getSourceFileName:'source.zip'.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6953
                                zarFn notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6954
                                    zar := ZipArchive oldFileNamed:zarFn.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6955
                                    zar notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6956
                                        entry := zar extract:(zarFn := classFileName , '.st').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6957
                                        (entry isNil and:[alternativeClassFileName notNil]) ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6958
                                            entry := zar extract:(zarFn := alternativeClassFileName , '.st').
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6959
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6960
                                        entry notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6961
                                            filenameToSet := zarFn.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6962
                                            ok := self
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6963
                                                    fileInStream:(entry asString readStream)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6964
                                                    lazy:loadLazy
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6965
                                                    silent:beSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6966
                                                    logged:false
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6967
                                                    addPath:nil
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6968
                                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6969
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6970
                                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6971
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6972
                            ok ifFalse:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6973
                                "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6974
                                 if there is a sourceCodeManager, ask it for the classes sourceCode
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6975
                                "
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6976
                                (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6977
                                    inStream := mgr getMostRecentSourceStreamForClassNamed:aClassName inPackage:package.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6978
                                    inStream notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6979
                                        filenameToSet := nil.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6980
                                        ok := self fileInStream:inStream lazy:loadLazy silent:beSilent logged:false addPath:nil.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6981
                                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6982
                                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6983
                            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6984
                        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6985
                    ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6986
                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6987
            ] ensure:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6988
                Compiler compileLazy:wasLazy.
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6989
                wasSilent notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6990
                    self silentLoading:wasSilent
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6991
                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6992
            ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6993
        ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6994
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6995
        ok ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6996
            newClass := self at:(aClassName asSymbol).
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6997
            newClass notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6998
                "set the classes name - but do not change if already set"
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  6999
                filenameToSet notNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7000
                    newClass getClassFilename isNil ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7001
                        newClass setClassFilename:(filenameToSet asFilename baseName)
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7002
                    ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7003
                ].
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7004
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7005
                doInit ifTrue:[
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7006
                    newClass initialize
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7007
                ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7008
            ]
641df14854e2 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22900
diff changeset
  7009
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7010
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7011
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7012
    ^ newClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7013
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7014
    "Created: / 09-01-1998 / 14:40:32 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7015
    "Modified: / 05-06-1999 / 14:53:01 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7016
    "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
  7017
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7018
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7019
fileInClassLibrary:aClassLibraryName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7020
    "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
  7021
     and load it. This install all of its contained classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7022
     Return true if ok, false if not.
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7023
     Changed to raise an error if not OK (i.e. only returns false if the error is proceeded)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7024
     Notice: the argument may not have an extension (by purpose);
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7025
             the sharedLib extension (.dll / .so / .sl) is added here, to
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7026
             make the caller independent of the underlying operatingSystem."
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
    |path fn|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7029
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7030
    ObjectFileLoader isNil ifTrue:[
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7031
        ^ (PackageLoadError raiseRequestWith:aClassLibraryName errorString:' - no ObjectFileLoader') ? false.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7032
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7033
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7034
    fn := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7035
    fn := fn pathName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7036
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7037
    path := self getBinaryFileName:fn.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7038
    path isNil ifTrue:[
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7039
        path := self getSystemFileName:fn.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7040
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7041
    path isNil ifTrue:[
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7042
        ^ (PackageNotFoundError raiseRequestWith:aClassLibraryName) ? false.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7043
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7044
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7045
    (ObjectFileLoader loadObjectFile:path) isNil ifTrue:[
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7046
        ^ (PackageLoadError raiseRequestWith:aClassLibraryName) ? false.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7047
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7048
    ^ true.
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7049
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7050
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7051
     Smalltalk fileInClassLibrary:'libtable'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7052
     Smalltalk fileInClassLibrary:'binary/libwidg3'
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7053
     Smalltalk fileInClassLibrary:'foo'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7054
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7055
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7056
    "Modified: 8.1.1997 / 17:58:56 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7057
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7058
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7059
fileInClassLibrary:aClassLibraryName inPackage:packageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7060
    "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
  7061
     and load it. This installs all of its contained classes.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7062
     Return true if ok, false if not.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7063
     Notice: the argument may not have an extension (by purpose);
23177
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7064
             the sharedLib extension (.dll / .so / .sl) is added here, to
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7065
             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
  7066
11690
b48d486944fc fix for previous revision
Stefan Vogel <sv@exept.de>
parents: 11689
diff changeset
  7067
    |baseName handle libraryFilename packagePath|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7068
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7069
    ObjectFileLoader isNil ifTrue:[
23177
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7070
        ^ PackageLoadError raiseRequestWith:packageID errorString:' - no ObjectFileLoader'
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7071
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7072
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7073
    baseName := aClassLibraryName asFilename withSuffix:(ObjectFileLoader sharedLibrarySuffix).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7074
    baseName exists ifTrue:[
23177
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7075
        "/ load local file first...
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7076
        handle := ObjectFileLoader loadObjectFile:baseName.
12744
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  7077
    ].
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  7078
    handle isNil ifTrue:[
23177
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7079
        packagePath := self getPackageDirectoryForPackage:packageID.
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7080
        packagePath isNil ifTrue:[
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7081
            ^ PackageNotFoundError raiseRequestWith:packageID.
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7082
        ].
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7083
        libraryFilename := ObjectFileLoader binaryClassFilenameForPackage:packageID inDirectory:packagePath.    
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7084
        (libraryFilename notNil and:[libraryFilename exists]) ifTrue:[
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7085
            handle := ObjectFileLoader loadObjectFile:libraryFilename pathName.
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7086
        ].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7087
    ].
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7088
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7089
    handle isNil ifTrue:[
23177
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7090
        ^ PackageNotFoundError raiseRequestWith:packageID.
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7091
    ].
12744
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  7092
"/    handle notNil ifTrue:[
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  7093
"/        Transcript showCR:('    Smalltalk: loaded %1.' bindWith:libraryFilename pathName).
80f6da0fee57 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 12700
diff changeset
  7094
"/    ].
16144
3bde1ed36852 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 16132
diff changeset
  7095
    ^ true.
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7098
     Smalltalk fileInClassLibrary:'libtable'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7099
     Smalltalk fileInClassLibrary:'binary/libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7100
     Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7101
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7102
13787
1695a24d0fa7 changed: #fileInClassLibrary:inPackage:
Claus Gittinger <cg@exept.de>
parents: 13785
diff changeset
  7103
    "Modified: / 08-10-2011 / 00:08:51 / cg"
23177
1f49ca31ecc8 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22955
diff changeset
  7104
    "Modified: / 02-07-2018 / 14:19:16 / Stefan Vogel"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7105
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7106
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  7107
fileInSourceFile:filenameArg lazy:loadLazy silent:beSilent
18560
a37464a68e70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18385
diff changeset
  7108
    "Try all available programming languages for a matching suffix"
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7109
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  7110
    |filename|
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  7111
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  7112
    filename := filenameArg asFilename.
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7113
"/    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
  7114
"/        | f |
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7115
"/
21338
82931ca66d88 #OTHER by mawalch
mawalch
parents: 21265
diff changeset
  7116
"/        "/ cg: changed: did try all languages to load (eg. whether suffix matched or not.
18572
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7117
"/        "/ 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
  7118
"/        (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
  7119
"/            (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
  7120
"/                ^ true
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7121
"/            ].
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7122
"/        ]
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7123
"/    ].
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7124
"/ 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
  7125
    ProgrammingLanguage allDo:[:lang| | f |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7126
	f := (filename hasSuffix:lang sourceFileSuffix)
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7127
		    ifTrue:[filename]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7128
		    ifFalse:[filename addSuffix:lang sourceFileSuffix].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7129
	(self fileIn:f lazy:loadLazy silent:beSilent)
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7130
		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
  7131
    ].
b088a44b9681 \"/ revert to old code to get stuff running again- please review - (autoload problems)
Michael Beyl <mb@exept.de>
parents: 18560
diff changeset
  7132
15073
e243aaa87bdf class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15068
diff changeset
  7133
    ^ false
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7134
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7135
    "Created: / 16-08-2009 / 14:45:41 / Jan Vrany <vranyj1@fel.cvut.cz>"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7136
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7137
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7138
fileInStream:streamArg
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7139
    ^ self fileInStream:streamArg lazy:nil silent:nil logged:false addPath:nil
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7142
fileInStream:streamArg lazy:lazy silent:silent logged:logged addPath:morePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7143
    "read sourceCode from aStream;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7144
     return true if ok, false if failed.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7145
     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
  7146
     are created which compile themself when first executed. This allows
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7147
     for much faster fileIn (but slows down the first execution later).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7148
     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
  7149
     code which is known to be syntactically correct.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7150
     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
  7151
     Giving nil for silent/lazy will use the current settings.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7152
     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
  7153
     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
  7154
     using a relative path."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7155
11427
ac373ee02301 refactored
Claus Gittinger <cg@exept.de>
parents: 11400
diff changeset
  7156
    |inStream wasLazy wasSilent oldSystemPath oldRealPath|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7157
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7158
    inStream := streamArg.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7159
    inStream isNil ifTrue:[^ false].
19385
0c655478e4bd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19187
diff changeset
  7160
    inStream isLineNumberReadStream ifFalse:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7161
	LineNumberReadStream notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7162
	    "/ sigh - is in libbasic2, which is not always present
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7163
	    inStream := LineNumberReadStream on:inStream.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7164
	].
19385
0c655478e4bd #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19187
diff changeset
  7165
    ].
21458
f9ff2c1811fd #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21443
diff changeset
  7166
    inStream := EncodedStream decodedStreamFor:inStream.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7167
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7168
    lazy notNil ifTrue:[wasLazy := Compiler compileLazy:lazy].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7169
    silent notNil ifTrue:[wasSilent := self silentLoading:silent].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7170
    morePath notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7171
	oldSystemPath := SystemPath copy.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7172
	SystemPath addFirst:morePath.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7173
	oldRealPath := RealSystemPath.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7174
	RealSystemPath := nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7175
    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7176
22703
d4218cffd69d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22691
diff changeset
  7177
    ^ [
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7178
	(Class updateChangeFileQuerySignal , Class updateChangeListQuerySignal) answer:logged do:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7179
	    "JV: Changed to give ProgrammingLanguage to choose
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7180
	     proper reader"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7181
	    ((ProgrammingLanguage forStream: inStream) fileInStream: inStream) ~~ #Error
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7182
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7183
    ] ensure:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7184
	morePath notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7185
	    "take care, someone could have changed SystemPath during fileIn!!"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7186
	    (SystemPath copyFrom:2) = oldSystemPath ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7187
		SystemPath := oldSystemPath.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7188
		RealSystemPath := oldRealPath.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7189
	    ] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7190
		(oldSystemPath includes:morePath) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7191
		    SystemPath remove:morePath ifAbsent:[].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7192
		].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7193
		RealSystemPath := nil.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7194
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7195
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7196
	lazy notNil ifTrue:[Compiler compileLazy:wasLazy].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7197
	silent notNil ifTrue:[self silentLoading:wasSilent].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7198
	inStream close
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7199
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7200
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7201
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7202
     Smalltalk fileInStream:('source/TicTacToe.st' asFilename readStream) lazy:true silent:true
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7203
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7204
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7205
    "Modified: / 05-11-1996 / 20:03:35 / cg"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7206
    "Modified: / 16-08-2009 / 11:06:05 / Jan Vrany <vranyj1@fel.cvut.cz>"
22706
5f1633e2dde7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22705
diff changeset
  7207
    "Modified: / 24-04-2018 / 23:50:22 / stefan"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7208
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7209
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7210
isClassLibraryLoaded:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7211
    "return true, if a particular class library is already loaded"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7212
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7213
    ObjectMemory
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7214
	binaryModuleInfo
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7215
	    do:[:entry |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7216
		   entry type == #classLibrary ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7217
		       entry libraryName = name ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7218
			  ^ true        "/ already loaded
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7219
		       ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7220
		   ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7221
	       ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7222
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7223
    ^ false
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7224
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7225
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7226
     Smalltalk isClassLibraryLoaded:'libstx_libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7227
     Smalltalk isClassLibraryLoaded:'libstx_libwidg3'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7228
     Smalltalk isClassLibraryLoaded:'libstx_libboss'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7229
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7230
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7231
    "Modified: / 23-08-2006 / 15:54:46 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7232
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7233
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7234
loadClassLibraryIfAbsent:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7235
    "dynamically load a classLibrary, if not already loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7236
     and the system supports dynamic loading.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7237
     Return true, if the library is loaded, false if not.
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7238
     Changed to raise an error if not ok (i.e. only returns false if the error is proceeded)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7239
     This entry is called without system specific filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7240
     extensions - it is portable among different architectures
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7241
     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
  7242
     are be present ..."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7243
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7244
    (self isClassLibraryLoaded:name) ifTrue:[ ^ true ].  "/ already loaded
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7245
    ^ self fileInClassLibrary:name
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7246
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7247
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7248
     Smalltalk loadClassLibraryIfAbsent:'libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7249
     Smalltalk loadClassLibraryIfAbsent:'libwidg3'
24405
1cd295707fd7 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24376
diff changeset
  7250
     Smalltalk loadClassLibraryIfAbsent:'foo'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7251
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7252
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7253
    "Modified: 31.10.1996 / 16:57:24 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7254
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7255
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7256
secureFileIn:aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7257
    "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
  7258
     Catch various errors during fileIn.
13000
28bd279e2574 changed: #secureFileIn:
Stefan Vogel <sv@exept.de>
parents: 12919
diff changeset
  7259
     Return true if ok, false if failed"
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7260
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7261
    Parser isNil ifTrue:[
23588
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7262
        ^ false         "/ for small stand alone apps.
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7263
    ].
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7264
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7265
    ^ (SignalSet
23588
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7266
        with:AbortOperationRequest
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7267
        with:TerminateProcessRequest
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7268
        with:ParseError)
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7269
            handle:[:ex | 
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7270
                ex creator == ParseError ifTrue:[
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7271
                    Logger info:'ParseError in line %1: %2' with:ex lineNumber with:ex description.
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7272
                ].
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7273
                ex return:false 
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7274
            ]
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7275
            do:[ self fileIn:aFileName ].
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7276
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7277
    "Modified: / 23-04-2018 / 16:53:29 / stefan"
23588
3d22aa7327b0 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 23470
diff changeset
  7278
    "Modified: / 25-12-2018 / 10:23:40 / Claus Gittinger"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7279
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7280
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7281
silentFileIn:aFilename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7282
    "same as fileIn:, but do not output 'compiled...'-messages on Transcript.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7283
     Main use is during startup."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7284
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7285
    ^ self silentlyLoadingDo:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7286
	self fileIn:aFilename
22691
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7287
    ].
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7288
df53ad43691d #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22679
diff changeset
  7289
    "Modified: / 23-04-2018 / 16:57:17 / stefan"
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7290
! !
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7291
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7292
!Smalltalk class methodsFor:'system management-files'!
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3033
diff changeset
  7293
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7294
addIdeTopDirectoryToPackagePath
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7295
    "{ Pragma: +optSpace }"
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7296
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7297
    |topDirectory|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7298
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7299
    (topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7300
	topDirectory := topDirectory asFilename.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7301
	(topDirectory directory / 'stc') exists ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7302
	    topDirectory := topDirectory directory.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7303
	] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7304
	    (topDirectory directory directory / 'stc') exists ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7305
		topDirectory := topDirectory directory directory.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7306
	    ] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7307
		(topDirectory directory directory directory / 'stc') exists ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7308
		    topDirectory := topDirectory directory directory directory.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7309
		] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7310
		    topDirectory := nil
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7311
		].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7312
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7313
	].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7314
	topDirectory notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7315
	    "/ one above "stx"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7316
	    topDirectory := topDirectory directory pathName.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7317
	    (PackagePath includes:topDirectory) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7318
		PackagePath add:topDirectory
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7319
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7320
	]
20663
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7321
    ].
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7322
!
0c2ac3c3937e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20640
diff changeset
  7323
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7324
addWorkspaceDirectoryToPackagePath
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7325
    "{ Pragma: +optSpace }"
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7326
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7327
    |workspaceDirectory|
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7328
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7329
    (workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7330
	(workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7331
	    workspaceDirectory := workspaceDirectory pathName.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7332
	    (PackagePath includes:workspaceDirectory) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7333
		PackagePath addFirst:workspaceDirectory
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7334
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7335
	]
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7336
    ].
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7337
!
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  7338
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7339
bitmapFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7340
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7341
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7342
     Searches in subdirectories named 'bitmaps' in the SystemPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7343
     Notice: this does not look in the package-specific bitmaps directories."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7344
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7345
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7346
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7347
    aString := self getBitmapFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7348
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7349
	^ aString asFilename readStreamOrNil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7350
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7351
    ^ nil
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7354
bitmapFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7355
    "backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7356
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7357
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7358
     then in the classes own package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7359
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7360
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7361
    ^ self imageFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7362
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
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' forClass:View
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7368
bitmapFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7369
    "backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7370
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7371
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7372
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7373
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7374
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7375
    ^ self imageFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7376
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7377
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7378
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7379
     Smalltalk bitmapFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7380
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7381
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7382
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7383
classNameForFile:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7384
    "return the className which corresponds to an abbreviated fileName,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7385
     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
  7386
     include a '.st' suffix (but no other)."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7387
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7388
    |fn|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7389
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7390
    (aFileName asFilename hasSuffix:'st') ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7391
	fn := aFileName copyButLast:3
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7392
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7393
	fn := aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7394
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7395
    ^ self filenameAbbreviations keyAtEqualValue:fn ifAbsent:[fn].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7396
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7397
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7398
     Smalltalk classNameForFile:'DrawObj'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7399
     Smalltalk classNameForFile:'DrawObj.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7400
     Smalltalk classNameForFile:'ArrColl.st'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7401
     Smalltalk classNameForFile:'ArrColl.chg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7402
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7403
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7404
    "Modified: 11.12.1995 / 14:51:10 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7405
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7406
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7407
constructPathFor:aDirectoryName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7408
    "search for aDirectory in SystemPath;
20294
dc408807328e #OTHER by mawalch
mawalch
parents: 20207
diff changeset
  7409
     return a collection of paths which include that directory."
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7410
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7411
    ^ self realSystemPath select:[:dirName |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7412
	|fullPath|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7413
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7414
	fullPath := dirName asFilename construct:aDirectoryName.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7415
	"/ fullPath exists and:[fullPath isDirectory and:[fullPath isReadable]]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7416
	fullPath isDirectory and:[fullPath isReadable]
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7420
fileInFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7421
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7422
     search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7423
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7424
     Searches in subdirectories named 'fileIn' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7425
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7426
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7427
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7428
    aString := self getFileInFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7429
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7430
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7431
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7432
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  7433
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7434
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7435
fileNameForClass:aClassOrClassName
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7436
    "return a actual or expected (or most wanted) filename for aClassOrClassName
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7437
     - only the base name (without directory part) and without suffix."
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7438
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7439
    |cls nonMetaclass nm nameWithPrefix nameWithoutPrefix compatQuery compatPkg |
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7440
12301
5d077b04f6f0 changed: #fileNameForClass:
fm
parents: 12300
diff changeset
  7441
"/  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
  7442
"/  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
  7443
"/  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
  7444
"/  prerequisites in makefiles. But if you renamed such a stc-compiled class,
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7445
"/  the filename remains the same, but SVN __ALWAYS__ keep container name
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7446
"/  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
  7447
"/  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
  7448
"/  Certainly a hack, but do not remove this until fixed elsewhere
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7449
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7450
    compatQuery := #'SVN::CompatModeQuery' asClassIfAbsent:nil.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7451
    (compatQuery notNil
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7452
      and:[compatQuery isLoaded
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7453
        and:[compatQuery query not]]) ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7454
            nm := aClassOrClassName isBehavior
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7455
                ifTrue:[aClassOrClassName name]
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7456
                ifFalse:[aClassOrClassName].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7457
            nm := nm copyReplaceAll:$: with:$_ ifNone:nm.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7458
            ^nm
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7459
    ].
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7460
16122
18c865388947 Fix in Smalltalk>>#fileNameForClass: - required by libscm to support nested packages.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16117
diff changeset
  7461
    "/ 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
  7462
    "/ 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
  7463
    "/ 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
  7464
    "/ of classes OUTSIDE filed-out package when generating makefile dependencies.
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7465
    compatQuery := #'SCMCompatModeQuery' asClassIfAbsent:nil.
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7466
    (compatQuery notNil
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7467
      and:[compatQuery isLoaded
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7468
        and:[(compatPkg := compatQuery query) notNil]]) ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7469
            | compatPkgs |
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7470
            "/ Originally libscm could only fileout one package at time so
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7471
            "/ the query answered one package name. However, to support nested
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7472
            "/ packages, libscm is being rewritten to commit multiple packages
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7473
            "/ at once, so query answers a collection of packages. The code below
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7474
            "/ makes sure it works for both.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7475
            compatPkgs := compatPkg isString ifTrue:[ Array with: compatPkg] ifFalse:[ compatPkg ].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7476
            nm := aClassOrClassName isBehavior
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7477
                ifTrue:[aClassOrClassName name]
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7478
                ifFalse:[aClassOrClassName].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7479
            cls := Smalltalk at: nm asSymbol.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7480
            (cls notNil and:[compatPkgs includes: cls package]) ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7481
                nm := nm copyReplaceAll:$: with:$_.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7482
                ^nm
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7483
            ].
15958
fd69e4694d91 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15872
diff changeset
  7484
    ].
12301
5d077b04f6f0 changed: #fileNameForClass:
fm
parents: 12300
diff changeset
  7485
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7486
    aClassOrClassName isBehavior ifTrue:[
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7487
        cls := aClassOrClassName.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7488
    ] ifFalse:[
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7489
        cls := Smalltalk classNamed:aClassOrClassName.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7490
        cls isNil ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7491
            nameWithPrefix := aClassOrClassName.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7492
            nameWithoutPrefix := (aClassOrClassName copyFrom:(aClassOrClassName lastIndexOf:$:)+1).
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7493
        ].
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7494
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7495
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7496
    cls notNil ifTrue:[
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7497
        nonMetaclass := cls theNonMetaclass.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7498
        nm := nonMetaclass getClassFilename.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7499
        nm isNil ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7500
            |revisionInfo|
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7501
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7502
            (revisionInfo := cls revisionInfo) notNil ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7503
                nm := revisionInfo fileName.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7504
            ].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7505
        ].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7506
        nm notNil ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7507
            ^ nm asFilename withoutSuffix baseName
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7508
        ].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7509
        nameWithPrefix := nonMetaclass name.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7510
        nameWithoutPrefix := nonMetaclass nameWithoutPrefix.
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7511
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7512
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7513
    CachedAbbreviations notNil ifTrue:[
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7514
        nameWithPrefix := nameWithPrefix asSymbol.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7515
        (CachedAbbreviations includesKey:nameWithPrefix) ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7516
            ^ (CachedAbbreviations at:nameWithPrefix) asFilename baseName
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7517
        ].
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7518
        nameWithoutPrefix := nameWithoutPrefix asSymbol.
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7519
        (CachedAbbreviations includesKey:nameWithoutPrefix) ifTrue:[
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7520
            ^ (CachedAbbreviations at:nameWithoutPrefix) asFilename baseName
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7521
        ].
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7522
    ].
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7523
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7524
    ^ nameWithPrefix copyReplaceAll:$: with:$_
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7525
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7526
    "
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7527
     Smalltalk fileNameForClass:#Complex
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7528
     Smalltalk fileNameForClass:'SmallInteger'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7529
     Smalltalk fileNameForClass:'UnixOperatingSystem'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7530
     Smalltalk fileNameForClass:'Launcher'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7531
     Smalltalk fileNameForClass:'SomeUnknownClass'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7532
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7533
     Smalltalk fileNameForClass:HTML::Encoder
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7534
     Smalltalk fileNameForClass:OSI::FTAMOperation
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7535
     Smalltalk fileNameForClass:'OSI::Foobar'
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7536
     Smalltalk fileNameForClass:(Workflow::UnsuccessfulFinishReasons)
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7537
     Workflow::UnsuccessfulFinishReasons classFilename
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7538
    "
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7539
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7540
    "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
  7541
    "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
  7542
    "Modified (comment): / 23-02-2014 / 12:39:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23414
c10ead3a5a86 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23408
diff changeset
  7543
    "Modified: / 10-10-2018 / 00:44:07 / Claus Gittinger"
12022
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7544
!
205ac90337cc oops- fileNameForClass
Claus Gittinger <cg@exept.de>
parents: 12019
diff changeset
  7545
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7546
filenameAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7547
    "return a dictionary containing the classname-to-filename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7548
     mappings. (needed for sys5.3 users, where filenames are limited
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7549
     to 14 chars)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7550
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7551
    CachedAbbreviations isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7552
	self readAbbreviations
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7553
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7554
    ^ CachedAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7555
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7556
    "flush with:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7557
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7558
     CachedAbbreviations := nil
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7561
     Smalltalk filenameAbbreviations
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
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7564
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7565
findPackageDirectoryForPackage:aPackage
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7566
    "find a packages directory along a number of standard places"
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7567
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7568
    |relDir|
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7569
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7570
    relDir := Smalltalk relativePackagePathForPackage:aPackage.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7571
    relDir asFilename isAbsolute ifTrue:[^ relDir].
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7572
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7573
    ^ Smalltalk getPackageFileName:relDir.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7574
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7575
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7576
     Smalltalk findPackageDirectoryForPackage:'stx:libview/resources'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7577
     Smalltalk findPackageDirectoryForPackage:'stx:libview'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7578
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7579
!
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  7580
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7581
flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7582
    "{ Pragma: +optSpace }"
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
    "forget pathCaches - these are collections containing valid directory names,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7585
     where system files (resource, bitmaps etc.) are found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7586
     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
  7587
     the system is active, and those files should override the others
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7588
     (for example, if you created a private resource directory)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7589
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7590
    RealSystemPath := ResourcePath := SourcePath :=
15332
cc2fb912d04c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15315
diff changeset
  7591
    BinaryPath := FileInPath := nil.
cc2fb912d04c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15315
diff changeset
  7592
10641
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
     Smalltalk flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7595
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7596
!
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
getBinaryFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7599
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7600
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7601
     (subdirectories named 'binary' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7602
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7603
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7604
    BinaryPath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7605
	BinaryPath := self constructPathFor:BinaryDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7606
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7607
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7608
    ^ self searchPath:BinaryPath for:aFileName in:BinaryDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7609
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7610
    "Modified: 18.7.1996 / 15:53:49 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7611
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7612
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7613
getBitmapFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7614
    "for backward compatibility:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7615
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7616
     (subdirectories named 'bitmaps' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7617
     Return the pathName or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7618
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7619
    ^ self getBitmapFileName:aFileName forPackage:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7620
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7621
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7622
     Smalltalk getBitmapFileName:'SBrowser.xbm'
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7625
    "Modified: 18.7.1996 / 15:53:55 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7626
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7627
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7628
getBitmapFileName:aFileName forPackage:aPackageIDOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7629
    "for backward compatibility.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7630
     search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7631
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7632
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7633
     Return a path or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7634
     Search order is:
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7635
        bitmaps/<pkg>/file
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7636
        resources/<pkg>/bitmaps/file
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7637
        <pkg>/bitmaps/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7638
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7639
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7640
    |f dir packageDir pF|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7641
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  7642
    f := aFileName asString withoutPrefix:'bitmaps/'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7643
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7644
    aPackageIDOrNil isNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7645
        "/ this will be an error in the future
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7646
"/        'Smalltalk [warning]: bitmap file access without package: ' infoPrint. aFileName infoPrintCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7647
"/        self halt.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7648
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7649
        pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps').
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7650
        pF notNil ifTrue:[
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7651
            ^ pF.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7652
        ].
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7653
        f ~= aFileName ifTrue:[
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7654
            pF := self searchPath:(self realSystemPath) for:f in:('bitmaps').
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7655
            pF notNil ifTrue:[
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7656
                ^ pF.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7657
            ].
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7658
        ].
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7659
        ^ nil
11077
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7660
    ].
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7661
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7662
    dir := self projectDirectoryForPackage:aPackageIDOrNil.
14df4640ed89 image by package and filename access fixed
Claus Gittinger <cg@exept.de>
parents: 11057
diff changeset
  7663
    dir notNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7664
        pF := dir asFilename / f.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7665
        pF exists ifTrue:[
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7666
            ^ pF.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7667
        ].
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7668
        pF := dir asFilename / 'bitmaps' /f.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7669
        pF exists ifTrue:[
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7670
            ^ pF.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7671
        ].
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7674
    packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7675
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7676
    pF := self searchPath:(self realSystemPath) for:aFileName in:('bitmaps/',packageDir).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7677
    pF notNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7678
        ^ pF.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7679
    ].
23446
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7680
    #('../Resources' '.resources' 'resources') do:[:eachPossibleRsrcDir |
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7681
        pF := self searchPath:(self realSystemPath) 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7682
                   for:aFileName 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7683
                   in:(eachPossibleRsrcDir,'/',packageDir,'/bitmaps').
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7684
        pF notNil ifTrue:[
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7685
            ^ pF.
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7686
        ].
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7687
    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7688
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7689
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7690
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7691
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7692
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7693
     Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7694
     Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7695
    "
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
    "Modified: / 11-10-2006 / 13:53:18 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7700
getFileInFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7701
    "obsolete
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7702
     search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7703
     (subdirectories named 'fileIn' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7704
     return the absolute filename or nil if none is found."
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
    FileInPath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7707
	FileInPath := self constructPathFor:FileInDirName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7708
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7709
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7710
    ^ self searchPath:FileInPath for:aFileName in:FileInDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7711
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7712
    "Modified: 18.7.1996 / 15:53:59 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7713
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7714
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7715
getPackageDirectoryForPackage:aPackageID
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7716
    "search for a particular package; return its directory, or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7717
     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
  7718
19121
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7719
    |packageId checkForPackageDirectory module packageSubDirectory|
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7720
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7721
    packageId := aPackageID asPackageId.
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7722
    module := packageId module.
4b8d83dceb98 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19117
diff changeset
  7723
    packageSubDirectory := packageId directory.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7724
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7725
    checkForPackageDirectory :=
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7726
	[:moduleDir |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7727
	    |packageDir|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7728
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7729
	    moduleDir isDirectory ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7730
		packageDir := moduleDir / packageSubDirectory.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7731
		packageDir isDirectory ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7732
		    ^ packageDir
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7733
		]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7734
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7735
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7736
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7737
    self packagePath do:[:aPath |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7738
	|moduleDir|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7739
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7740
	moduleDir := aPath asFilename / module.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7741
	checkForPackageDirectory value:moduleDir.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7742
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7743
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7744
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7745
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7746
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7747
     Smalltalk getPackageDirectoryForPackage:(Array package)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7748
     Smalltalk getPackageDirectoryForPackage:'stx:goodies/bitmaps'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7749
     Smalltalk getPackageDirectoryForPackage:'stx:libview'
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
    "Modified: / 06-10-2006 / 11:49:27 / cg"
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
getPackageFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7756
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7757
     (packagePath and subdirectories named 'packages' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7758
     return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7759
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7760
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7761
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7762
    "/ search along packagePath ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7763
    f := self searchPath:self packagePath for:aFileName in:nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7764
    f isNil ifTrue:[
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7765
        "/ search under packages-directory along systemPath ...
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7766
        f := self searchPath:self realSystemPath for:aFileName in:PackageDirName.
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7767
        "/ kludge - allow for stx-directory to be named differently
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7768
        f isNil ifTrue:[
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7769
            (aFileName asString startsWith:('stx' , Filename separator)) ifTrue:[
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7770
                f := '..' asFilename / '..' / (aFileName copyFrom:5).
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7771
            ]
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7772
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7773
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7774
    (f notNil and:[(f := f asFilename) exists]) ifTrue:[
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7775
        ^ f pathName
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7776
    ].
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  7777
    ^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7778
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7779
    "
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  7780
     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
  7781
     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
  7782
     Smalltalk getPackageFileName:'stx/libview/source.zip'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7783
    "
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
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7786
getPackageSourceFileName:filenameWithoutSuffixArg
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7787
    "search aFileName in some standard places and try all available languages"
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7788
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7789
    |filenameWithoutSuffix|
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7790
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7791
    filenameWithoutSuffix:= filenameWithoutSuffixArg asFilename.
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7792
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  7793
    ProgrammingLanguage
24376
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7794
        allDo:[:lang |
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7795
            |file|
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7796
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7797
            file := self getPackageFileName:(filenameWithoutSuffix addSuffix:lang sourceFileSuffix).
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7798
            file notNil ifTrue:[ ^ file ]
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7799
        ].
15074
32e78cd1a8af class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15073
diff changeset
  7800
    ^ nil
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7801
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7802
    "Created: / 16-08-2009 / 14:44:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
24376
746ce8c19ac4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24136
diff changeset
  7803
    "Modified (format): / 27-06-2019 / 12:32:39 / Claus Gittinger"
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7804
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  7805
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7806
getResourceFileName:aFileName
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7807
    <resource: #obsolete>
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7808
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7809
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7810
     (subdirectories named 'resources' in SystemPath);
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7811
     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
  7812
     Obsolete: you must now provide a package argument."
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7813
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7814
    self obsoleteMethodWarning:'use getResourceFileName:forPackage:'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7815
    ^ self getResourceFileName:aFileName forPackage:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7816
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7817
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7818
     Smalltalk getResourceFileName:'SystemBrowser.rs'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7819
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7820
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7821
    "Modified: 18.7.1996 / 15:54:03 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7822
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7823
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7824
getResourceFileName:aFileName forClass:aClassOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7825
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7826
     (subdirectories named 'resource' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7827
     and in aClasses package directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7828
     Return the absolute filename or nil if none is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7829
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7830
    |pkgOrNil|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7831
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7832
    aClassOrNil notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  7833
	pkgOrNil := aClassOrNil package.
10641
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
    ^ self getResourceFileName:aFileName forPackage:pkgOrNil.
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
    "
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7838
     Smalltalk getResourceFileName:'de.rs' forClass:SystemBrowser
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7839
    "
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
getResourceFileName:aFileName forPackage:aPackageIDOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7843
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7844
     (subdirectories named 'resource' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7845
     and in a packages directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7846
     Return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7847
     Search order is:
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7848
        resources/<pkg>/file
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7849
        <pkg>/resources/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7850
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7851
23467
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7852
    |pF f dir packageDir possibleResourceDirs|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7853
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  7854
    f := aFileName asString withoutPrefix:'resources/'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7855
23467
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7856
    OperatingSystem isOSXlike ifTrue:[
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7857
        possibleResourceDirs := #('../Resources' '.resources' 'resources').
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7858
    ] ifFalse:[
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7859
        OperatingSystem isMSWINDOWSlike ifTrue:[
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7860
            possibleResourceDirs := #('resources').
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7861
        ] ifFalse:[
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7862
            possibleResourceDirs := #('.resources' 'resources').
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7863
        ].
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7864
    ].
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7865
    
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7866
    aPackageIDOrNil isNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7867
        "/ this will be an error in the future
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7868
"/        'Smalltalk [warning]: resource file access without package: ' infoPrint. aFileName infoPrintCR.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7869
"/        self halt.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7870
23467
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7871
        possibleResourceDirs do:[:eachPossibleRsrcDir |
23446
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7872
            pF := self searchPath:(self realSystemPath) 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7873
                       for:aFileName 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7874
                       in:(eachPossibleRsrcDir).
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7875
            pF notNil ifTrue:[
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7876
                ^ pF.
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7877
            ].
23449
a03c056447f2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23448
diff changeset
  7878
            f ~= aFileName ifTrue:[
23446
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7879
                pF := self searchPath:(self realSystemPath) 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7880
                           for:f 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7881
                           in:(eachPossibleRsrcDir).
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7882
                pF notNil ifTrue:[
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7883
                    ^ pF.
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7884
                ].
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7885
            ].
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7886
        ].
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7887
        ^ nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7888
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7889
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7890
    packageDir := aPackageIDOrNil copyReplaceAll:$: with:$/.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7891
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7892
    "/ search under resources-directory along systemPath ...
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7893
    pF := self 
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7894
            searchPath:(self realSystemPath) 
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7895
            for:(packageDir asFilename / 'resources' / f) 
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7896
            in:ResourceDirName.
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7897
    pF notNil ifTrue:[
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7898
        ^ pF.
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7899
    ].
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  7900
    
23467
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7901
    possibleResourceDirs do:[:eachPossibleRsrcDir |
23446
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7902
        pF := self searchPath:(self realSystemPath) 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7903
                   for:aFileName 
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7904
                   in:(eachPossibleRsrcDir,'/',packageDir).
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7905
        pF notNil ifTrue:[
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7906
            ^ pF.
994a3426acdb #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23445
diff changeset
  7907
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7908
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7909
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7910
    "/ 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
  7911
    dir := self projectDirectoryForPackage:aPackageIDOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7912
    dir notNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7913
        dir := dir asFilename.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7914
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7915
        (pF := dir / 'resources' / f) exists ifTrue:[ ^ pF name ].
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7916
"/        (pF := dir / 'styles' / f) exists ifTrue:[ ^ pF name ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7917
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7918
        "resolve something like: 'ASN/definition.asn1'"
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  7919
        (pF := dir / f) exists ifTrue:[ ^ pF name ].
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7920
    ].
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  7921
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7922
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7923
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7924
    "
23449
a03c056447f2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23448
diff changeset
  7925
     Smalltalk projectDirectoryForPackage:'stx:libtool'
a03c056447f2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23448
diff changeset
  7926
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7927
     Smalltalk getResourceFileName:'SystemBrowser.rs' forPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7928
     Smalltalk getResourceFileName:'normal.style' forPackage:'stx:libview'
12547
30fda24cebb5 comment/format in: #getResourceFileName:forClass:
Claus Gittinger <cg@exept.de>
parents: 12539
diff changeset
  7929
     Smalltalk getResourceFileName:'styles/normal.style' forPackage:'stx:libview'
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  7930
     Smalltalk getResourceFileName:'styles/mswindowsXP.style' forPackage:'stx:libview'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7931
     Smalltalk getResourceFileName:'Foo.rs' forPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7932
    "
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
    "Modified: / 11-10-2006 / 13:53:43 / cg"
23467
f145dcf0e5e8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23462
diff changeset
  7935
    "Modified: / 25-10-2018 / 10:00:30 / Claus Gittinger"
10641
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
getSourceFileName:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7939
    "search aFileName in some standard places
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7940
     (subdirectories named 'source' in SystemPath);
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7941
     return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7942
     This is used to find a sourceFile for a methods source,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7943
     if no sourceCodeManager is available."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7944
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7945
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7946
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7947
    SourcePath isNil ifTrue:[
23470
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7948
        SourcePath := self constructPathFor:SourceDirName
10641
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
    "/ first, try a source subdir along the path.
24884
95fd8f42074f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24872
diff changeset
  7952
    SourcePath notEmptyOrNil ifTrue:[
23470
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7953
        f := self searchPath:SourcePath for:aFileName in:SourceDirName.
10641
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
    f isNil ifTrue:[
23470
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7956
        "/ then, try it itself along the path.
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7957
        f := self searchPath:self realSystemPath for:aFileName in:nil
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7958
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7959
    ^ f
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7960
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7961
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7962
     Smalltalk getSourceFileName:'Smalltalk.st'
23470
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7963
     Smalltalk getSourceFileName:'stx/libbasic/ArrayedCollection.st'
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7964
    "
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7965
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7966
    "Modified: / 18-07-1996 / 15:54:07 / cg"
bd1dde092c48 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23467
diff changeset
  7967
    "Modified (comment): / 25-10-2018 / 23:29:01 / Claus Gittinger"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7968
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7969
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7970
getSystemFileName:aFileNameOrString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7971
    "search aFileNameOrString in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7972
     return the absolute filename or nil if none is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7973
     see comment in Smalltalk>>initSystemPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7974
     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
  7975
     and other help files.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7976
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7977
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7978
    "credits for this method go to Markus ...."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7979
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7980
    |fn nameString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7981
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7982
    fn := aFileNameOrString asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7983
    nameString := fn name.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7984
    fn isAbsolute ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7985
	"don't use path for absolute file names"
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7986
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7987
	^ nameString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7988
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7989
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  7990
    self realSystemPath do:[:dirName |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7991
	|realName|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7992
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7993
	realName := dirName asFilename / nameString.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7994
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7995
	"/ here, we also return true if it's a directory
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7996
	"/ (Even if unreadable).
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7997
	"/ It could be that the file itself is still readable.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7998
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  7999
	(realName isDirectory or:[realName isReadable]) ifTrue: [
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8000
	    ^ realName name
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8001
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8002
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8003
    ^ nil
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
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8006
     Smalltalk getSystemFileName:'doc/online/english/TOP.html'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8007
     Smalltalk getSystemFileName:'bitmaps/SBrowser.xbm'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8008
     Smalltalk getSystemFileName:'bitmaps/foo'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8009
     Smalltalk getSystemFileName:'resources/View.rs'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8010
     Smalltalk getSystemFileName:'resources/iris.style'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8011
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8012
21443
e34ee2e79763 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21365
diff changeset
  8013
    "Modified: / 06-05-1999 / 10:40:37 / cg"
e34ee2e79763 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21365
diff changeset
  8014
    "Modified (comment): / 13-02-2017 / 20:30:51 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8015
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8016
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8017
imageFromFileNamed:aFileName forClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8018
    "search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8019
     first in the redefinable bitmaps path, then in the classes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8020
     own package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8021
     Return an image or nil."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8022
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8023
    |classPackage img|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8024
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8025
    classPackage := aClass package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8026
    img := self imageFromFileNamed:aFileName inPackage:classPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8027
    img isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8028
	"/ try under the goodies package ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8029
	classPackage ~= 'stx:goodies' ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8030
	    img := self imageFromFileNamed:aFileName inPackage:'stx:goodies'.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8031
	]
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8032
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8033
    ^ img
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8034
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8035
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8036
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' forClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8037
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8038
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8039
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8040
imageFromFileNamed:aFileName inPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8041
    "search aFileName in some standard places:
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8042
     first in the redefinable bitmaps path,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8043
     then in the package directory if existing.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8044
     Return an image or nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8045
     Search order is:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8046
	bitmaps/<pkg>/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8047
	resources/<pkg>/bitmaps/file
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8048
	<pkg>/bitmaps/file
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8049
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8050
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8051
    |path|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8052
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8053
    path := self getBitmapFileName:aFileName forPackage:aPackage.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8054
    path notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8055
	^ Image fromFile:path.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8056
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8057
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8058
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8059
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8060
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libview'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8061
     Smalltalk imageFromFileNamed:'SmalltalkX.xbm' inPackage:'stx:libtool'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8062
     Smalltalk imageFromFileNamed:'bitmaps/gifImages/garfield.gif' inPackage:'stx:goodies'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8063
     Smalltalk imageFromFileNamed:'CheckOn10_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8064
     Smalltalk imageFromFileNamed:'ComboDn_xp.xpm' inPackage:'stx:libwidg'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8065
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8066
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8067
    "Modified: / 08-09-2006 / 18:02:04 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8068
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8069
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8070
libraryFileNameOfClass:aClassOrClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8071
    "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
  8072
     binary code for it.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8073
     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
  8074
     for an entry for aClassOrClassName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8075
     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
  8076
     the 2nd col.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8077
     Return nil if no entry is found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8078
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8079
     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
  8080
     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
  8081
     Otherwise, the returned name is the classLibrary object of that class.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8082
     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
  8083
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8084
    |aStream line words n aClassName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8085
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8086
    aClassOrClassName isBehavior ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8087
	aClassName := aClassOrClassName name
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8088
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8089
	aClassName := aClassOrClassName
10641
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
    aClassName := aClassName asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8092
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8093
    #('include/liblist.stc')    "/ filenames
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8094
    with:#(2)                   "/ column
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8095
    do:[:fileName :col |
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8096
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8097
	aStream := self systemFileStreamFor:fileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8098
	aStream notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8099
	    [aStream atEnd] whileFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8100
		line := aStream nextLine.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8101
		line notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8102
		    (line startsWith:'#') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8103
			words := line asCollectionOfWords.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8104
			(n := words size) > 1 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8105
			    (words at:1) = aClassName ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8106
				n >= col ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8107
				    aStream close.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8108
				    ^ (words at:col) withoutSeparators
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8109
				]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8110
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8111
			]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8112
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8113
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8114
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8115
	    aStream close
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8116
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8117
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8118
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8119
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8120
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8121
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8122
     Smalltalk libraryFileNameOfClass:'ClockView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8123
     Smalltalk libraryFileNameOfClass:'Bag'
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8126
    "Modified: 6.11.1995 / 15:41:39 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8127
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8128
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8129
packagePath
15781
3185deb3a8d2 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 15766
diff changeset
  8130
    "return a collection of additional directory names, where smalltalk
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8131
     looks for package directories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8132
     Notice, that directories named 'packages' under the systemPath are
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8133
     always consulted - even if not in the packagePath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8134
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
  8135
    ^ PackagePath ? #()
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8136
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8137
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8138
     Smalltalk packagePath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8139
     Smalltalk packagePath addLast:'/opt/smalltalk'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8140
     Smalltalk packagePath addFirst:'/usr/local/otherPackages'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8141
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8142
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8143
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8144
packagePath:aPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8145
    "set the packagePath;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8146
     a collection of additional directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8147
     looks for package directories.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8148
     Notice, that directories named 'packages' under the systemPath are
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8149
     always consulted - even if not in the packagePath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8150
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8151
    PackagePath := aPath asOrderedCollection
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8152
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8153
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8154
     Smalltalk packagePath:#( '.' '/opt/stx' '/opt/smalltalk' '/usr/local/otherPackages')
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8155
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8156
!
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
projectDirectoryForClass:aClass
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8159
    "given a class, return the path to its package directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8160
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8161
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8162
    |pkg|
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
    pkg := aClass package.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8165
    pkg isNil ifTrue:[^ nil].
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
    ^ self projectDirectoryForPackage:pkg.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8168
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8169
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8170
     Smalltalk projectDirectoryForClass:Array
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8171
     Smalltalk projectDirectoryForClass:View
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8172
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8173
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8174
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8175
projectDirectoryForPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8176
    "given a packageID, return the path to its package directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8177
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8178
16642
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  8179
    ^ aPackage asPackageId packageDirectory.
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  8180
23449
a03c056447f2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23448
diff changeset
  8181
"/    |prj prjDir|
a03c056447f2 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23448
diff changeset
  8182
"/
23448
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8183
"/    "/ there might be a package specific resource directory ...
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8184
"/    "/ in the directory, from which the project was loaded
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8185
"/    prj := Project projectWithId:aPackage.
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8186
"/    prj notNil ifTrue:[
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8187
"/        prjDir := prj directory.
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8188
"/    ].
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8189
"/    (prjDir notNil and:[prjDir asFilename exists]) ifFalse:[
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8190
"/        prjDir := Smalltalk getPackageFileName:(aPackage copyReplaceAll:$: with:$/).
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8191
"/    ].
c3a10c2e07a4 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23446
diff changeset
  8192
"/    ^ prjDir
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8193
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8194
    "
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  8195
     Smalltalk projectDirectoryForPackage:'stx:libbasic'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8196
     Smalltalk projectDirectoryForPackage:'exept:smartcard'
16668
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  8197
     Smalltalk projectDirectoryForPackage:'stx'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  8198
     Smalltalk projectDirectoryForPackage:'bosch'
b88318df967d flush cached class resources AFTER reading the user preferences
Claus Gittinger <cg@exept.de>
parents: 16666
diff changeset
  8199
     Smalltalk projectDirectoryForPackage:'bosch:foo'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8200
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8201
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8202
    "Modified: / 07-10-2006 / 17:45:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8203
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8204
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8205
readAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8206
    "read classname to filename mappings from include/abbrev.stc.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8207
     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
  8208
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8209
    "since installAutoloadedClasses also reads all abbreviations, use it"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8210
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8211
    CachedAbbreviations := IdentityDictionary new.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8212
    self installAutoloadedClasses.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8213
    ^ CachedAbbreviations.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8214
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8215
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8216
     Smalltalk readAbbreviations
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8217
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8218
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8219
    "Modified: / 10.12.1999 / 17:48:53 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8220
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8221
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8222
readAbbreviationsFromStream:aStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8223
    "read classname to filename mappings from aStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8224
     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
  8225
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  8226
    self
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8227
	withAbbreviationsFromStream:aStream
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8228
	do:[:className :abbrev :pkg |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8229
	    self setFilename:abbrev forClass:className package:pkg.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8230
	].
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
    "Modified: / 13.12.1999 / 11:54:17 / cg"
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8235
realSystemPath
16642
f98a00a58e5a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16593
diff changeset
  8236
    "return the realSystemPath - that's the directory names from
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8237
     SystemPath which exist and are readable"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8238
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8239
    |nP|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8240
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8241
    RealSystemPath isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8242
	OperatingSystem isVMSlike ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8243
	    "/ temporary kludge: since we cannot currently
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8244
	    "/ check for existence of a name like 'volume:',
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8245
	    "/ leave those in the Path without a check.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8246
	    RealSystemPath := SystemPath select:[:dirName |  |f|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8247
		f := dirName asFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8248
		f isVolumeOnly or:[(f isDirectory) and:[f isReadable]]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8249
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8250
	] ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8251
	    RealSystemPath := SystemPath
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8252
		select:[:eachDirectoryName |  |f|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8253
		    f := eachDirectoryName asFilename.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8254
		    (f isDirectory) and:[f isReadable]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8255
		] thenCollect:[:eachDirectoryName|
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8256
		    eachDirectoryName asFilename pathName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8257
		].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8258
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8259
	    "/ remove duplicates (but keep order)
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8260
	    nP := OrderedCollection new.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8261
	    RealSystemPath do:[:p |
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8262
		(nP includes:p) ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8263
		    nP add:p
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8264
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8265
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8266
	    (nP includes:'.') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8267
		nP add:'.'
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8268
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8269
	    RealSystemPath := nP.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8270
	].
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8271
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8272
    ^ RealSystemPath
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8273
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8274
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8275
recursiveReadAllAbbreviationsFrom:aDirectory
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8276
    self recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:15
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8277
!
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
recursiveReadAllAbbreviationsFrom:aDirectory maxLevels:maxLevels
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8280
    "read all abbreviations from and under aDirectory."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8281
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8282
    |abbrevStream dir directoryContents|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8283
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8284
    maxLevels == 0 ifTrue:[
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8285
"/        'Smalltalk [warning]: max directory nesting reached.' infoPrintCR.
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8286
        ^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8287
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8288
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8289
    dir := aDirectory asFilename.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8290
    dir exists ifFalse:[^ self].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8291
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8292
    [
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8293
        abbrevStream := (dir / 'abbrev.stc') asFilename readStream.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8294
        self readAbbreviationsFromStream:abbrevStream.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8295
        abbrevStream close.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8296
    ] on:OpenError do:[:ex| "ignore this file"].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8297
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8298
    [
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8299
        directoryContents := dir directoryContents.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8300
    ] on:OpenError do:[:ex|
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8301
        "non-accessible directory: we are done"
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8302
        ^ self
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8303
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8304
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8305
    directoryContents do:[:aFilename |
25176
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8306
        |f|
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8307
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8308
        (#(
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8309
            'doc'
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8310
            'CVS'
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8311
            'bitmaps'
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8312
            'resources'
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8313
            'source'
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8314
        ) includes:aFilename) ifFalse:[
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8315
            f := dir / aFilename.
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8316
            f isDirectory ifTrue:[
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8317
                self recursiveReadAllAbbreviationsFrom:f maxLevels:maxLevels-1
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8318
            ]
fb161da81648 #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 25116
diff changeset
  8319
        ].
4458
6f46b35f787c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4431
diff changeset
  8320
    ].
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8321
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8322
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8323
reinitializePackagePath
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8324
    "{ Pragma: +optSpace }"
20207
17e32d469ac6 #OTHER by mawalch
mawalch
parents: 20161
diff changeset
  8325
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8326
    PackagePath notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8327
	PackagePath := PackagePath select:[:p | p asFilename exists].
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8328
    ].
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8329
    PackagePath isEmptyOrNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8330
	PackagePath := OperatingSystem defaultPackagePath
18868
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  8331
    ].
0856cde0eaa4 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 18794
diff changeset
  8332
    self addWorkspaceDirectoryToPackagePath.
15334
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8333
!
aead0a7a558a class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 15333
diff changeset
  8334
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8335
relativePackagePathForPackage:aPackage
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8336
    |path|
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8337
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8338
    PackageToPathMapping notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8339
	path := PackageToPathMapping at:aPackage ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8340
	PackageToPathMapping notNil ifTrue:[^ path].
13370
Claus Gittinger <cg@exept.de>
parents: 13368
diff changeset
  8341
    ].
Claus Gittinger <cg@exept.de>
parents: 13368
diff changeset
  8342
    ^ aPackage copyReplaceAll:$: with:$/.
13368
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8343
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8344
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8345
     PackageToPathMapping := Dictionary new.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8346
     PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8347
     PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'.
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8348
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8349
     Smalltalk relativePackagePathForPackage:'stx:libview/resources'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8350
     Smalltalk relativePackagePathForPackage:'stx:libview'
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8351
    "
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8352
!
00d9e3385e76 class definition
Claus Gittinger <cg@exept.de>
parents: 13353
diff changeset
  8353
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8354
resourceDirectoryForPackage:aPackage
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8355
    "given a packageID, return the path to its resource directory;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8356
     nil if not found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8357
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8358
    |prjDir rsrcDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8359
11183
9a4e7475a655 care for nil project when asked for a resource directory
Claus Gittinger <cg@exept.de>
parents: 11174
diff changeset
  8360
    aPackage notNil ifTrue:[
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8361
        prjDir := self projectDirectoryForPackage:aPackage.
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8362
        (prjDir notNil
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8363
        and:[(prjDir := prjDir asFilename) exists
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8364
        and:[(rsrcDir := prjDir / 'resources') exists]]) ifTrue:[
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8365
            ^ rsrcDir
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8366
        ].
23445
2f2ca1a7aaac #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23433
diff changeset
  8367
        
2f2ca1a7aaac #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23433
diff changeset
  8368
        #( '../Resources' '.resources' 'resources' ) do:[:eachPossibleRsrcDir |
2f2ca1a7aaac #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23433
diff changeset
  8369
            rsrcDir := self getSystemFileName:(eachPossibleRsrcDir,'/',(aPackage copyReplaceAll:$: with:$/)).
2f2ca1a7aaac #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23433
diff changeset
  8370
            rsrcDir notNil ifTrue:[
2f2ca1a7aaac #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23433
diff changeset
  8371
                ^ rsrcDir asFilename
2f2ca1a7aaac #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23433
diff changeset
  8372
            ].
23433
247788b989f6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23419
diff changeset
  8373
        ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8374
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8375
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8376
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8377
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8378
     Smalltalk resourceDirectoryForPackage:'stx:libbasic'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8379
     Smalltalk resourceDirectoryForPackage:'exept:expecco'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8380
     Smalltalk resourceDirectoryForPackage:'exept:smartcard'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8381
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8382
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8383
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8384
resourceFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8385
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8386
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8387
     Searches in subdirectories named 'resource' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8388
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8389
    ^ self resourceFileStreamFor:aFileName forClass:nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8390
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8391
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8392
resourceFileStreamFor:aFileName forClass:aClassOrNil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8393
    "search aFileName in some standard places and in the classes
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8394
     package-resource directory.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8395
     Return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8396
     Searches in subdirectories named 'resource' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8397
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8398
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8399
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8400
    aString := self getResourceFileName:aFileName forClass:aClassOrNil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8401
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8402
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8403
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8404
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8405
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8406
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8407
searchPath:aPath for:aFileName in:aDirName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8408
    "search aPath for a subdirectory named aDirectory with a file
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8409
     named aFileName"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8410
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8411
    |f|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8412
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8413
    ((f := aFileName asFilename) isAbsolute
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8414
    or:[f isExplicitRelative]) ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8415
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8416
	"/ don't use path for absolute or explicit .-relative file names
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8417
	"/
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8418
	^ aFileName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8419
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8420
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8421
    aPath notNil ifTrue:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8422
	aPath do:[:dirName |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8423
	    |realName dir|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8424
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8425
	    dir := dirName asFilename.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8426
	    aDirName notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8427
		realName := dir / aDirName / aFileName.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8428
	    ] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8429
		realName := dir / aFileName.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8430
	    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8431
	    (realName isReadable) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8432
		^ realName name
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8433
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8434
	].
11108
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8435
    ].
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8436
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8437
"/ not needed - executing dir is always in SearchPath
12377
f9a9aea7ba0f changed:13 methods
Claus Gittinger <cg@exept.de>
parents: 12376
diff changeset
  8438
"/    realName := Filename currentDirectory / aFileName.
11108
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8439
"/    (realName isReadable) ifTrue:[
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8440
"/        ^ realName name
a803fa13937a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11093
diff changeset
  8441
"/    ].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8442
    ^ nil.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8443
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8444
    "Modified: / 29.4.1999 / 15:06:43 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8445
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8446
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8447
setFilename:aFileNameString forClass:aClassNameString package:aPackageNameString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8448
    |classNameSymbol oldAbbrev oldPath newPath cls abbrevs|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8449
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8450
    CachedAbbreviations isNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8451
	CachedAbbreviations := IdentityDictionary new.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8452
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8453
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8454
    abbrevs := CachedAbbreviations.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8455
    aClassNameString ~= aFileNameString ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8456
	classNameSymbol := aClassNameString asSymbol.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8457
	oldAbbrev := abbrevs at:classNameSymbol ifAbsent:nil.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8458
	oldAbbrev notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8459
	    oldAbbrev ~= aFileNameString ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8460
		oldAbbrev asFilename isAbsolute
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8461
		    ifTrue:[ oldPath := oldAbbrev ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8462
		    ifFalse:[ oldPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: oldAbbrev ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8463
		aFileNameString asFilename isAbsolute
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8464
		    ifTrue:[ newPath := aFileNameString ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8465
		    ifFalse:[ newPath := (self projectDirectoryForPackage:aPackageNameString) asFilename constructString: aFileNameString ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8466
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8467
		oldPath ~= newPath ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8468
		    StandAlone ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8469
			('Smalltalk [warning]: autoload path change for: ',aClassNameString,' in package ',aPackageNameString) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8470
			('Smalltalk [info]: old: ',oldPath) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8471
			('Smalltalk [info]: new: ',newPath) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8472
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8473
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8474
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8475
	    "overwrite old abbreviation with new one,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8476
	     to allow fixing of bad abbrev files"
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8477
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8478
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8479
	cls := self classNamed:aFileNameString.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8480
	cls notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8481
	    cls name ~= aClassNameString ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8482
		"/ ok, there is a class named after this abbrev ...
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8483
		"/ this is only a conflict, if the other class has no
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8484
		"/ abbreviation (or the same).
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8485
		(abbrevs at:(cls name asSymbol) ifAbsent:cls name) = aFileNameString ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8486
		    cls isNameSpace ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8487
			aPackageNameString = cls package ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8488
			    StandAlone ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8489
				('Smalltalk [warning]: conflict for: ' , cls name ,
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8490
				    ' in package ' , aPackageNameString) infoPrintCR.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8491
				('Smalltalk [warning]: (' , aClassNameString , ' -> ' , aFileNameString
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8492
				    , ')') infoPrintCR
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8493
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8494
			]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8495
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8496
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8497
	    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8498
	].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8499
	abbrevs at:classNameSymbol put:aFileNameString.
8470
d79e917d4f36 Define #setFilename:forClass:package: to define an abbreviation.
Stefan Vogel <sv@exept.de>
parents: 8445
diff changeset
  8500
    ]
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8501
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8502
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8503
sourceDirectoryNameOfClass:aClassOrClassName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8504
    "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
  8505
     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
  8506
     for an entry for aClassOrClassName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8507
     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
  8508
     the 3rd col.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8509
     Return nil if no entry is found."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8510
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8511
    |aStream line words n aClassName|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8512
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8513
    aClassOrClassName isBehavior ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8514
	aClassName := aClassOrClassName name
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8515
    ] ifFalse:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8516
	aClassName := aClassOrClassName
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8517
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8518
    aClassName := aClassName asString.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8519
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8520
    #('include/abbrev.stc' 'include/liblist.stc')    "/ filenames
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8521
    with:#(3 2)                   "/ column
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8522
    do:[:fileName :col |
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8523
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8524
	aStream := self systemFileStreamFor:fileName.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8525
	aStream notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8526
	    [aStream atEnd] whileFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8527
		line := aStream nextLine.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8528
		line notNil ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8529
		    (line startsWith:'#') ifFalse:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8530
			words := line asCollectionOfWords.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8531
			(n := words size) > 1 ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8532
			    (words at:1) = aClassName ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8533
				n >= col ifTrue:[
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8534
				    aStream close.
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8535
				    ^ (words at:col) withoutSeparators
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8536
				]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8537
			    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8538
			]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8539
		    ]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8540
		]
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8541
	    ].
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8542
	    aStream close
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8543
	].
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8544
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8545
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8546
    ^ nil
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8547
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8548
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8549
     Smalltalk sourceDirectoryNameOfClass:'ClockView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8550
     Smalltalk sourceDirectoryNameOfClass:'Bag'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8551
     Smalltalk sourceDirectoryNameOfClass:'GLWireCubeDemoView'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8552
     Smalltalk sourceDirectoryNameOfClass:'SomeNonExistingClass'
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8555
    "Created: 6.11.1995 / 15:43:30 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8556
    "Modified: 9.12.1995 / 23:54:14 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8557
    "Modified: 3.1.1997 / 11:26:44 / stefan"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8558
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8559
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8560
sourceFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8561
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8562
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8563
     Searches in subdirectories named 'source' in SystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8564
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8565
    |aString|
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
    aString := self getSourceFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8568
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8569
	^ aString asFilename readStreamOrNil
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8570
    ].
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8571
    ^ nil
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8572
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8573
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8574
systemFileStreamFor:aFileName
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8575
    "search aFileName in some standard places;
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8576
     return a readonly fileStream or nil if not found.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8577
     see comment in Smalltalk>>initSystemPath"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8578
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8579
    |aString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8580
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8581
    aString := self getSystemFileName:aFileName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8582
    aString notNil ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8583
	^ aString asFilename readStreamOrNil
617
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8584
    ].
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8585
    ^ nil
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8586
!
427245e28240 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
  8587
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8588
systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8589
    "return a collection of directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8590
     looks for system files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8591
     (usually in subdirs such as resources, bitmaps, source etc.)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8592
     see comment in Smalltalk>>initSystemPath."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8593
20640
751b68301857 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20615
diff changeset
  8594
    ^ SystemPath ? #()
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8595
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8596
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8597
     Smalltalk systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8598
     Smalltalk systemPath addLast:'someOtherDirectoryPath'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8599
    "
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8602
systemPath:aPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8603
    "set the collection of directorynames, where smalltalk
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8604
     looks for system files
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8605
     (usually in subdirs such as resources, bitmaps, source etc.)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8606
     see comment in Smalltalk>>initSystemPath."
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
    SystemPath := aPath.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8609
    self flushPathCaches
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8610
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
     Smalltalk systemPath
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8613
     Smalltalk systemPath:(Smalltalk systemPath copy addLast:'someOtherDirectoryPath')
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8614
    "
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8615
!
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8616
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8617
withAbbreviationsFromStream:aStream do:aBlock
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8618
    "read classname to filename mappings from aStream.
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8619
     Evaluate aBlock for each tuple:
24741
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8620
        class-name , abbrev-name, package
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8621
     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
  8622
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8623
    |line lineNo words nm abbrev pkg category size s w|
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8624
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8625
    lineNo := 0.
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8626
    [aStream atEnd] whileFalse:[
24741
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8627
        line := aStream nextLine.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8628
        lineNo := lineNo + 1.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8629
        line notEmptyOrNil ifTrue:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8630
            (line startsWith:'#') ifFalse:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8631
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8632
                "/ must do it manually, caring for quoted strings.
11301
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8633
"/                words := line asCollectionOfWords.
f65ffb560925 refactored abbreviation-reading
Claus Gittinger <cg@exept.de>
parents: 11232
diff changeset
  8634
24741
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8635
                words := OrderedCollection new.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8636
                s := line readStream.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8637
                [s atEnd] whileFalse:[
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  8638
                    s skipSeparators == $' ifTrue:[
24741
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8639
                        s next.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8640
                        w := s upTo:$'.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8641
                        s skipSeparators.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8642
                    ] ifFalse:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8643
                        w := s upToSeparator
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8644
                    ].
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8645
                    words add:w
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8646
                ].
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8647
                words size >= 3 ifTrue:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8648
                    nm := (words at:1) withoutSeparators.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8649
                    abbrev := (words at:2) withoutSeparators.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8650
                    pkg := (words at:3) withoutSeparators.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8651
                    aBlock argumentCount == 3 ifTrue:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8652
                        aBlock value:nm value:abbrev value:pkg.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8653
                    ] ifFalse:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8654
                        words size >= 4 ifTrue:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8655
                            category := words at:4.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8656
                        ].
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8657
                        words size == 5 ifTrue:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8658
                            size := (words at:5) asNumber
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8659
                        ].
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8660
                        aBlock value:nm value:abbrev value:pkg value: category value: size
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8661
                    ]
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8662
                ] ifFalse:[
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8663
                    ('Smalltalk [warning]: malformed line ', lineNo printString , ' in ' , (aStream pathName)) infoPrintCR.
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8664
                ]
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8665
            ]
bdf7f00ee97b #TUNING by exept
Claus Gittinger <cg@exept.de>
parents: 24679
diff changeset
  8666
        ]
13518
b81bc64782b1 not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents: 13506
diff changeset
  8667
    ].
b81bc64782b1 not ifTrue -> ifFalse (trying the rewrite tool ;-)
Claus Gittinger <cg@exept.de>
parents: 13506
diff changeset
  8668
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  8669
    "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
  8670
    "Modified: / 04-08-2011 / 21:35:00 / cg"
24807
cf61f14ef49f #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 24799
diff changeset
  8671
    "Modified: / 28-09-2019 / 15:22:30 / Stefan Vogel"
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8672
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8673
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8674
!Smalltalk class methodsFor:'system management-packages'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8675
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8676
isPackageLoaded:aPackageIdOrPackage
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8677
    |projectDefinition|
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8678
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8679
    projectDefinition := aPackageIdOrPackage asPackageId projectDefinitionClass.
16161
195f2580fa6c class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16159
diff changeset
  8680
    ^ projectDefinition notNil and:[projectDefinition isLoaded and:[projectDefinition isFullyLoaded]]
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8681
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8682
    "
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8683
     Smalltalk isPackageLoaded:'stx:goodies/persistency'
16170
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8684
     Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint'
ca4d03def070 endOfDipatch if running scripts
Claus Gittinger <cg@exept.de>
parents: 16164
diff changeset
  8685
     Smalltalk isPackageLoaded:'stx:goodies/refactoryBrowser/lint/spelling'
16159
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8686
    "
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8687
!
d66db46bd78f class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 16144
diff changeset
  8688
20898
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8689
knownLoadablePackagesDo:aBlock
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8690
    "enumerate loadable packages from the packages folder."
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8691
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8692
    Smalltalk realSystemPath do:[:dirName |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8693
	|packageDir|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8694
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8695
	packageDir := dirName asFilename / 'packages'.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8696
	(packageDir exists and:[packageDir isDirectory]) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8697
	    packageDir directoryContentsAsFilenames sort do:[:fn |
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8698
		|item base nm path parentPath parent isLibrary isApplication isAlreadyLoaded
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8699
		 defClass target type nameComponents packageName packageID|
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8700
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8701
		((fn suffix = 'mcz')
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8702
		or:[ fn isDirectory
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8703
		or:[ (fn baseName startsWith:'.')
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8704
		or:[ (fn baseName = 'README') ]]]) ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8705
		    base := fn withoutSuffix baseName.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8706
		    (base startsWith:'lib') ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8707
			nm := (base copyFrom:4).
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8708
			fn suffix notEmptyOrNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8709
			    type := #library.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8710
			] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8711
			    type := #application.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8712
			]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8713
		    ] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8714
			nm := base.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8715
			type := #application.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8716
		    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8717
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8718
		    (base ~= 'librun') ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8719
			(fn suffix = 'mcz') ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8720
			    packageName := fn withoutSuffix.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8721
			    target := fn.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8722
			] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8723
			    ( #('dll' 'so' 'sl' 'dylib') includes:(fn suffix)) ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8724
				(base startsWith:'lib') ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8725
				    nm := base copyFrom:4.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8726
				] ifFalse:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8727
				    nm := base.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8728
				].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8729
			    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8730
			    nameComponents := nm asCollectionOfSubstringsSeparatedBy:$_.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8731
			    packageName := nameComponents first.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8732
			    nameComponents size > 1 ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8733
				packageName := packageName,':',((nameComponents copyFrom:2) asStringWith:'/')
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8734
			    ].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8735
			].
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8736
			packageName notNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8737
			    aBlock value:packageName value:type value:fn .
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8738
			]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8739
		    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8740
		]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8741
	    ]
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8742
	]
20898
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8743
    ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8744
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8745
    "
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8746
     Smalltalk knownLoadablePackagesDo:[:packageID :type :path |
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8747
	 Transcript showCR:'%1 (%2) in %3' with:packageID with:type with:path.
20898
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8748
     ]
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8749
    "
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8750
!
d640780dabb0 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20885
diff changeset
  8751
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8752
loadPackage:aPackageIdOrPackage
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8753
    "make certain, that some particular package is loaded into the system.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8754
     Return true if loaded, false otherwise."
11668
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8755
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8756
    ^ self loadPackage:aPackageIdOrPackage asAutoloaded:false
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8757
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8758
    "
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8759
     Smalltalk loadPackage:'stx:libbasic'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8760
     Smalltalk loadPackage:'stx:goodies/persistency'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8761
     Smalltalk loadPackage:'cg:cparser'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8762
     Smalltalk loadPackage:'cg:rose'
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8763
    "
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8764
!
a7f22eab5b72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11667
diff changeset
  8765
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8766
packageDirectoryForPackageId:aPackageId
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8767
    "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
  8768
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8769
     Notice that the directory structure is different between the development
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8770
     environment (top for packages is ../../../stx) and delivered stand alone executables,
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8771
     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
  8772
     At runtime, Smalltalk knows about the systemPath setting."
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8773
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8774
    |packageDirName packageDir|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8775
14589
058231c234cb class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 14546
diff changeset
  8776
    packageDirName := aPackageId asPackageId string copyReplaceAll:$: with:$/.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8777
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8778
    packageDir := self getPackageFileName:packageDirName.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8779
    packageDir isNil ifTrue:[
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  8780
        ^ nil.
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
    ^ packageDir asFilename
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8783
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8784
    "
11375
bcdaeec8353c splash support
Claus Gittinger <cg@exept.de>
parents: 11367
diff changeset
  8785
     Smalltalk packageDirectoryForPackageId:'stx:libbasic'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8786
     Smalltalk packageDirectoryForPackageId:'stx:goodies/persistency'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8787
     Smalltalk packageDirectoryForPackageId:'exept:ctypes'
23450
704f8e20673d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23449
diff changeset
  8788
     Smalltalk getPackageFileName:'stx/libview'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8789
    "
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8790
!
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8791
24563
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8792
require:className fromPackage:aPackageIdOrPackage
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8793
    "make certain, that some particular package is loaded into the system,
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8794
     and that a class named className is present.
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8795
     Returns the class, or raises an error, if the load fails."
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8796
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8797
    |cls|
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8798
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8799
    (cls := self classNamed:className) isNil ifTrue:[
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8800
        self requirePackage:aPackageIdOrPackage.
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8801
        (cls := self classNamed:className) isNil ifTrue:[ 
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8802
            NotFoundError 
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8803
                raiseRequestWith:className 
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8804
                errorString:('class not found: %1' bindWith:className).
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8805
            ^ nil
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8806
        ].
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8807
    ].
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8808
    ^ cls
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8809
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8810
    "
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8811
     Smalltalk require:#Array fromPackage:'stx:libbasic'
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8812
    "
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8813
!
dabe24b121db #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24562
diff changeset
  8814
18794
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8815
requirePackage:aPackageIdOrPackage
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8816
    "make certain, that some particular package is loaded into the system.
24679
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8817
     Raises a proceedable error, if the load fails.
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8818
     Returns the package-definition class or nil (if exception was proceeded)."
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8819
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8820
    |packageId def|
24562
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8821
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8822
    (self loadPackage:aPackageIdOrPackage) ifFalse:[
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8823
        PackageNotFoundError 
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8824
            raiseRequestWith:aPackageIdOrPackage 
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8825
            errorString:('require failed to load package: %1' bindWith:aPackageIdOrPackage).
24679
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8826
        ^ nil
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8827
    ].
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8828
    packageId := aPackageIdOrPackage asPackageId.
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8829
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8830
    "/ if there is a projectDefinition, let it load itself...
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8831
    def := packageId projectDefinitionClass.
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8832
    ^ def
24562
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8833
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8834
    "
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8835
     Smalltalk requirePackage:'foobar'
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8836
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8837
     Smalltalk requirePackage:'stx:libbasic'
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8838
     Smalltalk requirePackage:'stx:goodies/bla'
24679
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8839
     Smalltalk requirePackage:'stx:goodies/regression'
28a451eaa355 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24563
diff changeset
  8840
     Smalltalk requirePackage:'exept:ctypes'
24562
33dd11e56674 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24417
diff changeset
  8841
     Smalltalk requirePackage:'cg:rose'
18794
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8842
    "
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8843
!
d9c30cfc3959 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 18733
diff changeset
  8844
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8845
unloadPackage:aPackageIdOrPackage
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8846
    |projectDefinition|
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8847
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8848
    projectDefinition := aPackageIdOrPackage.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8849
    projectDefinition isProjectDefinition ifFalse:[
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8850
	projectDefinition := projectDefinition asPackageId projectDefinitionClass.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8851
	projectDefinition isNil ifTrue:[
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8852
	    Logger warning:'trying to unload non-existing package: %1' with:aPackageIdOrPackage.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8853
	    ^ self.
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8854
	].
12250
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8855
    ].
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8856
    projectDefinition unloadPackage.
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8857
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8858
    "
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8859
     Smalltalk loadPackage:'stx:goodies/persistency'
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8860
     Smalltalk unloadPackage:'stx:goodies/persistency'
1a21bcbad053 added: #unloadPackage:
Claus Gittinger <cg@exept.de>
parents: 12194
diff changeset
  8861
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8862
! !
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8863
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8864
!Smalltalk class methodsFor:'system management-undeclared variables'!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8865
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8866
clearUndeclaredVariables
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8867
    "remove all undeclared variables"
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
    (Smalltalk at:#Undeclared) do:[:eachKey |
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8870
	Smalltalk removeKey:(self undeclaredPrefix , eachKey) asSymbol.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8871
    ].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8872
    (Smalltalk at:#Undeclared) removeAll.
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8873
    Smalltalk removeKey:#Undeclared.
10641
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
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8876
undeclaredPrefix
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8877
    "the prefix used for undeclared variables"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8878
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8879
    ^ 'Undeclared:::'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8880
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8881
    "Created: / 31.10.1997 / 01:13:10 / cg"
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8882
! !
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8883
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8884
!Smalltalk class methodsFor:'time-versions'!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8885
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8886
configuration
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8887
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8888
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8889
    "for developers only: return the configuration, with which
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8890
     this smalltalk was compiled."
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
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8893
    extern char *__getConfigurationString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8894
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8895
    RETURN (__MKSTRING(__getConfigurationString() COMMA_SND));
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8896
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8897
    ^ 'unknownOS/unknownCONF:unknownPACK'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8898
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8899
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  8900
     Smalltalk configuration
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8901
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8902
!
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  8903
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8904
copyrightString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8905
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8906
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8907
    "return a copyright string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8908
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8909
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8910
#ifndef __getCopyrightString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8911
    extern OBJ __getCopyrightString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8912
#endif
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8913
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8914
    RETURN (__getCopyrightString());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8915
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8916
    ^ self primitiveFailed
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8917
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8918
    "
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8919
     Smalltalk copyrightString
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8920
    "
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8921
!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  8922
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8923
distributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8924
    "{ Pragma: +optSpace }"
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 a string describing the distributor of this software"
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
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8929
#ifndef __getDistributorString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8930
    extern OBJ __getDistributorString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8931
#endif
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8932
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8933
    RETURN (__getDistributorString());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8934
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8935
    ^ 'eXept Software AG, Germany'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8936
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
     Smalltalk distributorString
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
!
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
expirationTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8943
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8944
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8945
    "for developers only: return the time when the system will expire.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8946
     after this time it will not run any longer.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8947
     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
  8948
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8949
    |exp|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8950
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8951
%{
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8952
    extern unsigned int __getExpirationTime();
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
    exp = __MKUINT(__getExpirationTime());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8955
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8956
    exp == 0 ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  8957
	^ nil
10641
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
    ^ Timestamp new fromOSTime:(exp * 1000). "OSTime is ms since 1970"
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
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8962
     Smalltalk expirationTime
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8963
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8964
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  8965
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8966
fullVersionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8967
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8968
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8969
    "return a full version string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8970
19516
69d40825637a #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 19511
diff changeset
  8971
    ^ 'Smalltalk/X release %1%2 of %3'
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  8972
        bindWith:(self versionString)
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  8973
        with:((ExternalBytes sizeofPointer == 8)
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  8974
                        ifTrue:[' (64bit)']
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  8975
                        ifFalse:[''])
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  8976
        with:(self versionDate)
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8977
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8978
    "
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  8979
     Smalltalk fullVersionString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8980
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8981
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8982
    "Created: / 27.10.1997 / 17:03:09 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8983
    "Modified: / 27.10.1997 / 17:04:02 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8984
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8985
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8986
hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8987
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8988
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8989
    "return a greeting string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8990
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8991
    "stupid: this should come from a resource file ...
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  8992
     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
  8993
     Resource-stuff."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8994
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8995
    |proto lang bit bitsPerWordString|
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8996
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  8997
    lang := Language.
19187
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8998
    bit := 'bit'.
7730a271c529 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19121
diff changeset
  8999
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9000
    (lang == #de) ifTrue:[
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  9001
        proto := 'Willkommen bei %1 (%4Version %2 von %3)'. bit := 'Bit'.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9002
    ] ifFalse:[ (lang == #fr) ifTrue:[
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9003
        proto := 'Salut, Bienvenue à %1 (%4version %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9004
    ] ifFalse:[ (lang == #it) ifTrue:[
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  9005
        proto := 'Ciao, benvenuto al %1 (%4versione %2 di %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9006
    ] ifFalse:[ (lang == #es) ifTrue:[
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  9007
        proto := 'Hola, bienvenida a %1 (%4version %2 de %3)'
18924
f5063aa4e434 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18868
diff changeset
  9008
    ] ifFalse:[ (lang == #pt) ifTrue:[
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9009
        proto := 'Olá!!, mem-vindo a %1 (%4version %2 de %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9010
    ] ifFalse:[ (lang == #no) ifTrue:[
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  9011
        proto := 'Hei, verdenmottakelse til %1 (%4versjon %2 av %3)'
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9012
    ]]]]]].
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9013
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9014
    "/ ... more needed here ...
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9015
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9016
    proto isNil ifTrue:[
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9017
        proto := 'Hello World - Welcome to %1 (Version %2 (%3bit) of %4)'.
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9018
    ].
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9019
    bitsPerWordString := (ExternalBytes sizeofPointer * 8) printString.
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9020
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9021
    ^ proto bindWith:('SmallTalk/X' allBold)
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  9022
                with:(self versionString)
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9023
                with:bitsPerWordString
22900
8d0aedd02702 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22831
diff changeset
  9024
                with:(self versionDate)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9025
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9026
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9027
     Smalltalk language:#us.
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9028
     Smalltalk hello           
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9029
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9030
     Smalltalk language:#de.
25199
c2b66eb303bc #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 25192
diff changeset
  9031
     Smalltalk hello       
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9032
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9033
     Smalltalk language:#no.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9034
     Smalltalk hello
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9035
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9036
     Transcript showCR:(Smalltalk hello)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9037
     Stdout showCR:(Smalltalk hello)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9038
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9039
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9040
    "Modified: 18.5.1996 / 14:25:13 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9041
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9042
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9043
imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9044
    "return a timestamp for the moment when this image was restarted.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9045
     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
  9046
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9047
    ^ ImageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9048
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9049
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9050
     Smalltalk imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9051
     Smalltalk imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9052
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9053
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9054
    "Created: 13.12.1995 / 17:44:20 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9055
    "Modified: 6.3.1996 / 11:56:35 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9056
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9057
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9058
imageSaveTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9059
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9060
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9061
    "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
  9062
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9063
    ^ ObjectMemory imageSaveTime
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9064
!
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  9065
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9066
imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9067
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9068
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9069
    "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
  9070
     (i.e. the first initial start without an image)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9071
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9072
    ^ ImageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9073
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9074
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9075
     Smalltalk imageStartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9076
     Smalltalk imageRestartTime
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9077
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9078
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9079
    "Created: 13.12.1995 / 17:44:14 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9080
    "Modified: 13.12.1995 / 17:45:47 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9081
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9082
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9083
majorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9084
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9085
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9086
    "return the major version number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9087
     This is only incremented for very fundamental changes,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9088
     which make old object files totally incompatible
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9089
     (for example, if the layout/representation of fundamental
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9090
      classes changes).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9091
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9092
     ST/X revision Naming is:
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  9093
	<major>.<minor>.<revision>.<release>"
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9094
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9095
    ^ 7
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9096
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9097
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9098
     Smalltalk majorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9099
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9100
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9101
    "Modified: / 09-06-2016 / 16:28:40 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9102
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9103
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9104
minorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9105
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9106
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9107
    "return the minor version number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9108
     This is incremented for changes which make some old object
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9109
     files incompatible, or the protocol changes such that some
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9110
     classes need rework.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9111
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9112
     ST/X revision Naming is:
23683
05f38e32876b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23679
diff changeset
  9113
        <major>.<minor>.<revision>.<release>"
05f38e32876b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23679
diff changeset
  9114
25292
baed06d0d302 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 25199
diff changeset
  9115
    ^ 3
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9116
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9117
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9118
     Smalltalk minorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9119
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9120
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9121
    "Modified: / 09-06-2016 / 16:28:45 / cg"
23683
05f38e32876b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23679
diff changeset
  9122
    "Modified: / 08-02-2019 / 22:36:33 / Claus Gittinger"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9123
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9124
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9125
releaseIdentification
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9126
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9127
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9128
    "for developers only: return the release
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9129
     (to further identify the version in case of errors)"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9130
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9131
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9132
    extern OBJ __getRel();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9133
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9134
    RETURN (__getRel());
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9135
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9136
    ^ 'ST/X_experimental'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9137
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9138
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9139
     Smalltalk releaseIdentification
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9140
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9141
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9142
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9143
releaseNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9144
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9145
14542
8ed2cefffa0c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14529
diff changeset
  9146
    "return the release number.
8ed2cefffa0c class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14529
diff changeset
  9147
     Now releaseNr is the build number (BUILD_NUMBER from Jenkins)
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9148
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9149
     ST/X revision Naming is:
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  9150
	<major>.<minor>.<revision>.<release>"
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9151
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9152
    |releaseNumber|
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9153
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9154
    releaseNumber := Smalltalk versionBuildNumber.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9155
    releaseNumber isEmpty ifTrue:[
18668
b8be71e850e1 schteam
Claus Gittinger <cg@exept.de>
parents: 18572
diff changeset
  9156
	^ 0.
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9157
    ].
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9158
    ^ releaseNumber
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9159
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9160
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9161
     Smalltalk releaseNr
12867
2b9cbcea983b version bump - layout of Class, Method and Context changed.
Claus Gittinger <cg@exept.de>
parents: 12861
diff changeset
  9162
     Smalltalk versionString
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9163
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9164
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9165
    "Created: / 10-12-1995 / 01:42:19 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9166
    "Modified: / 10-02-2007 / 14:49:51 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9167
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9168
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9169
revisionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9170
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9171
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9172
    "return the revision number.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9173
     Incremented for releases which fix bugs/add features
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9174
     and represent a stable workable version which got published
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9175
     to the outside world.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9176
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9177
     ST/X revision Naming is:
22791
5aebe8996c2d --silent + --repl
Claus Gittinger <cg@exept.de>
parents: 22707
diff changeset
  9178
	<major>.<minor>.<revision>.<release>"
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9179
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9180
    ^ 0
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9181
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9182
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9183
     Smalltalk revisionNr
13323
68e5bb82f5f7 changed: #loadPackage:fromClassLibrary:
Stefan Vogel <sv@exept.de>
parents: 13303
diff changeset
  9184
     Smalltalk hello string
13014
fe6484596968 changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 13000
diff changeset
  9185
    "
fe6484596968 changed: #revisionNr
Claus Gittinger <cg@exept.de>
parents: 13000
diff changeset
  9186
14898
5afe1d1f7ffe class: Smalltalk
az
parents: 14892
diff changeset
  9187
    "Modified: / 19-03-2013 / 10:48:59 / az"
19974
09283ec7cc62 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19958
diff changeset
  9188
    "Modified: / 09-06-2016 / 16:28:57 / cg"
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9189
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9190
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9191
timeStamp
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9192
    "return a string useful for timestamping a file.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9193
     The returned string is padded with spaces for a constant
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9194
     length (to avoid changing a files size in fileOut with unchanged
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9195
     class)."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9196
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9197
    ^ ('''' , self timeStampString , '''') paddedTo:80 with:(Character space)
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9198
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9199
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9200
timeStamp:aStream
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9201
    "write a string useful for timestamping a file onto aStream.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9202
     ST80 compatibility"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9203
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9204
    aStream nextPutAll:(self timeStamp).
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9205
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9206
    "Created: / 18.6.1998 / 17:22:58 / cg"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9207
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9208
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9209
timeStampString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9210
    "return a string useful for timestamping a file."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9211
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9212
    |dateString|
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9213
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9214
    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
  9215
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9216
    ^ ('From Smalltalk/X, Version:' , (Smalltalk versionString) , ' on '
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9217
       , dateString , ' at ' , Time now printString
7758
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  9218
       )
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  9219
!
526f0a3a74a4 *** empty log message ***
penk
parents: 7757
diff changeset
  9220
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9221
versionBuildNumber
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9222
    "{ Pragma: +optSpace }"
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9223
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9224
    "return the executables build number - that's the jenkins build #.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9225
     Empty if not built by jenkins"
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9226
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9227
%{  /* NOCONTEXT */
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9228
    extern char *__getBuildNumberString();
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9229
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9230
    RETURN (__MKSTRING(__getBuildNumberString() COMMA_SND) );
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9231
%}.
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9232
    ^ ''
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9233
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9234
    "
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9235
     Smalltalk versionBuildNumber
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9236
    "
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9237
!
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9238
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9239
versionDate
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9240
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9241
14522
ae3c24478338 build number
Claus Gittinger <cg@exept.de>
parents: 14487
diff changeset
  9242
    "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
  9243
     executable was built"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9244
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9245
%{  /* NOCONTEXT */
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9246
    extern char *__getBuildDateString();
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9247
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9248
    RETURN (__MKSTRING(__getBuildDateString() COMMA_SND) );
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9249
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9250
    ^ 'today'
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9251
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9252
    "
10071
c3ac1c847c22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10069
diff changeset
  9253
     Smalltalk versionDate
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9254
    "
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9255
!
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9256
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9257
versionString
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9258
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9259
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9260
    "return the version string"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9261
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9262
    ^ (self majorVersionNr printString ,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9263
       '.',
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9264
       self minorVersionNr printString ,
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9265
       '.',
14529
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9266
       self revisionNr printString,
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9267
       '.',
93eb58ca1886 class: Smalltalk
Stefan Vogel <sv@exept.de>
parents: 14522
diff changeset
  9268
       self releaseNr printString)
13771
42c23bea6aaf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13675
diff changeset
  9269
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9270
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9271
    "
8583
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9272
     Smalltalk versionString
2952bfabeaf7 oops - garbage was checked in
Claus Gittinger <cg@exept.de>
parents: 8570
diff changeset
  9273
    "
10641
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9274
!
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9275
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9276
vmMajorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9277
    "{ Pragma: +optSpace }"
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9278
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9279
    "return the VMs major version number."
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9280
%{
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9281
    RETURN (__mkSmallInteger(4));
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9282
%}.
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9283
    ^ 4
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9284
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9285
    "
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9286
     Smalltalk vmMajorVersionNr
e2a4830afe72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10640
diff changeset
  9287
    "
2
claus
parents: 1
diff changeset
  9288
! !
453
57381f377c3f fix logged-arg (was nil)
Claus Gittinger <cg@exept.de>
parents: 452
diff changeset
  9289
1750
36ff7e62388a care for privateClasses in remove
Claus Gittinger <cg@exept.de>
parents: 1713
diff changeset
  9290
!Smalltalk class methodsFor:'documentation'!
630
b785d23d7c5b version at the end
Claus Gittinger <cg@exept.de>
parents: 617
diff changeset
  9291
13532
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  9292
version
18560
a37464a68e70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18385
diff changeset
  9293
    ^ '$Header$'
13532
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  9294
!
638f9bfab880 changed: #recursiveInstallAutoloadedClassesFrom:rememberIn:maxLevels:noAutoload:packageTop:showSplashInLevels:
Claus Gittinger <cg@exept.de>
parents: 13531
diff changeset
  9295
12172
d90a72004f43 changed: #fileNameForClass:
Claus Gittinger <cg@exept.de>
parents: 12033
diff changeset
  9296
version_CVS
18560
a37464a68e70 class: Smalltalk
Claus Gittinger <cg@exept.de>
parents: 18385
diff changeset
  9297
    ^ '$Header$'
13415
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  9298
!
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  9299
ba3e5e6dd910 Jan's changes
vrany
parents: 13385
diff changeset
  9300
version_SVN
15225
80d7f00bfcc0 refactored
Claus Gittinger <cg@exept.de>
parents: 15170
diff changeset
  9301
    ^ '$ 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
  9302
! !
22792
642855917cc2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22791
diff changeset
  9303