# HG changeset patch # User Matti Hamalainen # Date 1560574526 -10800 # Node ID 65a2c2e99c810ed0bed9b7a0c8cb4c9e60d3988a # Parent 587eb90459f9acf82a381d01389b540a6cdb4303 Move listing of C64 formats function to argShowC64Formats in lib64util. diff -r 587eb90459f9 -r 65a2c2e99c81 tools/64vw.c --- a/tools/64vw.c Sat Jun 15 07:54:39 2019 +0300 +++ b/tools/64vw.c Sat Jun 15 07:55:26 2019 +0300 @@ -57,27 +57,6 @@ } -void argShowFormats() -{ - printf( - "Available C64 bitmap formats (-f ):\n" - " frmt | Type | Description\n" - "------+-----------------+-------------------------------------\n" - ); - for (int i = 0; i < ndmC64ImageFormats; i++) - { - const DMC64ImageFormat *fmt = dmC64ImageFormatsSorted[i]; - char buf[64]; - printf("%-6s| %-15s | %s%s\n", - fmt->fext, - dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->type, FALSE), - fmt->name, - fmt->flags & DM_FMT_BROKEN ? " [BROKEN]" : ""); - } - printf("%d formats supported.\n", ndmC64ImageFormats); -} - - void argShowHelp() { dmPrintBanner(stdout, dmProgName, "[options] "); @@ -151,7 +130,7 @@ break; case 5: - argShowFormats(); + argShowC64Formats(stdout, FALSE); exit(0); break; diff -r 587eb90459f9 -r 65a2c2e99c81 tools/gfxconv.c --- a/tools/gfxconv.c Sat Jun 15 07:54:39 2019 +0300 +++ b/tools/gfxconv.c Sat Jun 15 07:55:26 2019 +0300 @@ -206,24 +206,9 @@ "\n" "(Not all input->output combinations are actually supported.)\n" "\n" - "Available C64 bitmap formats (-f ):\n" - " frmt | RW | Type | Description\n" - "------+----+-----------------+-------------------------------------\n" ); - for (int i = 0; i < ndmC64ImageFormats; i++) - { - const DMC64ImageFormat *fmt = dmC64ImageFormatsSorted[i]; - char buf[64]; - printf("%-6s| %c%c | %-15s | %s%s\n", - fmt->fext, - (fmt->flags & DM_FMT_RD) ? 'R' : ' ', - (fmt->flags & DM_FMT_WR) ? 'W' : ' ', - dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->type, FALSE), - fmt->name, - fmt->flags & DM_FMT_BROKEN ? " [BROKEN]" : ""); - } - printf("%d formats supported.\n", ndmC64ImageFormats); + argShowC64Formats(stdout, TRUE); } diff -r 587eb90459f9 -r 65a2c2e99c81 tools/lib64util.c --- a/tools/lib64util.c Sat Jun 15 07:54:39 2019 +0300 +++ b/tools/lib64util.c Sat Jun 15 07:55:26 2019 +0300 @@ -114,6 +114,43 @@ } +void argShowC64Formats(FILE *fp, const BOOL rw) +{ + fprintf(fp, + "Available C64 bitmap formats (-f ):\n" + " frmt %s| Type | Description\n" + "------%s+-----------------+-------------------------------------\n", + rw ? "| RW " : "", + rw ? "+----" : "" + ); + + for (int i = 0; i < ndmC64ImageFormats; i++) + { + const DMC64ImageFormat *fmt = dmC64ImageFormatsSorted[i]; + char buf[64]; + + fprintf(fp, "%-6s", + fmt->fext); + + if (rw) + { + fprintf(fp, "| %c%c ", + (fmt->flags & DM_FMT_RD) ? 'R' : ' ', + (fmt->flags & DM_FMT_WR) ? 'W' : ' ' + ); + } + + fprintf(fp, + "| %-15s | %s%s\n", + dmC64GetImageTypeString(buf, sizeof(buf), fmt->format->type, FALSE), + fmt->name, + fmt->flags & DM_FMT_BROKEN ? " [BROKEN]" : ""); + } + + fprintf(fp, "%d formats supported.\n", ndmC64ImageFormats); +} + + BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile) { if (strcasecmp(optArg, "help") == 0 || diff -r 587eb90459f9 -r 65a2c2e99c81 tools/lib64util.h --- a/tools/lib64util.h Sat Jun 15 07:54:39 2019 +0300 +++ b/tools/lib64util.h Sat Jun 15 07:55:26 2019 +0300 @@ -25,6 +25,7 @@ void dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt, const char *indent); void argShowC64PaletteHelp(FILE *fp); +void argShowC64Formats(FILE *fp, const BOOL rw); BOOL argHandleC64PaletteOption(char *optArg, DMC64Palette **ppal, char **palFile); int dmHandleExternalPalette(const char *filename, DMPalette **ppal);