When creating a VICE label file, replace characters in labels that VICE
doesn't understand with '_'. Fixes #836.
This commit is contained in:
@@ -532,7 +532,7 @@ void PrintDbgSymLabels (FILE* F)
|
||||
if (GetDbgSym (D, Val) == 0) {
|
||||
|
||||
/* Emit the VICE label line */
|
||||
fprintf (F, "al %06lX .%s\n", Val, GetString (D->Name));
|
||||
PrintLabelLine (F, D->Name, Val);
|
||||
|
||||
/* Insert the symbol into the table */
|
||||
InsertDbgSym (D, Val);
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
|
||||
/* common */
|
||||
#include "addrsize.h"
|
||||
#include "chartype.h"
|
||||
#include "check.h"
|
||||
#include "hashfunc.h"
|
||||
#include "lidefs.h"
|
||||
@@ -1006,6 +1007,36 @@ void PrintImportMap (FILE* F)
|
||||
|
||||
|
||||
|
||||
void PrintLabelLine (FILE* F, unsigned NameId, long Val)
|
||||
/* Output one label into a vice label file doing some cleanup on the name. */
|
||||
{
|
||||
/* Get the name */
|
||||
const char* N = GetString (NameId);
|
||||
|
||||
/* Cleanup the name. It might be generated by the assembler when creating
|
||||
** internally used labels. Such names contain invalid characters to avoid
|
||||
** clashes with user input and cannot be read by VICE.
|
||||
*/
|
||||
fprintf (F, "al %06lX .", Val);
|
||||
if (IsAlpha (*N) || *N == '@' || *N == '?' || *N == '_') {
|
||||
putc (*N, F);
|
||||
} else {
|
||||
putc ('_', F);
|
||||
}
|
||||
++N;
|
||||
while (*N) {
|
||||
if (IsAlpha (*N) || IsDigit (*N) || *N == '_') {
|
||||
putc (*N, F);
|
||||
} else {
|
||||
putc ('_', F);
|
||||
}
|
||||
++N;
|
||||
}
|
||||
putc ('\n', F);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PrintExportLabels (FILE* F)
|
||||
/* Print the exports in a VICE label file */
|
||||
{
|
||||
@@ -1014,7 +1045,8 @@ void PrintExportLabels (FILE* F)
|
||||
/* Print all exports */
|
||||
for (I = 0; I < ExpCount; ++I) {
|
||||
const Export* E = ExpPool [I];
|
||||
fprintf (F, "al %06lX .%s\n", GetExportVal (E), GetString (E->Name));
|
||||
PrintLabelLine (F, E->Name, GetExportVal (E));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +195,9 @@ void PrintExportMapByValue (FILE* F);
|
||||
void PrintImportMap (FILE* F);
|
||||
/* Print an import map to the given file */
|
||||
|
||||
void PrintLabelLine (FILE* F, unsigned NameId, long Val);
|
||||
/* Output one label into a vice label file doing some cleanup on the name. */
|
||||
|
||||
void PrintExportLabels (FILE* F);
|
||||
/* Print the exports in a VICE label file */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user