Category : C Source Code
Archive   : HEAPMAN.ZIP
Filename : NUHNDL.C

Output of file : NUHNDL.C contained in archive : HEAPMAN.ZIP
#include "mm.h"

long *NuHndl(theSize)
int theSize;

rets a hndl to a blk of mem of size "blk + hdr" if enough heap
space is available. Otherwise, it rets a NIL ptr. Note: in order to
access the data area of the allocated hndl, the user app must offset
by a value equal to the blk hdr in bytes.

calling params:
blk size in bytes

return params:
hndl | NIL
Author: Byro
Creation: 01/09/91
Modified: 01/21/91


int emptyHndl = ZERO;
long *aHndl = NIL;
unsigned long myTemp;

extern long gMPTsize,

/* chk free space, if enough or ret location of free hndl */

if (ComputeFree((long) theSize, &emptyHndl) != NO_ERR)

/* chk to see if mpt full and ret if true */

if (emptyHndl == ZERO)

/* load hndl and adrs of mem; var myTemp needed to avoid add errs */

myTemp = (unsigned long) gTableSizeCountAdrs + (emptyHndl * BYTE_OFFSET);
aHndl = (long *) myTemp;
myTemp = (unsigned long) gTableSizeCountAdrs + ((gMPTsize + 1) * BYTE_OFFSET);
*aHndl = myTemp; /* free space above mpt */

/* setup data struct to nu blk */

if (UpdateBlk(aHndl, theSize) != NO_ERR)

/* compact heap */

if (CompactHeap() != NO_ERR)


  3 Responses to “Category : C Source Code
Archive   : HEAPMAN.ZIP
Filename : NUHNDL.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: