summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2017-05-02 11:28:27 +0200
committerDidier Raboud <odyx@debian.org>2017-05-02 11:28:27 +0200
commit328b73a7bcd044b41b648c94925b2230466d9c81 (patch)
tree18e2e0dddbe6331d1f02effc442f06e0bf4049a3
parent19c8b4bfda3010fb0e0f748a4afe631f28a6eeb4 (diff)
New upstream version 20170320
-rw-r--r--ChangeLog7
-rw-r--r--INSTALL2
-rw-r--r--INSTALL.in2
-rw-r--r--Makefile137
-rw-r--r--PPD/Ricoh-SP_112.ppd341
-rw-r--r--PPD/Ricoh-SP_201Nw.ppd341
-rw-r--r--ddst.h224
-rw-r--r--ddstdecode.1in84
-rw-r--r--ddstdecode.c540
-rw-r--r--foo2ddst-wrapper.1in163
-rwxr-xr-xfoo2ddst-wrapper.in683
-rw-r--r--foo2ddst.1in162
-rw-r--r--foo2ddst.c1580
-rw-r--r--foo2hiperc.c6
-rw-r--r--foomatic-db/driver/foo2ddst.xml20
-rw-r--r--foomatic-db/opt/foo2ddst-InputSlot.xml32
-rw-r--r--foomatic-db/opt/foo2ddst-MediaType.xml47
-rw-r--r--foomatic-db/opt/foo2ddst-PageSize.xml87
-rw-r--r--foomatic-db/opt/foo2ddst-Resolution.xml36
-rw-r--r--foomatic-db/opt/foo2xxx-Copies.xml4
-rw-r--r--foomatic-db/printer/Ricoh-SP_112.xml53
-rw-r--r--foomatic-db/printer/Ricoh-SP_201Nw.xml53
-rw-r--r--icc2ps/Makefile2
-rw-r--r--osx-hotplug/Makefile2
-rw-r--r--osx-hotplug/osx-hplj-hotplug.1in2
-rw-r--r--regress.txt6
26 files changed, 4572 insertions, 44 deletions
diff --git a/ChangeLog b/ChangeLog
index bfef091..a15626a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-03-20 Rick Richardson <rick.richardson@comcast.net>
+ * Add ddstdecode, for decoding some Ricoh printers.
+
+2016-10-21 Rick Richardson <rick.richardson@comcast.net>
+ * Makefile: install-hotplug-prog
+ Add /lib/systemd/systemd-udevd to the list for Ubuntu 16.
+
2016-09-02 Rick Richardson <rick.richardson@comcast.net>
* New Printer: Xerox Phaser 3040 using the foo2hbpl2 driver.
diff --git a/INSTALL b/INSTALL
index 26e731c..6952158 100644
--- a/INSTALL
+++ b/INSTALL
@@ -127,7 +127,7 @@ it will not pass since different versions of Ghostscript generate different
raster images:
# make test
-Create printers (Fedora 6/7/8/.../16 and Ubuntu 7.10/8.x/9.x/10.x/11.x):
+Create printers (Fedora 6/7/.../25 and Ubuntu 7.10/8.x/.../16.x):
# system-config-printer
Create printers (Redhat 7.2/7.3/8.0/9.0, Fedora Core 1-5):
diff --git a/INSTALL.in b/INSTALL.in
index eeb135c..723ddca 100644
--- a/INSTALL.in
+++ b/INSTALL.in
@@ -97,7 +97,7 @@ it will not pass since different versions of Ghostscript generate different
raster images:
# make test
-Create printers (Fedora 6/7/8/.../16 and Ubuntu 7.10/8.x/9.x/10.x/11.x):
+Create printers (Fedora 6/7/.../25 and Ubuntu 7.10/8.x/.../16.x):
# system-config-printer
Create printers (Redhat 7.2/7.3/8.0/9.0, Fedora Core 1-5):
diff --git a/Makefile b/Makefile
index 62b28ec..addc4b5 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,7 @@ SHAREQPDL=$(PREFIX)/share/foo2qpdl
SHARESLX=$(PREFIX)/share/foo2slx
SHAREHC=$(PREFIX)/share/foo2hiperc
SHAREHBPL=$(PREFIX)/share/foo2hbpl
+SHAREDDST=$(PREFIX)/share/foo2ddst
MANDIR=$(PREFIX)/share/man
DOCDIR=$(PREFIX)/share/doc/foo2zjs/
INSTALL=install
@@ -149,6 +150,8 @@ FILES = \
hbpl.h \
foo2hbpl2.c \
foo2hbpl2.1in \
+ foo2ddst.c \
+ foo2ddst.1in \
cups.h \
xqx.h \
xqxdecode.c \
@@ -167,6 +170,9 @@ FILES = \
gipddecode.1in \
hbpldecode.c \
hbpldecode.1in \
+ ddst.h \
+ ddstdecode.c \
+ ddstdecode.1in \
foo2zjs-wrapper.in \
foo2zjs-wrapper.1in \
foo2hp2600-wrapper.in \
@@ -183,6 +189,8 @@ FILES = \
foo2hiperc-wrapper.1in \
foo2hbpl2-wrapper.in \
foo2hbpl2-wrapper.1in \
+ foo2ddst-wrapper.in \
+ foo2ddst-wrapper.1in \
gamma.ps \
gamma-lookup.ps \
align.ps \
@@ -260,6 +268,7 @@ PROGS+= foo2slx slxdecode
PROGS+= foo2hiperc hipercdecode
PROGS+= foo2hbpl2 hbpldecode
PROGS+= gipddecode
+PROGS+= foo2ddst ddstdecode
ifneq ($(CUPS_SERVERBIN),)
ifneq ($(CUPS_DEVEL),)
ifneq ($(CUPS_GOODAPI),)
@@ -269,7 +278,8 @@ ifneq ($(CUPS_SERVERBIN),)
endif
SHELLS= foo2zjs-wrapper foo2oak-wrapper foo2hp2600-wrapper \
foo2xqx-wrapper foo2lava-wrapper foo2qpdl-wrapper \
- foo2slx-wrapper foo2hiperc-wrapper foo2hbpl2-wrapper
+ foo2slx-wrapper foo2hiperc-wrapper foo2hbpl2-wrapper \
+ foo2ddst-wrapper
SHELLS+= foo2zjs-pstops
SHELLS+= printer-profile
MANPAGES= foo2zjs-wrapper.1 foo2zjs.1 zjsdecode.1
@@ -281,6 +291,7 @@ MANPAGES+= foo2qpdl-wrapper.1 foo2qpdl.1 qpdldecode.1
MANPAGES+= foo2slx-wrapper.1 foo2slx.1 slxdecode.1
MANPAGES+= foo2hiperc-wrapper.1 foo2hiperc.1 hipercdecode.1
MANPAGES+= foo2hbpl2-wrapper.1 foo2hbpl2.1 hbpldecode.1
+MANPAGES+= foo2ddst-wrapper.1 foo2ddst.1 ddstdecode.1
MANPAGES+= gipddecode.1
MANPAGES+= foo2zjs-pstops.1 arm2hpdl.1 usb_printerid.1
MANPAGES+= printer-profile.1
@@ -307,7 +318,7 @@ GSOPTS= -q -dBATCH -dSAFER -dQUIET -dNOPAUSE -sPAPERSIZE=letter -r$(GXR)x$(GYR)
JBGOPTS=-m 16 -d 0 -p 92 # Equivalent options for pbmtojbg
.SUFFIXES: .ps .pbm .pgm .pgm2 .ppm .ppm2 .zjs .cmyk .pksm .zc .zm .jbg \
- .cups .cupm .1 .1in .fig .gif .xqx .lava .qpdl .slx .hc .hbpl
+ .cups .cupm .1 .1in .fig .gif .xqx .lava .qpdl .slx .hc .hbpl .ddst
.fig.gif:
fig2dev -L gif $*.fig | giftrans -t "#ffffff" -o $*.gif
@@ -377,6 +388,9 @@ JBGOPTS=-m 16 -d 0 -p 92 # Equivalent options for pbmtojbg
.pbm.hbpl:
./foo2hbpl2 < $*.pbm > $*.hbpl
+.pbm.ddst:
+ ./foo2ddst < $*.pbm > $*.ddst
+
#
# The usual build rules
#
@@ -453,36 +467,44 @@ all-done:
@echo "yourself."
-foo2zjs: foo2zjs.o $(LIBJBG)
- $(CC) $(CFLAGS) -o $@ foo2zjs.o $(LIBJBG)
+foo2ddst: foo2ddst.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2ddst.o $(LIBJBG)
+
+foo2hbpl2: foo2hbpl2.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2hbpl2.o $(LIBJBG)
foo2hp: foo2hp.o $(LIBJBG)
- # $(CC) $(CFLAGS) -o $@ foo2hp.o $(LIBJBG) /usr/local/lib/libdmalloc.a
$(CC) $(CFLAGS) -o $@ foo2hp.o $(LIBJBG)
-foo2xqx: foo2xqx.o $(LIBJBG)
- $(CC) $(CFLAGS) -o $@ foo2xqx.o $(LIBJBG)
+foo2hiperc: foo2hiperc.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2hiperc.o $(LIBJBG)
foo2lava: foo2lava.o $(LIBJBG)
$(CC) $(CFLAGS) -o $@ foo2lava.o $(LIBJBG)
-foo2qpdl: foo2qpdl.o $(LIBJBG)
- $(CC) $(CFLAGS) -o $@ foo2qpdl.o $(LIBJBG)
-
foo2oak: foo2oak.o $(LIBJBG)
$(CC) $(CFLAGS) -o $@ foo2oak.o $(LIBJBG)
+foo2qpdl: foo2qpdl.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2qpdl.o $(LIBJBG)
+
foo2slx: foo2slx.o $(LIBJBG)
$(CC) $(CFLAGS) -o $@ foo2slx.o $(LIBJBG)
-foo2hiperc: foo2hiperc.o $(LIBJBG)
- $(CC) $(CFLAGS) -o $@ foo2hiperc.o $(LIBJBG)
+foo2xqx: foo2xqx.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2xqx.o $(LIBJBG)
-foo2hbpl2: foo2hbpl2.o $(LIBJBG)
- $(CC) $(CFLAGS) -o $@ foo2hbpl2.o $(LIBJBG)
+foo2zjs: foo2zjs.o $(LIBJBG)
+ $(CC) $(CFLAGS) -o $@ foo2zjs.o $(LIBJBG)
-foo2zjs-wrapper: foo2zjs-wrapper.in Makefile
+foo2ddst-wrapper: foo2ddst-wrapper.in Makefile
+ [ ! -f $@ ] || chmod +w $@
+ sed < $@.in > $@ \
+ -e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
+ chmod 555 $@
+
+foo2hbpl2-wrapper: foo2hbpl2-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
sed < $@.in > $@ \
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
@@ -494,7 +516,7 @@ foo2hp2600-wrapper: foo2hp2600-wrapper.in Makefile
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
chmod 555 $@
-foo2xqx-wrapper: foo2xqx-wrapper.in Makefile
+foo2hiperc-wrapper: foo2hiperc-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
sed < $@.in > $@ \
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
@@ -524,13 +546,13 @@ foo2slx-wrapper: foo2slx-wrapper.in Makefile
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
chmod 555 $@
-foo2hiperc-wrapper: foo2hiperc-wrapper.in Makefile
+foo2xqx-wrapper: foo2xqx-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
sed < $@.in > $@ \
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
chmod 555 $@
-foo2hbpl2-wrapper: foo2hbpl2-wrapper.in Makefile
+foo2zjs-wrapper: foo2zjs-wrapper.in Makefile
[ ! -f $@ ] || chmod +w $@
sed < $@.in > $@ \
-e 's@^PREFIX=.*@PREFIX=$(PREFIX)@' || (rm -f $@ && exit 1)
@@ -561,6 +583,9 @@ endif
ok: ok.o $(LIBJBG)
$(CC) $(CFLAGS) ok.o $(LIBJBG) -o $@
+ddstdecode: ddstdecode.o $(LIBJBG)
+ $(CC) $(CFLAGS) ddstdecode.o $(LIBJBG) -o $@
+
gipddecode: gipddecode.o $(LIBJBG)
$(CC) $(CFLAGS) gipddecode.o $(LIBJBG) -o $@
@@ -839,6 +864,13 @@ install-extra:
$(INSTALL) -c -m 644 $$i $(SHAREHBPL)/icm/; \
fi; \
done
+ # foo2ddst ICM files (if any)
+ $(INSTALL) $(LPuid) $(LPgid) -m 775 -d $(SHAREDDST)/icm/
+ for i in ddst*.icm; do \
+ if [ -f $$i ]; then \
+ $(INSTALL) -c -m 644 $$i $(SHAREDDST)/icm/; \
+ fi; \
+ done
MODEL=$(PREFIX)/share/cups/model
LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model
@@ -869,6 +901,7 @@ install-ppd:
find $(PPD) -name '*foo2slx*' | xargs rm -rf; \
find $(PPD) -name '*foo2hiperc*' | xargs rm -rf; \
find $(PPD) -name '*foo2hbpl*' | xargs rm -rf; \
+ find $(PPD) -name '*foo2ddst*' | xargs rm -rf; \
[ -d $(PPD)/foo2zjs ] || mkdir $(PPD)/foo2zjs; \
cd PPD; \
for ppd in *.ppd; do \
@@ -996,11 +1029,15 @@ install-hotplug-prog:
version=`/sbin/udevd --version 2>/dev/null`; \
elif [ -x /usr/lib/udev/udevd ]; then \
version=`/usr/lib/udev/udevd --version 2>/dev/null`; \
+ elif [ -x /lib/systemd/systemd-udevd ]; then \
+ version=`/lib/systemd/systemd-udevd --version 2>/dev/null`; \
elif [ -x /usr/lib/systemd/systemd-udevd ]; then \
version=`/usr/lib/systemd/systemd-udevd --version 2>/dev/null`; \
fi; \
if [ "$$version" = "" ]; then version=0; fi; \
+ echo "***"; \
echo "*** udev version $$version"; \
+ echo "***"; \
if [ "$$version" -lt 148 ]; then \
$(INSTALL) -c -m 644 $(RULES).old $(UDEVDIR)/11-$(RULES); \
else \
@@ -1037,6 +1074,7 @@ install-hotplug-osx:
install-filter:
if [ "$(CUPS_SERVERBIN)" != "" ]; then \
+ $(INSTALL) -d $(CUPS_SERVERBIN)/filter; \
ln -sf $(BIN)/command2foo2lava-pjl $(CUPS_SERVERBIN)/filter/; \
fi
@@ -1138,6 +1176,7 @@ uninstall:
-rm -f $(MANDIR)/man1/opldecode.1 $(MANDIR)/man1/rodecode.1
-rm -f $(MANDIR)/man1/foo2hiperc*.1 $(MANDIR)/man1/hipercdecode.1
-rm -f $(MANDIR)/man1/foo2hbpl*.1 $(MANDIR)/man1/hbpldecode.1
+ -rm -f $(MANDIR)/man1/foo2ddst*.1 $(MANDIR)/man1/ddstdecode.1
-rm -f $(MANDIR)/man1/gipddecode.1
-rm -f $(MANDIR)/man1/arm2hpdl.1 $(MANDIR)/man1/usb_printerid.1
-rm -f $(MANDIR)/man1/foo2zjs-icc2ps.1
@@ -1150,6 +1189,7 @@ uninstall:
-rm -rf /usr/share/foo2slx/
-rm -rf /usr/share/foo2hiperc/
-rm -rf /usr/share/foo2hbpl/
+ -rm -rf /usr/share/foo2ddst/
-rm -f /usr/bin/arm2hpdl
-rm -f /usr/bin/foo2zjs-wrapper /usr/bin/foo2zjs /usr/bin/zjsdecode
-rm -f /usr/bin/foo2oak-wrapper /usr/bin/foo2oak /usr/bin/oakdecode
@@ -1159,10 +1199,11 @@ uninstall:
-rm -f /usr/bin/foo2qpdl-wrapper /usr/bin/foo2qpdl /usr/bin/qpdldecode
-rm -f /usr/bin/foo2slx-wrapper /usr/bin/foo2slx /usr/bin/slxdecode
-rm -f /usr/bin/foo2hiperc-wrapper /usr/bin/foo2hiperc
- -rm -f /usr/bin/foo2hbpl2-wrapper /usr/bin/foo2hbpl2
-rm -f /usr/bin/hipercdecode
- -rm -f /usr/bin/gipddecode
+ -rm -f /usr/bin/foo2hbpl2-wrapper /usr/bin/foo2hbpl2
-rm -f /usr/bin/hbpldecode
+ -rm -f /usr/bin/foo2ddst-wrapper /usr/bin/foo2ddst /usr/bin/ddstdecode
+ -rm -f /usr/bin/gipddecode
-rm -f /usr/bin/opldecode
-rm -f /usr/bin/rodecode
-rm -f /usr/bin/foo2zjs-icc2ps
@@ -1195,9 +1236,11 @@ clean:
-rm -f foo2hiperc.o hipercdecode.o
-rm -f foo2hbpl2.o hbpldecode.o
-rm -f opldecode.o gipddecode.o
+ -rm -f foo2dsst.o ddstdecode.o
-rm -f command2foo2lava-pjl.o
-rm -f foo2oak.html foo2zjs.html foo2hp.html foo2xqx.html foo2lava.html
-rm -f foo2slx.html foo2qpdl.html foo2hiperc.html foo2hbpl.html
+ -rm -f foo2ddst.html
-rm -f index.html
-rm -f arch*.gif
-rm -f sihp*.dl
@@ -1214,25 +1257,29 @@ clean:
#
# Header dependencies
#
-zjsdecode.o: jbig.h zjs.h
-foo2zjs.o: jbig.h zjs.h
-foo2oak.o: jbig.h oak.h
jbig.o: jbig.h
+
+foo2ddst.o: jbig.h ddst.h
+foo2hiperc.o: jbig.h hiperc.h
foo2hp.o: jbig.h zjs.h cups.h
-foo2xqx.o: jbig.h xqx.h
+foo2hbpl2.o: jbig.h hbpl.h
foo2lava.o: jbig.h
+foo2oak.o: jbig.h oak.h
foo2qpdl.o: jbig.h qpdl.h
foo2slx.o: jbig.h slx.h
-foo2hiperc.o: jbig.h hiperc.h
-foo2hbpl2.o: jbig.h hbpl.h
-hipercdecode.o: hiperc.h jbig.h
+foo2xqx.o: jbig.h xqx.h
+foo2zjs.o: jbig.h zjs.h
+
+ddstdecode.o: ddst.h jbig.h
+gipddecode.o: slx.h jbig.h
hbpldecode.o: jbig.h
+hipercdecode.o: hiperc.h jbig.h
lavadecode.o: jbig.h
-qpdldecode.o: jbig.h
opldecode.o: jbig.h
+qpdldecode.o: jbig.h
slxdecode.o: slx.h jbig.h
xqxdecode.o: xqx.h jbig.h
-gipddecode.o: slx.h jbig.h
+zjsdecode.o: jbig.h zjs.h
#
# foo2* Regression tests
@@ -1440,6 +1487,7 @@ ppd:
*3010*|*3040*) driver=foo2hbpl2;; \
*M215*) driver=foo2hbpl2;; \
*M1400*) driver=foo2hbpl2;; \
+ *SP_*) driver=foo2ddst;; \
*) driver=foo2zjs;; \
esac; \
echo $$driver - $$printer; \
@@ -1484,9 +1532,10 @@ man-osx-hotplug:
-e "s@\$${URLSLX}@$(URLSLX)@" \
-e "s@\$${URLHC}@$(URLHC)@" \
-e "s@\$${URLHBPL}@$(URLHBPL)@" \
+ -e "s@\$${URLDDST}@$(URLDDST)@" \
-e "s/\$${MODpage}/$$MODpage/" \
-e "s/\$${MODver}/$$MODver/"
- chmod -w $*.1
+ chmod a-w $*.1
install-man: man
#
@@ -1521,6 +1570,9 @@ install-man: man
$(INSTALL) -c -m 644 foo2hbpl2.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2hbpl2-wrapper.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 hbpldecode.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 foo2ddst.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 foo2ddst-wrapper.1 $(MANDIR)/man1/
+ $(INSTALL) -c -m 644 ddstdecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 gipddecode.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 foo2zjs-pstops.1 $(MANDIR)/man1/
$(INSTALL) -c -m 644 arm2hpdl.1 $(MANDIR)/man1/
@@ -1560,7 +1612,7 @@ README: README.in
sed < $@.in > $@ \
-e "s@\$${URLOAK}@$(URLOAK)@" \
-e "s@\$${URLZJS}@$(URLZJS)@"
- chmod -w $@
+ chmod a-w $@
INSTALL: INSTALL.in Makefile
rm -f $@
@@ -1572,7 +1624,7 @@ INSTALL: INSTALL.in Makefile
-e "s@\$${URLOAK}@$(URLOAK)@" \
-e "s@\$${URLZJS}@$(URLZJS)@"
rm -f $@.tmp
- chmod -w $@
+ chmod a-w $@
#
# Check db files against current foomatic to see if any changes
@@ -1635,17 +1687,20 @@ URLQPDL=http://foo2qpdl.rkkda.com
URLSLX=http://foo2slx.rkkda.com
URLHC=http://foo2hiperc.rkkda.com
URLHBPL=http://foo2hbpl.rkkda.com
+URLDDST=http://foo2ddst.rkkda.com
FTPSITE=~/.ncftp-website
foo2zjs.html foo2oak.html foo2hp.html \
foo2xqx.html foo2lava.html foo2qpdl.html \
- foo2slx.html foo2hiperc.html foo2hbpl.html: thermometer.gif FRC
+ foo2slx.html foo2hiperc.html foo2hbpl.html \
+ foo2ddst.html: thermometer.gif FRC
rm -f $@
HERE=`basename $$PWD`; \
TZ=`date | cut -c 21-24`; \
modtime() { $(MODTIME); }; \
MODindex=`modtime $@.in`; \
MODtarball=`modtime $$HERE.tar.gz`; \
+ MODsha=`sha1sum $$HERE.tar.gz | awk '{print $$1}'` ; \
PRODUCT=`basename $@ .html`; \
./includer-html $@.in | sed > $@ \
-e "s@\$${URLOAK}@$(URLOAK)@g" \
@@ -1657,10 +1712,12 @@ foo2zjs.html foo2oak.html foo2hp.html \
-e "s@\$${URLSLX}@$(URLSLX)@g" \
-e "s@\$${URLHC}@$(URLHC)@g" \
-e "s@\$${URLHBPL}@$(URLHBPL)@g" \
+ -e "s@\$${URLDDST}@$(URLDDST)@g" \
-e "s@\$${PRODUCT}@$$PRODUCT@g" \
-e "s/\$${MODindex}/$$MODindex $$TZ/" \
- -e "s/\$${MODtarball}/$$MODtarball $$TZ/"
- chmod -w $@
+ -e "s/\$${MODtarball}/$$MODtarball $$TZ/" \
+ -e "s/\$${MODsha}/$$MODsha/"
+ chmod a-w $@
myftpput: ../geo/myftpput
rm -f myftpput
@@ -1678,7 +1735,7 @@ webt: tar manual.pdf webindex
webworld: web webpics
webindex: INSTALL zjsindex oakindex hpindex xqxindex lavaindex \
- qpdlindex oakindex slxindex hcindex hbplindex
+ qpdlindex oakindex slxindex hcindex hbplindex ddstindex
webpics: redhat suse ubuntu mandriva fedora
@@ -1749,6 +1806,13 @@ hbplindex: foo2hbpl.html archhbpl.gif thermometer.gif webphotos
images/flags.png INSTALL images/hbplfavicon.png \
printer-photos/printers.jpg;
+ddstindex: foo2ddst.html archddst.gif thermometer.gif webphotos
+ ln -sf foo2ddst.html index.html
+ ./myftpput -S -m -f $(FTPSITE) foo2ddst \
+ index.html style.css archddst.gif thermometer.gif \
+ images/flags.png INSTALL images/ddstfavicon.png \
+ printer-photos/printers.jpg;
+
foo2zjs.html: warning.html contribute.html resources.html unsupported.html
foo2hp.html: warning.html contribute.html resources.html unsupported.html
foo2xqx.html: warning.html contribute.html resources.html unsupported.html
@@ -1758,6 +1822,7 @@ foo2slx.html: warning.html contribute.html resources.html unsupported.html
foo2hiperc.html: warning.html contribute.html resources.html unsupported.html
foo2oak.html: warning.html contribute.html resources.html unsupported.html
foo2hbpl.html: warning.html contribute.html resources.html unsupported.html
+foo2ddst.html: warning.html contribute.html resources.html unsupported.html
# RedHat
redhat: FRC
diff --git a/PPD/Ricoh-SP_112.ppd b/PPD/Ricoh-SP_112.ppd
new file mode 100644
index 0000000..ead334f
--- /dev/null
+++ b/PPD/Ricoh-SP_112.ppd
@@ -0,0 +1,341 @@
+*PPD-Adobe: "4.3"
+*%
+*% For information on using this, and to obtain the required backend
+*% script, consult http://www.openprinting.org/
+*%
+*% This file is published under the GNU General Public License
+*%
+*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with
+*% all programs and environments which use PPD files for dealing with
+*% printer capability information. The printer must be configured with the
+*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This
+*% file and "foomatic-rip" work together to support PPD-controlled printer
+*% driver option access with arbitrary free software printer drivers and
+*% printing spoolers.
+*%
+*% To save this file on your disk, wait until the download has completed
+*% (the animation of the browser logo must stop) and then use the
+*% "Save as..." command in the "File" menu of your browser or in the
+*% pop-up manu when you click on this document with the right mouse button.
+*% DO NOT cut and paste this file into an editor with your mouse. This can
+*% introduce additional line breaks which lead to unexpected results.
+*%
+*% You may save this file as 'Ricoh-SP_112-foo2ddst.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "FOO2DDST.PPD"
+*Manufacturer: "Ricoh"
+*Product: "(SP 112)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+*%pprRIP: foomatic-rip other
+*ModelName: "Ricoh SP 112"
+*ShortNickName: "Ricoh SP 112 foo2ddst"
+*NickName: "Ricoh SP 112 Foomatic/foo2ddst (recommended)"
+*PSVersion: "(3010.000) 550"
+*PSVersion: "(3010.000) 651"
+*PSVersion: "(3010.000) 652"
+*PSVersion: "(3010.000) 653"
+*PSVersion: "(3010.000) 704"
+*PSVersion: "(3010.000) 705"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: False
+*DefaultColorSpace: Gray
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "DRV:Dfoo2ddst,R1,M0,TF;"
+
+*driverName foo2ddst/foo2ddst: ""
+*driverType F/Filter: ""
+*driverUrl: "http://foo2ddst.rkkda.com/"
+*driverObsolete: False
+
+
+
+
+*HWMargins: 14.40 14.40 14.4 14.4
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 135 AnySetup *CustomPageSize
+*CustomPageSize True: "pop pop pop pop pop
+%% FoomaticRIPOptionSetting: PageSize=Custom"
+*End
+*FoomaticRIPOptionSetting PageSize=Custom: "-pCustom.%0x%1 "
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*FoomaticIDs: Ricoh-SP_112 foo2ddst
+*FoomaticRIPCommandLine: "foo2ddst-wrapper %A"
+
+*OpenGroup: General/General
+
+*OpenUI *Resolution/Resolution: PickOne
+*FoomaticRIPOption Resolution: enum CmdLine A
+*OrderDependency: 130 AnySetup *Resolution
+*DefaultResolution: 600x600dpi
+*Resolution 600x600dpi/600x600 dpi: "%% FoomaticRIPOptionSetting: Resolution=600x600dpi"
+*FoomaticRIPOptionSetting Resolution=600x600dpi: "-r600x600 "
+*Resolution 1200x600dpi/1200x600 dpi: "%% FoomaticRIPOptionSetting: Resolution=1200x600dpi"
+*FoomaticRIPOptionSetting Resolution=1200x600dpi: "-r1200x600 "
+*CloseUI: *Resolution
+
+*OpenUI *PageSize/Page Size: PickOne
+*FoomaticRIPOption PageSize: enum CmdLine A
+*OrderDependency: 135 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*FoomaticRIPOptionSetting PageSize=Letter: "-p1 "
+*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*FoomaticRIPOptionSetting PageSize=A4: "-p5 "
+*PageSize A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5"
+*FoomaticRIPOptionSetting PageSize=A5: "-p6 "
+*PageSize A7/A7: "%% FoomaticRIPOptionSetting: PageSize=A7"
+*FoomaticRIPOptionSetting PageSize=A7: "-p7 "
+*PageSize B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*FoomaticRIPOptionSetting PageSize=B5jis: "-p8 "
+*PageSize B6jis/B6 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B6jis"
+*FoomaticRIPOptionSetting PageSize=B6jis: "-p9 "
+*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*FoomaticRIPOptionSetting PageSize=Executive: "-p3 "
+*PageSize Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*FoomaticRIPOptionSetting PageSize=Legal: "-p2 "
+*PageSize w522h737/16k 184x260: "%% FoomaticRIPOptionSetting: PageSize=w522h737"
+*FoomaticRIPOptionSetting PageSize=w522h737: "-p11 "
+*PageSize w553h765/16k 195x270: "%% FoomaticRIPOptionSetting: PageSize=w553h765"
+*FoomaticRIPOptionSetting PageSize=w553h765: "-p12 "
+*PageSize w558h774/16k 197x273: "%% FoomaticRIPOptionSetting: PageSize=w558h774"
+*FoomaticRIPOptionSetting PageSize=w558h774: "-p10 "
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 135 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*PageRegion A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5"
+*PageRegion A7/A7: "%% FoomaticRIPOptionSetting: PageSize=A7"
+*PageRegion B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*PageRegion B6jis/B6 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B6jis"
+*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*PageRegion Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*PageRegion w522h737/16k 184x260: "%% FoomaticRIPOptionSetting: PageSize=w522h737"
+*PageRegion w553h765/16k 195x270: "%% FoomaticRIPOptionSetting: PageSize=w553h765"
+*PageRegion w558h774/16k 197x273: "%% FoomaticRIPOptionSetting: PageSize=w558h774"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/Letter: "14.40 14.40 597.60 777.60"
+*ImageableArea A4/A4: "14.40 14.40 580.60 827.60"
+*ImageableArea A5/A5: "14.40 14.40 405.60 580.60"
+*ImageableArea A7/A7: "14.40 14.40 195.60 282.60"
+*ImageableArea B5jis/B5 (JIS): "14.40 14.40 503.60 712.60"
+*ImageableArea B6jis/B6 (JIS): "14.40 14.40 347.60 503.60"
+*ImageableArea Executive/Executive: "14.40 14.40 507.60 741.60"
+*ImageableArea Legal/Legal: "14.40 14.40 597.60 993.60"
+*ImageableArea w522h737/16k 184x260: "14.40 14.40 507.60 722.60"
+*ImageableArea w553h765/16k 195x270: "14.40 14.40 538.60 750.60"
+*ImageableArea w558h774/16k 197x273: "14.40 14.40 543.60 759.60"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension A5/A5: "420 595"
+*PaperDimension A7/A7: "210 297"
+*PaperDimension B5jis/B5 (JIS): "518 727"
+*PaperDimension B6jis/B6 (JIS): "362 518"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension Legal/Legal: "612 1008"
+*PaperDimension w522h737/16k 184x260: "522 737"
+*PaperDimension w553h765/16k 195x270: "553 765"
+*PaperDimension w558h774/16k 197x273: "558 774"
+
+*OpenUI *InputSlot/Media Source: PickOne
+*FoomaticRIPOption InputSlot: enum CmdLine A
+*OrderDependency: 150 AnySetup *InputSlot
+*DefaultInputSlot: Tray1
+*InputSlot Tray1/Tray 1: "%% FoomaticRIPOptionSetting: InputSlot=Tray1"
+*FoomaticRIPOptionSetting InputSlot=Tray1: "-s1 "
+*InputSlot Manual/Manual Feed: "%% FoomaticRIPOptionSetting: InputSlot=Manual"
+*FoomaticRIPOptionSetting InputSlot=Manual: "-s2 "
+*CloseUI: *InputSlot
+
+*OpenUI *MediaType/Media Type: PickOne
+*FoomaticRIPOption MediaType: enum CmdLine A
+*OrderDependency: 150 AnySetup *MediaType
+*DefaultMediaType: PlainAndRecycled
+*MediaType PlainAndRecycled/PlainAndRecycled: "%% FoomaticRIPOptionSetting: MediaType=PlainAndRecycled"
+*FoomaticRIPOptionSetting MediaType=PlainAndRecycled: "-m1 "
+*MediaType Paper/Plain: "%% FoomaticRIPOptionSetting: MediaType=Paper"
+*FoomaticRIPOptionSetting MediaType=Paper: "-m2 "
+*MediaType Recycled/Recycled: "%% FoomaticRIPOptionSetting: MediaType=Recycled"
+*FoomaticRIPOptionSetting MediaType=Recycled: "-m5 "
+*MediaType Thick1/Thick 1: "%% FoomaticRIPOptionSetting: MediaType=Thick1"
+*FoomaticRIPOptionSetting MediaType=Thick1: "-m4 "
+*MediaType Thin/Thin: "%% FoomaticRIPOptionSetting: MediaType=Thin"
+*FoomaticRIPOptionSetting MediaType=Thin: "-m3 "
+*CloseUI: *MediaType
+
+*OpenUI *Copies/Copies: PickOne
+*FoomaticRIPOption Copies: int CmdLine A
+*FoomaticRIPOptionPrototype Copies: "-n%s "
+*FoomaticRIPOptionRange Copies: 1 100
+*OrderDependency: 220 AnySetup *Copies
+*DefaultCopies: 1
+*FoomaticRIPDefaultCopies: 1
+*Copies 1/1: "%% FoomaticRIPOptionSetting: Copies=1"
+*Copies 2/2: "%% FoomaticRIPOptionSetting: Copies=2"
+*Copies 3/3: "%% FoomaticRIPOptionSetting: Copies=3"
+*Copies 4/4: "%% FoomaticRIPOptionSetting: Copies=4"
+*Copies 5/5: "%% FoomaticRIPOptionSetting: Copies=5"
+*Copies 6/6: "%% FoomaticRIPOptionSetting: Copies=6"
+*Copies 7/7: "%% FoomaticRIPOptionSetting: Copies=7"
+*Copies 8/8: "%% FoomaticRIPOptionSetting: Copies=8"
+*Copies 9/9: "%% FoomaticRIPOptionSetting: Copies=9"
+*Copies 10/10: "%% FoomaticRIPOptionSetting: Copies=10"
+*Copies 11/11: "%% FoomaticRIPOptionSetting: Copies=11"
+*Copies 12/12: "%% FoomaticRIPOptionSetting: Copies=12"
+*Copies 13/13: "%% FoomaticRIPOptionSetting: Copies=13"
+*Copies 14/14: "%% FoomaticRIPOptionSetting: Copies=14"
+*Copies 15/15: "%% FoomaticRIPOptionSetting: Copies=15"
+*Copies 16/16: "%% FoomaticRIPOptionSetting: Copies=16"
+*Copies 17/17: "%% FoomaticRIPOptionSetting: Copies=17"
+*Copies 18/18: "%% FoomaticRIPOptionSetting: Copies=18"
+*Copies 19/19: "%% FoomaticRIPOptionSetting: Copies=19"
+*Copies 20/20: "%% FoomaticRIPOptionSetting: Copies=20"
+*Copies 21/21: "%% FoomaticRIPOptionSetting: Copies=21"
+*Copies 22/22: "%% FoomaticRIPOptionSetting: Copies=22"
+*Copies 23/23: "%% FoomaticRIPOptionSetting: Copies=23"
+*Copies 24/24: "%% FoomaticRIPOptionSetting: Copies=24"
+*Copies 25/25: "%% FoomaticRIPOptionSetting: Copies=25"
+*Copies 26/26: "%% FoomaticRIPOptionSetting: Copies=26"
+*Copies 27/27: "%% FoomaticRIPOptionSetting: Copies=27"
+*Copies 28/28: "%% FoomaticRIPOptionSetting: Copies=28"
+*Copies 29/29: "%% FoomaticRIPOptionSetting: Copies=29"
+*Copies 30/30: "%% FoomaticRIPOptionSetting: Copies=30"
+*Copies 31/31: "%% FoomaticRIPOptionSetting: Copies=31"
+*Copies 32/32: "%% FoomaticRIPOptionSetting: Copies=32"
+*Copies 33/33: "%% FoomaticRIPOptionSetting: Copies=33"
+*Copies 34/34: "%% FoomaticRIPOptionSetting: Copies=34"
+*Copies 35/35: "%% FoomaticRIPOptionSetting: Copies=35"
+*Copies 36/36: "%% FoomaticRIPOptionSetting: Copies=36"
+*Copies 37/37: "%% FoomaticRIPOptionSetting: Copies=37"
+*Copies 38/38: "%% FoomaticRIPOptionSetting: Copies=38"
+*Copies 39/39: "%% FoomaticRIPOptionSetting: Copies=39"
+*Copies 40/40: "%% FoomaticRIPOptionSetting: Copies=40"
+*Copies 41/41: "%% FoomaticRIPOptionSetting: Copies=41"
+*Copies 42/42: "%% FoomaticRIPOptionSetting: Copies=42"
+*Copies 43/43: "%% FoomaticRIPOptionSetting: Copies=43"
+*Copies 44/44: "%% FoomaticRIPOptionSetting: Copies=44"
+*Copies 45/45: "%% FoomaticRIPOptionSetting: Copies=45"
+*Copies 46/46: "%% FoomaticRIPOptionSetting: Copies=46"
+*Copies 47/47: "%% FoomaticRIPOptionSetting: Copies=47"
+*Copies 48/48: "%% FoomaticRIPOptionSetting: Copies=48"
+*Copies 49/49: "%% FoomaticRIPOptionSetting: Copies=49"
+*Copies 50/50: "%% FoomaticRIPOptionSetting: Copies=50"
+*Copies 51/51: "%% FoomaticRIPOptionSetting: Copies=51"
+*Copies 52/52: "%% FoomaticRIPOptionSetting: Copies=52"
+*Copies 53/53: "%% FoomaticRIPOptionSetting: Copies=53"
+*Copies 54/54: "%% FoomaticRIPOptionSetting: Copies=54"
+*Copies 55/55: "%% FoomaticRIPOptionSetting: Copies=55"
+*Copies 56/56: "%% FoomaticRIPOptionSetting: Copies=56"
+*Copies 57/57: "%% FoomaticRIPOptionSetting: Copies=57"
+*Copies 58/58: "%% FoomaticRIPOptionSetting: Copies=58"
+*Copies 59/59: "%% FoomaticRIPOptionSetting: Copies=59"
+*Copies 60/60: "%% FoomaticRIPOptionSetting: Copies=60"
+*Copies 61/61: "%% FoomaticRIPOptionSetting: Copies=61"
+*Copies 62/62: "%% FoomaticRIPOptionSetting: Copies=62"
+*Copies 63/63: "%% FoomaticRIPOptionSetting: Copies=63"
+*Copies 64/64: "%% FoomaticRIPOptionSetting: Copies=64"
+*Copies 65/65: "%% FoomaticRIPOptionSetting: Copies=65"
+*Copies 66/66: "%% FoomaticRIPOptionSetting: Copies=66"
+*Copies 67/67: "%% FoomaticRIPOptionSetting: Copies=67"
+*Copies 68/68: "%% FoomaticRIPOptionSetting: Copies=68"
+*Copies 69/69: "%% FoomaticRIPOptionSetting: Copies=69"
+*Copies 70/70: "%% FoomaticRIPOptionSetting: Copies=70"
+*Copies 71/71: "%% FoomaticRIPOptionSetting: Copies=71"
+*Copies 72/72: "%% FoomaticRIPOptionSetting: Copies=72"
+*Copies 73/73: "%% FoomaticRIPOptionSetting: Copies=73"
+*Copies 74/74: "%% FoomaticRIPOptionSetting: Copies=74"
+*Copies 75/75: "%% FoomaticRIPOptionSetting: Copies=75"
+*Copies 76/76: "%% FoomaticRIPOptionSetting: Copies=76"
+*Copies 77/77: "%% FoomaticRIPOptionSetting: Copies=77"
+*Copies 78/78: "%% FoomaticRIPOptionSetting: Copies=78"
+*Copies 79/79: "%% FoomaticRIPOptionSetting: Copies=79"
+*Copies 80/80: "%% FoomaticRIPOptionSetting: Copies=80"
+*Copies 81/81: "%% FoomaticRIPOptionSetting: Copies=81"
+*Copies 82/82: "%% FoomaticRIPOptionSetting: Copies=82"
+*Copies 83/83: "%% FoomaticRIPOptionSetting: Copies=83"
+*Copies 84/84: "%% FoomaticRIPOptionSetting: Copies=84"
+*Copies 85/85: "%% FoomaticRIPOptionSetting: Copies=85"
+*Copies 86/86: "%% FoomaticRIPOptionSetting: Copies=86"
+*Copies 87/87: "%% FoomaticRIPOptionSetting: Copies=87"
+*Copies 88/88: "%% FoomaticRIPOptionSetting: Copies=88"
+*Copies 89/89: "%% FoomaticRIPOptionSetting: Copies=89"
+*Copies 90/90: "%% FoomaticRIPOptionSetting: Copies=90"
+*Copies 91/91: "%% FoomaticRIPOptionSetting: Copies=91"
+*Copies 92/92: "%% FoomaticRIPOptionSetting: Copies=92"
+*Copies 93/93: "%% FoomaticRIPOptionSetting: Copies=93"
+*Copies 94/94: "%% FoomaticRIPOptionSetting: Copies=94"
+*Copies 95/95: "%% FoomaticRIPOptionSetting: Copies=95"
+*Copies 96/96: "%% FoomaticRIPOptionSetting: Copies=96"
+*Copies 97/97: "%% FoomaticRIPOptionSetting: Copies=97"
+*Copies 98/98: "%% FoomaticRIPOptionSetting: Copies=98"
+*Copies 99/99: "%% FoomaticRIPOptionSetting: Copies=99"
+*Copies 100/100: "%% FoomaticRIPOptionSetting: Copies=100"
+*CloseUI: *Copies
+
+*CloseGroup: General
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
diff --git a/PPD/Ricoh-SP_201Nw.ppd b/PPD/Ricoh-SP_201Nw.ppd
new file mode 100644
index 0000000..1c9e256
--- /dev/null
+++ b/PPD/Ricoh-SP_201Nw.ppd
@@ -0,0 +1,341 @@
+*PPD-Adobe: "4.3"
+*%
+*% For information on using this, and to obtain the required backend
+*% script, consult http://www.openprinting.org/
+*%
+*% This file is published under the GNU General Public License
+*%
+*% PPD-O-MATIC (3.0.0 or newer) generated this PPD file. It is for use with
+*% all programs and environments which use PPD files for dealing with
+*% printer capability information. The printer must be configured with the
+*% "foomatic-rip" backend filter script of Foomatic 3.0.0 or newer. This
+*% file and "foomatic-rip" work together to support PPD-controlled printer
+*% driver option access with arbitrary free software printer drivers and
+*% printing spoolers.
+*%
+*% To save this file on your disk, wait until the download has completed
+*% (the animation of the browser logo must stop) and then use the
+*% "Save as..." command in the "File" menu of your browser or in the
+*% pop-up manu when you click on this document with the right mouse button.
+*% DO NOT cut and paste this file into an editor with your mouse. This can
+*% introduce additional line breaks which lead to unexpected results.
+*%
+*% You may save this file as 'Ricoh-SP_201Nw-foo2ddst.ppd'
+*%
+*%
+*FormatVersion: "4.3"
+*FileVersion: "1.1"
+*LanguageVersion: English
+*LanguageEncoding: ISOLatin1
+*PCFileName: "FOO2DDST.PPD"
+*Manufacturer: "Ricoh"
+*Product: "(SP 201Nw)"
+*cupsVersion: 1.0
+*cupsManualCopies: True
+*cupsModelNumber: 2
+*cupsFilter: "application/vnd.cups-postscript 0 foomatic-rip"
+*%pprRIP: foomatic-rip other
+*ModelName: "Ricoh SP 201Nw"
+*ShortNickName: "Ricoh SP 201Nw foo2ddst"
+*NickName: "Ricoh SP 201Nw Foomatic/foo2ddst (recommended)"
+*PSVersion: "(3010.000) 550"
+*PSVersion: "(3010.000) 651"
+*PSVersion: "(3010.000) 652"
+*PSVersion: "(3010.000) 653"
+*PSVersion: "(3010.000) 704"
+*PSVersion: "(3010.000) 705"
+*PSVersion: "(3010.000) 800"
+*LanguageLevel: "3"
+*ColorDevice: False
+*DefaultColorSpace: Gray
+*FileSystem: False
+*Throughput: "1"
+*LandscapeOrientation: Plus90
+*TTRasterizer: Type42
+*1284DeviceID: "DRV:Dfoo2ddst,R1,M0,TF;"
+
+*driverName foo2ddst/foo2ddst: ""
+*driverType F/Filter: ""
+*driverUrl: "http://foo2ddst.rkkda.com/"
+*driverObsolete: False
+
+
+
+
+*HWMargins: 14.40 14.40 14.4 14.4
+*VariablePaperSize: True
+*MaxMediaWidth: 100000
+*MaxMediaHeight: 100000
+*NonUIOrderDependency: 135 AnySetup *CustomPageSize
+*CustomPageSize True: "pop pop pop pop pop
+%% FoomaticRIPOptionSetting: PageSize=Custom"
+*End
+*FoomaticRIPOptionSetting PageSize=Custom: "-pCustom.%0x%1 "
+*ParamCustomPageSize Width: 1 points 36 100000
+*ParamCustomPageSize Height: 2 points 36 100000
+*ParamCustomPageSize Orientation: 3 int 0 0
+*ParamCustomPageSize WidthOffset: 4 points 0 0
+*ParamCustomPageSize HeightOffset: 5 points 0 0
+
+*FoomaticIDs: Ricoh-SP_201Nw foo2ddst
+*FoomaticRIPCommandLine: "foo2ddst-wrapper %A"
+
+*OpenGroup: General/General
+
+*OpenUI *Resolution/Resolution: PickOne
+*FoomaticRIPOption Resolution: enum CmdLine A
+*OrderDependency: 130 AnySetup *Resolution
+*DefaultResolution: 600x600dpi
+*Resolution 600x600dpi/600x600 dpi: "%% FoomaticRIPOptionSetting: Resolution=600x600dpi"
+*FoomaticRIPOptionSetting Resolution=600x600dpi: "-r600x600 "
+*Resolution 1200x600dpi/1200x600 dpi: "%% FoomaticRIPOptionSetting: Resolution=1200x600dpi"
+*FoomaticRIPOptionSetting Resolution=1200x600dpi: "-r1200x600 "
+*CloseUI: *Resolution
+
+*OpenUI *PageSize/Page Size: PickOne
+*FoomaticRIPOption PageSize: enum CmdLine A
+*OrderDependency: 135 AnySetup *PageSize
+*DefaultPageSize: Letter
+*PageSize Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*FoomaticRIPOptionSetting PageSize=Letter: "-p1 "
+*PageSize A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*FoomaticRIPOptionSetting PageSize=A4: "-p5 "
+*PageSize A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5"
+*FoomaticRIPOptionSetting PageSize=A5: "-p6 "
+*PageSize A7/A7: "%% FoomaticRIPOptionSetting: PageSize=A7"
+*FoomaticRIPOptionSetting PageSize=A7: "-p7 "
+*PageSize B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*FoomaticRIPOptionSetting PageSize=B5jis: "-p8 "
+*PageSize B6jis/B6 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B6jis"
+*FoomaticRIPOptionSetting PageSize=B6jis: "-p9 "
+*PageSize Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*FoomaticRIPOptionSetting PageSize=Executive: "-p3 "
+*PageSize Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*FoomaticRIPOptionSetting PageSize=Legal: "-p2 "
+*PageSize w522h737/16k 184x260: "%% FoomaticRIPOptionSetting: PageSize=w522h737"
+*FoomaticRIPOptionSetting PageSize=w522h737: "-p11 "
+*PageSize w553h765/16k 195x270: "%% FoomaticRIPOptionSetting: PageSize=w553h765"
+*FoomaticRIPOptionSetting PageSize=w553h765: "-p12 "
+*PageSize w558h774/16k 197x273: "%% FoomaticRIPOptionSetting: PageSize=w558h774"
+*FoomaticRIPOptionSetting PageSize=w558h774: "-p10 "
+*CloseUI: *PageSize
+
+*OpenUI *PageRegion: PickOne
+*OrderDependency: 135 AnySetup *PageRegion
+*DefaultPageRegion: Letter
+*PageRegion Letter/Letter: "%% FoomaticRIPOptionSetting: PageSize=Letter"
+*PageRegion A4/A4: "%% FoomaticRIPOptionSetting: PageSize=A4"
+*PageRegion A5/A5: "%% FoomaticRIPOptionSetting: PageSize=A5"
+*PageRegion A7/A7: "%% FoomaticRIPOptionSetting: PageSize=A7"
+*PageRegion B5jis/B5 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B5jis"
+*PageRegion B6jis/B6 (JIS): "%% FoomaticRIPOptionSetting: PageSize=B6jis"
+*PageRegion Executive/Executive: "%% FoomaticRIPOptionSetting: PageSize=Executive"
+*PageRegion Legal/Legal: "%% FoomaticRIPOptionSetting: PageSize=Legal"
+*PageRegion w522h737/16k 184x260: "%% FoomaticRIPOptionSetting: PageSize=w522h737"
+*PageRegion w553h765/16k 195x270: "%% FoomaticRIPOptionSetting: PageSize=w553h765"
+*PageRegion w558h774/16k 197x273: "%% FoomaticRIPOptionSetting: PageSize=w558h774"
+*CloseUI: *PageRegion
+
+*DefaultImageableArea: Letter
+*ImageableArea Letter/Letter: "14.40 14.40 597.60 777.60"
+*ImageableArea A4/A4: "14.40 14.40 580.60 827.60"
+*ImageableArea A5/A5: "14.40 14.40 405.60 580.60"
+*ImageableArea A7/A7: "14.40 14.40 195.60 282.60"
+*ImageableArea B5jis/B5 (JIS): "14.40 14.40 503.60 712.60"
+*ImageableArea B6jis/B6 (JIS): "14.40 14.40 347.60 503.60"
+*ImageableArea Executive/Executive: "14.40 14.40 507.60 741.60"
+*ImageableArea Legal/Legal: "14.40 14.40 597.60 993.60"
+*ImageableArea w522h737/16k 184x260: "14.40 14.40 507.60 722.60"
+*ImageableArea w553h765/16k 195x270: "14.40 14.40 538.60 750.60"
+*ImageableArea w558h774/16k 197x273: "14.40 14.40 543.60 759.60"
+
+*DefaultPaperDimension: Letter
+*PaperDimension Letter/Letter: "612 792"
+*PaperDimension A4/A4: "595 842"
+*PaperDimension A5/A5: "420 595"
+*PaperDimension A7/A7: "210 297"
+*PaperDimension B5jis/B5 (JIS): "518 727"
+*PaperDimension B6jis/B6 (JIS): "362 518"
+*PaperDimension Executive/Executive: "522 756"
+*PaperDimension Legal/Legal: "612 1008"
+*PaperDimension w522h737/16k 184x260: "522 737"
+*PaperDimension w553h765/16k 195x270: "553 765"
+*PaperDimension w558h774/16k 197x273: "558 774"
+
+*OpenUI *InputSlot/Media Source: PickOne
+*FoomaticRIPOption InputSlot: enum CmdLine A
+*OrderDependency: 150 AnySetup *InputSlot
+*DefaultInputSlot: Tray1
+*InputSlot Tray1/Tray 1: "%% FoomaticRIPOptionSetting: InputSlot=Tray1"
+*FoomaticRIPOptionSetting InputSlot=Tray1: "-s1 "
+*InputSlot Manual/Manual Feed: "%% FoomaticRIPOptionSetting: InputSlot=Manual"
+*FoomaticRIPOptionSetting InputSlot=Manual: "-s2 "
+*CloseUI: *InputSlot
+
+*OpenUI *MediaType/Media Type: PickOne
+*FoomaticRIPOption MediaType: enum CmdLine A
+*OrderDependency: 150 AnySetup *MediaType
+*DefaultMediaType: PlainAndRecycled
+*MediaType PlainAndRecycled/PlainAndRecycled: "%% FoomaticRIPOptionSetting: MediaType=PlainAndRecycled"
+*FoomaticRIPOptionSetting MediaType=PlainAndRecycled: "-m1 "
+*MediaType Paper/Plain: "%% FoomaticRIPOptionSetting: MediaType=Paper"
+*FoomaticRIPOptionSetting MediaType=Paper: "-m2 "
+*MediaType Recycled/Recycled: "%% FoomaticRIPOptionSetting: MediaType=Recycled"
+*FoomaticRIPOptionSetting MediaType=Recycled: "-m5 "
+*MediaType Thick1/Thick 1: "%% FoomaticRIPOptionSetting: MediaType=Thick1"
+*FoomaticRIPOptionSetting MediaType=Thick1: "-m4 "
+*MediaType Thin/Thin: "%% FoomaticRIPOptionSetting: MediaType=Thin"
+*FoomaticRIPOptionSetting MediaType=Thin: "-m3 "
+*CloseUI: *MediaType
+
+*OpenUI *Copies/Copies: PickOne
+*FoomaticRIPOption Copies: int CmdLine A
+*FoomaticRIPOptionPrototype Copies: "-n%s "
+*FoomaticRIPOptionRange Copies: 1 100
+*OrderDependency: 220 AnySetup *Copies
+*DefaultCopies: 1
+*FoomaticRIPDefaultCopies: 1
+*Copies 1/1: "%% FoomaticRIPOptionSetting: Copies=1"
+*Copies 2/2: "%% FoomaticRIPOptionSetting: Copies=2"
+*Copies 3/3: "%% FoomaticRIPOptionSetting: Copies=3"
+*Copies 4/4: "%% FoomaticRIPOptionSetting: Copies=4"
+*Copies 5/5: "%% FoomaticRIPOptionSetting: Copies=5"
+*Copies 6/6: "%% FoomaticRIPOptionSetting: Copies=6"
+*Copies 7/7: "%% FoomaticRIPOptionSetting: Copies=7"
+*Copies 8/8: "%% FoomaticRIPOptionSetting: Copies=8"
+*Copies 9/9: "%% FoomaticRIPOptionSetting: Copies=9"
+*Copies 10/10: "%% FoomaticRIPOptionSetting: Copies=10"
+*Copies 11/11: "%% FoomaticRIPOptionSetting: Copies=11"
+*Copies 12/12: "%% FoomaticRIPOptionSetting: Copies=12"
+*Copies 13/13: "%% FoomaticRIPOptionSetting: Copies=13"
+*Copies 14/14: "%% FoomaticRIPOptionSetting: Copies=14"
+*Copies 15/15: "%% FoomaticRIPOptionSetting: Copies=15"
+*Copies 16/16: "%% FoomaticRIPOptionSetting: Copies=16"
+*Copies 17/17: "%% FoomaticRIPOptionSetting: Copies=17"
+*Copies 18/18: "%% FoomaticRIPOptionSetting: Copies=18"
+*Copies 19/19: "%% FoomaticRIPOptionSetting: Copies=19"
+*Copies 20/20: "%% FoomaticRIPOptionSetting: Copies=20"
+*Copies 21/21: "%% FoomaticRIPOptionSetting: Copies=21"
+*Copies 22/22: "%% FoomaticRIPOptionSetting: Copies=22"
+*Copies 23/23: "%% FoomaticRIPOptionSetting: Copies=23"
+*Copies 24/24: "%% FoomaticRIPOptionSetting: Copies=24"
+*Copies 25/25: "%% FoomaticRIPOptionSetting: Copies=25"
+*Copies 26/26: "%% FoomaticRIPOptionSetting: Copies=26"
+*Copies 27/27: "%% FoomaticRIPOptionSetting: Copies=27"
+*Copies 28/28: "%% FoomaticRIPOptionSetting: Copies=28"
+*Copies 29/29: "%% FoomaticRIPOptionSetting: Copies=29"
+*Copies 30/30: "%% FoomaticRIPOptionSetting: Copies=30"
+*Copies 31/31: "%% FoomaticRIPOptionSetting: Copies=31"
+*Copies 32/32: "%% FoomaticRIPOptionSetting: Copies=32"
+*Copies 33/33: "%% FoomaticRIPOptionSetting: Copies=33"
+*Copies 34/34: "%% FoomaticRIPOptionSetting: Copies=34"
+*Copies 35/35: "%% FoomaticRIPOptionSetting: Copies=35"
+*Copies 36/36: "%% FoomaticRIPOptionSetting: Copies=36"
+*Copies 37/37: "%% FoomaticRIPOptionSetting: Copies=37"
+*Copies 38/38: "%% FoomaticRIPOptionSetting: Copies=38"
+*Copies 39/39: "%% FoomaticRIPOptionSetting: Copies=39"
+*Copies 40/40: "%% FoomaticRIPOptionSetting: Copies=40"
+*Copies 41/41: "%% FoomaticRIPOptionSetting: Copies=41"
+*Copies 42/42: "%% FoomaticRIPOptionSetting: Copies=42"
+*Copies 43/43: "%% FoomaticRIPOptionSetting: Copies=43"
+*Copies 44/44: "%% FoomaticRIPOptionSetting: Copies=44"
+*Copies 45/45: "%% FoomaticRIPOptionSetting: Copies=45"
+*Copies 46/46: "%% FoomaticRIPOptionSetting: Copies=46"
+*Copies 47/47: "%% FoomaticRIPOptionSetting: Copies=47"
+*Copies 48/48: "%% FoomaticRIPOptionSetting: Copies=48"
+*Copies 49/49: "%% FoomaticRIPOptionSetting: Copies=49"
+*Copies 50/50: "%% FoomaticRIPOptionSetting: Copies=50"
+*Copies 51/51: "%% FoomaticRIPOptionSetting: Copies=51"
+*Copies 52/52: "%% FoomaticRIPOptionSetting: Copies=52"
+*Copies 53/53: "%% FoomaticRIPOptionSetting: Copies=53"
+*Copies 54/54: "%% FoomaticRIPOptionSetting: Copies=54"
+*Copies 55/55: "%% FoomaticRIPOptionSetting: Copies=55"
+*Copies 56/56: "%% FoomaticRIPOptionSetting: Copies=56"
+*Copies 57/57: "%% FoomaticRIPOptionSetting: Copies=57"
+*Copies 58/58: "%% FoomaticRIPOptionSetting: Copies=58"
+*Copies 59/59: "%% FoomaticRIPOptionSetting: Copies=59"
+*Copies 60/60: "%% FoomaticRIPOptionSetting: Copies=60"
+*Copies 61/61: "%% FoomaticRIPOptionSetting: Copies=61"
+*Copies 62/62: "%% FoomaticRIPOptionSetting: Copies=62"
+*Copies 63/63: "%% FoomaticRIPOptionSetting: Copies=63"
+*Copies 64/64: "%% FoomaticRIPOptionSetting: Copies=64"
+*Copies 65/65: "%% FoomaticRIPOptionSetting: Copies=65"
+*Copies 66/66: "%% FoomaticRIPOptionSetting: Copies=66"
+*Copies 67/67: "%% FoomaticRIPOptionSetting: Copies=67"
+*Copies 68/68: "%% FoomaticRIPOptionSetting: Copies=68"
+*Copies 69/69: "%% FoomaticRIPOptionSetting: Copies=69"
+*Copies 70/70: "%% FoomaticRIPOptionSetting: Copies=70"
+*Copies 71/71: "%% FoomaticRIPOptionSetting: Copies=71"
+*Copies 72/72: "%% FoomaticRIPOptionSetting: Copies=72"
+*Copies 73/73: "%% FoomaticRIPOptionSetting: Copies=73"
+*Copies 74/74: "%% FoomaticRIPOptionSetting: Copies=74"
+*Copies 75/75: "%% FoomaticRIPOptionSetting: Copies=75"
+*Copies 76/76: "%% FoomaticRIPOptionSetting: Copies=76"
+*Copies 77/77: "%% FoomaticRIPOptionSetting: Copies=77"
+*Copies 78/78: "%% FoomaticRIPOptionSetting: Copies=78"
+*Copies 79/79: "%% FoomaticRIPOptionSetting: Copies=79"
+*Copies 80/80: "%% FoomaticRIPOptionSetting: Copies=80"
+*Copies 81/81: "%% FoomaticRIPOptionSetting: Copies=81"
+*Copies 82/82: "%% FoomaticRIPOptionSetting: Copies=82"
+*Copies 83/83: "%% FoomaticRIPOptionSetting: Copies=83"
+*Copies 84/84: "%% FoomaticRIPOptionSetting: Copies=84"
+*Copies 85/85: "%% FoomaticRIPOptionSetting: Copies=85"
+*Copies 86/86: "%% FoomaticRIPOptionSetting: Copies=86"
+*Copies 87/87: "%% FoomaticRIPOptionSetting: Copies=87"
+*Copies 88/88: "%% FoomaticRIPOptionSetting: Copies=88"
+*Copies 89/89: "%% FoomaticRIPOptionSetting: Copies=89"
+*Copies 90/90: "%% FoomaticRIPOptionSetting: Copies=90"
+*Copies 91/91: "%% FoomaticRIPOptionSetting: Copies=91"
+*Copies 92/92: "%% FoomaticRIPOptionSetting: Copies=92"
+*Copies 93/93: "%% FoomaticRIPOptionSetting: Copies=93"
+*Copies 94/94: "%% FoomaticRIPOptionSetting: Copies=94"
+*Copies 95/95: "%% FoomaticRIPOptionSetting: Copies=95"
+*Copies 96/96: "%% FoomaticRIPOptionSetting: Copies=96"
+*Copies 97/97: "%% FoomaticRIPOptionSetting: Copies=97"
+*Copies 98/98: "%% FoomaticRIPOptionSetting: Copies=98"
+*Copies 99/99: "%% FoomaticRIPOptionSetting: Copies=99"
+*Copies 100/100: "%% FoomaticRIPOptionSetting: Copies=100"
+*CloseUI: *Copies
+
+*CloseGroup: General
+
+
+*% Generic boilerplate PPD stuff as standard PostScript fonts and so on
+
+*DefaultFont: Courier
+*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM
+*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM
+*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM
+*Font Bookman-Demi: Standard "(001.004S)" Standard ROM
+*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM
+*Font Bookman-Light: Standard "(001.004S)" Standard ROM
+*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM
+*Font Courier: Standard "(002.004S)" Standard ROM
+*Font Courier-Bold: Standard "(002.004S)" Standard ROM
+*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM
+*Font Courier-Oblique: Standard "(002.004S)" Standard ROM
+*Font Helvetica: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM
+*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM
+*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM
+*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM
+*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM
+*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM
+*Font Palatino-Bold: Standard "(001.005S)" Standard ROM
+*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Italic: Standard "(001.005S)" Standard ROM
+*Font Palatino-Roman: Standard "(001.005S)" Standard ROM
+*Font Symbol: Special "(001.007S)" Special ROM
+*Font Times-Bold: Standard "(001.007S)" Standard ROM
+*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM
+*Font Times-Italic: Standard "(001.007S)" Standard ROM
+*Font Times-Roman: Standard "(001.007S)" Standard ROM
+*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM
+*Font ZapfDingbats: Special "(001.004S)" Standard ROM
+
diff --git a/ddst.h b/ddst.h
new file mode 100644
index 0000000..a7b97ee
--- /dev/null
+++ b/ddst.h
@@ -0,0 +1,224 @@
+/*
+ * Manifest constants for the ZjStream protocol
+ *
+ * I'm told that a lot of this stuff came from a file called "zjrca.h".
+ * But a Google search does not turn up that file. I added my own
+ * improvements and missing pieces. -Rick
+ */
+
+#include <inttypes.h>
+typedef uint32_t DWORD;
+typedef uint16_t WORD;
+typedef uint8_t BYTE;
+
+typedef enum {
+ XQX_START_DOC = 1,
+ XQX_END_DOC = 2,
+ XQX_START_PAGE = 3,
+ XQX_END_PAGE = 4,
+ XQX_START_PLANE = 5,
+ XQX_END_PLANE = 6,
+ XQX_JBIG = 7,
+
+ // XQX_2600N_PAUSE =11,
+ // XQX_2600N =12,
+} XQX_TYPE;
+
+typedef struct _XQX_HEADER {
+ DWORD type; /* ZJ_TYPE */
+ DWORD items; /* total record size, includes sizeof(ZJ_HEADER) */
+} XQX_HEADER;
+
+typedef enum {
+ XQXI_DMDUPLEX = 0x10000002, // from DEVMODE (DMBIN?)
+ XQXI_DMDEFAULTSOURCE= 0x20000006, // from DEVMODE (DMBIN?)
+ XQXI_DMMEDIATYPE = 0x20000000, // from DEVMODE
+ XQXI_RESOLUTION_X = 0x20000008, // dots per inch
+ XQXI_RESOLUTION_Y = 0x20000009,
+ XQXI_RASTER_X = 0x2000000d, // dots per inch
+ XQXI_RASTER_Y = 0x2000000e,
+ XQXI_VIDEO_BPP = 0x2000000a, // video bits per pixel
+ XQXI_VIDEO_X = 0x2000000f, // video dimensions
+ XQXI_VIDEO_Y = 0x20000010,
+ XQXI_ECONOMODE = 0x20000011, // HP's "EconoMode", 0=OFF, 1=ON
+ XQXI_DMPAPER = 0x20000001,
+ XQXI_DUPLEX_PAUSE = 0x20000012, // 0,1=front side; 2-3=back side
+ XQXI_BIH = 0x40000002,
+ XQXI_END = 0x80000001,
+
+ ZJI_LAST
+} XQX_ITEM;
+
+typedef enum
+{
+ DMDUPLEX_OFF = 1,
+ DMDUPLEX_LONGEDGE = 2,
+ DMDUPLEX_SHORTEDGE = 3,
+ DMDUPLEX_MANUALLONG = 4,
+ DMDUPLEX_MANUALSHORT= 5
+} DMDUPLEX;
+
+typedef enum {
+ DMBIN_TRAY1 = 1,
+ DMBIN_MANUAL = 4,
+ DMBIN_AUTO = 7,
+} DM_BIN;
+
+typedef enum {
+ DMMEDIA_UNSPECIFIED = 0, // Unspecified
+ DMMEDIA_PLAIN = 1, // Plain paper
+ DMMEDIA_HP_MULTIPURPOSE = 301,
+ DMMEDIA_HP_OFFICE = 300,
+ DMMEDIA_HP_ALL_IN_ONE = 303,
+ DMMEDIA_HP_LASERJET = 302,
+ DMMEDIA_HP_PREMIUM_LASERJET = 304,
+ DMMEDIA_PREPRINTED = 514,
+ DMMEDIA_LETTERHEAD = 513, // Letterhead
+ DMMEDIA_TRANSPARENCY = 2, // Transparency
+ DMMEDIA_PREPUNCHED = 515,
+ DMMEDIA_LABELS = 265, // Labels
+ DMMEDIA_BOND = 260,
+ DMMEDIA_RECYCLED = 516,
+ DMMEDIA_COLOR = 512,
+ DMMEDIA_LIGHT = 258,
+ DMMEDIA_HEAVY = 262,
+ DMMEDIA_CARDSTOCK = 261,
+ DMMEDIA_ENVELOPE = 267, // Envelope
+ DMMEDIA_ROUGH = 263,
+} DMMEDIA;
+
+typedef enum {
+ DMCOLOR_MONOCHROME = 1,
+ DMCOLOR_COLOR = 2,
+} DMCOLOR;
+
+typedef enum {
+ DMORIENT_PORTRAIT = 1,
+ DMORIENT_LANDSCAPE = 2,
+} DMORIENT;
+
+typedef enum {
+ DMPAPER_LETTER = 1, // Letter, 8 1/2- by 11-inches
+ DMPAPER_LETTERSMALL = 2, // Letter Small, 8 1/2- by 11-inches
+ DMPAPER_TABLOID = 3, // Tabloid, 11- by 17-inches
+ DMPAPER_LEDGER = 4, // Ledger, 17- by 11-inches
+ DMPAPER_LEGAL = 5, // Legal, 8 1/2- by 14-inches
+ DMPAPER_STATEMENT = 6, // Statement, 5 1/2- by 8 1/2-inches
+ DMPAPER_EXECUTIVE = 7, // Executive, 7 1/4- by 10 1/2-inches
+ DMPAPER_A3 = 8, // A3 sheet, 297- by 420-millimeters
+ DMPAPER_A4 = 9, // A4 Sheet, 210- by 297-millimeters
+ DMPAPER_A4SMALL =10, // A4 small sheet, 210- by 297-millimeters
+ DMPAPER_A5 =11, // A5 sheet, 148- by 210-millimeters
+ DMPAPER_B4 =12, // B4 sheet, 250- by 354-millimeters
+ DMPAPER_B5 =13, // B5 sheet, 182- by 257-millimeter paper
+ DMPAPER_FOLIO =14, // Folio, 8 1/2- by 13-inch paper
+ DMPAPER_QUARTO =15, // Quarto, 215- by 275-millimeter paper
+ DMPAPER_10X14 =16, // 10- by 14-inch sheet
+ DMPAPER_11X17 =17, // 11- by 17-inch sheet
+ DMPAPER_NOTE =18, // Note, 8 1/2- by 11-inches
+ DMPAPER_ENV_9 =19, // #9 Envelope, 3 7/8- by 8 7/8-inches
+ DMPAPER_ENV_10 =20, // #10 Envelope, 4 1/8- by 9 1/2-inches
+ DMPAPER_ENV_11 =21, // #11 Envelope, 4 1/2- by 10 3/8-inches
+ DMPAPER_ENV_12 =22, // #12 Envelope, 4 3/4- by 11-inches
+ DMPAPER_ENV_14 =23, // #14 Envelope, 5- by 11 1/2-inches
+ DMPAPER_CSHEET =24, // C Sheet, 17- by 22-inches
+ DMPAPER_DSHEET =25, // D Sheet, 22- by 34-inches
+ DMPAPER_ESHEET =26, // E Sheet, 34- by 44-inches
+ DMPAPER_ENV_DL =27, // DL Envelope, 110- by 220-millimeters
+ DMPAPER_ENV_C5 =28, // C5 Envelope, 162- by 229-millimeters
+ DMPAPER_ENV_C3 =29, // C3 Envelope, 324- by 458-millimeters
+ DMPAPER_ENV_C4 =30, // C4 Envelope, 229- by 324-millimeters
+ DMPAPER_ENV_C6 =31, // C6 Envelope, 114- by 162-millimeters
+ DMPAPER_ENV_C65 =32, // C65 Envelope, 114- by 229-millimeters
+ DMPAPER_ENV_B4 =33, // B4 Envelope, 250- by 353-millimeters
+ DMPAPER_ENV_B5 =34, // B5 Envelope, 176- by 250-millimeters
+ DMPAPER_ENV_B6 =35, // B6 Envelope, 176- by 125-millimeters
+ DMPAPER_ENV_ITALY =36, // Italy Envelope, 110- by 230-millimeters
+ DMPAPER_ENV_MONARCH =37, // Monarch Envelope, 3 7/8- by 7 1/2-inches
+ DMPAPER_ENV_PERSONAL=38, // 6 3/4 Envelope, 3 5/8- by 6 1/2-inches
+ DMPAPER_FANFOLD_US =39, // US Std Fanfold, 14 7/8- by 11-inches
+ DMPAPER_FANFOLD_STD_GERMAN =40, // German Std Fanfold, 8 1/2 x 12 in
+ DMPAPER_FANFOLD_LGL_GERMAN =41, // German Legal Fanfold, 8 1/2 x 13 in
+
+ DMPAPER_ISO_B4 =42, // B4 (ISO) 250 x 353 mm
+ DMPAPER_JAPANESE_POSTCARD =43, // Japanese Postcard 100 x 148 mm
+ DMPAPER_9X11 =44, // 9 x 11 in
+ DMPAPER_10X11 =45, // 10 x 11 in
+ DMPAPER_15X11 =46, // 15 x 11 in
+ DMPAPER_ENV_INVITE =47, // Envelope Invite 220 x 220 mm
+ DMPAPER_RESERVED_48 =48, // RESERVED--DO NOT USE
+ DMPAPER_RESERVED_49 =49, // RESERVED--DO NOT USE
+ DMPAPER_LETTER_EXTRA =50, // Letter Extra 9 \275 x 12 in
+ DMPAPER_LEGAL_EXTRA =51, // Legal Extra 9 \275 x 15 in
+ DMPAPER_TABLOID_EXTRA =52, // Tabloid Extra 11.69 x 18 in
+ DMPAPER_A4_EXTRA =53, // A4 Extra 9.27 x 12.69 in
+ DMPAPER_LETTER_TRANSVERSE =54, // Letter Transverse 8 \275 x 11 in
+ DMPAPER_A4_TRANSVERSE =55, // A4 Transverse 210 x 297 mm
+ DMPAPER_LETTER_EXTRA_TRANSVERSE=56, // Letter Extra Transverse 9\275 x 12 in
+ DMPAPER_A_PLUS =57, // SuperA/SuperA/A4 227 x 356 mm
+ DMPAPER_B_PLUS =58, // SuperB/SuperB/A3 305 x 487 mm
+ DMPAPER_LETTER_PLUS =59, // Letter Plus 8.5 x 12.69 in
+ DMPAPER_A4_PLUS =60, // A4 Plus 210 x 330 mm
+ DMPAPER_A5_TRANSVERSE =61, // A5 Transverse 148 x 210 mm
+ DMPAPER_B5_TRANSVERSE =62, // B5 (JIS) Transverse 182 x 257 mm
+ DMPAPER_A3_EXTRA =63, // A3 Extra 322 x 445 mm
+ DMPAPER_A5_EXTRA =64, // A5 Extra 174 x 235 mm
+ DMPAPER_B5_EXTRA =65, // B5 (ISO) Extra 201 x 276 mm
+ DMPAPER_A2 =66, // A2 420 x 594 mm
+ DMPAPER_A3_TRANSVERSE =67, // A3 Transverse 297 x 420 mm
+ DMPAPER_A3_EXTRA_TRANSVERSE =68, // A3 Extra Transverse 322 x 445 mm
+} DMPAPER;
+
+typedef struct _XQX_ITEM_HEADER {
+ DWORD type; // type
+ DWORD size; // total record size following
+} XQX_ITEM_HEADER;
+
+typedef struct _XQX_ITEM_UINT32 {
+ XQX_ITEM_HEADER header;
+ DWORD value;
+} XQX_ITEM_UINT32;
+
+typedef union _SWAP_32{
+ char byte[sizeof(uint32_t)];
+ uint32_t dword;
+} SWAP_32;
+
+typedef union _SWAP_16{
+ char byte[sizeof(uint16_t)];
+ uint16_t word;
+} SWAP_16;
+
+static inline uint32_t
+be32(uint32_t dword)
+{
+ SWAP_32 swap;
+ uint32_t probe = 1;
+
+ if (((char *)&probe)[0] == 1)
+ {
+ swap.byte[3] = (( SWAP_32 )dword).byte[0];
+ swap.byte[2] = (( SWAP_32 )dword).byte[1];
+ swap.byte[1] = (( SWAP_32 )dword).byte[2];
+ swap.byte[0] = (( SWAP_32 )dword).byte[3];
+ return swap.dword;
+ }
+ else
+ return dword;
+}
+
+static inline uint16_t
+be16(uint16_t word)
+{
+ SWAP_16 swap;
+ uint16_t probe = 1;
+
+ if (((char *)&probe)[0] == 1)
+ {
+ swap.byte[1] = (( SWAP_16 )word).byte[0];
+ swap.byte[0] = (( SWAP_16 )word).byte[1];
+ return swap.word;
+ }
+ else
+ return word;
+}
diff --git a/ddstdecode.1in b/ddstdecode.1in
new file mode 100644
index 0000000..2b1fb30
--- /dev/null
+++ b/ddstdecode.1in
@@ -0,0 +1,84 @@
+.TH ddstdecode 1 "${MODpage}" "ddstdecode ${MODver}"
+#ifndef OLDGROFF
+#include "macros.man"
+#endif
+'\"==========================================================================
+'\" MANUAL PAGE SOURCE
+'\"==========================================================================
+.SH NAME
+ddstdecode \- Decode a Ricoh DDST stream into human readable form.
+.SH SYNOPSIS
+.B ddstdecode
+.RI [ options "] <" ddst-file
+.SH DESCRIPTION
+.B ddstdecode
+decodes a Ricoh DDST stream into human readable form.
+.P
+A Ricoh DDST stream is the printer language used by some Ricoh
+printers. From what I can tell, it is pbmtojbg(1) wrapped with some PJL.
+
+.SH COMMAND LINE OPTIONS
+These are the options that can appear on the command line.
+.TP
+.BI \-d\0 basename
+Basename of .pbm file for saving decompressed planes.
+.TP
+.BI \-h
+Print hex file offsets.
+.TP
+.BI \-o
+Print file offsets.
+.TP
+.BI \-D\0 level
+Set Debug level [0].
+
+.SH EXAMPLES
+Decode an Ricoh DDST stream file created by a Ricoh SP112.
+
+.nf
+.ft CW
+$ ddstdecode -h ~/testpage-ricoh-sp112.prn
+ 0: \033%-12345X@PJL
+ f: @PJL SET TIMESTAMP=2017/03/16 16:53:16
+ 37: @PJL SET FILENAME=testpage.pdf
+ 57: @PJL SET COMPRESS=JBIG
+ 6f: @PJL SET USERNAME=rick
+ 87: @PJL SET COVER=OFF
+ 9b: @PJL SET HOLD=OFF
+ ae: @PJL SET PAGESTATUS=START
+ c9: @PJL SET COPIES=1
+ dc: @PJL SET MEDIASOURCE=TRAY1
+ f8: @PJL SET MEDIATYPE=PLAINRECYCLE
+ 119: @PJL SET PAPER=LETTER
+ 130: @PJL SET PAPERWIDTH=5100
+ 14a: @PJL SET PAPERLENGTH=6600
+ 165: @PJL SET RESOLUTION=600
+ 17e: @PJL SET IMAGELEN=60604
+ 197: DDST_JBIG_DATA_BEGIN 60604 bytes
+ DL = 0, D = 0, P = 1, - = 0, XY = 5100 x 6600
+ L0 = 128, MX = 0, MY = 0
+ Order = 3 ILEAVE SMID
+ Options = 72 LRLTWO TPBON
+ 52 stripes, 0 layers, 1 planes
+ ee53: DDST_JBIG_DATA_END
+ ee53: @PJL SET DOTCOUNT=1765571
+ ee6e: @PJL SET PAGESTATUS=END
+ ee87: @PJL EOJ
+ ee91: \033%-12345X
+.ft P
+.fi
+
+.SH FILES
+.BR /usr/bin/ddstdecode
+.SH SEE ALSO
+.BR foo2ddst-wrapper (1),
+.BR foo2ddst (1),
+.BR pbmtojbg (1)
+.SH "AUTHOR"
+Rick Richardson <rick.richardson@comcast.net>
+.br
+${URLXQX}/
+'\"
+'\"
+'\"
+.em pdf_outline
diff --git a/ddstdecode.c b/ddstdecode.c
new file mode 100644
index 0000000..651ec37
--- /dev/null
+++ b/ddstdecode.c
@@ -0,0 +1,540 @@
+/*
+ * $Id: ddstdecode.c,v 1.7 2017/03/25 15:01:32 rick Exp $
+ */
+
+/*b
+ * Copyright (C) 2003-2006 Rick Richardson
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Rick Richardson <rick.richardson@comcast.net>
+b*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include "ddst.h"
+#include "jbig.h"
+
+/*
+ * Global option flags
+ */
+int Debug = 0;
+char *DecFile;
+int PrintOffset = 0;
+int PrintHexOffset = 0;
+
+void
+debug(int level, char *fmt, ...)
+{
+ va_list ap;
+
+ if (Debug < level)
+ return;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+}
+
+int
+error(int fatal, char *fmt, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, fatal ? "Error: " : "Warning: ");
+ if (errno)
+ fprintf(stderr, "%s: ", strerror(errno));
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ if (fatal > 0)
+ exit(fatal);
+ else
+ {
+ errno = 0;
+ return (fatal);
+ }
+}
+
+void
+usage(void)
+{
+ fprintf(stderr,
+"Usage:\n"
+" ddstdecode [options] < zjs-file\n"
+"\n"
+" Decode a Ricoh DDST stream into human readable form.\n"
+"\n"
+" A Ricoh DDST stream is the printer language used by some Ricoh\n"
+" printers. From what I can tell, it is pbmtojbg wrapped with some PJL.\n"
+"\n"
+"\n"
+"Options:\n"
+" -d basename Basename of .pbm file for saving decompressed planes\n"
+" -o Print file offsets\n"
+" -h Print hex file offsets\n"
+" -D lvl Set Debug level [%d]\n"
+ , Debug
+ );
+
+ exit(1);
+}
+
+void
+print_bih(unsigned char bih[20])
+{
+ unsigned int xd, yd, l0;
+
+ xd = (bih[4] << 24) | (bih[5] << 16) | (bih[6] << 8) | (bih[7] << 0);
+ yd = (bih[8] << 24) | (bih[9] << 16) | (bih[10] << 8) | (bih[11] << 0);
+ l0 = (bih[12] << 24) | (bih[13] << 16) | (bih[14] << 8) | (bih[15] << 0);
+
+ printf(" DL = %d, D = %d, P = %d, - = %d, XY = %d x %d\n",
+ bih[0], bih[1], bih[2], bih[3], xd, yd);
+
+ printf(" L0 = %d, MX = %d, MY = %d\n",
+ l0, bih[16], bih[17]);
+
+ printf(" Order = %d %s%s%s%s%s\n", bih[18],
+ bih[18] & JBG_HITOLO ? " HITOLO" : "",
+ bih[18] & JBG_SEQ ? " SEQ" : "",
+ bih[18] & JBG_ILEAVE ? " ILEAVE" : "",
+ bih[18] & JBG_SMID ? " SMID" : "",
+ bih[18] & 0xf0 ? " other" : "");
+
+ printf(" Options = %d %s%s%s%s%s%s%s%s\n", bih[19],
+ bih[19] & JBG_LRLTWO ? " LRLTWO" : "",
+ bih[19] & JBG_VLENGTH ? " VLENGTH" : "",
+ bih[19] & JBG_TPDON ? " TPDON" : "",
+ bih[19] & JBG_TPBON ? " TPBON" : "",
+ bih[19] & JBG_DPON ? " DPON" : "",
+ bih[19] & JBG_DPPRIV ? " DPPRIV" : "",
+ bih[19] & JBG_DPLAST ? " DPLAST" : "",
+ bih[19] & 0x80 ? " other" : "");
+ printf(" %u stripes, %d layers, %d planes\n",
+ ((yd >> bih[1]) + ((((1UL << bih[1]) - 1) & xd) != 0) + l0 - 1) / l0,
+ bih[1] - bih[0], bih[2]);
+}
+
+void
+proff(int curOff)
+{
+ if (PrintOffset)
+ printf("%d: ", curOff);
+ else if (PrintHexOffset)
+ printf("%6x: ", curOff);
+}
+
+int curOff = 0;
+int pageNum = 0;
+
+void
+decode(FILE *fp)
+{
+ DWORD magic;
+ XQX_HEADER hdr;
+ int c;
+ int rc;
+ int i;
+ char *codestr;
+ FILE *dfp = NULL;
+ int planeNum = 4;
+ int len;
+ struct jbg_dec_state s[5];
+ unsigned char bih[20];
+ int bihlen = 0;
+ int imageCnt[5] = {0,0,0,0,0};
+ int pn = 0;
+ int incrY = 0;
+ int totSize = 0;
+ int imagelen = 0;
+ int startPagestatus = 0;
+
+ /*
+ * <unknown> XQX format
+ */
+ c = getc(fp);
+ if (c == EOF)
+ {
+ printf("EOF on file reading header.\n");
+ return;
+ }
+ ungetc(c, fp);
+ if (c == '\033' || c == '@')
+ {
+ char buf[1024];
+
+ while (fgets(buf, sizeof(buf), fp))
+ {
+ proff(curOff);
+ if (buf[0] == '\033')
+ {
+ printf("\\033");
+ fputs(buf+1, stdout);
+ }
+ else
+ fputs(buf, stdout);
+ curOff += strlen(buf);
+ if (0) {}
+ else if (strncmp(buf, "@PJL SET PAGESTATUS=START", 23) == 0)
+ {
+ startPagestatus = 2;
+ ++pageNum;
+ }
+ else if (strncmp(buf, "@PJL SET PAGESTATUS=END", 21) == 0)
+ {
+ startPagestatus = 0;
+ }
+ else if (strncmp(buf, "@PJL SET IMAGELEN=", 18) == 0)
+ {
+ imagelen = atoi(&buf[18]);
+ debug(2, "imagelen=%d\n", imagelen);
+ break;
+ proff(curOff);
+ buf[51] = 0;
+ printf("%s\n", buf);
+ curOff += 43;
+ proff(curOff);
+ printf("\\033%s\n", buf+44);
+ curOff += 9;
+ break;
+ }
+ }
+ if (feof(fp))
+ return;
+ }
+
+ proff(curOff);
+ printf("DDST_JBIG_DATA_BEGIN %d bytes\n", imagelen);
+ for (i = 0; i < imagelen; )
+ {
+ unsigned char buf[4024*1024];
+//printf("fread\n");
+ rc = fread(buf, 1, imagelen, fp);
+ if (i == 0 && startPagestatus == 2)
+ {
+ memcpy(bih, buf, bihlen = 20);
+//printf("data: %x\n", buf[3]);
+ if (DecFile && startPagestatus == 2)
+ {
+ size_t cnt;
+
+ startPagestatus = 1;
+ jbg_dec_init(&s[pn]);
+ rc = jbg_dec_in(&s[pn], bih, bihlen, &cnt);
+ if (rc == JBG_EIMPL)
+ error(1, "JBIG uses unimplemented feature\n");
+ }
+ print_bih(bih);
+ }
+ i += rc;
+ curOff += rc;
+rc = 0;
+ if (rc == 0)
+ {
+ debug(1, "imagelen = %d startPagestatus = %d\n",
+ imagelen, startPagestatus);
+ for (i = 0; i < imagelen; ++i)
+ {
+//printf("data: %x\n", buf[3]);
+ c = buf[i];
+ if (DecFile)
+ {
+ size_t cnt;
+ unsigned char ch = c;
+
+ rc = JBG_EAGAIN;
+ rc = jbg_dec_in(&s[pn], &ch, 1, &cnt);
+//printf("in: rc=%d ch=%x cnt=%ld\n", rc, ch, cnt);
+ if (rc == JBG_EOK)
+ {
+ int h, w, len;
+ unsigned char *image;
+
+//printf("JBG_OK!\n");
+ // debug(0, "JBG_EOK: %d\n", pn);
+ h = jbg_dec_getheight(&s[pn]);
+ w = jbg_dec_getwidth(&s[pn]);
+ image = jbg_dec_getimage(&s[pn], 0);
+ len = jbg_dec_getsize(&s[pn]);
+ //debug(0, "OK image len = %d\n", len);
+ if (image)
+ {
+ char buf[512];
+ sprintf(buf, "%s-%02d-%d.pbm",
+ DecFile, pageNum, planeNum);
+ dfp = fopen(buf,
+ imageCnt[planeNum] ? "a" : "w");
+ if (dfp)
+ {
+ if (imageCnt[planeNum] == 0)
+ fprintf(dfp, "P4\n%8d %8d\n", w, h);
+ imageCnt[planeNum] += incrY;
+ rc = fwrite(image, 1, len, dfp);
+ fclose(dfp);
+ }
+ }
+ else
+ debug(0, "Missing image %dx%d!\n", h, w);
+ jbg_dec_free(&s[pn]);
+ }
+ }
+ }
+ break;
+ }
+ }
+ proff(curOff);
+ printf("DDST_JBIG_DATA_END\n");
+ return;
+
+ /*
+ * ??? XQX_MAGIC format
+ */
+ rc = fread(&magic, len = sizeof(magic), 1, fp);
+ if (rc != 1)
+ {
+ printf("Missing XQX Magic number\n");
+ return;
+ }
+
+ proff(curOff);
+ printf("XQX_MAGIC, 0x%lx (%.4s)\n", (long)magic, (char *) &magic);
+
+ if (memcmp((char *) &magic, ",XQX", 4))
+ {
+ printf(" Don't understand magic number 0x%lx\n", (long)magic);
+ return;
+ }
+
+ curOff += len;
+ for (;;)
+ {
+ proff(curOff);
+
+ rc = fread(&hdr, len = sizeof(hdr), 1, fp);
+ if (rc != 1) break;
+ curOff += len;
+
+ hdr.type = be32(hdr.type);
+ hdr.items = be32(hdr.items);
+
+ #define CODESTR(X) case X: codestr = #X;
+ switch (hdr.type)
+ {
+ CODESTR(XQX_START_DOC) break;
+ CODESTR(XQX_END_DOC) break;
+ CODESTR(XQX_START_PAGE) ++pageNum; break;
+ CODESTR(XQX_END_PAGE) break;
+ CODESTR(XQX_START_PLANE) break;
+ CODESTR(XQX_END_PLANE) break;
+ CODESTR(XQX_JBIG) break;
+ default: codestr = NULL; break;
+ }
+
+ if (codestr)
+ printf("%s(%ld), %ld items",
+ codestr, (long) hdr.type, (long) hdr.items);
+ else
+ printf("XQX_0x%lx, %ld items", (long) hdr.type, (long) hdr.items);
+
+ if (hdr.type == XQX_START_PAGE)
+ printf(" [Page %d]", pageNum);
+ printf("\n");
+
+ if (hdr.type == XQX_JBIG)
+ {
+ for (i = 0; i < hdr.items; ++i)
+ {
+ c = fgetc(fp);
+ if (DecFile)
+ {
+ size_t cnt;
+ unsigned char ch = c;
+
+ rc = JBG_EAGAIN;
+ rc = jbg_dec_in(&s[pn], &ch, 1, &cnt);
+ if (rc == JBG_EOK)
+ {
+ int h, w, len;
+ unsigned char *image;
+
+ // debug(0, "JBG_EOK: %d\n", pn);
+ h = jbg_dec_getheight(&s[pn]);
+ w = jbg_dec_getwidth(&s[pn]);
+ image = jbg_dec_getimage(&s[pn], 0);
+ len = jbg_dec_getsize(&s[pn]);
+ if (image)
+ {
+ char buf[512];
+ sprintf(buf, "%s-%02d-%d.pbm",
+ DecFile, pageNum, planeNum);
+ dfp = fopen(buf,
+ imageCnt[planeNum] ? "a" : "w");
+ if (dfp)
+ {
+ if (imageCnt[planeNum] == 0)
+ fprintf(dfp, "P4\n%8d %8d\n", w, h);
+ imageCnt[planeNum] += incrY;
+ rc = fwrite(image, 1, len, dfp);
+ fclose(dfp);
+ }
+ }
+ else
+ debug(0, "Missing image %dx%d!\n", h, w);
+ jbg_dec_free(&s[pn]);
+ }
+ }
+ }
+ curOff += hdr.items;
+ totSize += hdr.items;
+ }
+ else if (hdr.type == 2 && hdr.items == 0)
+ break;
+ else
+ {
+ for (i = 0; i < hdr.items; ++i)
+ {
+ XQX_ITEM_HEADER item;
+ DWORD val;
+ int j;
+
+ proff(curOff);
+ rc = fread(&item, len = sizeof(item), 1, fp);
+ if (rc != 1) break;
+ curOff += len;
+
+ item.type = be32(item.type);
+ item.size = be32(item.size);
+ switch (item.type)
+ {
+ CODESTR(XQXI_DMDUPLEX) break;
+ CODESTR(XQXI_DMDEFAULTSOURCE) break;
+ CODESTR(XQXI_DMMEDIATYPE) break;
+ CODESTR(XQXI_RESOLUTION_X) break;
+ CODESTR(XQXI_RESOLUTION_Y) break;
+ CODESTR(XQXI_RASTER_X) break;
+ CODESTR(XQXI_RASTER_Y) break;
+ CODESTR(XQXI_VIDEO_BPP) break;
+ CODESTR(XQXI_VIDEO_X) break;
+ CODESTR(XQXI_VIDEO_Y) break;
+ CODESTR(XQXI_ECONOMODE) break;
+ CODESTR(XQXI_DMPAPER) break;
+ CODESTR(XQXI_DUPLEX_PAUSE) break;
+ CODESTR(XQXI_BIH) break;
+ CODESTR(XQXI_END) break;
+ default: codestr = NULL; break;
+ }
+ if (item.size == 4)
+ {
+ rc = fread(&val, len = sizeof(val), 1, fp);
+ if (rc != 1) break;
+ val = be32(val);
+ if (codestr)
+ printf(" %s, %ld (0x%lx)",
+ codestr, (long) val, (long) val);
+ else
+ printf(" XQXI_0x%x, %ld (0x%lx)",
+ item.type, (long) val, (long) val);
+ }
+ else if (item.size == 20)
+ {
+ rc = fread(bih, bihlen = sizeof(bih), 1, fp);
+ if (rc != 1) break;
+ printf(" %s(0x%lx)\n", codestr, (long) item.type);
+ print_bih(bih);
+ if (DecFile)
+ {
+ size_t cnt;
+
+ jbg_dec_init(&s[pn]);
+ rc = jbg_dec_in(&s[pn], bih, bihlen, &cnt);
+ if (rc == JBG_EIMPL)
+ error(1, "JBIG uses unimplemented feature\n");
+ }
+ }
+ else
+ {
+ printf(" XQXI_0x%lx, %ld size,",
+ (long) item.type, (long) item.size);
+
+ for (j = 0; j < item.size; ++j)
+ {
+ c = fgetc(fp);
+ printf(" %02x" , c);
+ }
+ }
+ curOff += item.size;
+ printf("\n");
+ }
+ }
+ }
+ printf("Total size: %d bytes\n", totSize);
+}
+
+int
+main(int argc, char *argv[])
+{
+ extern int optind;
+ extern char *optarg;
+ int c;
+
+ while ( (c = getopt(argc, argv, "d:hoD:?h")) != EOF)
+ switch (c)
+ {
+ case 'd': DecFile = optarg; break;
+ case 'o': PrintOffset = 1; break;
+ case 'h': PrintHexOffset = 1; break;
+ case 'D': Debug = atoi(optarg); break;
+ default: usage(); exit(1);
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ if (argc > 0)
+ {
+ FILE *fp;
+
+ fp = fopen(argv[0], "r");
+ if (!fp)
+ error(1, "file '%s' doesn't exist\n", argv[0]);
+ for (;;)
+ {
+ decode(fp);
+ c = getc(fp); ungetc(c, fp);
+ if (feof(fp))
+ break;
+ }
+ fclose(fp);
+ }
+ else
+ {
+ for(;;)
+ {
+ decode(stdin);
+ c = getc(stdin); ungetc(c, stdin);
+ if (feof(stdin))
+ break;
+ }
+ }
+ printf("\n");
+
+ exit(0);
+}
diff --git a/foo2ddst-wrapper.1in b/foo2ddst-wrapper.1in
new file mode 100644
index 0000000..789d66e
--- /dev/null
+++ b/foo2ddst-wrapper.1in
@@ -0,0 +1,163 @@
+'\" t
+.TH foo2ddst-wrapper 1 "${MODpage}" "foo2ddst-wrapper ${MODver}"
+#ifndef OLDGROFF
+#include "macros.man"
+#endif
+'\"==========================================================================
+'\" MANUAL PAGE SOURCE
+'\"==========================================================================
+.SH NAME
+foo2ddst-wrapper \- Convert Postscript into a DDST printer stream
+.SH SYNOPSIS
+.B foo2ddst-wrapper
+.RI [ options "] [" ps-file ]
+.SH DESCRIPTION
+.B foo2ddst-wrapper
+is a Foomatic compatible printer wrapper for the \fBfoo2ddst\fP printer driver.
+This script reads a Postscript \fIps-file\fP or standard input
+and converts it to DDST printer format
+for driving
+the Ricoh Aficio SP 112,
+the Ricoh Aficio SP 201,
+and other DDST-based printers.
+.P
+This script can be used in a standalone fashion, but is intended to
+be called from a printer spooler system which uses the Foomatic
+printer database.
+
+.SH COMMAND LINE OPTIONS
+.SS Normal Options
+These are the options used to select the parameters of a
+print job that are usually controlled on a per job basis.
+.TP
+.BI \-d\0 duplex
+Duplex code to send to printer [1].
+.TS
+| n l | n l | n l .
+1 off 2 long edge 3 short edge
+.TE
+.TP
+.BI \-m\0 media
+Media code to send to printer [1].
+.TS
+l l l
+l n n.
+_
+Media Code
+_
+plain&recycled 1
+paper 2
+thin 3
+thick 4
+recycled 5
+.TE
+.TP
+.BI \-p\0 paper
+Paper size code to send to printer [1].
+.TS
+box;
+| n l | n l.
+1 letter 5 A4
+2 legal 6 A5
+3 executive 7 A6
+4 invoice(5.5x8.5) 8 B5 JIS
+ 10 16k 197x273
+11 16k 184x260 12 16k 195x270
+.TE
+.TP
+.BI \-n\0 copies
+Number of copies [1].
+.TP
+.BI \-r\0 xres x yres
+Set device resolution in pixels/inch [600x600].
+.TP
+.BI \-s\0 source
+Source (Input Slot) code to send to printer [7].
+.TS
+box;
+| n l | n l.
+1 upper 2 manual
+.TE
+.TP
+.BI \-t
+Draft mode. Every other pixel is white.
+.TP
+.BI \-T\0 density
+Print density (1-5). The default is 3 (medium).
+.TP
+.BI "\-2 \-3 \-4 \-5 \-6 \-8 \-9 \-10 \-12 \-14 \-15 \-16 \-18"
+Print in N-up. Requires the \fBpsutils\fP package.
+.TP
+.BI \-o\0 orient
+Orientation used for N-up.
+.TS
+l l l.
+Portrait -op (normal)
+Landscape -ol (rotated 90 degrees anticlockwise)
+Seascape -os (rotated 90 degrees clockwise)
+.TE
+.SS Printer Tweaking Options
+These are the options used to customize the operation of \fBfoo2ddst\fP
+for a particular printer.
+.TP
+.BI \-u\0 xoff x yoff
+Set the offset of the start of the printable region from the
+upper left corner, in pixels [varies with paper size].
+The defaults should work on the 2200DL and 2300DL, and have not
+been tested on any other printers.
+.TP
+.BI \-l\0 xoff x yoff
+Set the offset of the end of the printable region from the
+lower right corner, in pixels [varies with paper size].
+The defaults should work on the 2200DL and 2300DL, and have not
+been tested on any other printers.
+.TP
+.BI \-L\0 mask
+Send the logical clipping values from -u/-l in the ZjStream.
+\fBfoo2ddst-wrapper\fP always runs Ghostscript with the ideal page dimensions,
+so that the scale of the image is correct,
+regardless whether or not the printer has unprintable regions.
+This option is used to move the position of the clipped image
+back to where it belongs on the page. The default is to send
+the amount which was clipped by -u and -l, and should be
+good in most cases.
+.TS
+l l.
+0 don't send any logical clipping amounts
+1 only send Y clipping amount
+2 only send X clipping amount
+3 send both X and Y clipping amounts
+.TE
+.SS Debugging Options
+These options are used for debugging \fBfoo2ddst\fP and its wrapper.
+.TP
+.BI \-D\0 level
+Set Debug level [0].
+
+.SH EXAMPLES
+Create a monochrome ZjStream from a Postscript document,
+examine it, and then print it using a RAW print queue:
+
+.RS
+.nf
+foo2ddst-wrapper testpage.ps > testpage.ddst
+ddstdecode < testpage.ddst
+lpr -P raw testpage.ddst
+.fi
+.RE
+
+.SH FILES
+.BR /usr/bin/foo2ddst-wrapper
+.SH SEE ALSO
+.BR foo2ddst (1),
+.BR ddstdecode (1)
+.br
+.BR https://github.com/madlynx/ricoh-sp100
+.SH "AUTHOR"
+Rick Richardson <rick.richardson@comcast.net>
+.br
+${URLDDST}/
+'\"
+'\"
+'\"
+.em pdf_outline
diff --git a/foo2ddst-wrapper.in b/foo2ddst-wrapper.in
new file mode 100755
index 0000000..f4e20e8
--- /dev/null
+++ b/foo2ddst-wrapper.in
@@ -0,0 +1,683 @@
+#!/bin/sh
+
+#* Copyright (C) 2003-2006 Rick Richardson
+#*
+#* This program is free software; you can redistribute it and/or modify
+#* it under the terms of the GNU General Public License as published by
+#* the Free Software Foundation; either version 2 of the License, or
+#* (at your option) any later version.
+#*
+#* This program is distributed in the hope that it will be useful,
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+#* GNU General Public License for more details.
+#*
+#* You should have received a copy of the GNU General Public License
+#* along with this program; if not, write to the Free Software
+#* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#*
+#* Authors: Rick Richardson <rick.richardson@comcast.net>
+
+VERSION='$Id: foo2ddst-wrapper.in,v 1.3 2017/03/26 19:46:23 rick Exp $'
+
+#
+# Printer Notes:
+#
+# Ricoh Aficio SP 112 B/W
+# Ricoh Aficio SP 201 B/W
+#
+
+PROGNAME="$0"
+BASENAME=`basename $PROGNAME`
+PREFIX=/usr
+SHARE=$PREFIX/share/foo2ddst
+PATH=$PATH:/sw/bin:/opt/local/bin
+
+#
+# Log the command line, for debugging and problem reports
+#
+if [ -x /usr/bin/logger -o -x /bin/logger ]; then
+ logger -t "$BASENAME" -p lpr.info -- "$BASENAME $@" </dev/null
+fi
+
+usage() {
+ cat <<EOF
+Usage:
+ $BASENAME [options] [ps-file]
+
+ Foomatic printer wrapper for the foo2ddst printer driver.
+ This script reads a Postscript ps-file or standard input
+ and converts it to Ricoh DDST printer format.
+
+Normal Options:
+-c Print in color (else monochrome)
+-d duplex Duplex code to send to printer [$DUPLEX]
+ 1=off, 2=longedge, 3=shortedge
+-m media Media code to send to printer [$MEDIA]
+ 1=plain&recycled 2=paper 3=thin 4=thick1 5=recycled
+-p paper Paper code [$PAPER]
+ 1=letter 2=legal 3=executive 4=invoice(5.5x8.5)
+ 5=A4 6=A5 7=A6 8=B5JIS 9=B6JIS
+ 10=16k197x273, 11=16k184x260, 12=16k195x270
+-n copies Number of copies [$COPIES]
+-r <xres>x<yres> Set device resolution in pixels/inch [$RES]
+-s source Source code to send to printer [$SOURCE]
+ 1=tray1 2=manual
+ Code numbers may vary with printer model.
+-t Draft mode. Every other pixel is white.
+-T density Print density (1-5) [$DENSITY]
+-2/-3/-4/-6/-8/-10/-12/-14/-15/-16/-18
+ Print with N-up (requires psutils)
+-o orient For N-up: -op is portrait, -ol is landscape, -os is seascape.
+
+Printer Tweaking Options:
+-u <xoff>x<yoff> Set offset of upper left printable in pixels [varies]
+-l <xoff>x<yoff> Set offset of lower right printable in pixels [varies]
+-L mask Send logical clipping values from -u/-l in ZjStream [3]
+ 0=no, 1=Y, 2=X, 3=XY
+-P Do not output START_PLANE codes. May be needed by some
+ monochrome-only printers.
+-X padlen Add extra zero padding to the end of BID segments [16]
+
+Color Tweaking Options:
+-g gsopts Additional options to pass to Ghostscript, such as
+ -dDITHERPPI=nnn, etc. May appear more than once. []
+-G profile.icm Convert profile.icm to a Postscript CRD using icc2ps and
+ adjust colors using the setcolorrendering PS operator.
+ $SHARE/icm/ will be searched for profile.icm.
+-I intent Select profile intent from ICM file [$INTENT]
+ 0=Perceptual, 1=Colorimetric, 2=Saturation, 3=Absolute
+-G gamma-file.ps Prepend gamma-file to the Postscript input to perform
+ color correction using the setcolortransfer PS operator.
+
+Debugging Options:
+-S plane Output just a single color plane from a color print [all]
+ 1=Cyan, 2=Magenta, 3=Yellow, 4=Black
+-D lvl Set Debug level [$DEBUG]
+-V $VERSION
+EOF
+
+ exit 1
+}
+
+#
+# Report an error and exit
+#
+error() {
+ echo "$BASENAME: $1" >&2
+ exit 1
+}
+
+dbgcmd() {
+ if [ $DEBUG -ge 1 ]; then
+ echo "$@" >&2
+ fi
+ "$@"
+}
+
+#
+# N-up-ify the job. Requires psnup from psutils package
+#
+nup() {
+ case "$NUP" in
+ [2368]|1[0458])
+ tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.3in -p$paper -q
+ ;;
+ [49]|1[26])
+ tr '\r' '\n' | psnup $NUP_ORIENT -d2 -$NUP -m.5in -p$paper -q
+ ;;
+ *)
+ error "Illegal call to nup()."
+ ;;
+ esac
+}
+
+#
+# Process the options
+#
+
+# Try to use a local copy of GhostScript 8.54, if available. Otherwise,
+# fallback to whatever the Linux distro has installed (usually 7.07)
+#
+# N.B. := operator used here, when :- would be better, because "ash"
+# doesn't have :-
+if eval gs.foo -v >/dev/null 2>&1; then
+ GSBIN=${GSBIN:-gs.foo}
+else
+ GSBIN=${GSBIN:-gs}
+fi
+
+CMDLINE="$*"
+DEBUG=0
+DUPLEX=1
+COLOR=
+COLORMODE=0
+# What mode to use if the user wants us to pick the "best" mode
+case `$GSBIN --version` in
+7*) DEFAULTCOLORMODE=10
+ DEFAULTCOLORMODE=2
+ ;;
+*) DEFAULTCOLORMODE=2
+ ;;
+esac
+QUALITY=1
+QUALITY=wts
+MEDIA=1
+COPIES=1
+PAPER=1
+RES=600x600
+SOURCE=1
+NUP=
+CLIP_UL=
+CLIP_LR=
+CLIP_LOG=
+BC=
+AIB=
+NOPLANES=
+COLOR2MONO=
+GAMMAFILE=
+INTENT=0
+GSOPTS=
+EXTRAPAD=
+SAVETONER=
+DENSITY=3 #Medium
+NUP_ORIENT=
+GSDEV=-sDEVICE=pbmraw
+# What mode to use if the user wants us to pick the "best" mode
+case `$GSBIN --version` in
+8.1*)
+ QUALITY=1
+ ;;
+esac
+while getopts "1:23456789o:b:cC:d:g:l:u:L:m:n:p:q:r:s:tT:ABS:D:G:I:PX:Vh?" opt
+do
+ case $opt in
+ b) GSBIN="$OPTARG";;
+ c) COLOR=-c;;
+ d) DUPLEX="$OPTARG";;
+ g) GSOPTS="$GSOPTS $OPTARG";;
+ m) MEDIA="$OPTARG";;
+ n) COPIES="$OPTARG";;
+ p) PAPER="$OPTARG";;
+ q) QUALITY="$OPTARG";;
+ r) RES="$OPTARG";;
+ s) SOURCE="$OPTARG";;
+ t) SAVETONER="-t";;
+ T) DENSITY="$OPTARG";;
+ l) CLIP_LR="-l $OPTARG";;
+ u) CLIP_UL="-u $OPTARG";;
+ L) CLIP_LOG="-L $OPTARG";;
+ A) AIB=-A;;
+ B) BC=-B;;
+ C) COLORMODE="$OPTARG";;
+ S) COLOR2MONO="-S$OPTARG";;
+ D) DEBUG="$OPTARG";;
+ G) GAMMAFILE="$OPTARG";;
+ I) INTENT="$OPTARG";;
+ P) NOPLANES=-P;;
+ X) EXTRAPAD="-X $OPTARG";;
+ [234689]) NUP="$opt";;
+ [57]) error "Can't find acceptable layout for $opt-up";;
+ 1) case "$OPTARG" in
+ [024568]) NUP="1$OPTARG";;
+ *) error "Can't find acceptable layout for 1$OPTARG-up";;
+ esac
+ ;;
+ o) case "$OPTARG" in
+ l*) NUP_ORIENT=-l;;
+ s*) NUP_ORIENT=-r;;
+ p*|*) NUP_ORIENT=;;
+ esac;;
+ V) echo "$VERSION"; foo2ddst -V; foo2zjs-pstops -V; exit 0;;
+ h|\?)
+ if [ "$CMDLINE" != "-?" -a "$CMDLINE" != -h ]; then
+ echo "Illegal command:"
+ echo " $0 $CMDLINE"
+ echo
+ fi
+ usage;;
+ esac
+done
+shift `expr $OPTIND - 1`
+
+#
+# If there is an argument left, take it as the file to print.
+# Else, the input comes from stdin.
+#
+if [ $# -ge 1 ]; then
+ if [ "$LPJOB" = "" ]; then
+ : # LPJOB="$1"
+ fi
+ exec < $1
+fi
+
+#
+case "$QUALITY" in
+0)
+ GSOPTS="-dCOLORSCREEN $GSOPTS"
+ ;;
+1)
+ GSOPTS="-dCOLORSCREEN $GSOPTS"
+ ;;
+2)
+ GSOPTS="-dMaxBitmap=500000000 $GSOPTS"
+ ;;
+as)
+ GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"
+ ;;
+wts)
+ GSOPTS="-dCOLORSCREEN -dMaxBitmap=500000000 $GSOPTS"
+ ;;
+esac
+
+#
+# Validate media code
+#
+case "$MEDIA" in
+1|standard) MEDIA=1;;
+2|transparency) MEDIA=2;;
+3|glossy) MEDIA=3;;
+257|envelope) MEDIA=257;;
+259|letterhead) MEDIA=259;;
+261|thickstock) MEDIA=261;;
+262|postcard) MEDIA=262;;
+263|labels) MEDIA=263;;
+[0-9]*) ;;
+*) error "Unknown media code $MEDIA";;
+esac
+
+#
+# Validate source (InputSlot) code
+#
+case "$SOURCE" in
+1|upper) SOURCE=1;;
+4|manual) SOURCE=4;;
+7|auto) SOURCE=7;;
+[0-9]*) ;;
+*) error "Unknown source code $SOURCE";;
+esac
+
+#
+# Validate Duplex code
+#
+case "$DUPLEX" in
+1|off|none) DUPLEX=1;;
+2|long*) DUPLEX=2;;
+3|short*) DUPLEX=3;;
+[0-9]*) ;;
+*) error "Unknown duplex code $DUPLEX";;
+esac
+
+#
+# Validate Resolution
+#
+case "$RES" in
+600x600) ;;
+1200x600) ;;
+*) error "Illegal resolution $RES";;
+esac
+
+#
+# Validate Print Density
+#
+case "$DENSITY" in
+1|2|3|4|5) ;;
+*) error "Illegal print density (-T) $DENSITY";;
+esac
+
+#
+# Figure out the paper dimensions in pixels/inch, and set the
+# default clipping region. Unfortunately, this is a trouble
+# area for ZjStream printers. Various versions of ZjS print
+# engines react differently when asked to print into their
+# unprintable regions.
+#
+# The Minolta 2200 DL is sensitive to its unprintable regions,
+# and will pixel skew if you try to print there.
+#
+# The HP1000 will print blank pages when asked to print into its
+# unprintable region.
+#
+# The Minolta 2300 DL doesn't care if print into the unprintable
+# region. It will do the clipping itself. This is as it should be.
+# But it won't hurt it if we do the clipping here.
+#
+set_clipping() {
+ ulx=$1; uly=$2
+ lrx=$3; lry=$4
+
+ # Set clipping region if it isn't already set
+ if [ "$CLIP_UL" = "" ]; then
+ case "$RES" in
+ 600x600) ulx=`expr $ulx / 2`;;
+ 2400x600) ulx=`expr $ulx \* 2`;;
+ esac
+ CLIP_UL="-u ${ulx}x${uly}"
+ fi
+ if [ "$CLIP_LR" = "" ]; then
+ case "$RES" in
+ 600x600) lrx=`expr $lrx / 2`;;
+ 2400x600) lrx=`expr $lrx \* 2`;;
+ esac
+ CLIP_LR="-l ${lrx}x${lry}"
+ fi
+}
+
+case "$PAPER" in
+Custom*x*)
+ # Command line only
+ XDIM=`echo "$PAPER" | sed -e "s/Custom.//" -e "s/x.*//" `
+ YDIM=`echo "$PAPER" | sed -e "s/.*x//" `
+ if [ "$XDIM" = "" -o "$YDIM" = "" ]; then
+ error "Custom page size '$PAPER' != 1-99999"
+ fi
+ if [ "$XDIM" -eq 0 -o "$YDIM" -eq 0 ]; then
+ error "Custom page size '$PAPER' != 1-99999"
+ fi
+ XDIM=`dc -e "$XDIM 1200* 72/p"`
+ YDIM=`dc -e "$YDIM 600* 72/p"`
+ PAPER=359; paper=letter;
+ #set_clipping 2 84 2 84
+ ;;
+Custom*)
+ # PS job
+ #%%BeginFeature: *CustomPageSize True
+ #216
+ #360
+ #0
+ #0
+ #0
+ #pop pop pop pop pop
+
+ #%%BeginFeature: *CustomPageSize True
+ #792.000000 612.000000 1 0.000000 0.000000
+ #pop pop pop pop pop
+
+ if [ $DEBUG = 0 ]; then
+ TMPFILE=/tmp/cus$$
+ else
+ TMPFILE=/tmp/custom.ps
+ fi
+ cat >$TMPFILE
+ exec <$TMPFILE
+
+ tmp=`head -n 10000 $TMPFILE \
+ | sed -n '/CustomPageSize/{n;p;n;p;}' \
+ | tr '\n' ' '`
+ case "$tmp" in
+ [0-9]*\ [0-9]*)
+ XDIM=`echo "$tmp" | sed 's/ .*//'`
+ YDIM=`echo "$tmp" | sed -e 's/^[^ ]* //' -e 's/ .*//'`
+ ;;
+ *)
+ if [ $DEBUG = 0 ]; then rm -f $TMPFILE; fi
+ error "Custom page size [XY]DIM != 1-99999"
+ ;;
+ esac
+ XDIM=`dc -e "$XDIM 1200* 72/p"`
+ YDIM=`dc -e "$YDIM 600* 72/p"`
+ PAPER=359; paper=letter;
+ #set_clipping 2 84 2 84
+ ;;
+1|letter) PAPER=1; paper=letter; XDIM="10200"; YDIM="6600"
+ #set_clipping 177 84 177 84
+ ;;
+2|legal) PAPER=2; paper=legal; XDIM="10200"; YDIM="8400"
+ #set_clipping 177 96 177 96
+ ;;
+3|executive) PAPER=3; paper=executive; XDIM="8700"; YDIM="6300"
+ #set_clipping 192 96 192 96
+ ;;
+5|a4|A4) PAPER=5; paper=a4; XDIM="9920"; YDIM="7016"
+ #set_clipping 176 84 176 84
+ ;;
+6|a5|A5) PAPER=6; paper=a5; XDIM="6992"; YDIM="4960"
+ #set_clipping 192 96 192 96
+ ;;
+8|b5|B5) PAPER=8; paper=b5; XDIM="8598"; YDIM="6070"
+ #set_clipping 192 96 192 96
+ ;;
+10|16k197x273) PAPER=10; paper=executive;XDIM="9306"; YDIM="6448"
+ #set_clipping 173 84 173 84
+ ;;
+11|16k184x260) PAPER=11; paper=executive;XDIM="8692"; YDIM="6142"
+ #set_clipping 122 87 122 87
+ ;;
+12|16k195x270) PAPER=12; paper=executive;XDIM="9212"; YDIM="6378"
+ #set_clipping 126 87 126 87
+ ;;
+20|"env#10") PAPER=20; paper=env10; XDIM="4950"; YDIM="5700"
+ #set_clipping 171 78 171 78
+ ;;
+27|envDL) PAPER=27; paper=envDL; XDIM="5200"; YDIM="5200"
+ #set_clipping 176 84 176 84
+ ;;
+28|envC5) PAPER=28; paper=envC5; XDIM="7650"; YDIM="5408"
+ #set_clipping 170 80 169 80
+ ;;
+34|envB5) PAPER=34; paper=envB5; XDIM="8316"; YDIM="5892"
+ #set_clipping 174 74 174 74
+ ;;
+37|envMonarch) PAPER=37; paper=envMonarch;XDIM="4650"; YDIM="4500"
+ #set_clipping 174 78 173 78
+ ;;
+*) error "Unimplemented paper code $PAPER";;
+esac
+PAPERSIZE="-sPAPERSIZE=$paper";
+
+case "$RES" in
+600x600) XDIM=`expr $XDIM / 2`;;
+1200x600) ;;
+2400x600) XDIM=`expr $XDIM \* 2`;;
+esac
+DIM="${XDIM}x${YDIM}"
+
+#
+# Filter thru psnup if N-up printing has been requested
+#
+case $NUP in
+[234689]|1[024568]) PREFILTER="nup";;
+*) PREFILTER=cat;;
+esac
+if [ "$DEBUG" -ge 9 ]; then
+ PREFILTER="tee /tmp/$BASENAME.ps"
+fi
+
+#
+# Overload -G. If the file name ends with ".icm" or ".ICM"
+# then convert the ICC color profile to a Postscript CRD,
+# then prepend it to the users job. Select the intent
+# using the -I option.
+#
+
+create_crd() {
+ #
+ # Create a Postscript CRD
+ #
+ ICC2PS=$PREFIX/bin/foo2zjs-icc2ps
+ if [ -x $ICC2PS ]; then
+ if [ -x /usr/bin/logger ]; then
+ logger -t "$BASENAME" -p lpr.info -- \
+ "`basename $ICC2PS` -o $GAMMAFILE -t$INTENT > $ICCTMP.crd.ps"
+ fi
+ $ICC2PS -o $GAMMAFILE -t$INTENT > $ICCTMP.crd.ps 2>$ICCTMP.log \
+ || error "Problem converting .ICM file to Postscript"
+
+ PSTOPS_OPTS="$PSTOPS_OPTS -c"
+ cat > $ICCTMP.usecie.ps <<-EOF
+ %!PS-Adobe-3.0
+ <</UseCIEColor true>>setpagedevice
+ EOF
+ cat > $ICCTMP.selcrd.ps <<-EOF
+ /Current /ColorRendering findresource setcolorrendering
+ EOF
+ GAMMAFILE="$ICCTMP.usecie.ps $ICCTMP.crd.ps $ICCTMP.selcrd.ps"
+ else
+ GAMMAFILE=
+ fi
+}
+
+if [ $DEBUG -gt 0 ]; then
+ ICCTMP=/tmp/icc
+else
+ ICCTMP=/tmp/icc$$
+fi
+
+if [ "" = "$COLOR" ]; then
+ COLORMODE=
+ GAMMAFILE=
+else
+ case "$COLORMODE" in
+ 0) COLORMODE=$DEFAULTCOLORMODE;;
+ esac
+fi
+
+CRDBASE="$PREFIX/share/foo2zjs/crd"
+case "$RES" in
+ 600x600) SCREEN=screen1200.ps;;
+ 1200x600) SCREEN=screen1200.ps;;
+ 2400x600) SCREEN=screen2400.ps;;
+esac
+
+PSTOPS_OPTS="-n"
+
+case "$COLORMODE" in
+"")
+ # Monochrome
+ ;;
+10|icm)
+ # Use old ICM method
+ AIB=-A
+ BC=-B
+ case "$GAMMAFILE" in
+ *.icm|*.ICM|*.icc|*.ICC)
+ #
+ # Its really an .ICM file, not a gamma file.
+ #
+ # The file can be a full path name, or the name of a file in $SHARE/icm/
+ #
+ if [ -r "$GAMMAFILE" ]; then
+ create_crd
+ elif [ -r "$SHARE/icm/$GAMMAFILE" ]; then
+ GAMMAFILE="$SHARE/icm/$GAMMAFILE"
+ create_crd
+ else
+ GAMMAFILE=
+ fi
+ ;;
+ none)
+ GAMMAFILE=
+ ;;
+ esac
+ ;;
+1|photo)
+ # Photo
+ GAMMAFILE="$CRDBASE/prolog.ps"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/2300w-1200@150-l250-kx,ucr125,75-per.crd"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ ;;
+2|graphics)
+ # Photo and Text
+ GAMMAFILE="$CRDBASE/prolog.ps"
+ #GAMMAFILE="$GAMMAFILE $CRDBASE/2300w-1200@150-l250-kx,ucr100,75-per.crd"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/kh.crd"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ ;;
+3|text)
+ # Graphic and Text
+ GAMMAFILE="$CRDBASE/prolog.ps"
+ #GAMMAFILE="$GAMMAFILE $CRDBASE/2300w-1200@150-l250-kx,ucr100,50-per.crd"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/kx.crd"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ ;;
+4|tonersave)
+ # Reduced toner
+ GAMMAFILE="$CRDBASE/prolog.ps"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/2300w-1200@150-l250-kx,ucr100,0-per.crd"
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ ;;
+*.crd)
+ GAMMAFILE="$CRDBASE/prolog.ps"
+ if [ -f $COLORMODE ]; then
+ GAMMAFILE="$GAMMAFILE $COLORMODE"
+ elif [ -f $CRDBASE/$COLORMODE ]; then
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$COLORMODE"
+ else
+ error "Can't find CRD '$COLORMODE' in . or in $CRDBASE"
+ fi
+ GAMMAFILE="$GAMMAFILE $CRDBASE/$SCREEN"
+ ;;
+*)
+ error "Unknown color method '$COLORMODE'"
+ ;;
+esac
+
+if [ "$COLOR" != "" -a "$QUALITY" = wts ]; then
+ PSTOPS_OPTS="$PSTOPS_OPTS -w"
+elif [ "$COLOR" != "" -a "$QUALITY" = as ]; then
+ PSTOPS_OPTS="$PSTOPS_OPTS -a"
+fi
+
+if [ "" != "$COLOR" ]; then
+ if [ "" = "$AIB" -a "" = "$BC" ]; then
+ # Faster, but can't handle AllIsBlack or BlackClears
+ GSDEV=-sDEVICE=pksmraw
+ else
+ # Can't handle different size pages
+ GSDEV=-sDEVICE=bitcmyk
+ fi
+fi
+
+#
+# Figure out USERNAME
+#
+if [ "$LPUSER" != "" ]; then
+ USER="$LPUSER@$LPHOST"
+else
+ USER=""
+fi
+
+#
+# Main Program, just cobble together the pipeline and run it
+#
+# The malarky with file descriptors 1 and 3 is to avoid a bug in
+# (some versions?) of Ghostscript where Postscript's stdout gets
+# intermingled with the printer drivers output, resulting in
+# corrupted image data.
+#
+GS="$GSBIN -q -dBATCH -dSAFER -dQUIET -dNOPAUSE"
+
+foo2zjs-pstops $PSTOPS_OPTS | \
+$PREFILTER \
+| ($GS $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS \
+ -sOutputFile="|cat 1>&3" $GAMMAFILE -_ >/dev/null) 3>&1 \
+| foo2ddst -r$RES -g$DIM -p$PAPER -m$MEDIA -n$COPIES -d$DUPLEX -s$SOURCE \
+ $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG $SAVETONER -T$DENSITY \
+ -J "$LPJOB" -U "$USER" \
+ $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD -D$DEBUG
+
+#
+# Log the command line, for debugging and problem reports
+#
+if [ -x /usr/bin/logger ]; then
+ logger -t "$BASENAME" -p lpr.info -- \
+ "$GSBIN $PAPERSIZE -g$DIM -r$RES $GSDEV $GSOPTS $GAMMAFILE"
+ logger -t "$BASENAME" -p lpr.info -- \
+ "foo2ddst -r$RES -g$DIM -p$PAPER -m$MEDIA \
+-n$COPIES -d$DUPLEX -s$SOURCE $COLOR $CLIP_UL $CLIP_LR $CLIP_LOG \
+$SAVETONER -T$DENSITY $BC $AIB $COLOR2MONO $NOPLANES $EXTRAPAD"
+fi
+
+#
+# Remove cruft
+#
+if [ $DEBUG -eq 0 ]; then
+ for i in crd.ps log usecie.ps selcrd.ps
+ do
+ file="$ICCTMP.$i"
+ [ -f $file ] && rm -f $file
+ done
+ [ -f "$TMPFILE" ] && rm -f $TMPFILE
+fi
+
+exit 0
diff --git a/foo2ddst.1in b/foo2ddst.1in
new file mode 100644
index 0000000..e5adfe5
--- /dev/null
+++ b/foo2ddst.1in
@@ -0,0 +1,162 @@
+'\" t
+.TH foo2ddst 1 "${MODpage}" "foo2ddst ${MODver}"
+#ifndef OLDGROFF
+#include "macros.man"
+#endif
+'\"==========================================================================
+'\" MANUAL PAGE SOURCE
+'\"==========================================================================
+.SH NAME
+foo2ddst \- Convert Ghostscript pbmraw into a
+DDST printer stream
+.SH SYNOPSIS
+.B foo2ddst
+.RI [ options "] <" pbmraw-file " >" ddst-file
+.SH DESCRIPTION
+.B foo2ddst
+converts Ghostscript pbmraw to monochrome
+DDST streams,
+for driving
+the Ricoh Aficio SP 112,
+the Ricoh Aficio SP 201,
+and other DDST-based printers.
+
+.SH COMMAND LINE OPTIONS
+.SS Normal Options
+These are the options used to select the parameters of a
+print job that are usually controlled on a per job basis.
+.TP
+.BI \-d\0 duplex
+Duplex code to send to printer [1].
+.TS
+| n l | n l | n l .
+1 off 2 long edge 3 short edge
+.TE
+.TP
+.BI \-g\0 xpix x ypix
+Set page dimensions in pixels [5100x6600].
+.TP
+.BI \-m\0 media
+Media code to send to printer [1].
+.TS
+l l l
+l n n.
+_
+Media Code
+_
+plain&recycled 1
+paper 2
+thin 3
+thick 4
+recycled 5
+.TE
+.TP
+.BI \-p\0 paper
+Paper code to send to printer [1].
+.TS
+box;
+| n l | n l.
+1 letter 5 A4
+2 legal 6 A5
+3 executive 7 A6
+4 invoice(5.5x8.5) 8 B5 JIS
+ 10 16k 197x273
+11 16k 184x260 12 16k 195x270
+.TE
+.TP
+.BI \-n\0 copies
+Number of copies [1].
+.TP
+.BI \-r\0 xres x yres
+Set device resolution in pixels/inch [600x600].
+.TP
+.BI \-s\0 source
+Source (InputSlot) code to send to printer [7].
+.TS
+box;
+| n l | n l.
+1 tray 1 2 manual
+.TE
+.TP
+.BI \-t
+Draft mode. Every other pixel is white.
+.TP
+.BI \-T\0 density
+Print density (1-5). The default is 3 (medium).
+.TP
+.BI \-J\0 filename
+Filename string to send to printer.
+.TP
+.BI \-U\0 username
+Username string to send to printer.
+.SS Printer Tweaking Options
+These are the options used to customize the operation of \fBfoo2ddst\fP
+for a particular printer.
+.TP
+.BI \-u\0 xoff x yoff
+Set the offset of the start of the printable region from the
+upper left corner, in pixels [0x0].
+.TP
+.BI \-l\0 xoff x yoff
+Set the offset of the end of the printable region from the
+lower right corner, in pixels [0x0].
+.TP
+.BI \-L\0 mask
+Send logical clipping amounts implied by -u/-l in the ZjStream [3].
+.TS
+l l.
+0 don't send any logical clipping amounts
+1 only send Y clipping amount
+2 only send X clipping amount
+3 send both X and Y clipping amounts
+.TE
+.TP
+.BI \-A
+AllIsBlack: convert C=1,M=1,Y=1 to just K=1. Works with bitcmyk input only.
+.TP
+.BI \-B
+BlackClears: K=1 forces C,M,Y to 0. Works with bitcmyk input only.
+.SS Debugging Options
+These options are used for debugging \fBfoo2ddst\fP.
+.TP
+.BI \-S\0 plane
+Output just a single color plane from a color print and print it
+on the black plane. The default is to output all color planes.
+.TS
+l l.
+1 Cyan
+2 Magenta
+3 Yellow
+4 Black
+.TE
+.TP
+.BI \-D\0 level
+Set Debug level [0].
+
+.SH EXAMPLES
+Create a black and white DDST stream:
+
+.RS
+.nf
+gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \
+ -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw \
+ -sOutputFile=- - < testpage.ps \
+| foo2ddst -r1200x600 -g10200x6600 -p1 >testpage.zm
+.fi
+.RE
+
+.SH FILES
+.BR /usr/bin/foo2ddst
+.SH SEE ALSO
+.BR foo2ddst-wrapper (1),
+.BR ddstdecode (1)
+.br
+.BR https://github.com/madlynx/ricoh-sp100
+.SH "AUTHOR"
+Rick Richardson <rick.richardson@comcast.net>
+.br
+${URLDDST}/
+'\"
+'\"
+'\"
+.em pdf_outline
diff --git a/foo2ddst.c b/foo2ddst.c
new file mode 100644
index 0000000..700a5e0
--- /dev/null
+++ b/foo2ddst.c
@@ -0,0 +1,1580 @@
+/*
+
+GENERAL
+This program converts pbm (B/W) images and 1-bit-per-pixel cmyk images
+(both produced by ghostscript) to Zenographics ZJ-stream format. There
+is some information about the ZJS format at http://ddk.zeno.com.
+
+With this utility, you can print to some Ricoh printers, such as these:
+ - Ricoh Aficio SP 112 B/W
+ - Ricoh Aficio SP 201 B/W
+
+AUTHORS
+This program began life as Robert Szalai's 'pbmtozjs' program. It
+also uses Markus Kuhn's jbig-kit compression library (included, but
+also available at http://www.cl.cam.ac.uk/~mgk25/jbigkit/).
+
+The program was overhauled by Rick Richardson to limit data chunk size
+to 65536 bytes, add command line options, add color support,
+and other miscellaneous features.
+
+You can contact the current author at mailto:rick.richardson@comcast.net
+
+LICENSE
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+If you want to use this program under different license conditions,
+then contact the author for an arrangement.
+
+It is possible that certain products which can be built using the jbig
+software module might form inventions protected by patent rights in
+some countries (e.g., by patents about arithmetic coding algorithms
+owned by IBM and AT&T in the USA). Provision of this software by the
+author does NOT include any licenses for any patents. In those
+countries where a patent license is required for certain applications
+of this software module, you will have to obtain such a license
+yourself.
+
+*/
+
+static char Version[] = "$Id: foo2ddst.c,v 1.10 2017/03/26 18:29:05 rick Exp $";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include <time.h>
+#include "jbig.h"
+#include "ddst.h"
+
+/*
+ * Command line options
+ */
+int Debug = 0;
+int ResX = 600;
+int ResY = 600;
+int Bpp = 1;
+int PaperCode = DMPAPER_LETTER;
+int PageWidth = 600 * 8.5;
+int PageHeight = 600 * 11;
+int UpperLeftX = 0;
+int UpperLeftY = 0;
+int LowerRightX = 0;
+int LowerRightY = 0;
+int Copies = 1;
+int Duplex = DMDUPLEX_OFF;
+int SourceCode = DMBIN_AUTO;
+int MediaCode = DMMEDIA_PLAIN;
+char *Username = NULL;
+char *Filename = NULL;
+int Mode = 0;
+ #define MODE_MONO 1
+ #define MODE_COLOR 2
+
+int Color2Mono = 0;
+int BlackClears = 0;
+int AllIsBlack = 0;
+int OutputStartPlane = 1;
+int ExtraPad = 16;
+
+int LogicalOffsetX = 0;
+int LogicalOffsetY = 0;
+
+#define LOGICAL_CLIP_X 2
+#define LOGICAL_CLIP_Y 1
+int LogicalClip = LOGICAL_CLIP_X | LOGICAL_CLIP_Y;
+int SaveToner = 0;
+int PageNum = 0;
+int RealWidth;
+int EconoMode = 0;
+int PrintDensity = 3;
+
+int IsCUPS = 0;
+
+FILE *EvenPages = NULL;
+typedef struct
+{
+ off_t b, e, pause;
+} SEEKREC;
+SEEKREC SeekRec[2000];
+int SeekIndex = 0;
+int DuplexPause = 0;
+
+long JbgOptions[5] =
+{
+ /* Order */
+ JBG_ILEAVE | JBG_SMID,
+ /* Options */
+ JBG_DELAY_AT | JBG_LRLTWO | JBG_TPBON,
+ /* L0 */
+ 128,
+ /* MX */
+ 0,
+ /* MY */
+ 0
+};
+
+void
+usage(void)
+{
+ fprintf(stderr,
+"Usage:\n"
+" foo2ddst [options] <pbmraw-file >ddst-file\n"
+"\n"
+" Convert Ghostscript pbmraw format to a monochrome ZJS stream,\n"
+" for driving the Ricoh SP1212 and other laser printers.\n"
+"\n"
+" gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \\ \n"
+" -sPAPERSIZE=letter -r1200x600 -sDEVICE=pbmraw \\ \n"
+" -sOutputFile=- - < testpage.ps \\ \n"
+" | foo2ddst -r1200x600 -g10200x6600 -p1 >testpage.zm\n"
+"\n"
+#if 0
+" foo2ddst [options] <bitcmyk-file >ddst-file\n"
+" foo2ddst [options] <pksmraw-file >ddst-file\n"
+"\n"
+" Convert Ghostscript bitcmyk or pksmraw format to a color ZJS stream,\n"
+" for driving the HP LaserJet M1005 MFP color laser printer\n"
+" N.B. Color correction is expected to be performed by ghostscript.\n"
+"\n"
+" gs -q -dBATCH -dSAFER -dQUIET -dNOPAUSE \\ \n"
+" -sPAPERSIZE=letter -g10200x6600 -r1200x600 -sDEVICE=bitcmyk \\ \n"
+" -sOutputFile=- - < testpage.ps \\ \n"
+" | foo2ddst -r1200x600 -g10200x6600 -p1 >testpage.zc\n"
+"\n"
+#endif
+"Normal Options:\n"
+// "-c Force color mode if autodetect doesn't work\n"
+"-d duplex Duplex code to send to printer [%d]\n"
+" 1=off, 2=longedge, 3=shortedge\n"
+"-g <xpix>x<ypix> Set page dimensions in pixels [%dx%d]\n"
+"-m media Media code to send to printer [%d]\n"
+" 1=plain&recycled 2=paper 3=thin 4=thick1 5=recycled\n"
+"-p paper Paper code to send to printer [%d]\n"
+" 1=letter 2=legal 3=executive 4=invoice(5.5x8.5)\n"
+" 5=A4 6=A5 7=A6 8=B5JIS 9=B6JIS\n"
+" 10=16k197x273, 11=16k184x260, 12=16k195x270\n"
+//" 20=env#10, 27=envDL 28=envC5 34=envB5 37=envMonarch\n"
+"-n copies Number of copies [%d]\n"
+"-r <xres>x<yres> Set device resolution in pixels/inch [%dx%d]\n"
+"-s source Source code to send to printer [%d]\n"
+" 1=tray1 2=manual\n"
+" Code numbers may vary with printer model\n"
+"-t Draft mode. Every other pixel is white.\n"
+"-T density Print density (1-5) [%d].\n"
+"-J filename Filename string to send to printer [%s]\n"
+"-U username Username string to send to printer [%s]\n"
+"\n"
+"Printer Tweaking Options:\n"
+"-u <xoff>x<yoff> Set offset of upper left printable in pixels [%dx%d]\n"
+"-l <xoff>x<yoff> Set offset of lower right printable in pixels [%dx%d]\n"
+"-L mask Send logical clipping values from -u/-l in ZjStream [%d]\n"
+" 0=no, 1=Y, 2=X, 3=XY\n"
+"-A AllIsBlack: convert C=1,M=1,Y=1 to just K=1\n"
+"-B BlackClears: K=1 forces C,M,Y to 0\n"
+" -A, -B work with bitcmyk input only\n"
+"-P Do not output START_PLANE codes. May be needed by some\n"
+" some black and white only printers.\n"
+"-X padlen Add extra zero padding to the end of BID segments [%d]\n"
+"\n"
+"Debugging Options:\n"
+"-S plane Output just a single color plane from a color print [all]\n"
+" 1=Cyan, 2=Magenta, 3=Yellow, 4=Black\n"
+"-D lvl Set Debug level [%d]\n"
+"-V Version %s\n"
+ , Duplex
+ , PageWidth , PageHeight
+ , MediaCode
+ , PaperCode
+ , Copies
+ , ResX , ResY
+ , SourceCode
+ , PrintDensity
+ , Filename ? Filename : ""
+ , Username ? Username : ""
+ , UpperLeftX , UpperLeftY
+ , LowerRightX , LowerRightY
+ , LogicalClip
+ , ExtraPad
+ , Debug
+ , Version
+ );
+
+ exit(1);
+}
+
+/*
+ * Mirror1: bits 01234567 become 76543210
+ */
+unsigned char Mirror1[256] =
+{
+ 0,128, 64,192, 32,160, 96,224, 16,144, 80,208, 48,176,112,240,
+ 8,136, 72,200, 40,168,104,232, 24,152, 88,216, 56,184,120,248,
+ 4,132, 68,196, 36,164,100,228, 20,148, 84,212, 52,180,116,244,
+ 12,140, 76,204, 44,172,108,236, 28,156, 92,220, 60,188,124,252,
+ 2,130, 66,194, 34,162, 98,226, 18,146, 82,210, 50,178,114,242,
+ 10,138, 74,202, 42,170,106,234, 26,154, 90,218, 58,186,122,250,
+ 6,134, 70,198, 38,166,102,230, 22,150, 86,214, 54,182,118,246,
+ 14,142, 78,206, 46,174,110,238, 30,158, 94,222, 62,190,126,254,
+ 1,129, 65,193, 33,161, 97,225, 17,145, 81,209, 49,177,113,241,
+ 9,137, 73,201, 41,169,105,233, 25,153, 89,217, 57,185,121,249,
+ 5,133, 69,197, 37,165,101,229, 21,149, 85,213, 53,181,117,245,
+ 13,141, 77,205, 45,173,109,237, 29,157, 93,221, 61,189,125,253,
+ 3,131, 67,195, 35,163, 99,227, 19,147, 83,211, 51,179,115,243,
+ 11,139, 75,203, 43,171,107,235, 27,155, 91,219, 59,187,123,251,
+ 7,135, 71,199, 39,167,103,231, 23,151, 87,215, 55,183,119,247,
+ 15,143, 79,207, 47,175,111,239, 31,159, 95,223, 63,191,127,255,
+};
+
+/*
+ * Mirror2: bits 01234567 become 67452301
+ */
+unsigned char Mirror2[256] =
+{
+ 0, 64,128,192, 16, 80,144,208, 32, 96,160,224, 48,112,176,240,
+ 4, 68,132,196, 20, 84,148,212, 36,100,164,228, 52,116,180,244,
+ 8, 72,136,200, 24, 88,152,216, 40,104,168,232, 56,120,184,248,
+ 12, 76,140,204, 28, 92,156,220, 44,108,172,236, 60,124,188,252,
+ 1, 65,129,193, 17, 81,145,209, 33, 97,161,225, 49,113,177,241,
+ 5, 69,133,197, 21, 85,149,213, 37,101,165,229, 53,117,181,245,
+ 9, 73,137,201, 25, 89,153,217, 41,105,169,233, 57,121,185,249,
+ 13, 77,141,205, 29, 93,157,221, 45,109,173,237, 61,125,189,253,
+ 2, 66,130,194, 18, 82,146,210, 34, 98,162,226, 50,114,178,242,
+ 6, 70,134,198, 22, 86,150,214, 38,102,166,230, 54,118,182,246,
+ 10, 74,138,202, 26, 90,154,218, 42,106,170,234, 58,122,186,250,
+ 14, 78,142,206, 30, 94,158,222, 46,110,174,238, 62,126,190,254,
+ 3, 67,131,195, 19, 83,147,211, 35, 99,163,227, 51,115,179,243,
+ 7, 71,135,199, 23, 87,151,215, 39,103,167,231, 55,119,183,247,
+ 11, 75,139,203, 27, 91,155,219, 43,107,171,235, 59,123,187,251,
+ 15, 79,143,207, 31, 95,159,223, 47,111,175,239, 63,127,191,255,
+};
+
+/*
+ * Mirror4: bits 01234567 become 45670123
+ */
+unsigned char Mirror4[256] =
+{
+ 0, 16, 32, 48, 64, 80, 96,112,128,144,160,176,192,208,224,240,
+ 1, 17, 33, 49, 65, 81, 97,113,129,145,161,177,193,209,225,241,
+ 2, 18, 34, 50, 66, 82, 98,114,130,146,162,178,194,210,226,242,
+ 3, 19, 35, 51, 67, 83, 99,115,131,147,163,179,195,211,227,243,
+ 4, 20, 36, 52, 68, 84,100,116,132,148,164,180,196,212,228,244,
+ 5, 21, 37, 53, 69, 85,101,117,133,149,165,181,197,213,229,245,
+ 6, 22, 38, 54, 70, 86,102,118,134,150,166,182,198,214,230,246,
+ 7, 23, 39, 55, 71, 87,103,119,135,151,167,183,199,215,231,247,
+ 8, 24, 40, 56, 72, 88,104,120,136,152,168,184,200,216,232,248,
+ 9, 25, 41, 57, 73, 89,105,121,137,153,169,185,201,217,233,249,
+ 10, 26, 42, 58, 74, 90,106,122,138,154,170,186,202,218,234,250,
+ 11, 27, 43, 59, 75, 91,107,123,139,155,171,187,203,219,235,251,
+ 12, 28, 44, 60, 76, 92,108,124,140,156,172,188,204,220,236,252,
+ 13, 29, 45, 61, 77, 93,109,125,141,157,173,189,205,221,237,253,
+ 14, 30, 46, 62, 78, 94,110,126,142,158,174,190,206,222,238,254,
+ 15, 31, 47, 63, 79, 95,111,127,143,159,175,191,207,223,239,255,
+};
+
+void
+rotate_bytes_180(unsigned char *sp, unsigned char *ep, unsigned char *mirror)
+{
+ unsigned char tmp;
+
+ while (sp < ep)
+ {
+ tmp = mirror[*sp];
+ *sp = mirror[*ep];
+ *ep = tmp;
+ ++sp;
+ --ep;
+ }
+ if (sp == ep)
+ *sp = mirror[*sp];
+}
+
+void
+debug(int level, char *fmt, ...)
+{
+ va_list ap;
+
+ if (Debug < level)
+ return;
+
+ setvbuf(stderr, (char *) NULL, _IOLBF, BUFSIZ);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+}
+
+void
+error(int fatal, char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ if (fatal)
+ exit(fatal);
+}
+
+#if 0
+static void
+chunk_write(unsigned long type, unsigned long items, FILE *fp)
+{
+ XQX_HEADER chunk;
+ int rc;
+
+ chunk.type = be32(type);
+ chunk.items = be32(items);
+ rc = fwrite(&chunk, 1, sizeof(XQX_HEADER), fp);
+ if (rc == 0) error(1, "fwrite(1): rc == 0!\n");
+}
+
+static void
+item_uint32_write(unsigned long item, unsigned long value, FILE *fp)
+{
+ XQX_ITEM_UINT32 item_uint32;
+ int rc;
+
+ item_uint32.header.type = be32(item);
+ item_uint32.header.size = be32(sizeof(DWORD));
+ item_uint32.value = be32(value);
+ rc = fwrite(&item_uint32, 1, sizeof(XQX_ITEM_UINT32), fp);
+ if (rc == 0) error(1, "fwrite(2): rc == 0!\n");
+}
+
+static void
+item_bytelut_write(unsigned long item, unsigned long len, BYTE *buf, FILE *fp)
+{
+ XQX_ITEM_HEADER header;
+ int rc;
+
+ header.type = be32(item);
+ header.size = be32(len);
+ rc = fwrite(&header, 1, sizeof(XQX_ITEM_HEADER), fp);
+ if (rc == 0) error(1, "fwrite(3): rc == 0!\n");
+ rc = fwrite(buf, 1, len, fp);
+ if (rc == 0) error(1, "fwrite(4): rc == 0!\n");
+}
+#endif
+
+/*
+ * A linked list of compressed data
+ */
+typedef struct _BIE_CHAIN{
+ unsigned char *data;
+ size_t len;
+ struct _BIE_CHAIN *next;
+} BIE_CHAIN;
+
+void
+free_chain(BIE_CHAIN *chain)
+{
+ BIE_CHAIN *next;
+ next = chain;
+ while ((chain = next))
+ {
+ next = chain->next;
+ if (chain->data)
+ free(chain->data);
+ free(chain);
+ }
+}
+
+int
+write_plane(int planeNum, BIE_CHAIN **root, FILE *fp)
+{
+ BIE_CHAIN *current = *root;
+ //BIE_CHAIN *next;
+ int len;
+ int first;
+ BYTE *bih;
+ int rc;
+
+ debug(3, "Write Plane %d\n", planeNum);
+
+ /* error handling */
+ if (!current)
+ error(1,"There is no JBIG!\n");
+ if (!current->next)
+ error(1,"There is no or wrong JBIG header!\n");
+ if (current->len != 20)
+ error(1,"wrong BIH length\n");
+
+ bih = current->data;
+ first = 1;
+ for (current = *root; current && current->len; current = current->next)
+ {
+ if (current == *root)
+ {
+ }
+ else
+ {
+ len = current->len;
+ //next = current->next;
+
+ if (first)
+ {
+ fprintf(fp, "@PJL SET IMAGELEN=%d\r\n", 20+len);
+ fwrite(bih, 1, 20, fp);
+ }
+ else
+ {
+ fprintf(fp, "@PJL SET IMAGELEN=%d\r\n", len);
+ }
+#if 0
+ chunk_write(XQX_START_PLANE, 4, fp);
+ item_uint32_write(0x80000000, first ? 64 : 48, fp);
+ item_uint32_write(0x40000000, 0, fp);
+ if (first)
+ item_bytelut_write(XQXI_BIH, 20, bih, fp);
+ else
+ item_uint32_write(0x40000003, 1, fp);
+ item_uint32_write(XQXI_END, 0xdeadbeef, fp);
+
+ chunk_write(XQX_JBIG, len, fp);
+#endif
+ if (len)
+ {
+ rc = fwrite(current->data, 1, len, fp);
+ if (rc == 0) error(1, "fwrite(5): rc == 0!\n");
+ }
+
+#if 0
+ chunk_write(XQX_END_PLANE, 0, fp);
+#endif
+ first = 0;
+ }
+ }
+
+ free_chain(*root);
+
+ return 0;
+}
+
+void
+start_page(BIE_CHAIN **root, int nbie, FILE *ofp)
+{
+ //BIE_CHAIN *current = *root;
+ //unsigned long w, h;
+ //int nitems;
+ //int pause = 0;
+ static int pageno = 0;
+ #define STRARY(X, A) \
+ ((X) >= 0 && (X) < sizeof(A)/sizeof(A[0])) \
+ ? A[X] : "NORMAL"
+ char *strsource[] =
+ {
+ "",
+ "TRAY1", "MANUALFEED",
+ };
+ char *strmedia[] =
+ {
+ "",
+ "PLAINRECYCLE", "PAPER", "THIN", "THICK1", "RECYCLE"
+ };
+ char *strpaper[] =
+ {
+ "",
+ "LETTER", "LEGAL", "EXECUTIVE", "INVOICE",
+ "A4", "A5", "A6", "JISB5", "JISB6",
+ "16K_197x273", "16K_184x260", "16K_195x270",
+ };
+
+ fprintf(ofp, "@PJL SET PAGESTATUS=START\r\n");
+ fprintf(ofp, "@PJL SET COPIES=%d\r\n", Copies);
+ fprintf(ofp, "@PJL SET MEDIASOURCE=%s\r\n", STRARY(SourceCode, strsource));
+ fprintf(ofp, "@PJL SET MEDIATYPE=%s\r\n", STRARY(MediaCode, strmedia));
+ fprintf(ofp, "@PJL SET PAPER=%s\r\n", STRARY(PaperCode, strpaper));
+ fprintf(ofp, "@PJL SET PAPERWIDTH=%d\r\n", PageWidth);
+ fprintf(ofp, "@PJL SET PAPERLENGTH=%d\r\n", PageHeight);
+ fprintf(ofp, "@PJL SET RESOLUTION=%d\r\n", ResX);
+
+#if 0
+ /* error handling */
+ if (!current)
+ error(1, "There is no JBIG!\n");
+ if (!current->next)
+ error(1, "There is no or wrong JBIG header!\n");
+ if (current->len != 20 )
+ error(1,"wrong BIH length\n");
+
+ /* startpage, jbig_bih, jbig_bid, jbig_end, endpage */
+ w = (((long) current->data[ 4] << 24)
+ | ((long) current->data[ 5] << 16)
+ | ((long) current->data[ 6] << 8)
+ | (long) current->data[ 7]);
+ h = (((long) current->data[ 8] << 24)
+ | ((long) current->data[ 9] << 16)
+ | ((long) current->data[10] << 8)
+ | (long) current->data[11]);
+
+ nitems = 15;
+ if (Duplex != DMDUPLEX_OFF)
+ ++nitems;
+ pause = (PageNum == 1) ? 0 : 1;
+
+ chunk_write(XQX_START_PAGE, nitems, ofp);
+ item_uint32_write(0x80000000, (Duplex == DMDUPLEX_OFF) ? 180 : 192, ofp);
+ item_uint32_write(0x20000005, 1, ofp);
+ item_uint32_write(XQXI_DMDEFAULTSOURCE, SourceCode, ofp);
+ item_uint32_write(XQXI_DMMEDIATYPE, MediaCode, ofp);
+ item_uint32_write(0x20000007, 1, ofp);
+
+ item_uint32_write(XQXI_RESOLUTION_X, ResX, ofp);
+ item_uint32_write(XQXI_RESOLUTION_Y, ResY, ofp);
+ item_uint32_write(XQXI_RASTER_X, w, ofp);
+ item_uint32_write(XQXI_RASTER_Y, h, ofp);
+ item_uint32_write(XQXI_VIDEO_BPP, Bpp, ofp);
+
+ item_uint32_write(XQXI_VIDEO_X, RealWidth / Bpp,ofp);
+ item_uint32_write(XQXI_VIDEO_Y, h, ofp);
+ item_uint32_write(XQXI_ECONOMODE, EconoMode, ofp);
+ if (Duplex != DMDUPLEX_OFF)
+ {
+ item_uint32_write(XQXI_DUPLEX_PAUSE, pause, ofp);
+ if ((PageNum & 1) == 0 && EvenPages)
+ {
+ debug(1, "EvenPage: page %d seekindex %d\n", PageNum, SeekIndex);
+ SeekRec[SeekIndex].pause = ftell(EvenPages) - 4;
+ }
+ }
+ item_uint32_write(XQXI_DMPAPER, PaperCode, ofp);
+ item_uint32_write(XQXI_END, 0xdeadbeef, ofp);
+#endif
+
+ ++pageno;
+ if (IsCUPS)
+ fprintf(stderr, "PAGE: %d %d\n", pageno, Copies);
+}
+
+void
+end_page(FILE *ofp)
+{
+ fprintf(ofp, "@PJL SET DOTCOUNT=%d\r\n", 12345);
+ fprintf(ofp, "@PJL SET PAGESTATUS=END\r\n");
+ //chunk_write(XQX_END_PAGE, 0, ofp);
+}
+
+int
+write_page(BIE_CHAIN **root, BIE_CHAIN **root2,
+ BIE_CHAIN **root3, BIE_CHAIN **root4, FILE *ofp)
+{
+ int nbie = root2 ? 4 : 1;
+ int chainlen;
+ BIE_CHAIN *current = *root;
+
+ start_page(root, nbie, ofp);
+
+ chainlen = 0;
+ for (current = *root; current; current = current->next)
+ {
+ chainlen += current->len;
+ //fprintf(stderr, "chainlen = %d\n", chainlen);
+ }
+
+ if (OutputStartPlane)
+ write_plane(nbie == 1 ? 4 : 1, root, ofp);
+ else
+ write_plane(nbie == 1 ? 0 : 1, root, ofp);
+
+#if 0
+ if (root3)
+ write_plane(3, root3, ofp);
+ if (root2)
+ write_plane(2, root2, ofp);
+ if (root)
+ {
+ if (OutputStartPlane)
+ write_plane(nbie == 1 ? 4 : 1, root, ofp);
+ else
+ write_plane(nbie == 1 ? 0 : 1, root, ofp);
+ }
+ if (root4)
+ write_plane(4, root4, ofp);
+#endif
+
+ end_page(ofp);
+ return 0;
+}
+
+/*
+ * This creates a linked list of compressed data. The first item
+ * in the list is the BIH and is always 20 bytes in size. Each following
+ * item is 65536 bytes in length. The last item length is whatever remains.
+ */
+void
+output_jbig(unsigned char *start, size_t len, void *cbarg)
+{
+ BIE_CHAIN *current, **root = (BIE_CHAIN **) cbarg;
+ int size = 65536; // Printer does strange things otherwise.
+
+ if ( (*root) == NULL)
+ {
+ (*root) = malloc(sizeof(BIE_CHAIN));
+ if (!(*root))
+ error(1, "Can't allocate space for chain\n");
+
+ (*root)->data = NULL;
+ (*root)->next = NULL;
+ (*root)->len = 0;
+ size = 20;
+ if (len != 20)
+ error(1, "First chunk must be BIH and 20 bytes long\n");
+ }
+
+ current = *root;
+ while (current->next)
+ current = current->next;
+
+ while (len > 0)
+ {
+ int amt, left;
+
+ if (!current->data)
+ {
+ current->data = malloc(size);
+ if (!current->data)
+ error(1, "Can't allocate space for compressed data\n");
+ }
+
+ left = size - current->len;
+ amt = (len > left) ? left : len;
+ memcpy(current->data + current->len, start, amt);
+ current->len += amt;
+ len -= amt;
+ start += amt;
+
+ if (current->len == size)
+ {
+ current->next = malloc(sizeof(BIE_CHAIN));
+ if (!current->next)
+ error(1, "Can't allocate space for chain\n");
+ current = current->next;
+ current->data = NULL;
+ current->next = NULL;
+ current->len = 0;
+ }
+ }
+}
+
+void
+start_doc(FILE *fp)
+{
+ //char header[4] = ",XQX"; // Big-endian data
+ //int nitems;
+ time_t now;
+ struct tm *tmp;
+ char datetime[32+1];
+
+ now = time(NULL);
+ tmp = localtime(&now);
+ strftime(datetime, sizeof(datetime), "%Y/%m/%d %H:%M:%S", tmp);
+
+ fprintf(fp, "\033%%-12345X@PJL\r\n");
+ fprintf(fp, "@PJL SET TIMESTAMP=%s\r\n", datetime);
+ fprintf(fp, "@PJL SET FILENAME=%s\r\n", Filename ? Filename : "stdin");
+ fprintf(fp, "@PJL SET COMPRESS=JBIG\r\n");
+ fprintf(fp, "@PJL SET USERNAME=%s\r\n", Username ? Username : "root");
+ fprintf(fp, "@PJL SET COVER=OFF\r\n");
+
+#if 0
+ fwrite(header, 1, sizeof(header), fp);
+
+ nitems = 7;
+
+ chunk_write(XQX_START_DOC, nitems, fp);
+
+ item_uint32_write(0x80000000, 84, fp);
+ item_uint32_write(0x10000005, 1, fp);
+ item_uint32_write(0x10000001, 0, fp);
+ item_uint32_write(XQXI_DMDUPLEX, (Duplex != DMDUPLEX_OFF)
+ ? 2 : 0, fp);
+ item_uint32_write(0x10000000, 0, fp);
+ item_uint32_write(0x10000003, 1, fp);
+ item_uint32_write(XQXI_END, 0xdeadbeef, fp);
+#endif
+}
+
+void
+end_doc(FILE *fp)
+{
+ //int nitems;
+
+ //nitems = 0;
+ //chunk_write(XQX_END_DOC , nitems, fp);
+
+ fprintf(fp, "@PJL EOJ\r\n");
+ fprintf(fp, "\033%%-12345X\r\n");
+}
+
+static int AnyColor;
+
+void
+cmyk_planes(unsigned char *plane[4], unsigned char *raw, int w, int h)
+{
+ int rawbpl = (w+1) / 2;
+ int bpl = (w + 7) / 8;
+ int i;
+ int x, y;
+ unsigned char byte;
+ unsigned char mask[8] = { 128, 64, 32, 16, 8, 4, 2, 1 };
+ int aib = AllIsBlack;
+ int bc = BlackClears;
+
+ AnyColor = 0;
+ for (i = 0; i < 4; ++i)
+ memset(plane[i], 0, bpl * h);
+
+ //
+ // Unpack the combined plane into individual color planes
+ //
+ // TODO: this can be speeded up using a 256 or 65536 entry lookup table
+ //
+ for (y = 0; y < h; ++y)
+ {
+ for (x = 0; x < w; ++x)
+ {
+ byte = raw[y*rawbpl + x/2];
+
+ if (aib && (byte & 0xE0) == 0xE0)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ }
+ else if (byte & 0x10)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ if (!bc)
+ {
+ if (byte & 0x80) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x40) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x20) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE0) AnyColor |= byte;
+ }
+ }
+ else
+ {
+ if (byte & 0x80) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x40) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x20) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE0) AnyColor |= byte;
+ }
+
+ ++x;
+ if (aib && (byte & 0x0E) == 0x0E)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ }
+ else if (byte & 0x1)
+ {
+ plane[3][y*bpl + x/8] |= mask[x&7];
+ if (!bc)
+ {
+ if (byte & 0x8) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x4) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x2) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE) AnyColor |= byte;
+ }
+ }
+ else
+ {
+ if (byte & 0x8) plane[0][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x4) plane[1][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0x2) plane[2][y*bpl + x/8] |= mask[x&7];
+ if (byte & 0xE) AnyColor |= byte;
+ }
+ }
+ }
+ debug(2, "BlackClears = %d; AnyColor = %s %s %s\n",
+ BlackClears,
+ (AnyColor & 0x88) ? "Cyan" : "",
+ (AnyColor & 0x44) ? "Magenta" : "",
+ (AnyColor & 0x22) ? "Yellow" : ""
+ );
+}
+
+int
+cmyk_page(unsigned char *raw, int w, int h, FILE *ofp)
+{
+ BIE_CHAIN *chain[4];
+ int i;
+ int bpl = (w + 7) / 8;
+ unsigned char *plane[4], *bitmaps[4][1];
+ struct jbg_enc_state se[4];
+
+ RealWidth = w;
+ for (i = 0; i < 4; ++i)
+ {
+ plane[i] = malloc(bpl * h);
+ if (!plane[i]) error(3, "Cannot allocate space for bit plane\n");
+ chain[i] = NULL;
+ }
+
+ cmyk_planes(plane, raw, w, h);
+ for (i = 0; i < 4; ++i)
+ {
+ if (Debug >= 9)
+ {
+ FILE *dfp;
+ char fname[256];
+
+ sprintf(fname, "xxxplane%d", i);
+ dfp = fopen(fname, "w");
+ if (dfp)
+ {
+ fwrite(plane[i], bpl*h, 1, dfp);
+ fclose(dfp);
+ }
+ }
+
+ *bitmaps[i] = plane[i];
+
+ jbg_enc_init(&se[i], w, h, 1, bitmaps[i], output_jbig, &chain[i]);
+ jbg_enc_options(&se[i], JbgOptions[0], JbgOptions[1],
+ JbgOptions[2], JbgOptions[3], JbgOptions[4]);
+ jbg_enc_out(&se[i]);
+ jbg_enc_free(&se[i]);
+ }
+
+ if (Color2Mono)
+ write_page(&chain[Color2Mono-1], NULL, NULL, NULL, ofp);
+ else if (AnyColor)
+ write_page(&chain[0], &chain[1], &chain[2], &chain[3], ofp);
+ else
+ write_page(&chain[3], NULL, NULL, NULL, ofp);
+
+ for (i = 0; i < 4; ++i)
+ free(plane[i]);
+ return 0;
+}
+
+int
+pksm_page(unsigned char *plane[4], int w, int h, FILE *ofp)
+{
+ BIE_CHAIN *chain[4];
+ int i;
+ unsigned char *bitmaps[4][1];
+ struct jbg_enc_state se[4];
+
+ RealWidth = w;
+ for (i = 0; i < 4; ++i)
+ chain[i] = NULL;
+
+ for (i = 0; i < 4; ++i)
+ {
+ *bitmaps[i] = plane[i];
+
+ jbg_enc_init(&se[i], w, h, 1, bitmaps[i], output_jbig, &chain[i]);
+ jbg_enc_options(&se[i], JbgOptions[0], JbgOptions[1],
+ JbgOptions[2], JbgOptions[3], JbgOptions[4]);
+ jbg_enc_out(&se[i]);
+ jbg_enc_free(&se[i]);
+ }
+
+ if (Color2Mono)
+ write_page(&chain[Color2Mono-1], NULL, NULL, NULL, ofp);
+ else if (AnyColor)
+ write_page(&chain[0], &chain[1], &chain[2], &chain[3], ofp);
+ else
+ write_page(&chain[3], NULL, NULL, NULL, ofp);
+
+ return 0;
+}
+
+int
+pbm_page(unsigned char *buf, int w, int h, FILE *ofp)
+{
+ BIE_CHAIN *chain = NULL;
+ unsigned char *bitmaps[1];
+ struct jbg_enc_state se;
+
+ RealWidth = w;
+ //w = (w + 127) & ~127;
+
+ if (SaveToner)
+ {
+ int x, y;
+ int bpl, bpl16;
+
+ bpl = (w + 7) / 8;
+ bpl16 = (bpl + 15) & ~15;
+ bpl16 = bpl;
+
+ for (y = 0; y < h; y += 2)
+ for (x = 0; x < bpl16; ++x)
+ buf[y*bpl16 + x] &= 0x55;
+ for (y = 1; y < h; y += 2)
+ for (x = 0; x < bpl16; ++x)
+ buf[y*bpl16 + x] &= 0xaa;
+ }
+
+ *bitmaps = buf;
+
+ jbg_enc_init(&se, w, h, 1, bitmaps, output_jbig, &chain);
+ jbg_enc_options(&se, JbgOptions[0], JbgOptions[1],
+ JbgOptions[2], JbgOptions[3], JbgOptions[4]);
+ jbg_enc_out(&se);
+ jbg_enc_free(&se);
+
+ write_page(&chain, NULL, NULL, NULL, ofp);
+
+ return 0;
+}
+
+int
+read_and_clip_image(unsigned char *buf,
+ int rawBpl, int rightBpl, int pixelsPerByte,
+ int bpl, int h, int bpl16, FILE *ifp)
+{
+ unsigned char *rowbuf, *rowp;
+ int y;
+ int rc;
+
+ rowbuf = malloc(rawBpl);
+ if (!rowbuf)
+ error(1, "Can't allocate row buffer\n");
+
+ // Clip top rows
+ if (UpperLeftY)
+ {
+ for (y = 0; y < UpperLeftY; ++y)
+ {
+ rc = fread(rowbuf, rawBpl, 1, ifp);
+ if (rc == 0)
+ goto eof;
+ if (rc != 1)
+ error(1, "Premature EOF(1) on input at y=%d\n", y);
+ }
+ }
+
+ // Copy the rows that we want to image
+ rowp = buf;
+ for (y = 0; y < h; ++y, rowp += bpl16)
+ {
+ // Clip left pixel *bytes*
+ if (UpperLeftX)
+ {
+ rc = fread(rowbuf, UpperLeftX / pixelsPerByte, 1, ifp);
+ if (rc == 0 && y == 0 && !UpperLeftY)
+ goto eof;
+ if (rc != 1)
+ error(1, "Premature EOF(2) on input at y=%d\n", y);
+ }
+
+ if (bpl != bpl16)
+ memset(rowp, 0, bpl16);
+ rc = fread(rowp, bpl, 1, ifp);
+ if (rc == 0 && y == 0 && !UpperLeftY && !UpperLeftX)
+ goto eof;
+ if (rc != 1)
+ error(1, "Premature EOF(3) on input at y=%d\n", y);
+
+ // Clip right pixels
+ if (rightBpl != bpl)
+ {
+ rc = fread(rowbuf, rightBpl - bpl, 1, ifp);
+ if (rc != 1)
+ error(1, "Premature EOF(4) on input at y=%d\n", y);
+ }
+ }
+
+ // Clip bottom rows
+ if (LowerRightY)
+ {
+ for (y = 0; y < LowerRightY; ++y)
+ {
+ rc = fread(rowbuf, rawBpl, 1, ifp);
+ if (rc != 1)
+ error(1, "Premature EOF(5) on input at y=%d\n", y);
+ }
+ }
+
+ free(rowbuf);
+ return (0);
+
+eof:
+ free(rowbuf);
+ return (EOF);
+}
+
+int
+cmyk_pages(FILE *ifp, FILE *ofp)
+{
+ unsigned char *buf;
+ int rawW, rawH, rawBpl;
+ int rightBpl;
+ int w, h, bpl;
+ int rc;
+
+ //
+ // Save the original Upper Right clip values as the logical offset,
+ // because we may adjust them slightly below, in the interest of speed.
+ //
+ if (LogicalClip & LOGICAL_CLIP_X)
+ LogicalOffsetX = UpperLeftX;
+ if (LogicalClip & LOGICAL_CLIP_Y)
+ LogicalOffsetY = UpperLeftY;
+
+ rawW = PageWidth;
+ rawH = PageHeight;
+ rawBpl = (PageWidth + 1) / 2;
+
+ // We only clip multiples of 2 pixels off the leading edge, and
+ // add any remainder to the amount we clip from the right edge.
+ // Its fast, and good enough for government work.
+ LowerRightX += UpperLeftX & 1;
+ UpperLeftX &= ~1;
+
+ w = rawW - UpperLeftX - LowerRightX;
+ h = rawH - UpperLeftY - LowerRightY;
+ bpl = (w + 1) / 2;
+ rightBpl = (rawW - UpperLeftX + 1) / 2;
+
+ buf = malloc(bpl * h);
+ if (!buf)
+ error(1, "Unable to allocate page buffer of %d x %d = %d bytes\n",
+ rawW, rawH, rawBpl * rawH);
+
+ for (;;)
+ {
+ rc = read_and_clip_image(buf, rawBpl, rightBpl, 2, bpl, h, bpl, ifp);
+ if (rc == EOF)
+ goto done;
+
+ ++PageNum;
+ if (Duplex == DMDUPLEX_LONGEDGE && (PageNum & 1) == 0)
+ rotate_bytes_180(buf, buf + bpl * h - 1, Mirror4);
+ if (Duplex == DMDUPLEX_MANUALLONG && (PageNum & 1) == 0)
+ rotate_bytes_180(buf, buf + bpl * h - 1, Mirror4);
+
+ if ((PageNum & 1) == 0 && EvenPages)
+ {
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ cmyk_page(buf, w, h, EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "CMYK Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+ else
+ cmyk_page(buf, w, h, ofp);
+ }
+
+done:
+ free(buf);
+ return 0;
+}
+
+static unsigned long
+getint(FILE *fp)
+{
+ int c;
+ unsigned long i = 0;
+ int rc;
+
+ while ((c = getc(fp)) != EOF && !isdigit(c))
+ if (c == '#')
+ while ((c = getc(fp)) != EOF && !(c == 13 || c == 10)) ;
+ if (c != EOF)
+ {
+ ungetc(c, fp);
+ rc = fscanf(fp, "%lu", &i);
+ if (rc != 1) error(1, "fscanf: rc == 0!\n");
+ }
+ return i;
+}
+
+static void
+skip_to_nl(FILE *fp)
+{
+ for (;;)
+ {
+ int c;
+ c = getc(fp);
+ if (c == EOF)
+ error(1, "Premature EOF on input stream\n");
+ if (c == '\n')
+ return;
+ }
+}
+
+int
+pbm_header(FILE *ifp, int *p4eatenp, int *wp, int *hp)
+{
+ int c1, c2;
+
+ if (*p4eatenp)
+ *p4eatenp = 0; // P4 already eaten in main
+ else
+ {
+ c1 = getc(ifp);
+ if (c1 == EOF)
+ return 0;
+ c2 = getc(ifp);
+ if (c1 != 'P' || c2 != '4')
+ error(1, "Not a pbmraw data stream\n");
+ }
+
+ skip_to_nl(ifp);
+
+ *wp = getint(ifp);
+ *hp = getint(ifp);
+ skip_to_nl(ifp);
+ return 1;
+}
+
+int
+pksm_pages(FILE *ifp, FILE *ofp)
+{
+ unsigned char *plane[4];
+ int rawW, rawH, rawBpl;
+ int saveW = 0, saveH = 0;
+ int rightBpl;
+ int w, h, bpl;
+ int i;
+ int rc;
+ int p4eaten = 1;
+
+ //
+ // Save the original Upper Right clip values as the logical offset,
+ // because we may adjust them slightly below, in the interest of speed.
+ //
+ if (LogicalClip & LOGICAL_CLIP_X)
+ LogicalOffsetX = UpperLeftX;
+ if (LogicalClip & LOGICAL_CLIP_Y)
+ LogicalOffsetY = UpperLeftY;
+
+ for (;;)
+ {
+ ++PageNum;
+ AnyColor = 0;
+
+ for (i = 0; i < 4; ++i)
+ {
+ if (pbm_header(ifp, &p4eaten, &rawW, &rawH) == 0)
+ {
+ if (i == 0)
+ goto eof;
+ else
+ error(1, "Premature EOF(pksm) on page %d hdr, plane %d\n",
+ PageNum, i);
+ }
+ if (i == 0)
+ {
+ saveW = rawW;
+ saveH = rawH;
+ }
+ if (saveW != rawW)
+ error(1, "Image width changed from %d to %d on plane %d\n",
+ saveW, rawW, i);
+ if (saveH != rawH)
+ error(1, "Image height changed from %d to %d on plane %d\n",
+ saveH, rawH, i);
+
+ rawBpl = (rawW + 7) / 8;
+
+ // We only clip multiples of 8 pixels off the leading edge, and
+ // add any remainder to the amount we clip from the right edge.
+ // Its fast, and good enough for government work.
+ LowerRightX += UpperLeftX & 7;
+ UpperLeftX &= ~7;
+
+ w = rawW - UpperLeftX - LowerRightX;
+ h = rawH - UpperLeftY - LowerRightY;
+ bpl = (w + 7) / 8;
+ rightBpl = (rawW - UpperLeftX + 7) / 8;
+
+ plane[i] = malloc(bpl * h);
+ if (!plane[i])
+ error(1, "Can't allocate plane buffer\n");
+
+ rc = read_and_clip_image(plane[i],
+ rawBpl, rightBpl, 8, bpl, h, bpl, ifp);
+ if (rc == EOF)
+ error(1, "Premature EOF(pksm) on page %d data, plane %d\n",
+ PageNum, i);
+
+ if (Debug >= 9)
+ {
+ FILE *dfp;
+ char fname[256];
+
+ sprintf(fname, "xxxplane%d", i);
+ dfp = fopen(fname, "w");
+ if (dfp)
+ {
+ fwrite(plane[i], bpl*h, 1, dfp);
+ fclose(dfp);
+ }
+ }
+
+ // See if we can optimize this to be a monochrome page
+ if (!AnyColor && i != 3)
+ {
+ unsigned char *p, *e;
+
+ for (p = plane[i], e = p + bpl*h; p < e; ++p)
+ if (*p)
+ {
+ AnyColor |= 1<<i;
+ break;
+ }
+ }
+
+ if (Duplex == DMDUPLEX_LONGEDGE && (PageNum & 1) == 0)
+ rotate_bytes_180(plane[i], plane[i] + bpl * h - 1, Mirror1);
+ if (Duplex == DMDUPLEX_MANUALLONG && (PageNum & 1) == 0)
+ rotate_bytes_180(plane[i], plane[i] + bpl * h - 1, Mirror1);
+ }
+
+ debug(2, "AnyColor = %s %s %s\n",
+ (AnyColor & 0x01) ? "Cyan" : "",
+ (AnyColor & 0x02) ? "Magenta" : "",
+ (AnyColor & 0x04) ? "Yellow" : ""
+ );
+
+ if ((PageNum & 1) == 0 && EvenPages)
+ {
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ pksm_page(plane, w, h, EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "PKSM Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+ else
+ pksm_page(plane, w, h, ofp);
+
+ for (i = 0; i < 4; ++i)
+ free(plane[i]);
+ }
+eof:
+ return (0);
+}
+
+int
+pbm_pages(FILE *ifp, FILE *ofp)
+{
+ unsigned char *buf;
+ int rawW, rawH, rawBpl;
+ int rightBpl;
+ int w, h, bpl;
+ int bpl16 = 0;
+ int rc;
+ int p4eaten = 1;
+
+ //
+ // Save the original Upper Right clip values as the logical offset,
+ // because we may adjust them slightly below, in the interest of speed.
+ //
+ if (LogicalClip & LOGICAL_CLIP_X)
+ LogicalOffsetX = UpperLeftX;
+ if (LogicalClip & LOGICAL_CLIP_Y)
+ LogicalOffsetY = UpperLeftY;
+
+ for (;;)
+ {
+ if (pbm_header(ifp, &p4eaten, &rawW, &rawH) == 0)
+ break;
+
+ rawBpl = (rawW + 7) / 8;
+
+ // We only clip multiples of 8 pixels off the leading edge, and
+ // add any remainder to the amount we clip from the right edge.
+ // Its fast, and good enough for government work.
+ LowerRightX += UpperLeftX & 7;
+ UpperLeftX &= ~7;
+
+ w = rawW - UpperLeftX - LowerRightX;
+ h = rawH - UpperLeftY - LowerRightY;
+ bpl = (w + 7) / 8;
+ rightBpl = (rawW - UpperLeftX + 7) / 8;
+
+ bpl16 = (bpl + 15) & ~15;
+ bpl16 = bpl;
+ debug(1, "bpl=%d bpl16=%d\n", bpl, bpl16);
+
+ buf = malloc(bpl16 * h);
+ if (!buf)
+ error(1, "Can't allocate page buffer\n");
+
+ rc = read_and_clip_image(buf, rawBpl, rightBpl, 8, bpl, h, bpl16, ifp);
+ if (rc == EOF)
+ error(1, "Premature EOF(pbm) on input stream\n");
+
+ ++PageNum;
+ if (Duplex == DMDUPLEX_LONGEDGE && (PageNum & 1) == 0)
+ rotate_bytes_180(buf, buf + bpl16 * h - 1, Mirror1);
+
+ if ((PageNum & 1) == 0 && EvenPages)
+ {
+ if (Duplex == DMDUPLEX_MANUALLONG)
+ rotate_bytes_180(buf, buf + bpl16 * h - 1, Mirror1);
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ pbm_page(buf, w, h, EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "PBM Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+ else
+ pbm_page(buf, w, h, ofp);
+
+ free(buf);
+ }
+ return (0);
+}
+
+void
+blank_page(FILE *ofp)
+{
+ int w, h, bpl, bpl16 = 0;
+ unsigned char *plane;
+
+ w = PageWidth - UpperLeftX - LowerRightX;
+ h = PageHeight - UpperLeftY - LowerRightY;
+ bpl = (w + 7) / 8;
+ bpl16 = (bpl + 15) & ~15;
+ bpl16 = bpl;
+
+ plane = malloc(bpl16 * h);
+ if (!plane)
+ error(1, "Unable to allocate blank plane (%d bytes)\n", bpl16*h);
+ memset(plane, 0, bpl16*h);
+
+ pbm_page(plane, w, h, ofp);
+ ++PageNum;
+ free(plane);
+}
+
+int
+parse_xy(char *str, int *xp, int *yp)
+{
+ char *p;
+
+ if (!str || str[0] == 0) return -1;
+
+ *xp = strtoul(str, &p, 10);
+ if (str == p) return -2;
+ while (*p && (*p < '0' || *p > '9'))
+ ++p;
+ str = p;
+ if (str[0] == 0) return -3;
+ *yp = strtoul(str, &p, 10);
+ if (str == p) return -4;
+ return (0);
+}
+
+void
+do_one(FILE *in)
+{
+ int mode;
+
+ if (Mode == MODE_COLOR)
+ {
+ error(1, "Color is unimplemented right now.\n");
+ mode = getc(in);
+ if (mode != 'P')
+ {
+ ungetc(mode, in);
+ cmyk_pages(in, stdout);
+ }
+ else
+ {
+ mode = getc(in);
+ if (mode == '4')
+ pksm_pages(in, stdout);
+ else
+ error(1, "Not a pksmraw file!\n");
+ }
+ }
+ else
+ {
+ mode = getc(in);
+ if (mode != 'P')
+ error(1, "Not a pbm file!\n");
+ mode = getc(in);
+ if (mode == '4')
+ pbm_pages(in, stdout);
+ else
+ error(1, "Not a pbmraw file!\n");
+ }
+}
+
+int
+main(int argc, char *argv[])
+{
+ int c;
+ int i, j;
+
+ while ( (c = getopt(argc, argv,
+ "cd:g:n:m:p:r:s:tT:u:l:L:ABPJ:S:U:X:D:V?h")) != EOF)
+ switch (c)
+ {
+ case 'c': Mode = MODE_COLOR; break;
+ case 'S': Color2Mono = atoi(optarg);
+ Mode = MODE_COLOR;
+ if (Color2Mono < 0 || Color2Mono > 4)
+ error(1, "Illegal value '%s' for -C\n", optarg);
+ break;
+ case 'd': Duplex = atoi(optarg); break;
+ case 'g': if (parse_xy(optarg, &PageWidth, &PageHeight))
+ error(1, "Illegal format '%s' for -g\n", optarg);
+ if (PageWidth < 0 || PageWidth > 1000000)
+ error(1, "Illegal X value '%s' for -g\n", optarg);
+ if (PageHeight < 0 || PageHeight > 1000000)
+ error(1, "Illegal Y value '%s' for -g\n", optarg);
+ break;
+ case 'm': MediaCode = atoi(optarg); break;
+ case 'n': Copies = atoi(optarg); break;
+ case 'p': PaperCode = atoi(optarg); break;
+ case 'r': if (parse_xy(optarg, &ResX, &ResY))
+ error(1, "Illegal format '%s' for -r\n", optarg);
+ break;
+ case 's': SourceCode = atoi(optarg); break;
+ case 't': SaveToner = 1; break;
+ case 'T': PrintDensity = atoi(optarg);
+ if (PrintDensity < 1 || PrintDensity > 5)
+ error(1, "Illegal value '%s' for PrintDensity -T\n",
+ optarg);
+ break;
+ case 'u':
+ if (strcmp(optarg, "0") == 0)
+ break;
+ if (parse_xy(optarg, &UpperLeftX, &UpperLeftY))
+ error(1, "Illegal format '%s' for -u\n", optarg);
+ break;
+ case 'l':
+ if (strcmp(optarg, "0") == 0)
+ break;
+ if (parse_xy(optarg, &LowerRightX, &LowerRightY))
+ error(1, "Illegal format '%s' for -l\n", optarg);
+ break;
+ case 'L': LogicalClip = atoi(optarg);
+ if (LogicalClip < 0 || LogicalClip > 3)
+ error(1, "Illegal value '%s' for -L\n", optarg);
+ break;
+ case 'A': AllIsBlack = !AllIsBlack; break;
+ case 'B': BlackClears = !BlackClears; break;
+ case 'P': OutputStartPlane = !OutputStartPlane; break;
+ case 'J': if (optarg[0]) Filename = optarg; break;
+ case 'U': if (optarg[0]) Username = optarg; break;
+ case 'X': ExtraPad = atoi(optarg); break;
+ case 'D': Debug = atoi(optarg); break;
+ case 'V': printf("%s\n", Version); exit(0);
+ default: usage(); exit(1);
+ }
+
+ if (UpperLeftX < 0 || UpperLeftX >= PageWidth)
+ error(1, "Illegal X value '%d' for -u\n", UpperLeftX);
+ if (UpperLeftY < 0 || UpperLeftY >= PageHeight)
+ error(1, "Illegal Y value '%d' for -u\n", UpperLeftY);
+ if (LowerRightX < 0 || LowerRightX >= PageWidth)
+ error(1, "Illegal X value '%d' for -l\n", LowerRightX);
+ if (LowerRightY < 0 || LowerRightY >= PageHeight)
+ error(1, "Illegal Y value '%d' for -l\n", LowerRightY);
+
+ argc -= optind;
+ argv += optind;
+
+ if (getenv("DEVICE_URI"))
+ IsCUPS = 1;
+
+ Bpp = ResX / 600;
+ //ResX = 600;
+ if (SaveToner)
+ {
+ SaveToner = 0;
+ EconoMode = 1;
+ }
+
+ switch (Duplex)
+ {
+ case DMDUPLEX_LONGEDGE:
+ case DMDUPLEX_SHORTEDGE:
+ case DMDUPLEX_MANUALLONG:
+ case DMDUPLEX_MANUALSHORT:
+ EvenPages = tmpfile();
+ break;
+ }
+
+ start_doc(stdout);
+
+ if (argc == 0)
+ {
+ do_one(stdin);
+ }
+ else
+ {
+ for (i = 0; i < argc; ++i)
+ {
+ FILE *ifp;
+
+ ifp = fopen(argv[i], "r");
+ if (!ifp)
+ error(1, "Can't open '%s' for reading\n", argv[i]);
+ do_one(ifp);
+ fclose(ifp);
+ }
+ }
+
+ /*
+ * Do manual duplex
+ */
+ if (EvenPages)
+ {
+ DWORD pause;
+
+ // Handle odd page count
+ if ( (PageNum & 1) == 1)
+ {
+ SeekRec[SeekIndex].b = ftell(EvenPages);
+ blank_page(EvenPages);
+ SeekRec[SeekIndex].e = ftell(EvenPages);
+ debug(1, "Blank Page: %d %ld %ld\n",
+ PageNum, SeekRec[SeekIndex].b, SeekRec[SeekIndex].e);
+ SeekIndex++;
+ }
+
+ /*
+ * Manual Pause
+ */
+ // Write even pages in reverse order
+ for (i = SeekIndex-1; i >= 0; --i)
+ {
+ int rc;
+
+ debug(1, "EvenPage: %d %ld %ld %ld\n",
+ i, SeekRec[i].b, SeekRec[i].e, SeekRec[i].pause);
+ fseek(EvenPages, SeekRec[i].pause, 0L);
+ if (i == SeekIndex-1)
+ pause = be32(2);
+ else
+ pause = be32(3);
+ rc = fwrite(&pause, 1, sizeof(DWORD), EvenPages);
+ if (rc == 0) error(1, "fwrite(10): rc == 0!\n");
+
+ fseek(EvenPages, SeekRec[i].b, 0L);
+ for (j = 0; j < (SeekRec[i].e - SeekRec[i].b); ++j)
+ putc(getc(EvenPages), stdout);
+ }
+ fclose(EvenPages);
+ }
+
+ end_doc(stdout);
+
+ exit(0);
+}
diff --git a/foo2hiperc.c b/foo2hiperc.c
index 509028c..2a8fe7e 100644
--- a/foo2hiperc.c
+++ b/foo2hiperc.c
@@ -48,7 +48,7 @@ yourself.
*/
-static char Version[] = "$Id: foo2hiperc.c,v 1.35 2013/12/01 20:13:58 rick Exp $";
+static char Version[] = "$Id: foo2hiperc.c,v 1.36 2017/03/20 16:35:04 rick Exp $";
#include <stdio.h>
#include <stdlib.h>
@@ -1645,8 +1645,8 @@ main(int argc, char *argv[])
if (getenv("DEVICE_URI"))
IsCUPS = 1;
-if (getenv("ccc"))
- Compressed = 1;
+ if (getenv("ccc"))
+ Compressed = 1;
Bpp = ResX / 600;
//ResX = 600;
diff --git a/foomatic-db/driver/foo2ddst.xml b/foomatic-db/driver/foo2ddst.xml
new file mode 100644
index 0000000..b8a048a
--- /dev/null
+++ b/foomatic-db/driver/foo2ddst.xml
@@ -0,0 +1,20 @@
+<driver id="driver/foo2ddst">
+ <name>foo2ddst</name>
+ <url>http://foo2ddst.rkkda.com/</url>
+ <execution>
+ <filter />
+ <prototype>foo2ddst-wrapper %A</prototype>
+ </execution>
+ <comments> <en>
+
+ This is a driver developed for the Ricoh Aficio SP 112 and SP 201.
+
+ &lt;p&gt;
+
+ </en> </comments>
+ <printers>
+ <printer><id>printer/Ricoh-SP_112</id></printer>
+ <printer><id>printer/Ricoh-SP_201Nw</id></printer>
+ <printer><id>printer/Generic-DDST_Printer</id></printer>
+ </printers>
+</driver>
diff --git a/foomatic-db/opt/foo2ddst-InputSlot.xml b/foomatic-db/opt/foo2ddst-InputSlot.xml
new file mode 100644
index 0000000..68f416d
--- /dev/null
+++ b/foomatic-db/opt/foo2ddst-InputSlot.xml
@@ -0,0 +1,32 @@
+<option type="enum" id="opt/foo2ddst-InputSlot">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname> <en>Media Source</en> </arg_longname>
+ <arg_shortname> <en>InputSlot</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>150</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>-s%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2ddst</driver>
+ <arg_defval>ev/foo2ddst-InputSlot-1</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2ddst-InputSlot-1">
+ <ev_longname> <en>Tray 1</en> </ev_longname>
+ <ev_shortname> <en>Tray1</en> </ev_shortname>
+ <ev_driverval>1</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-InputSlot-2">
+ <ev_longname> <en>Manual Feed</en> </ev_longname>
+ <ev_shortname> <en>Manual</en> </ev_shortname>
+ <ev_driverval>2</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2ddst-MediaType.xml b/foomatic-db/opt/foo2ddst-MediaType.xml
new file mode 100644
index 0000000..4d3f9f1
--- /dev/null
+++ b/foomatic-db/opt/foo2ddst-MediaType.xml
@@ -0,0 +1,47 @@
+<option type="enum" id="opt/foo2ddst-MediaType">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname> <en>Media Type</en> </arg_longname>
+ <arg_shortname> <en>MediaType</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>150</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>-m%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2ddst</driver>
+ <arg_defval>ev/foo2ddst-MediaType-1</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2ddst-MediaType-1">
+ <ev_longname> <en>PlainAndRecycled</en> </ev_longname>
+ <ev_shortname> <en>PlainAndRecycled</en> </ev_shortname>
+ <ev_driverval>1</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-MediaType-2">
+ <ev_longname> <en>Plain</en> </ev_longname>
+ <ev_shortname> <en>Paper</en> </ev_shortname>
+ <ev_driverval>2</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-MediaType-3">
+ <ev_longname> <en>Thin</en> </ev_longname>
+ <ev_shortname> <en>Thin</en> </ev_shortname>
+ <ev_driverval>3</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-MediaType-4">
+ <ev_longname> <en>Thick 1</en> </ev_longname>
+ <ev_shortname> <en>Thick1</en> </ev_shortname>
+ <ev_driverval>4</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-MediaType-5">
+ <ev_longname> <en>Recycled</en> </ev_longname>
+ <ev_shortname> <en>Recycled</en> </ev_shortname>
+ <ev_driverval>5</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2ddst-PageSize.xml b/foomatic-db/opt/foo2ddst-PageSize.xml
new file mode 100644
index 0000000..7e3719f
--- /dev/null
+++ b/foomatic-db/opt/foo2ddst-PageSize.xml
@@ -0,0 +1,87 @@
+<option type="enum" id="opt/foo2ddst-PageSize">
+ <arg_longname> <en>Page Size</en> </arg_longname>
+ <arg_shortname> <en>PageSize</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>135</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>-p%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2ddst</driver>
+ <arg_defval>ev/foo2ddst-PageSize-1</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2ddst-PageSize-1">
+ <ev_longname> <en>Letter</en> </ev_longname>
+ <ev_shortname> <en>Letter</en> </ev_shortname>
+ <ev_driverval>1</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-2">
+ <ev_longname> <en>Legal</en> </ev_longname>
+ <ev_shortname> <en>Legal</en> </ev_shortname>
+ <ev_driverval>2</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-3">
+ <ev_longname> <en>Executive</en> </ev_longname>
+ <ev_shortname> <en>Executive</en> </ev_shortname>
+ <ev_driverval>3</ev_driverval>
+ </enum_val>
+<!--
+ <enum_val id="ev/foo2ddst-PageSize-4">
+ <ev_longname> <en>Invoice</en> </ev_longname>
+ <ev_shortname> <en>Invoice</en> </ev_shortname>
+ <ev_driverval>4</ev_driverval>
+ </enum_val>
+-->
+ <enum_val id="ev/foo2ddst-PageSize-5">
+ <ev_longname> <en>A4</en> </ev_longname>
+ <ev_shortname> <en>A4</en> </ev_shortname>
+ <ev_driverval>5</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-6">
+ <ev_longname> <en>A5</en> </ev_longname>
+ <ev_shortname> <en>A5</en> </ev_shortname>
+ <ev_driverval>6</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-7">
+ <ev_longname> <en>A7</en> </ev_longname>
+ <ev_shortname> <en>A7</en> </ev_shortname>
+ <ev_driverval>7</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-8">
+ <ev_longname> <en>B5 (JIS)</en> </ev_longname>
+ <ev_shortname> <en>B5jis</en> </ev_shortname>
+ <ev_driverval>8</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-9">
+ <ev_longname> <en>B6 (JIS)</en> </ev_longname>
+ <ev_shortname> <en>B6jis</en> </ev_shortname>
+ <ev_driverval>9</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-10">
+ <ev_longname> <en>16k 197x273</en> </ev_longname>
+ <ev_shortname> <en>w558h774</en> </ev_shortname>
+ <ev_driverval>10</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-11">
+ <ev_longname> <en>16k 184x260</en> </ev_longname>
+ <ev_shortname> <en>w522h737</en> </ev_shortname>
+ <ev_driverval>11</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-12">
+ <ev_longname> <en>16k 195x270</en> </ev_longname>
+ <ev_shortname> <en>w553h765</en> </ev_shortname>
+ <ev_driverval>12</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-PageSize-Custom">
+ <ev_longname> <en>Custom</en> </ev_longname>
+ <ev_shortname> <en>Custom</en> </ev_shortname>
+ <ev_driverval>Custom.%0x%1</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2ddst-Resolution.xml b/foomatic-db/opt/foo2ddst-Resolution.xml
new file mode 100644
index 0000000..a35f879
--- /dev/null
+++ b/foomatic-db/opt/foo2ddst-Resolution.xml
@@ -0,0 +1,36 @@
+<option type="enum" id="opt/foo2ddst-Resolution">
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <arg_longname> <en>Resolution</en> </arg_longname>
+ <arg_shortname> <en>Resolution</en> </arg_shortname>
+ <arg_execution>
+ <arg_group>General</arg_group>
+ <arg_order>130</arg_order>
+ <arg_spot>A</arg_spot>
+ <arg_required />
+ <arg_substitution />
+ <arg_proto>-r%s </arg_proto>
+ </arg_execution>
+ <constraints>
+ <constraint sense="true">
+ <driver>foo2ddst</driver>
+ <arg_defval>ev/foo2ddst-Resolution-600x600</arg_defval>
+ </constraint>
+ </constraints>
+ <enum_vals>
+ <enum_val id="ev/foo2ddst-Resolution-600x600">
+ <ev_longname> <en>600x600 dpi</en> </ev_longname>
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <ev_shortname> <en>600x600dpi</en> </ev_shortname>
+ <ev_driverval>600x600</ev_driverval>
+ </enum_val>
+ <enum_val id="ev/foo2ddst-Resolution-1200x600">
+ <ev_longname> <en>1200x600 dpi</en> </ev_longname>
+ <!-- A multilingual <comments> block can appear here, too;
+ it should be treated as documentation for the user. -->
+ <ev_shortname> <en>1200x600dpi</en> </ev_shortname>
+ <ev_driverval>1200x600</ev_driverval>
+ </enum_val>
+ </enum_vals>
+</option>
diff --git a/foomatic-db/opt/foo2xxx-Copies.xml b/foomatic-db/opt/foo2xxx-Copies.xml
index 9c1211b..173ef00 100644
--- a/foomatic-db/opt/foo2xxx-Copies.xml
+++ b/foomatic-db/opt/foo2xxx-Copies.xml
@@ -68,6 +68,10 @@
<driver>foo2hbpl2</driver>
<arg_defval>1</arg_defval>
</constraint>
+ <constraint sense="true">
+ <driver>foo2ddst</driver>
+ <arg_defval>1</arg_defval>
+ </constraint>
</constraints>
<arg_max>100</arg_max>
<arg_min>1</arg_min>
diff --git a/foomatic-db/printer/Ricoh-SP_112.xml b/foomatic-db/printer/Ricoh-SP_112.xml
new file mode 100644
index 0000000..453acd5
--- /dev/null
+++ b/foomatic-db/printer/Ricoh-SP_112.xml
@@ -0,0 +1,53 @@
+<printer id="printer/Ricoh-SP_112">
+ <make>Ricoh</make>
+ <model>SP 112</model>
+ <mechanism>
+ <laser/><!--not "color"-->
+ <resolution>
+ <dpi>
+ <x>600</x>
+ <y>600</y>
+ </dpi>
+ </resolution>
+ <margins>
+ <general>
+ <unit>inch</unit>
+ <top>0.2</top>
+ <bottom>0.2</bottom>
+ <left>0.2</left>
+ <right>0.2</right>
+ </general>
+ </margins>
+ <consumables>
+ <comments>
+ <en>Print cartridge (1200 prints) - $55</en>
+ </comments>
+ <partno>SP 100LA</partno>
+ </consumables>
+ </mechanism>
+ <url>https://www.ricoh-usa.com/en/products/pd/sp-112-black-and-white-laser-printer/_/R-407431</url>
+ <lang>
+ <proprietary/>
+ <!--no pjl--><!--No "text"?--></lang>
+<!--
+ <autodetect>
+ <parallel>
+ <ieee1284>MFG:Hewlett-Packard;MDL:HP LaserJet P1005;CMD:ACL;CLS:PRINTER;DES:HP LaserJet P1005;FWVER:20080415;</ieee1284>
+ <manufacturer>Hewlett-Packard</manufacturer>
+ <model>HP LaserJet P1005</model>
+ <commandset>XQX</commandset>
+ </parallel>
+ </autodetect>
+-->
+ <functionality>B</functionality>
+ <driver>foo2ddst</driver>
+ <!--no "contrib_url"-->
+ <comments>
+ <en>
+
+ This printer is supported by the foo2ddst free software printer driver.
+ &lt;p&gt;
+
+ </en>
+ </comments>
+</printer>
diff --git a/foomatic-db/printer/Ricoh-SP_201Nw.xml b/foomatic-db/printer/Ricoh-SP_201Nw.xml
new file mode 100644
index 0000000..a6dba31
--- /dev/null
+++ b/foomatic-db/printer/Ricoh-SP_201Nw.xml
@@ -0,0 +1,53 @@
+<printer id="printer/Ricoh-SP_201Nw">
+ <make>Ricoh</make>
+ <model>SP 201Nw</model>
+ <mechanism>
+ <laser/><!--not "color"-->
+ <resolution>
+ <dpi>
+ <x>600</x>
+ <y>600</y>
+ </dpi>
+ </resolution>
+ <margins>
+ <general>
+ <unit>inch</unit>
+ <top>0.2</top>
+ <bottom>0.2</bottom>
+ <left>0.2</left>
+ <right>0.2</right>
+ </general>
+ </margins>
+ <consumables>
+ <comments>
+ <en>Print cartridge (1500 prints) - $75</en>
+ </comments>
+ <partno>SP 201LA</partno>
+ </consumables>
+ </mechanism>
+ <url>https://www.ricoh-usa.com/en/products/pd/sp-201nw-black-and-white-laser-printer/_/R-407203</url>
+ <lang>
+ <proprietary/>
+ <!--no pjl--><!--No "text"?--></lang>
+<!--
+ <autodetect>
+ <parallel>
+ <ieee1284>MFG:Hewlett-Packard;MDL:HP LaserJet P1005;CMD:ACL;CLS:PRINTER;DES:HP LaserJet P1005;FWVER:20080415;</ieee1284>
+ <manufacturer>Hewlett-Packard</manufacturer>
+ <model>HP LaserJet P1005</model>
+ <commandset>XQX</commandset>
+ </parallel>
+ </autodetect>
+-->
+ <functionality>B</functionality>
+ <driver>foo2ddst</driver>
+ <!--no "contrib_url"-->
+ <comments>
+ <en>
+
+ This printer is supported by the foo2ddst free software printer driver.
+ &lt;p&gt;
+
+ </en>
+ </comments>
+</printer>
diff --git a/icc2ps/Makefile b/icc2ps/Makefile
index fab1d01..f3abb99 100644
--- a/icc2ps/Makefile
+++ b/icc2ps/Makefile
@@ -41,7 +41,7 @@ man: foo2zjs-icc2ps.1
-e "s@\$${URLSLX}@$(URLSLX)@" \
-e "s@\$${URLHC}@$(URLHC)@" \
-e "s/\$${MODver}/$$MODver/"
- chmod -w $*.1
+ chmod a-w $*.1
install-man: man
$(INSTALL) -d -m 755 $(MANDIR)
diff --git a/osx-hotplug/Makefile b/osx-hotplug/Makefile
index c588aa4..936b977 100644
--- a/osx-hotplug/Makefile
+++ b/osx-hotplug/Makefile
@@ -36,7 +36,7 @@ man: osx-hplj-hotplug.1
-e "s@\$${URLSLX}@$(URLSLX)@" \
-e "s@\$${URLHC}@$(URLHC)@" \
-e "s/\$${MODver}/$$MODver/"
- chmod -w $*.1
+ chmod a-w $*.1
install: all
$(INSTALL) -c osx-hplj-hotplug $(BIN)/
diff --git a/osx-hotplug/osx-hplj-hotplug.1in b/osx-hotplug/osx-hplj-hotplug.1in
index 317c20f..326d066 100644
--- a/osx-hotplug/osx-hplj-hotplug.1in
+++ b/osx-hotplug/osx-hplj-hotplug.1in
@@ -31,7 +31,7 @@ Set Debug level [0].
.SH FILES
.BR /usr/share/foo2*/firmware/*
.SH SEE ALSO
-.BR /etc/rc.local,
+.BR /etc/rc.local
.SH "AUTHOR"
Rick Richardson <rick.richardson@comcast.net>
.br
diff --git a/regress.txt b/regress.txt
index 93a83ff..dd2333e 100644
--- a/regress.txt
+++ b/regress.txt
@@ -4,6 +4,7 @@ eafcf2ab43e8ecea78d1663491629869 testpage.zm 7.05 i386
3365dcef45a03b3686c00da0f5f711c3 testpage.zm 8.61 i386
b0fe6c289308ebc086328c2944ce915c testpage.zm 9.07 x86_64 f19
fd5e020d0c009f1733e51e7303820235 testpage.zm 9.14 x86_64 f19
+d9acc8761b0259ccd2439099465da068 testpage.zm 9.20 x86_64 f23
#
94b77586bab210ad54eaf7b652817a4c testpage.zc10 7.05
@@ -15,6 +16,7 @@ e2b8cd9191afe74bf684e7655f48f372 testpage.zc10 8.71
bcf8f73383eebb4da0d6a0fd03732c90 testpage.zc10 8.71 f16
23546ba41a46973bc70664030a65cb6c testpage.zc10 9.07 x86_64 f19
6f697e3c66bd22e19a8c25056beb5949 testpage.zc10 9.14 x86_64 f19
+d884b7684885abbec95b0d6867bbc5dd testpage.zc10 9.20 x86_64 f23
#
29788ba74874c9be35ab1f8bcc5719b6 testpage.zc1 7.05
@@ -43,6 +45,7 @@ f30e09990c7c2ad460074fb38c3a1720 lj1000.zm 8.60amd
46d4a9157a2282a64a9b37e361b0059c lj1000.zm 8.62amd
98bda2da23dfd94c40f96ef7be1533b3 lj1000.zm 9.07 x86_64 f19
3e1a545894d571061fca0ba443daa465 lj1000.zm 9.14 x86_64 f19
+12c9f616a7fba2a1234b2076cf91ea16 lj1000.zm 9.20 x86_64 f23
#
afed329ee495b7575b908680a2512c30 lj1020.zm 7.05
@@ -53,6 +56,7 @@ d8f28750c1dacc2066eee1e0a050e60c lj1020.zm 8.71
518482229bed6d3cb23f66b7f7f9a685 lj1020.zm 8.71 f16
59c71a09255fe1d84e22c372d4d6704a lj1020.zm 9.07 x86_64 f19
9900771e2963b03b61f163434de84c94 lj1020.zm 9.14 x86_64 f19
+dc91007cb42fc49101b5d97f9053193a lj1020.zm 9.20 x86_64 f23
#
b4ccadb72f1b386b1caabeed85c269dd lj2600.zm1 7.05
@@ -61,6 +65,7 @@ b4ccadb72f1b386b1caabeed85c269dd lj2600.zm1 7.05
a768fc2854434276dd8a274896af5d4f lj2600.zm1 8.62amd
70b31b8f35702091da0673fb29a3d7c5 lj2600.zm1 9.07 x86_64 f19
af3cb950122a621700ca71d73ae91d13 lj2600.zm1 9.14 x86_64 f19
+0637ceb08277689016ebc2d7309ad3ca lj2600.zm1 9.20 x86_64 f23
#
500ee54205b85d18407b56cfea5cbb02 lj2600.zc1 7.05
@@ -71,3 +76,4 @@ ddcdc6e87de6560bfc4e6053509ad575 lj2600.zc1 8.62amd
3b0fa7c37af9c3069e285f5fc81b62a3 lj2600.zc1 8.71
45ae0df794f2ada19fa63f7ca8edc5ac lj2600.zc1 8.71 f16
80c09c01f555bc4fa9a27099d0a2ecfe lj2600.zc1 9.07 x86_64 f19
+5a8df35fef1da08cadf557b9d6582517 lj2600.zc1 9.20 x86_64 f23