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
curstak defined in line 28; used 2 times
fixstak defined in line 44; used 3 times
pushstak defined in line 22; used 10 times
relstak defined in line 19; used 3 times
setstak defined in line 21; used 2 times
usestak defined in line 34; used 2 times
zerostak defined in line 23; used 3 times

Usage of this include

stak.h used 1 times
Last modified: 1982-06-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2288
Valid CSS Valid XHTML 1.0 Strict