mirror of
https://github.com/gbdev/rgbds.git
synced 2026-01-11 19:11:52 +00:00
Remove nonstandard <err.h>.
This provides some really nice functions, but does not exist in some environments (particularly MinGW).
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -71,8 +70,11 @@ area_AllocAbs(struct sFreeArea ** ppArea, SLONG org, SLONG size)
|
||||
size + pArea->nSize;
|
||||
|
||||
return (org);
|
||||
} else
|
||||
errx(5, "Out of memory!");
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -164,8 +166,11 @@ AssignCodeSections(void)
|
||||
pSection->nBank = org >> 16;
|
||||
pSection->oAssigned = 1;
|
||||
DOMAXBANK(pSection->nBank);
|
||||
} else
|
||||
errx(5, "Unable to place CODE section anywhere");
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"Unable to place CODE section anywhere\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +190,10 @@ AssignSections(void)
|
||||
for (i = 0; i < MAXBANKS; i += 1) {
|
||||
BankFree[i] = malloc(sizeof *BankFree[i]);
|
||||
|
||||
if (!BankFree[i])
|
||||
errx(5, "Out of memory!");
|
||||
if (!BankFree[i]) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
BankFree[i]->nOrg = 0x0000;
|
||||
@@ -244,7 +251,10 @@ AssignSections(void)
|
||||
if (area_AllocAbs
|
||||
(&BankFree[BANK_BSS], pSection->nOrg,
|
||||
pSection->nByteSize) != pSection->nOrg) {
|
||||
errx(5, "Unable to load fixed BSS section at $%lX", pSection->nOrg);
|
||||
fprintf(stderr,
|
||||
"Unable to load fixed BSS section "
|
||||
"at $%lX\n", pSection->nOrg);
|
||||
exit(1);
|
||||
}
|
||||
pSection->oAssigned = 1;
|
||||
pSection->nBank = BANK_BSS;
|
||||
@@ -253,7 +263,10 @@ AssignSections(void)
|
||||
if (area_AllocAbs
|
||||
(&BankFree[BANK_HRAM], pSection->nOrg,
|
||||
pSection->nByteSize) != pSection->nOrg) {
|
||||
errx(5, "Unable to load fixed HRAM section at $%lX", pSection->nOrg);
|
||||
fprintf(stderr, "Unable to load fixed "
|
||||
"HRAM section at $%lX\n",
|
||||
pSection->nOrg);
|
||||
exit(1);
|
||||
}
|
||||
pSection->oAssigned = 1;
|
||||
pSection->nBank = BANK_HRAM;
|
||||
@@ -262,7 +275,10 @@ AssignSections(void)
|
||||
if (area_AllocAbs
|
||||
(&BankFree[BANK_VRAM], pSection->nOrg,
|
||||
pSection->nByteSize) != pSection->nOrg) {
|
||||
errx(5, "Unable to load fixed VRAM section at $%lX", pSection->nOrg);
|
||||
fprintf(stderr, "Unable to load fixed "
|
||||
"VRAM section at $%lX\n",
|
||||
pSection->nOrg);
|
||||
exit(1);
|
||||
}
|
||||
pSection->oAssigned = 1;
|
||||
pSection->nBank = BANK_VRAM;
|
||||
@@ -271,7 +287,10 @@ AssignSections(void)
|
||||
if (area_AllocAbs
|
||||
(&BankFree[BANK_HOME], pSection->nOrg,
|
||||
pSection->nByteSize) != pSection->nOrg) {
|
||||
errx(5, "Unable to load fixed HOME section at $%lX", pSection->nOrg);
|
||||
fprintf(stderr, "Unable to load fixed "
|
||||
"HOME section at $%lX\n",
|
||||
pSection->nOrg);
|
||||
exit(1);
|
||||
}
|
||||
pSection->oAssigned = 1;
|
||||
pSection->nBank = BANK_HOME;
|
||||
@@ -316,13 +335,15 @@ AssignSections(void)
|
||||
pSection->
|
||||
nByteSize) !=
|
||||
pSection->nOrg) {
|
||||
errx(5, "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX", pSection->nOrg, pSection->nBank);
|
||||
fprintf(stderr, "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX\n", pSection->nOrg, pSection->nBank);
|
||||
exit(1);
|
||||
}
|
||||
DOMAXBANK(pSection->
|
||||
nBank);
|
||||
pSection->oAssigned = 1;
|
||||
} else {
|
||||
errx(5, "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX", pSection->nOrg, pSection->nBank);
|
||||
fprintf(stderr, "Unable to load fixed CODE/DATA section at $%lX in bank $%02lX\n", pSection->nOrg, pSection->nBank);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,12 +369,14 @@ AssignSections(void)
|
||||
if ((pSection->nOrg =
|
||||
area_Alloc(&BankFree[pSection->nBank],
|
||||
pSection->nByteSize)) == -1) {
|
||||
errx(5, "Unable to load fixed CODE/DATA section into bank $%02lX", pSection->nBank);
|
||||
fprintf(stderr, "Unable to load fixed CODE/DATA section into bank $%02lX\n", pSection->nBank);
|
||||
exit(1);
|
||||
}
|
||||
pSection->oAssigned = 1;
|
||||
DOMAXBANK(pSection->nBank);
|
||||
} else {
|
||||
errx(5, "Unable to load fixed CODE/DATA section into bank $%02lX", pSection->nBank);
|
||||
fprintf(stderr, "Unable to load fixed CODE/DATA section into bank $%02lX\n", pSection->nBank);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
pSection = pSection->pNext;
|
||||
@@ -375,7 +398,8 @@ AssignSections(void)
|
||||
area_AllocAbsCODEAnyBank(pSection->nOrg,
|
||||
pSection->nByteSize)) ==
|
||||
-1) {
|
||||
errx(5, "Unable to load fixed CODE/DATA section at $%lX into any bank", pSection->nOrg);
|
||||
fprintf(stderr, "Unable to load fixed CODE/DATA section at $%lX into any bank\n", pSection->nOrg);
|
||||
exit(1);
|
||||
}
|
||||
pSection->oAssigned = 1;
|
||||
DOMAXBANK(pSection->nBank);
|
||||
@@ -397,7 +421,8 @@ AssignSections(void)
|
||||
if ((pSection->nOrg =
|
||||
area_Alloc(&BankFree[BANK_BSS],
|
||||
pSection->nByteSize)) == -1) {
|
||||
errx(5, "BSS section too large");
|
||||
fprintf(stderr, "BSS section too large\n");
|
||||
exit(1);
|
||||
}
|
||||
pSection->nBank = BANK_BSS;
|
||||
pSection->oAssigned = 1;
|
||||
@@ -406,7 +431,8 @@ AssignSections(void)
|
||||
if ((pSection->nOrg =
|
||||
area_Alloc(&BankFree[BANK_HRAM],
|
||||
pSection->nByteSize)) == -1) {
|
||||
errx(5, "HRAM section too large");
|
||||
fprintf(stderr, "HRAM section too large\n");
|
||||
exit(1);
|
||||
}
|
||||
pSection->nBank = BANK_HRAM;
|
||||
pSection->oAssigned = 1;
|
||||
@@ -415,7 +441,8 @@ AssignSections(void)
|
||||
if ((pSection->nOrg =
|
||||
area_Alloc(&BankFree[BANK_VRAM],
|
||||
pSection->nByteSize)) == -1) {
|
||||
errx(5, "VRAM section too large");
|
||||
fprintf(stderr, "VRAM section too large\n");
|
||||
exit(1);
|
||||
}
|
||||
pSection->nBank = BANK_VRAM;
|
||||
pSection->oAssigned = 1;
|
||||
@@ -424,7 +451,8 @@ AssignSections(void)
|
||||
if ((pSection->nOrg =
|
||||
area_Alloc(&BankFree[BANK_HOME],
|
||||
pSection->nByteSize)) == -1) {
|
||||
errx(5, "HOME section too large");
|
||||
fprintf(stderr, "HOME section too large\n");
|
||||
exit(1);
|
||||
}
|
||||
pSection->nBank = BANK_HOME;
|
||||
pSection->oAssigned = 1;
|
||||
@@ -432,7 +460,8 @@ AssignSections(void)
|
||||
case SECT_CODE:
|
||||
break;
|
||||
default:
|
||||
errx(5, "(INTERNAL) Unknown section type!");
|
||||
fprintf(stderr, "(INTERNAL) Unknown section type!\n");
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -92,8 +91,9 @@ AddNeededModules(void)
|
||||
}
|
||||
if (options & OPT_SMART_C_LINK) {
|
||||
if (!addmodulecontaining(smartlinkstartsymbol)) {
|
||||
errx(5, "Can't find start symbol '%s'",
|
||||
fprintf(stderr, "Can't find start symbol '%s'\n",
|
||||
smartlinkstartsymbol);
|
||||
exit(1);
|
||||
} else
|
||||
printf("Smart linking with symbol '%s'\n",
|
||||
smartlinkstartsymbol);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -72,10 +71,14 @@ main(int argc, char *argv[])
|
||||
break;
|
||||
case 'p':
|
||||
fillchar = strtoul(optarg, &ep, 0);
|
||||
if (optarg[0] == '\0' || *ep != '\0')
|
||||
errx(1, "Invalid argument for option 'p'");
|
||||
if (fillchar < 0 || fillchar > 0xFF)
|
||||
errx(1, "Argument for option 'p' must be between 0 and 0xFF");
|
||||
if (optarg[0] == '\0' || *ep != '\0') {
|
||||
fprintf(stderr, "Invalid argument for option 'p'\n");
|
||||
exit(1);
|
||||
}
|
||||
if (fillchar < 0 || fillchar > 0xFF) {
|
||||
fprintf(stderr, "Argument for option 'p' must be between 0 and 0xFF");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
options |= OPT_SMART_C_LINK;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -20,8 +19,11 @@ SetMapfileName(char *name)
|
||||
{
|
||||
mf = fopen(name, "w");
|
||||
|
||||
if (mf == NULL)
|
||||
err(1, "Cannot open mapfile '%s'", name);
|
||||
if (mf == NULL) {
|
||||
fprintf(stderr, "Cannot open mapfile '%s': ", name);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -29,8 +31,10 @@ SetSymfileName(char *name)
|
||||
{
|
||||
sf = fopen(name, "w");
|
||||
|
||||
if (sf == NULL)
|
||||
errx(1, "Cannot open symfile '%s'", name);
|
||||
if (sf == NULL) {
|
||||
fprintf(stderr, "Cannot open symfile '%s'\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fprintf(sf, ";File generated by xLink v" LINK_VERSION "\n\n");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -81,8 +80,8 @@ AllocSection(void)
|
||||
|
||||
*ppSections = malloc(sizeof **ppSections);
|
||||
if (!*ppSections) {
|
||||
errx(5, "Out of memory!");
|
||||
return NULL;
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
(*ppSections)->tSymbols = tSymbols;
|
||||
(*ppSections)->pNext = NULL;
|
||||
@@ -102,13 +101,17 @@ obj_ReadSymbol(FILE * f)
|
||||
struct sSymbol *pSym;
|
||||
|
||||
pSym = malloc(sizeof *pSym);
|
||||
if (!pSym)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pSym) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
readasciiz(s, f);
|
||||
pSym->pzName = malloc(strlen(s) + 1);
|
||||
if (!pSym->pzName)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pSym->pzName) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
strcpy(pSym->pzName, s);
|
||||
if ((pSym->Type = (enum eSymbolType) fgetc(f)) != SYM_IMPORT) {
|
||||
@@ -146,8 +149,9 @@ obj_ReadRGB0Section(FILE * f)
|
||||
*/
|
||||
if (pSection->nByteSize) {
|
||||
pSection->pData = malloc(pSection->nByteSize);
|
||||
if (!pSection->pData)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pSection->pData) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
SLONG nNumberOfPatches;
|
||||
struct sPatch **ppPatch, *pPatch;
|
||||
@@ -164,15 +168,17 @@ obj_ReadRGB0Section(FILE * f)
|
||||
*/
|
||||
while (nNumberOfPatches--) {
|
||||
pPatch = malloc(sizeof *pPatch);
|
||||
if (!pPatch)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pPatch) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
*ppPatch = pPatch;
|
||||
readasciiz(s, f);
|
||||
|
||||
pPatch->pzFilename = malloc(strlen(s) + 1);
|
||||
if (!pPatch->pzFilename)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pPatch->pzFilename) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
strcpy(pPatch->pzFilename, s);
|
||||
|
||||
@@ -186,8 +192,10 @@ obj_ReadRGB0Section(FILE * f)
|
||||
|
||||
if ((pPatch->nRPNSize = readlong(f)) > 0) {
|
||||
pPatch->pRPN = malloc(pPatch->nRPNSize);
|
||||
if (!pPatch->pRPN)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pPatch->pRPN) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fread(pPatch->pRPN, sizeof(UBYTE),
|
||||
pPatch->nRPNSize, f);
|
||||
@@ -219,8 +227,10 @@ obj_ReadRGB0(FILE * pObjfile)
|
||||
|
||||
if (nNumberOfSymbols) {
|
||||
tSymbols = malloc(nNumberOfSymbols * sizeof(struct sSymbol *));
|
||||
if (!tSymbols)
|
||||
errx(5, "Out of memory!");
|
||||
if (!tSymbols) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 0; i < nNumberOfSymbols; i += 1)
|
||||
tSymbols[i] = obj_ReadSymbol(pObjfile);
|
||||
@@ -294,8 +304,10 @@ obj_ReadRGB1Section(FILE * f)
|
||||
*/
|
||||
if (pSection->nByteSize) {
|
||||
pSection->pData = malloc(pSection->nByteSize);
|
||||
if (!pSection->pData)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pSection->pData) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SLONG nNumberOfPatches;
|
||||
struct sPatch **ppPatch, *pPatch;
|
||||
@@ -312,14 +324,16 @@ obj_ReadRGB1Section(FILE * f)
|
||||
*/
|
||||
while (nNumberOfPatches--) {
|
||||
pPatch = malloc(sizeof *pPatch);
|
||||
if (!pPatch)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pPatch) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
*ppPatch = pPatch;
|
||||
readasciiz(s, f);
|
||||
pPatch->pzFilename = malloc(strlen(s) + 1);
|
||||
if (!pPatch->pzFilename)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pPatch->pzFilename) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
strcpy(pPatch->pzFilename, s);
|
||||
pPatch->nLineNo = readlong(f);
|
||||
@@ -327,8 +341,9 @@ obj_ReadRGB1Section(FILE * f)
|
||||
pPatch->Type = (enum ePatchType) fgetc(f);
|
||||
if ((pPatch->nRPNSize = readlong(f)) > 0) {
|
||||
pPatch->pRPN = malloc(pPatch->nRPNSize);
|
||||
if (!pPatch->pRPN)
|
||||
errx(5, "Out of memory!");
|
||||
if (!pPatch->pRPN) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
fread(pPatch->pRPN, sizeof(UBYTE),
|
||||
pPatch->nRPNSize, f);
|
||||
@@ -360,8 +375,9 @@ obj_ReadRGB1(FILE * pObjfile)
|
||||
|
||||
if (nNumberOfSymbols) {
|
||||
tSymbols = malloc(nNumberOfSymbols * sizeof *tSymbols);
|
||||
if (!tSymbols)
|
||||
errx(5, "Out of memory!");
|
||||
if (!tSymbols) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
}
|
||||
|
||||
for (i = 0; i < nNumberOfSymbols; i += 1)
|
||||
tSymbols[i] = obj_ReadSymbol(pObjfile);
|
||||
@@ -424,12 +440,14 @@ obj_ReadOpenFile(FILE * pObjfile, char *tzObjectfile)
|
||||
obj_ReadRGB1(pObjfile);
|
||||
break;
|
||||
default:
|
||||
errx(5, "'%s' is an unsupported version",
|
||||
fprintf(stderr, "'%s' is an unsupported version",
|
||||
tzObjectfile);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
errx(5, "'%s' is not a valid object", tzObjectfile);
|
||||
fprintf(stderr, "'%s' is not a valid object\n", tzObjectfile);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,9 +462,12 @@ obj_Readfile(char *tzObjectfile)
|
||||
oReadLib = 0;
|
||||
|
||||
pObjfile = fopen(tzObjectfile, "rb");
|
||||
if (pObjfile == NULL)
|
||||
err(1, "Unable to open object '%s'",
|
||||
if (pObjfile == NULL) {
|
||||
fprintf(stderr, "Unable to open object '%s': ",
|
||||
tzObjectfile);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
obj_ReadOpenFile(pObjfile, tzObjectfile);
|
||||
fclose(pObjfile);
|
||||
|
||||
@@ -494,10 +515,14 @@ lib_Readfile(char *tzLibfile)
|
||||
oReadLib = 1;
|
||||
|
||||
pObjfile = fopen(tzLibfile, "rb");
|
||||
if (pObjfile == NULL)
|
||||
err(1, "Unable to open object '%s'", tzLibfile);
|
||||
if (pObjfile == NULL) {
|
||||
fprintf(stderr, "Unable to open object '%s': ", tzLibfile);
|
||||
perror(NULL);
|
||||
exit(1);
|
||||
}
|
||||
if (!pObjfile) {
|
||||
errx(5, "Unable to open '%s'", tzLibfile);
|
||||
fprintf(stderr, "Unable to open '%s'\n", tzLibfile);
|
||||
exit(1);
|
||||
}
|
||||
char tzHeader[5];
|
||||
|
||||
@@ -506,8 +531,9 @@ lib_Readfile(char *tzLibfile)
|
||||
if (strcmp(tzHeader, "XLB0") == 0)
|
||||
lib_ReadXLB0(pObjfile);
|
||||
else {
|
||||
errx(5, "'%s' is an invalid library",
|
||||
fprintf(stderr, "'%s' is an invalid library\n",
|
||||
tzLibfile);
|
||||
exit(1);
|
||||
}
|
||||
fclose(pObjfile);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "link/mylink.h"
|
||||
@@ -46,7 +46,8 @@ getsymvalue(SLONG symid)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
errx(5, "*INTERNAL* UNKNOWN SYMBOL TYPE");
|
||||
fprintf(stderr, "*INTERNAL* UNKNOWN SYMBOL TYPE\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SLONG
|
||||
@@ -63,7 +64,8 @@ getsymbank(SLONG symid)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
errx(5, "*INTERNAL* UNKNOWN SYMBOL TYPE");
|
||||
fprintf(stderr, "*INTERNAL* UNKNOWN SYMBOL TYPE\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
SLONG
|
||||
@@ -157,18 +159,20 @@ calcrpn(struct sPatch * pPatch)
|
||||
t = rpnpop();
|
||||
rpnpush(t & 0xFF);
|
||||
if (t < 0 || (t > 0xFF && t < 0xFF00) || t > 0xFFFF) {
|
||||
errx(5,
|
||||
"%s(%ld) : Value must be in the HRAM area",
|
||||
fprintf(stderr,
|
||||
"%s(%ld) : Value must be in the HRAM area\n",
|
||||
pPatch->pzFilename, pPatch->nLineNo);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case RPN_PCEZP:
|
||||
t = rpnpop();
|
||||
rpnpush(t & 0xFF);
|
||||
if (t < 0x2000 || t > 0x20FF) {
|
||||
errx(5,
|
||||
"%s(%ld) : Value must be in the ZP area",
|
||||
fprintf(stderr,
|
||||
"%s(%ld) : Value must be in the ZP area\n",
|
||||
pPatch->pzFilename, pPatch->nLineNo);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case RPN_CONST:
|
||||
@@ -213,10 +217,11 @@ calcrpn(struct sPatch * pPatch)
|
||||
high |= (*rpn++) << 24;
|
||||
t = rpnpop();
|
||||
if (t < low || t > high) {
|
||||
errx(5,
|
||||
"%s(%ld) : Value must be in the range [%ld;%ld]",
|
||||
fprintf(stderr,
|
||||
"%s(%ld) : Value must be in the range [%ld;%ld]\n",
|
||||
pPatch->pzFilename,
|
||||
pPatch->nLineNo, low, high);
|
||||
exit(1);
|
||||
}
|
||||
rpnpush(t);
|
||||
size -= 8;
|
||||
@@ -250,10 +255,11 @@ Patch(void)
|
||||
pSect->pData[pPatch->nOffset] =
|
||||
(UBYTE) t;
|
||||
} else {
|
||||
errx(5,
|
||||
fprintf(stderr,
|
||||
"%s(%ld) : Value must be 8-bit\n",
|
||||
pPatch->pzFilename,
|
||||
pPatch->nLineNo);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case PATCH_WORD_L:
|
||||
@@ -274,10 +280,11 @@ Patch(void)
|
||||
1] = t & 0xFF;
|
||||
}
|
||||
} else {
|
||||
errx(5,
|
||||
fprintf(stderr,
|
||||
"%s(%ld) : Value must be 16-bit\n",
|
||||
pPatch->pzFilename,
|
||||
pPatch->nLineNo);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case PATCH_LONG_L:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -54,7 +53,8 @@ sym_GetValue(char *tzName)
|
||||
}
|
||||
}
|
||||
|
||||
errx(5, "Unknown symbol '%s'", tzName);
|
||||
fprintf(stderr, "Unknown symbol '%s'\n", tzName);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ sym_GetBank(char *tzName)
|
||||
}
|
||||
}
|
||||
|
||||
errx(5, "Unknown symbol '%s'", tzName);
|
||||
fprintf(stderr, "Unknown symbol '%s'\n", tzName);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -92,9 +93,10 @@ sym_CreateSymbol(char *tzName, SLONG nValue, SBYTE nBank)
|
||||
if (nBank == -1)
|
||||
return;
|
||||
|
||||
errx(5,
|
||||
fprintf(stderr,
|
||||
"Symbol '%s' defined more than once\n",
|
||||
tzName);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user