/* */
/* */
/* */
-/* (C) 1998-2007, Ullrich von Bassewitz */
+/* (C) 1998-2009, Ullrich von Bassewitz */
/* Roemerstrasse 52 */
/* D-70794 Filderstadt */
/* EMail: uz@cc65.org */
/* Initialize a MacroExp structure */
{
InitCollection (&E->ActualArgs);
- InitStrBuf (&E->Replacement);
+ SB_Init (&E->Replacement);
E->M = M;
return E;
}
FreeStrBuf (CollAtUnchecked (&E->ActualArgs, I));
}
DoneCollection (&E->ActualArgs);
- DoneStrBuf (&E->Replacement);
+ SB_Done (&E->Replacement);
}
}
/* Check for end of macro param list */
- if (CurC == ')') {
+ if (CurC == ')') {
NextChar ();
break;
}
}
/* Deallocate string buf resources */
- DoneStrBuf (&Arg);
+ SB_Done (&Arg);
}
/* Remember the current input and switch to the macro replacement. */
+ int OldIndex = SB_GetIndex (&E->M->Replacement);
SB_Reset (&E->M->Replacement);
OldSource = InitLine (&E->M->Replacement);
/* Switch back the input */
InitLine (OldSource);
+ SB_SetIndex (&E->M->Replacement, OldIndex);
}
static void ExpandMacro (StrBuf* Target, Macro* M)
/* Expand a macro into Target */
{
- /* ### printf ("Expanding %s(%u)\n", M->Name, ++V); */
+#if 0
+ static unsigned V = 0;
+ printf ("Expanding %s(%u)\n", M->Name, ++V);
+#endif
/* Check if this is a function like macro */
if (M->ArgCount >= 0) {
DoneMacroExp (&E);
}
- /* ### printf ("Done with %s(%u)\n", M->Name, V--); */
+#if 0
+ printf ("Done with %s(%u)\n", M->Name, V--);
+#endif
}
while (IsSpace (SB_LookAtLast (&M->Replacement))) {
SB_Drop (&M->Replacement, 1);
}
-
- /* ### printf ("%s: <%.*s>\n", M->Name, SB_GetLen (&M->Replacement), SB_GetConstBuf (&M->Replacement)); */
+#if 0
+ printf ("%s: <%.*s>\n", M->Name, SB_GetLen (&M->Replacement), SB_GetConstBuf (&M->Replacement));
+#endif
/* If we have an existing macro, check if the redefinition is identical.
* Print a diagnostic if not.
Done:
/* Free the allocated filename data */
- DoneStrBuf (&Filename);
+ SB_Done (&Filename);
/* Clear the remaining line so the next input will come from the new
* file (if open)
Done:
if (Verbosity > 1 && SB_NotEmpty (Line)) {
printf ("%s(%u): %.*s\n", GetCurrentFile (), GetCurrentLine (),
- SB_GetLen (Line), SB_GetConstBuf (Line));
+ (int) SB_GetLen (Line), SB_GetConstBuf (Line));
}
}