comparison sidinfo.c @ 114:cc74a9871a44

Simplify.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Feb 2016 11:11:04 +0200
parents cd97e7517e21
children 6843261b4cd6
comparison
equal deleted inserted replaced
113:cd97e7517e21 114:cc74a9871a44
442 442
443 443
444 #define PR(xfmt, xaltfmt, ...) siPrintPSIDInfoLine(outFile, shown, xindex, xfmt, xaltfmt, __VA_ARGS__ ) 444 #define PR(xfmt, xaltfmt, ...) siPrintPSIDInfoLine(outFile, shown, xindex, xfmt, xaltfmt, __VA_ARGS__ )
445 445
446 446
447 static void siPrintPSIDInformationField(FILE *outFile, const char *filename, const PSIDHeader *psid, BOOL *shown, const int xindex) 447 static void siPrintPSIDInformationField(FILE *outFile, const char *filename, const PSIDHeader *psid, BOOL *shown, const PSFStackItem *item)
448 { 448 {
449 switch (xindex) 449 const PSFOption *opt = &optPSOptions[item->cmd];
450 switch (item->cmd)
450 { 451 {
451 case 0: PR("%s", NULL, filename); break; 452 case 0: PR("%s", NULL, filename); break;
452 case 1: PR("%s", NULL, psid->magic); break; 453 case 1: PR("%s", NULL, psid->magic); break;
453 case 2: PR("%d.%d", NULL, (psid->version & 0xff), (psid->version >> 8)); break; 454 case 2: PR("%d.%d", NULL, (psid->version & 0xff), (psid->version >> 8)); break;
454 case 3: PR("%s", NULL, (psid->flags & PSF_PLAYER_TYPE) ? "Compute! SIDPlayer MUS" : "Normal built-in"); break; 455 case 3: PR("%s", NULL, (psid->flags & PSF_PLAYER_TYPE) ? "Compute! SIDPlayer MUS" : "Normal built-in"); break;
475 case 14: PR("%s", NULL, psid->sidName); break; 476 case 14: PR("%s", NULL, psid->sidName); break;
476 case 15: PR("%s", NULL, psid->sidAuthor); break; 477 case 15: PR("%s", NULL, psid->sidAuthor); break;
477 case 16: PR("%s", NULL, psid->sidCopyright); break; 478 case 16: PR("%s", NULL, psid->sidCopyright); break;
478 479
479 case 17: 480 case 17:
481 siPrintFieldPrefix(outFile, opt);
482 th_md5_print(outFile, psid->hash);
483 siPrintFieldSeparator(outFile);
484 break;
485
486 case 18:
487 siPrintFieldPrefix(outFile, opt);
488 if (psid->lengths != NULL)
480 { 489 {
481 const PSFOption *opt = &optPSOptions[xindex]; 490 int i;
482 siPrintFieldPrefix(outFile, opt); 491 for (i = 0; i < psid->lengths->nlengths; i++)
483 th_md5_print(outFile, psid->hash); 492 {
484 siPrintFieldSeparator(outFile); 493 int len = psid->lengths->lengths[i];
494 fprintf(outFile, "%d:%d%s", len / 60, len % 60,
495 (i < psid->lengths->nlengths - 1) ? " " : "");
496 }
485 } 497 }
486 break; 498 siPrintFieldSeparator(outFile);
487
488 case 18:
489 {
490 const PSFOption *opt = &optPSOptions[xindex];
491 siPrintFieldPrefix(outFile, opt);
492 if (psid->lengths != NULL)
493 {
494 int i;
495 for (i = 0; i < psid->lengths->nlengths; i++)
496 {
497 int len = psid->lengths->lengths[i];
498 fprintf(outFile, "%d:%d%s", len / 60, len % 60,
499 (i < psid->lengths->nlengths - 1) ? " " : "");
500 }
501 }
502 siPrintFieldSeparator(outFile);
503 }
504 break; 499 break;
505 500
506 } 501 }
507 } 502 }
508 503
548 case -2: 543 case -2:
549 fputc(item->chr, outFile); 544 fputc(item->chr, outFile);
550 break; 545 break;
551 546
552 default: 547 default:
553 siPrintPSIDInformationField(outFile, filename, &psid, &shown, item->cmd); 548 siPrintPSIDInformationField(outFile, filename, &psid, &shown, item);
554 break; 549 break;
555 } 550 }
556 } 551 }
557 552
558 if (optFieldOutput) 553 if (optFieldOutput)