home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume21 / xwinpr / part01 < prev    next >
Encoding:
Text File  |  1993-10-20  |  29.3 KB  |  1,014 lines

  1. Newsgroups: comp.sources.x
  2. From: tetsuji@rai.juice.or.jp (Tetsuji Rai)
  3. Subject: v21i016:  xwinpr - Print an X-Window, Part01/01
  4. Message-ID: <1993Oct20.204038.27857@sparky.sterling.com>
  5. X-Md4-Signature: 03c18b4b40d1bc2677909ef2967d7eef
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Wed, 20 Oct 1993 20:40:38 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: tetsuji@rai.juice.or.jp (Tetsuji Rai)
  12. Posting-number: Volume 21, Issue 16
  13. Archive-name: xwinpr/part01
  14. Environment: C++, Canon, LipsII+, X11
  15.  
  16. [ This at least tried to print on my system (I don't have the right ]
  17. [ printer for more ... )                                            ]
  18. [                             Chris                                 ]
  19.  
  20. This is a hardcopy program for X Windows.
  21.  
  22. #! /bin/sh
  23. # This is a shell archive.  Remove anything before this line, then feed it
  24. # into a shell via "sh file" or similar.  To overwrite existing files,
  25. # type "sh file -c".
  26. # Contents:  README Imakefile Makefile patchlevel.h xwinpr.C xwinpr.man
  27. # Wrapped by chris@sparky on Wed Oct 20 15:32:13 1993
  28. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  29. echo If this archive is complete, you will see the following message:
  30. echo '          "shar: End of archive 1 (of 1)."'
  31. if test -f 'README' -a "${1}" != "-c" ; then 
  32.   echo shar: Will not clobber existing file \"'README'\"
  33. else
  34.   echo shar: Extracting \"'README'\" \(2000 characters\)
  35.   sed "s/^X//" >'README' <<'END_OF_FILE'
  36. XXwinpr - hardcopy program.(ver.1.0)
  37. X
  38. X
  39. X   This is a hardcopy program for X Windows.
  40. X
  41. X
  42. XRequirements, supported hardware:
  43. X---------------------------------
  44. X
  45. X1. Printer should support Canon LipsII+.  But other printers may
  46. X  work with minor modifications.  I haven't tested.
  47. X2. C++.  Originally it is compiled with g++ 2.3.3, but other C++ compilers
  48. X  will be good.
  49. X3. This was made on BSD/386 (which identifies itself by defining "bsdi"),
  50. X  but should work on many platforms with minor fixes.  This uses only
  51. X  basic functions of Un?x and C++.
  52. X
  53. X
  54. XInstallation:
  55. X-------------
  56. X  Simply xmkmf and make.  If you don't have xmkmf or imake, then modify
  57. XMakefile in this package and use it.   To install, "make install", and 
  58. Xto install the manual, "make install.man".
  59. X
  60. X
  61. XUsage:
  62. X------
  63. X  Invoke this program, and the cursor will change to a crosshair.  Move
  64. Xthe cursor to the window you want to print out, at the precise point you
  65. Xwant to print as white.  The other colors will be black on the print.
  66. XFor command options, read the man page or invoke "xwinpr -help".
  67. X
  68. X
  69. XSupport:
  70. X--------
  71. X  There will be no official support for this program, but I'll appreciate
  72. Xreceiving any bug, suggestions or improvements.   Since this is now limited 
  73. Xto only a small variety of hardware, your port to other platforms is
  74. Xvery welcome!  Please send me know your patch.  In that case, original
  75. Xcodes shall be enclosed by "#ifdef bsdi" and "#endif" or the likes.
  76. XFixes will be out sooner or later (sorry if there are delays).
  77. X
  78. X
  79. XHints:
  80. X------
  81. X  This software uses only 7bit character codes.  So you can use this 
  82. Xwithout caring about the high bits.
  83. X
  84. X
  85. XCopyright:
  86. X----------
  87. X  Permission to use, copy, modify, distribute, and sell this software is
  88. Xgranted without fee, but only when with copyright notice which appears 
  89. Xin Imakefile and xwinpr.C.  Tetsuji Rai makes no representations about
  90. Xthe suitability of this software for any purpose.
  91. X
  92. X
  93. X
  94. XHappy printing!
  95. X
  96. X
  97. X    Tetsuji Rai 
  98. X      (tetsuji@rai.juice.or.jp   74610.1537@compuserve.com)
  99. END_OF_FILE
  100.   if test 2000 -ne `wc -c <'README'`; then
  101.     echo shar: \"'README'\" unpacked with wrong size!
  102.   fi
  103.   # end of 'README'
  104. fi
  105. if test -f 'Imakefile' -a "${1}" != "-c" ; then 
  106.   echo shar: Will not clobber existing file \"'Imakefile'\"
  107. else
  108.   echo shar: Extracting \"'Imakefile'\" \(1836 characters\)
  109.   sed "s/^X//" >'Imakefile' <<'END_OF_FILE'
  110. X/*
  111. X * Copyright (C) 1993    Tetsuji Rai (tetsuji@rai.juice.or.jp)
  112. X *
  113. X * Permission to use, copy, modify, distribute, and sell this software and its
  114. X * documentation for any purpose is hereby granted without fee, provided that
  115. X * the above copyright notice appear in all copies and that both that
  116. X * copyright notice and this permission notice appear in supporting
  117. X * documentation, and that the name of Tetsuji Rai not be used in
  118. X * advertising or publicity pertaining to distribution of the software
  119. X * without specific, written prior permission.  Tetsuji Rai makes
  120. X * no representations about the suitability of this software for any purpose.
  121. X * It is provided "as is" without express or implied warranty.
  122. X *
  123. X * TETSUJI RAI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  124. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO
  125. X * EVENT SHALL TETSUJI RAI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  126. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  127. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  128. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  129. X * OF THIS SOFTWARE.
  130. X *
  131. X * Author:  Tetsuji Rai
  132. X *          tetsuji@rai.juice.or.jp
  133. X *          74610.1537@Compuserve.Com
  134. X *          +81-3-3557-3936
  135. X */
  136. X
  137. X.SUFFIXES: .c .C .cc .o .y .l
  138. X
  139. X.C.o:
  140. X    $(CC) $(CFLAGS) -c $<
  141. X
  142. XCC = g++ -g     /* gcc 2.3.3 prefered */
  143. X# CC = cc -g
  144. X
  145. XLOCAL_LIBRARIES += $(XLIB) $(XMULIB) -lm
  146. XEXTRA_LIBRARIES = $(LOCAL_LIBRARIES)
  147. X
  148. XDEFINES = $(XAWINCL) $(MOTIF) $(BCOPY) $(MEMCPY) $(VASIMPLE)
  149. X
  150. X
  151. X
  152. XDEPENDFLAGS += -I/usr/local/lib/g++-include
  153. X
  154. XMAN = xwinpr.man
  155. XSRCS = xwinpr.C
  156. XOBJS = xwinpr.o
  157. XHEADERS = patchlevel.h
  158. XETC = Imakefile README Makefile
  159. X
  160. XCC = g++ -g
  161. X
  162. XComplexProgramTarget (xwinpr)
  163. X
  164. XDependTarget ()
  165. X
  166. Xshar:
  167. X    shar $(ETC) $(SRCS) $(HEADERS) $(MAN) > xwinpr.shar
  168. END_OF_FILE
  169.   if test 1836 -ne `wc -c <'Imakefile'`; then
  170.     echo shar: \"'Imakefile'\" unpacked with wrong size!
  171.   fi
  172.   # end of 'Imakefile'
  173. fi
  174. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  175.   echo shar: Will not clobber existing file \"'Makefile'\"
  176. else
  177.   echo shar: Extracting \"'Makefile'\" \(12630 characters\)
  178.   sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  179. X# Makefile generated by imake - do not edit!
  180. X# $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $
  181. X
  182. X# -------------------------------------------------------------------------
  183. X# Makefile generated from "Imake.tmpl" and </tmp/IIf.003735>
  184. X# $XConsortium: Imake.tmpl,v 1.139 91/09/16 08:52:48 rws Exp $
  185. X#
  186. X# Platform-specific parameters may be set in the appropriate <vendor>.cf
  187. X# configuration files.  Site-specific parameters should be set in the file
  188. X# site.def.  Full rebuilds are recommended if any parameters are changed.
  189. X#
  190. X# If your C preprocessor does not define any unique symbols, you will need
  191. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  192. X# "make World" the first time).
  193. X#
  194. X
  195. X# -------------------------------------------------------------------------
  196. X# site-specific configuration parameters that need to come before
  197. X# the platform-specific parameters - edit site.def to change
  198. X
  199. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  200. X
  201. XCONFIGSRC = /usr/X11/lib/X11/config
  202. X
  203. X# -------------------------------------------------------------------------
  204. X# platform-specific configuration parameters - edit bsd.cf to change
  205. X
  206. X# platform:  $XConsortium: 1.cf,v 1.1 93/01/17 12:10:52 ef Exp $
  207. X
  208. X# operating system:           BSD/386 Berkeley Software Design Inc
  209. X
  210. X# -------------------------------------------------------------------------
  211. X# site-specific configuration parameters that go after
  212. X# the platform-specific parameters - edit site.def to change
  213. X
  214. X# site:  $XConsortium: site.def,v 1.2 91/07/30 20:26:44 rws Exp $
  215. X
  216. XCONFIGSRC = /usr/X11/lib/X11/config
  217. X
  218. X            SHELL =     /bin/sh
  219. X
  220. X              TOP = .
  221. X      CURRENT_DIR = .
  222. X
  223. X               AR = ar clq
  224. X  BOOTSTRAPCFLAGS =
  225. X               CC =         gcc
  226. X               AS = as
  227. X
  228. X         COMPRESS = compress
  229. X              CPP =         /usr/bin/cpp $(STD_CPP_DEFINES)
  230. X    PREPROCESSCMD =         gcc -E $(STD_CPP_DEFINES)
  231. X          INSTALL = install
  232. X               LD = ld
  233. X             LINT = lint
  234. X      LINTLIBFLAG = -C
  235. X         LINTOPTS = -axz
  236. X               LN = ln -s
  237. X             MAKE = make
  238. X               MV = mv
  239. X               CP = cp
  240. X
  241. X           RANLIB = ranlib
  242. X  RANLIBINSTFLAGS =
  243. X
  244. X               RM = rm -f
  245. X            TROFF = psroff
  246. X         MSMACROS = -ms
  247. X              TBL = tbl
  248. X              EQN = eqn
  249. X     STD_INCLUDES =
  250. X  STD_CPP_DEFINES = -P -DXML -pipe -DX_LOCALE
  251. X      STD_DEFINES = -DXML -pipe -DX_LOCALE
  252. X EXTRA_LOAD_FLAGS =
  253. X  EXTRA_LIBRARIES =
  254. X             TAGS = ctags
  255. X
  256. X    PROTO_DEFINES =
  257. X
  258. X     INSTPGMFLAGS = -s
  259. X
  260. X     INSTBINFLAGS = -m 0755
  261. X     INSTUIDFLAGS = -m 4755
  262. X     INSTLIBFLAGS = -m 0644
  263. X     INSTINCFLAGS = -m 0444
  264. X     INSTMANFLAGS = -m 0444
  265. X     INSTDATFLAGS = -m 0444
  266. X    INSTKMEMFLAGS =     -g kmem -m 2755
  267. X
  268. X      PROJECTROOT =     /usr/X11
  269. X
  270. X     TOP_INCLUDES = -I$(INCROOT)
  271. X
  272. X      CDEBUGFLAGS = -O2
  273. X        CCOPTIONS =
  274. X
  275. X      ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES)
  276. X       ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(DEFINES)
  277. X           CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(ALLDEFINES)
  278. X        LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES)
  279. X
  280. X           LDLIBS = $(SYS_LIBRARIES) $(EXTRA_LIBRARIES)
  281. X
  282. X        LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(LOCAL_LDFLAGS) -L$(USRLIBDIR)
  283. X
  284. X   LDCOMBINEFLAGS = -X -r
  285. X      DEPENDFLAGS =
  286. X
  287. X        MACROFILE = bsd.cf
  288. X           RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut
  289. X
  290. X    IMAKE_DEFINES =
  291. X
  292. X         IRULESRC = $(CONFIGDIR)
  293. X
  294. X        IMAKE_CMD = $(IMAKE) -DUseInstalled -DUseInstalledMotif -I$(IRULESRC) $(IMAKE_DEFINES)
  295. X
  296. X     ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/Imake.rules             $(IRULESRC)/Project.tmpl $(IRULESRC)/site.def             $(IRULESRC)/$(MACROFILE) $(EXTRA_ICONFIGFILES)
  297. X
  298. X# -------------------------------------------------------------------------
  299. X# X Window System Build Parameters
  300. X# $XConsortium: Project.tmpl,v 1.138 91/09/10 09:02:12 rws Exp $
  301. X
  302. X# -------------------------------------------------------------------------
  303. X# X Window System make variables; this need to be coordinated with rules
  304. X
  305. X          PATHSEP = /
  306. X        USRLIBDIR =     /usr/X11/lib
  307. X           BINDIR =     /usr/X11/bin
  308. X          INCROOT =     /usr/X11/include
  309. X     BUILDINCROOT = $(TOP)
  310. X      BUILDINCDIR = $(BUILDINCROOT)/X11
  311. X      BUILDINCTOP = ..
  312. X           INCDIR = $(INCROOT)/X11
  313. X           ADMDIR =         /var/log
  314. X           LIBDIR = $(USRLIBDIR)/X11
  315. X        CONFIGDIR = /usr/X11/lib/X11/config
  316. X       LINTLIBDIR = $(USRLIBDIR)/lint
  317. X
  318. X          FONTDIR = $(LIBDIR)/fonts
  319. X         XINITDIR = $(LIBDIR)/xinit
  320. X           XDMDIR = $(LIBDIR)/xdm
  321. X           TWMDIR = $(LIBDIR)/twm
  322. X          MANPATH =     /usr/X11/man
  323. X    MANSOURCEPATH =     $(MANPATH)/cat
  324. X        MANSUFFIX =     1
  325. X     LIBMANSUFFIX =     3
  326. X           MANDIR = $(MANSOURCEPATH)$(MANSUFFIX)
  327. X        LIBMANDIR = $(MANSOURCEPATH)$(LIBMANSUFFIX)
  328. X           NLSDIR = $(LIBDIR)/nls
  329. X        PEXAPIDIR = $(LIBDIR)/PEX
  330. X      XAPPLOADDIR = $(LIBDIR)/app-defaults
  331. X       FONTCFLAGS = -t
  332. X
  333. X     INSTAPPFLAGS = $(INSTDATFLAGS)
  334. X
  335. X            IMAKE = imake
  336. X           DEPEND = makedepend
  337. X              RGB = rgb
  338. X
  339. X            FONTC = bdftopcf
  340. X
  341. X        MKFONTDIR = mkfontdir
  342. X        MKDIRHIER =     /bin/sh $(BINDIR)/mkdirhier
  343. X
  344. X        CONFIGSRC = $(TOP)/config
  345. X       DOCUTILSRC = $(TOP)/doc/util
  346. X        CLIENTSRC = $(TOP)/clients
  347. X          DEMOSRC = $(TOP)/demos
  348. X           LIBSRC = $(TOP)/lib
  349. X          FONTSRC = $(TOP)/fonts
  350. X       INCLUDESRC = $(TOP)/X11
  351. X        SERVERSRC = $(TOP)/server
  352. X          UTILSRC = $(TOP)/util
  353. X        SCRIPTSRC = $(UTILSRC)/scripts
  354. X       EXAMPLESRC = $(TOP)/examples
  355. X       CONTRIBSRC = $(TOP)/../contrib
  356. X           DOCSRC = $(TOP)/doc
  357. X           RGBSRC = $(TOP)/rgb
  358. X        DEPENDSRC = $(UTILSRC)/makedepend
  359. X         IMAKESRC = $(CONFIGSRC)
  360. X         XAUTHSRC = $(LIBSRC)/Xau
  361. X          XLIBSRC = $(LIBSRC)/X
  362. X           XMUSRC = $(LIBSRC)/Xmu
  363. X       TOOLKITSRC = $(LIBSRC)/Xt
  364. X       AWIDGETSRC = $(LIBSRC)/Xaw
  365. X       OLDXLIBSRC = $(LIBSRC)/oldX
  366. X      XDMCPLIBSRC = $(LIBSRC)/Xdmcp
  367. X      BDFTOSNFSRC = $(FONTSRC)/bdftosnf
  368. X      BDFTOSNFSRC = $(FONTSRC)/clients/bdftosnf
  369. X      BDFTOPCFSRC = $(FONTSRC)/clients/bdftopcf
  370. X     MKFONTDIRSRC = $(FONTSRC)/clients/mkfontdir
  371. X         FSLIBSRC = $(FONTSRC)/lib/fs
  372. X    FONTSERVERSRC = $(FONTSRC)/server
  373. X     EXTENSIONSRC = $(TOP)/extensions
  374. X         XILIBSRC = $(EXTENSIONSRC)/lib/xinput
  375. X      PHIGSLIBSRC = $(EXTENSIONSRC)/lib/PEX
  376. X
  377. X#
  378. X# (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
  379. X# ALL RIGHTS RESERVED
  380. X#
  381. X#
  382. X# Motif Release 1.2.2
  383. X#
  384. X#   $RCSfile: Motif.tmpl,v $ $Revision: 1.5.10.6 $ $Date: 92/12/10 18:34:38 $
  385. X
  386. X              XTOP = $(TOP)
  387. X              MTOP = $(TOP)
  388. X     XBUILDINCROOT = $(XTOP)
  389. X      XBUILDINCDIR = $(XBUILDINCROOT)/X11
  390. X
  391. X         CLIENTSRC = $(XTOP)/clients
  392. X           DEMOSRC = $(XTOP)/demos
  393. X            LIBSRC = $(XTOP)/lib
  394. X           FONTSRC = $(XTOP)/fonts
  395. X        INCLUDESRC = $(XTOP)/X11
  396. X         SERVERSRC = $(XTOP)/server
  397. X           UTILSRC = $(XTOP)/util
  398. X        EXAMPLESRC = $(XTOP)/examples
  399. X            DOCSRC = $(XTOP)/doc
  400. X            RGBSRC = $(XTOP)/rgb
  401. X      EXTENSIONSRC = $(XTOP)/extensions
  402. X
  403. X      TOP_INCLUDES = -I$(INCROOT)
  404. X
  405. X      UIL_INCLUDES = -I$(USRINCDIR)/uil
  406. X
  407. X      USRINCDIR =     /usr/X11/include
  408. X         UIDDIR = $(USRLIBDIR)/Xm/uid
  409. X        TESTSRC = $(MTOP)/tests
  410. X  GENERALSRCLIB = $(TESTSRC)/General/lib
  411. X  GENERALSRCBIN = $(TESTSRC)/General/bin
  412. X   MANUALSRCLIB = $(TESTSRC)/Manual/lib
  413. X   MANUALSRCBIN = $(TESTSRC)/Manual/bin
  414. X     AUTOSRCLIB = $(TESTSRC)/Auto/lib
  415. X     AUTOSRCBIN = $(TESTSRC)/Auto/bin
  416. X       COMMONPP = $(GENERALSRCBIN)/Commonpp
  417. X         GENRUN = $(GENERALSRCBIN)/Genrun
  418. X         MANRUN = $(GENERALSRCBIN)/Manrun
  419. X
  420. X     TESTCOMSRC = $(MANUALSRCLIB)/Common
  421. X
  422. X    MTOOLKITSRC = $(TOOLKITSRC)
  423. X    MINCLUDESRC = $(MTOP)/X11
  424. X        MLIBSRC = $(MTOP)/lib
  425. X     MCLIENTSRC = $(MTOP)/clients
  426. X       MDEMOSRC = $(MTOP)/demos
  427. X     MWIDGETSRC = $(MLIBSRC)/Xm
  428. X   MRESOURCESRC = $(MLIBSRC)/Mrm
  429. X         UILSRC = $(MCLIENTSRC)/uil
  430. X
  431. X            UIL = uil
  432. X         DEPUIL = $(BINDIR)/uil
  433. X
  434. XDEPXMLIB = $(USRLIBDIR)/libXm.a
  435. XXMLIB =              -lXm
  436. X
  437. X   XMEXTRA_LIBS = -lXwchar -lcompat
  438. X
  439. XDEPMRESOURCELIB = $(USRLIBDIR)/libMrm.a
  440. XMRESOURCELIB =              -lMrm
  441. X
  442. XDEPUILLIB = $(USRLIBDIR)/libUil.a
  443. XUILLIB =              -lUil
  444. X
  445. XDEPTESTCOMLIB = $(USRLIBDIR)/libCommon.a
  446. XTESTCOMLIB =              -lCommon
  447. X
  448. X  LINTMRESOURCE = $(MRESOURCESRC)/libMrm.a
  449. XLINTXMWIDGETLIB = $(MWIDGETSRC)/llib-l/Xm.ln
  450. X     LINTXMTOOL = $(MTOOLKITSRC)/llib-lXt.ln
  451. X     LINTUILLIB = $(UILSRC)/llib-lUil.ln
  452. X
  453. X      YACCFLAGS =
  454. X       UILFLAGS =
  455. X
  456. X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut   *.Dat
  457. X
  458. X    STD_DEFINES = -DXML -pipe -DX_LOCALE
  459. X
  460. X  DEPEXTENSIONLIB = $(USRLIBDIR)/libXext.a
  461. X     EXTENSIONLIB =              -lXext
  462. X
  463. X          DEPXLIB = $(DEPEXTENSIONLIB) $(USRLIBDIR)/libX11.a
  464. X             XLIB = $(EXTENSIONLIB)              -lX11
  465. X
  466. X      DEPXAUTHLIB = $(USRLIBDIR)/libXau.a
  467. X         XAUTHLIB =              -lXau
  468. X      DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a
  469. X         XDMCPLIB =              -lXdmcp
  470. X
  471. X        DEPXMULIB = $(USRLIBDIR)/libXmu.a
  472. X           XMULIB =              -lXmu
  473. X
  474. X       DEPOLDXLIB = $(USRLIBDIR)/liboldX.a
  475. X          OLDXLIB =              -loldX
  476. X
  477. X      DEPXTOOLLIB = $(USRLIBDIR)/libXt.a
  478. X         XTOOLLIB =              -lXt
  479. X
  480. X        DEPXAWLIB = $(USRLIBDIR)/libXaw.a
  481. X           XAWLIB =              -lXaw
  482. X
  483. X        DEPXILIB = $(USRLIBDIR)/libXi.a
  484. X           XILIB =              -lXi
  485. X
  486. X        DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a
  487. X           PHIGSLIB =              -lphigs
  488. X
  489. X       DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a
  490. X          XBSDLIB =              -lXbsd
  491. X
  492. X LINTEXTENSIONLIB = $(LINTLIBDIR)/llib-lXext.ln
  493. X         LINTXLIB = $(LINTLIBDIR)/llib-lX11.ln
  494. X          LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln
  495. X        LINTXTOOL = $(LINTLIBDIR)/llib-lXt.ln
  496. X          LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln
  497. X           LINTXI = $(LINTLIBDIR)/llib-lXi.ln
  498. X        LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln
  499. X
  500. X          DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)
  501. X
  502. X         DEPLIBS1 = $(DEPLIBS)
  503. X         DEPLIBS2 = $(DEPLIBS)
  504. X         DEPLIBS3 = $(DEPLIBS)
  505. X
  506. X# -------------------------------------------------------------------------
  507. X# Imake rules for building libraries, programs, scripts, and data files
  508. X# rules:  $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $
  509. X
  510. X#
  511. X# (c) Copyright 1989, 1990, 1991, 1992, 1993 OPEN SOFTWARE FOUNDATION, INC.
  512. X# ALL RIGHTS RESERVED
  513. X#
  514. X#
  515. X# Motif Release 1.2.2
  516. X#
  517. X#   $RCSfile: Motif.rules,v $ $Revision: 1.5.8.8 $ $Date: 92/12/10 18:43:17 $
  518. X
  519. X#  Rule for making shadow trees.
  520. X
  521. X# -------------------------------------------------------------------------
  522. X# start of Imakefile
  523. X
  524. X.SUFFIXES: .c .C .cc .o .y .l
  525. X
  526. X.C.o:
  527. X    $(CC) $(CFLAGS) -c $<
  528. X
  529. XCC = g++ -g
  530. X# CC = cc -g
  531. X
  532. XLOCAL_LIBRARIES += $(XLIB) $(XMULIB) -lm
  533. XEXTRA_LIBRARIES = $(LOCAL_LIBRARIES)
  534. X
  535. XDEFINES = $(XAWINCL) $(MOTIF) $(BCOPY) $(MEMCPY) $(VASIMPLE)
  536. X
  537. XDEPENDFLAGS += -I/usr/local/lib/g++-include
  538. X
  539. XMAN = xwinpr.man
  540. XSRCS = xwinpr.C
  541. XOBJS = xwinpr.o
  542. XHEADERS = patchlevel.h
  543. XETC = Imakefile README Makefile
  544. X
  545. XCC = g++ -g
  546. X
  547. X PROGRAM = xwinpr
  548. X
  549. Xall:: xwinpr
  550. X
  551. Xxwinpr: $(OBJS) $(DEPLIBS)
  552. X    $(RM) $@
  553. X    $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS)
  554. X
  555. Xinstall:: xwinpr
  556. X        -@if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \
  557. X    else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi
  558. X    $(INSTALL) -c $(INSTPGMFLAGS)  xwinpr $(DESTDIR)$(BINDIR)
  559. X
  560. Xinstall.man:: xwinpr.man
  561. X    $(RM) $(MANDIR)/xwinpr.0
  562. X    groff -Tascii -t -man xwinpr.man >/tmp/xwinpr.man
  563. X    $(INSTALL) -c $(INSTMANFLAGS) /tmp/xwinpr.man $(MANDIR)/xwinpr.0
  564. X    $(RM) /tmp/xwinpr.man
  565. X
  566. Xdepend::
  567. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  568. X
  569. Xlint:
  570. X    $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  571. Xlint1:
  572. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  573. X
  574. Xclean::
  575. X    $(RM) $(PROGRAM)
  576. X
  577. Xdepend::
  578. X    $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  579. X
  580. Xshar:
  581. X    shar $(ETC) $(SRCS) $(HEADERS) $(MAN) > xwinpr.shar
  582. X
  583. X# -------------------------------------------------------------------------
  584. X# common rules for all Makefiles - do not edit
  585. X
  586. Xemptyrule::
  587. X
  588. Xclean::
  589. X    $(RM_CMD) "#"*
  590. X
  591. XMakefile::
  592. X    -@if [ -f Makefile ]; then set -x; \
  593. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  594. X    else exit 0; fi
  595. X    $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR)
  596. X
  597. Xtags::
  598. X    $(TAGS) -w *.[ch]
  599. X    $(TAGS) -xw *.[ch] > TAGS
  600. X
  601. X# -------------------------------------------------------------------------
  602. X# empty rules for directories that do not have SUBDIRS - do not edit
  603. X
  604. Xinstall::
  605. X    @echo "install in $(CURRENT_DIR) done"
  606. X
  607. Xinstall.man::
  608. X    @echo "install.man in $(CURRENT_DIR) done"
  609. X
  610. XMakefiles::
  611. X
  612. Xincludes::
  613. X
  614. X# -------------------------------------------------------------------------
  615. X# dependencies generated by makedepend
  616. X
  617. END_OF_FILE
  618.   if test 12630 -ne `wc -c <'Makefile'`; then
  619.     echo shar: \"'Makefile'\" unpacked with wrong size!
  620.   fi
  621.   # end of 'Makefile'
  622. fi
  623. if test -f 'patchlevel.h' -a "${1}" != "-c" ; then 
  624.   echo shar: Will not clobber existing file \"'patchlevel.h'\"
  625. else
  626.   echo shar: Extracting \"'patchlevel.h'\" \(64 characters\)
  627.   sed "s/^X//" >'patchlevel.h' <<'END_OF_FILE'
  628. X#define PATCHLEVEL "Version 1.0   Thu Sep 30 19:39:30 JST 1993"
  629. END_OF_FILE
  630.   if test 64 -ne `wc -c <'patchlevel.h'`; then
  631.     echo shar: \"'patchlevel.h'\" unpacked with wrong size!
  632.   fi
  633.   # end of 'patchlevel.h'
  634. fi
  635. if test -f 'xwinpr.C' -a "${1}" != "-c" ; then 
  636.   echo shar: Will not clobber existing file \"'xwinpr.C'\"
  637. else
  638.   echo shar: Extracting \"'xwinpr.C'\" \(6634 characters\)
  639.   sed "s/^X//" >'xwinpr.C' <<'END_OF_FILE'
  640. X/*
  641. X * Copyright (C) 1993    Tetsuji Rai (tetsuji@rai.juice.or.jp)
  642. X *
  643. X * Permission to use, copy, modify, distribute, and sell this software and its
  644. X * documentation for any purpose is hereby granted without fee, provided that
  645. X * the above copyright notice appear in all copies and that both that
  646. X * copyright notice and this permission notice appear in supporting
  647. X * documentation, and that the name of Tetsuji Rai not be used in
  648. X * advertising or publicity pertaining to distribution of the software
  649. X * without specific, written prior permission.  Tetsuji Rai makes
  650. X * no representations about the suitability of this software for any purpose.
  651. X * It is provided "as is" without express or implied warranty.
  652. X *
  653. X * TETSUJI RAI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  654. X * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO
  655. X * EVENT SHALL TETSUJI RAI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  656. X * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  657. X * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  658. X * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
  659. X * OF THIS SOFTWARE.
  660. X *
  661. X * Author:  Tetsuji Rai
  662. X *          tetsuji@rai.juice.or.jp
  663. X *          74610.1537@Compuserve.Com
  664. X *          +81-3-3557-3936
  665. X */
  666. X
  667. X/*
  668. X * xwinpr.C  ver.1.0
  669. X *
  670. X */
  671. X#include <stdio.h>
  672. X#include <stdlib.h>
  673. X#include <X11/Xlib.h>
  674. X#include <X11/Xutil.h>
  675. X#include <X11/Xos.h>
  676. X#include <unistd.h>
  677. X#include <X11/cursorfont.h>
  678. X#include <X11/Xmu/WinUtil.h>
  679. X
  680. X#include <fstream.h>
  681. X
  682. X#include "patchlevel.h"
  683. X
  684. X
  685. X
  686. XXImage *xim;
  687. XDisplay *dp;
  688. XWindow win, pwin;
  689. XXWindowAttributes wattr, pwattr;
  690. Xint height, width;
  691. Xint pheight, pwidth;
  692. Xunsigned long background;
  693. Xtime_t t;
  694. X
  695. X#ifndef DEBUG
  696. Xchar *lpr = "lpr";
  697. X
  698. X#else
  699. Xchar *lpr = "cat";
  700. X
  701. X#endif
  702. X
  703. Xint dot = 100;
  704. Xint hflag = !0;            // header flag (true if necessary)
  705. Xint rflag = 0;            // reverse flag
  706. Xchar *ofile = 0;
  707. X
  708. Xvoid Usage (void);
  709. X
  710. X
  711. Xint main (int c, char **v)
  712. X{
  713. X  dp = XOpenDisplay (0);
  714. X
  715. X  for (int i = 1; i < c; i++) {
  716. X    if (!strcmp (v[i], "-help")) {    // display usage
  717. X      Usage ();
  718. X      exit (0);
  719. X    } else if (!strcmp (v[i], "-r")) {    // reverse white/black
  720. X      rflag = !0;
  721. X    } else if (!strcmp (v[i], "-o")) {    // output file
  722. X      ofile = v[++i];
  723. X    } else if (!strcmp (v[i], "-p")) {    // output program
  724. X      lpr = v[++i];
  725. X    } else if (!strcmp (v[i], "-dotpitch")) {    // dotpitch
  726. X      dot = atoi (v[++i]);
  727. X      if (!dot) {
  728. X    cerr << "xwinpr : invalid dotpitch.\n";
  729. X    exit (1);
  730. X      }
  731. X    } else if (!strcmp (v[i], "-nh")) {    // non header printing
  732. X      hflag = 0;
  733. X    } else {
  734. X      cerr << " xwinpr : unknown flag \"" << v[i] << "\"\n";
  735. X      Usage ();
  736. X      exit (1);
  737. X    }
  738. X  }
  739. X
  740. X  Cursor cursor;
  741. X
  742. X  cursor = XCreateFontCursor (dp, XC_crosshair);
  743. X  int status =
  744. X  XGrabPointer (dp, DefaultRootWindow (dp), False,
  745. X        ButtonPressMask, GrabModeSync,
  746. X        GrabModeAsync, DefaultRootWindow (dp), cursor, CurrentTime);
  747. X
  748. X  pwin = 0;
  749. X
  750. X  XEvent xe;
  751. X
  752. X  cerr << "\n- Xwinpr : \n\
  753. X  Move cursor to the window you want to print, exactly to the\n\
  754. X  point which you want to print as white(or black if you specified -r \n\
  755. X  option).\n";
  756. X
  757. X  while (pwin == 0) {
  758. X    XAllowEvents (dp, SyncPointer, CurrentTime);
  759. X    XWindowEvent (dp, DefaultRootWindow (dp), ButtonPressMask,
  760. X          &xe);
  761. X    if (xe.type == ButtonPress)
  762. X      pwin = xe.xbutton.subwindow;
  763. X  }
  764. X  win = XmuClientWindow (dp, pwin);
  765. X
  766. X  XUngrabPointer (dp, CurrentTime);
  767. X
  768. X  time_t t = time (0);
  769. X  struct tm *tm = localtime (&t);
  770. X
  771. X  int pipes[2];
  772. X
  773. X  if (!ofile)
  774. X    if (pipe (pipes)) {
  775. X      cerr << "xwinpr : pipe(2) failed.\n";
  776. X      exit (1);
  777. X    }
  778. X  if (!ofile)
  779. X    switch (fork ()) {
  780. X     case 0:            // You are the child.
  781. X      close (0);        // close stdin handle
  782. X      dup2 (pipes[0], 0);    // connect pipe output to stdin handle(0)
  783. X      close (pipes[1]);        // close input end of the pipe
  784. X      system (lpr);        // invole lpr
  785. X      exit (0);
  786. X     case -1:            // fork failed!
  787. X      cerr << "xwinpr : fork(2) failed.\n";
  788. X      exit (1);
  789. X    }
  790. X  if (!ofile)
  791. X    close (pipes[0]);
  792. X
  793. X // Well, now you are the parent!
  794. X
  795. X  ofstream *clprp;
  796. X
  797. X  if (ofile)
  798. X    clprp = new ofstream (ofile);    // open output file instead of running
  799. X // program
  800. X  else
  801. X    clprp = new ofstream (pipes[1]);    // open output stream connected to
  802. X // "lpr"
  803. X
  804. X  ofstream & clpr = *clprp;
  805. X  char *winName;
  806. X
  807. X  XFetchName (dp, win, &winName);
  808. X
  809. X  cerr << '\n'
  810. X    << "Date        : " << asctime (tm)
  811. X    << "Window ID   : " << hex << win << '\n'
  812. X    << "Window Name : " << winName << '\n';
  813. X
  814. X  if (hflag) {
  815. X    clpr << "Date    : " << asctime (tm)
  816. X      << "Window  : " << winName
  817. X      << "\n\n";
  818. X  }
  819. X  XGetWindowAttributes (dp, pwin, &pwattr);
  820. X  XGetWindowAttributes (dp, win, &wattr);
  821. X  width = wattr.width;
  822. X  height = wattr.height;
  823. X
  824. X#ifdef DEBUG
  825. X  cerr << "wid, height = " << width << "," << height << '\n';
  826. X#endif
  827. X  pwidth = (width + 7) / 8 * 2;
  828. X  pheight = height;
  829. X
  830. X  xim = XGetImage (dp, win, 0, 0, width, height, 0xffff, ZPixmap);
  831. X#ifdef DEBUG
  832. X  fprintf (stderr, "xim = %lx\n", xim);
  833. X#endif // DEBUG
  834. X
  835. X  clpr
  836. X#ifndef DEBUG
  837. X    << "\x1b["
  838. X#else
  839. X    << "(ESC)1b["
  840. X#endif
  841. X    << dec << pwidth * pheight << ';'
  842. X    << pwidth / 2 << ';'
  843. X    << dot << ";;"
  844. X    << pheight
  845. X    << "/r";
  846. X//   (fp, "\x1b[%d;%d;%d;;%d/r", pwidth * pheight, pwidth / 2, 150, pheight);
  847. X
  848. X#ifdef DEBUG
  849. X  cerr << "xe, wattr = " << xe.xbutton.x << ',' << wattr.x << ',' << pwattr.x
  850. X    << '\n'
  851. X    << xe.xbutton.y << ',' << wattr.y << ',' << pwattr.y << '\n';
  852. X#endif
  853. X  background = XGetPixel (xim, xe.xbutton.x - wattr.x - pwattr.x,
  854. X              xe.xbutton.y - wattr.y - pwattr.y);
  855. X
  856. X#ifdef DEBUG
  857. X  cerr << "background = " << background << '\n';
  858. X#endif // DEBUG
  859. X
  860. X  clpr << hex;
  861. X
  862. X  for (int xy = 0; xy < pheight; xy++) {
  863. X    int xx = 0;
  864. X
  865. X    for (int ix = 0; ix < pwidth; ix++) {
  866. X      unsigned int b = 0;
  867. X      int bitx;
  868. X
  869. X      for (bitx = 0; bitx < 4; bitx++, xx++) {
  870. X    b <<= 1;
  871. X    if (xx < width)
  872. X      b |= ((XGetPixel (xim, xx, xy) != background) ^ rflag);
  873. X      }
  874. X      clpr << b;
  875. X    }
  876. X  }
  877. X#ifndef DEBUG
  878. X  clpr << '\xc';
  879. X#else
  880. X  clpr << "(form feed)";
  881. X#endif
  882. X  exit (0);
  883. X}
  884. X
  885. X
  886. Xvoid Usage ()
  887. X{
  888. X  cout <<
  889. X  "Xwinpr : " PATCHLEVEL "\n"
  890. X  "Usage : xwinpr [options]\n"
  891. X  " where options are:\n"
  892. X  "  -help              : display this message.\n"
  893. X  "  -r                 : reverse black and white.\n"
  894. X  "  -o file            : send output to a file.\n"
  895. X  "  -p printer         : send output to the printer program.  The default\n"
  896. X  "                       is \"lpr\".\n"
  897. X  "  -dotpitch (number) : set dotpitch.  The default is 100.\n"
  898. X  "  -nh                : Non-header mode.  Header includes the date and the\n"
  899. X  "                       name of the window.\n"
  900. X  ;
  901. X}
  902. END_OF_FILE
  903.   if test 6634 -ne `wc -c <'xwinpr.C'`; then
  904.     echo shar: \"'xwinpr.C'\" unpacked with wrong size!
  905.   fi
  906.   # end of 'xwinpr.C'
  907. fi
  908. if test -f 'xwinpr.man' -a "${1}" != "-c" ; then 
  909.   echo shar: Will not clobber existing file \"'xwinpr.man'\"
  910. else
  911.   echo shar: Extracting \"'xwinpr.man'\" \(1871 characters\)
  912.   sed "s/^X//" >'xwinpr.man' <<'END_OF_FILE'
  913. X.TH XWINPR 1 "Release 5" "X Version 11"
  914. X.SH NAME
  915. Xxwinpr \- window print utility for X (Canon LBP)
  916. X.SH SYNOPSIS
  917. X.B "xwinpr"
  918. X[\-help] [\-r] [\-o \fIfile\fP] [\-p \fIprinter\fP] [\-dotpitch 
  919. X\fIdotpitch\fP] [\-nh]
  920. X.SH DESCRIPTION
  921. X.PP
  922. X.I Xwinpr
  923. Xis a utility for hardcopying a window.  Various pixel values are classified
  924. Xinto only two colors(white and black), and printed.  If no options are 
  925. Xchosen, \fB\-p lpr\fP is assumed.
  926. X.PP
  927. XThe user selects the target window with the mouse (by clicking any 
  928. Xmouse button in the desired window), where background pixel value is
  929. Xdisplayed, which is printed as white.  The other pixel values are 
  930. Xprinted as black.  This white/black settings are reversed by \fB\-r\fP
  931. Xoption.
  932. X
  933. X.SH OPTIONS
  934. X.PP
  935. X.TP 8
  936. X.B "\-help"
  937. XPrint out the `Usage:' command syntax summary.
  938. X
  939. X.PP
  940. X.TP 8
  941. X.B "\-r"
  942. XReverse white/black; ie, pixel value you click on is black, and the others
  943. Xare white.
  944. X
  945. X.PP
  946. X.TP 8
  947. X.B "\-o \fIfile\fP"
  948. XSend output to a file instead of printing.
  949. X
  950. X.PP
  951. X.TP 8
  952. X.B "\-p \fIprinter\fP"
  953. XSend output to the print program.  The default is "lpr".  If this option is
  954. Xdefined with "\-o \fIfile\fP", it takes precedence over "\-p" option.
  955. X
  956. X.PP
  957. X.TP 8
  958. X.B "\-dotpitch \fIdotpitch\fP"
  959. XDefine the dotpitch of the printer.  The default is 100(dpi).
  960. X
  961. X.PP
  962. X.TP 8
  963. X.B "\-nh"
  964. XNon header mode.  Header (including the date and the name of the window)
  965. Xis not printed.
  966. X
  967. X.SH ENVIRONMENT
  968. X.PP
  969. X.TP 8
  970. X.B DISPLAY
  971. XTo get the default host and display number.
  972. X.SH SEE ALSO
  973. XX(1), lpr(1)
  974. X.SH BUGS
  975. XUsing \fB\-stats \-bits\fP shows some redundant information.
  976. X.PP
  977. XThe -geometry string displayed must make assumptions about the
  978. Xwindow's border width and the behavior of the application and the
  979. Xwindow manager.  As a result, the location given is not always
  980. Xcorrect.
  981. X.SH COPYRIGHT
  982. XCopyright 1993, Tetsuji Rai
  983. X.br
  984. X.SH AUTHOR
  985. XTetsuji Rai (tetsuji@rai.juice.or.jp, 74610.1537@compuserve.com)
  986. END_OF_FILE
  987.   if test 1871 -ne `wc -c <'xwinpr.man'`; then
  988.     echo shar: \"'xwinpr.man'\" unpacked with wrong size!
  989.   fi
  990.   # end of 'xwinpr.man'
  991. fi
  992. echo shar: End of archive 1 \(of 1\).
  993. cp /dev/null ark1isdone
  994. MISSING=""
  995. for I in 1 ; do
  996.     if test ! -f ark${I}isdone ; then
  997.     MISSING="${MISSING} ${I}"
  998.     fi
  999. done
  1000. if test "${MISSING}" = "" ; then
  1001.     echo You have the archive.
  1002.     rm -f ark[1-9]isdone
  1003. else
  1004.     echo You still must unpack the following archives:
  1005.     echo "        " ${MISSING}
  1006. fi
  1007. exit 0
  1008. exit 0 # Just in case...
  1009. -- 
  1010.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  1011. \X/  Amiga - The only way to fly! |    sources-x@sterling.com
  1012.  "It's intuitively obvious to the |
  1013.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  1014.