summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2021-08-01 15:21:52 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2021-08-02 07:54:55 -0700
commit91c9f2bf4de6a508b537afb95d45cab750a439d0 (patch)
treed6f075849e7d93bbe2aa41916dcd71f4a98c41a2
parent6c22fc002e2b5a08c8678db673afa32fefea07a3 (diff)
Remove support for Digital LN03 laser printer
This DEC printer from the early 1980's is not widely used today. This was the last remaining printer using the "sixel" and "sixmap" support, so those functions were removed as well. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--Makefile.am1
-rw-r--r--lncmd.h51
-rw-r--r--xdpr.man5
-rw-r--r--xpr.c360
-rw-r--r--xpr.h2
-rw-r--r--xpr.man29
6 files changed, 17 insertions, 431 deletions
diff --git a/Makefile.am b/Makefile.am
index dc31147..fada3de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,7 +25,6 @@ AM_CFLAGS = $(CWARNFLAGS) $(XPR_CFLAGS) -DNOINLINE
xpr_LDADD = $(XPR_LIBS)
xpr_SOURCES = \
- lncmd.h \
pmp.h \
x2jet.c \
x2pmp.c \
diff --git a/lncmd.h b/lncmd.h
deleted file mode 100644
index d61e44e..0000000
--- a/lncmd.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-
-Copyright (c) 1985 X Consortium
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of the X Consortium shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from the X Consortium.
-
-*/
-
-
-/* lncmd.h - Command sequences DEC printers, in particular LN0x laser
- printers */
-
-/*
-#define LN_RIS "\033c" Obsolete; causes LN03+ problems
-*/
-#define LN_STR "\033[!p"
-#define LN_SSU "\033[%d I"
-#define LN_PUM_SET "\033[11h"
-#define LN_PFS "\033[%s J"
-#define LN_DECSLRM "\033[%d;%ds"
-#define LN_HPA "\033[%d`"
-#define LN_VPA "\033[%dd"
-#define LN_SIXEL_GRAPHICS "\033P%d;%d;%dq"
-#define LN_ST "\033\\"
-#define LN_DECOPM_SET "\033[?52h"
-#define LN_DECOPM_RESET "\033[?52I"
-#define LN_SGR "\033[1%dm"
-#define LN_PUM "\033[11I"
-#define LN_LNM "\033[20h"
diff --git a/xdpr.man b/xdpr.man
index 0dbf6ee..670e8dc 100644
--- a/xdpr.man
+++ b/xdpr.man
@@ -1,4 +1,4 @@
-.TH XDPR 1 "Release 6" "X Version 11"
+.TH XDPR 1 __xorgversion__
.SH NAME
xdpr \- dump an X window directly to a printer
.SH SYNOPSIS
@@ -72,9 +72,6 @@ HP LaserJet series and other monochrome PCL devices
such as ThinkJet, QuietJet, RuggedWriter, \s-1HP\s+12560 series,
and HP 2930 series printers
.TP
-.B ln03
-Digital LN03
-.TP
.B pjet
HP PaintJet (color mode)
.TP
diff --git a/xpr.c b/xpr.c
index 8ef99bd..6efd01d 100644
--- a/xpr.c
+++ b/xpr.c
@@ -38,7 +38,7 @@ from the X Consortium.
* Also accepts the -compact flag that produces more compact output
* by using run-length encoding on white (1) pixels.
* This version does not (yet) support the following options
- * -append -dump -noff -nosixopt -split
+ * -append -dump -noff -split
*
* Changes
* Copyright 1986 by Marvin Solomon and the University of Wisconsin
@@ -84,7 +84,6 @@ from the X Consortium.
#ifndef WIN32
#include <pwd.h>
#endif
-#include "lncmd.h"
#include "xpr.h"
#include <X11/XWDFile.h>
#include <X11/Xmu/SysUtil.h>
@@ -122,8 +121,6 @@ int debug = 0;
#define F_PORTRAIT 1
#define F_LANDSCAPE 2
-#define F_DUMP 4
-#define F_NOSIXOPT 8
#define F_APPEND 16
#define F_NOFF 32
#define F_REPORT 64
@@ -216,33 +213,6 @@ char *convert_data(
GrayPtr gray,
XColor *colors,
int flags);
-static
-void dump_sixmap(
- register unsigned char (*sixmap)[],
- int iw,
- int ih);
-static
-void build_sixmap(
- int ih,
- int iw,
- unsigned char (*sixmap)[],
- int hpad,
- XWDFileHeader *win,
- const char *data);
-static
-void ln03_setup(
- int iw,
- int ih,
- enum orientation orientation,
- int scale,
- int left,
- int top,
- int *left_margin,
- int *top_margin,
- int flags,
- const char *header,
- const char *trailer);
-static void ln03_finish(void);
static void dump_prolog(int flags);
static int points(int n);
static char *escape(const char *s);
@@ -259,16 +229,6 @@ void ps_setup(
const char *trailer,
const char *name);
static void ps_finish(void);
-static
-void ln03_output_sixels(
- unsigned char (*sixmap)[],
- int iw,
- int ih,
- int nosixopt,
- int split,
- int scale,
- int top_margin,
- int left_margin);
static void ps_output_bits(
int iw,
int ih,
@@ -296,16 +256,12 @@ int main(int argc, char **argv)
{
unsigned long swaptest = 1;
XWDFileHeader win;
- register unsigned char (*sixmap)[];
register int i;
register int iw;
register int ih;
- register int sixel_count;
char *w_name;
int scale, width, height, flags, split;
int left, top;
- int top_margin, left_margin;
- int hpad;
char *header, *trailer;
int plane;
int density, render;
@@ -349,7 +305,10 @@ int main(int argc, char **argv)
(flags & F_SLIDE),
device, cutoff, gamma, render);
exit(0);
+ } else if (device != PS) {
+ fprintf(stderr, "xpr: device not supported\n");
}
+ /* everything past here is for device == PS */
/* read in window header */
fullread(0, (char *)&win, sizeof win);
@@ -413,38 +372,13 @@ int main(int argc, char **argv)
setup_layout(device, (int) win.pixmap_width, (int) win.pixmap_height,
flags, width, height, header, trailer, &scale, &orientation);
- if (device == PS) {
- iw = win.pixmap_width;
- ih = win.pixmap_height;
- sixmap = NULL;
- } else {
- /* calculate w and h cell count */
- iw = win.pixmap_width;
- ih = (win.pixmap_height + 5) / 6;
- hpad = (ih * 6) - win.pixmap_height;
-
- /* build pixcells from input file */
- sixel_count = iw * ih;
- sixmap = (unsigned char (*)[])malloc((unsigned)sixel_count);
- build_sixmap(iw, ih, sixmap, hpad, &win, data);
- }
+ iw = win.pixmap_width;
+ ih = win.pixmap_height;
- /* output commands and sixel graphics */
- if (device == LN03) {
-/* ln03_grind_fonts(sixmap, iw, ih, scale, &pixmap); */
- ln03_setup(iw, ih, orientation, scale, left, top,
- &left_margin, &top_margin, flags, header, trailer);
- ln03_output_sixels(sixmap, iw, ih, (flags & F_NOSIXOPT), split,
- scale, top_margin, left_margin);
- ln03_finish();
- } else if (device == PS) {
- ps_setup(iw, ih, orientation, scale, left, top,
- flags, header, trailer, w_name);
- ps_output_bits(iw, ih, flags, orientation, &win, data);
- ps_finish();
- } else {
- fprintf(stderr, "xpr: device not supported\n");
- }
+ ps_setup(iw, ih, orientation, scale, left, top,
+ flags, header, trailer, w_name);
+ ps_output_bits(iw, ih, flags, orientation, &win, data);
+ ps_finish();
/* print some statistics */
if (flags & F_REPORT) {
@@ -454,8 +388,6 @@ int main(int argc, char **argv)
fprintf(stderr, "Orientation: %s, Scale: %d\n",
(orientation==PORTRAIT) ? "Portrait" : "Landscape", scale);
}
- if ((device == LN03) && (flags & F_DUMP))
- dump_sixmap(sixmap, iw, ih);
exit(EXIT_SUCCESS);
}
@@ -487,7 +419,7 @@ usage(void)
fprintf(stderr, "usage: %s [options] [file]\n%s", progname,
" -append <file> -noff -output <file>\n"
" -compact\n"
- " -device {ln03 | ps | lw | pp | ljet | pjet | pjetxl}\n"
+ " -device {ps | lw | pp | ljet | pjet | pjetxl}\n"
" -dump\n"
" -gamma <correction>\n"
" -gray {2 | 3 | 4}\n"
@@ -496,7 +428,6 @@ usage(void)
" -landscape -portrait\n"
" -left <inches> -top <inches>\n"
" -noposition\n"
- " -nosixopt\n"
" -plane <n>\n"
" -psfig\n"
" -render <type>\n"
@@ -570,8 +501,6 @@ void parse_args(
argc--; argv++;
if (argc == 0) missing_arg(arg);
*cutoff = min((atof(*argv) / 100.0 * 0xFFFF), 0xFFFF);
- } else if (!strcmp(*argv, "-dump")) {
- *flags |= F_DUMP;
} else if (!strcmp(*argv, "-density")) {
argc--; argv++;
if (argc == 0) missing_arg(arg);
@@ -579,9 +508,7 @@ void parse_args(
} else if (!strcmp(*argv, "-device")) {
argc--; argv++;
if (argc == 0) missing_arg(arg);
- if (!strcmp(*argv, "ln03")) {
- *device = LN03;
- } else if (!strcmp(*argv, "ps")) {
+ if (!strcmp(*argv, "ps")) {
*device = PS;
} else if (!strcmp(*argv, "lw")) {
*device = PS;
@@ -631,8 +558,6 @@ void parse_args(
argc--; argv++;
if (argc == 0) missing_arg(arg);
*left = (int)(300.0 * atof(*argv));
- } else if (!strcmp(*argv, "-nosixopt")) {
- *flags |= F_NOSIXOPT;
} else if (!strcmp(*argv, "-noff")) {
*flags |= F_NOFF;
} else if (!strcmp(*argv, "-noposition")) {
@@ -747,7 +672,7 @@ void setup_layout(
if (trailer != NULL) win_height += 75;
/* check maximum width and height; set orientation and scale*/
- if (device == LN03 || device == PS) {
+ if (device == PS) {
if ((win_width < win_height || (flags & F_PORTRAIT)) &&
!(flags & F_LANDSCAPE)) {
*orientation = PORTRAIT;
@@ -967,185 +892,6 @@ char *convert_data(
return (out_image->data);
}
-static
-void dump_sixmap(
- register unsigned char (*sixmap)[],
- int iw,
- int ih)
-{
- register int i, j;
- register unsigned char *c;
-
- c = (unsigned char *)sixmap;
- fprintf(stderr, "Sixmap:\n");
- for (i = 0; i < ih; i++) {
- for (j = 0; j < iw; j++) {
- fprintf(stderr, "%02X ", *c++);
- }
- fprintf(stderr, "\n\n");
- }
-}
-
-static
-void build_sixmap(
- int ih,
- int iw,
- unsigned char (*sixmap)[],
- int hpad,
- XWDFileHeader *win,
- const char *data)
-{
- int iwb = win->bytes_per_line;
- unsigned char *line[6];
- register unsigned char *c;
- register int i, j;
-#ifdef NOINLINE
- register int w;
-#endif
- register int sixel;
- unsigned char *buffer = (unsigned char *)data;
-
- c = (unsigned char *)sixmap;
-
-
- while (--ih >= 0) {
- for (i = 0; i <= 5; i++) {
- line[i] = buffer;
- buffer += iwb;
- }
- if ((ih == 0) && (hpad > 0)) {
- unsigned char *ffbuf;
-
- ffbuf = (unsigned char *)malloc((unsigned)iwb);
- for (j = 0; j < iwb; j++)
- ffbuf[j] = 0xFF;
- for (; --hpad >= 0; i--)
- line[i] = ffbuf;
- }
-
-#ifndef NOINLINE
- for (i = 0; i < iw; i++) {
- sixel = extzv(line[0], i, 1);
- sixel |= extzv(line[1], i, 1) << 1;
- sixel |= extzv(line[2], i, 1) << 2;
- sixel |= extzv(line[3], i, 1) << 3;
- sixel |= extzv(line[4], i, 1) << 4;
- sixel |= extzv(line[5], i, 1) << 5;
- *c++ = sixel;
- }
-#else
- for (i = 0, w = iw; w > 0; i++) {
- for (j = 0; j <= 7; j++) {
- sixel = ((line[0][i] >> j) & 1);
- sixel |= ((line[1][i] >> j) & 1) << 1;
- sixel |= ((line[2][i] >> j) & 1) << 2;
- sixel |= ((line[3][i] >> j) & 1) << 3;
- sixel |= ((line[4][i] >> j) & 1) << 4;
- sixel |= ((line[5][i] >> j) & 1) << 5;
- *c++ = sixel;
- if (--w == 0) break;
- }
- }
-#endif
- }
-}
-
-/*
-ln03_grind_fonts(sixmap, iw, ih, scale, pixmap)
-unsigned char (*sixmap)[];
-int iw;
-int ih;
-int scale;
-struct pixmap (**pixmap)[];
-{
-}
-*/
-
-static
-void ln03_setup(
- int iw,
- int ih,
- enum orientation orientation,
- int scale,
- int left,
- int top,
- int *left_margin,
- int *top_margin,
- int flags,
- const char *header,
- const char *trailer)
-{
- register int i;
- register int lm, tm, xm;
- char buf[256];
- register char *bp = buf;
-
- if (!(flags & F_APPEND)) {
- sprintf(bp, LN_STR); bp += 4;
- sprintf(bp, LN_SSU, 7); bp += 5;
- sprintf(bp, LN_PUM_SET); bp += sizeof LN_PUM_SET - 1;
- }
-
- if (orientation == PORTRAIT) {
- lm = (left > 0)? left : (((W_MAX - scale * iw) / 2) + W_MARGIN);
- tm = (top > 0)? top : (((H_MAX - scale * ih * 6) / 2) + H_MARGIN);
- sprintf(bp, LN_PFS, "?20"); bp += 7;
- sprintf(bp, LN_DECOPM_SET); bp += sizeof LN_DECOPM_SET - 1;
- sprintf(bp, LN_DECSLRM, lm, W_PAGE - lm); bp += strlen(bp);
- } else {
- lm = (left > 0)? left : (((H_MAX - scale * iw) / 2) + H_MARGIN);
- tm = (top > 0)? top : (((W_MAX - scale * ih * 6) / 2) + W_MARGIN);
- sprintf(bp, LN_PFS, "?21"); bp += 7;
- sprintf(bp, LN_DECOPM_SET); bp += sizeof LN_DECOPM_SET - 1;
- sprintf(bp, LN_DECSLRM, lm, H_PAGE - lm); bp += strlen(bp);
- }
-
- if (header != NULL) {
- sprintf(bp, LN_VPA, tm - 100); bp += strlen(bp);
- i = strlen(header);
- xm = (((scale * iw) - (i * 30)) / 2) + lm;
- sprintf(bp, LN_HPA, xm); bp += strlen(bp);
- sprintf(bp, LN_SGR, 3); bp += strlen(bp);
- memmove(bp, header, i);
- bp += i;
- }
- if (trailer != NULL) {
- sprintf(bp, LN_VPA, tm + (scale * ih * 6) + 75); bp += strlen(bp);
- i = strlen(trailer);
- xm = (((scale * iw) - (i * 30)) / 2) + lm;
- sprintf(bp, LN_HPA, xm); bp += strlen(bp);
- sprintf(bp, LN_SGR, 3); bp += strlen(bp);
- memmove(bp, trailer, i);
- bp += i;
- }
-
- sprintf(bp, LN_HPA, lm); bp += strlen(bp);
- sprintf(bp, LN_VPA, tm); bp += strlen(bp);
- sprintf(bp, LN_SIXEL_GRAPHICS, 9, 0, scale); bp += strlen(bp);
- sprintf(bp, "\"1;1"); bp += 4; /* Pixel aspect ratio */
- write(1, buf, bp-buf);
- *top_margin = tm;
- *left_margin = lm;
-}
-
-static
-void ln03_finish(void)
-{
- char buf[256];
- register char *bp = buf;
-
- sprintf(bp, LN_DECOPM_RESET); bp += sizeof LN_DECOPM_SET - 1;
- sprintf(bp, LN_LNM); bp += 5;
- sprintf(bp, LN_PUM); bp += 5;
- sprintf(bp, LN_PFS, "?20"); bp += 7;
- sprintf(bp, LN_SGR, 0); bp += strlen(bp);
- sprintf(bp, LN_HPA, 1); bp += strlen(bp);
- sprintf(bp, LN_VPA, 1); bp += strlen(bp);
-
-
- write(1, buf, bp-buf);
-}
-
#define COMMENTVERSION "PS-Adobe-1.0"
#ifdef XPROLOG
@@ -1445,86 +1191,6 @@ void ps_finish(void)
while (*p) printf("%s\n",*p++);
}
-static
-void ln03_output_sixels(
- unsigned char (*sixmap)[],
- int iw,
- int ih,
- int nosixopt,
- int split,
- int scale,
- int top_margin,
- int left_margin)
-{
- unsigned char *buf;
- register unsigned char *bp;
- int i;
- int j;
- register int k;
- register unsigned char *c;
- register int lastc;
- register int count;
- char snum[6];
- register char *snp;
-
- bp = (unsigned char *)malloc((unsigned)(iw*ih+512));
- buf = bp;
- count = 0;
- lastc = -1;
- c = (unsigned char *)sixmap;
- split = ih / split; /* number of lines per page */
-
- iw--; /* optimization */
- for (i = 0; i < ih; i++) {
- for (j = 0; j <= iw; j++) {
- if (!nosixopt) {
- if (*c == lastc && j < iw) {
- count++;
- c++;
- continue;
- }
- if (count >= 3) {
- bp--;
- count++;
- *bp++ = '!';
- snp = snum;
- while (count > 0) {
- k = count / 10;
- *snp++ = count - (k * 10) + '0';
- count = k;
- }
- while (--snp >= snum) *bp++ = *snp;
- *bp++ = (~lastc & 0x3F) + 0x3F;
- } else if (count > 0) {
- lastc = (~lastc & 0x3F) + 0x3F;
- do {
- *bp++ = lastc;
- } while (--count > 0);
- }
- }
- lastc = *c++;
- *bp++ = (~lastc & 0x3F) + 0x3F;
- }
- *bp++ = '-'; /* New line */
- lastc = -1;
- if ((i % split) == 0 && i != 0) {
- sprintf((char *)bp, LN_ST); bp += sizeof LN_ST - 1;
- *bp++ = '\f';
- sprintf((char *)bp, LN_VPA, top_margin + (i * 6 * scale));
- bp += strlen((char *)bp);
- sprintf((char *)bp, LN_HPA, left_margin);
- bp += strlen((char *)bp);
- sprintf((char *)bp, LN_SIXEL_GRAPHICS, 9, 0, scale);
- bp += strlen((char *)bp);
- sprintf((char *)bp, "\"1;1"); bp += 4;
- }
- }
-
- sprintf((char *)bp, LN_ST); bp += sizeof LN_ST - 1;
- write(1, (char *)buf, bp-buf);
-}
-
-
#define LINELEN 72 /* number of CHARS (bytes*2) per line of bitmap output */
static
diff --git a/xpr.h b/xpr.h
index ef9f5b4..42a3f59 100644
--- a/xpr.h
+++ b/xpr.h
@@ -29,7 +29,7 @@ enum orientation {
LANDSCAPE_LEFT = 3
};
-enum device {LN01, LN03, PS, PP, LJET, PJET, PJETXL};
+enum device {PS, PP, LJET, PJET, PJETXL};
/* Global variables */
extern const char *progname;
diff --git a/xpr.man b/xpr.man
index b279503..0c6baf7 100644
--- a/xpr.man
+++ b/xpr.man
@@ -79,7 +79,7 @@ xpr \- print an X window dump
.I xpr
takes as input a window dump file produced by
.IR xwd(1)
-and formats it for output on PostScript printers, the Digital LN03,
+and formats it for output on PostScript printers,
the IBM PP3812 page printer, the HP LaserJet (or other PCL printers),
or the HP PaintJet. If no file
argument is given, the standard input is used. By default, \fIxpr\fP
@@ -104,9 +104,6 @@ Specifies the device on which the file will be printed. Currently supported:
such as ThinkJet, QuietJet, RuggedWriter, \s-1HP\s+12560 series,
and \s-1HP\s+12930 series printers
.TP
-.B ln03
-Digital LN03
-.TP
.B pjet
HP PaintJet (color mode)
.TP
@@ -125,7 +122,7 @@ The default is PostScript.
\fB-device lw\fP (LaserWriter) is equivalent to -device ps and is
provided only for backwards compatibility.
.IP "\fB\-scale\fP \fIscale\fP"
-Affects the size of the window on the page. The PostScript, LN03, and HP
+Affects the size of the window on the page. The PostScript and HP
printers are able to
translate each bit in a window pixel map into a grid of a specified size.
For example each bit might translate into a 3x3 grid. This would be
@@ -213,28 +210,6 @@ This option prints the program version information and exits.
xwd(1), xwud(1), X(__miscmansuffix__)
.SH LIMITATIONS
-The current version of \fIxpr\fP can generally print out on the LN03
-most X windows that are not larger than two-thirds of the screen.
-For example, it will be able to print out a large Emacs window, but
-it will usually fail when trying to print out the entire screen. The
-LN03 has memory limitations that can cause it to incorrectly print
-very large or complex windows. The two most common errors
-encountered are ``band too complex'' and ``page memory exceeded.''
-In the first case, a window may have a particular six pixel row that
-contains too many changes (from black to white to black). This will
-cause the printer to drop part of the line and possibly parts of the
-rest of the page. The printer will flash the number `1' on its front
-panel when this problem occurs. A possible solution to this problem
-is to increase the scale of the picture, or to split the picture onto
-two or more pages. The second problem, ``page memory exceeded,''
-will occur if the picture contains too much black, or if the picture
-contains complex half-tones such as the background color of a
-display. When this problem occurs the printer will automatically
-split the picture into two or more pages. It may flash the number
-`5' on its from panel. There is no easy solution to this problem.
-It will probably be necessary to either cut and paste, or to rework the
-application to produce a less complex picture.
-
Support for PostScript output currently cannot handle the \fB-append\fP,
\fB-noff\fP or \fB-split\fP options.