Autoload.st
author Claus Gittinger <cg@exept.de>
Sun, 06 Jun 1999 15:16:59 +0200
changeset 4279 3de9eb5ae5e8
parent 4114 9300fc0fae0e
child 4280 f100fa94428f
permissions -rw-r--r--
oops - dont put dQuotes inside a comment-string
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
154
d4236ec280a6 *** empty log message ***
claus
parents: 138
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
    13
nil subclass:#Autoload
938
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
    14
	instanceVariableNames:''
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
    15
	classVariableNames:'LazyLoading AutoloadFailedSignal LoadedClasses'
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
    16
	poolDictionaries:''
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
    17
	category:'Kernel-Classes'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    18
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    20
!Autoload class methodsFor:'documentation'!
68
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    21
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    22
copyright
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    23
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    24
 COPYRIGHT (c) 1991 by Claus Gittinger
154
d4236ec280a6 *** empty log message ***
claus
parents: 138
diff changeset
    25
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    26
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    27
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    28
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    30
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    31
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    32
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    34
!
81dacba7a63a *** empty log message ***
claus
parents: 68
diff changeset
    35
68
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    36
documentation
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    37
"
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    38
    In memory limited systems (as my 8Mb 386 is) all seldom-used classes are made
2662
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    39
    subclasses of this class. 
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    40
    Autoload catches all messages and files-In the corresponding code
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    41
    when first used. 
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
    42
    Then the caught message is resent to the (now existing) class.
2662
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    43
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    44
    Class files are searched along the searchPath (see Smalltalk),
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    45
    and any of binary-classFile, byteCode-classFile or sourceFile are
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    46
    loaded, whichever is found first. For binaries to be loaded,
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    47
    these must be found in the 'bin' directory. Sources must be found
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    48
    in the 'source' directory.
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    49
    (Usually, Autoload classes finds the source file and loads that one).
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    50
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    51
    When started, the patches startup script arranges for the abbreviation
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    52
    file 'include/abbrev.stc' to be read and installs autoload stubs for
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    53
    all classes listed in that file, which do not exists already.
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    54
    The abbreviation file is maintained by the production environment
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    55
    and updated by makefile rules - therefore, it should not be edited
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    56
    manually.
68
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    57
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    58
    Late addition: above comment is no longer true - I have made now almost
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    59
    all Demos & Goodies be autoloaded ... even for big systems.
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    60
1278
7ef5a312d87e commentary
Claus Gittinger <cg@exept.de>
parents: 1277
diff changeset
    61
    [class variables:]
92
0c73b48551ac *** empty log message ***
claus
parents: 88
diff changeset
    62
        
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    63
	LazyLoading             <Boolean>       if true, the loaded classes 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    64
						methods will NOT be compiled at 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    65
						autoload time, but instead when 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    66
						first called. This allows for a 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    67
						faster load. However, expect short 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    68
						pauses later when the methods are
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    69
						first executed.
126
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
    70
                                     
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    71
	AutoloadFailedSignal    <Signal>        signal raised if an autoloaded 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    72
						classes source is not available.
922
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
    73
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    74
	LoadedClasses           <Collection>    set of classes that heve been
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    75
						autoloaded (for later unload)
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
    76
2662
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    77
    [see also:]
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    78
	Smalltalk
2662
51f8054b524e commentary
Claus Gittinger <cg@exept.de>
parents: 2654
diff changeset
    79
1292
89497fff7f87 documentation
Claus Gittinger <cg@exept.de>
parents: 1278
diff changeset
    80
    [author:]
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    81
	Claus Gittinger
68
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    82
"
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    83
! !
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
    84
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
    85
!Autoload class methodsFor:'initialization'!
126
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
    86
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
    87
initialize
2223
87381a043e75 commentary
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
    88
    "initialize the failure-signal"
87381a043e75 commentary
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
    89
126
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
    90
    AutoloadFailedSignal isNil ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    91
	LazyLoading := false.
2654
fb9a81692dbf initialize classVar
Claus Gittinger <cg@exept.de>
parents: 2555
diff changeset
    92
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    93
	AutoloadFailedSignal := Object errorSignal newSignalMayProceed:true.
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    94
	AutoloadFailedSignal nameClass:self message:#autoloadFailedSignal.
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    95
	AutoloadFailedSignal notifierString:'autoload failed '.
197
    96
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    97
	self setSuperclass:nil.
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
    98
	ObjectMemory flushCaches.
126
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
    99
    ]
2223
87381a043e75 commentary
Claus Gittinger <cg@exept.de>
parents: 2112
diff changeset
   100
2654
fb9a81692dbf initialize classVar
Claus Gittinger <cg@exept.de>
parents: 2555
diff changeset
   101
    "Modified: 20.5.1997 / 19:06:25 / cg"
126
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   102
! !
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   103
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   104
!Autoload class methodsFor:'Signal constants'!
126
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   105
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   106
autoloadFailedSignal
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   107
    "return the signal raised when an autoload fails"
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   108
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   109
    ^ AutoloadFailedSignal
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   110
! !
c00c6e25c98c raise a signal on failure
claus
parents: 92
diff changeset
   111
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   112
!Autoload class methodsFor:'adding/removing autoloaded classes'!
359
claus
parents: 356
diff changeset
   113
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   114
addClass:aClassName
4052
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   115
    "given a name, install a corresponding autoload class stub for it.
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   116
     Return the (autoload-) stubClass or nil, if no new class was created."
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   117
4052
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   118
    ^ self addClass:aClassName inCategory:'autoloaded-Classes'
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   119
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   120
    "
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   121
     Autoload addClass:'Clock'
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   122
    "
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   123
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   124
    "Modified: 24.4.1996 / 19:54:16 / cg"
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   125
!
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   126
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   127
addClass:aClassName inCategory:aCategory
4052
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   128
    "given a name, install a corresponding autoload class stub for it.
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   129
     Return the (autoload-) stubClass or nil, if no new class was created."
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   130
4052
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   131
    |nameSymbol cls|
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   132
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   133
    nameSymbol := aClassName asSymbol.
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   134
    (Smalltalk at:nameSymbol) isNil ifTrue:[
4052
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   135
        cls := Autoload 
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   136
                subclass:nameSymbol
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   137
                instanceVariableNames:''
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   138
                classVariableNames:''
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   139
                poolDictionaries:''
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   140
                category:aCategory.
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   141
    ].
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   142
    ^ cls
7b126a2f20ee checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4033
diff changeset
   143
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   144
    "
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   145
     Autoload addClass:'Clock' inCategory:'autoloaded-Demos'
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   146
    "
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   147
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   148
    "Modified: 24.4.1996 / 19:54:20 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   149
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   150
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   151
removeClass:aClass
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   152
    "remove a class from the list of loaded classes"
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   153
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   154
    LoadedClasses remove:aClass ifAbsent:[]
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   155
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   156
    "Modified: 24.4.1996 / 19:54:35 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   157
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   158
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   159
!Autoload class methodsFor:'fileout'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   160
2067
36226285e85e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
   161
basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   162
    "print an expression to define myself on aStream.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   163
     Since autoloaded classes dont know their real definition, simply
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   164
     output some comment string making things clear in the browser."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   165
4016
e0fc2cf0cf03 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4014
diff changeset
   166
    |myName fileName nm mgr classFileName packageDir package|
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   167
2067
36226285e85e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2062
diff changeset
   168
    (self == Autoload) ifTrue:[^ super basicFileOutDefinitionOn:aStream withNameSpace:forceNameSpace].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   169
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   170
    myName := self name.
1952
18cfc11b49fa use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   171
    aStream nextPutAll:'"' ; nextPutLine:'Notice from Autoload:'; cr;
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   172
            spaces:4; nextPutLine:myName , ' is not yet loaded.'; cr.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   173
    aStream nextPutAll:'to load, execute: '.
1952
18cfc11b49fa use #nextPutLine instead of #nextPutAll; #cr
Claus Gittinger <cg@exept.de>
parents: 1862
diff changeset
   174
    aStream cr; cr; spaces:4; nextPutLine:myName  , ' autoload'.
2019
8f44b270809b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
   175
    aStream cr; nextPutLine:'or use the browsers load-function (in the class menu).'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   176
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   177
     the following is simply informative ...
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   178
     actually, its a hack & kludge - there ought to be a method for this
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   179
     in Smalltalk 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   180
     (knowing the details of loading here is no good coding style)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   181
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   182
    fileName := Smalltalk fileNameForClass:myName.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   183
    (ObjectFileLoader notNil and:[Smalltalk loadBinaries]) ifTrue:[
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   184
        (nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   185
            nm := nm , ' (a classLibrary, possibly including more classes)'
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   186
        ] ifFalse:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   187
            nm := Smalltalk getBinaryFileName:(fileName , '.so').
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   188
            nm isNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   189
                nm := Smalltalk getBinaryFileName:(fileName , '.o')
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   190
            ].
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   191
            nm notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   192
                nm := nm , ' (a classBinary)'
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   193
            ]
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   194
        ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   195
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   196
    nm isNil ifTrue:[
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   197
        package := self package.
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   198
        package notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   199
            nm := Smalltalk getSourceFileName:((package copyReplaceAll:$: with:$/) , '/' , fileName , '.st').
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   200
        ].
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   201
        nm isNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   202
            nm := Smalltalk getSourceFileName:(fileName , '.st').
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   203
        ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   204
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   205
    nm notNil ifTrue:[
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   206
        aStream cr; nextPutLine:'When accessed, ' , myName , ' will automatically be loaded'.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   207
        aStream nextPutLine:'from: '; spaces:4; nextPutAll:nm.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   208
        nm asFilename isSymbolicLink ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   209
            aStream cr; cr.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   210
            aStream nextPutLine:'which is a link to: '; spaces:4; 
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   211
                    nextPutAll:(nm asFilename linkInfo path).
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   212
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   213
    ] ifFalse:[
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   214
        aStream cr; nextPutLine:'There is currently no file to load ' , myName , ' from.'; cr.
709
c31cbd5e5323 more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
   215
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   216
        (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   217
            classFileName := Smalltalk fileNameForClass:myName.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   218
            packageDir := Smalltalk sourceDirectoryNameOfClass:myName.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   219
        ].
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   220
        (classFileName notNil and:[packageDir notNil]) ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   221
            aStream nextPutAll:'When accessed, I''ll ask the sourceCodeManager to load the code 
4279
3de9eb5ae5e8 oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents: 4114
diff changeset
   222
from ''' , classFileName , '.st'' in the ''' , packageDir , ''' package.'.
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   223
        ] ifFalse:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   224
            aStream nextPutAll:'When accessed, an error will be reported.'.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   225
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   226
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   227
    aStream cr; nextPutAll:'"'.
709
c31cbd5e5323 more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
   228
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   229
    "Created: / 5.1.1997 / 14:31:33 / cg"
4279
3de9eb5ae5e8 oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents: 4114
diff changeset
   230
    "Modified: / 6.6.1999 / 15:15:17 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   231
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   232
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   233
!Autoload class methodsFor:'lazy compilation'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   234
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   235
compileLazy
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   236
    "return the lazy loading flag - if on, fileIn is much faster,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   237
     but pauses are to be expected later, since methods are compiled
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   238
     when first executed."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   239
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   240
    ^ LazyLoading
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   241
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   242
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   243
compileLazy:aBoolean
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   244
    "turn on/off lazy loading - if on, fileIn is much faster,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
     but pauses are to be expected later, since methods are compiled
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   246
     when first executed.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
     If you like it, add a line to your startup file."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   248
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   249
    LazyLoading := aBoolean
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   250
! !
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   251
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   252
!Autoload class methodsFor:'loading'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   253
a27a279701f8 Initial revision
claus
parents:
diff changeset
   254
autoload
a27a279701f8 Initial revision
claus
parents:
diff changeset
   255
    "use this to force loading
2062
762e951d42b8 #initialize
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
   256
     - it is defined a noop in all non-autoloading classes"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   257
4033
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   258
    |mySelf myName myNameSpace newClass oldMeta project prevMode 
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   259
     package newPackage|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   260
a27a279701f8 Initial revision
claus
parents:
diff changeset
   261
    mySelf := self.
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   262
    myName := self name asSymbol.
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   263
    myNameSpace := self nameSpace.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   264
a27a279701f8 Initial revision
claus
parents:
diff changeset
   265
    "remove myself - to avoid recompilation"
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   266
    Smalltalk at:myName put:nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   267
2
claus
parents: 1
diff changeset
   268
    "load it"
1566
b1968c0d02bd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
   269
    (Object infoPrinting and:[Smalltalk silentLoading ~~ true]) ifTrue:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   270
        Transcript showCR:('autoloading ', myName , ' ...'); endEntry.
1564
f3f9736bd0fa suppress load messages, if infoPrinting is turned off
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   271
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   272
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   273
    [
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   274
        prevMode := ClassCategoryReader sourceMode.
1720
831096ab21a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
   275
"/
831096ab21a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
   276
"/ no- do not do this; it may lead to trouble ...
831096ab21a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
   277
"/        ClassCategoryReader sourceMode:#reference.
1694
29791fde790e autoload classes keep source reference
Claus Gittinger <cg@exept.de>
parents: 1674
diff changeset
   278
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   279
        "/
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   280
        "/ in order to not get a package of private (or whatever),
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   281
        "/ temporarily set the currentProject to nil.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   282
        "/ we will later set the classes package to something useful
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   283
        "/
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   284
        Project notNil ifTrue:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   285
            project := Project current.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   286
            Project setProject:nil.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   287
        ].
2375
7eb1b35edc33 autoload into Smalltalk nameSpace - by default.
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   288
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   289
        Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   290
        do:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   291
            package := self package.
4114
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   292
"/            package notNil ifTrue:[
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   293
"/                (package includes:$:) ifTrue:[
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   294
"/                    package := package asString copyReplaceAll:$: with:$/
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   295
"/                ] ifFalse:[
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   296
"/                    package := 'stx/' , package
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   297
"/                ]
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   298
"/            ].
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   299
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   300
            (Smalltalk 
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   301
                fileInClass:myName
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   302
                package:package
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   303
                initialize:false 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   304
                lazy:LazyLoading
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   305
                silent:nil) isNil ifTrue:[
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   306
                "/ temporary: try without stx/package prefix
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   307
                "/ this will vanishas soon as source-directory
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   308
                "/ is always guaranteed to contain an stx-subtree
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   309
                (package startsWith:'stx/') ifTrue:[
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   310
                    package := package copyFrom:5.
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   311
                    Smalltalk 
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   312
                        fileInClass:myName
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   313
                        package:package
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   314
                        initialize:false 
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   315
                        lazy:LazyLoading
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   316
                        silent:nil.
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   317
                ]
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   318
            ]
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   319
        ].
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   320
        ClassCategoryReader sourceMode:prevMode.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   321
        project notNil ifTrue:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   322
            Project setProject:project.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   323
        ].
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   324
    ] valueOnUnwindDo:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   325
        ClassCategoryReader sourceMode:prevMode.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   326
        project notNil ifTrue:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   327
            Project setProject:project.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   328
        ].
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   329
        Smalltalk at:myName put:mySelf.
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   330
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   331
a27a279701f8 Initial revision
claus
parents:
diff changeset
   332
    "did it work ?"
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   333
    newClass := Smalltalk at:myName.
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   334
    Smalltalk at:myName put:mySelf.   "will be undone by become:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   335
138
c9f46b635f98 *** empty log message ***
claus
parents: 126
diff changeset
   336
    "no - report the error"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   337
    newClass isNil ifTrue:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   338
        "
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   339
         this signal is raised, if an autoloaded class
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   340
         cannot be loaded. Usually, this happends when
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   341
         some sourcefile is missing, not readable or if 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   342
         an entry is missing in the abbreviation file.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   343
         Check for a readable file named <myName>.st 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   344
         in the 'source' directory and (if its a long fileName) 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   345
         for a corresponding entry in the abbreviation file
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   346
         'include/abbrev.stc'.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   347
         Finally, your searchpath could be set wrong -
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   348
         both 'source' and 'include' directories must be found in
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   349
         one of the directories named in systemPath.
154
d4236ec280a6 *** empty log message ***
claus
parents: 138
diff changeset
   350
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   351
         In the debugger, press 'abort' to continue execution.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   352
        " 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   353
        AutoloadFailedSignal
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   354
            raiseRequestWith:self
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   355
            errorString:('autoload of ' , myName , ' failed').
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   356
        ^ nil
938
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   357
    ].
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   358
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   359
    "/
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   360
    "/ autoloaded classes get their package from the revision (if present)
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   361
    "/ this only happens with autoloaded sourceFiles which have no package
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   362
    "/ info encoded. (binary classes have it)
2057
35003ed4b817 care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents: 2019
diff changeset
   363
    "/ If there is no such information, give it my package (if I have one)
938
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   364
    "/
4033
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   365
    newClass setPackageFromRevision.
4011
cc80bf78916d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
   366
4033
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   367
    newPackage := newClass package.
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   368
    (newPackage isNil or:[newPackage = 'no package']) ifTrue:[
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   369
        (package notNil and:[package ~= 'no package']) ifTrue:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   370
            newClass setPackage:package.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   371
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   372
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   373
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   374
    LoadedClasses isNil ifTrue:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   375
        LoadedClasses := IdentitySet new.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   376
    ].
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   377
    LoadedClasses add:newClass.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   378
154
d4236ec280a6 *** empty log message ***
claus
parents: 138
diff changeset
   379
    "wow - it worked. now the big trick ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   380
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   381
"/    newClass class setSoleInstance:self.   "/ will be undone by become ...
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   382
    oldMeta := self class.
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   383
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   384
"/ self setName:(self name , ' (auto)').
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   385
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   386
    self becomeSameAs:newClass.
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   387
    oldMeta becomeSameAs:newClass class.
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   388
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   389
    ObjectMemory flushCaches.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   390
    LoadedClasses rehash.
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   391
3443
d57ea75d3ac5 oops - must send #initialize to all privateClasses.
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   392
    newClass initializeWithAllPrivateClasses.
886
62c66d49077d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
   393
    newClass postAutoload.
62c66d49077d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
   394
    ^ newClass
938
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   395
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   396
    "Modified: / 5.3.1999 / 12:59:13 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   397
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   398
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   399
!Autoload class methodsFor:'message catching'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   400
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   401
basicNew
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   402
    "catch basicNew - load the class and send it to the real one"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   403
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   404
    ^ self doesNotUnderstand:(Message selector:#basicNew)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   405
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   406
    "Modified: 24.4.1996 / 19:53:10 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   407
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   408
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   409
basicNew:arg
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   410
    "catch basicNew: - load the class and send it to the real one"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   411
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   412
    ^ self doesNotUnderstand:(Message selector:#basicNew: with:arg)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   413
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   414
    "Modified: 24.4.1996 / 19:53:16 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   415
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   416
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   417
comment
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   418
    "return the classes comment.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   419
     Autoloaded classes have no comment; but I myself have one"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   420
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   421
    (self == Autoload) ifTrue:[^ super comment].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   422
    ^ 'not yet loaded'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   423
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   424
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   425
doesNotUnderstand:aMessage
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   426
    "caught a message; load the class and retry the message"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   427
a27a279701f8 Initial revision
claus
parents:
diff changeset
   428
    |newClass|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   429
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   430
    self ~~ Autoload ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   431
	newClass := self autoload.
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   432
	newClass notNil ifTrue:[
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   433
	    ^ newClass perform:(aMessage selector)
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   434
		 withArguments:(aMessage arguments)
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   435
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   436
    ].
789
155eca125ef0 return value from doesNotUnderstand (so handler can return a value)
Claus Gittinger <cg@exept.de>
parents: 739
diff changeset
   437
    ^ super doesNotUnderstand:aMessage
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   438
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   439
    "Modified: 24.4.1996 / 19:53:27 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   440
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   441
a27a279701f8 Initial revision
claus
parents:
diff changeset
   442
new
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   443
    "catch new - load the class and resend #new to the real one"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   444
a27a279701f8 Initial revision
claus
parents:
diff changeset
   445
    ^ self doesNotUnderstand:(Message selector:#new)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   446
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   447
    "Modified: 26.5.1997 / 14:59:52 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   448
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   449
a27a279701f8 Initial revision
claus
parents:
diff changeset
   450
new:arg
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   451
    "catch new: - load the class and resend #new: it to the real one"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   452
a27a279701f8 Initial revision
claus
parents:
diff changeset
   453
    ^ self doesNotUnderstand:(Message selector:#new: with:arg)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   454
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   455
    "Modified: 26.5.1997 / 14:59:58 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   456
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   457
1438
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   458
readFrom:aStream 
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   459
    "catch  - load the class and send it to the real one"
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   460
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   461
    ^ self doesNotUnderstand:(Message selector:#readFrom: with:aStream)
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   462
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   463
    "Created: 22.5.1996 / 23:44:23 / stefan"
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   464
!
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   465
1437
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   466
readFrom:aStream onError:exceptionBlock
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   467
    "catch  - load the class and send it to the real one"
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   468
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   469
    ^ self doesNotUnderstand:(Message selector:#readFrom:onError: with:aStream with:exceptionBlock)
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   470
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   471
    "Created: 22.5.1996 / 23:03:39 / stefan"
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   472
!
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   473
1438
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   474
readFromString:aString
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   475
    "catch  - load the class and send it to the real one"
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   476
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   477
    ^ self doesNotUnderstand:(Message selector:#readFromString: with:aString)
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   478
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   479
    "Created: 22.5.1996 / 23:46:15 / stefan"
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   480
!
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   481
1437
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   482
readFromString:aString onError:exceptionBlock
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   483
    "catch  - load the class and send it to the real one"
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   484
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   485
    ^ self doesNotUnderstand:(Message selector:#readFromString:onError: with:aString with:exceptionBlock)
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   486
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   487
    "Created: 22.5.1996 / 23:04:49 / stefan"
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   488
!
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   489
2691
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   490
respondsTo:aSelector
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   491
    "catch respondsTo: - load the class and resend #respondsTo: it to the real one"
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   492
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   493
    self == Autoload ifTrue:[
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   494
	^ super respondsTo:aSelector
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   495
    ].
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   496
    ^ self doesNotUnderstand:(Message selector:#respondsTo: with:aSelector)
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   497
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   498
    "Modified: 26.5.1997 / 14:59:58 / cg"
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   499
!
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   500
2366
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   501
subclass:nameSymbol instanceVariableNames:instVarNames classVariableNames:cVarNames poolDictionaries:pools category:cat
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   502
    "catch subclass creation - this forces missing superclasses to be 
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   503
     loaded first"
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   504
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   505
    ^ self
4054
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   506
        subclass:nameSymbol     
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   507
        instanceVariableNames:instVarNames 
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   508
        classVariableNames:cVarNames 
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   509
        poolDictionaries:pools 
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   510
        category:cat
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   511
        inEnvironment:(Class nameSpaceQuerySignal query)
2366
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   512
4054
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   513
    "Modified: / 8.2.1997 / 20:06:22 / cg"
38ec2abfe9ff Use #query instead of #raise to invoke QuerySignals
Stefan Vogel <sv@exept.de>
parents: 4052
diff changeset
   514
    "Modified: / 18.3.1999 / 18:10:20 / stefan"
2366
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   515
!
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   516
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   517
subclass:nameSymbol instanceVariableNames:instVarNames classVariableNames:cVarNames poolDictionaries:poolDicts category:cat inEnvironment:aNameSpace
2
claus
parents: 1
diff changeset
   518
    "catch subclass creation - this forces missing superclasses to be 
claus
parents: 1
diff changeset
   519
     loaded first"
claus
parents: 1
diff changeset
   520
68
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
   521
    |newClass sel args|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   522
2
claus
parents: 1
diff changeset
   523
    "take care: subclassing Autoload must still be possible"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   524
    (self == Autoload) ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   525
	^ super 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   526
	    subclass:nameSymbol 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   527
	    instanceVariableNames:instVarNames
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   528
	    classVariableNames:cVarNames
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   529
	    poolDictionaries:poolDicts
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   530
	    category:cat
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   531
	    inEnvironment:aNameSpace
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   532
    ].
2366
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   533
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   534
    newClass := self autoload.
68
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
   535
    sel := thisContext selector.
59faa75185ba *** empty log message ***
claus
parents: 22
diff changeset
   536
    args := thisContext args.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   537
    newClass notNil ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   538
	^ newClass perform:sel withArguments:args
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   539
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   540
    ^ nil
2366
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   541
bbe8c60d7c9f additional entry, passing the environment
Claus Gittinger <cg@exept.de>
parents: 2223
diff changeset
   542
    "Created: 8.2.1997 / 19:42:47 / cg"
2531
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   543
!
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   544
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   545
subclass:nameSymbol instanceVariableNames:instVarNames classVariableNames:cVarNames poolDictionaries:poolDicts privateIn:owningClass
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   546
    "catch subclass creation - this forces missing superclasses to be 
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   547
     loaded first"
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   548
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   549
    |newClass sel args|
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   550
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   551
    "take care: subclassing Autoload must still be possible"
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   552
    (self == Autoload) ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   553
	^ super 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   554
	    subclass:nameSymbol 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   555
	    instanceVariableNames:instVarNames 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   556
	    classVariableNames:cVarNames 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   557
	    poolDictionaries:poolDicts 
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   558
	    privateIn:owningClass
2531
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   559
    ].
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   560
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   561
    newClass := self autoload.
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   562
    sel := thisContext selector.
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   563
    args := thisContext args.
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   564
    newClass notNil ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   565
	^ newClass perform:sel withArguments:args
2531
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   566
    ].
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   567
    ^ nil
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   568
1e22ac3610a4 care for private classes being subclass of an autoloadedClass.
ca
parents: 2375
diff changeset
   569
    "Created: 8.2.1997 / 19:42:47 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   570
! !
11
6bf3080856be *** empty log message ***
claus
parents: 5
diff changeset
   571
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   572
!Autoload class methodsFor:'queries'!
356
claus
parents: 345
diff changeset
   573
4011
cc80bf78916d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
   574
allPrivateClassesDo:aBlock
cc80bf78916d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
   575
    "an autoloaded class has none"
cc80bf78916d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
   576
!
cc80bf78916d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
   577
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   578
isBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   579
    "return true if the recevier is some kind of class.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   580
     Autoloaded classes are definitely; therefore return true."
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   581
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   582
    ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   583
!
356
claus
parents: 345
diff changeset
   584
729
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   585
isBuiltInClass
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   586
    "return true if this class is known by the run-time-system.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   587
     Returns false here."
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   588
729
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   589
    ^ false
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   590
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   591
    "Created: 10.12.1995 / 00:28:22 / cg"
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   592
    "Modified: 23.4.1996 / 15:55:36 / cg"
729
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   593
!
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   594
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   595
isLoaded
3287
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   596
    "return true, if the class has been loaded.
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   597
     Autoload itself is loaded, subclasses are not.
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   598
     This allows testing wether a class has already been loaded."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   599
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   600
    ^ (self == Autoload)
3287
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   601
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   602
    "Modified: / 16.2.1998 / 11:57:35 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   603
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   604
922
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   605
loadedClasses
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   606
    "return the set of classes that were autoloaded"
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   607
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   608
    ^ LoadedClasses
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   609
!
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   610
4000
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   611
privateClasses
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   612
    "an autoloaded class has none"
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   613
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   614
    ^ #()
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   615
!
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   616
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   617
wasAutoloaded:aClass
922
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   618
    "return true, if aClass was autoloaded"
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   619
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   620
    ^ LoadedClasses notNil and:[LoadedClasses includes:aClass]
11
6bf3080856be *** empty log message ***
claus
parents: 5
diff changeset
   621
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   622
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   623
!Autoload class methodsFor:'documentation'!
661
7e1c7358c980 version method at the end
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   624
7e1c7358c980 version method at the end
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   625
version
4279
3de9eb5ae5e8 oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents: 4114
diff changeset
   626
    ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.91 1999-06-06 13:16:59 cg Exp $'
661
7e1c7358c980 version method at the end
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   627
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   628
Autoload initialize!