ref: b1d4be66e49ba1b722e9a7a072c39b22f0f9c7e5
parent: ef43ae0eea5fcaab931b42baa2aa9245a6c79a08
author: ISSOtm <[email protected]>
date: Tue Dec 3 20:56:06 EST 2019
Remove deprecated "section charmap" feature
--- a/include/asm/output.h
+++ b/include/asm/output.h
@@ -22,7 +22,6 @@
uint32_t nAlign;
struct Section *pNext;
struct Patch *pPatches;
- struct Charmap *charmap;
uint8_t *tData;
};
--- a/src/asm/charmap.c
+++ b/src/asm/charmap.c
@@ -33,17 +33,6 @@
struct CharmapStackEntry *charmapStack;
-static void warnSectionCharmap(void)
-{
- static bool warned = false;
-
- if (warned)
- return;
-
- warning(WARNING_OBSOLETE, "Using 'charmap' within a section when the current charmap is 'main' is deprecated");
- warned = true;
-}
-
static uint32_t charmap_CalcHash(const char *s)
{
return calchash(s) % CHARMAP_HASH_SIZE;
@@ -163,30 +152,9 @@
int32_t i;
uint8_t v;
- struct Charmap *charmap;
+ struct Charmap *charmap = currentCharmap;
struct Charnode *curr_node, *temp_node;
- /*
- * If the user tries to define a character mapping inside a section
- * and the current global charmap is the "main" one, then a local
- * section charmap will be created or modified instead of the global
- * one. In other words, the local section charmap can override the
- * main global one, but not the others.
- */
- if (pCurrentSection && currentCharmap == mainCharmap) {
- warnSectionCharmap();
- if (pCurrentSection->charmap) {
- charmap = pCurrentSection->charmap;
- } else {
- charmap = calloc(1, sizeof(struct Charmap));
- if (charmap == NULL)
- fatalerror("Not enough memory for charmap");
- pCurrentSection->charmap = charmap;
- }
- } else {
- charmap = currentCharmap;
- }
-
if (charmap->charCount >= MAXCHARMAPS || strlen(input) > CHARMAPLENGTH)
return -1;
@@ -217,7 +185,7 @@
int32_t charmap_Convert(char **input)
{
- struct Charmap *charmap;
+ struct Charmap *charmap = currentCharmap;
struct Charnode *charnode;
char *output;
@@ -225,19 +193,6 @@
int32_t i, match, length;
uint8_t v, foundCode;
-
- /*
- * If there is a local section charmap and the current global charmap
- * is the "main" one, the local one is used. Otherwise, the global
- * one is used. In other words, the local section charmap can override
- * the main global one, but not the others.
- */
- if (pCurrentSection &&
- pCurrentSection->charmap &&
- currentCharmap == mainCharmap)
- charmap = pCurrentSection->charmap;
- else
- charmap = currentCharmap;
output = malloc(strlen(*input));
if (output == NULL)
--- a/src/asm/output.c
+++ b/src/asm/output.c
@@ -642,7 +642,6 @@
pSect->nAlign = alignment;
pSect->pNext = NULL;
pSect->pPatches = NULL;
- pSect->charmap = NULL;
/* It is only needed to allocate memory for ROM sections. */
if (sect_HasData(secttype)) {
--- a/test/asm/multiple-charmaps.asm
+++ b/test/asm/multiple-charmaps.asm
@@ -71,7 +71,7 @@
print "ab"
-printt "override main charmap\n"
+printt "modify main charmap\n"
charmap "ef", $3
print "ab"
--- a/test/asm/multiple-charmaps.out
+++ b/test/asm/multiple-charmaps.out
@@ -1,5 +1,3 @@
-warning: multiple-charmaps.asm(75): [-Wobsolete]
- Using 'charmap' within a section when the current charmap is 'main' is deprecated
ERROR: multiple-charmaps.asm(100) -> multiple-charmaps.asm::new_(7):
Charmap 'map1' already exists
ERROR: multiple-charmaps.asm(102) -> multiple-charmaps.asm::set_(13):
@@ -24,8 +22,8 @@
$6364
setcharmap main
$0
-override main charmap
-$6162
+modify main charmap
+$0
$3
setcharmap map1
pushc