Autoload.st
changeset 92 0c73b48551ac
parent 88 81dacba7a63a
child 126 c00c6e25c98c
equal deleted inserted replaced
91:b3971c7dc731 92:0c73b48551ac
    18 !
    18 !
    19 
    19 
    20 Autoload comment:'
    20 Autoload comment:'
    21 COPYRIGHT (c) 1991 by Claus Gittinger
    21 COPYRIGHT (c) 1991 by Claus Gittinger
    22               All Rights Reserved
    22               All Rights Reserved
       
    23 
       
    24 $Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.9 1994-08-05 00:53:51 claus Exp $
    23 '!
    25 '!
    24 
    26 
    25 !Autoload class methodsFor:'documentation'!
    27 !Autoload class methodsFor:'documentation'!
    26 
    28 
    27 copyright
    29 copyright
    38 "
    40 "
    39 ! 
    41 ! 
    40 
    42 
    41 version
    43 version
    42 "
    44 "
    43 $Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.8 1994-06-02 16:19:17 claus Exp $
    45 $Header: /cvs/stx/stx/libbasic/Autoload.st,v 1.9 1994-08-05 00:53:51 claus Exp $
    44 "
    46 "
    45 !
    47 !
    46 
    48 
    47 documentation
    49 documentation
    48 "
    50 "
    53 
    55 
    54     Late addition: above comment is no longer true - I have made now almost
    56     Late addition: above comment is no longer true - I have made now almost
    55     all Demos & Goodies be autoloaded ... even for big systems.
    57     all Demos & Goodies be autoloaded ... even for big systems.
    56 
    58 
    57     class variables:
    59     class variables:
    58 	
    60         
    59 	LazyLoading	<Boolean>	if true, the loaded classes methods will
    61         LazyLoading     <Boolean>       if true, the loaded classes methods will
    60 					not be compiled at autoload time, but
    62                                         not be compiled at autoload time, but
    61 					instead when first called. This allows 
    63                                         instead when first called. This allows 
    62 					a faster load - however, expect short 
    64                                         a faster load - however, expect short 
    63 					pauses later.
    65                                         pauses later.
    64 "
    66 "
    65 ! !
    67 ! !
    66 
    68 
    67 !Autoload class methodsFor:'queries'!
    69 !Autoload class methodsFor:'queries'!
    68 
    70 
   100 
   102 
   101     "load it"
   103     "load it"
   102     Transcript showCr:('autoloading ', myName , ' ...'); endEntry.
   104     Transcript showCr:('autoloading ', myName , ' ...'); endEntry.
   103 
   105 
   104     LazyLoading ifTrue:[
   106     LazyLoading ifTrue:[
   105 	prev := Compiler compileLazy:true.
   107         prev := Compiler compileLazy:true.
   106 	[
   108         [
   107 	    Smalltalk fileInClass:myName.
   109             Smalltalk fileInClass:myName.
   108 	] valueNowOrOnUnwindDo:[
   110         ] valueNowOrOnUnwindDo:[
   109 	    Compiler compileLazy:prev
   111             Compiler compileLazy:prev
   110 	]
   112         ]
   111     ] ifFalse:[
   113     ] ifFalse:[
   112         Smalltalk fileInClass:myName.
   114         Smalltalk fileInClass:myName.
   113     ].
   115     ].
   114 
   116 
   115     "did it work ?"
   117     "did it work ?"
   191 ! !
   193 ! !
   192 
   194 
   193 !Autoload class methodsFor:'fileout'!
   195 !Autoload class methodsFor:'fileout'!
   194 
   196 
   195 fileOutDefinitionOn:aStream
   197 fileOutDefinitionOn:aStream
   196     "print an expression to define myself on aStream"
   198     "print an expression to define myself on aStream.
       
   199      Since autoloaded classes dont know their real definition, simply
       
   200      output some comment string making things clear."
   197 
   201 
   198     self == Autoload ifFalse:[
   202     self == Autoload ifFalse:[
   199         aStream nextPutAll:'''' , self name , ' is not yet loaded'''
   203         aStream nextPutAll:'''' , self name , ' is not yet loaded.'; cr.
       
   204         aStream nextPutAll:' to load, execute: '.
       
   205         aStream cr; cr; spaces:4; nextPutAll:self name , ' autoload'; cr.
       
   206         aStream nextPutAll:''''.
   200     ] ifTrue:[
   207     ] ifTrue:[
   201         ^ super fileOutDefinitionOn:aStream
   208         ^ super fileOutDefinitionOn:aStream
   202     ]
   209     ]
   203 ! !
   210 ! !