mirror of
https://github.com/cc65/cc65.git
synced 2024-06-17 16:29:32 +00:00
Add StrPool lookup
This commit is contained in:
parent
acf9676c0f
commit
42a93f00d4
|
@ -281,3 +281,22 @@ unsigned SP_GetCount (const StringPool* P)
|
|||
{
|
||||
return CollCount (&P->Entries);
|
||||
}
|
||||
|
||||
unsigned SP_Lookup(StringPool *P, const StrBuf *S)
|
||||
/*
|
||||
** Determine whether the given string is in the pool.
|
||||
** Returns 1 if the string is in the pool, 0 otherwise.
|
||||
*/
|
||||
{
|
||||
return HT_Find (&P->Tab, S) != 0;
|
||||
}
|
||||
|
||||
unsigned SP_LookupStr(StringPool *P, const char *S)
|
||||
/*
|
||||
** Determine whether the given string is in the pool.
|
||||
** Returns 1 if the string is in the pool, 0 otherwise.
|
||||
*/
|
||||
{
|
||||
StrBuf Buf;
|
||||
return SP_Lookup (P, SB_InitFromString (&Buf, S));
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ const StrBuf* SP_Get (const StringPool* P, unsigned Index);
|
|||
|
||||
unsigned SP_Add (StringPool* P, const StrBuf* S);
|
||||
/* Add a string buffer to the buffer and return the index. If the string does
|
||||
** already exist in the pool, SP_AddBuf will just return the index of the
|
||||
** already exist in the pool, SP_Add will just return the index of the
|
||||
** existing string.
|
||||
*/
|
||||
|
||||
|
@ -96,6 +96,18 @@ unsigned SP_AddStr (StringPool* P, const char* S);
|
|||
unsigned SP_GetCount (const StringPool* P);
|
||||
/* Return the number of strings in the pool */
|
||||
|
||||
unsigned SP_Lookup(StringPool *P, const StrBuf *S);
|
||||
/*
|
||||
** Determine whether the given string is in the pool.
|
||||
** Returns 1 if the string is in the pool, 0 otherwise.
|
||||
*/
|
||||
|
||||
unsigned SP_LookupStr(StringPool *P, const char *S);
|
||||
/*
|
||||
** Determine whether the given string is in the pool.
|
||||
** Returns 1 if the string is in the pool, 0 otherwise.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* End of strpool.h */
|
||||
|
|
Loading…
Reference in New Issue
Block a user