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

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

void FindNext(LastHighest)
long *LastHighest;

/*
Finds the next lowest adrs in mpt based on the present value of
LastHighest. Additionally, it rets either an adrs or a nil value if
the table search is exhausted.

calling params:
last highest adrs in table

return params:
next lowest hndl adrs in mpt
Author: Byro
Creation: 01/10/91
Modified: 01/31/91
Revision:

*/

{
int i;
long evenLower = ZERO,
nextLowest = ZERO,
temp = ZERO,
*thisHndl = NIL;
unsigned long myTemp;

extern long gMPTsize,
*gTableSizeCountAdrs,
*gTopOfHeap;

/* Debugger(); */
if (*LastHighest == A_HIGH_NUMBER) /* hndls init cond */
{
myTemp = (unsigned long) gTopOfHeap + 1;
*LastHighest = myTemp;
}

for (i = 1; i <= gMPTsize; i++)
{
myTemp = (unsigned long) gTableSizeCountAdrs + (i * BYTE_OFFSET);
thisHndl = (long *) myTemp;

if ((*thisHndl < *LastHighest) && (*thisHndl != NIL))
evenLower = (long) *thisHndl;

if (nextLowest < evenLower) /* swap */
{
temp = nextLowest;
nextLowest = evenLower;
evenLower = temp;
}
}
*LastHighest = nextLowest;
}


  3 Responses to “Category : C Source Code
Archive   : HEAPMAN.ZIP
Filename : FINDNEXT.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: http://www.os2museum.com/wp/mtswslnk/