mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Remove deprecated "section charmap" feature
This commit is contained in:
@@ -22,7 +22,6 @@ struct Section {
|
||||
uint32_t nAlign;
|
||||
struct Section *pNext;
|
||||
struct Patch *pPatches;
|
||||
struct Charmap *charmap;
|
||||
uint8_t *tData;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,17 +33,6 @@ static struct Charmap *currentCharmap;
|
||||
|
||||
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 charmap_Add(char *input, uint8_t output)
|
||||
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_Add(char *input, uint8_t output)
|
||||
|
||||
int32_t charmap_Convert(char **input)
|
||||
{
|
||||
struct Charmap *charmap;
|
||||
struct Charmap *charmap = currentCharmap;
|
||||
struct Charnode *charnode;
|
||||
|
||||
char *output;
|
||||
@@ -226,19 +194,6 @@ int32_t charmap_Convert(char **input)
|
||||
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)
|
||||
fatalerror("Not enough memory for buffer");
|
||||
|
||||
@@ -642,7 +642,6 @@ struct Section *out_FindSection(char *pzName, uint32_t secttype, int32_t org,
|
||||
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)) {
|
||||
|
||||
@@ -71,7 +71,7 @@ SECTION "sec0", ROM0
|
||||
|
||||
print "ab"
|
||||
|
||||
printt "override main charmap\n"
|
||||
printt "modify main charmap\n"
|
||||
charmap "ef", $3
|
||||
|
||||
print "ab"
|
||||
|
||||
@@ -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 @@ $1
|
||||
$6364
|
||||
setcharmap main
|
||||
$0
|
||||
override main charmap
|
||||
$6162
|
||||
modify main charmap
|
||||
$0
|
||||
$3
|
||||
setcharmap map1
|
||||
pushc
|
||||
|
||||
Reference in New Issue
Block a user