Autoload.st
author Claus Gittinger <cg@exept.de>
Mon, 02 Aug 1999 18:06:38 +0200
changeset 4496 28f3f57dbe60
parent 4401 d9667432d35b
child 4511 da0b327f3204
permissions -rw-r--r--
checkin from browser
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'.
4280
f100fa94428f oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents: 4279
diff changeset
   175
    aStream cr; nextPutLine:'or use the browsers load-function (in the class menu)'.
f100fa94428f oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents: 4279
diff changeset
   176
    aStream nextPutLine:'(double-click on the class will also load it).'.
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   177
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   178
     the following is simply informative ...
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   179
     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
   180
     in Smalltalk 
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   181
     (knowing the details of loading here is no good coding style)
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   182
    "
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   183
    fileName := Smalltalk fileNameForClass:myName.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   184
    (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
   185
        (nm := Smalltalk libraryFileNameOfClass:myName) notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   186
            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
   187
        ] ifFalse:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   188
            nm := Smalltalk getBinaryFileName:(fileName , '.so').
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   189
            nm isNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   190
                nm := Smalltalk getBinaryFileName:(fileName , '.o')
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   191
            ].
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   192
            nm notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   193
                nm := nm , ' (a classBinary)'
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   194
            ]
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   195
        ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   196
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   197
    nm isNil ifTrue:[
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   198
        package := self package.
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   199
        package notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   200
            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
   201
        ].
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   202
        nm isNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   203
            nm := Smalltalk getSourceFileName:(fileName , '.st').
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   204
        ].
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   205
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   206
    nm notNil ifTrue:[
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   207
        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
   208
        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
   209
        nm asFilename isSymbolicLink ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   210
            aStream cr; cr.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   211
            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
   212
                    nextPutAll:(nm asFilename linkInfo path).
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   213
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   214
    ] ifFalse:[
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   215
        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
   216
4014
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   217
        (mgr := Smalltalk at:#SourceCodeManager) notNil ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   218
            classFileName := Smalltalk fileNameForClass:myName.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   219
            packageDir := Smalltalk sourceDirectoryNameOfClass:myName.
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   220
        ].
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   221
        (classFileName notNil and:[packageDir notNil]) ifTrue:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   222
            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
   223
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
   224
        ] ifFalse:[
e9040614767a search for source in <module>/<package>/file.st
Claus Gittinger <cg@exept.de>
parents: 4011
diff changeset
   225
            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
   226
        ]
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   227
    ].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   228
    aStream cr; nextPutAll:'"'.
709
c31cbd5e5323 more info for autoloaded classes (for browsers definition text)
Claus Gittinger <cg@exept.de>
parents: 661
diff changeset
   229
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   230
    "Created: / 5.1.1997 / 14:31:33 / cg"
4280
f100fa94428f oops - dont put dQuotes inside a comment-string
Claus Gittinger <cg@exept.de>
parents: 4279
diff changeset
   231
    "Modified: / 6.6.1999 / 15:17:30 / cg"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   232
! !
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   233
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   234
!Autoload class methodsFor:'lazy compilation'!
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   235
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   236
compileLazy
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   237
    "return the lazy loading flag - if on, fileIn is much faster,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   238
     but pauses are to be expected later, since methods are compiled
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   239
     when first executed."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   240
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   241
    ^ LazyLoading
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   244
compileLazy:aBoolean
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   245
    "turn on/off lazy loading - if on, fileIn is much faster,
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   246
     but pauses are to be expected later, since methods are compiled
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   247
     when first executed.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   248
     If you like it, add a line to your startup file."
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   249
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   250
    LazyLoading := aBoolean
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   251
! !
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   252
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   253
!Autoload class methodsFor:'loading'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   254
a27a279701f8 Initial revision
claus
parents:
diff changeset
   255
autoload
a27a279701f8 Initial revision
claus
parents:
diff changeset
   256
    "use this to force loading
2062
762e951d42b8 #initialize
Claus Gittinger <cg@exept.de>
parents: 2061
diff changeset
   257
     - it is defined a noop in all non-autoloading classes"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   258
4033
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   259
    |mySelf myName myNameSpace newClass oldMeta project prevMode 
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   260
     package newPackage|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   261
a27a279701f8 Initial revision
claus
parents:
diff changeset
   262
    mySelf := self.
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   263
    myName := self name asSymbol.
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   264
    myNameSpace := self nameSpace.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   265
a27a279701f8 Initial revision
claus
parents:
diff changeset
   266
    "remove myself - to avoid recompilation"
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   267
    Smalltalk at:myName put:nil.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   268
2
claus
parents: 1
diff changeset
   269
    "load it"
1566
b1968c0d02bd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1564
diff changeset
   270
    (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
   271
        Transcript showCR:('autoloading ', myName , ' ...'); endEntry.
1564
f3f9736bd0fa suppress load messages, if infoPrinting is turned off
Claus Gittinger <cg@exept.de>
parents: 1438
diff changeset
   272
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   273
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   274
    [
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   275
        prevMode := ClassCategoryReader sourceMode.
1720
831096ab21a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
   276
"/
831096ab21a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
   277
"/ no- do not do this; it may lead to trouble ...
831096ab21a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1694
diff changeset
   278
"/        ClassCategoryReader sourceMode:#reference.
1694
29791fde790e autoload classes keep source reference
Claus Gittinger <cg@exept.de>
parents: 1674
diff changeset
   279
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   280
        "/
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   281
        "/ 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
   282
        "/ 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
   283
        "/ 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
   284
        "/
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   285
        Project notNil ifTrue:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   286
            project := Project current.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   287
            Project setProject:nil.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   288
        ].
2375
7eb1b35edc33 autoload into Smalltalk nameSpace - by default.
Claus Gittinger <cg@exept.de>
parents: 2366
diff changeset
   289
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   290
        Class nameSpaceQuerySignal answer:myNameSpace "Smalltalk" 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   291
        do:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   292
            package := self package.
4114
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   293
"/            package notNil ifTrue:[
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   294
"/                (package includes:$:) ifTrue:[
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   295
"/                    package := package asString copyReplaceAll:$: with:$/
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   296
"/                ] ifFalse:[
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   297
"/                    package := 'stx/' , package
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   298
"/                ]
9300fc0fae0e do not modify the package-ID (replacing : with /)
Claus Gittinger <cg@exept.de>
parents: 4054
diff changeset
   299
"/            ].
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   300
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   301
            (Smalltalk 
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   302
                fileInClass:myName
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   303
                package:package
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   304
                initialize:false 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   305
                lazy:LazyLoading
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   306
                silent:nil) isNil ifTrue:[
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   307
                "/ temporary: try without stx/package prefix
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   308
                "/ 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
   309
                "/ 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
   310
                (package startsWith:'stx/') ifTrue:[
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   311
                    package := package copyFrom:5.
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   312
                    Smalltalk 
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   313
                        fileInClass:myName
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   314
                        package:package
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   315
                        initialize:false 
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   316
                        lazy:LazyLoading
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   317
                        silent:nil.
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   318
                ]
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   319
            ]
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   320
        ].
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   321
        ClassCategoryReader sourceMode:prevMode.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   322
        project notNil ifTrue:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   323
            Project setProject:project.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   324
        ].
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   325
    ] valueOnUnwindDo:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   326
        ClassCategoryReader sourceMode:prevMode.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   327
        project notNil ifTrue:[
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   328
            Project setProject:project.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   329
        ].
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   330
        Smalltalk at:myName put:mySelf.
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   331
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   332
a27a279701f8 Initial revision
claus
parents:
diff changeset
   333
    "did it work ?"
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   334
    newClass := Smalltalk at:myName.
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   335
    Smalltalk at:myName put:mySelf.   "will be undone by become:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   336
138
c9f46b635f98 *** empty log message ***
claus
parents: 126
diff changeset
   337
    "no - report the error"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   338
    newClass isNil ifTrue:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   339
        "
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   340
         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
   341
         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
   342
         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
   343
         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
   344
         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
   345
         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
   346
         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
   347
         'include/abbrev.stc'.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   348
         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
   349
         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
   350
         one of the directories named in systemPath.
154
d4236ec280a6 *** empty log message ***
claus
parents: 138
diff changeset
   351
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   352
         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
   353
        " 
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   354
        AutoloadFailedSignal
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   355
            raiseRequestWith:self
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   356
            errorString:('autoload of ' , myName , ' failed').
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   357
        ^ nil
938
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
    "/
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   361
    "/ 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
   362
    "/ 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
   363
    "/ info encoded. (binary classes have it)
2057
35003ed4b817 care for the package ID when autoloading
Claus Gittinger <cg@exept.de>
parents: 2019
diff changeset
   364
    "/ 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
   365
    "/
4033
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   366
    newClass setPackageFromRevision.
4011
cc80bf78916d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4000
diff changeset
   367
4033
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   368
    newPackage := newClass package.
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   369
    (newPackage isNil or:[newPackage = 'no package']) ifTrue:[
6bd3f16bc897 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4025
diff changeset
   370
        (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
   371
            newClass setPackage:package.
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   372
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   373
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   374
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   375
    LoadedClasses isNil ifTrue:[
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   376
        LoadedClasses := IdentitySet new.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   377
    ].
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   378
    LoadedClasses add:newClass.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   379
154
d4236ec280a6 *** empty log message ***
claus
parents: 138
diff changeset
   380
    "wow - it worked. now the big trick ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   381
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   382
"/    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
   383
    oldMeta := self class.
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   384
3267
870789c08fad do not change the autoloaded classes name to '... (auto)'
Claus Gittinger <cg@exept.de>
parents: 3151
diff changeset
   385
"/ 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
   386
860
b3ffea40999a use new becomeSameAs: to migrate to new class.
Claus Gittinger <cg@exept.de>
parents: 789
diff changeset
   387
    self becomeSameAs:newClass.
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   388
    oldMeta becomeSameAs:newClass class.
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   389
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   390
    ObjectMemory flushCaches.
216
a8abff749575 *** empty log message ***
claus
parents: 213
diff changeset
   391
    LoadedClasses rehash.
921
4db7603f9506 rename myself (just in case) & flush caches after loading
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   392
3443
d57ea75d3ac5 oops - must send #initialize to all privateClasses.
Claus Gittinger <cg@exept.de>
parents: 3287
diff changeset
   393
    newClass initializeWithAllPrivateClasses.
886
62c66d49077d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
   394
    newClass postAutoload.
62c66d49077d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 860
diff changeset
   395
    ^ newClass
938
a23bc7f62ed1 set package info when autoloading
Claus Gittinger <cg@exept.de>
parents: 922
diff changeset
   396
4025
d9b9a5e77f1a when autoloading, allow for the stx-source subtree
Claus Gittinger <cg@exept.de>
parents: 4016
diff changeset
   397
    "Modified: / 5.3.1999 / 12:59:13 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   398
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   399
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   400
!Autoload class methodsFor:'message catching'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   401
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   402
basicNew
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   403
    "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
   404
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   405
    ^ self doesNotUnderstand:(Message selector:#basicNew)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   406
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   407
    "Modified: 24.4.1996 / 19:53:10 / cg"
620
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   410
basicNew:arg
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   411
    "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
   412
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   413
    ^ self doesNotUnderstand:(Message selector:#basicNew: with:arg)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   414
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   415
    "Modified: 24.4.1996 / 19:53:16 / cg"
620
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
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   418
comment
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   419
    "return the classes comment.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   420
     Autoloaded classes have no comment; but I myself have one"
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   421
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   422
    (self == Autoload) ifTrue:[^ super comment].
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   423
    ^ 'not yet loaded'
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   424
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   425
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   426
doesNotUnderstand:aMessage
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2666
diff changeset
   427
    "caught a message; load the class and retry the message"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   428
a27a279701f8 Initial revision
claus
parents:
diff changeset
   429
    |newClass|
a27a279701f8 Initial revision
claus
parents:
diff changeset
   430
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   431
    self ~~ Autoload ifTrue:[
3027
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   432
	newClass := self autoload.
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   433
	newClass notNil ifTrue:[
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   434
	    ^ newClass perform:(aMessage selector)
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   435
		 withArguments:(aMessage arguments)
7d677a5ced41 care for loaded classes namespace (vs. default namespace)
Claus Gittinger <cg@exept.de>
parents: 2691
diff changeset
   436
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   437
    ].
789
155eca125ef0 return value from doesNotUnderstand (so handler can return a value)
Claus Gittinger <cg@exept.de>
parents: 739
diff changeset
   438
    ^ super doesNotUnderstand:aMessage
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   439
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   440
    "Modified: 24.4.1996 / 19:53:27 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   441
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   442
4301
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   443
loadAndResendMessage
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   444
    "common helper to autoload a class and define a subclass of it by sending
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   445
     the sender-message again.
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   446
     This is invoked by all #subClass... definition messages."
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   447
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   448
    |sel args newClass|
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   449
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   450
    sel := thisContext sender selector.
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   451
    args := thisContext sender args.
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   452
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   453
    "take care: subclassing Autoload must still be possible"
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   454
    (self == Autoload) ifTrue:[
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   455
        ^ self perform:sel inClass:Autoload class superclass withArguments:args
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   456
    ].
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   457
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   458
    newClass := self autoload.
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   459
    newClass notNil ifTrue:[
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   460
        ^ newClass perform:sel withArguments:args
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   461
    ].
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   462
    ^ nil
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   463
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   464
    "Created: 8.2.1997 / 19:42:47 / cg"
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   465
!
e74e49f4e8e2 changed the way subclass-creation messages are handled
Claus Gittinger <cg@exept.de>
parents: 4280
diff changeset
   466
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   467
new
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   468
    "catch new - load the class and resend #new to the real one"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   469
a27a279701f8 Initial revision
claus
parents:
diff changeset
   470
    ^ self doesNotUnderstand:(Message selector:#new)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   471
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   472
    "Modified: 26.5.1997 / 14:59:52 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   473
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   474
a27a279701f8 Initial revision
claus
parents:
diff changeset
   475
new:arg
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   476
    "catch new: - load the class and resend #new: it to the real one"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   477
a27a279701f8 Initial revision
claus
parents:
diff changeset
   478
    ^ self doesNotUnderstand:(Message selector:#new: with:arg)
1277
7acd342fb251 commentary
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   479
2663
2ce59f3b8c2b comments
Claus Gittinger <cg@exept.de>
parents: 2662
diff changeset
   480
    "Modified: 26.5.1997 / 14:59:58 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   481
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   482
1438
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   483
readFrom:aStream 
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   484
    "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
   485
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   486
    ^ self doesNotUnderstand:(Message selector:#readFrom: with:aStream)
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   487
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   488
    "Created: 22.5.1996 / 23:44:23 / stefan"
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   489
!
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   490
1437
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   491
readFrom:aStream onError:exceptionBlock
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   492
    "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
   493
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   494
    ^ 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
   495
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   496
    "Created: 22.5.1996 / 23:03:39 / stefan"
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   497
!
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   498
1438
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   499
readFromString:aString
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   500
    "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
   501
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   502
    ^ self doesNotUnderstand:(Message selector:#readFromString: with:aString)
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   503
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   504
    "Created: 22.5.1996 / 23:46:15 / stefan"
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   505
!
76fdecf85f9e Catch readFrom: and readFromString: too.
Stefan Vogel <sv@exept.de>
parents: 1437
diff changeset
   506
1437
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   507
readFromString:aString onError:exceptionBlock
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   508
    "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
   509
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   510
    ^ 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
   511
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   512
    "Created: 22.5.1996 / 23:04:49 / stefan"
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   513
!
2a167c1f9f35 Catch readFrom:onError et al.
Stefan Vogel <sv@exept.de>
parents: 1414
diff changeset
   514
2691
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   515
respondsTo:aSelector
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   516
    "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
   517
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   518
    self == Autoload ifTrue:[
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   519
	^ super respondsTo:aSelector
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   520
    ].
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   521
    ^ self doesNotUnderstand:(Message selector:#respondsTo: with:aSelector)
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   522
33221e233f79 when asked via #respondsTo:, load & resend
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
   523
    "Modified: 26.5.1997 / 14:59:58 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   524
! !
11
6bf3080856be *** empty log message ***
claus
parents: 5
diff changeset
   525
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   526
!Autoload class methodsFor:'queries'!
356
claus
parents: 345
diff changeset
   527
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   528
isBehavior
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   529
    "return true if the recevier is some kind of class.
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   530
     Autoloaded classes are definitely; therefore return true."
164
9bad8fe706e9 *** empty log message ***
claus
parents: 154
diff changeset
   531
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   532
    ^ true
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   533
!
356
claus
parents: 345
diff changeset
   534
729
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   535
isBuiltInClass
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   536
    "return true if this class is known by the run-time-system.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   537
     Returns false here."
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   538
729
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   539
    ^ false
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   540
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   541
    "Created: 10.12.1995 / 00:28:22 / cg"
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1148
diff changeset
   542
    "Modified: 23.4.1996 / 15:55:36 / cg"
729
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   543
!
67a60a088d56 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 727
diff changeset
   544
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   545
isLoaded
3287
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   546
    "return true, if the class has been loaded.
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   547
     Autoload itself is loaded, subclasses are not.
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   548
     This allows testing wether a class has already been loaded."
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   549
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   550
    ^ (self == Autoload)
3287
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   551
f3761386e4ba Comment
Stefan Vogel <sv@exept.de>
parents: 3267
diff changeset
   552
    "Modified: / 16.2.1998 / 11:57:35 / stefan"
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   553
!
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   554
922
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   555
loadedClasses
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   556
    "return the set of classes that were autoloaded"
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   557
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   558
    ^ LoadedClasses ? #()
922
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   559
!
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   560
4401
d9667432d35b privateClasses and allPrivateClasses
Claus Gittinger <cg@exept.de>
parents: 4301
diff changeset
   561
privateClassesOrAll:allOfThem
4000
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   562
    "an autoloaded class has none"
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   563
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   564
    ^ #()
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   565
!
0f00add4298e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3655
diff changeset
   566
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   567
wasAutoloaded:aClass
922
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   568
    "return true, if aClass was autoloaded"
0e8e0d920d0d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 921
diff changeset
   569
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   570
    ^ LoadedClasses notNil and:[LoadedClasses includes:aClass]
11
6bf3080856be *** empty log message ***
claus
parents: 5
diff changeset
   571
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   572
1862
e8f44f10f1ab changes for new #infoOf: / #linkInfoOf: return
Claus Gittinger <cg@exept.de>
parents: 1720
diff changeset
   573
!Autoload class methodsFor:'documentation'!
661
7e1c7358c980 version method at the end
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   574
7e1c7358c980 version method at the end
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   575
version
4496
28f3f57dbe60 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4401
diff changeset
   576
    ^ '$Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.95 1999-08-02 16:05:52 cg Exp $'
661
7e1c7358c980 version method at the end
Claus Gittinger <cg@exept.de>
parents: 624
diff changeset
   577
! !
620
c7353f86a302 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 528
diff changeset
   578
Autoload initialize!