Object.st
changeset 6323 9dbabd4270d3
parent 6321 8af99331b6e8
child 6328 49317c043e04
equal deleted inserted replaced
6322:8e6d732fda15 6323:9dbabd4270d3
   330     "Modified: / 22.1.1998 / 21:23:40 / av"
   330     "Modified: / 22.1.1998 / 21:23:40 / av"
   331     "Modified: / 3.2.1998 / 18:55:09 / cg"
   331     "Modified: / 3.2.1998 / 18:55:09 / cg"
   332     "Modified: / 4.8.1999 / 08:54:06 / stefan"
   332     "Modified: / 4.8.1999 / 08:54:06 / stefan"
   333 ! !
   333 ! !
   334 
   334 
       
   335 
   335 !Object class methodsFor:'Compatibility - ST80'!
   336 !Object class methodsFor:'Compatibility - ST80'!
   336 
   337 
   337 rootError
   338 rootError
   338     "return the signal used for error/error: - handling.
   339     "return the signal used for error/error: - handling.
   339      Same as errorSignal for ST80 compatibility."
   340      Same as errorSignal for ST80 compatibility."
   569 
   570 
   570     ^ self == Object
   571     ^ self == Object
   571 
   572 
   572     "Modified: 23.4.1996 / 16:00:07 / cg"
   573     "Modified: 23.4.1996 / 16:00:07 / cg"
   573 ! !
   574 ! !
       
   575 
   574 
   576 
   575 !Object methodsFor:'Compatibility - ST80'!
   577 !Object methodsFor:'Compatibility - ST80'!
   576 
   578 
   577 isMetaclass
   579 isMetaclass
   578     ^ self isMeta
   580     ^ self isMeta
  1515     "Modified: 19.4.1996 / 11:12:49 / cg"
  1517     "Modified: 19.4.1996 / 11:12:49 / cg"
  1516 ! !
  1518 ! !
  1517 
  1519 
  1518 !Object methodsFor:'attributes access'!
  1520 !Object methodsFor:'attributes access'!
  1519 
  1521 
  1520 objectAttributeAt:key 
  1522 objectAttributeAt:attributeKey 
  1521     "return the attribute for a given key or nil if not found"
  1523     "return the attribute for a given key or nil if not found"
  1522 
  1524 
  1523     | attrs |
  1525     | attrs |
  1524 
  1526 
  1525     attrs := self objectAttributes.
  1527     attrs := self objectAttributes.
  1526     (attrs notNil and:[attrs size > 0]) ifTrue:[
  1528     (attrs notNil and:[attrs size > 0]) ifTrue:[
  1527         ^ attrs at:key ifAbsent:[]
  1529         ^ attrs at:attributeKey ifAbsent:[]
  1528     ].
  1530     ].
  1529     ^ nil
  1531     ^ nil
  1530 
  1532 
  1531     "Created: / 22.1.1998 / 21:29:17 / av"
  1533     "Created: / 22.1.1998 / 21:29:17 / av"
  1532     "Modified: / 3.2.1998 / 18:55:55 / cg"
  1534     "Modified: / 3.2.1998 / 18:55:55 / cg"
  1533 !
  1535 !
  1534 
  1536 
  1535 objectAttributeAt:key put:anObject
  1537 objectAttributeAt:attributeKey put:anObject
  1536     "store the attribute anObject referenced by key into the receiver"
  1538     "store the attribute anObject referenced by key into the receiver"
  1537 
       
  1538     |wasBlocked|
       
  1539 
  1539 
  1540     "/ must do this save from interrupts, since the attributes collection
  1540     "/ must do this save from interrupts, since the attributes collection
  1541     "/ is possibly accessed from multiple threads ...
  1541     "/ is possibly accessed from multiple threads ...
  1542 
       
  1543     wasBlocked := OperatingSystem blockInterrupts.
       
  1544     [
  1542     [
  1545         | attrs |
  1543         | attrs |
  1546 
  1544 
  1547         attrs := self objectAttributes.
  1545         attrs := self objectAttributes.
  1548         (attrs isNil or:[attrs size == 0]) ifTrue:[
  1546         (attrs isNil or:[attrs size == 0]) ifTrue:[
  1549             attrs := WeakIdentityDictionary new.
  1547             attrs := WeakIdentityDictionary new.
  1550             attrs at:key put:anObject.
  1548             attrs at:attributeKey put:anObject.
  1551             self objectAttributes:attrs.
  1549             self objectAttributes:attrs.
  1552         ] ifFalse:[ 
  1550         ] ifFalse:[ 
  1553             attrs at:key put:anObject.
  1551             attrs at:attributeKey put:anObject.
  1554         ].
  1552         ].
  1555     ] valueNowOrOnUnwindDo:[
  1553     ] valueUninterruptably
  1556         wasBlocked ifFalse:[
       
  1557             OperatingSystem unblockInterrupts
       
  1558         ]
       
  1559     ]
       
  1560 
  1554 
  1561     "Attaching additional attributes (slots) to an arbitrary object:
  1555     "Attaching additional attributes (slots) to an arbitrary object:
  1562 
  1556 
  1563      |p|
  1557      |p|
  1564 
  1558 
  1618 
  1612 
  1619     "Created: / 22.1.1998 / 21:29:35 / av"
  1613     "Created: / 22.1.1998 / 21:29:35 / av"
  1620     "Modified: / 3.2.1998 / 18:58:10 / cg"
  1614     "Modified: / 3.2.1998 / 18:58:10 / cg"
  1621 !
  1615 !
  1622 
  1616 
  1623 removeObjectAttribute:anObject
  1617 removeObjectAttribute:attributeKey
  1624     "make the argument, anObject be no attribute of the receiver"
  1618     "make the argument, anObject be no attribute of the receiver"
  1625 
       
  1626     |wasBlocked|
       
  1627 
  1619 
  1628     "/ must do this save from interrupts, since the attributes collection
  1620     "/ must do this save from interrupts, since the attributes collection
  1629     "/ is possibly accessed from multiple threads.
  1621     "/ is possibly accessed from multiple threads.
  1630 
       
  1631     wasBlocked := OperatingSystem blockInterrupts.
       
  1632     [
  1622     [
  1633         |attrs n a|
  1623         |attrs n a|
  1634 
  1624 
  1635         attrs := self objectAttributes.
  1625         attrs := self objectAttributes.
  1636         attrs size == 0 ifTrue:[
  1626         attrs size == 0 ifTrue:[
  1637             self objectAttributes:nil
  1627             self objectAttributes:nil
  1638         ] ifFalse:[
  1628         ] ifFalse:[
  1639             attrs removeKey:anObject ifAbsent:nil.
  1629             attrs removeKey:attributeKey ifAbsent:nil.
  1640             attrs size == 0 ifTrue:[
  1630             attrs size == 0 ifTrue:[
  1641                 self objectAttributes:nil
  1631                 self objectAttributes:nil
  1642             ]
  1632             ]
  1643         ]
  1633         ]
  1644     ] valueNowOrOnUnwindDo:[
  1634     ] valueUninterruptably
  1645         wasBlocked ifFalse:[
       
  1646             OperatingSystem unblockInterrupts
       
  1647         ]
       
  1648     ]
       
  1649 
  1635 
  1650     "Created: / 22.1.1998 / 21:29:39 / av"
  1636     "Created: / 22.1.1998 / 21:29:39 / av"
  1651     "Modified: / 18.2.2000 / 11:32:19 / cg"
  1637     "Modified: / 18.2.2000 / 11:32:19 / cg"
  1652 ! !
  1638 ! !
  1653 
  1639 
  8667 ! !
  8653 ! !
  8668 
  8654 
  8669 !Object class methodsFor:'documentation'!
  8655 !Object class methodsFor:'documentation'!
  8670 
  8656 
  8671 version
  8657 version
  8672     ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.389 2001-12-14 10:52:18 cg Exp $'
  8658     ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.390 2001-12-16 18:37:11 cg Exp $'
  8673 ! !
  8659 ! !
  8674 Object initialize!
  8660 Object initialize!