|
|
1.1.1.2 ! root 1: /* Created by Microsoft Corp. 1987 */ ! 2: ! 3: #define INCL_DOSMEMMGR ! 4: ! 5: #include <os2def.h> ! 6: #include <bsedos.h> 1.1 root 7: #include "ssedefs.h" 8: 9: 10: 11: 12: /*** allocseg - allocates segments. 13: * 1.1.1.2 ! root 14: * allocseg uses DosAllocSeg to allocate segments from OS/2. 1.1 root 15: * 16: * This routine will return an error code if it is unable to 17: * allocate the segment. 18: * 1.1.1.2 ! root 19: * EXIT rc - return code of DosAllocSeg 1.1 root 20: * 21: * 1.1.1.2 ! root 22: * EFFECTS : allocates memory from OS/2 1.1 root 23: * modifies SegTable (by adding a new segment) 24: * modifies TotalSegs (by incrementing it by one) 25: */ 26: 1.1.1.2 ! root 27: SHORT allocseg() 1.1 root 28: { 1.1.1.2 ! root 29: SHORT rc; /* return code of OS/2 call */ 1.1 root 30: 1.1.1.2 ! root 31: rc = DosAllocSeg(SEGSIZE, ! 32: &(SegTable[TotalSegs].segment), 1.1 root 33: NOTSHARED); 34: 35: if (rc == 0) { 36: SegTable[TotalSegs].free = SEGSIZE; 37: ++TotalSegs; 38: } 39: 40: return(rc); 41: } /* end allocseg */ 42: 43: 44: 45: 46: /*** freesegs - free segments 47: * 1.1.1.2 ! root 48: * freesegs uses DosFreeSeg to free all the segments 1.1 root 49: * allocated by allocseg. 50: * 1.1.1.2 ! root 51: * EFFECTS: frees all alocated memory (segments) to OS/2 1.1 root 52: * sets TotalSegs to zero 53: * makes SegTable invalid 54: */ 55: 56: void freesegs() 57: { 1.1.1.2 ! root 58: register USHORT i; 1.1 root 59: 60: for (i = 0; i < TotalSegs; i++) { 1.1.1.2 ! root 61: DosFreeSeg(SegTable[i].segment); 1.1 root 62: } 63: TotalSegs = 0; 64: } /* end freesegs */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.