1: #include "0x.h"
   2: #include "E.h"
   3: 
   4: extern char *sbrk(), *brk();
   5: 
   6: alloc(need)
   7:     char *need;
   8: {
   9:     register cnt, *wp;
  10:     register char *have;
  11: 
  12:     need = (char *)((unsigned)(need+1) &~ 1);
  13:     if ((have=high-memptr) < need) {
  14:         if (sbrk(need > have + 1024 ? need-have:1024) == -1)
  15:             error(EOUTOFMEM);
  16:         high = sbrk(0);
  17:     }
  18:     wp = memptr;
  19:     cnt = ((unsigned)need >> 1) & 077777;
  20:     do {
  21:         *wp++ = 0;
  22:     } while (--cnt);
  23:     wp = memptr;
  24:     memptr += (unsigned)need;
  25:     stklim();
  26:     return(wp);
  27: }
  28: 
  29: setmem()
  30: {
  31:     high = bottmem = memptr = sbrk(0);
  32:     stklim();
  33: }
  34: 
  35: free(cptr)
  36:     char *cptr;
  37: {
  38: }
  39: 
  40: stklim()
  41: {
  42:     maxstk = (char *)((((unsigned)memptr + 07777) &~ 07777) + 512);
  43: }

Defined functions

setmem defined in line 29; used 1 times
stklim defined in line 40; used 2 times
Last modified: 1986-05-31
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1030
Valid CSS Valid XHTML 1.0 Strict