Class.st
changeset 488 1677ee52d630
parent 484 12f066c0ac29
child 523 27e13690f124
equal deleted inserted replaced
487:898ed6e7391c 488:1677ee52d630
    13 'From Smalltalk/X, Version:2.10.8 on 29-oct-1995 at 19:51:30'                   !
    13 'From Smalltalk/X, Version:2.10.8 on 29-oct-1995 at 19:51:30'                   !
    14 
    14 
    15 ClassDescription subclass:#Class
    15 ClassDescription subclass:#Class
    16 	 instanceVariableNames:'classvars comment subclasses classFilename package revision
    16 	 instanceVariableNames:'classvars comment subclasses classFilename package revision
    17 		history'
    17 		history'
    18 	 classVariableNames:'UpdatingChanges FileOutErrorSignal CatchMethodRedefinitions
    18 	 classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal CatchMethodRedefinitions
    19 		MethodRedefinitionSignal UpdateChangeFileQuerySignal'
    19 		MethodRedefinitionSignal UpdateChangeFileQuerySignal'
    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'!
    25 
    25 
    26 version
    26 version
    27 "
    27 "
    28 $Header: /cvs/stx/stx/libbasic/Class.st,v 1.65 1995-11-04 20:54:39 cg Exp $
    28 $Header: /cvs/stx/stx/libbasic/Class.st,v 1.66 1995-11-05 16:20:14 cg Exp $
    29 "!
    29 "!
    30 
    30 
    31 documentation
    31 documentation
    32 "
    32 "
    33     Class adds more functionality to classes; minimum stuff has already
    33     Class adds more functionality to classes; minimum stuff has already
    63     Class variables:
    63     Class variables:
    64 
    64 
    65 	UpdatingChanges <Boolean>       true if the changes-file shall be updated
    65 	UpdatingChanges <Boolean>       true if the changes-file shall be updated
    66 					(except during startup and when filing in, this flag
    66 					(except during startup and when filing in, this flag
    67 					 is usually true)
    67 					 is usually true)
       
    68 
       
    69 	LockChangesFile <Boolean>       if true, the change file is locked for updates.
       
    70 					Required when multiple users operate on a common
       
    71 					change file.
       
    72 					This is an experimental new feature, being evaluated.
    68 
    73 
    69 	UpdateChangeFileQuerySignal     used as an upQuery from the change management.
    74 	UpdateChangeFileQuerySignal     used as an upQuery from the change management.
    70 					Whenever a changeRecord is to be written,
    75 					Whenever a changeRecord is to be written,
    71 					this signal is raised and a handler (if present)
    76 					this signal is raised and a handler (if present)
    72 					is supposed to return true or false.
    77 					is supposed to return true or false.
   113      into the changes-file; normally this variable is set to true, but
   118      into the changes-file; normally this variable is set to true, but
   114      (for example) during fileIn or when changes are applied, it is set to false
   119      (for example) during fileIn or when changes are applied, it is set to false
   115      to avoid putting too much junk into the changes-file."
   120      to avoid putting too much junk into the changes-file."
   116      
   121      
   117     UpdatingChanges := true.
   122     UpdatingChanges := true.
       
   123     LockChangesFile := false.
   118     CatchMethodRedefinitions := true.
   124     CatchMethodRedefinitions := true.
   119 
   125 
   120     FileOutErrorSignal isNil ifTrue:[
   126     FileOutErrorSignal isNil ifTrue:[
   121 	FileOutErrorSignal := ErrorSignal newSignalMayProceed:false.
   127 	FileOutErrorSignal := ErrorSignal newSignalMayProceed:false.
   122 	FileOutErrorSignal nameClass:self message:#fileOutErrorSignal.
   128 	FileOutErrorSignal nameClass:self message:#fileOutErrorSignal.
   171     prev := UpdatingChanges.
   177     prev := UpdatingChanges.
   172     UpdatingChanges := aBoolean.
   178     UpdatingChanges := aBoolean.
   173     ^ prev
   179     ^ prev
   174 !
   180 !
   175 
   181 
       
   182 lockChangesFile:aBoolean
       
   183     "turn on/off change-file-locking. Return the previous value of the flag."
       
   184 
       
   185     |prev|
       
   186 
       
   187     prev := LockChangesFile.
       
   188     LockChangesFile := aBoolean.
       
   189     ^ prev
       
   190 !
       
   191 
   176 catchMethodRedefinitions:aBoolean
   192 catchMethodRedefinitions:aBoolean
   177     "turn on/off redefinition catching. Return the prior value of the flag."
   193     "turn on/off redefinition catching. Return the prior value of the flag."
   178 
   194 
   179     |prev|
   195     |prev|
   180 
   196 
   185 
   201 
   186 updatingChanges
   202 updatingChanges
   187     "return true if changes are recorded"
   203     "return true if changes are recorded"
   188 
   204 
   189     ^ UpdatingChanges
   205     ^ UpdatingChanges
       
   206 !
       
   207 
       
   208 lockChangesFile
       
   209     "return true, if the change file is locked during update"
       
   210 
       
   211     ^ LockChangesFile
   190 !
   212 !
   191 
   213 
   192 catchMethodRedefinitions
   214 catchMethodRedefinitions
   193     "return the redefinition catching flag."
   215     "return the redefinition catching flag."
   194 
   216 
  1040 !
  1062 !
  1041 
  1063 
  1042 changesStream
  1064 changesStream
  1043     "return a Stream for the writing changes file - or nil if no update is wanted"
  1065     "return a Stream for the writing changes file - or nil if no update is wanted"
  1044 
  1066 
  1045     |aStream fileName|
  1067     |streamType aStream fileName|
  1046 
  1068 
  1047     (UpdateChangeFileQuerySignal raise) ifTrue:[
  1069     (UpdateChangeFileQuerySignal raise) ifTrue:[
  1048 	fileName := ObjectMemory nameForChanges.
  1070 	fileName := ObjectMemory nameForChanges.
  1049 	aStream := FileStream oldFileNamed:fileName.
  1071         
       
  1072 	LockChangesFile ifTrue:[
       
  1073 	    streamType := LockedFileStream. 
       
  1074 	] ifFalse:[
       
  1075 	    streamType := FileStream.
       
  1076 	].
       
  1077 	aStream := streamType oldFileNamed:fileName.
  1050 	aStream isNil ifTrue:[
  1078 	aStream isNil ifTrue:[
  1051 	    aStream := FileStream newFileNamed:fileName.
  1079 	    aStream := streamType newFileNamed:fileName.
  1052 	    aStream isNil ifTrue:[
  1080 	    aStream isNil ifTrue:[
  1053 		self warn:'cannot create/update the changes file'.
  1081 		self warn:'cannot create/update the changes file'.
  1054 		^ nil
  1082 		^ nil
  1055 	    ]
  1083 	    ]
  1056 	].
  1084 	].