Use inttypes for stdint types

This should help make RGBDS portable to systems with 16-bit integers,
like DOS.

For kicks, use the macros for 16-bit and 8-bit integers.

Fix other miscellaneous things, like #include ordering and other
printf-format related things.

Reduce repitition in math.c while I'm there.
This commit is contained in:
James Larrowe
2020-05-06 16:46:14 -04:00
parent b299f6fb3b
commit 5c24de3dc4
22 changed files with 180 additions and 150 deletions

View File

@@ -167,7 +167,7 @@ void opt_Parse(char *s)
/* fallthrough */
case 'p':
if (strlen(&s[1]) <= 2) {
int32_t result;
int result;
unsigned int fillchar;
result = sscanf(&s[1], "%x", &fillchar);
@@ -551,10 +551,11 @@ int main(int argc, char *argv[])
fclose(dependfile);
if (nIFDepth != 0)
errx(1, "Unterminated IF construct (%u levels)!", nIFDepth);
errx(1, "Unterminated IF construct (%" PRIu32 " levels)!",
nIFDepth);
if (nUnionDepth != 0) {
errx(1, "Unterminated UNION construct (%u levels)!",
errx(1, "Unterminated UNION construct (%" PRIu32 " levels)!",
nUnionDepth);
}
@@ -564,8 +565,9 @@ int main(int argc, char *argv[])
timespent = ((double)(nEndClock - nStartClock))
/ (double)CLOCKS_PER_SEC;
if (verbose) {
printf("Success! %u lines in %d.%02d seconds ", nTotalLines,
(int)timespent, ((int)(timespent * 100.0)) % 100);
printf("Success! %" PRIu32 " lines in %d.%02d seconds ",
nTotalLines, (int)timespent,
((int)(timespent * 100.0)) % 100);
if (timespent < FLT_MIN_EXP)
printf("(INFINITY lines/minute)\n");
else