about summary refs log tree commit diff
path: root/converter/ppm/ppmtoarbtxt.c
diff options
context:
space:
mode:
Diffstat (limited to 'converter/ppm/ppmtoarbtxt.c')
-rw-r--r--converter/ppm/ppmtoarbtxt.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/converter/ppm/ppmtoarbtxt.c b/converter/ppm/ppmtoarbtxt.c
index 6d4c6eac..a8d7a004 100644
--- a/converter/ppm/ppmtoarbtxt.c
+++ b/converter/ppm/ppmtoarbtxt.c
@@ -62,18 +62,16 @@ parseCommandLine(int argc, const char ** argv,
    in argv!
 -----------------------------------------------------------------------------*/
     optEntry * option_def;
-        /* Instructions to OptParseOptions3 on how to parse our options.
-         */
     optStruct3 opt;
 
     unsigned int hdSpec, tlSpec;
 
     unsigned int option_def_index;
-    
+
     MALLOCARRAY(option_def, 100);
 
     option_def_index = 0;   /* incremented by OPTENTRY */
-    OPTENT3(0,   "hd",   OPT_STRING, &cmdlineP->hd, 
+    OPTENT3(0,   "hd",   OPT_STRING, &cmdlineP->hd,
             &hdSpec,             0);
     OPTENT3(0,   "tl",   OPT_STRING, &cmdlineP->tl,
             &tlSpec,             0);
@@ -84,7 +82,7 @@ parseCommandLine(int argc, const char ** argv,
     opt.short_allowed = FALSE;  /* We have no short (old-fashioned) options */
     opt.allowNegNum = FALSE;  /* We have no parms that are negative numbers */
 
-    pm_optParseOptions3(&argc, (char **)argv, opt, sizeof(opt), 0);
+    pm_optParseOptions4(&argc, argv, opt, sizeof(opt), 0);
     free(option_def);
 
     if (!hdSpec)
@@ -113,7 +111,6 @@ parseCommandLine(int argc, const char ** argv,
 
 
 
-
 typedef enum {
 /* The types of object we handle */
     BDATA, IRED, IGREEN, IBLUE, ILUM, FRED, FGREEN, FBLUE, FLUM,
@@ -134,7 +131,7 @@ typedef union {
         char * bdat;   /* Binary data (text with newlines etc.) */
         unsigned int ndat;
     } binData;
-    
+
     struct Icdat {
         char icformat[MAXFORMAT+1];  /* Integer colors */
         unsigned int icolmin, icolmax;
@@ -144,7 +141,7 @@ typedef union {
         char fcformat[MAXFORMAT+1];  /* Float colors */
         double fcolmin, fcolmax;
     } fcolData;
-    
+
     struct Idat {
         char iformat[MAXFORMAT+1];   /* Integer data */
     } iData;
@@ -152,7 +149,7 @@ typedef union {
 
 
 /* Each object has a type and some data */
-typedef struct { 
+typedef struct {
     SkeletonObjectType objType;
     SkeletonObjectData odata;
 } SkeletonObject;
@@ -187,11 +184,11 @@ dumpSkeleton(SkeletonObject ** const skeletonPList,
 static void
 dumpAllSkeleton(SkeletonObject ** const bodySkeletonPList,
                 unsigned int      const bodyNskl,
-                SkeletonObject ** const headSkeletonPList, 
+                SkeletonObject ** const headSkeletonPList,
                 unsigned int      const headNskl,
                 SkeletonObject ** const tailSkeletonPList,
                 unsigned int      const tailNskl) {
-    
+
     pm_message("Body skeleton:");
     dumpSkeleton(bodySkeletonPList, bodyNskl);
 
@@ -240,7 +237,7 @@ writeFcol(FILE *           const ofP,
           double           const value) {
 
     struct Fcdat * const fcdataP = &objectP->odata.fcolData;
-    
+
     fprintf(ofP, fcdataP->fcformat,
             (double)
             (fcdataP->fcolmin
@@ -255,7 +252,7 @@ writeIdat(FILE *           const ofP,
           unsigned int     const value) {
 
     struct Idat * const idataP = &objectP->odata.iData;
-    
+
     fprintf(ofP, idataP->iformat, value);
 }
 
@@ -272,7 +269,7 @@ writeText(FILE *            const ofP,
           double            const red,
           double            const green,
           double            const blue) {
-    
+
     unsigned int i;
 
     for (i = 0; i < nObj; ++i) {
@@ -352,6 +349,7 @@ objClass(SkeletonObjectType const objType) {
 }
 
 
+
 /*----------------------------------------------------------------------------
   Format string validation
 
@@ -366,7 +364,7 @@ objClass(SkeletonObjectType const objType) {
 
   Documentation for parse_printf_format() is usually available in texinfo
   format on GNU/Linux systems.  As of Dec. 2014 there is no official man page.
-  
+
   Online documentation is available from:
   https://
   www.gnu.org/software/libc/manual/html_node/Parsing-a-Template-String.html
@@ -379,7 +377,7 @@ validateParsePrintfFlag(int                const printfConversion,
                         const char **      const errorP) {
 /*----------------------------------------------------------------------------
   Assuming 'printfConversion' is the value reported by parse_printf_format()
-  as the type of argument a format string requires, 
+  as the type of argument a format string requires,
   return an explanation of how it is incompatible with 'ctyp' as
   *errorP -- return null string if it is compatible.
 -----------------------------------------------------------------------------*/
@@ -403,7 +401,7 @@ validateParsePrintfFlag(int                const printfConversion,
     default:
         switch (printfConversion & ~PA_FLAG_MASK) {
         case PA_CHAR:
-            pm_message("Warning: char type conversion."); 
+            pm_message("Warning: char type conversion.");
         case PA_INT:
             if(objClass(ctyp) == OBJTYP_ICOLOR ||
                objClass(ctyp) == OBJTYP_INT )
@@ -496,7 +494,7 @@ validateFormatOne(char               const typeSpecifier,
     case '0': case '1': case '2': case '3': case '4': case '5':
     case '6': case '7': case '8': case '9':
         break;
-        
+
     case 'c': case 'C':
         pm_message("Warning: char type conversion: %%%c.", typeSpecifier);
     case 'i': case 'd': case 'u': case 'o': case 'x': case 'X':
@@ -599,12 +597,12 @@ validateFormat(const char *       const format,
 
     if (error)
         pm_error("Invalid format string '%s'.  %s", format, error);
-}              
-               
+}
+
 
 
 static SkeletonObject *
-newBinDataObj(unsigned int const nDat, 
+newBinDataObj(unsigned int const nDat,
               const char * const bdat) {
 /*----------------------------------------------------------------------------
   Create a binary data object.
@@ -787,7 +785,7 @@ newFcSkelFromReplString(const char *       const fcolorObjstr,
         retval = NULL;
 
     return retval;
-} 
+}
 
 
 
@@ -805,7 +803,7 @@ newISkelFromReplString(const char *       const intObjstr,
     int nOdata;
 
     nOdata = sscanf(intObjstr, "%s", formstr);
-    
+
     if (nOdata == 1)
         retval = newIdataObj(objType, formstr);
     else if (nOdata == EOF) {
@@ -815,7 +813,7 @@ newISkelFromReplString(const char *       const intObjstr,
         retval = NULL;
 
     return retval;
-} 
+}
 
 
 
@@ -842,7 +840,7 @@ newSkeletonFromReplString(const char * const objstr) {
     int conversionCt;
     char s1[MAX_OBJ_BUF];    /* Dry read. */
     char s2[MAX_OBJ_BUF];    /* Extra tailing characters. */
-    float f1, f2;            /* Dry read. */ 
+    float f1, f2;            /* Dry read. */
 
     typstr[0] = '\0';  /* initial value */
 
@@ -905,7 +903,7 @@ readThroughCloseParen(FILE * const ifP,
             if (chr == ')') {
                 gotEscSeq = true;
                 objstr[i] = '\0';
-	        } else
+                } else
                 objstr[i] = chr;
         }
     }
@@ -942,7 +940,7 @@ SkeletonBuffer_add(SkeletonBuffer * const bufferP,
         pm_error("Too many skeletons.  Max = %u", bufferP->capacity);
 
     bufferP->skeletonPList[bufferP->nSkeleton++] = skeletonP;
-}                   
+}
 
 
 
@@ -1050,7 +1048,7 @@ readSkeletonFile(const char *      const filename,
         /* A buffer for accumulating skeleton objects */
     Buffer buffer;
         /* A buffer for accumulating binary (literal; unsubstituted) data, on
-           its way to becoming a binary skeleton object. 
+           its way to becoming a binary skeleton object.
         */
     bool eof;
     const char * error;
@@ -1135,7 +1133,7 @@ convertIt(FILE *            const ifP,
           FILE *            const ofP,
           SkeletonObject ** const bodySkeletonPList,
           unsigned int      const bodyNskl,
-          SkeletonObject ** const headSkeletonPList, 
+          SkeletonObject ** const headSkeletonPList,
           unsigned int      const headNskl,
           SkeletonObject ** const tailSkeletonPList,
           unsigned int      const tailNskl) {
@@ -1154,7 +1152,7 @@ convertIt(FILE *            const ifP,
     dmaxval = (double)maxval;
 
     /* Write header */
-    writeText(ofP, headNskl, headSkeletonPList, 
+    writeText(ofP, headNskl, headSkeletonPList,
               cols, rows , 0, 0, 0.0, 0.0, 0.0);
 
     /* Write raster */
@@ -1175,7 +1173,7 @@ convertIt(FILE *            const ifP,
     }
 
     /* Write trailer */
-    writeText(ofP, tailNskl, tailSkeletonPList, 
+    writeText(ofP, tailNskl, tailSkeletonPList,
               cols, rows, 0, 0, 0.0, 0.0, 0.0);
 }
 
@@ -1184,7 +1182,7 @@ convertIt(FILE *            const ifP,
 int
 main(int           argc,
      const char ** argv) {
-    
+
     struct CmdlineInfo cmdline;
 
     unsigned int headNskl, bodyNskl, tailNskl;
@@ -1240,3 +1238,4 @@ main(int           argc,
 }
 
 
+