mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.2 KiB
104 lines
2.2 KiB
/**********************************************************************/
|
|
/** Microsoft LAN Manager **/
|
|
/** Copyright(c) Microsoft Corp., 1987-1990 **/
|
|
/**********************************************************************/
|
|
|
|
/*
|
|
|
|
lextable.hxx
|
|
MIDL Compiler Lexeme Table Definition
|
|
|
|
This class centralizes access to allocated strings throughout the
|
|
compiler.
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
FILE HISTORY :
|
|
|
|
DonnaLi 08-23-1990 Created.
|
|
|
|
*/
|
|
|
|
#ifndef __LEXTABLE_HXX__
|
|
#define __LEXTABLE_HXX__
|
|
|
|
#include "dict.hxx"
|
|
|
|
/**********************************************************************\
|
|
|
|
NAME: LexKey
|
|
|
|
SYNOPSIS: Defines the key to the lexeme table.
|
|
|
|
INTERFACE:
|
|
|
|
CAVEATS:
|
|
|
|
NOTES:
|
|
|
|
HISTORY:
|
|
Donnali 08-23-1990 Initial creation
|
|
Donnali 12-04-1990 Port to Dov's generic dictionary
|
|
|
|
\**********************************************************************/
|
|
|
|
class LexKey
|
|
{
|
|
char *sz; // lexeme that serves as key to the LexTable
|
|
public:
|
|
LexKey() { sz = 0; }
|
|
LexKey(char * psz) { sz = psz; }
|
|
~LexKey() { }
|
|
char *GetString() { return sz; }
|
|
void SetString(char * psz) { sz = psz; }
|
|
void Print(void) { printf("%s", sz); }
|
|
|
|
friend void PrintLexeme(void *);
|
|
friend int CompareLexeme(void *, void *);
|
|
};
|
|
|
|
/**********************************************************************\
|
|
|
|
NAME: LexTable
|
|
|
|
SYNOPSIS: Defines the lexeme table.
|
|
|
|
INTERFACE: LexTable ()
|
|
Constructor.
|
|
LexInsert ()
|
|
Inserts a lexeme into the lexeme table.
|
|
LexSearch ()
|
|
Searches the lexeme table for a lexeme.
|
|
|
|
CAVEATS: This implementation does not support deletion of strings
|
|
from the lexeme table.
|
|
|
|
NOTES:
|
|
|
|
HISTORY:
|
|
Donnali 08-23-1990 Initial creation
|
|
|
|
\**********************************************************************/
|
|
|
|
class LexTable : public Dictionary
|
|
{
|
|
size_t BufferSize; // size of the current buffer
|
|
size_t BufferNext; // next position for new lexeme
|
|
char * pBuffer; // pointer to current buffer
|
|
LexKey SearchKey; // used to hold a search string
|
|
|
|
public:
|
|
|
|
LexTable(
|
|
size_t Size,
|
|
int (* pfnCompare)(void *, void *) = CompareLexeme,
|
|
void (* pfnPrint)(void *) = PrintLexeme
|
|
);
|
|
char * LexInsert(char * psz);
|
|
char * LexSearch(char * psz);
|
|
|
|
};
|
|
|
|
#endif // __LEXTABLE_HXX__
|