about summary refs log tree commit diff
path: root/converter/pbm
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-05 15:29:05 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2017-06-05 15:29:05 +0000
commit1d4814ce637f9d81b477ebc4c0c490e185f50c4e (patch)
treeca71ca5c2a0ebf9be68a7a3c84cab371a05e3b58 /converter/pbm
parentfd8606fa05d458ce107c786a511e7997398192ab (diff)
downloadnetpbm-mirror-1d4814ce637f9d81b477ebc4c0c490e185f50c4e.tar.gz
netpbm-mirror-1d4814ce637f9d81b477ebc4c0c490e185f50c4e.tar.xz
netpbm-mirror-1d4814ce637f9d81b477ebc4c0c490e185f50c4e.zip
Remove recently added undocumented -dump option
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2986 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/pbm')
-rw-r--r--converter/pbm/pbmtog3.c37
1 files changed, 14 insertions, 23 deletions
diff --git a/converter/pbm/pbmtog3.c b/converter/pbm/pbmtog3.c
index 4f19ec2f..4a731efd 100644
--- a/converter/pbm/pbmtog3.c
+++ b/converter/pbm/pbmtog3.c
@@ -20,18 +20,12 @@
 
 enum G3eol {EOL, ALIGN8, ALIGN16, NO_EOL, NO_RTC, NO_EOLRTC};
 
-enum OutMode {BINARY, DUMP};
-
 struct OutStream;
 
-typedef void PutbitsFn(struct OutStream * const outP,
-                       struct BitString   const newBits);
-
 struct OutStream {
     FILE * fp;
     struct BitString buffer;
     bool reverseBits;    /* Reverse bit order */  
-    PutbitsFn * putbitsFn;
     enum G3eol eolAlign; /* Omit EOL and/or RTC; align EOL to 8/16 bits */ 
     void * data;         /* Reserved for future expansion */
 };
@@ -45,7 +39,6 @@ struct CmdlineInfo {
     const char * inputFileName;
     unsigned int reversebits;
     enum G3eol   align;
-    unsigned int dump;
     unsigned int desiredWidth;
     unsigned int verbose;
 };
@@ -80,8 +73,6 @@ parseCommandLine(int argc, const char ** const argv,
             0);
     OPTENT3(0,   "verbose",          OPT_FLAG,  NULL, &cmdlineP->verbose, 
             0);
-    OPTENT3(0,   "dump",             OPT_FLAG,  NULL, &cmdlineP->dump,
-            0);
 
     /* TODO
        Explicit fixed widths: -A4 -B4 -A3
@@ -160,15 +151,17 @@ flushBuffer(struct OutStream * const outP) {
 }
 
 
-
-static PutbitsFn putbitsDump;
-
+#if 1==0
 static void
 putbitsDump(struct OutStream * const outP,
             struct BitString   const newBits) {
 /*----------------------------------------------------------------------------
   Print the content of the bit put request, in human readable text form
   For debugging.  Also good for studying how the coding scheme works.
+
+  By default the compiler ignores this function.
+  To turn on, remove the "#if" - "#endif" lines enclosing the function and
+  edit the output function name in putbits().
 -----------------------------------------------------------------------------*/
     unsigned int const bitCount = newBits.bitCount;
 
@@ -187,11 +180,10 @@ putbitsDump(struct OutStream * const outP,
     charBuff[bitCount+1] = '\0';
     fwrite(charBuff, 1, bitCount+1, outP->fp);
 }
+#endif
 
 
 
-static PutbitsFn putbitsDump;
-
 static void
 putbitsBinary(struct OutStream * const outP,
               struct BitString   const newBits) {
@@ -239,14 +231,12 @@ putbitsBinary(struct OutStream * const outP,
 static void 
 initOutStream(struct OutStream * const outP,
               bool               const reverseBits,
-              enum G3eol         const eolAlign,
-              bool               const wantDump) {
+              enum G3eol         const eolAlign) {
 
     outP->buffer.intBuffer = 0;
     outP->buffer.bitCount  = 0;
     outP->reverseBits      = reverseBits;
-    outP->putbitsFn        = wantDump ? &putbitsDump : &putbitsBinary;
-    outP->fp               = wantDump ? stderr : stdout;
+    outP->fp               = stdout;
     outP->eolAlign         = eolAlign;
 }
 
@@ -269,7 +259,8 @@ static void
 putbits(struct OutStream * const outP,
         struct BitString   const newBits) {
 
-    outP->putbitsFn(outP, newBits);
+    putbitsBinary(outP, newBits); 
+    /* Change to putbitsDump() for human readable output */
 }
 
 
@@ -329,7 +320,7 @@ putcodeExtra(struct OutStream * const outP,
    According to the standard, the mark-up code for 2560 can be issued as
    many times as necessary without terminal codes.  
    --------------------------------------------------------------------------*/
-    G3TableEntry const markUp2560 = mtable[2560/64];
+    G3TableEntry const markUp2560 = mtable[2560/64*2];
                               /* Same code for black and white */
 
     unsigned int remainingLen;
@@ -530,8 +521,8 @@ convertRowToG3(struct OutStream * const outP,
    spanning several bytes.  Likewise for the rightmost 0.
 
    So we first remove the sequence on the left side and compare its
-   color with the leftmost pixel of the adjacent byte and emit codes
-   for either ones sequence if they agree, or two if they disagree. 
+   color with the leftmost pixel of the adjacent byte and emit either
+   one code for a single sequence if they agree or two if they disagree. 
    Next the composite code for the central part (in the above example
    110011 -> 11 0111 11) is emitted.  Finally we save the length and
    color of the sequence on the right end as carry-over for the next
@@ -643,7 +634,7 @@ main(int          argc,
     if (!bitrow)
         pm_error("Failed to allocate a row buffer for %u columns", cols);
 
-    initOutStream(&out, cmdline.reversebits, cmdline.align, cmdline.dump);
+    initOutStream(&out, cmdline.reversebits, cmdline.align);
     
     puteol(&out);