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