|
|
Microsoft Windows NT Build 297 06-28-1992
/******************************************************************************\
*
* MODULE: LOOKUP.C
*
* PURPOSE: Provides supporting functions for doing lookups in
* LOOKUPENTRY tables.
*
* FUNTIONS: dwLookupWord() - given WORD index returns DWORD value
* iLookupWord() - given WORD index returns int value
* lpszLookupInt() - given int index returns LPSTR value
*
\******************************************************************************/
#include <windows.h>
#include "lookup.h"
/******************************************************************************\
*
* FUNCTION: dwLookupWord
*
* INPUTS: pLookup - pointer to LOOKUPENTRY array
* wIndex - wIndex to search for in array
* iMaxEntries - number elements in array
*
* RETURNS: DWORD value corresponding to wIndex in LOOKUPENTRY array,
* or 0
*
* LOCAL VARS: int i - loop variable
*
\******************************************************************************/
DWORD dwLookupWord (PLOOKUPENTRY pLookup, WORD wIndex, int iMaxEntries)
{
int i;
for (i = 0; i < iMaxEntries; i++)
if ((pLookup + i)->x.wIndex == wIndex)
return (pLookup + i)->v.dwValue;
return 0;
}
/******************************************************************************\
*
* FUNCTION: iLookupWord
*
* INPUTS: pLookup - pointer to LOOKUPENTRY array
* wIndex - wIndex to search for in array
* iMaxEntries - number elements in array
*
* RETURNS: int value corresponding to wIndex in LOOKUPENTRY array, or
* 0
*
* LOCAL VARS: int i - loop variable
*
\******************************************************************************/
int iLookupWord (PLOOKUPENTRY pLookup, WORD wIndex, int iMaxEntries)
{
int i;
for (i = 0; i < iMaxEntries; i++)
if ((pLookup + i)->x.wIndex == wIndex)
return (pLookup + i)->v.iValue;
return 0;
}
/******************************************************************************\
*
* FUNCTION: lpszLookupInt
*
* INPUTS: pLookup - pointer to LOOKUPENTRY array
* iIndex - iIndex to search for in array
* iMaxEntries - number elements in array
*
* RETURNS: LPTSTR value corresponding to iIndex in LOOKUPENTRY array,
* or 0
*
* LOCAL VARS: int i - loop variable
*
\******************************************************************************/
LPTSTR lpszLookupInt (PLOOKUPENTRY pLookup, int iIndex, int iMaxEntries)
{
int i;
for (i = 0; i < iMaxEntries; i++)
if ((pLookup + i)->x.iIndex == iIndex)
return (pLookup + i)->lpszValue;
return (LPTSTR) NULL;
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.