changeset 1822:9bec535956fd

Add indentation parameter to dmC64ImageDump().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 22 Jun 2018 12:20:46 +0300
parents ee2383d1a21e
children 02f604264bc4
files tools/64vw.c tools/lib64gfx.c tools/lib64gfx.h
diffstat 3 files changed, 22 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/tools/64vw.c	Fri Jun 22 11:20:15 2018 +0300
+++ b/tools/64vw.c	Fri Jun 22 12:20:46 2018 +0300
@@ -308,7 +308,7 @@
             else
             {
                 fprintf(stdout, "\n%s\n", filename);
-                dmC64ImageDump(stdout, cimage, fmt);
+                dmC64ImageDump(stdout, cimage, fmt, "  ");
             }
 
             dmC64ImageFree(cimage);
@@ -481,7 +481,7 @@
                 if (dmVerbosity >= 1)
                 {
                     fprintf(stdout, "\n%s\n", filename);
-                    dmC64ImageDump(stdout, cimage, fmt);
+                    dmC64ImageDump(stdout, cimage, fmt, "  ");
                 }
             }
 
--- a/tools/lib64gfx.c	Fri Jun 22 11:20:15 2018 +0300
+++ b/tools/lib64gfx.c	Fri Jun 22 12:20:46 2018 +0300
@@ -48,7 +48,7 @@
 }
 
 
-void dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt)
+void dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt, const char *indent)
 {
     char typeStr[64], typeStr2[64];
 
@@ -57,8 +57,8 @@
     if (fmt != NULL)
     {
         fprintf(fh,
-            "Format              : %s [%s]\n",
-            fmt->name, fmt->fext);
+            "%sFormat              : %s [%s]\n",
+            indent, fmt->name, fmt->fext);
     }
 
     if (img != NULL)
@@ -66,10 +66,10 @@
         dmC64GetImageTypeString(typeStr2, sizeof(typeStr2), img->type, TRUE);
 
         fprintf(fh,
-            "Type                : %s [%s]\n"
-            "Banks               : %d\n",
-            typeStr, typeStr2,
-            img->nbanks);
+            "%sType                : %s [%s]\n"
+            "%sBanks               : %d\n",
+            indent, typeStr, typeStr2,
+            indent, img->nbanks);
 
         if (img->type & D64_FMT_ILACE)
         {
@@ -81,27 +81,27 @@
                 default: tmps = "ERROR"; break;
             }
             fprintf(fh,
-                "Interlace type      : %s\n",
-                tmps);
+                "%sInterlace type      : %s\n",
+                indent, tmps);
         }
 
         fprintf(fh,
-            "Width x Height      : %d x %d [%d x %d]\n"
-            "CHwidth x CHheight  : %d x %d [%d x %d]\n",
-            img->width, img->height,
+            "%sWidth x Height      : %d x %d [%d x %d]\n"
+            "%sCHwidth x CHheight  : %d x %d [%d x %d]\n",
+            indent, img->width, img->height,
             fmt->format->width, fmt->format->height,
-            img->chWidth, img->chHeight,
+            indent, img->chWidth, img->chHeight,
             fmt->format->chWidth, fmt->format->chHeight);
     }
     else
     {
         fprintf(fh,
-            "Type                : %s\n"
-            "Width x Height      : %d x %d\n"
-            "CHwidth x CHheight  : %d x %d\n",
-            typeStr,
-            fmt->format->width, fmt->format->height,
-            fmt->format->chWidth, fmt->format->chHeight);
+            "%sType                : %s\n"
+            "%sWidth x Height      : %d x %d\n"
+            "%sCHwidth x CHheight  : %d x %d\n",
+            indent, typeStr,
+            indent, fmt->format->width, fmt->format->height,
+            indent, fmt->format->chWidth, fmt->format->chHeight);
     }
 }
 
--- a/tools/lib64gfx.h	Fri Jun 22 11:20:15 2018 +0300
+++ b/tools/lib64gfx.h	Fri Jun 22 12:20:46 2018 +0300
@@ -292,7 +292,7 @@
 int       dmC64ProbeBMP(const DMGrowBuf *buf, const DMC64ImageFormat **fmt);
 
 char *    dmC64GetImageTypeString(char *buf, const size_t len, const int type, const BOOL lng);
-void      dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt);
+void      dmC64ImageDump(FILE *fh, const DMC64Image *img, const DMC64ImageFormat *fmt, const char *indent);
 
 void      dmSetDefaultC64Palette(DMImage *img);
 BOOL      dmSetMixedColorC64Palette(DMImage *img);