-unsigned AllocLineInfoSlot (unsigned Type, unsigned Count)
+int AllocLineInfoSlot (unsigned Type, unsigned Count)
/* Allocate a line info slot of the given type and return the slot index */
{
/* Grow the array if necessary */
CurLineInfo[UsedSlots].Info = 0;
/* Increment the count and return the index of the new slot */
- return UsedSlots++;
+ return (int) UsedSlots++;
}
-void FreeLineInfoSlot (unsigned Slot)
+void FreeLineInfoSlot (int Slot)
/* Free the line info in the given slot. Note: Alloc/Free must be used in
* FIFO order.
*/
{
/* Check the parameter */
- PRECONDITION (Slot == UsedSlots - 1);
+ PRECONDITION (Slot == (int) UsedSlots - 1);
/* Free the last entry */
CurLineInfo[Slot].Info = 0;
-void GenLineInfo (unsigned Slot, const FilePos* Pos)
+void GenLineInfo (int Slot, const FilePos* Pos)
/* Generate a new line info in the given slot */
{
/* Get a pointer to the slot */
-void ClearLineInfo (unsigned Slot)
+void ClearLineInfo (int Slot)
/* Clear the line info in the given slot */
{
/* Zero the pointer */
* standard line info. It is assumed to be always there.
*/
enum {
+ LI_SLOT_INV = -1, /* Use to mark invalid slots */
LI_SLOT_ASM = 0, /* Normal assembler source */
LI_SLOT_EXT = 1, /* Externally supplied line info */
};
void InitLineInfo (void);
/* Initialize the line infos */
-unsigned AllocLineInfoSlot (unsigned Type, unsigned Count);
+int AllocLineInfoSlot (unsigned Type, unsigned Count);
/* Allocate a line info slot of the given type and return the slot index */
-void FreeLineInfoSlot (unsigned Slot);
+void FreeLineInfoSlot (int Slot);
/* Free the line info in the given slot. Note: Alloc/Free must be used in
* FIFO order.
*/
-void GenLineInfo (unsigned Slot, const FilePos* Pos);
+void GenLineInfo (int Slot, const FilePos* Pos);
/* Generate a new line info in the given slot */
-void ClearLineInfo (unsigned Slot);
+void ClearLineInfo (int Slot);
/* Clear the line info in the given slot */
void GetFullLineInfo (Collection* LineInfos, unsigned IncUsage);
+
unsigned ParamCount; /* Number of actual parameters */
TokNode** Params; /* List of actual parameters */
TokNode* ParamExp; /* Node for expanding parameters */
- unsigned LISlot; /* Slot for additional line infos */
+ int LISlot; /* Slot for additional line infos */
};
/* Maximum number of nested macro expansions */
/* Free a complete list of IdDesc structures */
{
while (ID) {
- IdDesc* This = ID;
+ IdDesc* This = ID;
ID = ID->Next;
FreeIdDesc (This);
}
*/
if (Mac->ParamExp) {
- /* Ok, use token from parameter list */
- TokSet (Mac->ParamExp, Mac->LISlot);
+ /* Ok, use token from parameter list, but don't use its line info */
+ TokSet (Mac->ParamExp, LI_SLOT_INV);
/* Set pointer to next token */
Mac->ParamExp = Mac->ParamExp->Next;
-void TokSet (TokNode* N, unsigned LineInfoSlot)
-/* Set the scanner token from the given token node. The given line info slot
- * is used to store the position of the token fed into the scanner.
+void TokSet (TokNode* N, int LineInfoSlot)
+/* Set the scanner token from the given token node. If the given line info
+ * slot is not LI_SLOT_INV, it is used to store the position of the token fed
+ * into the scanner.
*/
{
/* Set the values */
CopyToken (&CurTok, &N->T);
SB_Terminate (&CurTok.SVal);
- /* Set the position */
- GenLineInfo (LineInfoSlot, &CurTok.Pos);
+ /* Set the position if the slot is not invald */
+ if (LineInfoSlot != LI_SLOT_INV) {
+ GenLineInfo (LineInfoSlot, &CurTok.Pos);
+ }
}
void FreeTokNode (TokNode* N);
/* Free the given token node */
-void TokSet (TokNode* N, unsigned LineInfoSlot);
-/* Set the scanner token from the given token node. The given line info slot
- * is used to store the position of the token fed into the scanner.
+void TokSet (TokNode* N, int LineInfoSlot);
+/* Set the scanner token from the given token node. If the given line info
+ * slot is not LI_SLOT_INV, it is used to store the position of the token fed
+ * into the scanner.
*/
enum TC TokCmp (const TokNode* N);