home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-20 | 29.3 KB | 1,014 lines |
- Newsgroups: comp.sources.x
- From: tetsuji@rai.juice.or.jp (Tetsuji Rai)
- Subject: v21i016: xwinpr - Print an X-Window, Part01/01
- Message-ID: <1993Oct20.204038.27857@sparky.sterling.com>
- X-Md4-Signature: 03c18b4b40d1bc2677909ef2967d7eef
- Sender: chris@sparky.sterling.com (Chris Olson)
- Organization: Sterling Software
- Date: Wed, 20 Oct 1993 20:40:38 GMT
- Approved: chris@sterling.com
-
- Submitted-by: tetsuji@rai.juice.or.jp (Tetsuji Rai)
- Posting-number: Volume 21, Issue 16
- Archive-name: xwinpr/part01
- Environment: C++, Canon, LipsII+, X11
-
- [ This at least tried to print on my system (I don't have the right ]
- [ printer for more ... ) ]
- [ Chris ]
-
- This is a hardcopy program for X Windows.
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # Contents: README Imakefile Makefile patchlevel.h xwinpr.C xwinpr.man
- # Wrapped by chris@sparky on Wed Oct 20 15:32:13 1993
- PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 1 (of 1)."'
- if test -f 'README' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'README'\"
- else
- echo shar: Extracting \"'README'\" \(2000 characters\)
- sed "s/^X//" >'README' <<'END_OF_FILE'
- XXwinpr - hardcopy program.(ver.1.0)
- X
- X
- X This is a hardcopy program for X Windows.
- X
- X
- XRequirements, supported hardware:
- X---------------------------------
- X
- X1. Printer should support Canon LipsII+. But other printers may
- X work with minor modifications. I haven't tested.
- X2. C++. Originally it is compiled with g++ 2.3.3, but other C++ compilers
- X will be good.
- X3. This was made on BSD/386 (which identifies itself by defining "bsdi"),
- X but should work on many platforms with minor fixes. This uses only
- X basic functions of Un?x and C++.
- X
- X
- XInstallation:
- X-------------
- X Simply xmkmf and make. If you don't have xmkmf or imake, then modify
- XMakefile in this package and use it. To install, "make install", and
- Xto install the manual, "make install.man".
- X
- X
- XUsage:
- X------
- X Invoke this program, and the cursor will change to a crosshair. Move
- Xthe cursor to the window you want to print out, at the precise point you
- Xwant to print as white. The other colors will be black on the print.
- XFor command options, read the man page or invoke "xwinpr -help".
- X
- X
- XSupport:
- X--------
- X There will be no official support for this program, but I'll appreciate
- Xreceiving any bug, suggestions or improvements. Since this is now limited
- Xto only a small variety of hardware, your port to other platforms is
- Xvery welcome! Please send me know your patch. In that case, original
- Xcodes shall be enclosed by "#ifdef bsdi" and "#endif" or the likes.
- XFixes will be out sooner or later (sorry if there are delays).
- X
- X
- XHints:
- X------
- X This software uses only 7bit character codes. So you can use this
- Xwithout caring about the high bits.
- X
- X
- XCopyright:
- X----------
- X Permission to use, copy, modify, distribute, and sell this software is
- Xgranted without fee, but only when with copyright notice which appears
- Xin Imakefile and xwinpr.C. Tetsuji Rai makes no representations about
- Xthe suitability of this software for any purpose.
- X
- X
- X
- XHappy printing!
- X
- X
- X Tetsuji Rai
- X (tetsuji@rai.juice.or.jp 74610.1537@compuserve.com)
- END_OF_FILE
- if test 2000 -ne `wc -c <'README'`; then
- echo shar: \"'README'\" unpacked with wrong size!
- fi
- # end of 'README'
- fi
- if test -f 'Imakefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Imakefile'\"
- else
- echo shar: Extracting \"'Imakefile'\" \(1836 characters\)
- sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
- X/*
- X * Copyright (C) 1993 Tetsuji Rai (tetsuji@rai.juice.or.jp)
- X *
- X * Permission to use, copy, modify, distribute, and sell this software and its
- X * documentation for any purpose is hereby granted without fee, provided that
- X * the above copyright notice appear in all copies and that both that
- X * copyright notice and this permission notice appear in supporting
- X * documentation, and that the name of Tetsuji Rai not be used in
- X * advertising or publicity pertaining to distribution of the software
- X * without specific, written prior permission. Tetsuji Rai makes
- X * no representations about the suitability of this software for any purpose.
- X * It is provided "as is" without express or implied warranty.
- X *
- X * TETSUJI RAI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
- X * EVENT SHALL TETSUJI RAI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- X * OF THIS SOFTWARE.
- X *
- X * Author: Tetsuji Rai
- X * tetsuji@rai.juice.or.jp
- X * 74610.1537@Compuserve.Com
- X * +81-3-3557-3936
- X */
- X
- X.SUFFIXES: .c .C .cc .o .y .l
- X
- X.C.o:
- X $(CC) $(CFLAGS) -c $<
- X
- XCC = g++ -g /* gcc 2.3.3 prefered */
- X# CC = cc -g
- X
- XLOCAL_LIBRARIES += $(XLIB) $(XMULIB) -lm
- XEXTRA_LIBRARIES = $(LOCAL_LIBRARIES)
- X
- XDEFINES = $(XAWINCL) $(MOTIF) $(BCOPY) $(MEMCPY) $(VASIMPLE)
- X
- X
- X
- XDEPENDFLAGS += -I/usr/local/lib/g++-include
- X
- XMAN = xwinpr.man
- XSRCS = xwinpr.C
- XOBJS = xwinpr.o
- XHEADERS = patchlevel.h
- XETC = Imakefile README Makefile
- X
- XCC = g++ -g
- X
- XComplexProgramTarget (xwinpr)
- X
- XDependTarget ()
- X
- Xshar:
- X shar $(ETC) $(SRCS) $(HEADERS) $(MAN) > xwinpr.shar
- END_OF_FILE
- if test 1836 -ne `wc -c <'Imakefile'`; then
- echo shar: \"'Imakefile'\" unpacked with wrong size!
- fi
- # end of 'Imakefile'
- fi
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(12630 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X# Makefile generated by imake - do not edit!
- X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# Makefile generated from "Imake.tmpl" and </tmp/IIf.003735>
- X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
- X#
- X# Platform-specific parameters may be set in the appropriate <vendor>.cf
- X# configuration files. Site-specific parameters should be set in the file
- X# site.def. Full rebuilds are recommended if any parameters are changed.
- X#
- X# If your C preprocessor does not define any unique symbols, you will need
- X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
- X# "make World" the first time).
- X#
- X
- X# -------------------------------------------------------------------------
- X# site-specific configuration parameters that need to come before
- X# the platform-specific parameters - edit site.def to change
- X
- X# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- XCONFIGSRC = /usr/X11/lib/X11/config
- X
- X# -------------------------------------------------------------------------
- X# platform-specific configuration parameters - edit bsd.cf to change
- X
- X# platform: $XConsortium: 1.cf,v 1.1 93/01/17 12:10:52 ef Exp $
- X
- X# operating system: BSD/386 Berkeley Software Design Inc
- X
- X# -------------------------------------------------------------------------
- X# site-specific configuration parameters that go after
- X# the platform-specific parameters - edit site.def to change
- X
- X# site: $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
- X
- XCONFIGSRC = /usr/X11/lib/X11/config
- X
- X SHELL = /bin/sh
- X
- X TOP = .
- X CURRENT_DIR = .
- X
- X AR = ar clq
- X BOOTSTRAPCFLAGS =
- X CC = gcc
- X AS = as
- X
- X COMPRESS = compress
- X CPP = /usr/bin/cpp $(STD_CPP_DEFINES)
- X PREPROCESSCMD = gcc -E $(STD_CPP_DEFINES)
- X INSTALL = install
- X LD = ld
- X LINT = lint
- X LINTLIBFLAG = -C
- X LINTOPTS = -axz
- X LN = ln -s
- X MAKE = make
- X MV = mv
- X CP = cp
- X
- X RANLIB = ranlib
- X RANLIBINSTFLAGS =
- X
- X RM = rm -f
- X TROFF = psroff
- X MSMACROS = -ms
- X TBL = tbl
- X EQN = eqn
- X STD_INCLUDES =
- X STD_CPP_DEFINES = -P -DXML -pipe -DX_LOCALE
- X STD_DEFINES = -DXML -pipe -DX_LOCALE
- X EXTRA_LOAD_FLAGS =
- X EXTRA_LIBRARIES =
- X TAGS = ctags
- X
- X PROTO_DEFINES =
- X
- X INSTPGMFLAGS = -s
- X
- X INSTBINFLAGS = -m 0755
- X INSTUIDFLAGS = -m 4755
- X INSTLIBFLAGS = -m 0644
- X INSTINCFLAGS = -m 0444
- X INSTMANFLAGS = -m 0444
- X INSTDATFLAGS = -m 0444
- X INSTKMEMFLAGS = -g kmem -m 2755
- X
- X PROJECTROOT = /usr/X11
- X
- X TOP_INCLUDES = -I$(INCROOT)
- X
- X CDEBUGFLAGS = -O2
- X CCOPTIONS =
- X
- X ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
- X ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
- X CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
- X LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
- X
- X LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
- X
- X LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
- X
- X LDCOMBINEFLAGS = -X -r
- X DEPENDFLAGS =
- X
- X MACROFILE = bsd.cf
- X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
- X
- X IMAKE_DEFINES =
- X
- X IRULESRC = $(CONFIGDIR)
- X
- X IMAKE_CMD = $(IMAKE) -DUseInstalled -DUseInstalledMotif -I$(IRULESRC) $(IMAKE_DEFINES)
- X
- X ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
- X
- X# -------------------------------------------------------------------------
- X# X Window System Build Parameters
- X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
- X
- X# -------------------------------------------------------------------------
- X# X Window System make variables; this need to be coordinated with rules
- X
- X PATHSEP = /
- X USRLIBDIR = /usr/X11/lib
- X BINDIR = /usr/X11/bin
- X INCROOT = /usr/X11/include
- X BUILDINCROOT = $(TOP)
- X BUILDINCDIR = $(BUILDINCROOT)/X11
- X BUILDINCTOP = ..
- X INCDIR = $(INCROOT)/X11
- X ADMDIR = /var/log
- X LIBDIR = $(USRLIBDIR)/X11
- X CONFIGDIR = /usr/X11/lib/X11/config
- X LINTLIBDIR = $(USRLIBDIR)/lint
- X
- X FONTDIR = $(LIBDIR)/fonts
- X XINITDIR = $(LIBDIR)/xinit
- X XDMDIR = $(LIBDIR)/xdm
- X TWMDIR = $(LIBDIR)/twm
- X MANPATH = /usr/X11/man
- X MANSOURCEPATH = $(MANPATH)/cat
- X MANSUFFIX = 1
- X LIBMANSUFFIX = 3
- X MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
- X LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
- X NLSDIR = $(LIBDIR)/nls
- X PEXAPIDIR = $(LIBDIR)/PEX
- X XAPPLOADDIR = $(LIBDIR)/app-defaults
- X FONTCFLAGS = -t
- X
- X INSTAPPFLAGS = $(INSTDATFLAGS)
- X
- X IMAKE = imake
- X DEPEND = makedepend
- X RGB = rgb
- X
- X FONTC = bdftopcf
- X
- X MKFONTDIR = mkfontdir
- X MKDIRHIER = /bin/sh $(BINDIR)/mkdirhier
- X
- X CONFIGSRC = $(TOP)/config
- X DOCUTILSRC = $(TOP)/doc/util
- X CLIENTSRC = $(TOP)/clients
- X DEMOSRC = $(TOP)/demos
- X LIBSRC = $(TOP)/lib
- X FONTSRC = $(TOP)/fonts
- X INCLUDESRC = $(TOP)/X11
- X SERVERSRC = $(TOP)/server
- X UTILSRC = $(TOP)/util
- X SCRIPTSRC = $(UTILSRC)/scripts
- X EXAMPLESRC = $(TOP)/examples
- X CONTRIBSRC = $(TOP)/../contrib
- X DOCSRC = $(TOP)/doc
- X RGBSRC = $(TOP)/rgb
- X DEPENDSRC = $(UTILSRC)/makedepend
- X IMAKESRC = $(CONFIGSRC)
- X XAUTHSRC = $(LIBSRC)/Xau
- X XLIBSRC = $(LIBSRC)/X
- X XMUSRC = $(LIBSRC)/Xmu
- X TOOLKITSRC = $(LIBSRC)/Xt
- X AWIDGETSRC = $(LIBSRC)/Xaw
- X OLDXLIBSRC = $(LIBSRC)/oldX
- X XDMCPLIBSRC = $(LIBSRC)/Xdmcp
- X BDFTOSNFSRC = $(FONTSRC)/bdftosnf
- X BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
- X BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
- X MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
- X FSLIBSRC = $(FONTSRC)/lib/fs
- X FONTSERVERSRC = $(FONTSRC)/server
- X EXTENSIONSRC = $(TOP)/extensions
- X XILIBSRC = $(EXTENSIONSRC)/lib/xinput
- X PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
- X
- X#
- X# (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
- X# ALL RIGHTS RESERVED
- X#
- X#
- X# Motif Release 1.2.2
- X#
- X# $RCSfile: Motif.tmpl,v $ $Revision: 1.5.10.6 $ $Date: 92/12/10 18:34:38 $
- X
- X XTOP = $(TOP)
- X MTOP = $(TOP)
- X XBUILDINCROOT = $(XTOP)
- X XBUILDINCDIR = $(XBUILDINCROOT)/X11
- X
- X CLIENTSRC = $(XTOP)/clients
- X DEMOSRC = $(XTOP)/demos
- X LIBSRC = $(XTOP)/lib
- X FONTSRC = $(XTOP)/fonts
- X INCLUDESRC = $(XTOP)/X11
- X SERVERSRC = $(XTOP)/server
- X UTILSRC = $(XTOP)/util
- X EXAMPLESRC = $(XTOP)/examples
- X DOCSRC = $(XTOP)/doc
- X RGBSRC = $(XTOP)/rgb
- X EXTENSIONSRC = $(XTOP)/extensions
- X
- X TOP_INCLUDES = -I$(INCROOT)
- X
- X UIL_INCLUDES = -I$(USRINCDIR)/uil
- X
- X USRINCDIR = /usr/X11/include
- X UIDDIR = $(USRLIBDIR)/Xm/uid
- X TESTSRC = $(MTOP)/tests
- X GENERALSRCLIB = $(TESTSRC)/General/lib
- X GENERALSRCBIN = $(TESTSRC)/General/bin
- X MANUALSRCLIB = $(TESTSRC)/Manual/lib
- X MANUALSRCBIN = $(TESTSRC)/Manual/bin
- X AUTOSRCLIB = $(TESTSRC)/Auto/lib
- X AUTOSRCBIN = $(TESTSRC)/Auto/bin
- X COMMONPP = $(GENERALSRCBIN)/Commonpp
- X GENRUN = $(GENERALSRCBIN)/Genrun
- X MANRUN = $(GENERALSRCBIN)/Manrun
- X
- X TESTCOMSRC = $(MANUALSRCLIB)/Common
- X
- X MTOOLKITSRC = $(TOOLKITSRC)
- X MINCLUDESRC = $(MTOP)/X11
- X MLIBSRC = $(MTOP)/lib
- X MCLIENTSRC = $(MTOP)/clients
- X MDEMOSRC = $(MTOP)/demos
- X MWIDGETSRC = $(MLIBSRC)/Xm
- X MRESOURCESRC = $(MLIBSRC)/Mrm
- X UILSRC = $(MCLIENTSRC)/uil
- X
- X UIL = uil
- X DEPUIL = $(BINDIR)/uil
- X
- XDEPXMLIB = $(USRLIBDIR)/libXm.a
- XXMLIB = -lXm
- X
- X XMEXTRA_LIBS = -lXwchar -lcompat
- X
- XDEPMRESOURCELIB = $(USRLIBDIR)/libMrm.a
- XMRESOURCELIB = -lMrm
- X
- XDEPUILLIB = $(USRLIBDIR)/libUil.a
- XUILLIB = -lUil
- X
- XDEPTESTCOMLIB = $(USRLIBDIR)/libCommon.a
- XTESTCOMLIB = -lCommon
- X
- X LINTMRESOURCE = $(MRESOURCESRC)/libMrm.a
- XLINTXMWIDGETLIB = $(MWIDGETSRC)/llib-l/Xm.ln
- X LINTXMTOOL = $(MTOOLKITSRC)/llib-lXt.ln
- X LINTUILLIB = $(UILSRC)/llib-lUil.ln
- X
- X YACCFLAGS =
- X UILFLAGS =
- X
- X RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut *.Dat
- X
- X STD_DEFINES = -DXML -pipe -DX_LOCALE
- X
- X DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
- X EXTENSIONLIB = -lXext
- X
- X DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
- X XLIB = $(EXTENSIONLIB) -lX11
- X
- X DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
- X XAUTHLIB = -lXau
- X DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
- X XDMCPLIB = -lXdmcp
- X
- X DEPXMULIB = $(USRLIBDIR)/libXmu.a
- X XMULIB = -lXmu
- X
- X DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
- X OLDXLIB = -loldX
- X
- X DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
- X XTOOLLIB = -lXt
- X
- X DEPXAWLIB = $(USRLIBDIR)/libXaw.a
- X XAWLIB = -lXaw
- X
- X DEPXILIB = $(USRLIBDIR)/libXi.a
- X XILIB = -lXi
- X
- X DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
- X PHIGSLIB = -lphigs
- X
- X DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
- X XBSDLIB = -lXbsd
- X
- X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
- X LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
- X LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
- X LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
- X LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
- X LINTXI = $(LINTLIBDIR)/llib-lXi.ln
- X LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
- X
- X DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
- X
- X DEPLIBS1 = $(DEPLIBS)
- X DEPLIBS2 = $(DEPLIBS)
- X DEPLIBS3 = $(DEPLIBS)
- X
- X# -------------------------------------------------------------------------
- X# Imake rules for building libraries, programs, scripts, and data files
- X# rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
- X
- X#
- X# (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
- X# ALL RIGHTS RESERVED
- X#
- X#
- X# Motif Release 1.2.2
- X#
- X# $RCSfile: Motif.rules,v $ $Revision: 1.5.8.8 $ $Date: 92/12/10 18:43:17 $
- X
- X# Rule for making shadow trees.
- X
- X# -------------------------------------------------------------------------
- X# start of Imakefile
- X
- X.SUFFIXES: .c .C .cc .o .y .l
- X
- X.C.o:
- X $(CC) $(CFLAGS) -c $<
- X
- XCC = g++ -g
- X# CC = cc -g
- X
- XLOCAL_LIBRARIES += $(XLIB) $(XMULIB) -lm
- XEXTRA_LIBRARIES = $(LOCAL_LIBRARIES)
- X
- XDEFINES = $(XAWINCL) $(MOTIF) $(BCOPY) $(MEMCPY) $(VASIMPLE)
- X
- XDEPENDFLAGS += -I/usr/local/lib/g++-include
- X
- XMAN = xwinpr.man
- XSRCS = xwinpr.C
- XOBJS = xwinpr.o
- XHEADERS = patchlevel.h
- XETC = Imakefile README Makefile
- X
- XCC = g++ -g
- X
- X PROGRAM = xwinpr
- X
- Xall:: xwinpr
- X
- Xxwinpr: $(OBJS) $(DEPLIBS)
- X $(RM) $@
- X $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
- X
- Xinstall:: xwinpr
- X -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
- X else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
- X $(INSTALL) -c $(INSTPGMFLAGS) xwinpr $(DESTDIR)$(BINDIR)
- X
- Xinstall.man:: xwinpr.man
- X $(RM) $(MANDIR)/xwinpr.0
- X groff -Tascii -t -man xwinpr.man >/tmp/xwinpr.man
- X $(INSTALL) -c $(INSTMANFLAGS) /tmp/xwinpr.man $(MANDIR)/xwinpr.0
- X $(RM) /tmp/xwinpr.man
- X
- Xdepend::
- X $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
- X
- Xlint:
- X $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
- Xlint1:
- X $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
- X
- Xclean::
- X $(RM) $(PROGRAM)
- X
- Xdepend::
- X $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
- X
- Xshar:
- X shar $(ETC) $(SRCS) $(HEADERS) $(MAN) > xwinpr.shar
- X
- X# -------------------------------------------------------------------------
- X# common rules for all Makefiles - do not edit
- X
- Xemptyrule::
- X
- Xclean::
- X $(RM_CMD) "#"*
- X
- XMakefile::
- X -@if [ -f Makefile ]; then set -x; \
- X $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
- X else exit 0; fi
- X $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
- X
- Xtags::
- X $(TAGS) -w *.[ch]
- X $(TAGS) -xw *.[ch] > TAGS
- X
- X# -------------------------------------------------------------------------
- X# empty rules for directories that do not have SUBDIRS - do not edit
- X
- Xinstall::
- X @echo "install in $(CURRENT_DIR) done"
- X
- Xinstall.man::
- X @echo "install.man in $(CURRENT_DIR) done"
- X
- XMakefiles::
- X
- Xincludes::
- X
- X# -------------------------------------------------------------------------
- X# dependencies generated by makedepend
- X
- END_OF_FILE
- if test 12630 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'patchlevel.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patchlevel.h'\"
- else
- echo shar: Extracting \"'patchlevel.h'\" \(64 characters\)
- sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
- X#define PATCHLEVEL "Version 1.0 Thu Sep 30 19:39:30 JST 1993"
- END_OF_FILE
- if test 64 -ne `wc -c <'patchlevel.h'`; then
- echo shar: \"'patchlevel.h'\" unpacked with wrong size!
- fi
- # end of 'patchlevel.h'
- fi
- if test -f 'xwinpr.C' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xwinpr.C'\"
- else
- echo shar: Extracting \"'xwinpr.C'\" \(6634 characters\)
- sed "s/^X//" >'xwinpr.C' <<'END_OF_FILE'
- X/*
- X * Copyright (C) 1993 Tetsuji Rai (tetsuji@rai.juice.or.jp)
- X *
- X * Permission to use, copy, modify, distribute, and sell this software and its
- X * documentation for any purpose is hereby granted without fee, provided that
- X * the above copyright notice appear in all copies and that both that
- X * copyright notice and this permission notice appear in supporting
- X * documentation, and that the name of Tetsuji Rai not be used in
- X * advertising or publicity pertaining to distribution of the software
- X * without specific, written prior permission. Tetsuji Rai makes
- X * no representations about the suitability of this software for any purpose.
- X * It is provided "as is" without express or implied warranty.
- X *
- X * TETSUJI RAI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
- X * EVENT SHALL TETSUJI RAI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
- X * OF THIS SOFTWARE.
- X *
- X * Author: Tetsuji Rai
- X * tetsuji@rai.juice.or.jp
- X * 74610.1537@Compuserve.Com
- X * +81-3-3557-3936
- X */
- X
- X/*
- X * xwinpr.C ver.1.0
- X *
- X */
- X#include <stdio.h>
- X#include <stdlib.h>
- X#include <X11/Xlib.h>
- X#include <X11/Xutil.h>
- X#include <X11/Xos.h>
- X#include <unistd.h>
- X#include <X11/cursorfont.h>
- X#include <X11/Xmu/WinUtil.h>
- X
- X#include <fstream.h>
- X
- X#include "patchlevel.h"
- X
- X
- X
- XXImage *xim;
- XDisplay *dp;
- XWindow win, pwin;
- XXWindowAttributes wattr, pwattr;
- Xint height, width;
- Xint pheight, pwidth;
- Xunsigned long background;
- Xtime_t t;
- X
- X#ifndef DEBUG
- Xchar *lpr = "lpr";
- X
- X#else
- Xchar *lpr = "cat";
- X
- X#endif
- X
- Xint dot = 100;
- Xint hflag = !0; // header flag (true if necessary)
- Xint rflag = 0; // reverse flag
- Xchar *ofile = 0;
- X
- Xvoid Usage (void);
- X
- X
- Xint main (int c, char **v)
- X{
- X dp = XOpenDisplay (0);
- X
- X for (int i = 1; i < c; i++) {
- X if (!strcmp (v[i], "-help")) { // display usage
- X Usage ();
- X exit (0);
- X } else if (!strcmp (v[i], "-r")) { // reverse white/black
- X rflag = !0;
- X } else if (!strcmp (v[i], "-o")) { // output file
- X ofile = v[++i];
- X } else if (!strcmp (v[i], "-p")) { // output program
- X lpr = v[++i];
- X } else if (!strcmp (v[i], "-dotpitch")) { // dotpitch
- X dot = atoi (v[++i]);
- X if (!dot) {
- X cerr << "xwinpr : invalid dotpitch.\n";
- X exit (1);
- X }
- X } else if (!strcmp (v[i], "-nh")) { // non header printing
- X hflag = 0;
- X } else {
- X cerr << " xwinpr : unknown flag \"" << v[i] << "\"\n";
- X Usage ();
- X exit (1);
- X }
- X }
- X
- X Cursor cursor;
- X
- X cursor = XCreateFontCursor (dp, XC_crosshair);
- X int status =
- X XGrabPointer (dp, DefaultRootWindow (dp), False,
- X ButtonPressMask, GrabModeSync,
- X GrabModeAsync, DefaultRootWindow (dp), cursor, CurrentTime);
- X
- X pwin = 0;
- X
- X XEvent xe;
- X
- X cerr << "\n- Xwinpr : \n\
- X Move cursor to the window you want to print, exactly to the\n\
- X point which you want to print as white(or black if you specified -r \n\
- X option).\n";
- X
- X while (pwin == 0) {
- X XAllowEvents (dp, SyncPointer, CurrentTime);
- X XWindowEvent (dp, DefaultRootWindow (dp), ButtonPressMask,
- X &xe);
- X if (xe.type == ButtonPress)
- X pwin = xe.xbutton.subwindow;
- X }
- X win = XmuClientWindow (dp, pwin);
- X
- X XUngrabPointer (dp, CurrentTime);
- X
- X time_t t = time (0);
- X struct tm *tm = localtime (&t);
- X
- X int pipes[2];
- X
- X if (!ofile)
- X if (pipe (pipes)) {
- X cerr << "xwinpr : pipe(2) failed.\n";
- X exit (1);
- X }
- X if (!ofile)
- X switch (fork ()) {
- X case 0: // You are the child.
- X close (0); // close stdin handle
- X dup2 (pipes[0], 0); // connect pipe output to stdin handle(0)
- X close (pipes[1]); // close input end of the pipe
- X system (lpr); // invole lpr
- X exit (0);
- X case -1: // fork failed!
- X cerr << "xwinpr : fork(2) failed.\n";
- X exit (1);
- X }
- X if (!ofile)
- X close (pipes[0]);
- X
- X // Well, now you are the parent!
- X
- X ofstream *clprp;
- X
- X if (ofile)
- X clprp = new ofstream (ofile); // open output file instead of running
- X // program
- X else
- X clprp = new ofstream (pipes[1]); // open output stream connected to
- X // "lpr"
- X
- X ofstream & clpr = *clprp;
- X char *winName;
- X
- X XFetchName (dp, win, &winName);
- X
- X cerr << '\n'
- X << "Date : " << asctime (tm)
- X << "Window ID : " << hex << win << '\n'
- X << "Window Name : " << winName << '\n';
- X
- X if (hflag) {
- X clpr << "Date : " << asctime (tm)
- X << "Window : " << winName
- X << "\n\n";
- X }
- X XGetWindowAttributes (dp, pwin, &pwattr);
- X XGetWindowAttributes (dp, win, &wattr);
- X width = wattr.width;
- X height = wattr.height;
- X
- X#ifdef DEBUG
- X cerr << "wid, height = " << width << "," << height << '\n';
- X#endif
- X pwidth = (width + 7) / 8 * 2;
- X pheight = height;
- X
- X xim = XGetImage (dp, win, 0, 0, width, height, 0xffff, ZPixmap);
- X#ifdef DEBUG
- X fprintf (stderr, "xim = %lx\n", xim);
- X#endif // DEBUG
- X
- X clpr
- X#ifndef DEBUG
- X << "\x1b["
- X#else
- X << "(ESC)1b["
- X#endif
- X << dec << pwidth * pheight << ';'
- X << pwidth / 2 << ';'
- X << dot << ";;"
- X << pheight
- X << "/r";
- X// (fp, "\x1b[%d;%d;%d;;%d/r", pwidth * pheight, pwidth / 2, 150, pheight);
- X
- X#ifdef DEBUG
- X cerr << "xe, wattr = " << xe.xbutton.x << ',' << wattr.x << ',' << pwattr.x
- X << '\n'
- X << xe.xbutton.y << ',' << wattr.y << ',' << pwattr.y << '\n';
- X#endif
- X background = XGetPixel (xim, xe.xbutton.x - wattr.x - pwattr.x,
- X xe.xbutton.y - wattr.y - pwattr.y);
- X
- X#ifdef DEBUG
- X cerr << "background = " << background << '\n';
- X#endif // DEBUG
- X
- X clpr << hex;
- X
- X for (int xy = 0; xy < pheight; xy++) {
- X int xx = 0;
- X
- X for (int ix = 0; ix < pwidth; ix++) {
- X unsigned int b = 0;
- X int bitx;
- X
- X for (bitx = 0; bitx < 4; bitx++, xx++) {
- X b <<= 1;
- X if (xx < width)
- X b |= ((XGetPixel (xim, xx, xy) != background) ^ rflag);
- X }
- X clpr << b;
- X }
- X }
- X#ifndef DEBUG
- X clpr << '\xc';
- X#else
- X clpr << "(form feed)";
- X#endif
- X exit (0);
- X}
- X
- X
- Xvoid Usage ()
- X{
- X cout <<
- X "Xwinpr : " PATCHLEVEL "\n"
- X "Usage : xwinpr [options]\n"
- X " where options are:\n"
- X " -help : display this message.\n"
- X " -r : reverse black and white.\n"
- X " -o file : send output to a file.\n"
- X " -p printer : send output to the printer program. The default\n"
- X " is \"lpr\".\n"
- X " -dotpitch (number) : set dotpitch. The default is 100.\n"
- X " -nh : Non-header mode. Header includes the date and the\n"
- X " name of the window.\n"
- X ;
- X}
- END_OF_FILE
- if test 6634 -ne `wc -c <'xwinpr.C'`; then
- echo shar: \"'xwinpr.C'\" unpacked with wrong size!
- fi
- # end of 'xwinpr.C'
- fi
- if test -f 'xwinpr.man' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'xwinpr.man'\"
- else
- echo shar: Extracting \"'xwinpr.man'\" \(1871 characters\)
- sed "s/^X//" >'xwinpr.man' <<'END_OF_FILE'
- X.TH XWINPR 1 "Release 5" "X Version 11"
- X.SH NAME
- Xxwinpr \- window print utility for X (Canon LBP)
- X.SH SYNOPSIS
- X.B "xwinpr"
- X[\-help] [\-r] [\-o \fIfile\fP] [\-p \fIprinter\fP] [\-dotpitch
- X\fIdotpitch\fP] [\-nh]
- X.SH DESCRIPTION
- X.PP
- X.I Xwinpr
- Xis a utility for hardcopying a window. Various pixel values are classified
- Xinto only two colors(white and black), and printed. If no options are
- Xchosen, \fB\-p lpr\fP is assumed.
- X.PP
- XThe user selects the target window with the mouse (by clicking any
- Xmouse button in the desired window), where background pixel value is
- Xdisplayed, which is printed as white. The other pixel values are
- Xprinted as black. This white/black settings are reversed by \fB\-r\fP
- Xoption.
- X
- X.SH OPTIONS
- X.PP
- X.TP 8
- X.B "\-help"
- XPrint out the `Usage:' command syntax summary.
- X
- X.PP
- X.TP 8
- X.B "\-r"
- XReverse white/black; ie, pixel value you click on is black, and the others
- Xare white.
- X
- X.PP
- X.TP 8
- X.B "\-o \fIfile\fP"
- XSend output to a file instead of printing.
- X
- X.PP
- X.TP 8
- X.B "\-p \fIprinter\fP"
- XSend output to the print program. The default is "lpr". If this option is
- Xdefined with "\-o \fIfile\fP", it takes precedence over "\-p" option.
- X
- X.PP
- X.TP 8
- X.B "\-dotpitch \fIdotpitch\fP"
- XDefine the dotpitch of the printer. The default is 100(dpi).
- X
- X.PP
- X.TP 8
- X.B "\-nh"
- XNon header mode. Header (including the date and the name of the window)
- Xis not printed.
- X
- X.SH ENVIRONMENT
- X.PP
- X.TP 8
- X.B DISPLAY
- XTo get the default host and display number.
- X.SH SEE ALSO
- XX(1), lpr(1)
- X.SH BUGS
- XUsing \fB\-stats \-bits\fP shows some redundant information.
- X.PP
- XThe -geometry string displayed must make assumptions about the
- Xwindow's border width and the behavior of the application and the
- Xwindow manager. As a result, the location given is not always
- Xcorrect.
- X.SH COPYRIGHT
- XCopyright 1993, Tetsuji Rai
- X.br
- X.SH AUTHOR
- XTetsuji Rai (tetsuji@rai.juice.or.jp, 74610.1537@compuserve.com)
- END_OF_FILE
- if test 1871 -ne `wc -c <'xwinpr.man'`; then
- echo shar: \"'xwinpr.man'\" unpacked with wrong size!
- fi
- # end of 'xwinpr.man'
- fi
- echo shar: End of archive 1 \(of 1\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have the archive.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
- --
- // chris@Sterling.COM | Send comp.sources.x submissions to:
- \X/ Amiga - The only way to fly! | sources-x@sterling.com
- "It's intuitively obvious to the |
- most casual observer..." | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
-