home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / x / volume20 / xgrabsc / part05 < prev    next >
Encoding:
Text File  |  1993-08-04  |  14.0 KB  |  525 lines

  1. Newsgroups: comp.sources.x
  2. From: bruce@servio.slc.com (Bruce Schuchardt)
  3. Subject: v20i104:  xgrabsc - Grab and dump X displays, Part05/05
  4. Message-ID: <1993Aug4.171740.9712@sparky.sterling.com>
  5. X-Md4-Signature: c9b709c69fbdd6b669192123960499a0
  6. Sender: chris@sparky.sterling.com (Chris Olson)
  7. Organization: Sterling Software
  8. Date: Wed, 4 Aug 1993 17:17:40 GMT
  9. Approved: chris@sterling.com
  10.  
  11. Submitted-by: bruce@servio.slc.com (Bruce Schuchardt)
  12. Posting-number: Volume 20, Issue 104
  13. Archive-name: xgrabsc/part05
  14. Environment: X11
  15. Supersedes: xgrabsc: Volume 18, Issue 52-56
  16.  
  17. #! /bin/sh
  18. # This is a shell archive.  Remove anything before this line, then unpack
  19. # it by saving it into a file and typing "sh file".  To overwrite existing
  20. # files, type "sh file -c".  You can also feed this as standard input via
  21. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  22. # will see the following message at the end:
  23. #        "End of archive 5 (of 5)."
  24. # Contents:  xgrabsc.2_3/Acks xgrabsc.2_3/Imakefile
  25. #   xgrabsc.2_3/ad2c.sed xgrabsc.2_3/checkvm.h xgrabsc.2_3/mem.hc
  26. #   xgrabsc.2_3/patchlevel.h xgrabsc.2_3/showvm.ps
  27. # Wrapped by bruce@trout on Mon Jun 28 09:14:50 1993
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'xgrabsc.2_3/Acks' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/Acks'\"
  31. else
  32. echo shar: Extracting \"'xgrabsc.2_3/Acks'\" \(1180 characters\)
  33. sed "s/^X//" >'xgrabsc.2_3/Acks' <<'END_OF_FILE'
  34. X/*========================================================================
  35. X*
  36. X* Name - Acks
  37. X*
  38. X* Version:    1.10
  39. X*
  40. X* ccsid:    @(#)Acks    1.10 - 06/25/93 12:54:07
  41. X* from:     ccs/s.Acks
  42. X* date:     06/28/93 09:14:48
  43. X*
  44. X* Description: Thanks to the people listed below for their help in this
  45. X*              project
  46. X*
  47. X*========================================================================
  48. X
  49. X
  50. X    Yves Arrouye for Encapsulated Postscript Preview (EPSI), page
  51. X    configuration contributions and many bug fixes.  Yves has contributed
  52. X    a great deal to this project.
  53. X
  54. X    George Ferguson for ad2c.sed and help in getting rid of title bars
  55. X
  56. X    David Lawrence for the memcpy() and memset() functions
  57. X
  58. X    Alan Kent for help with 4-plane problems, encapsulated postscript
  59. X    suggestions, and for testing the patch kit
  60. X
  61. X    Brian C. Smith for YIQ greyscale and Floyd-Steinberg algorithms
  62. X
  63. X    Johan Garpendal for the initial color-postscript work
  64. X
  65. X    Martin Birgmeier for the initial virtual window manager support
  66. X
  67. X    Vasco Lopes Paulo for his suggestion for the post-selection sleep
  68. X    option.
  69. X
  70. X    Hal R. Brand for binary Postscript output
  71. X
  72. X    Matt Freedman for the "-coords" selection style
  73. END_OF_FILE
  74. if test 1180 -ne `wc -c <'xgrabsc.2_3/Acks'`; then
  75.     echo shar: \"'xgrabsc.2_3/Acks'\" unpacked with wrong size!
  76. fi
  77. # end of 'xgrabsc.2_3/Acks'
  78. fi
  79. if test -f 'xgrabsc.2_3/Imakefile' -a "${1}" != "-c" ; then 
  80.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/Imakefile'\"
  81. else
  82. echo shar: Extracting \"'xgrabsc.2_3/Imakefile'\" \(1821 characters\)
  83. sed "s/^X//" >'xgrabsc.2_3/Imakefile' <<'END_OF_FILE'
  84. X/*========================================================================
  85. X *
  86. X * Name - Imakefile
  87. X *
  88. X * Version:    1.17
  89. X *
  90. X * ccsid:    @(#)Imakefile    1.17 - 06/25/93 12:54:11
  91. X * from:     ccs/s.Imakefile
  92. X * date:     06/28/93 09:14:48
  93. X *
  94. X * Description: imake file to build xgrabsc.  Use simple.mak if you
  95. X *              don't have imake.
  96. X *
  97. X *========================================================================
  98. X */
  99. X
  100. X/* #define MOTIF_XGRAB    /* uncomment this to get the Motif version of xgrab  */
  101. X
  102. X/* you can specify many config.h options here if you don't want to
  103. X * modify config.h.  E.g.,
  104. X *   DEFINES= $(SIGNAL_DEFINES) -DNO_RLE_CHECKS
  105. X */
  106. X
  107. XXRDB=/usr/bin/X11/xrdb
  108. X
  109. XCDebugFlags = -O
  110. X
  111. X
  112. X#if !defined(XmClientLibs)
  113. X#define XmClientLibs -lXm -lXt -lX11
  114. X#endif
  115. X
  116. X
  117. XSRCS1=xgrabsc.c
  118. XOBJS1=xgrabsc.o
  119. XPROGRAMS = xgrabsc xgrab
  120. X
  121. X#if defined(MOTIF_XGRAB)
  122. XSRCS2 = xgrabxm.c
  123. XOBJS2 = xgrabxm.o
  124. X#define Objs2 xgrabxm.o
  125. XLIBS2 = XmClientLibs
  126. X#define ADSource XGrabxm.res
  127. X#define ADName XGrabxm.ad
  128. X#define ADInc xgrabxm_ad.h
  129. X#else
  130. XSRCS2 = xgrabxaw.c
  131. XOBJS2 = xgrabxaw.o
  132. X#define Objs2 xgrabxaw.o
  133. XLIBS2 = XawClientLibs
  134. X#define ADSource XGrabxaw.res
  135. X#define ADName XGrabxaw.ad
  136. X#define ADInc  xgrabxaw_ad.h
  137. X#endif
  138. X
  139. X#define Nil
  140. X
  141. XComplexProgramTarget_1(xgrabsc,Nil,$(XLIB))
  142. XComplexProgramTarget_2(xgrab,Nil,$(LIBS2))
  143. XSpecialObjectRule(Objs2,$(SRCS2) ADInc config.h, Nil)
  144. X
  145. Xxgrabsc.o:: process.hc get.hc mem.hc convert.hc write.hc checkvm.h cmdopts.h \
  146. X  config.h
  147. X
  148. XADInc: xgrab_ad.h
  149. X    $(CP) xgrab_ad.h ADInc
  150. X
  151. Xxgrab_ad.h: ADName
  152. X    $(RM) xgrab_ad.h
  153. X    sed -n '1,/! ====/p' ADName | sed -n -f ad2c.sed >xgrab_ad.h
  154. X
  155. XXGrab.ad: ADName
  156. X    $(RM) XGrab.ad
  157. X    $(CP) ADName XGrab.ad
  158. X
  159. XADName: ADSource
  160. X    rm -f ADName
  161. X    $(XRDB) -n ADSource >ADName
  162. X
  163. Xclean::
  164. X    $(RM) xgrabxaw_ad.h xgrabxm_ad.h xgrabxaw xgrabxm XGrab.ad
  165. X    $(RM) XGrabxaw.ad XGrabxm.ad
  166. X
  167. XInstallAppDefaults(XGrab)
  168. END_OF_FILE
  169. if test 1821 -ne `wc -c <'xgrabsc.2_3/Imakefile'`; then
  170.     echo shar: \"'xgrabsc.2_3/Imakefile'\" unpacked with wrong size!
  171. fi
  172. # end of 'xgrabsc.2_3/Imakefile'
  173. fi
  174. if test -f 'xgrabsc.2_3/ad2c.sed' -a "${1}" != "-c" ; then 
  175.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/ad2c.sed'\"
  176. else
  177. echo shar: Extracting \"'xgrabsc.2_3/ad2c.sed'\" \(992 characters\)
  178. sed "s/^X//" >'xgrabsc.2_3/ad2c.sed' <<'END_OF_FILE'
  179. X#========================================================================
  180. X#
  181. X# Name - ad2c.sed
  182. X#
  183. X# Version:    1.2
  184. X#
  185. X# ccsid:    @(#)ad2c.sed    1.2 - 07/09/92 12:48:17
  186. X# from:     ccs/s.ad2c.sed
  187. X# date:     06/28/93 09:14:48
  188. X#
  189. X#  Name - ad2c.sed, part of the ad2c package by George Ferguson
  190. X#
  191. X#  Description:
  192. X#
  193. X#    Convert app-defaults file to C strings decls.
  194. X#
  195. X#    Invoke by: sed -n -f ad2c.sed
  196. X#
  197. X#
  198. X#  This is part of an older version of the ad2c package.
  199. X#  If you need to create fallback resources from .ad files, get the full
  200. X#  package.
  201. X#
  202. X# ========================================================================
  203. X
  204. X: read
  205. X# remove comments
  206. X/^!/d
  207. X/^#/d
  208. X# remove blanks
  209. X/^$/d
  210. X# escape quotes
  211. Xs/"/\\"/g
  212. X# escape backslash
  213. Xs/\\/\\\\/g
  214. X# except the line continuation ones
  215. Xs/\\$//g
  216. X# add leading quote
  217. Xs/^/"/
  218. X#
  219. X: test
  220. X/\\$/b slash
  221. Xs/$/",/
  222. Xp
  223. Xn
  224. Xb read
  225. X#
  226. X: slash
  227. Xp
  228. Xn
  229. X# just like "read" only doesn't add leading quote
  230. X/^!/d
  231. X/^$/d
  232. Xs/"/\\"/g
  233. Xs/\\\\/\\/g
  234. Xs/\\n/\\\\n/g
  235. Xs/\\t/\\\\t/g
  236. Xs/\\f/\\\\f/g
  237. Xs/\\b/\\\\b/g
  238. Xb test
  239. END_OF_FILE
  240. if test 992 -ne `wc -c <'xgrabsc.2_3/ad2c.sed'`; then
  241.     echo shar: \"'xgrabsc.2_3/ad2c.sed'\" unpacked with wrong size!
  242. fi
  243. # end of 'xgrabsc.2_3/ad2c.sed'
  244. fi
  245. if test -f 'xgrabsc.2_3/checkvm.h' -a "${1}" != "-c" ; then 
  246.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/checkvm.h'\"
  247. else
  248. echo shar: Extracting \"'xgrabsc.2_3/checkvm.h'\" \(976 characters\)
  249. sed "s/^X//" >'xgrabsc.2_3/checkvm.h' <<'END_OF_FILE'
  250. X/*
  251. X * Name - checkvm.h
  252. X *
  253. X * Version:    1.3
  254. X *
  255. X * ccsid:    @(#)checkvm.h    1.3 - 06/25/93 12:54:17
  256. X * from:     ccs/s.checkvm.h
  257. X * date:     06/28/93 09:14:48
  258. X *
  259. X * description:  a routine to check resource availability before attempting
  260. X *               to display a stand-alone image
  261. X */
  262. X
  263. X
  264. Xchar *CheckVM[] = {
  265. X  "/checkvm { %% bytesNeeded checkvm -",
  266. X  "  /needed exch store",
  267. X  "  /used  0 store",
  268. X  "  /maximum   0 store",
  269. X  "  vmstatus /maximum exch store /used exch store pop",
  270. X  "  /avail maximum used sub store  %% amount of vm available",
  271. X  "  avail needed lt {",
  272. X  "    /str 10 string store",
  273. X  "    gsave",
  274. X  "    0 inch 8.0 inch translate",
  275. X  "    1.0 1.0 scale",
  276. X  "    /Courier findfont 18 scalefont setfont",
  277. X  "    20 20 moveto",
  278. X  "    (There is not enough printer memory for this image.) show",
  279. X  "    20 -5 moveto",
  280. X  "    needed avail sub 10 str cvrs show",
  281. X  "    ( more bytes are needed.) show",
  282. X  "    showpage",
  283. X  "    grestore",
  284. X  "  } if",
  285. X  "} def",
  286. X  0
  287. X  };
  288. X
  289. X
  290. END_OF_FILE
  291. if test 976 -ne `wc -c <'xgrabsc.2_3/checkvm.h'`; then
  292.     echo shar: \"'xgrabsc.2_3/checkvm.h'\" unpacked with wrong size!
  293. fi
  294. # end of 'xgrabsc.2_3/checkvm.h'
  295. fi
  296. if test -f 'xgrabsc.2_3/mem.hc' -a "${1}" != "-c" ; then 
  297.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/mem.hc'\"
  298. else
  299. echo shar: Extracting \"'xgrabsc.2_3/mem.hc'\" \(1655 characters\)
  300. sed "s/^X//" >'xgrabsc.2_3/mem.hc' <<'END_OF_FILE'
  301. X/*========================================================================
  302. X *
  303. X * Name - mem.hc
  304. X *
  305. X * ccs version:    1.2
  306. X *
  307. X * ccsid:    @(#)mem.hc    1.2 - 07/06/92 10:52:47
  308. X * from:     ccs/s.mem.hc
  309. X * date:     06/28/93 09:14:49
  310. X *
  311. X * Description:  memcpy/set functions for xgrabsc
  312. X *
  313. X *
  314. X *========================================================================
  315. X */
  316. X
  317. X#ifdef MEMCPY
  318. X
  319. X/* memcpy and memset routines from C News */
  320. X
  321. X
  322. X/*
  323. X * memcpy - copy bytes
  324. X */
  325. X
  326. Xchar *
  327. Xmemcpy(dst, src, size)
  328. Xchar * dst;
  329. X char * src;
  330. Xint size;
  331. X{
  332. X        register char *d;
  333. X        register  char *s;
  334. X        register int n;
  335. X
  336. X        if (size <= 0)
  337. X                return(dst);
  338. X
  339. X        s = src;
  340. X        d = dst;
  341. X        if (s <= d && s + (size-1) >= d) {
  342. X                /* Overlap, must copy right-to-left. */
  343. X                s += size-1;
  344. X                d += size-1;
  345. X                for (n = size; n > 0; n--)
  346. X                        *d-- = *s--;
  347. X        } else
  348. X                for (n = size; n > 0; n--)
  349. X                        *d++ = *s++;
  350. X
  351. X        return(dst);
  352. X}
  353. X
  354. X/*
  355. X * memset - set bytes
  356. X *
  357. X * CHARBITS should be defined only if the compiler lacks "unsigned char".
  358. X * It should be a mask, e.g. 0377 for an 8-bit machine.
  359. X */
  360. X
  361. X#ifndef CHARBITS
  362. X#       define  UNSCHAR(c)      ((unsigned char)(c))
  363. X#else
  364. X#       define  UNSCHAR(c)      ((c)&CHARBITS)
  365. X#endif
  366. X
  367. Xchar *
  368. Xmemset(s, ucharfill, size)
  369. X char * s;
  370. Xregister int ucharfill;
  371. Xint size;
  372. X{
  373. X        register  char *scan;
  374. X        register int n;
  375. X        register int uc;
  376. X
  377. X        scan = s;
  378. X        uc = UNSCHAR(ucharfill);
  379. X        for (n = size; n > 0; n--)
  380. X                *scan++ = uc;
  381. X
  382. X        return(s);
  383. X}
  384. X#endif /* MEMCPY */
  385. X
  386. X
  387. X
  388. X
  389. END_OF_FILE
  390. if test 1655 -ne `wc -c <'xgrabsc.2_3/mem.hc'`; then
  391.     echo shar: \"'xgrabsc.2_3/mem.hc'\" unpacked with wrong size!
  392. fi
  393. # end of 'xgrabsc.2_3/mem.hc'
  394. fi
  395. if test -f 'xgrabsc.2_3/patchlevel.h' -a "${1}" != "-c" ; then 
  396.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/patchlevel.h'\"
  397. else
  398. echo shar: Extracting \"'xgrabsc.2_3/patchlevel.h'\" \(863 characters\)
  399. sed "s/^X//" >'xgrabsc.2_3/patchlevel.h' <<'END_OF_FILE'
  400. X#ifndef PATCHLEVEL_H
  401. X#define PATCHLEVEL_H
  402. X/*========================================================================
  403. X*
  404. X* Name - patchlevel.h
  405. X*
  406. X* Version:    1.13
  407. X*
  408. X* ccsid:    @(#)patchlevel.h    1.13 - 04/26/93 17:44:30
  409. X* from:     ccs/s.patchlevel.h
  410. X* date:     06/28/93 09:14:49
  411. X*
  412. X* Copyright (C), 1990-93 Bruce Schuchardt
  413. X* See cpyright.h for full copyright information.
  414. X*  
  415. X* Description: patch level for xgrabsc
  416. X*
  417. X*========================================================================*/
  418. X
  419. X/* XGRABSC_PATCHLEVEL has no bearing on the patch level for individual
  420. X * versions.  Starting with v2.0, version minor numbers indicate the
  421. X * patch level for a particular version.  XGRABSC_PATCHLEVEL indicates
  422. X * the number of released patches/versions since v1.0 was released in
  423. X * 1990.
  424. X */
  425. X
  426. X#define XGRABSC_PATCHLEVEL 10
  427. X
  428. X#define XGRABSC_VERSION "2.3 06/28/93 09:14:49"
  429. X#endif
  430. END_OF_FILE
  431. if test 863 -ne `wc -c <'xgrabsc.2_3/patchlevel.h'`; then
  432.     echo shar: \"'xgrabsc.2_3/patchlevel.h'\" unpacked with wrong size!
  433. fi
  434. # end of 'xgrabsc.2_3/patchlevel.h'
  435. fi
  436. if test -f 'xgrabsc.2_3/showvm.ps' -a "${1}" != "-c" ; then 
  437.   echo shar: Will not clobber existing file \"'xgrabsc.2_3/showvm.ps'\"
  438. else
  439. echo shar: Extracting \"'xgrabsc.2_3/showvm.ps'\" \(1497 characters\)
  440. sed "s/^X//" >'xgrabsc.2_3/showvm.ps' <<'END_OF_FILE'
  441. X%!
  442. X%%Creator: Bruce_Schuchardt
  443. X%%Title: showvm.ps
  444. X%%Version:       1.3
  445. X%%
  446. X%% ccsid:         @(#)showvm.ps    1.3 - 07/06/92 10:52:55
  447. X%% from:          ccs/s.showvm.ps
  448. X%% CreationDate:  06/28/93 09:14:49
  449. X%%
  450. X%% Description: a Postscript function to display vmstatus.
  451. X%%              Send this file to your printer to see how much vm is
  452. X%%              available for print jobs.
  453. X%%              Copy the dispvm function into xgrabsc postscript output
  454. X%%              and put
  455. X%%                    20 20 dispvm showpage
  456. X%%              after the xgrabsc showpage to see how much is left after
  457. X%%              printing your image
  458. X%%
  459. X%%EndComments
  460. Xgsave
  461. X
  462. X/inch {72 mul} def
  463. X
  464. X/dispvm {   %% x y dispvm -
  465. X  gsave
  466. X  /level 0 store
  467. X  /used  0 store
  468. X  /maximum 0 store
  469. X  /str 10 string store
  470. X
  471. X  vmstatus /maximum exch store /used exch store /level exch store
  472. X  level 10 str cvrs /slevel exch store
  473. X  used  10 str cvrs /sused exch store
  474. X  maximum 10 str cvrs /smaximum exch store
  475. X
  476. X  0.0 inch 8.0 inch translate
  477. X
  478. X  /Courier findfont 18 scalefont setfont          %% get a known font
  479. X  2 copy moveto                                   %% x y -> x y x y
  480. X  (Here are the current VM statistics:) show
  481. X  2 copy 20 sub moveto
  482. X  (level: ) show level 10 str cvrs show ( (level of 'save' nesting)) show
  483. X  2 copy 40 sub moveto
  484. X  (used:  ) show  used  10 str cvrs show ( (bytes)) show
  485. X  60 sub moveto
  486. X  (max:   ) show  maximum 10 str cvrs show ( (bytes)) show
  487. X  grestore
  488. X} bind def
  489. X
  490. X20 20 dispvm
  491. X
  492. Xgrestore
  493. Xshowpage
  494. X%%Trailer
  495. END_OF_FILE
  496. if test 1497 -ne `wc -c <'xgrabsc.2_3/showvm.ps'`; then
  497.     echo shar: \"'xgrabsc.2_3/showvm.ps'\" unpacked with wrong size!
  498. fi
  499. # end of 'xgrabsc.2_3/showvm.ps'
  500. fi
  501. echo shar: End of archive 5 \(of 5\).
  502. cp /dev/null ark5isdone
  503. MISSING=""
  504. for I in 1 2 3 4 5 ; do
  505.     if test ! -f ark${I}isdone ; then
  506.     MISSING="${MISSING} ${I}"
  507.     fi
  508. done
  509. if test "${MISSING}" = "" ; then
  510.     echo You have unpacked all 5 archives.
  511.     rm -f ark[1-9]isdone
  512. else
  513.     echo You still need to unpack the following archives:
  514.     echo "        " ${MISSING}
  515. fi
  516. ##  End of shell archive.
  517. exit 0
  518.  
  519. exit 0 # Just in case...
  520. -- 
  521.   // chris@Sterling.COM           | Send comp.sources.x submissions to:
  522. \X/  Amiga - The only way to fly! |    sources-x@sterling.com
  523.  "It's intuitively obvious to the |
  524.   most casual observer..."        | GCS d+/-- p+ c++ l+ m+ s++/+ g+ w+ t+ r+ x+
  525.