diff options
Diffstat (limited to 'converter/pbm')
-rw-r--r-- | converter/pbm/mdatopbm.c | 2 | ||||
-rw-r--r-- | converter/pbm/pbmtogem.c | 2 | ||||
-rw-r--r-- | converter/pbm/pbmtogo.c | 72 | ||||
-rw-r--r-- | converter/pbm/pbmtoibm23xx.c | 4 | ||||
-rw-r--r-- | converter/pbm/pbmtomacp.c | 2 | ||||
-rw-r--r-- | converter/pbm/pbmtopk.c | 120 | ||||
-rw-r--r-- | converter/pbm/pbmtoppa/README.REDHAT | 2 | ||||
-rw-r--r-- | converter/pbm/pbmtoppa/ppa.c | 10 |
8 files changed, 108 insertions, 106 deletions
diff --git a/converter/pbm/mdatopbm.c b/converter/pbm/mdatopbm.c index d8e06572..461b3f80 100644 --- a/converter/pbm/mdatopbm.c +++ b/converter/pbm/mdatopbm.c @@ -36,7 +36,7 @@ static bit **data; /* PBM image */ static mdbyte *mdrow; /* MDA row after decompression (MD3 only) */ static int bInvert = 0; /* Invert image? */ static int bScale = 0; /* Scale image? */ -static int bAscii = 0; /* Ouput ASCII PBM? */ +static int bAscii = 0; /* Output ASCII PBM? */ static int nInRows, nInCols; /* Height, width of input (rows x bytes) */ static int nOutCols, nOutRows; /* Height, width of output (rows x bytes) */ diff --git a/converter/pbm/pbmtogem.c b/converter/pbm/pbmtogem.c index 9eab0416..4fd30e92 100644 --- a/converter/pbm/pbmtogem.c +++ b/converter/pbm/pbmtogem.c @@ -26,7 +26,7 @@ * changed header length to count words to conform with Atari ST documentation * removed rounding of the imagewidth to the next word boundary * removed arbitrary limit to imagewidth -* changed pattern length to 1 to simplify locating of compressable parts +* changed pattern length to 1 to simplify locating of compressible parts * in real world images * add solid run and pattern run compression * diff --git a/converter/pbm/pbmtogo.c b/converter/pbm/pbmtogo.c index 23b2ee9a..4f84f391 100644 --- a/converter/pbm/pbmtogo.c +++ b/converter/pbm/pbmtogo.c @@ -1,29 +1,29 @@ /* pbmtogo.c - read a PBM image and produce a GraphOn terminal raster file -** +** ** Rev 1.1 was based on pbmtolj.c ** ** Bo Thide', Swedish Institute of Space Physics, bt@irfu.se -** +** ** ** $Log: pbmtogo.c,v $ * Revision 1.5 89/11/25 00:24:12 00:24:12 root (Bo Thide) * Bug found: The byte after 64 repeated bytes sometimes lost. Fixed. - * + * * Revision 1.4 89/11/24 14:56:04 14:56:04 root (Bo Thide) * Fixed the command line parsing since pbmtogo now always uses 2D * compression. Added a few comments to the source. - * + * * Revision 1.3 89/11/24 13:43:43 13:43:43 root (Bo Thide) * Added capability for > 63 repeated bytes and > 62 repeated lines in * the 2D compression scheme. - * + * * Revision 1.2 89/11/15 01:04:47 01:04:47 root (Bo Thide) * First version that works reasonably well with GraphOn 2D runlength * encoding/compression. - * + * * Revision 1.1 89/11/02 23:25:25 23:25:25 root (Bo Thide) * Initial revision - * + * ** ** Copyright (C) 1988, 1989 by Jef Poskanzer, Michael Haberler, and Bo Thide'. ** @@ -44,10 +44,10 @@ #define GRAPHON_WIDTH 1056 /* GraphOn has 1056 bit wide raster lines */ #define GRAPHON_WIDTH_BYTES (GRAPHON_WIDTH / 8) -#define REPEAT_CURRENT_LINE_MASK 0x00 -#define SKIP_AND_PLOT_MASK 0x40 -#define REPEAT_PLOT_MASK 0x80 -#define PLOT_ARBITRARY_DATA_MASK 0xc0 +#define REPEAT_CURRENT_LINE_MASK 0x00 +#define SKIP_AND_PLOT_MASK 0x40 +#define REPEAT_PLOT_MASK 0x80 +#define PLOT_ARBITRARY_DATA_MASK 0xc0 #define MAX_REPEAT 64 static unsigned char * scanlineptr; @@ -167,7 +167,7 @@ main(int argc, buffer[i] = oldscanline[i] = 0; putinit(); - /* Start donwloading screen raster */ + /* Start downloading screen raster */ printf("\033P0;1;0;4;1;%d;%d;1!R1/", rows, rucols); linerepeat = 63; /* 63 means "Start new picture" */ @@ -183,32 +183,32 @@ main(int argc, putbit(0); assert(bytesperrow <= GRAPHON_WIDTH_BYTES); - + /* XOR data from the new scan line with data from old scan line */ for (i = 0; i < bytesperrow; i++) diff[i] = oldscanline[i]^newscanline[i]; - + /* ** If the difference map is different from current internal buffer, - ** encode the difference and put it in the output buffer. + ** encode the difference and put it in the output buffer. ** Else, increase the counter for the current buffer by one. */ - + if ((memcmp(buffer, diff, bytesperrow) != 0) || (row == 0)) { - /* + /* **Since the data in the buffer has changed, send the **scan line repeat count to cause the old line(s) to **be plotted on the screen, copy the new data into - **the internal buffer, and reset the counters. + **the internal buffer, and reset the counters. */ - + putchar(linerepeat); for (i = 0; i < bytesperrow; ++i) buffer[i] = diff[i]; nbyte = 0; /* Internal buffer byte counter */ nout = 0; /* Output buffer byte counter */ - - /* Run length encode the new internal buffr (= difference map) */ + + /* Run length encode the new internal buffer (= difference map) */ while (TRUE) { ucount = 0; /* Unique items counter */ do /* Find unique patterns */ @@ -217,16 +217,16 @@ main(int argc, ucount++; } while (nbyte < bytesperrow && (olditem != buffer[nbyte]) && (ucount < MIN(bytesperrow, MAX_REPEAT))); - + if ((ucount != MAX_REPEAT) && (nbyte != bytesperrow)) { /* Back up to the last truly unique pattern */ ucount--; nbyte--; } - if (ucount > 0) { + if (ucount > 0) { /* Output the unique patterns */ - outbuffer[nout++] = + outbuffer[nout++] = (ucount-1) | PLOT_ARBITRARY_DATA_MASK; for (i = nbyte-ucount; i < nbyte; i++) outbuffer[nout++] = buffer[i]; @@ -235,12 +235,12 @@ main(int argc, /* ** If we already are at the end of the current scan ** line, skip the rest of the encoding and start - ** with a new scan line. + ** with a new scan line. */ if (nbyte >= bytesperrow) goto nextrow; - + ecount = 0; /* Equal items counter */ do /* Find equal patterns */ { @@ -248,25 +248,25 @@ main(int argc, ecount++; } while (nbyte < bytesperrow && (olditem == buffer[nbyte]) && (ecount < MIN(bytesperrow, MAX_REPEAT))); - + if (ecount > 1) { /* More than 1 equal pattern */ if (olditem == '\0') { /* White patterns */ if (nbyte >= bytesperrow-1) { /* No more valid data ahead */ - outbuffer[nout++] = + outbuffer[nout++] = (ecount-2) | SKIP_AND_PLOT_MASK; outbuffer[nout++] = buffer[nbyte-1]; - } - else { + } + else { /* More valid data ahead */ - outbuffer[nout++] = + outbuffer[nout++] = (ecount-1) | SKIP_AND_PLOT_MASK; outbuffer[nout++] = buffer[nbyte++]; - } + } } - else { + else { /* Non-white patterns */ outbuffer[nout++] = (ecount-1) | REPEAT_PLOT_MASK; outbuffer[nout++] = olditem; @@ -274,11 +274,11 @@ main(int argc, } /* if (ecount > 1) */ else nbyte--; /* No equal items found */ - + if (nbyte >= bytesperrow) goto nextrow; } /* while (TRUE) */ - + nextrow: printf("%d/", nout+1); /* Total bytes to xfer = nout+1 */ fflush(stdout); @@ -298,7 +298,7 @@ main(int argc, linerepeat = 0; } } - + /* Now we are ready for a new scan line */ for (i = 0; i < bytesperrow; ++i) oldscanline[i] = newscanline[i]; diff --git a/converter/pbm/pbmtoibm23xx.c b/converter/pbm/pbmtoibm23xx.c index 183d5419..0af20b5e 100644 --- a/converter/pbm/pbmtoibm23xx.c +++ b/converter/pbm/pbmtoibm23xx.c @@ -18,7 +18,7 @@ */ /* - * This prgram is primarily based on the description of Brothers PPDS + * This program is primarily based on the description of Brothers PPDS * emulation (see * http://www.brother.de/download/send_file.cfm?file_name=guide_ibmpro.pdf). * However, there are some differences. Their document states that @@ -39,7 +39,7 @@ * normally achieve in y. But the printer is able to do line feeds in * terms of 1/240", so the trick to print in higher resolutions is to * print in several interleaved passes, and do a line feed of 1/240" - * or 1/120" inbetween. + * or 1/120" in between. */ #include <stdio.h> diff --git a/converter/pbm/pbmtomacp.c b/converter/pbm/pbmtomacp.c index e02f5559..4897e6d0 100644 --- a/converter/pbm/pbmtomacp.c +++ b/converter/pbm/pbmtomacp.c @@ -18,7 +18,7 @@ /* - Implemention notes + Implementation notes Header size is 512 bytes. There is no MacBinary header. diff --git a/converter/pbm/pbmtopk.c b/converter/pbm/pbmtopk.c index 2f05d449..3f54254c 100644 --- a/converter/pbm/pbmtopk.c +++ b/converter/pbm/pbmtopk.c @@ -1,8 +1,8 @@ /* pbmtopk, adapted from "pxtopk.c by tomas rokicki" by AJCD 1/8/90 - + References (retrieved May 31 2015): - Packed (PK) Font File Format + Packed (PK) Font File Format https://www.tug.org/TUGboat/tb06-3/tb13pk.pdf Tex Font Metric Files (TFM) @@ -148,7 +148,7 @@ compute_checksum() temp_width:=memory[char_wd[c]]; if design_units<>unity then temp_width:=round((temp_width/design_units)*1048576.0); - temp_width:=temp_width + (c+4)*@'20000000; + temp_width:=temp_width + (c+4)*@'20000000; {this should be positive} c0:=(c0+c0+temp_width) mod 255; c1:=(c1+c1+temp_width) mod 253; @@ -173,12 +173,12 @@ compute_checksum() static byte -add_tfmtable(int * const table, - int * const count, - int const value, - int const max_count, +add_tfmtable(int * const table, + int * const count, + int const value, + int const max_count, const char * const name) { - + integer i; for (i = 0; i < *count; i++) /* search for value in tfm table */ if (table[i] == value) return (byte)i; @@ -194,8 +194,8 @@ add_tfmtable(int * const table, /* add a suffix to a filename in an allocated space */ -static void -pbmtopk_add_suffix(char * const name, +static void +pbmtopk_add_suffix(char * const name, const char * const suffix) { char *slash = strrchr(name, '/'); @@ -208,7 +208,7 @@ pbmtopk_add_suffix(char * const name, /* initialize the PK parameters */ -static void +static void initialize_pk(void) { integer i ; pm_message("This is PBMtoPK, version 2.4") ; @@ -225,13 +225,13 @@ initialize_pk(void) { /* write a single byte to the PK file */ -static void +static void pbmtopk_pkbyte(integer const b_in) { integer b; b = b_in; /* initial value */ - if (b < 0) + if (b < 0) b += 256 ; putc(b, pkfile) ; pbmtopk_pkloc++ ; @@ -240,13 +240,13 @@ pbmtopk_pkbyte(integer const b_in) { /* write two bytes to the PK file */ -static void +static void pkhalfword(integer const a_in) { integer a; a = a_in; - if (a < 0) + if (a < 0) a += 65536 ; pbmtopk_pkbyte(a >> 8) ; pbmtopk_pkbyte(a & 255) ; @@ -255,7 +255,7 @@ pkhalfword(integer const a_in) { /* write three bytes to the PK file */ -static void +static void pkthreebytes(integer const a) { pbmtopk_pkbyte((a>>16) & 255) ; @@ -266,7 +266,7 @@ pkthreebytes(integer const a) { /* write four bytes to the PK file */ -static void +static void pkword(integer const a) { pbmtopk_pkbyte((a>>24) & 255) ; pbmtopk_pkbyte((a>>16) & 255) ; @@ -277,7 +277,7 @@ pkword(integer const a) { /* write a nibble to the PK file */ -static void +static void pknyb(integer const a) { if (bitweight == 16) { @@ -292,15 +292,15 @@ pknyb(integer const a) { /* write preamble to PK file */ -static void +static void writepreamble(void) { integer i ; const char * const comment = "PBMtoPK 2.4 output" ; - + pbmtopk_pkbyte(247) ; /* PRE command */ pbmtopk_pkbyte(89) ; /* PK file type */ pbmtopk_pkbyte(strlen(comment)) ; /* output comment */ - for (i = 0 ; i < strlen(comment); i++) + for (i = 0 ; i < strlen(comment); i++) pbmtopk_pkbyte(xord[(int)comment[i]]) ; pkword(designsize) ; /* write designsize */ pkword(checksum) ; /* write checksum; calculate if possible */ @@ -311,7 +311,7 @@ writepreamble(void) { /* write postamble to PK file, padded to word length */ -static void +static void writepostamble(void) { pbmtopk_pkbyte(245) ; /* POST command */ while (pbmtopk_pkloc % 4) @@ -322,7 +322,7 @@ writepostamble(void) { /* write a byte to the TFM file */ -static void +static void tfmbyte(integer const b_in) { integer b; @@ -335,9 +335,9 @@ tfmbyte(integer const b_in) { /* write a half word to the TFM file */ -static void +static void tfmhalfword(integer const a_in) { - + integer a; a = a_in; @@ -350,7 +350,7 @@ tfmhalfword(integer const a_in) { /* write a word to the TFM file */ -static void +static void tfmword(integer const a) { tfmbyte((a>>24) & 255) ; tfmbyte((a>>16) & 255) ; @@ -361,12 +361,12 @@ tfmword(integer const a) { /* write the whole TFM file for the font */ -static void +static void writetfmfile(void) { integer totallength ; integer headersize = 17; integer i ; - + if (largestch - smallestch < 0) { largestch = 0; smallestch = 1; @@ -406,23 +406,23 @@ writetfmfile(void) { /* header */ tfmword(checksum) ; /* write checksum */ tfmword(designsize) ; /* write designsize */ - if (strlen(codingscheme) > 39) + if (strlen(codingscheme) > 39) tfmbyte(39) ; /* write coding scheme len */ - else + else tfmbyte(strlen(codingscheme)) ; for (i = 0; i < 39; i++) /* write coding scheme */ - if + if (*codingscheme) tfmbyte(xord[(int)(*codingscheme++)]) ; else tfmbyte(0) ; - if (strlen(familyname) > 19) + if (strlen(familyname) > 19) tfmbyte(19) ; /* write family length */ - else + else tfmbyte(strlen(familyname)) ; for (i = 0; i < 19; i++) /* write family */ - if (*familyname) + if (*familyname) tfmbyte(xord[(int)(*familyname++)]) ; - else + else tfmbyte(0) ; /* char_info */ for (car = smallestch; car <= largestch; car++) @@ -441,7 +441,7 @@ writetfmfile(void) { for (i = 0; i < numdepth; i++) tfmword(depthtab[i]) ; /* italic correction table */ for (i = 0; i < numitalic; i++) tfmword(italictab[i]) ; - /* no lig_kern, kern, or exten tables */ + /* no lig_kern, kern, or extent tables */ /* fontdimen table */ for (i = 0; i < numparam; i++) if (i && !fixrange(parameters[i])) @@ -456,11 +456,11 @@ writetfmfile(void) { /* read a character from a PBM file */ static void readcharacter(void) { FILE *fp; - + fp = pm_openr(filename[car]); bitmap = pbm_readpbm(fp, &width, &height) ; pm_close(fp) ; - + if ((charflags[car] & HORZESC) == 0) horzesc[car] = width ; if ((charflags[car] & VERTESC) == 0) vertesc[car] = 0; if ((charflags[car] & XOFFSET) == 0) xoffset[car] = 0; @@ -470,10 +470,10 @@ static void readcharacter(void) { if ((charflags[car] & TFMHEIGHT) == 0) hgtindex[car] = add_tfmheight(fixword(designunits(yoffset[car]+1))); if ((charflags[car] & TFMDEPTH) == 0) - depindex[car] = + depindex[car] = add_tfmdepth(fixword(designunits(height-1-yoffset[car]))); if ((charflags[car] & TFMITALIC) == 0) italindex[car] = 0; - + if (car < smallestch) smallestch = car; if (car > largestch) largestch = car; if (width > emwidth) emwidth = width ; @@ -482,14 +482,14 @@ static void readcharacter(void) { /* test if two rows of the PBM are the same */ -static int -equal(const bit * const row1, +static int +equal(const bit * const row1, const bit * const row2) { integer i ; - + for (i = 0; i < width; i++) - if (row1[i] != row2[i]) + if (row1[i] != row2[i]) return (0) ; return(1) ; @@ -497,7 +497,7 @@ equal(const bit * const row1, -static void +static void shipcharacter(void) { integer compsize ; @@ -526,13 +526,13 @@ shipcharacter(void) { integer max2 ; integer predpkloc ; integer buff ; - + integer tfwid = widthtab[tfmindex[car]] ; integer hesc = horzesc[car] ; integer vesc = vertesc[car] ; integer xoff = xoffset[car] ; integer yoff = yoffset[car] ; - + MALLOCARRAY(repeatptr, height + 1); MALLOCARRAY(bitcounts, height * width); if (repeatptr == NULL || bitcounts == NULL) @@ -781,8 +781,8 @@ shipcharacter(void) { } if (predpkloc != pbmtopk_pkloc) pm_error("bad predicted character length: character %d", car); - pbm_freerow(zerorow); - pbm_freerow(onesrow); + pbm_freerow(zerorow); + pbm_freerow(onesrow); free((char *)repeatptr); free((char *)bitcounts); } @@ -790,7 +790,7 @@ shipcharacter(void) { /* check that character is in valid range */ -static void +static void checkchar(void) { if (car < 0 || car >= MAXPKCHAR) pm_error("character must be in range 0 to %d", MAXPKCHAR-1) ; @@ -799,16 +799,16 @@ checkchar(void) { /* read character information from an option file */ -static void +static void optionfile(const char * const name) { FILE *fp ; char buffer[MAXOPTLINE] ; - + fp = pm_openr(name); while (!feof(fp)) { char *here = buffer; - + if (fgets(buffer, MAXOPTLINE, fp) == NULL) break ; while (ISSPACE(*here)) here++ ; if (*here && *here == '=') { @@ -817,7 +817,7 @@ optionfile(const char * const name) { } else if (*here && *here != '%' && *here != '#') { char str[NAMELENGTH] ; integer i, n; - + checkchar() ; if (sscanf(here, "%s%n", str, &n) != 1) pm_error("bad option file line %s", buffer) ; @@ -881,26 +881,26 @@ main(int argc, char *argv[]) { pbm_init(&argc, argv); initialize_pk() ; - + if (--argc < 1) pm_usage(usage) ; ++argv; if(strlen(*argv) + 4 > NAMELENGTH) pm_error("pkname is too long"); strcpy(pkname, *argv) ; pbmtopk_add_suffix(pkname, ".pk") ; - + if (--argc < 1) pm_usage(usage); ++argv; if(strlen(*argv) + 4 > NAMELENGTH) pm_error("tfmname is too long"); strcpy(tfmname, *argv) ; pbmtopk_add_suffix(tfmname, ".tfm") ; - + if (--argc < 1) pm_usage(usage) ; resolution = atoi(*++argv) ; if (resolution < 1 || resolution > 32767) pm_error("unlikely resolution %d dpi", resolution); - + car = flags = hesc = vesc = xoff = yoff = tfwid = 0; while (++argv, --argc) { if (argv[0][0] == '-' && argv[0][1]) { @@ -922,7 +922,7 @@ main(int argc, char *argv[]) { case 's': designsize = fixword(atof(p)); if (designsize < 1048576) - pm_error("design size %f out of range", + pm_error("design size %f out of range", unfixword(designsize)); case 'h': hesc = atoi(p) ; @@ -1009,3 +1009,5 @@ main(int argc, char *argv[]) { return 0; } + + diff --git a/converter/pbm/pbmtoppa/README.REDHAT b/converter/pbm/pbmtoppa/README.REDHAT index 3586aea2..e7b30490 100644 --- a/converter/pbm/pbmtoppa/README.REDHAT +++ b/converter/pbm/pbmtoppa/README.REDHAT @@ -17,7 +17,7 @@ StartEntry: DeskJet720C It does does not support color printing. \ IMPORTANT! Insert \ "- | pbm2ppa -" \ - in the "Extra GS Otions" field.\ + in the "Extra GS Options" field.\ } Resolution: {600} {600} {} EndEntry diff --git a/converter/pbm/pbmtoppa/ppa.c b/converter/pbm/pbmtoppa/ppa.c index aa30d684..69e7bb79 100644 --- a/converter/pbm/pbmtoppa/ppa.c +++ b/converter/pbm/pbmtoppa/ppa.c @@ -207,7 +207,7 @@ void ppa_init_job(ppa_stat* prn) scp3_put (prn->fptr, 0x018f, sizeof(init3), 7, 2, 4, init3); break; default: - fprintf(stderr,"ppa_init_job(): unknown printer verson\n"); + fprintf(stderr,"ppa_init_job(): unknown printer version\n"); } } @@ -238,7 +238,7 @@ void ppa_init_page(ppa_stat* prn) scp3_put (prn->fptr, 0x0183, sizeof(pageA), 5, 1, 0, pageA); break; default: - fprintf(stderr,"ppa_init_page(): unknown printer verson\n"); + fprintf(stderr,"ppa_init_page(): unknown printer version\n"); } } @@ -260,7 +260,7 @@ void ppa_load_page(ppa_stat* prn) scp3_put (prn->fptr, 0x0181, sizeof(loadC), 7, 1, 0, loadC); break; default: - fprintf(stderr,"ppa_load_page(): unknown printer verson\n"); + fprintf(stderr,"ppa_load_page(): unknown printer version\n"); } } @@ -282,7 +282,7 @@ void ppa_eject_page(ppa_stat* prn) scp3_put (prn->fptr, 0x0181, sizeof(loadC), 7, 1, 0, loadC); break; default: - fprintf(stderr,"ppa_eject_page(): unknown printer verson\n"); + fprintf(stderr,"ppa_eject_page(): unknown printer version\n"); } } @@ -440,7 +440,7 @@ void ppa_print_sweep(ppa_stat* prn,ppa_sweep_data* data) MF=1; break; default: - fprintf(stderr,"ppa_print_sweep(): unknown printer verson\n"); + fprintf(stderr,"ppa_print_sweep(): unknown printer version\n"); return; } |