# HG changeset patch # User Matti Hamalainen # Date 1508971502 -10800 # Node ID 717d143612e2303cb7508a937c02a501d05f6b0c # Parent de75385f75e283340eea9c5229aa2250dbf171cc Simplify things by having separate PRS/PRI macros for printing string and integer fields. Also prepare for iconv support. diff -r de75385f75e2 -r 717d143612e2 sidinfo.c --- a/sidinfo.c Thu Oct 26 00:22:36 2017 +0300 +++ b/sidinfo.c Thu Oct 26 01:45:02 2017 +0300 @@ -732,7 +732,8 @@ } -#define PR(d_str, d_int) siPrintPSIDInfoLine(outFile, shown, item, d_str, d_int) +#define PRS(d_str, d_conv) siPrintPSIDInfoLine(outFile, shown, item, d_str, -1) +#define PRI(d_int) siPrintPSIDInfoLine(outFile, shown, item, NULL, d_int) static void siPrintPSIDInformationField(FILE *outFile, const char *filename, const PSIDHeader *psid, BOOL *shown, const PSFStackItem *item) @@ -742,35 +743,35 @@ switch (item->cmd) { - case 0: PR(filename, -1); break; - case 1: PR(psid->magic, -1); break; + case 0: PRS(filename, FALSE); break; + case 1: PRS(psid->magic, FALSE); break; case 2: snprintf(tmp, sizeof(tmp), "%d.%d", (psid->version & 0xff), (psid->version >> 8)); - PR(tmp, -1); + PRS(tmp, FALSE); break; case 3: - PR((psid->flags & PSF_PLAYER_TYPE) ? "Compute! SIDPlayer MUS" : "Normal built-in", -1); + PRS((psid->flags & PSF_PLAYER_TYPE) ? "Compute! SIDPlayer MUS" : "Normal built-in", FALSE); break; case 4: if (psid->version >= 2) - PR((psid->flags & PSF_PLAYSID_TUNE) ? (psid->isRSID ? "C64 BASIC" : "PlaySID") : "C64 compatible", -1); + PRS((psid->flags & PSF_PLAYSID_TUNE) ? (psid->isRSID ? "C64 BASIC" : "PlaySID") : "C64 compatible", FALSE); break; case 5: if (psid->version >= 2) - PR(si_get_sid_clock_str((psid->flags >> 2) & PSF_CLOCK_MASK), -1); + PRS(si_get_sid_clock_str((psid->flags >> 2) & PSF_CLOCK_MASK), FALSE); break; case 6: if (psid->version >= 2) - PR(si_get_sid_model_str((psid->flags >> 4) & PSF_MODEL_MASK), -1); + PRS(si_get_sid_model_str((psid->flags >> 4) & PSF_MODEL_MASK), FALSE); break; - case 7: PR(NULL, psid->dataOffset); break; - case 8: PR(NULL, psid->dataSize); break; - case 9: PR(NULL, psid->loadAddress); break; - case 10: PR(NULL, psid->initAddress); break; - case 11: PR(NULL, psid->playAddress); break; - case 12: PR(NULL, psid->nSongs); break; - case 13: PR(NULL, psid->startSong); break; + case 7: PRI(psid->dataOffset); break; + case 8: PRI(psid->dataSize); break; + case 9: PRI(psid->loadAddress); break; + case 10: PRI(psid->initAddress); break; + case 11: PRI(psid->playAddress); break; + case 12: PRI(psid->nSongs); break; + case 13: PRI(psid->startSong); break; case 14: if (psid->version >= 3) @@ -779,7 +780,7 @@ if (flags == PSF_MODEL_UNKNOWN) flags = (psid->flags >> 4) & PSF_MODEL_MASK; - PR(si_get_sid_model_str(flags), -1); + PRS(si_get_sid_model_str(flags), FALSE); } break; case 15: @@ -789,21 +790,21 @@ if (flags == PSF_MODEL_UNKNOWN) flags = (psid->flags >> 4) & PSF_MODEL_MASK; - PR(si_get_sid_model_str(flags), -1); + PRS(si_get_sid_model_str(flags), FALSE); } break; case 16: if (psid->version >= 3) - PR(NULL, 0xD000 | (psid->sid2Addr << 4)); + PRI(0xD000 | (psid->sid2Addr << 4)); break; case 17: if (psid->version >= 4) - PR(NULL, 0xD000 | (psid->sid3Addr << 4)); + PRI(0xD000 | (psid->sid3Addr << 4)); break; - case 18: PR(psid->sidName, -1); break; - case 19: PR(psid->sidAuthor, -1); break; - case 20: PR(psid->sidCopyright, -1); break; + case 18: PRS(psid->sidName, TRUE); break; + case 19: PRS(psid->sidAuthor, TRUE); break; + case 20: PRS(psid->sidCopyright, TRUE); break; case 21: { @@ -811,7 +812,7 @@ for (i = k = 0; i < TH_MD5HASH_LENGTH && k < sizeof(tmp) - 1; i++, k += 2) sprintf(&tmp[k], "%02x", psid->hash[i]); - PR(tmp, -1); + PRS(tmp, FALSE); } break;