/* cc65 */
#include "global.h"
#include "input.h"
+#include "lineinfo.h"
#include "scanner.h"
#include "stmt.h"
#include "error.h"
{
va_list ap;
va_start (ap, Format);
- IntWarning (GetCurrentFile(), curpos, Format, ap);
+ IntWarning (GetInputName (CurTok.LI), GetInputLine (CurTok.LI), Format, ap);
va_end (ap);
}
{
va_list ap;
va_start (ap, Format);
- IntError (GetCurrentFile(), curpos, Format, ap);
+ IntError (GetInputName (CurTok.LI), GetInputLine (CurTok.LI), Format, ap);
va_end (ap);
}
{
va_list ap;
- fprintf (stderr, "%s(%u): Fatal: ", GetCurrentFile(), curpos);
+ const char* FileName;
+ unsigned LineNum;
+ if (CurTok.LI) {
+ FileName = GetInputName (CurTok.LI);
+ LineNum = GetInputLine (CurTok.LI);
+ } else {
+ FileName = GetCurrentFile ();
+ LineNum = GetCurrentLine ();
+ }
+
+ fprintf (stderr, "%s(%u): Fatal: ", FileName, LineNum);
va_start (ap, Format);
vfprintf (stderr, Format, ap);
-void Internal (char* Format, ...)
+void Internal (const char* Format, ...)
/* Print a message about an internal compiler error and die. */
{
va_list ap;
+ const char* FileName;
+ unsigned LineNum;
+ if (CurTok.LI) {
+ FileName = GetInputName (CurTok.LI);
+ LineNum = GetInputLine (CurTok.LI);
+ } else {
+ FileName = GetCurrentFile ();
+ LineNum = GetCurrentLine ();
+ }
+
fprintf (stderr, "%s(%u): Internal compiler error:\n",
- GetCurrentFile(), curpos);
+ FileName, LineNum);
va_start (ap, Format);
vfprintf (stderr, Format, ap);
/* Use abort to create a core dump */
abort ();
-}
+}
+