mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 02:32:06 +00:00
Use ++ and -- instead of [+-]= 1
Seriously...
This commit is contained in:
@@ -150,24 +150,24 @@ static void copyrept(void)
|
|||||||
while (src < bufferEnd && level) {
|
while (src < bufferEnd && level) {
|
||||||
if (instring == 0) {
|
if (instring == 0) {
|
||||||
if (isRept(src)) {
|
if (isRept(src)) {
|
||||||
level += 1;
|
level++;
|
||||||
src += 4;
|
src += 4;
|
||||||
} else if (isEndr(src)) {
|
} else if (isEndr(src)) {
|
||||||
level -= 1;
|
level--;
|
||||||
src += 4;
|
src += 4;
|
||||||
} else {
|
} else {
|
||||||
if (*src == '\"')
|
if (*src == '\"')
|
||||||
instring = 1;
|
instring = 1;
|
||||||
src += 1;
|
src++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (*src == '\\') {
|
if (*src == '\\') {
|
||||||
src += 2;
|
src += 2;
|
||||||
} else if (*src == '\"') {
|
} else if (*src == '\"') {
|
||||||
src += 1;
|
src++;
|
||||||
instring = 0;
|
instring = 0;
|
||||||
} else {
|
} else {
|
||||||
src += 1;
|
src++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,10 +188,10 @@ static void copyrept(void)
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
tzNewMacro[ulNewMacroSize] = 0;
|
tzNewMacro[ulNewMacroSize] = 0;
|
||||||
for (i = 0; i < ulNewMacroSize; i += 1) {
|
for (i = 0; i < ulNewMacroSize; i++) {
|
||||||
tzNewMacro[i] = src[i];
|
tzNewMacro[i] = src[i];
|
||||||
if (src[i] == '\n')
|
if (src[i] == '\n')
|
||||||
nLineNo+=1;
|
nLineNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
yyskipbytes(ulNewMacroSize + 4);
|
yyskipbytes(ulNewMacroSize + 4);
|
||||||
@@ -220,24 +220,24 @@ static void copymacro(void)
|
|||||||
while (src < bufferEnd && level) {
|
while (src < bufferEnd && level) {
|
||||||
if (instring == 0) {
|
if (instring == 0) {
|
||||||
if (isMacro(src)) {
|
if (isMacro(src)) {
|
||||||
level += 1;
|
level++;
|
||||||
src += 4;
|
src += 4;
|
||||||
} else if (isEndm(src)) {
|
} else if (isEndm(src)) {
|
||||||
level -= 1;
|
level--;
|
||||||
src += 4;
|
src += 4;
|
||||||
} else {
|
} else {
|
||||||
if(*src == '\"')
|
if(*src == '\"')
|
||||||
instring = 1;
|
instring = 1;
|
||||||
src += 1;
|
src++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (*src == '\\') {
|
if (*src == '\\') {
|
||||||
src += 2;
|
src += 2;
|
||||||
} else if (*src == '\"') {
|
} else if (*src == '\"') {
|
||||||
src += 1;
|
src++;
|
||||||
instring = 0;
|
instring = 0;
|
||||||
} else {
|
} else {
|
||||||
src += 1;
|
src++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,10 +257,10 @@ static void copymacro(void)
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
tzNewMacro[ulNewMacroSize] = 0;
|
tzNewMacro[ulNewMacroSize] = 0;
|
||||||
for (i = 0; i < ulNewMacroSize; i += 1) {
|
for (i = 0; i < ulNewMacroSize; i++) {
|
||||||
tzNewMacro[i] = src[i];
|
tzNewMacro[i] = src[i];
|
||||||
if (src[i] == '\n')
|
if (src[i] == '\n')
|
||||||
nLineNo += 1;
|
nLineNo++;
|
||||||
}
|
}
|
||||||
|
|
||||||
yyskipbytes(ulNewMacroSize + 4);
|
yyskipbytes(ulNewMacroSize + 4);
|
||||||
@@ -651,8 +651,8 @@ lines : /* empty */
|
|||||||
nListCountEmpty = 0;
|
nListCountEmpty = 0;
|
||||||
nPCOffset = 1;
|
nPCOffset = 1;
|
||||||
} line '\n' {
|
} line '\n' {
|
||||||
nLineNo += 1;
|
nLineNo++;
|
||||||
nTotalLines += 1;
|
nTotalLines++;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ int32_t charmap_Convert(char **input)
|
|||||||
if (match) {
|
if (match) {
|
||||||
output[length] = foundCode;
|
output[length] = foundCode;
|
||||||
|
|
||||||
length += 1;
|
length++;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* put a utf-8 character
|
* put a utf-8 character
|
||||||
|
|||||||
@@ -413,7 +413,7 @@ void fstk_RunInclude(char *tzFileName)
|
|||||||
/* Dirty hack to give the INCLUDE directive a linefeed */
|
/* Dirty hack to give the INCLUDE directive a linefeed */
|
||||||
|
|
||||||
yyunput('\n');
|
yyunput('\n');
|
||||||
nLineNo -= 1;
|
nLineNo--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static int32_t gbgfx2bin(char ch)
|
|||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
for (i = 0; i <= 3; i += 1) {
|
for (i = 0; i <= 3; i++) {
|
||||||
if (CurrentOptions.gbgfx[i] == ch)
|
if (CurrentOptions.gbgfx[i] == ch)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -46,7 +46,7 @@ static int32_t binary2bin(char ch)
|
|||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
for (i = 0; i <= 1; i += 1) {
|
for (i = 0; i <= 1; i++) {
|
||||||
if (CurrentOptions.binary[i] == ch)
|
if (CurrentOptions.binary[i] == ch)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@@ -80,22 +80,22 @@ static int32_t ascii2bin(char *s)
|
|||||||
switch (*s) {
|
switch (*s) {
|
||||||
case '$':
|
case '$':
|
||||||
radix = 16;
|
radix = 16;
|
||||||
s += 1;
|
s++;
|
||||||
convertfunc = char2bin;
|
convertfunc = char2bin;
|
||||||
break;
|
break;
|
||||||
case '&':
|
case '&':
|
||||||
radix = 8;
|
radix = 8;
|
||||||
s += 1;
|
s++;
|
||||||
convertfunc = char2bin;
|
convertfunc = char2bin;
|
||||||
break;
|
break;
|
||||||
case '`':
|
case '`':
|
||||||
radix = 4;
|
radix = 4;
|
||||||
s += 1;
|
s++;
|
||||||
convertfunc = gbgfx2bin;
|
convertfunc = gbgfx2bin;
|
||||||
break;
|
break;
|
||||||
case '%':
|
case '%':
|
||||||
radix = 2;
|
radix = 2;
|
||||||
s += 1;
|
s++;
|
||||||
convertfunc = binary2bin;
|
convertfunc = binary2bin;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ void upperstring(char *s)
|
|||||||
{
|
{
|
||||||
while (*s) {
|
while (*s) {
|
||||||
*s = toupper(*s);
|
*s = toupper(*s);
|
||||||
s += 1;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void lowerstring(char *s)
|
|||||||
{
|
{
|
||||||
while (*s) {
|
while (*s) {
|
||||||
*s = tolower(*s);
|
*s = tolower(*s);
|
||||||
s += 1;
|
s++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ void lex_FloatDeleteRange(uint32_t id, uint16_t start, uint16_t end)
|
|||||||
|
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tFloatingChars[start] &= ~id;
|
tFloatingChars[start] &= ~id;
|
||||||
start += 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ void lex_FloatAddRange(uint32_t id, uint16_t start, uint16_t end)
|
|||||||
|
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tFloatingChars[start] |= id;
|
tFloatingChars[start] |= id;
|
||||||
start += 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ void lex_FloatDeleteFirstRange(uint32_t id, uint16_t start, uint16_t end)
|
|||||||
|
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tFloatingFirstChar[start] &= ~id;
|
tFloatingFirstChar[start] &= ~id;
|
||||||
start += 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ void lex_FloatAddFirstRange(uint32_t id, uint16_t start, uint16_t end)
|
|||||||
|
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tFloatingFirstChar[start] |= id;
|
tFloatingFirstChar[start] |= id;
|
||||||
start += 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ void lex_FloatDeleteSecondRange(uint32_t id, uint16_t start, uint16_t end)
|
|||||||
|
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tFloatingSecondChar[start] &= ~id;
|
tFloatingSecondChar[start] &= ~id;
|
||||||
start += 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,7 +430,7 @@ void lex_FloatAddSecondRange(uint32_t id, uint16_t start, uint16_t end)
|
|||||||
|
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tFloatingSecondChar[start] |= id;
|
tFloatingSecondChar[start] |= id;
|
||||||
start += 1;
|
start++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ void lex_AddStrings(const struct sLexInitString *lex)
|
|||||||
if ((*ppHash)->nNameLength > nLexMaxLength)
|
if ((*ppHash)->nNameLength > nLexMaxLength)
|
||||||
nLexMaxLength = (*ppHash)->nNameLength;
|
nLexMaxLength = (*ppHash)->nNameLength;
|
||||||
|
|
||||||
lex += 1;
|
lex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,7 +821,7 @@ scanagain:
|
|||||||
pLexBuffer++;
|
pLexBuffer++;
|
||||||
} else if (*pLexBuffer == '\n') {
|
} else if (*pLexBuffer == '\n') {
|
||||||
pLexBuffer++;
|
pLexBuffer++;
|
||||||
nLineNo += 1;
|
nLineNo++;
|
||||||
goto scanagain;
|
goto scanagain;
|
||||||
} else {
|
} else {
|
||||||
errx(1, "Expected a new line after the continuation character.");
|
errx(1, "Expected a new line after the continuation character.");
|
||||||
@@ -832,7 +832,7 @@ scanagain:
|
|||||||
/* Line continuation character */
|
/* Line continuation character */
|
||||||
if (pLexBuffer[1] == '\n') {
|
if (pLexBuffer[1] == '\n') {
|
||||||
pLexBuffer += 2;
|
pLexBuffer += 2;
|
||||||
nLineNo += 1;
|
nLineNo++;
|
||||||
goto scanagain;
|
goto scanagain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -970,7 +970,7 @@ static uint32_t yylex_MACROARGS(void)
|
|||||||
pLexBuffer++;
|
pLexBuffer++;
|
||||||
} else if (*pLexBuffer == '\n') {
|
} else if (*pLexBuffer == '\n') {
|
||||||
pLexBuffer++;
|
pLexBuffer++;
|
||||||
nLineNo += 1;
|
nLineNo++;
|
||||||
ch = 0;
|
ch = 0;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
@@ -980,7 +980,7 @@ static uint32_t yylex_MACROARGS(void)
|
|||||||
break;
|
break;
|
||||||
case '\n':
|
case '\n':
|
||||||
/* Line continuation character */
|
/* Line continuation character */
|
||||||
nLineNo += 1;
|
nLineNo++;
|
||||||
ch = 0;
|
ch = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ static uint32_t countsymbols(void)
|
|||||||
pSym = pPatchSymbols;
|
pSym = pPatchSymbols;
|
||||||
|
|
||||||
while (pSym) {
|
while (pSym) {
|
||||||
count += 1;
|
count++;
|
||||||
pSym = pSym->pNext;
|
pSym = pSym->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ static uint32_t countsections(void)
|
|||||||
pSect = pSectionList;
|
pSect = pSectionList;
|
||||||
|
|
||||||
while (pSect) {
|
while (pSect) {
|
||||||
count += 1;
|
count++;
|
||||||
pSect = pSect->pNext;
|
pSect = pSect->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ static uint32_t countpatches(struct Section *pSect)
|
|||||||
|
|
||||||
pPatch = pSect->pPatches;
|
pPatch = pSect->pPatches;
|
||||||
while (pPatch) {
|
while (pPatch) {
|
||||||
r += 1;
|
r++;
|
||||||
pPatch = pPatch->pNext;
|
pPatch = pPatch->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +205,7 @@ static uint32_t getsectid(struct Section *pSect)
|
|||||||
while (sec) {
|
while (sec) {
|
||||||
if (sec == pSect)
|
if (sec == pSect)
|
||||||
return ID;
|
return ID;
|
||||||
ID += 1;
|
ID++;
|
||||||
sec = sec->pNext;
|
sec = sec->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ static void addexports(void)
|
|||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
for (i = 0; i < HASHSIZE; i += 1) {
|
for (i = 0; i < HASHSIZE; i++) {
|
||||||
struct sSymbol *pSym;
|
struct sSymbol *pSym;
|
||||||
|
|
||||||
pSym = tHashedSymbols[i];
|
pSym = tHashedSymbols[i];
|
||||||
@@ -704,9 +704,9 @@ void out_AbsByteBypassCheck(int32_t b)
|
|||||||
checksectionoverflow(1);
|
checksectionoverflow(1);
|
||||||
b &= 0xFF;
|
b &= 0xFF;
|
||||||
pCurrentSection->tData[nPC] = b;
|
pCurrentSection->tData[nPC] = b;
|
||||||
pCurrentSection->nPC += 1;
|
pCurrentSection->nPC++;
|
||||||
nPC += 1;
|
nPC++;
|
||||||
pPCSymbol->nValue += 1;
|
pPCSymbol->nValue++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -769,9 +769,9 @@ void out_RelByte(struct Expression *expr)
|
|||||||
if (rpn_isReloc(expr)) {
|
if (rpn_isReloc(expr)) {
|
||||||
pCurrentSection->tData[nPC] = 0;
|
pCurrentSection->tData[nPC] = 0;
|
||||||
createpatch(PATCHTYPE_BYTE, expr);
|
createpatch(PATCHTYPE_BYTE, expr);
|
||||||
pCurrentSection->nPC += 1;
|
pCurrentSection->nPC++;
|
||||||
nPC += 1;
|
nPC++;
|
||||||
pPCSymbol->nValue += 1;
|
pPCSymbol->nValue++;
|
||||||
} else {
|
} else {
|
||||||
out_AbsByte(expr->nVal);
|
out_AbsByte(expr->nVal);
|
||||||
}
|
}
|
||||||
@@ -865,9 +865,9 @@ void out_PCRelByte(struct Expression *expr)
|
|||||||
/* Always let the linker calculate the offset. */
|
/* Always let the linker calculate the offset. */
|
||||||
pCurrentSection->tData[nPC] = 0;
|
pCurrentSection->tData[nPC] = 0;
|
||||||
createpatch(PATCHTYPE_JR, expr);
|
createpatch(PATCHTYPE_JR, expr);
|
||||||
pCurrentSection->nPC += 1;
|
pCurrentSection->nPC++;
|
||||||
nPC += 1;
|
nPC++;
|
||||||
pPCSymbol->nValue += 1;
|
pPCSymbol->nValue++;
|
||||||
|
|
||||||
rpn_Free(expr);
|
rpn_Free(expr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user