Context.st
changeset 5422 bf75e784e34f
parent 4932 f47017a06866
child 5441 e88302747bbd
equal deleted inserted replaced
5421:6dda4984b524 5422:bf75e784e34f
     7  inclusion of the above copyright notice.   This software may not
     7  inclusion of the above copyright notice.   This software may not
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
       
    12 
       
    13 "{ Package: 'stx:libbasic' }"
    12 
    14 
    13 Object variableSubclass:#Context
    15 Object variableSubclass:#Context
    14 	instanceVariableNames:'flags sender* home receiver selector searchClass lineNr
    16 	instanceVariableNames:'flags sender* home receiver selector searchClass lineNr
    15 		retvalTemp handle*'
    17 		retvalTemp handle*'
    16 	classVariableNames:'InvalidReturnSignal SingleStepInterruptRequest'
    18 	classVariableNames:'InvalidReturnSignal SingleStepInterruptRequest'
   614 senderIsNil
   616 senderIsNil
   615     "return true, if I have no sender"
   617     "return true, if I have no sender"
   616 
   618 
   617 %{  /* NOCONTEXT */
   619 %{  /* NOCONTEXT */
   618     if ( __INST(sender_) == nil ) {
   620     if ( __INST(sender_) == nil ) {
   619 	RETURN (true);
   621         RETURN (true);
   620     }
   622     }
   621     RETURN (false);
   623     RETURN (false);
   622 %}
   624 %}.
       
   625     ^ self sender isNil
   623 !
   626 !
   624 
   627 
   625 setLineNumber:aNumber
   628 setLineNumber:aNumber
   626     "private entry for uncompiledCodeObject ..."
   629     "private entry for uncompiledCodeObject ..."
   627 
   630 
  1579     OBJ sel;
  1582     OBJ sel;
  1580     OBJ __FETCHSELECTOR();
  1583     OBJ __FETCHSELECTOR();
  1581 
  1584 
  1582     theContext = __INST(sender_);
  1585     theContext = __INST(sender_);
  1583     while (__isNonNilObject(theContext)) {
  1586     while (__isNonNilObject(theContext)) {
  1584 	if (__isLazy(theContext)) {
  1587         if (__isLazy(theContext)) {
  1585 #ifdef TRADITIONAL_STACK_FRAME
  1588 #ifdef TRADITIONAL_STACK_FRAME
  1586 	    sel = __FETCHSELECTOR(theContext);
  1589             sel = __FETCHSELECTOR(theContext);
  1587 #else
  1590 #else
  1588 	    /* mhmh - not really needed */
  1591             /* mhmh - not really needed */
  1589 	    __PATCHUPCONTEXT(theContext);
  1592             __PATCHUPCONTEXT(theContext);
  1590 	    sel = __ContextInstPtr(theContext)->c_selector;
  1593             sel = __ContextInstPtr(theContext)->c_selector;
  1591 #endif
  1594 #endif
  1592 	} else {
  1595         } else {
  1593 	    sel = __ContextInstPtr(theContext)->c_selector;
  1596             sel = __ContextInstPtr(theContext)->c_selector;
  1594 	}
  1597         }
  1595 
  1598 
  1596 	if ((sel == selector1)
  1599         if ((sel == selector1)
  1597 	 || ((selector2 != nil) && (sel == selector2))
  1600          || ((selector2 != nil) && (sel == selector2))
  1598 	 || ((selector3 != nil) && (sel == selector3))) {
  1601          || ((selector3 != nil) && (sel == selector3))) {
  1599 	    if (__isLazy(theContext)) {
  1602             if (__isLazy(theContext)) {
  1600 		__PATCHUPCONTEXT(theContext);
  1603                 __PATCHUPCONTEXT(theContext);
  1601 	    }
  1604             }
  1602 
  1605 
  1603 	    if (! __isNonLIFO(theContext)) {
  1606             if (! __isNonLIFO(theContext)) {
  1604 		/* 
  1607                 /* 
  1605 		 * to be prepared for the worst situation 
  1608                  * to be prepared for the worst situation 
  1606 		 * (the sender is not stored, so the trap wont catch it)
  1609                  * (the sender is not stored, so the trap wont catch it)
  1607 		 * make the writeBarrier trigger manually.
  1610                  * make the writeBarrier trigger manually.
  1608 		 * We'll see, if this is really required.
  1611                  * We'll see, if this is really required.
  1609 		 */
  1612                  */
  1610 		theContext->o_space |= CATCHMARK;
  1613                 theContext->o_space |= CATCHMARK;
  1611 		_markNonLIFO(theContext);
  1614                 _markNonLIFO(theContext);
  1612 	    }
  1615             }
  1613 	    RETURN (theContext);
  1616             RETURN (theContext);
  1614 	}
  1617         }
  1615 	theContext = __ContextInstPtr(theContext)->c_sender;
  1618         theContext = __ContextInstPtr(theContext)->c_sender;
  1616     }
  1619     }
       
  1620     RETURN (nil);
  1617 %}.
  1621 %}.
  1618     ^ nil
  1622     "
       
  1623      |con sel|
       
  1624 
       
  1625      con := self sender.
       
  1626      [con notNil] whileTrue:[
       
  1627         sel := con selector.
       
  1628         sel == selector1 ifTrue:[^ con].
       
  1629         (selector2 notNil and:[sel == selector2]) ifTrue:[^ con].
       
  1630         (selector3 notNil and:[sel == selector3]) ifTrue:[^ con].
       
  1631         con := con sender.
       
  1632      ].
       
  1633      ^ nil
       
  1634     "
  1619 !
  1635 !
  1620 
  1636 
  1621 findNextUnwindContextOr:aContext
  1637 findNextUnwindContextOr:aContext
  1622     "walk along the sender chain (starting at the sender), 
  1638     "walk along the sender chain (starting at the sender), 
  1623      for a context marked for unwindAction or aContext.
  1639      for a context marked for unwindAction or aContext.
  1912 ! !
  1928 ! !
  1913 
  1929 
  1914 !Context class methodsFor:'documentation'!
  1930 !Context class methodsFor:'documentation'!
  1915 
  1931 
  1916 version
  1932 version
  1917     ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.102 1999-10-22 18:25:14 cg Exp $'
  1933     ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.103 2000-06-26 09:14:05 cg Exp $'
  1918 ! !
  1934 ! !
  1919 Context initialize!
  1935 Context initialize!