Use UTF-8 for diagnostic output if it is available. Added a command line

switch --no-utf8 to disable the use of UTF-8 characters.
This commit is contained in:
Kugel Fuhr
2025-07-07 21:49:45 +02:00
parent b1eb1bf6ab
commit c466faf484
28 changed files with 435 additions and 214 deletions

View File

@@ -52,6 +52,7 @@
/* ca65 */
#include "condasm.h"
#include "error.h"
#include "expect.h"
#include "filetab.h"
#include "global.h"
#include "incpath.h"
@@ -545,7 +546,7 @@ int NewInputFile (const char* Name)
/* Main file */
F = fopen (Name, "r");
if (F == 0) {
Fatal ("Cannot open input file '%s': %s", Name, strerror (errno));
Fatal ("Cannot open input file `%s': %s", Name, strerror (errno));
}
} else {
/* We are on include level. Search for the file in the include
@@ -554,7 +555,7 @@ int NewInputFile (const char* Name)
PathName = SearchFile (IncSearchPath, Name);
if (PathName == 0 || (F = fopen (PathName, "r")) == 0) {
/* Not found or cannot open, print an error and bail out */
Error ("Cannot open include file '%s': %s", Name, strerror (errno));
Error ("Cannot open include file `%s': %s", Name, strerror (errno));
goto ExitPoint;
}
@@ -571,7 +572,7 @@ int NewInputFile (const char* Name)
** here.
*/
if (FileStat (Name, &Buf) != 0) {
Fatal ("Cannot stat input file '%s': %s", Name, strerror (errno));
Fatal ("Cannot stat input file `%s': %s", Name, strerror (errno));
}
/* Add the file to the input file table and remember the index */
@@ -1196,7 +1197,7 @@ Again:
/* Not found */
if (!LeadingDotInIdents) {
/* Invalid pseudo instruction */
Error ("'%m%p' is not a recognized control command", &CurTok.SVal);
Error ("`%m%p' is not a recognized control command", &CurTok.SVal);
goto Again;
}
@@ -1686,14 +1687,14 @@ unsigned char ParseAddrSize (void)
/* Check for an identifier */
if (CurTok.Tok != TOK_IDENT) {
Error ("Address size specifier expected");
ErrorExpect ("Expected an address size specifier");
return ADDR_SIZE_DEFAULT;
}
/* Convert the attribute */
AddrSize = AddrSizeFromStr (SB_GetConstBuf (&CurTok.SVal));
if (AddrSize == ADDR_SIZE_INVALID) {
Error ("Address size specifier expected");
ErrorExpect ("Expected an address size specifier");
AddrSize = ADDR_SIZE_DEFAULT;
}