Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

tokentable.c File Reference

#include "lclintMacros.nf"
#include "llbasic.h"
#include "osd.h"
#include "tokentable.h"

Go to the source code of this file.

Functions

ltoken LSLInsertToken (ltokenCode cod, lsymbol sym, lsymbol rTxt, bool def)
void LSLUpdateToken (ltokenCode cod, lsymbol sym, bool def)
void LSLSetTokenHasSyn (lsymbol sym, bool syn)
ltoken LSLGetToken (lsymbol sym)
ltoken LSLReserveToken (ltokenCode cod, char *txt)
void ltokenTableInit (void)
void ltokenTableCleanup (void)


Function Documentation

ltoken LSLGetToken ( lsymbol sym )
 

Definition at line 90 of file tokentable.c.

Referenced by LSLGetTokenForSyn().

00091 {
00092   llassert (TokenTable != NULL);
00093 
00094   if (!((sym < MaxToken) || (!ltoken_isUndefined (TokenTable[sym]))))
00095     {
00096       llcontbuglit ("LSLGetToken: bad argument");
00097       return TokenTable[0];
00098     }
00099 
00100   return TokenTable[sym];
00101 }

ltoken LSLInsertToken ( ltokenCode cod,
lsymbol sym,
lsymbol rTxt,
bool def )
 

Definition at line 39 of file tokentable.c.

Referenced by LSLReserveToken(), lscanLine(), and parseSignatures().

00040 {
00041   while (sym >= MaxToken)
00042     {
00043       AllocTokenTable ();
00044     }
00045 
00046   llassert (TokenTable != NULL);
00047 
00048   if (ltoken_isUndefined (TokenTable[sym]))
00049     {
00050       TokenTable[sym] = ltoken_create (cod, sym);        
00051       ltoken_setRawText (TokenTable[sym], rTxt);
00052       ltoken_setDefined (TokenTable[sym], def);
00053     }
00054   
00055   return TokenTable[sym];
00056 }

ltoken LSLReserveToken ( ltokenCode cod,
char * txt )
 

Definition at line 104 of file tokentable.c.

Referenced by lscanLineInit().

00105 {
00106   lsymbol sym;
00107   
00108   sym = lsymbol_fromChars (txt);
00109 
00110   /* 
00111   ** Reserved tokens never have raw text like synonyms.
00112   */
00113 
00114   return LSLInsertToken (cod, sym, lsymbol_undefined, TRUE);
00115 }

void LSLSetTokenHasSyn ( lsymbol sym,
bool syn )
 

Definition at line 76 of file tokentable.c.

Referenced by LSLAddSyn().

00077 {
00078   llassert (TokenTable != NULL);
00079     
00080   if (!ltoken_isUndefined (TokenTable[sym]))
00081     {
00082       ltoken_setHasSyn (TokenTable[sym], syn);
00083     }
00084   else
00085     {
00086       llbuglit ("LSLSetTokenHasSyn: null token");
00087     }
00088 }

void LSLUpdateToken ( ltokenCode cod,
lsymbol sym,
bool def )
 

Definition at line 59 of file tokentable.c.

00060 {
00061   llassert (TokenTable != NULL);
00062 
00063   if (!ltoken_isUndefined (TokenTable[sym]))
00064     {
00065       ltoken_setCode (TokenTable[sym], cod);
00066       ltoken_setDefined (TokenTable[sym], def);
00067     }
00068   else
00069     {
00070       llfatalbug (message ("LSLUpdateToken: token not in table: %d, text: %s", 
00071                            (int) cod, cstring_fromChars (lsymbol_toChars (sym))));
00072     }
00073 }

void ltokenTableCleanup ( void )
 

Definition at line 166 of file tokentable.c.

00167 {
00168   if (TokenTable != NULL)
00169     {
00170       long unsigned i;
00171       
00172       for (i = 0; i < MaxToken; i++)
00173         {
00174           ltoken_free (TokenTable[i]);
00175         }
00176 
00177       sfree (TokenTable); 
00178       TokenTable = NULL;
00179     }
00180 }

void ltokenTableInit ( void )
 

Definition at line 160 of file tokentable.c.

00161 {
00162   MaxToken = 0;
00163 }


Generated at Fri Nov 3 18:58:14 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000