1: /*
   2:  * cofail(coexpr,value) - suspend current co-expression and activate
   3:  *  activator with failure, without changing activator's activator.
   4:  *
   5:  * Outline:
   6:  *    create procedure frame
   7:  *    save sp and boundary in current co-expression stack header
   8:  *    change current stack to coexpr
   9:  *    get sp and boundary from new co-expression stack header
  10:  *    return value in new stack
  11:  */
  12: Global(_boundary)       /* Icon/C boundary */
  13: Global(_current)        /* current co-expression */
  14: Global(_file)           /* current file name */
  15: Global(_line)           /* current line number */
  16: Global(_deref)          /* dereference */
  17: Global(_fail)           /* signal failure */
  18: 
  19: Global(_cofail)
  20: #ifdef VAX
  21: _cofail:
  22:         Mask    STDSV
  23:         calls   $0,_setbound
  24:         subl2   $8,sp           # make room on stack for line and file
  25:         movl    _line,-4(fp)    # and put them in the frame
  26:         movl    _file,-8(fp)
  27:         movl    _current+4,r2   # r2 points at current stack header
  28:         movl    sp,16(r2)       # save the stack pointer,
  29:         movl    ap,20(r2)       #  address pointer,
  30:         movl    _boundary,24(r2) #  and boundary
  31:         movl    8(r2),r3        # r3 points to activator
  32:         movl    r3,_current+4   # make new stack header current
  33:         movl    16(r3),sp       # get new sp,
  34:         movl    20(r3),ap       #  ap,
  35:         movl    24(r3),fp       #  fp,
  36:         movl    fp,_boundary    #  and boundary
  37:         movl    -4(fp),_line    # restore line number
  38:         movl    -8(fp),_file    #  and file name
  39:         calls   $0,_fail        # fail in the new stack
  40: #endif VAX
  41: #ifdef PORT
  42: DummyFcn(_cofail)
  43: #endif PORT
  44: #ifdef PDP11
  45: / cofail(coexpr,value) - suspend current co-expression and activate
  46: / activator with failure, without changing activator's activator.
  47: 
  48: / NOTE:  this code is highly dependent on stack frame layout.
  49: 
  50: / Outline:
  51: /    create procedure frame
  52: /    save sp and boundary in current co-expression stack header
  53: /    change current stack to coexpr
  54: /    get sp and boundary from new co-expression stack header
  55: /    return value in new stack
  56: 
  57: / Register usage:
  58: /    r2:  pointer to current co-expression stack header
  59: /    r3:  pointer to new co-expression stack header
  60: /    r5:  procedure frame pointer
  61: 
  62: Global(csv)             / save registers
  63: Global(cret)            / return as from C
  64: 
  65: _cofail:
  66:         jsr     r5,csv          / create procedure frame
  67:         mov     _line,(sp)      / save current line number
  68:         mov     _file,-(sp)     /   and file name
  69:         mov     _current+2,r2   / r2 <- pointer to current stack header
  70:         mov     sp,8.(r2)       / save sp
  71:         mov     _boundary,12.(r2)  / save boundary
  72:         mov     4(r2),r3        / r3 <- pointer to activator
  73:         mov     r3,_current+2   / make new stack header current
  74:         mov     8.(r3),sp       / get new sp
  75:         mov     12.(r3),r5      / get new r5 and
  76:         mov     r5,_boundary    /   new boundary
  77:         mov     -8.(r5),_line   / restore line number
  78:         mov     -10.(r5),_file  /   and file name
  79:         jsr     pc,_fail        / fail in new stack
  80: #endif PDP11

Defined functions

_cofail defined in line 65; used 2 times
Last modified: 1984-11-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 744
Valid CSS Valid XHTML 1.0 Strict