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 = (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 = (need >> 1) & 077777; 20: do { 21: *wp++ = 0; 22: } while (--cnt); 23: wp = memptr; 24: memptr =+ 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 = ((memptr + 07777) &~ 07777) + 512; 43: }