Behavior.st
changeset 7358 7df7aa75e77a
parent 7331 cd0f1492d540
child 7435 c5afb1b0fd1b
equal deleted inserted replaced
7357:cde54b45c469 7358:7df7aa75e77a
   879     ^ (self == Behavior class) or:[self == Behavior]
   879     ^ (self == Behavior class) or:[self == Behavior]
   880 
   880 
   881     "Modified: 23.4.1996 / 15:55:52 / cg"
   881     "Modified: 23.4.1996 / 15:55:52 / cg"
   882 ! !
   882 ! !
   883 
   883 
       
   884 
   884 !Behavior methodsFor:'Compatibility-Dolphin'!
   885 !Behavior methodsFor:'Compatibility-Dolphin'!
   885 
   886 
   886 allSubinstances
   887 allSubinstances
   887     ^ self allSubInstances
   888     ^ self allSubInstances
   888 !
   889 !
   975 
   976 
   976 shortName
   977 shortName
   977     ^ self nameWithoutPrefix
   978     ^ self nameWithoutPrefix
   978 ! !
   979 ! !
   979 
   980 
   980 !Behavior methodsFor:'RefactoringBrowser'!
       
   981 
       
   982 parseTreeFor: aSymbol 
       
   983 	"parse a method given a selector - return a perseTree"
       
   984 
       
   985 	^RBParser 
       
   986 	    parseMethod: (self sourceCodeAt: aSymbol)
       
   987 	    onError: [:aString :pos | ^nil]
       
   988 ! !
       
   989 
   981 
   990 !Behavior methodsFor:'accessing'!
   982 !Behavior methodsFor:'accessing'!
   991 
   983 
   992 addSelector:newSelector withLazyMethod:newMethod
   984 addSelector:newSelector withLazyMethod:newMethod
   993     "add the method given by 2nd argument under the selector given by
   985     "add the method given by 2nd argument under the selector given by
  1286 
  1278 
  1287     |obj t
  1279     |obj t
  1288      basicSize "{ Class: SmallInteger }" |
  1280      basicSize "{ Class: SmallInteger }" |
  1289 
  1281 
  1290     self isPointers ifTrue: [
  1282     self isPointers ifTrue: [
  1291 	"/
  1283         "/
  1292 	"/ inst size not needed - if you uncomment the line below,
  1284         "/ inst size not needed - if you uncomment the line below,
  1293 	"/ also uncomment the corresponding line in
  1285         "/ also uncomment the corresponding line in
  1294 	"/ Object>>storeBinaryDefinitionOn:manager:
  1286         "/ Object>>storeBinaryDefinitionOn:manager:
  1295 	"/
  1287         "/
  1296 	"/ stream next. "skip instSize"
  1288         "/ stream next. "skip instSize"
  1297 	self isVariable ifTrue: [
  1289         self isVariable ifTrue: [
  1298 	    ^ self basicNew:(stream nextNumber:3)
  1290             ^ self basicNew:(stream nextNumber:3)
  1299 	].
  1291         ].
  1300 	^ self basicNew
  1292         ^ self basicNew
  1301     ].
  1293     ].
  1302 
  1294 
  1303     "
  1295     "
  1304      an object with bit-valued instance variables.
  1296      an object with bit-valued instance variables.
  1305      These are read here.
  1297      These are read here.
  1306     "
  1298     "
  1307     basicSize := stream nextNumber:4.
  1299     basicSize := stream nextNumber:4.
  1308     obj := self basicNew:basicSize.
  1300     obj := self basicNew:basicSize.
  1309 
  1301 
  1310     self isBytes ifTrue: [
  1302     self isBytes ifTrue: [
  1311 	stream nextBytes:basicSize into:obj
  1303         stream nextBytes:basicSize into:obj
  1312     ] ifFalse: [
  1304     ] ifFalse: [
  1313 	self isWords ifTrue: [
  1305         self isWords ifTrue: [
  1314 	    1 to:basicSize do:[:i |
  1306             1 to:basicSize do:[:i |
  1315 		obj basicAt:i put:(stream nextNumber:2)
  1307                 obj basicAt:i put:(stream nextNumber:2)
  1316 	    ]
  1308             ]
  1317 	] ifFalse:[
  1309         ] ifFalse:[
  1318 	    self isLongs ifTrue: [
  1310             self isLongs ifTrue: [
  1319 		1 to:basicSize do:[:i |
  1311                 1 to:basicSize do:[:i |
  1320 		    obj basicAt:i put:(stream nextNumber:4)
  1312                     obj basicAt:i put:(stream nextNumber:4)
  1321 		]
  1313                 ]
  1322 	    ] ifFalse:[
  1314             ] ifFalse:[
  1323 		self isFloats ifTrue: [
  1315                 self isFloats ifTrue: [
  1324 		    "could do it in one big read on machines which use IEEE floats ..."
  1316                     "could do it in one big read on machines which use IEEE floats ..."
  1325 		    t := Float basicNew.
  1317                     t := ShortFloat basicNew.
  1326 		    1 to:basicSize do:[:i |
  1318                     1 to:basicSize do:[:i |
  1327 			Float readBinaryIEEESingleFrom:stream into:t.
  1319                         ShortFloat readBinaryIEEESingleFrom:stream into:t.
  1328 			obj basicAt:i put: t
  1320                         obj basicAt:i put: t
  1329 		    ]
  1321                     ]
  1330 		] ifFalse:[
  1322                 ] ifFalse:[
  1331 		    self isDoubles ifTrue: [
  1323                     self isDoubles ifTrue: [
  1332 			"could do it in one big read on machines which use IEEE doubles ..."
  1324                         "could do it in one big read on machines which use IEEE doubles ..."
  1333 			t := Float basicNew.
  1325                         t := Float basicNew.
  1334 			1 to:basicSize do:[:i |
  1326                         1 to:basicSize do:[:i |
  1335 			    Float readBinaryIEEEDoubleFrom:stream into:t.
  1327                             Float readBinaryIEEEDoubleFrom:stream into:t.
  1336 			    obj basicAt:i put: t
  1328                             obj basicAt:i put: t
  1337 			]
  1329                         ]
  1338 		    ]
  1330                     ]
  1339 		]
  1331                 ]
  1340 	    ]
  1332             ]
  1341 	]
  1333         ]
  1342     ].
  1334     ].
  1343     ^obj
  1335     ^obj
  1344 !
  1336 !
  1345 
  1337 
  1346 canCloneFrom:anObject 
  1338 canCloneFrom:anObject 
  4428 ! !
  4420 ! !
  4429 
  4421 
  4430 !Behavior class methodsFor:'documentation'!
  4422 !Behavior class methodsFor:'documentation'!
  4431 
  4423 
  4432 version
  4424 version
  4433     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.226 2003-06-05 13:12:50 cg Exp $'
  4425     ^ '$Header: /cvs/stx/stx/libbasic/Behavior.st,v 1.227 2003-06-16 09:22:20 cg Exp $'
  4434 ! !
  4426 ! !