Class.st
changeset 1923 97b099fef985
parent 1919 cb189a5dcac8
child 1924 0103d478f8a4
equal deleted inserted replaced
1922:0f0e0c992fc0 1923:97b099fef985
    14 	instanceVariableNames:'classvars comment subclasses classFilename package revision hook'
    14 	instanceVariableNames:'classvars comment subclasses classFilename package revision hook'
    15 	classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal
    15 	classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal
    16 		CatchMethodRedefinitions MethodRedefinitionSignal
    16 		CatchMethodRedefinitions MethodRedefinitionSignal
    17 		UpdateChangeFileQuerySignal TryLocalSourceFirst
    17 		UpdateChangeFileQuerySignal TryLocalSourceFirst
    18 		ChangeFileAccessLock NameSpaceQuerySignal PackageQuerySignal
    18 		ChangeFileAccessLock NameSpaceQuerySignal PackageQuerySignal
    19 		CreateNameSpaceQuerySignal'
    19 		CreateNameSpaceQuerySignal OldMethods'
    20 	poolDictionaries:''
    20 	poolDictionaries:''
    21 	category:'Kernel-Classes'
    21 	category:'Kernel-Classes'
    22 !
    22 !
    23 
    23 
    24 !Class class methodsFor:'documentation'!
    24 !Class class methodsFor:'documentation'!
    70     [Class variables:]
    70     [Class variables:]
    71 
    71 
    72         UpdatingChanges <Boolean>       true if the changes-file shall be updated
    72         UpdatingChanges <Boolean>       true if the changes-file shall be updated
    73                                         (except during startup and when filing in, this flag
    73                                         (except during startup and when filing in, this flag
    74                                          is usually true)
    74                                          is usually true)
    75 
       
    76         LockChangesFile <Boolean>       if true, the change file is locked for updates.
       
    77                                         Required when multiple users operate on a common
       
    78                                         change file.
       
    79                                         This is an experimental new feature, being evaluated.
       
    80 
    75 
    81         UpdateChangeFileQuerySignal     used as an upQuery from the change management.
    76         UpdateChangeFileQuerySignal     used as an upQuery from the change management.
    82                                         Whenever a changeRecord is to be written,
    77                                         Whenever a changeRecord is to be written,
    83                                         this signal is raised and a handler (if present)
    78                                         this signal is raised and a handler (if present)
    84                                         is supposed to return true or false.
    79                                         is supposed to return true or false.
    86                                         UpdatingChanges is returned for backward
    81                                         UpdatingChanges is returned for backward
    87                                         compatibility (which means that the old
    82                                         compatibility (which means that the old
    88                                         mechanism is used if no query-handler
    83                                         mechanism is used if no query-handler
    89                                         is present).
    84                                         is present).
    90 
    85 
       
    86         LockChangesFile <Boolean>       if true, the change file is locked for updates.
       
    87                                         Required when multiple users operate on a common
       
    88                                         change file.
       
    89                                         This is an experimental new feature, being evaluated.
       
    90 
    91         FileOutErrorSignal              raised when an error occurs during fileOut
    91         FileOutErrorSignal              raised when an error occurs during fileOut
    92 
    92 
    93         CatchMethodRedefinitions        if true, classes protect themself 
    93         CatchMethodRedefinitions        if true, classes protect themself 
    94         MethodRedefinitionSignal        (by raising MethodRedefinitionSignal)
    94         MethodRedefinitionSignal        (by raising MethodRedefinitionSignal)
    95                                         from redefining any existing methods,
    95                                         from redefining any existing methods,
   105                                         consulted. If false, the sourceCodeManager
   105                                         consulted. If false, the sourceCodeManager
   106                                         is asked first.
   106                                         is asked first.
   107                                         Should be turned on, if you run an image from
   107                                         Should be turned on, if you run an image from
   108                                         local sources which have not yet been checked in.
   108                                         local sources which have not yet been checked in.
   109 
   109 
   110                                         
   110         NameSpaceQuerySignal            used as an upQuery to ask for a namespace into
       
   111                                         which new classes are to be installed.
       
   112 
       
   113         PackageQuerySignal              used as an upQuery to ask for a packageSymbol with
       
   114                                         which new classes/methods are to be marked.
       
   115 
       
   116         CreateNameSpaceQuerySignal      used as an upQuery to ask if unknown namespaces
       
   117                                         should be silently created (without asking the user)
       
   118 
       
   119         OldMethods                      if nonNil, this must be an IdentityDictionary,
       
   120                                         which is filled with method->previousversionMethod
       
   121                                         associations. Can be used for undo-last-method-change
       
   122                                         Notice: this may fillup your memory over time.
       
   123 
       
   124 
   111     WARNING: layout known by compiler and runtime system
   125     WARNING: layout known by compiler and runtime system
   112 
   126 
   113     [author:]
   127     [author:]
   114         Claus Gittinger
   128         Claus Gittinger
   115 
   129 
   257     prev := CatchMethodRedefinitions.
   271     prev := CatchMethodRedefinitions.
   258     CatchMethodRedefinitions := aBoolean.
   272     CatchMethodRedefinitions := aBoolean.
   259     ^ prev
   273     ^ prev
   260 !
   274 !
   261 
   275 
       
   276 keepOldMethods:aBoolean
       
   277     "turn on/off oldMethod remembering. If on, a methods previous version
       
   278      is kept locally, for later undo (or compare)."
       
   279 
       
   280     aBoolean ifTrue:[
       
   281         OldMethods isNil ifTrue:[
       
   282             OldMethods := IdentityDictionary new.
       
   283         ]
       
   284     ] ifFalse:[
       
   285         OldMethods := nil
       
   286     ].
       
   287 
       
   288     "
       
   289      Class keepOldMethods:true
       
   290      Class keepOldMethods:false
       
   291     "
       
   292 
       
   293     "Modified: 7.11.1996 / 18:36:00 / cg"
       
   294 !
       
   295 
   262 lockChangesFile
   296 lockChangesFile
   263     "return true, if the change file is locked during update"
   297     "return true, if the change file is locked during update"
   264 
   298 
   265     ^ LockChangesFile
   299     ^ LockChangesFile
   266 !
   300 !
   271     |prev|
   305     |prev|
   272 
   306 
   273     prev := LockChangesFile.
   307     prev := LockChangesFile.
   274     LockChangesFile := aBoolean.
   308     LockChangesFile := aBoolean.
   275     ^ prev
   309     ^ prev
       
   310 !
       
   311 
       
   312 oldMethods
       
   313     "return a dictionary containing method->previousVersion associations,
       
   314      nil if method remembering has been turned off"
       
   315 
       
   316     ^ OldMethods 
       
   317 
       
   318     "
       
   319      Class oldMethods
       
   320     "
       
   321 
       
   322     "Modified: 7.11.1996 / 18:36:00 / cg"
       
   323     "Created: 7.11.1996 / 18:40:12 / cg"
   276 !
   324 !
   277 
   325 
   278 tryLocalSourceFirst
   326 tryLocalSourceFirst
   279     ^ TryLocalSourceFirst
   327     ^ TryLocalSourceFirst
   280 
   328 
  1063                 MethodRedefinitionSignal 
  1111                 MethodRedefinitionSignal 
  1064                     raiseErrorString:('redefinition of ' , name , '>>' , newSelector) 
  1112                     raiseErrorString:('redefinition of ' , name , '>>' , newSelector) 
  1065             ]
  1113             ]
  1066         ]
  1114         ]
  1067     ].
  1115     ].
       
  1116 
       
  1117     OldMethods notNil ifTrue:[
       
  1118         oldMethod := self compiledMethodAt:newSelector.
       
  1119         oldMethod notNil ifTrue:[
       
  1120 "/            oldMethod source:(oldMethod source).
       
  1121             OldMethods at:newMethod put:oldMethod
       
  1122         ]
       
  1123     ].
       
  1124 
  1068     (super addSelector:newSelector withMethod:newMethod) ifTrue:[
  1125     (super addSelector:newSelector withMethod:newMethod) ifTrue:[
  1069         self addChangeRecordForMethod:newMethod.
  1126         self addChangeRecordForMethod:newMethod.
  1070     ]
  1127     ]
  1071 
  1128 
  1072     "Created: 29.10.1995 / 19:42:42 / cg"
  1129     "Created: 29.10.1995 / 19:42:42 / cg"
  1073     "Modified: 9.9.1996 / 22:39:32 / stefan"
  1130     "Modified: 9.9.1996 / 22:39:32 / stefan"
       
  1131     "Modified: 7.11.1996 / 18:49:43 / cg"
       
  1132 !
       
  1133 
       
  1134 basicAddSelector:newSelector withMethod:newMethod
       
  1135     "add the method given by 2nd argument under the selector given by
       
  1136      1st argument to the methodDictionary. 
       
  1137      This does NOT append a change record to the changes file and tell 
       
  1138      dependents. Also, no methodHistory is kept or redefinition is checked."
       
  1139 
       
  1140     super addSelector:newSelector withMethod:newMethod
       
  1141 
       
  1142     "Created: 7.11.1996 / 18:48:35 / cg"
  1074 !
  1143 !
  1075 
  1144 
  1076 removeSelector:aSelector
  1145 removeSelector:aSelector
  1077     "remove the selector, aSelector and its associated method 
  1146     "remove the selector, aSelector and its associated method 
  1078      from the methodDictionary.
  1147      from the methodDictionary.
  4362 ! !
  4431 ! !
  4363 
  4432 
  4364 !Class class methodsFor:'documentation'!
  4433 !Class class methodsFor:'documentation'!
  4365 
  4434 
  4366 version
  4435 version
  4367     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.207 1996-11-07 12:51:20 cg Exp $'
  4436     ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.208 1996-11-07 17:55:39 cg Exp $'
  4368 ! !
  4437 ! !
  4369 Class initialize!
  4438 Class initialize!