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.
49 lines
885 B
49 lines
885 B
/*
|
|
Enhanced NCSA Mosaic from Spyglass
|
|
"Guitar"
|
|
|
|
Copyright 1994 Spyglass, Inc.
|
|
All Rights Reserved
|
|
|
|
Author(s):
|
|
Jim Seidman [email protected]
|
|
*/
|
|
|
|
#include "all.h"
|
|
|
|
static struct hash_table Atoms;
|
|
BOOL bInit = FALSE;
|
|
|
|
PUBLIC HTAtom HTAtom_for(CONST char *string)
|
|
{
|
|
HTAtom a;
|
|
|
|
/* First time around, clear hash table
|
|
*/
|
|
if (!bInit)
|
|
{
|
|
Hash_Init(&Atoms);
|
|
bInit = TRUE;
|
|
}
|
|
|
|
a = Hash_FindOrAdd(&Atoms, (char *) string, NULL, NULL) + 1;
|
|
return a;
|
|
}
|
|
|
|
PUBLIC char *HTAtom_name(HTAtom atom)
|
|
{
|
|
char *result = NULL;
|
|
int err;
|
|
|
|
err = Hash_GetIndexedEntry(&Atoms, (int) atom - 1, &result, NULL, NULL);
|
|
|
|
XX_Assert((err >= 0) , ("Failed to get name for atom %d, returning 0x%x\n", atom, result));
|
|
|
|
return result;
|
|
}
|
|
|
|
PUBLIC void HTAtom_deleteAll(void)
|
|
{
|
|
if (bInit)
|
|
Hash_FreeContents(&Atoms);
|
|
}
|