static unsigned HT_GenHash (const void* Key);
/* Generate the hash over a key. */
-static const void* HT_GetKey (void* Entry);
+static const void* HT_GetKey (const void* Entry);
/* Given a pointer to the user entry data, return a pointer to the key */
static int HT_Compare (const void* Key1, const void* Key2);
unsigned ParamCount; /* Number of actual parameters */
TokNode** Params; /* List of actual parameters */
TokNode* ParamExp; /* Node for expanding parameters */
- int LISlot; /* Slot for additional line infos */
+ LineInfo* LI; /* Line info for the expansion */
};
/* Maximum number of nested macro expansions */
-static const void* HT_GetKey (void* Entry)
+static const void* HT_GetKey (const void* Entry)
/* Given a pointer to the user entry data, return a pointer to the index */
{
return &((Macro*) Entry)->Name;
E->Params[I] = 0;
}
E->ParamExp = 0;
- E->LISlot = AllocLineInfoSlot (LI_TYPE_MACRO, MacExpansions);
+ E->LI = 0;
/* Mark the macro as expanding */
++M->Expansions;
}
xfree (E->Params);
- /* Free the additional line info slot */
- FreeLineInfoSlot (E->LISlot);
+ /* Free the additional line info */
+ if (E->LI) {
+ EndLine (E->LI);
+ }
/* Free the final token if we have one */
if (E->Final) {
ExpandParam:
if (Mac->ParamExp) {
- /* Ok, use token from parameter list, but don't use its line info */
- TokSet (Mac->ParamExp, LI_SLOT_INV);
+ /* Ok, use token from parameter list */
+ TokSet (Mac->ParamExp);
/* Set pointer to next token */
Mac->ParamExp = Mac->ParamExp->Next;
if (Mac->Exp) {
/* Use next macro token */
- TokSet (Mac->Exp, Mac->LISlot);
+ TokSet (Mac->Exp);
+
+ /* Create new line info for this token */
+ if (Mac->LI) {
+ EndLine (Mac->LI);
+ }
+ Mac->LI = StartLine (&CurTok.Pos, LI_TYPE_MACRO, MacExpansions);
/* Set pointer to next token */
Mac->Exp = Mac->Exp->Next;
if (Mac->Final) {
/* Set the final token and remove it */
- TokSet (Mac->Final, LI_SLOT_INV);
+ TokSet (Mac->Final);
FreeTokNode (Mac->Final);
Mac->Final = 0;