# 2.11BSD#431 - /usr/src/bin/sh/stak.h

##### Macros

    absstak           X
    curstak           X
    fixstak           X
    pushstak          X
    relstak           X
    setstak           X
    usestak           X
    zerostak          X

       1: /*	stak.h	4.1	82/05/07	*/
       2:
       3: #
       4: /*
       5:  *	UNIX shell
       6:  *
       7:  *	S. R. Bourne
       8:  *	Bell Telephone Laboratories
       9:  *
      10:  */
      11:
      12: /* To use stack as temporary workspace across
      13:  * possible storage allocation (eg name lookup)
      14:  * a) get ptr from `relstak'
      15:  * b) can now use `pushstak'
      16:  * c) then reset with `setstak'
      17:  * d) `absstak' gives real address if needed
      18:  */
      19: #define     relstak()   (staktop-stakbot)
      20: #define     absstak(x)  (stakbot+Rcheat(x))
      21: #define     setstak(x)  (staktop=absstak(x))
      22: #define     pushstak(c) (*staktop++=(c))
      23: #define     zerostak()  (*staktop=0)
      24:
      25: /* Used to address an item left on the top of
      26:  * the stack (very temporary)
      27:  */
      28: #define     curstak()   (staktop)
      29:
      30: /* `usestak' before `pushstak' then `fixstak'
      31:  * These routines are safe against heap
      32:  * being allocated.
      33:  */
      34: #define     usestak()   {locstak();}
      35:
      36: /* for local use only since it hands
      37:  * out a real address for the stack top
      38:  */
      39: STKPTR      locstak();
      40:
      41: /* Will allocate the item being used and return its
      42:  * address (safe now).
      43:  */
      44: #define     fixstak()   endstak(staktop)
      45:
      46: /* For use after `locstak' to hand back
      47:  * new stack top and then allocate item
      48:  */
      49: STKPTR      endstak();
      50:
      51: /* Copy a string onto the stack and
      52:  * allocate the space.
      53:  */
      54: STKPTR      cpystak();
      55:
      56: /* Allocate given ammount of stack space */
      57: STKPTR      getstak();
      58:
      59: /* A chain of ptrs of stack blocks that
      60:  * have become covered by heap allocation.
      61:  * `tdystak' will return them to the heap.
      62:  */
      63: BLKPTR      stakbsy;
      64:
      65: /* Base of the entire stack */
      66: STKPTR      stakbas;
      67:
      68: /* Top of entire stack */
      69: STKPTR      brkend;
      70:
      71: /* Base of current item */
      72: STKPTR      stakbot;
      73:
      74: /* Top of current item */
      75: STKPTR      staktop;
      76:
      77: /* Used with tdystak */
      78: STKPTR      savstak();

#### Defined macros

absstak defined in line 20; used 4 times

- in line 21
- in /usr/src/bin/sh/macro.c line 78, 113
- in /usr/src/bin/sh/name.c line 147

curstak defined in line 28; used 2 times

- in /usr/src/bin/sh/service.c line 94, 139

fixstak defined in line 44; used 3 times

- in /usr/src/bin/sh/macro.c line 169, 177, 185

pushstak defined in line 22; used 10 times

- in /usr/src/bin/sh/blok.c line 63
- in /usr/src/bin/sh/macro.c line 28, 76, 120-123(2), 167, 181, 201, 223
- in /usr/src/bin/sh/name.c line 155

relstak defined in line 19; used 3 times

- in /usr/src/bin/sh/macro.c line 75, 108
- in /usr/src/bin/sh/name.c line 137

setstak defined in line 21; used 2 times

- in /usr/src/bin/sh/macro.c line 78
- in /usr/src/bin/sh/name.c line 147

usestak defined in line 34; used 2 times

- in /usr/src/bin/sh/macro.c line 163, 179

zerostak defined in line 23; used 3 times

- in /usr/src/bin/sh/macro.c line 29, 77
- in /usr/src/bin/sh/name.c line 146

#### Usage of this include

stak.h used 1 times

- in /usr/src/bin/sh/defs.h line 138

Last modified: 1982-06-09 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 546 |