Newsgroups: fj.comp.texhax
Path: galaxy.trc.rwcp.or.jp!coconuts.jaist!wnoc-tyo-news!aist-nara!odins-suita!icluna!uchiyama
From: uchiyama@bacchus.in.kobe-u.ac.jp (Takanori Uchiyama)
Subject: Re: a patch of xdvi PL18 for ASCII Nihongo TeX and VFlib 2.x
Sender: news@icluna.kobe-u.ac.jp (news-admin)
Message-ID: <UCHIYAMA.95Mar27154143@in5at3.bacchus.in.kobe-u.ac.jp>
In-Reply-To: uchiyama@bacchus.in.kobe-u.ac.jp's message of Thu, 23 Mar 1995 08:46:43 GMT
Date: Mon, 27 Mar 1995 06:41:43 GMT
Distribution: fj
References: <S31514.95Mar1175527@ecc-1000.ecc.u-tokyo.ac.jp>
	<UCHIYAMA.95Mar10222526@in5at3.bacchus.in.kobe-u.ac.jp>
	<MIYU.95Mar13144633@pigeon.shiratori.riec.tohoku.ac.jp>
	<UCHIYAMA.95Mar13185933@in5at3.bacchus.in.kobe-u.ac.jp>
	<UCHIYAMA.95Mar13221522@in5at3.bacchus.in.kobe-u.ac.jp>
	<UCHIYAMA.95Mar14102353@in5at3.bacchus.in.kobe-u.ac.jp>
	<UCHIYAMA.95Mar14134016@in5at3.bacchus.in.kobe-u.ac.jp>
	<G3P012.95Mar23152316@aqua3a.cfi.waseda.ac.jp>
	<UCHIYAMA.95Mar23174643@in5at3.bacchus.in.kobe-u.ac.jp>
Organization: Akazawa Lab. Dept. Comp. & Systems, Fac. Eng., Kobe Univ., Kobe,
	JAPAN
Lines: 2567
Xref: galaxy.trc.rwcp.or.jp fj.comp.texhax:6080
X-originally-archived-at: http://galaxy.rwcp.or.jp/text/cgi-bin/newsarticle2?ng=fj.comp.texhax&nb=6080&hd=a
X-reformat-date: Mon, 18 Oct 2004 15:18:22 +0900
X-reformat-comment: Tabs were expanded into 4 column tabstops by the Galaxy's archiver. See http://katsu.watanabe.name/ancientfj/galaxy-format.html for more info.

$BFb;3!w?@8MBg$G$9(B.

In article <UCHIYAMA.95Mar23174643@in5at3.bacchus.in.kobe-u.ac.jp> uchiyama@bacchus.in.kobe-u.ac.jp (Takanori Uchiyama) writes:

   $B@hF|(B, xdvipl18_epsbox+elepsf+selfile+vikey.patch $B$r%]%9%H$7$?8e(B,
   markpage+toc+printdvi $B$rDI2C$9$k%Q%C%A$r%a!<%k$GAw$C$F$$$?$@$$$?$N$G(B, 
   $B$=$l$b$"$F$F:#$O;H$C$F$$$^$9(B(640x480 $B$G$b%\%?%s$,2hLL$+$i$O$_$@$9$3$H(B
   $B$,$J$$$h$&$K$9$k%Q%C%A$b4^$^$l$F$$$^$9(B). 

$B>e5-$N%Q%C%A$rM_$7$$$H$$$&J}$+$i%a!<%k$r$$$?$@$-$^$7$?$N$G(B, $B%Q%C%A$rAw$C(B
$B$F$$$?$@$-$^$7$?8EH*!w(BIBM$B4pAC8&$5$s$N8f5v2D$N2<(B, $BBeM}Ej9F$$$?$7$^$9(B.

$B0J2<$,(B patch $B$G$9(B
------------
*** xdvi-18/Imakefile.origWed Mar 15 16:23:58 1995
--- xdvi-18/ImakefileWed Mar 15 23:20:12 1995
***************
*** 8,13 ****
--- 8,16 ----
  #defineUse_ASCIIDNP
  #undefUse_ZEIT
  #undefUse_NTTZEIT
+ #defineUse_MARKPAGE
+ #defineUse_TOC
+ #defineUse_PRINTDVI
  
  #include "XDvi.defs"
  #include "XDvi.rules"
***************
*** 74,79 ****
--- 77,129 ----
  #define SELFILE_OBJS
  #endif  /* Use_SELFILE */
  
+ #ifdefUse_MARKPAGE
+ RINGSIZE=1024
+ MARKPAGE_DEFS=-DMARKPAGE -DRINGSIZE=$(RINGSIZE)
+ #define MARKPAGE_SRCSmarkpage.c markring.c
+ #define MARKPAGE_OBJSmarkpage.o markring.o
+ #else
+ MARKPAGE_DEFS=
+ #define MARKPAGE_SRCS
+ #define MARKPAGE_OBJS
+ #endif/* Use_MARKPAGE */
+ 
+ #ifdefUse_TOC
+ MAX_PAGE=1024
+ TOC_DEFS=-DTOC -DMAX_PAGE=$(MAX_PAGE)
+ #define TOC_SRCStoc.c
+ #define TOC_OBJStoc.o
+ #else
+ TOC_DEFS=
+ #define TOC_SRCS
+ #define TOC_OBJS
+ #endif/* Use_TOC */
+ 
+ #ifdefUse_PRINTDVI
+ /* Print-out command templates */
+ PRCMDALL="(cd %d; dvi2ps %F) | lpr -P%p -J'%F'"
+ /* all pages of DVI file */
+ PRCMDCUR="(cd %d; dviselect -i %F -o /tmp/%F:%c@%r.dvi =%c; dvi2ps /tmp/%F:%c@%r.dvi) | lpr -P%p -J'%F (Page %c)'; /bin/rm /tmp/%F:%c@%r.dvi"
+ /* the current page */
+ PRCMDMRK="(cd %d; dviselect -i %F -o /tmp/%F:%m@%r.dvi =%m; dvi2ps /tmp/%F:%m@%r.dvi) | lpr -P%p -J'%F (Page %m)'; /bin/rm /tmp/%F:%m@%r.dvi"
+ /* the lastly marked page */
+ PRCMDRGN="(cd %d; dviselect -i %F -o /tmp/%F:%s-%e@%r.dvi =%s:%e; dvi2ps /tmp/%F:%s-%e@%r.dvi) | lpr -P%p -J'%F (Page %s-%e)'; /bin/rm /tmp/%F:%s-%e@%r.dvi"
+ /* pages in the region, between the current page and the lastly marked page */
+ PRCMDLST="(cd %d; dviselect -i %F -o /tmp/%F:%t@%r.dvi %A; dvi2ps /tmp/%F:%t@%r.dvi) | lpr -P%p -J'%F (Page %t)'; /bin/rm /tmp/%F:%t@%r.dvi"
+ /* all marked pages */
+ DVIPRINTER="lp"
+ /* the default printer to print-out DVI file */
+ PRINT_DEFS=-DPRINTDVI -DPRCMDALL=\"$(PRCMDALL)\" -DPRCMDCUR=\"$(PRCMDCUR)\" \
+            -DPRCMDMRK=\"$(PRCMDMRK)\" -DPRCMDRGN=\"$(PRCMDRGN)\" \
+            -DPRCMDLST=\"$(PRCMDLST)\" -DDVIPRINTER=\"$(DVIPRINTER)\"
+ #define PRINT_SRCSprint.c
+ #define PRINT_OBJSprint.o
+ #else
+ PRINT_DEFS=
+ #define PRINT_SRCS
+ #define PRINT_OBJS
+ #endif/* Use_PRINTDVI */
+ 
  LOCAL_LIBRARIES_NOT=$(VARLIBS) $(XLIB)
  DEPLIBS_NOT=$(VARDEPLIBS) $(DEPXLIB)
  LINTLIBS_NOT=$(VARLINT) $(LINTXLIB) -lm
***************
*** 83,89 ****
  
  OSDEFS=
  OPTIONDEFS=-DUSE_PK -DUSE_GF -DA4 -DBUTTONS -DGREY -DPS_GS -DTEXET -DMAKEPK \
!            $(KANJI_DEFS) $(ZEIT_DEFS)
  DEFS=-DBDPI=240 -UMSBITFIRST -UBMLONG -UBMSHORT -DVI_KEY \
       -DSELFILE $(OSDEFS) $(OPTIONDEFS)
  DEFINES=$(DEFS) -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
--- 133,140 ----
  
  OSDEFS=
  OPTIONDEFS=-DUSE_PK -DUSE_GF -DA4 -DBUTTONS -DGREY -DPS_GS -DTEXET -DMAKEPK \
!            -DSMALL_PANEL $(KANJI_DEFS) $(ZEIT_DEFS) \
!            $(MARKPAGE_DEFS) $(TOC_DEFS) $(PRINT_DEFS)
  DEFS=-DBDPI=240 -UMSBITFIRST -UBMLONG -UBMSHORT -DVI_KEY \
       -DSELFILE $(OSDEFS) $(OPTIONDEFS)
  DEFINES=$(DEFS) -DDEFAULT_FONT_PATH=\"$(DEFAULT_FONT_PATH)\" \
***************
*** 114,122 ****
  include Makefile.cfg
  
  SRCS=xdvi.c events.c dvi_init.c dvi_draw.c special.c font_open.c vf.c util.c \
!   $(VARSRCS) SELFILE_SRCS
  OBJS=xdvi.o events.o dvi_init.o dvi_draw.o special.o font_open.o vf.o util.o \
!   $(VAROBJS) SELFILE_OBJS
  
  ComplexProgramTarget(xdvi)
  
--- 165,173 ----
  include Makefile.cfg
  
  SRCS=xdvi.c events.c dvi_init.c dvi_draw.c special.c font_open.c vf.c util.c \
!   $(VARSRCS) SELFILE_SRCS MARKPAGE_SRCS TOC_SRCS PRINT_SRCS
  OBJS=xdvi.o events.o dvi_init.o dvi_draw.o special.o font_open.o vf.o util.o \
!   $(VAROBJS) SELFILE_OBJS MARKPAGE_OBJS TOC_OBJS PRINT_OBJS
  
  ComplexProgramTarget(xdvi)
  
*** xdvi-18/README.markpage+toc+printdvi.origWed Mar 15 22:32:04 1995
--- xdvi-18/README.markpage+toc+printdviWed Mar 15 22:32:04 1995
***************
*** 0 ****
--- 1,200 ----
+ 
+         << xdvi-17+markpage+toc+printdvi patch $B$K$D$$$F(B >>
+ 
+ 1993/09/13
+ $B>.Ln(B $B9/0l(B
+ onono@fuka.info.waseda.ac.jp
+ 
+ $B!{(Bxdvi-17+markpage+toc+printdvi patch $B$H$O(B
+   xdvi-17 + miyu-patch for xdvi PL17 $B$KBP$9$k%Q%C%A$G$9!#$3$N%Q%C%A$r$"(B
+   $B$F$F:n$C$?(B xdvi $B$G$O!"0J2<$N$h$&$J5!G=$r;H$&$3$H$,$G$-$^$9!#(B
+ 
+   1) Use_MARKPAGE
+   $B%Z!<%8%^!<%-%s%05!G=$r!"(BGNU Emacs $B$N%^!<%/%j%s%0Iw$K<B8=$7$?$b$N$G$9!#(B
+   $B%Z!<%8$N%^!<%/(B(`m',`a')/$B%"%s%^!<%/(B(`U',`A')$B!"%^!<%/$7$?%Z!<%8$X$N0\F0(B
+   (`'',``')$B!"%^!<%/$7$?%Z!<%8$H%+%l%s%H%Z!<%8$H$N8r49(B('"')$B!"%^!<%/$rH<$&(B
+   $B%Z!<%8%8%c%s%W(B('<','>')$B$J$I$r9T$J$($^$9!#(B
+   $B$^$?!"(B2) $B$N(B toc $B$+$i$N%^!<%-%s%0$b2DG=$G$9!#(B
+ 
+   2) Use_TOC
+   $B%Z!<%8HV9f%j%9%H$rI=<($7!"%^%&%9$G$=$N%Z!<%8$r%/%j%C%/$9$k$3$H$G!"$=$N(B
+   $B%Z!<%8$X0\F0(B($B:8%\%?%s(B)$B!"$=$N%Z!<%8$r%^!<%/(B($B??Cf%\%?%s(B)$B!"%"%s%^!<%/(B($B1&(B
+   $B%\%?%s(B)$B$9$k$3$H$,$G$-$^$9!#%I%i%C%0$K$h$j!"O"B3$9$k%Z!<%8$r%^!<%/(B/$B%"%s(B
+   $B%^!<%/$9$k$3$H$b$G$-$^$9!#(B
+ 
+   3) Use_PRINTDVI
+   `o' $B$^$?$O(B Print $B%\%?%s$G(B Print-out $B%a%K%e!<$,%]%C%W%"%C%W$7$^$9!#%U%!(B
+   $B%$%kA4BN$N=PNO$d%+%l%s%H%Z!<%8!":G8e$K%^!<%/$7$?%Z!<%8!"%j!<%8%g%s(B($B%+(B
+   $B%l%s%H%Z!<%8$H:G8e$K%^!<%/$7$?%Z!<%8$H$N4V$N%Z!<%8(B)$B!"%^!<%/$7$?A4It$N(B
+   $B%Z!<%8$r%a%K%e!<$+$iA*Br$7$F=PNO$G$-$^$9!#(B
+ 
+ $B!{F0:n$r3NG'$7$?4D6-(B
+ SunOS 4.1.3 / sun4c $B%^%7%s(B(SPARCstation$B%7%j!<%:(B)
+ 
+ $B!{%$%s%9%H!<%k$K$D$$$F(B
+ 
+   $B$^$:(B, xdvi PL17 $B$N%=!<%9!&%U%!%$%k$G$"$k(B xdvi-17.tar.gz $B$H(B
+   $B$=$l$KBP$9$k%Q%C%A(B xdvi-17miyu.patch-beta4.gz (*1)$B!"$=$7$F(B
+   $BEv3:%Q%C%A(B xdvi-17+markpage+toc+printdvi.patch $B$rMQ0U$7$^$9!#(B
+ 
+   $B<!$K(B, $B:n6H%G%#%l%/%H%j$r:n@.$7$F(B, $B$=$N%G%#%l%/%H%j$K0\$C$?8e(B, 
+   xdvi-17.tar.gz $B$rE83+$7$^$9!#$=$N$^$^(B, $B%G%#%l%/%H%j$r0\F0$7$J$$$G(B, 
+   xdvi-17miyu.patch-beta4.gz $B$rMQ$$$F%Q%C%A$r$"$F$^$9!#(B
+   $B$3$N$H$-(B, GNU $B$N%D!<%k$G$"$k(B gzip $B$*$h$S(B patch $B$,I,MW$H$J$j$^$9(B (*2)$B!#(B
+   $B$5$i$K(B xdvi-17+markpage+toc+printdvi.patch $B$rMQ$$$F%Q%C%A$r$"$F$^$9!#(B
+ 
+   $B$"$H$O(B, $B%7%9%F%`$K1~$8$F(B Imakefile $B$rJT=8$7$?8e(B, 
+   xmkmf $B$r<B9T$7$F(B Makefile $B$r@8@.$7$F(B, make $B$r<B9T$7$^$9!#(B
+ 
+   $B$J$*!"(Bmiyu-patch for xdvi PL17 $B$K$D$$$F$O!"(BREADME.miyu-patch $B$r$h$/FI(B
+   $B$s$G$/$@$5$$!#(B
+ 
+   (*1) $B$3$l$i$O(B, 
+        ftp.tohoku.ac.jp[130.34.8.9]:~ftp/pub/tex/dviwares/xdvi/PL17 $B$J$I$N(B
+        anonymous ftp $B$J$I$+$iF~<j$G$-$^$9!#(B
+   (*2) $B$3$l$i$O(B, 
+        ftp.waseda.ac.jp[133.9.1.32]:~ftp/pub/GNU/prep $B0J2<!"$^$?$O!"(B
+        ftp.ecei.tohoku.ac.jp[130.34.222.67]:~ftp/pub/GNU/gzip $B$*$h$S(B
+        ftp.ecei.tohoku.ac.jp[130.34.222.67]:~ftp/pub/GNU/patch $B0J2<$K$"$j$^$9!#(B
+ 
+ $B!{(BUse_MARKPAGE $B$*$h$S(B Use_TOC $B$K$D$$$F(B
+   $B$D$1$i$l$k%^!<%/$N:GBg?t$r(B 1024$B!"(BDVI $B%U%!%$%k$N:GBg%Z!<%8?t$bF1$8$/(B 
+   1024 $B$H$7$F$"$j$^$9!#$3$l$r1[$($k$3$H$O$^$:$J$$$H;W$$$^$9$,!"$b$7JQ99(B
+   $B$9$k>l9g$O!"(BImakefile $B$N(B RINGSIZE $B$*$h$S(B MAX_PAGE $B$r=$@5$7$F$/$@$5$$!#(B
+ 
+ $B!{(BUse_PRINTDVI $B$K$D$$$F(B
+   Imakefile $B$N(B Use_PRINTDVI $B$N$H$3$m$O!"<+8J%5%$%H$N4D6-$K9g$o$;$FJQ99$7(B
+   $B$F$/$@$5$$!#(B%d $B$J$I$N0UL#$K$D$$$F$O!"(Bprint.h $B$N:G=i$NJ}$N%3%a%s%H$K=q(B
+   $B$$$F$"$j$^$9!#$^$?!"%G%U%)%k%H$G$O(B dvi2ps $B$d(B dviselect $B$rMQ$$$k$h$&$K(B
+   $B=q$$$F$"$j$^$9!#$3$N$h$&$K!"I,MW$J%Z!<%8$r@Z$j=P$7$?$j!"%W%j%s%?=PNO7A(B
+   $B<0$XJQ49$9$k:n6H$O(B xdvi $B$NFbIt$G9T$J$o$:!"30It%3%^%s%I$G=hM}$9$k$h$&$J(B
+   $B;EMM$K$7$^$7$?!#$7$?$,$C$F!"$3$l$i$N%3%^%s%I$r$"$i$+$8$a%$%s%9%H!<%k$7(B
+   $B$F$*$+$J$$$H!"(Bxdvi $B$+$i$N=PNO$,$G$-$^$;$s!#(Bdvi2ps, dvips, jdvi2kps,
+   dviselect $B$J$I!"<+8J%5%$%H$N4D6-$K9g$C$?%3%^%s%I$r%$%s%9%H!<%k$7!"$=$l(B
+   $B$K9g$o$;$F(B Imakefile $B$r=$@5$7$?>e$G(B xdvi $B$r:n$C$F$/$@$5$$!#(B
+   $B$^$?!"%G%U%)%k%H$G$O(B lpr $B$K(B -v $B%*%W%7%g%s$rM?$($F$$$^$;$s!#(BPostScript 
+   $B%W%j%s%?MQ$N%U%#%k%?$K$h$C$F$O(B -v $B%*%W%7%g%s$r$D$1$kI,MW$,$"$k$+$bCN$l(B
+   $B$^$;$s!#(B
+   $B$^$?!"%G%U%)%k%H$G$O(B dvi2ps $B$N=PNO$r(B lpr $B$NI8=`F~NO$K%Q%$%W$GM?$($F$$(B
+   $B$^$9!#(Blpr $B$K$h$C$F$O!"=PNO%G!<%?$,(B 1Mbyte $B$r1[$($k$H$=$l0J9_$r@Z$j<N$F(B
+   $B$F=PNO$9$k$h$&$J;EMM$K$J$C$F$$$k$+$bCN$l$^$;$s!#$=$N$h$&$J>l9g$O!"(B
+   dvi2ps $B$N=PNO$r0lC6%F%s%]%i%j%U%!%$%k(B(/tmp/%F:%c@%r.ps $B$J$I(B)$B$K%j%@%$%l(B
+   $B%/%H$7!"$=$l$r(B lpr -s $B$G=PNO$7!"=*N;8e$K(B rm $B$9$k$h$&$K$9$l$P$$$$$G$7$g(B
+   $B$&!#$?$@$7!"(B-s $B$N>l9g!"%9%W!<%j%s%0$;$:$K=PNO$9$k$?$a!"=PNO$,40N;$9$k(B
+   $B$^$G$=$N%U%!%$%k$r>C$;$^$;$s!#=PNO40N;$^$GBT$C$F(B rm $B$9$k!"$H$$$&<jB3$-(B
+   $B$r4JC1$K$O=q$1$J$$$H;W$&$N$G!"%G%U%)%k%H$G$O(B lpr $B$NI8=`F~NO$KM?$($kJ}(B
+   $BK!$r:N$j$^$7$?!#(B1Mbyte $B$r1[$($k$/$i$$$?$/$5$s$N%Z!<%8$r=PNO$9$k$h$&$J(B
+   $B>l9g$O!"(Bxdvi $B$NCf$+$i=PNO$;$:$K%7%'%k$N%3%^%s%I%i%$%s$+$i(B
+ % dvi2ps file.dvi > /tmp/file.ps
+ % lpr -s /tmp/file.ps
+ ($B=PNO40N;8e(B)
+ % rm /tmp/file.ps
+   $B$H$7$?J}$,$$$$$h$&$J5$$,$7$^$9(B:-)
+ 
+ $B!{FbItJQ?t(B(%f $B$J$I(B)$B$N0UL#(B
+   print.h $B$N:G=i$NJ}$N%3%a%s%H$K$b=q$$$F$"$j$^$9$,!"4JC1$K@bL@$7$F$*$-$^(B
+   $B$9!#(BImakefile $BCf$N(B PRCMD??? $B$H$$$&JQ?t$O(B
+ PRCMDLST="(cd %d; dviselect -i %F -o /tmp/%F:%t@%r.dvi %A; dvi2ps /tmp/%F:%t@%r.dvi) | lpr -P%p -J'%F (Page %t)'; /bin/rm /tmp/%F:%t@%r.dvi"
+ /* all marked pages */
+   $B$N$h$&$K!"(B% $BI=5-$NFbItJQ?t$,MQ$$$i$l$F$$$^$9!#$3$l$O!"(BDVI $B%U%!%$%k$N=P(B
+   $BNO;~$K2r<a$5$l$F<B9T$5$l$k%3%^%s%IJ8;zNs$G$9!#(B
+     PRCMDALL  DVI $B%U%!%$%k$NA4It$r=PNO(B($B$9$k;~$KMQ$$$i$l$k%3%^%s%IJ8;zNs(B)
+     PRCMDCUR  $B%+%l%s%H%Z!<%8(B($B8=:_I=<($7$F$$$k%Z!<%8(B)$B$r=PNO(B
+     PRCMDMRK  $B:G8e$K%^!<%/$7$?%Z!<%8$r=PNO(B
+     PRCMDRGN  $B%j!<%8%g%s(B($B%+%l%s%H%Z!<%8$H:G8e$K%^!<%/$7$?%Z!<%8$G64$^$l(B
+               $B$F$$$k6h4V(B)$BFb$N$9$Y$F$N%Z!<%8$r=PNO(B
+     PRCMDLST  $B%^!<%/$7$?$9$Y$F$N%Z!<%8$r=PNO(B
+   $B$3$l$i$N%3%^%s%I$O!"(BPrint-out $B%a%K%e!<$GA*Br$9$k9`L\(B
+ All pages
+ Current page
+ Marked page
+ Region
+ All marked pages
+   $B$K$=$l$>$lBP1~$7$F$$$^$9!#(B
+   $B%3%^%s%IJ8;zNs$N2r<a$O!"(B% $BI=5-$NFbItJQ?t$rE83+$9$k$3$H$K$h$C$F9T$J$o$l(B
+   $B$^$9!#3FFbItJQ?t$N0UL#$O<!$NDL$j$G$9!#(B
+     %f : $B8=:_;2>H$7$F$$$k(B DVI $B%U%!%$%k$N%U%!%$%kL>(B($B%U%k%Q%9L>(B)
+     %F : $B8=:_;2>H$7$F$$$k(B DVI $B%U%!%$%k$N%U%!%$%kL>(B(basename)
+     %d : $B8=:_;2>H$7$F$$$k(B DVI $B%U%!%$%k$,CV$+$l$F$$$k%G%#%l%/%H%jL>(B
+          ( %f = %d/%F )
+     %p : $B%W%j%s%?L>(B($B4D6-JQ?t(B PRINTER $B$,Dj5A$5$l$F$$$l$P$=$NCM!#$^$?!"(B
+          Print-menu $B$G@_Dj$5$l$k$J$i$=$NCM(B)
+     %r : xdvi $B$N%W%m%;%9(B ID
+   $B0J2<$O%Z!<%8HV9f$K4X$9$kFbItJQ?t$G$9!#$9$Y$F@dBP%Z!<%8HV9f(B($B@hF,%Z!<%8(B
+   $B$r(B1$B$H$7$FC1D4A}2C$9$k%Z!<%8HV9f!#(B\count $B$K:81&$5$l$J$$(B)$B$GI=5-$7$^$9!#(B
+     %c : $B%+%l%s%H%Z!<%8HV9f(B
+     %m : $B:G8e$K%^!<%/$7$?%Z!<%8HV9f(B
+     %s : $B%j!<%8%g%s$N3+;O%Z!<%8HV9f(B(%c $B$H(B %m $B$N:G>.CM(B)
+     %e : $B%j!<%8%g%s$N=*N;%Z!<%8HV9f(B(%c $B$H(B %m $B$N:GBgCM(B)
+     %l : $B%^!<%/$7$?%Z!<%8HV9f%j%9%H(B($B%^!<%/=g(B); $B3F%Z!<%8HV9f$O(B ',' $B$G6h@Z(B
+          $B$i$l$F$$$k(B
+     %L : $B%^!<%/$7$?%Z!<%8HV9f%j%9%H(B($B%^!<%/=g(B); $B3F%Z!<%8HV9f$O(B ' ' $B$G6h@Z(B
+          $B$i$l$F$$$k(B
+     %t : $B%^!<%/$7$?%Z!<%8HV9f%j%9%H(B($B%=!<%H$5$l$F$$$k(B); $B3F%Z!<%8HV9f$O(B
+          ',' $B$G6h@Z$i$l$F$$$k(B
+     %T : $B%^!<%/$7$?%Z!<%8HV9f%j%9%H(B($B%=!<%H$5$l$F$$$k(B); $B3F%Z!<%8HV9f$O(B
+          ' ' $B$G6h@Z$i$l$F$$$k(B
+     %k : %l $B$HF1MM!"$?$@$7!"3F%Z!<%8HV9f$NA0$K(B '=' $B$,CV$+$l$F$$$k(B
+          (dviselect $B$r2>Dj$7$F$$$k(B)
+     %K : %L $B$HF1MM!"$?$@$7!"3F%Z!<%8HV9f$NA0$K(B '=' $B$,CV$+$l$F$$$k(B
+          (dviselect $B$r2>Dj$7$F$$$k(B)
+     %a : %t $B$HF1MM!"$?$@$7!"3F%Z!<%8HV9f$NA0$K(B '=' $B$,CV$+$l$F$$$k(B
+          (dviselect $B$r2>Dj$7$F$$$k(B)
+     %A : %T $B$HF1MM!"$?$@$7!"3F%Z!<%8HV9f$NA0$K(B '=' $B$,CV$+$l$F$$$k(B
+          (dviselect $B$r2>Dj$7$F$$$k(B)
+   $B$?$H$($P!">e5-$N(B PRCMDLST $B$NDj5A$G!"(B/home/onono/doc/sample.dvi $B$r%W%l(B
+   $B%S%e!<$7$F$$$F!"(B3,6,11,17$B%Z!<%8$r%^!<%/$7$F$$$k;~$K!"(BPrint-out $B%a%K%e!<(B
+   $B$+$i(B all marked pages $B$rA*Br$9$k$H!"<B9T$5$l$kJ8;zNs$O0J2<$N$h$&$K$J$j(B
+   $B$^$9!#(B
+ (cd /home/onono/doc;
+  dviselect -i sample.dvi -o /tmp/sample.dvi:3,6,11,17@3255.dvi
+  =3 =6 =11 =17;
+  dvi2ps /tmp/sample.dvi:3,6,11,17@3255.dvi)
+ | lpr -Plp -J'sample.dvi (Page 3.6.11.17)';
+ /bin/rm /tmp/sample.dvi:3,6,11,17@3255.dvi
+   $B$?$@$7!"(Bxdvi $B$N%W%m%;%9(B ID = 3255$B!"%W%j%s%?L>(B = lp $B$H$7$^$9!#(B
+ 
+ $B!{FHN)@-(B
+   Use_MARKPAGE, Use_TOC, Use_PRINTDVI $B$O!"Aj8_$KFHN)$7$F(B#define/#undef$B$G(B
+   $B$-$k$O$:$G$9(B($B;n$7$F$$$^$;$s(B)$B!#$b$A$m$s!"(B
+ #undefUse_MARKPAGE
+ #defineUse_TOC
+ #defineUse_PRINTDVI
+   $B$G:n$C$?>l9g$O!"(Btoc $B>e$G$N%^!<%-%s%0$,$G$-$^$;$s$7(B($B%Z!<%80\F0$O$G$-$k(B)$B!"(B
+   Print-out $B%a%K%e!<$O(B All pages $B$H(B current page $B$NFs$D$@$1$K$J$k$G$7$g(B
+   $B$&!#(B
+ 
+ $B!{Cx:n8"(B
+   $BEv3:%Q%C%A$NCf$N%U%!%$%k(B
+ markring.c
+ markring.h
+ markpage.c
+ markpage.h
+ toc.c
+ toc.h
+ print.c
+ print.h
+   $B$NCx:n8"$O!":n<T$G$"$k(B
+ $B>>1:(B $B=S(B     MATSUURA Syun      syun@fuka.info.waseda.ac.jp
+ $BJ?86(B $B8|;V(B   HIRAHARA Atsushi   hirahara@fuka.info.waseda.ac.jp
+ $B>.Ln(B $B9/0l(B   ONO Kouichi        onono@fuka.info.waseda.ac.jp
+   $B$K5"B0$7$^$9!#$J$*!"Cx:n<T$rL@$i$+$K$9$k8B$j!"Ev3:%Q%C%A$N0lIt$^$?$OA4(B
+   $BBN$r2~B$!"E>Aw!":FG[I[$9$k$N$O<+M3$H$7$^$9!#(B
+ 
+ $B!{%R%^$,$"$l$P$d$m$&$+$J(B
+ 
+ 1. $B4D6-JQ?t(B, $B%*%W%7%g%s(B, $B%j%=!<%9$K$h$k;XDj(B
+ -printer*printer
+ XDVIPRALL-prall*print.all
+ XDVIPRCUR-prcur*print.currentPage
+ XDVIPRMKD-prmarked*print.markedPage
+ XDVIPRRGN-prregion*print.region
+ XDVIPRLST-prlist*print.list
+ 
+ 2. $B%Z!<%80\F0$KH<$&(B toc $B$N%9%/%m!<%k%P!<0\F0(B
+ 
+ 3. toc $B$KI=<($9$k%Z!<%8HV9f$r(B \count0 $B$r9MN8$7$?(B($B<B:]$N(B)$B%Z!<%8HV9f$K$9$k(B
+ 
+ 4. $B%^!<%/%Z!<%8%j%9%H$NI=5-$r(B
+ 5,8-12,27,29,35-36,41
+    $B$N$h$&$K$9$k(B
*** xdvi-18/README.origThu Jun  2 03:29:08 1994
--- xdvi-18/READMEWed Mar 15 22:38:12 1995
***************
*** 154,159 ****
--- 154,169 ----
  variable and the DEFAULT_SUBDIR_PATH makefile variable.
  NOQUERYSet this if you have trouble compiling the definition
  of drawingWidgetClass.
+ MARKPAGE(xdvi.c markpage.c markring.c)
+ Enables us to mark pages. Page marking is
+ implemented by the mark ring like GNU Emacs.
+ TOC(xdvi.c toc.c) displays the Table-of-Contents
+ widget as page list. Page moving and marking can
+ be worked with TOC.
+ PRINTDVI(xdvi.c print.c) Enables us to print-out all or
+ necessary pages by selecting from popup menu. It
+ requires the external dviwares, for example,
+ dviselect, dvi2ps, and so on.
  
  
  SETTING THE FONT PATH
*** xdvi-18/events.c.origWed Mar 15 16:01:51 1995
--- xdvi-18/events.cThu Mar 16 01:06:17 1995
***************
*** 52,57 ****
--- 52,69 ----
  #include <ctype.h>
  #include "xdvi.h"
  
+ #ifdefMARKPAGE
+ #include "markpage.h"
+ #endif/* MARKPAGE */
+ 
+ #ifdefTOC
+ #include "toc.h"
+ #endif/* TOC */
+ 
+ #ifdefPRINTDVI
+ #include "print.h"
+ #endif/* PRINTDVI */
+ 
  #ifndefX_NOT_STDC_ENV
  #include <stdlib.h>
  #endif
***************
*** 111,117 ****
  #definebrdr_Pixelresource._brdr_Pixel
  #endif/* TOOLKIT */
  
! staticintpageno_correct= 1;
  
  #defineclip_wmane.width
  #defineclip_hmane.height
--- 123,133 ----
  #definebrdr_Pixelresource._brdr_Pixel
  #endif/* TOOLKIT */
  
! #ifdefTOC
! EXTERNintpageno_correct = 1;
! #else
! staticintpageno_correct = 1;
! #endif/* TOC */
  
  #defineclip_wmane.width
  #defineclip_hmane.height
***************
*** 175,180 ****
--- 191,219 ----
  inty_pos;
  }
  command_table[] = {
+ #ifdef SMALL_PANEL
+ {"Quit","quit",'q',20},
+ #ifdefSELFILE
+ {"File","file",'F', 60},
+ #endif/* SELFILE */
+ {"Shrink1","sh1",1 << 8 | 's',100},
+ {"Shrink2","sh2",2 << 8 | 's',125},
+ {"Shrink3","sh3",3 << 8 | 's',150},
+ {"Shrink4","sh4",4 << 8 | 's',175},
+ {"Shrink5","sh5",5 << 8 | 's',200},
+ {"Page-10","prev10",10 << 8 | 'p',240},
+ {"Page-5","prev5",5 << 8 | 'p',265},
+ {"Prev","prev",'p',290},
+ {"Next","next",'n',315},
+ {"Page+5","next5",5 << 8 | 'n',340},
+ {"Page+10","next10",10 << 8 | 'n',365},
+ #ifPS
+ {"View PS","postscript",'v',405},
+ #endif
+ #ifdefPRINTDVI
+ {"Print","print",'o',445},
+ #endif/* PRINTDVI */
+ #else
  {"Quit","quit",'q',20},
  #ifdefSELFILE
  {"File","file",'F', 80},
***************
*** 193,198 ****
--- 232,241 ----
  #ifPS
  {"View PS","postscript",'v',750},
  #endif
+ #ifdefPRINTDVI
+ {"Print","print",'o',810},
+ #endif/* PRINTDVI */
+ #endif
  };
  
  staticvoidhandle_command();
***************
*** 204,213 ****
--- 247,265 ----
  
  staticArgcommand_args[] = {
  {XtNlabel,(XtArgVal) NULL},
+ #ifdef SMALL_PANEL
+ {XtNx,(XtArgVal) 3},
+ #else
  {XtNx,(XtArgVal) 6},
+ #endif
  {XtNy,(XtArgVal) 0},
+ #ifdef SMALL_PANEL
+ {XtNwidth,(XtArgVal) 46},
+ {XtNheight,(XtArgVal) 20},
+ #else
  {XtNwidth,(XtArgVal) 64},
  {XtNheight,(XtArgVal) 30},
+ #endif
  {XtNcallback,(XtArgVal) command_call},
  };
  
***************
*** 236,241 ****
--- 288,296 ----
  commandWidgetClass, panel_widget,
  command_args, XtNumber(command_args));
  }
+ #ifdefTOC
+ Create_TOC(panel_widget, h);
+ #endif/* TOC */
  }
  #endif/* BUTTONS */
  
***************
*** 266,272 ****
--- 321,332 ----
  staticintnumber= 0;
  staticintsign= 1;
  
+ #ifdefTOC
+ staticvoidcan_exposures();
+ externvoidkeystroke();
+ #else
  staticvoidcan_exposures(), keystroke();
+ #endif/* TOC */
  
  #ifdefGREY
  #definegammaresource._gamma
***************
*** 973,979 ****
--- 1033,1043 ----
   *is partially obscured and one, for example, drags a scrollbar.
   */
  
+ #ifdefTOC
+ void
+ #else
  staticvoid
+ #endif/* TOC */
  keystroke(ch, number0, arg0, eventp)
  charch;
  intnumber0;
***************
*** 981,986 ****
--- 1045,1053 ----
  XEvent*eventp;
  {
  intnext_page;
+ #ifdefMARKPAGE
+ PAGE    mark_page;
+ #endif/* MARKPAGE */
  #ifdefTOOLKIT
  Windowww;
  #endif
***************
*** 1021,1026 ****
--- 1088,1223 ----
      case 'P':/* declare current page */
  pageno_correct = arg0 * number0 - current_page;
  return;
+ #ifdefTOC
+ Set_Page();
+ #endif/* TOC */ 
+ return;
+ #ifdefMARKPAGE
+     case '<':
+ /* go to the first page */
+ next_page = 0;
+ MarkPage(current_page);
+ break;
+     case '>':
+ /* go to the last page */
+ next_page = total_pages - 1;
+ MarkPage(current_page);
+ break;
+     case 'm':
+ /* Mark a page */
+ mark_page = (arg0 ? number0 - pageno_correct : current_page);
+ if (0 <= mark_page && mark_page < total_pages) {
+   MarkPage(mark_page);
+ #ifdefTOC
+   Set_Page();
+ #endif/* TOC */ 
+ }
+ else {
+   goto bad;
+ }
+ return;
+     case 'U':
+ /* Delete the mark */
+ mark_page = (arg0 ? number0 - pageno_correct : current_page);
+ if (0 <= mark_page && mark_page < total_pages) {
+   if (ThisPageIsMarked(mark_page)) {
+     UnmarkPage(mark_page);
+ #ifdefTOC
+     Set_Page();
+ #endif/* TOC */ 
+   }
+   else {
+     goto bad;
+   }
+ }
+ else {
+   goto bad;
+ }
+ return;
+     case 'a':
+ /* Mark all pages */
+ for(mark_page = 0; mark_page < total_pages; mark_page++) {
+   MarkPage(mark_page);
+ }
+ #ifdefTOC
+ Set_Page();
+ #endif/* TOC */ 
+ return;
+     case 'A':
+ /* Unmark all pages */
+ if(! EmptyPageMarkRing()) {
+   MakePageMarkRingNull();
+ #ifdefTOC
+   Set_Page();
+ #endif/* TOC */ 
+ }
+ else {
+   goto bad;
+ }
+ return;
+     case '\'':
+ /* Goto lastly marked page */
+ if (! EmptyPageMarkRing()) {
+   PAGE last_mark;
+ 
+   last_mark = LastMarkPage();
+   mark_page = last_mark;
+   while (! (0 <= mark_page && mark_page < total_pages)) {
+     RotatePageMarkRing();
+     mark_page = LastMarkPage();
+     if ( mark_page==last_mark ) {
+       goto bad;
+     }
+   }
+   next_page = mark_page;
+ }
+ else {
+   goto bad;
+ }
+ break;
+     case '\"':
+ /* Exchange current page and lastly marked page */
+ if (! EmptyPageMarkRing()) {
+   PAGE last_mark;
+ 
+   last_mark = LastMarkPage();
+   mark_page = last_mark;
+   while (! (0 <= mark_page && mark_page < total_pages)) {
+     RotatePageMarkRing();
+     mark_page = LastMarkPage();
+     if ( mark_page==last_mark ) {
+       goto bad;
+     }
+   }
+   SetPageMarkAtLast(next_page);
+   next_page = mark_page;
+ }
+ else {
+   goto bad;
+ }
+ break;
+     case '`':
+ /* Trace back Page Mark Ring */
+ if (! EmptyPageMarkRing()) {
+   PAGE last_mark;
+ 
+   last_mark = LastMarkPage();
+   mark_page = last_mark;
+   while (! (0 <= mark_page && mark_page < total_pages)) {
+     RotatePageMarkRing();
+     mark_page = LastMarkPage();
+     if ( mark_page==last_mark ) {
+       goto bad;
+     }
+   }
+   RotatePageMarkRing();
+   next_page = mark_page;
+ }
+ else {
+   goto bad;
+ }
+ break;
+ #endif/* MARKPAGE */
  #ifdef  VI_KEY
              case 'K':           /* toggle keep-position flag */
  #else   /* VI_KEY */
***************
*** 1055,1060 ****
--- 1252,1262 ----
  XtCallCallbacks(x_bar, XtNscrollProc,
      (XtPointer) (2 * (int) clip_w / 3));
  return;
+ #ifdefPRINTDVI
+     case 'o':                       /* Print out */
+                 print_DVI_file (top_level);
+ return;
+ #endif/* PRINTDVI */
  #ifdef  VI_KEY
              case 'k':
              case '\020':        /* control-P */
***************
*** 1227,1232 ****
--- 1429,1438 ----
  if (0 <= next_page && next_page < total_pages) {
      if (current_page != next_page) {
  current_page = next_page;
+ #ifdefTOC
+ if ( ! resource.expert )
+   Set_Page();
+ #endif/* TOC */
  hush_spec_now = hush_spec;
  if (!resource.keep_flag) home(False);
      }
***************
*** 1281,1286 ****
--- 1487,1495 ----
      temp_args[0].value = (XtArgVal) title_name;
      XtSetValues(top_level, temp_args, XtNumber(temp_args));
  #endif
+ #ifdefMARKPAGE
+     MakePageMarkRingNull();
+ #endif/* MARKPAGE */
  } else {
      /* User cancelled, so open old file */
      if (open)
*** xdvi-18/markpage.c.origWed Mar 15 22:32:04 1995
--- xdvi-18/markpage.cWed Mar 15 22:32:04 1995
***************
*** 0 ****
--- 1,195 ----
+ /*
+  * Page mark ring for xdvi
+  *
+  * Copyright (c) 1993
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ #include <stdio.h>
+ #include "markpage.h"
+ 
+ static  MARKRING        *PageMarkRing;
+ 
+ void
+   CreateNewPageMarkRing()
+ {
+   PageMarkRing = CreateNewRing();
+ }
+ 
+ void
+   MakePageMarkRingNull()
+ {
+   MakeRingNull(PageMarkRing);
+ }
+ 
+ BOOL
+   ThisPageIsMarked(page)
+ PAGE page;
+ {
+   return(MemberOfRing(page,PageMarkRing));
+ }
+ 
+ void
+   MarkPage(page)
+ PAGE page;
+ {
+   if (ThisPageIsMarked(page)) {
+     PurgeTheValueAllFromRing(page,PageMarkRing);
+   }
+   AddElementToRing(page,PageMarkRing);
+   /* Like LRU-stack */
+ }
+ 
+ void
+   UnmarkPage(page)
+ PAGE page;
+ {
+   if (ThisPageIsMarked(page)) {
+     PurgeTheValueAllFromRing(page,PageMarkRing);
+   }
+ }
+ 
+ void
+   ReverseTheMarkOfPage(page)
+ PAGE page;
+ {
+   if (ThisPageIsMarked(page)) {
+     UnmarkPage(page);
+   }
+   else {
+     MarkPage(page);
+   }
+ }
+ 
+ BOOL
+   EmptyPageMarkRing()
+ {
+   return(EmptyRing(PageMarkRing));
+ }
+ 
+ PAGE
+   LastMarkPage()
+ {
+   return(RingLastElement(PageMarkRing));
+ }
+ 
+ void
+   SetPageMarkAtLast(page)
+ PAGE page;
+ {
+   if (! ThisPageIsMarked(page)) {
+     PurgeLastElementFromRing(PageMarkRing);
+   }
+   MarkPage(page);
+ }
+ 
+ void
+   RotatePageMarkRing()
+ {
+   RotateRing(PageMarkRing);
+ }
+ 
+ LIST_LOCATION
+   MakeMarkedPageList(PageList)
+ PAGE PageList[LISTSIZE];
+ {
+   return(MakeListFromRing(PageMarkRing,PageList));
+ }
+ 
+ LIST_LOCATION
+   MakeSortedMarkedPageList(PageList)
+ PAGE PageList[LISTSIZE];
+ {
+   return(MakeListFromRing(MakeRingSort(PageMarkRing),PageList));
+ }
+ 
+ void
+   GetMarkedPageListAsString(ResultString,prevchar,postchar,delimiter)
+ char ResultString[STRLENGTH], prevchar, postchar, delimiter;
+ {
+   PAGE          PageList[LISTSIZE];
+   LIST_LOCATION EndLocation, loc;
+   char          buff[STRLENGTH];
+   
+   ResultString[0] = NULL;
+   EndLocation = MakeMarkedPageList(PageList);
+   if (EndLocation >= INITIAL_LIST) {
+     if(prevchar!=NULL) {
+       sprintf(buff, "%c", prevchar);
+       strcat(ResultString, buff);
+     }
+     /* Put a character on the previous position of the first page number */
+     sprintf(buff, "%d", PageList[INITIAL_LIST] + 1);
+     strcat(ResultString, buff);
+     /* Put the first page number */
+     if(postchar!=NULL) {
+       sprintf(buff, "%c", postchar);
+       strcat(ResultString, buff);
+     }
+     /* Put a character on the post position of the first page number */
+     for(loc = INITIAL_LIST + 1; loc<=EndLocation; loc++) {
+       sprintf(buff, "%c", delimiter);
+       strcat(ResultString, buff);
+       /* Put the delimiter character */
+       if(prevchar!=NULL) {
+ sprintf(buff, "%c", prevchar);
+ strcat(ResultString, buff);
+       }
+       /* Put a character on the previous position of the first page number */
+       sprintf(buff, "%d", PageList[loc] + 1);
+       strcat(ResultString, buff);
+       /* Put the page number */
+       if(postchar!=NULL) {
+ sprintf(buff, "%c", postchar);
+ strcat(ResultString, buff);
+       }
+       /* Put a character on the post position of the first page number */
+     }
+   }
+ }
+ 
+ void
+   GetSortedMarkedPageListAsString(ResultString,prevchar,postchar,delimiter)
+ char ResultString[STRLENGTH], prevchar, postchar, delimiter;
+ {
+   PAGE          PageList[LISTSIZE];
+   LIST_LOCATION EndLocation, loc;
+   char          buff[STRLENGTH];
+   
+   ResultString[0] = NULL;
+   EndLocation = MakeSortedMarkedPageList(PageList);
+   if (EndLocation >= INITIAL_LIST) {
+     if(prevchar!=NULL) {
+       sprintf(buff, "%c", prevchar);
+       strcat(ResultString, buff);
+     }
+     /* Put a character on the previous position of the first page number */
+     sprintf(buff, "%d", PageList[INITIAL_LIST] + 1);
+     strcat(ResultString, buff);
+     /* Put the first page number */
+     if(postchar!=NULL) {
+       sprintf(buff, "%c", postchar);
+       strcat(ResultString, buff);
+     }
+     /* Put a character on the post position of the first page number */
+     for(loc = INITIAL_LIST + 1; loc<=EndLocation; loc++) {
+       sprintf(buff, "%c", delimiter);
+       strcat(ResultString, buff);
+       /* Put the delimiter character */
+       if(prevchar!=NULL) {
+ sprintf(buff, "%c", prevchar);
+ strcat(ResultString, buff);
+       }
+       /* Put a character on the previous position of the first page number */
+       sprintf(buff, "%d", PageList[loc] + 1);
+       strcat(ResultString, buff);
+       /* Put the page number */
+       if(postchar!=NULL) {
+ sprintf(buff, "%c", postchar);
+ strcat(ResultString, buff);
+       }
+       /* Put a character on the post position of the first page number */
+     }
+   }
+ }
*** xdvi-18/markpage.h.origWed Mar 15 22:32:04 1995
--- xdvi-18/markpage.hWed Mar 15 22:32:04 1995
***************
*** 0 ****
--- 1,28 ----
+ /*
+  * Page mark ring for xdvi
+  *
+  * Copyright (c) 1993
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ #include "markring.h"
+ 
+ #define STRLENGTH       1024
+ 
+ typedef int     PAGE;
+ 
+ extern  void    CreateNewPageMarkRing();
+ extern  void    MakePageMarkRingNull();
+ extern  BOOL    ThisPageIsMarked();
+ extern  void    MarkPage();
+ extern  void    UnmarkPage();
+ extern  void    ReverseTheMarkOfPage();
+ extern  BOOL    EmptyPageMarkRing();
+ extern  PAGE    LastMarkPage();
+ extern  void    SetPageMarkAtLast();
+ extern  void    RotatePageMarkRing();
+ extern  LIST_LOCATION   MakeMarkedPageList();
+ extern  LIST_LOCATION   MakeSortedMarkedPageList();
+ extern  void    GetMarkedPageListAsString();
+ extern  void    GetSortedMarkedPageListAsString();
*** xdvi-18/markring.c.origWed Mar 15 22:32:04 1995
--- xdvi-18/markring.cWed Mar 15 22:32:04 1995
***************
*** 0 ****
--- 1,327 ----
+ /*
+  * Mark ring package
+  *
+  * Copyright (c) 1993
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ #include "markring.h"
+ #include <stdio.h>
+ #include <malloc.h>
+ 
+ void
+   MakeRingNull(ring)
+ MARKRING        *ring;
+ {
+   ring->front = INITIAL_FRONT;
+   ring->rear = INITIAL_REAR;
+ }
+ 
+ MARKRING
+   *CreateNewRing()
+ {
+   MARKRING      *ring;
+   
+   ring = (MARKRING *) calloc(1, sizeof(MARKRING));
+   MakeRingNull(ring);
+   return(ring);
+ }
+ 
+ BOOL
+   EmptyRing(ring)
+ MARKRING        *ring;
+ {
+   return(Is_Empty_Location(ring->front,ring->rear));
+ }
+ 
+ BOOL
+   ElementExistsHereInRing(index,ring)
+ RING_LOCATION   index;
+ MARKRING        *ring;
+ {
+   if (EmptyRing(ring)) {
+     return(FALSE);
+   }
+   else {
+     return(BetweenOnRing(ring->front,ring->rear,index));
+   }
+ }
+ 
+ BOOL
+   BetweenOnRing(pre,post,index)
+ RING_LOCATION   pre,post,index;
+ {
+   if (pre<=post) {
+     return((pre<=index)&&(index<=post));
+   }
+   else {
+     /* pre>post */
+     return(   (INITIAL_FRONT<=index) && (index<=        post)
+            || (pre          <=index) && (index<=INITIAL_REAR));
+   }
+ }
+ 
+ BOOL
+   MemberOfRing(elem,ring)
+ RING_ELEMENT    elem;
+ MARKRING        *ring;
+ {
+   register RING_LOCATION index=ring->front;
+   
+   while (! Is_Empty_Location(index,ring->rear)) {
+     if (ring->element[index]==elem) {
+       return(TRUE);
+     }
+     else {
+       index = Ring_Next_Location(index);
+     }
+   }
+   return(FALSE);
+ }
+ 
+ RING_LOCATION
+   LocationOfMemberInRing(elem,ring)
+ RING_ELEMENT    elem;
+ MARKRING        *ring;
+ {
+   register RING_LOCATION index=ring->front;
+   
+   while (! Is_Empty_Location(index,ring->rear)) {
+     if (ring->element[index]==elem) {
+       return(index);
+     }
+     else {
+       index = Ring_Next_Location(index);
+     }
+   }
+   return(ILLEGAL_LOCAT);
+ }
+ 
+ RING_ELEMENT
+   RingTopElement(ring)
+ MARKRING        *ring;
+ {
+   if (EmptyRing(ring)) {
+     fprintf(stderr,"Mark ring has no elements.\n");
+   }
+   else {
+     return(ring->element[ring->front]);
+   }
+ }
+ 
+ RING_ELEMENT
+   RingLastElement(ring)
+ MARKRING        *ring;
+ {
+   if (EmptyRing(ring)) {
+     fprintf(stderr,"Mark ring has no elements.\n");
+   }
+   else {
+     return(ring->element[ring->rear]);
+   }
+ }
+ 
+ NUMBER
+   NumberOfElementsInRing(ring)
+ MARKRING        *ring;
+ {
+   register NUMBER num=0;
+   
+   if(EmptyRing(ring)) {
+     return(num);
+   }
+   else {
+     register RING_LOCATION index=ring->front;
+     
+     while (! Is_Empty_Location(index,ring->rear)) {
+       num++;
+       index = Ring_Next_Location(index);
+     }
+     return(num);
+   }
+ }
+ 
+ void
+   PurgeOldElementFromRing(ring)
+ MARKRING        *ring;
+ {
+   if(EmptyRing(ring)) {
+     fprintf(stderr,"Mark ring has no elements.\n");
+   }
+   else {
+     ring->front = Ring_Next_Location(ring->front);
+     /* forget the oldest (first-in) element to free space */
+   }
+ }
+ 
+ void
+   PurgeLastElementFromRing(ring)
+ MARKRING        *ring;
+ {
+   if(EmptyRing(ring)) {
+     fprintf(stderr,"Mark ring has no elements.\n");
+   }
+   else {
+     ring->rear = Ring_Prev_Location(ring->rear);
+     /* forget the last (last-in) element to free space */
+   }
+ }
+ 
+ void
+   PurgeElementHereFromRing(index,ring)
+ RING_LOCATION   index;
+ MARKRING        *ring;
+ {
+   if (ElementExistsHereInRing(index,ring)) {
+     RING_LOCATION prev,next;
+     
+     ring->rear = Ring_Prev_Location(ring->rear);
+     next = index;
+     prev = next;
+     while (! Is_Empty_Location(prev,ring->rear)) {
+       next = Ring_Next_Location(prev);
+       ring->element[prev] = ring->element[next];
+       prev = next;
+     }
+   }
+   else {
+     fprintf(stderr,"There is no elements in the Mark ring.\n");
+   }
+ }
+ 
+ void
+   PurgeTheValueAllFromRing(elem,ring)
+ RING_ELEMENT    elem;
+ MARKRING        *ring;
+ {
+   register RING_LOCATION index;
+   
+   while ((index = LocationOfMemberInRing(elem,ring))!=ILLEGAL_LOCAT) {
+     PurgeElementHereFromRing(index,ring);
+   }
+ }
+ 
+ void
+   AddElementToRing(elem,ring)
+ RING_ELEMENT    elem;
+ MARKRING        *ring;
+ {
+   if (Is_Empty_Location(ring->front,Ring_Next_Location(ring->rear))) {
+     PurgeOldElementFromRing(ring);
+   }
+   ring->rear = Ring_Next_Location(ring->rear);
+   ring->element[ring->rear] = elem;
+ }
+ 
+ void
+   InsertElementToRing(elem,ring)
+ RING_ELEMENT    elem;
+ MARKRING        *ring;
+ {
+   if (Is_Empty_Location(Ring_Prev_Location(ring->front),ring->rear)) {
+     PurgeLastElementFromRing(ring);
+   }
+   ring->front = Ring_Prev_Location(ring->front);
+   ring->element[ring->front] = elem;
+ }
+ 
+ void
+   RotateRing(ring)
+ MARKRING        *ring;
+ {
+   RING_ELEMENT    elem;
+   
+   if (EmptyRing(ring)) {
+     fprintf(stderr,"Mark ring has no elements.\n");
+   }
+   else {
+     elem = RingLastElement(ring);
+     PurgeLastElementFromRing(ring);
+     InsertElementToRing(elem,ring);
+   }
+ }
+ 
+ void
+   ReverseRotateRing(ring)
+ MARKRING        *ring;
+ {
+   RING_ELEMENT    elem;
+   
+   if (EmptyRing(ring)) {
+     fprintf(stderr,"Mark ring has no elements.\n");
+   }
+   else {
+     elem = RingTopElement(ring);
+     PurgeOldElementFromRing(ring);
+     AddElementToRing(elem,ring);
+   }
+ }
+ 
+ MARKRING
+   *CopyRing(ring)
+ MARKRING        *ring;
+ {
+   register RING_LOCATION index=ring->front;
+   MARKRING      *newring;
+   
+   newring = CreateNewRing();
+   while (! Is_Empty_Location(index,ring->rear)) {
+     AddElementToRing(ring->element[index],newring);
+     index = Ring_Next_Location(index);
+   }
+   return(newring);
+ }
+ 
+ MARKRING
+   *MakeRingUnique(ring)
+ MARKRING        *ring;
+ {
+   register RING_LOCATION index=ring->front;
+   MARKRING      *newring;
+   
+   newring = CreateNewRing();
+   while (! Is_Empty_Location(index,ring->rear)) {
+     if (! MemberOfRing(ring->element[index],newring)) {
+       AddElementToRing(ring->element[index],newring);
+     }
+     index = Ring_Next_Location(index);
+   }
+   return(newring);
+ }
+ 
+ BOOL
+   RingElemCompare(elem1,elem2)
+ RING_ELEMENT *elem1,*elem2;
+ {
+   return(*elem1 - *elem2);
+ }
+ 
+ MARKRING
+   *MakeRingSort(ring)
+ MARKRING        *ring;
+ {
+   MARKRING      *newring;
+   
+   newring = CopyRing(ring);
+   qsort(newring->element,newring->rear+1,sizeof(RING_ELEMENT),RingElemCompare);
+   return(newring);
+ }
+ 
+ LIST_LOCATION
+   MakeListFromRing(ring,list)
+ MARKRING        *ring;
+ LIST_ELEMENT    list[LISTSIZE];
+ {
+   register RING_LOCATION index;
+   register LIST_LOCATION loc = INITIAL_LIST;
+   
+   index = ring->front;
+   
+   while (! Is_Empty_Location(index,ring->rear)) {
+     list[loc] = ring->element[index];
+     loc++;
+     index = Ring_Next_Location(index);
+   }
+   return(loc - 1);
+ }
*** xdvi-18/markring.h.origWed Mar 15 22:32:04 1995
--- xdvi-18/markring.hWed Mar 15 22:32:04 1995
***************
*** 0 ****
--- 1,70 ----
+ /*
+  * Mark ring package
+  *
+  * Copyright (c) 1993
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ typedef int             BOOL;
+ #ifndef TRUE
+ #define TRUE            (1)
+ #define FALSE           (0)
+ #endif
+ 
+ typedef unsigned short int      NUMBER;
+ 
+ typedef int             RING_ELEMENT;   /* contents of Ring */
+ #ifndef RINGSIZE
+ #define RINGSIZE        16
+ #endif /* RINGSIZE */
+ typedef short int       RING_LOCATION;  /* index of Ring */
+ #define ILLEGAL_LOCAT   -1              /* when location is illegal */
+ #define INITIAL_FRONT   0               /* front index */
+ #define INITIAL_REAR    RINGSIZE-1      /* rear index */
+ 
+ struct MarkRing {
+   RING_ELEMENT    element[RINGSIZE]  ;    /* Ring body */
+   RING_LOCATION   front,rear;
+   /* front     : index of first-in element */
+   /* rear      : index of last-in element */
+ };
+ 
+ typedef struct MarkRing MARKRING;
+ 
+ typedef RING_ELEMENT    LIST_ELEMENT;   /* contents of List */
+ #define LISTSIZE        RINGSIZE
+ typedef short int       LIST_LOCATION;  /* index of List */
+ #define INITIAL_LIST   0                /* initial position of List */
+ 
+ typedef LIST_ELEMENT    MARKLIST[LISTSIZE];
+ 
+ extern  void             MakeRingNull();
+ extern  MARKRING         *CreateNewRing();
+ extern  BOOL             EmptyRing();
+ extern  BOOL             ElementExistsHereInRing();
+ extern  BOOL             BetweenOnRing();
+ extern  BOOL             MemberOfRing();
+ extern  RING_LOCATION    LocationOfMemberInRing();
+ extern  RING_ELEMENT     RingTopElement();
+ extern  RING_ELEMENT     RingLastElement();
+ extern  NUMBER           NumberOfElementsInRing();
+ extern  void             PurgeOldElementFromRing();
+ extern  void             PurgeLastElementFromRing();
+ extern  void             PurgeElementHereFromRing();
+ extern  void             PurgeTheValueAllFromRing();
+ extern  void             AddElementToRing();
+ extern  void             InsertElementToRing();
+ extern  void             RotateRing();
+ extern  void             ReverseRotateRing();
+ extern  MARKRING         *CopyRing();
+ extern  MARKRING         *MakeRingUnique();
+ extern  BOOL             RingElemCompare();
+ extern  MARKRING         *MakeRingSort();
+ extern  LIST_LOCATION    MakeListFromRing();
+ 
+ #define Ring_Next_Location(i)   ( ((i)+1) % RINGSIZE )
+ #define Ring_Prev_Location(i)   ( (i)==INITIAL_FRONT ? INITIAL_REAR : ((i)-1) )
+ #define Is_Next_In_Ring(i,j)            ( Ring_Next_Location(j)==(i) )
+ #define Is_Prev_In_Ring(i,j)            ( Ring_Prev_Location(j)==(i) )
+ #define Is_Empty_Location(front,rear)   ( Is_Next_In_Ring(front,rear) )
*** xdvi-18/mksedscript.origTue May  3 06:04:55 1994
--- xdvi-18/mksedscriptWed Mar 15 22:40:22 1995
***************
*** 30,35 ****
--- 30,43 ----
  -DPS_DPS)DPS=y; PS=y;;
  -DPS_NEWS)NEWS=y; PS=y;;
  -DPS_GS)GHOST=y; PS=y;;
+ -DMARKPAGE)MARKPAGE=y;;
+ -DTOC)TOC=y;;
+ -DPRINTDVI)PRINTDVI=y;;
+ -DPRCMDALL=*)PRCMDALL=$1;;
+ -DPRCMDCUR=*)PRCMDCUR=$1;;
+ -DPRCMDMRK=*)PRCMDMRK=$1;;
+ -DPRCMDRGN=*)PRCMDRGN=$1;;
+ -DPRCMDLST=*)PRCMDLST=$1;;
  esac
  shift
  done
***************
*** 78,81 ****
--- 86,104 ----
  .B @g"
  else
  echo'/%%DEFAULT_VF_PATH%%/d'
+ fi
+ if test -z "$MARKPAGE";then
+ echo'/^#ifmarkpage/,/^#endifmarkpage/d'
+ fi
+ if test -z "$TOC";then
+ echo'/^#iftoc/,/^#endiftoc/d'
+ fi
+ if test -z "$PRINTDVI";then
+ echo'/^#ifprintdvi/,/^#endifprintdvi/d'
+ else
+ echo"s_%%prcmdall%%_`echo $PRCMDALL | sed s/-DPRCMDALL=//`_"
+ echo"s_%%prcmdcur%%_`echo $PRCMDCUR | sed s/-DPRCMDCUR=//`_"
+ echo"s_%%prcmdmrk%%_`echo $PRCMDMRK | sed s/-DPRCMDMRK=//`_"
+ echo"s_%%prcmdrgn%%_`echo $PRCMDRGN | sed s/-DPRCMDRGN=//`_"
+ echo"s_%%prcmdlst%%_`echo $PRCMDLST | sed s/-DPRCMDLST=//`_"
  fi
*** xdvi-18/print.c.origWed Mar 15 22:32:04 1995
--- xdvi-18/print.cWed Mar 15 22:32:05 1995
***************
*** 0 ****
--- 1,428 ----
+ /*
+  * print-out DVI
+  *
+  * Copyright (c) 1993
+  *      MATSUURA Syun           syun@fuka.info.waseda.ac.jp
+  *      HIRAHARA Atsushi        hirahara@fuka.info.waseda.ac.jp
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+ 
+ #include <X11/Intrinsic.h>
+ #include <X11/StringDefs.h>
+ #include <X11/Shell.h>
+ 
+ #include <X11/Xaw/AsciiText.h>
+ #include <X11/Xaw/Box.h>
+ #include <X11/Xaw/Command.h>
+ #include <X11/Xaw/Dialog.h>
+ #include <X11/Xaw/Form.h>
+ #include <X11/Xaw/Label.h>
+ #include <X11/Xaw/MenuButton.h>
+ #include <X11/Xaw/SimpleMenu.h>
+ #include <X11/Xaw/SmeBSB.h>
+ #include <X11/Xaw/Cardinals.h>
+ 
+ #include "xdvi.h"
+ #include "print.h"
+ #ifdef MARKPAGE
+ #include "markpage.h"
+ #endif /* MARKPAGE */
+ 
+ enum PRINTSTYLE
+ #ifdef MARKPAGE
+ {PRINTALL, PRINTCUR, PRINTMARKED, PRINTREGION, PRINTALLMARKED};
+ #else
+ {PRINTALL, PRINTCUR};
+ #endif /* MARKPAGE */
+ 
+ static String print_style[] =
+ #ifdef MARKPAGE
+ {LBLPRINTALL,  LBLPRINTCUR,  LBLPRINTMRK,  LBLPRINTRGN,  LBLPRINTAMK};
+ #else
+ {LBLPRINTALL,  LBLPRINTCUR};
+ #endif /* MARKPAGE */
+ 
+ static String print_command[] =
+ #ifdef MARKPAGE
+ {PRCMDALL,  PRCMDCUR,  PRCMDMRK,  PRCMDRGN,  PRCMDLST};
+ #else
+ {PRCMDALL,  PRCMDCUR};
+ #endif /* MARKPAGE */
+ 
+ static char     printer_name[PRINTERNAMELEN];
+ 
+ static Boolean  PrintMenuEnd = False;
+ 
+ static Widget   popup, dialog, print_button, print_menu;
+ 
+ static void
+   GetBaseName(pathname, basename)
+ char pathname[STRLENGTH], basename[STRLENGTH];
+ {
+   int len,i;
+   int found = -1;
+   
+   len = strlen(pathname);
+   
+   for(i=len-1; i>found; i--) {
+     if(pathname[i]==PATH_DELIMITER) /* found it */
+       found = i;
+   }
+   if (found <= -1) /* not found */
+     found = -1;
+   strcpy(basename, pathname + found + 1);
+ }
+ 
+ static void
+   GetDirName(pathname, dirname)
+ char pathname[STRLENGTH], dirname[STRLENGTH];
+ {
+   int len,i;
+   int found = -1;
+   char copypathname[STRLENGTH];
+ 
+   strcpy(copypathname, pathname);
+   
+   len = strlen(copypathname);
+   
+   for(i=len-1; i>found; i--) {
+     if(copypathname[i]==PATH_DELIMITER) /* found it */
+       found = i;
+   }
+ 
+   if (found==0) {
+     /* found, and directory is "/" */
+     copypathname[0] = PATH_DELIMITER;
+     copypathname[1] = NULL;
+   }
+   else if (found > 0) {
+     /* found, and directory is "/xxx/yyy/zz..." */
+     copypathname[found] = NULL;
+   }
+   else {
+     /* not found, pathname may be plain filename */
+     /* copy current directory */
+     copypathname[0] = '.';
+     copypathname[1] = NULL;
+   }
+   strcpy(dirname, copypathname);
+ }
+ 
+ static void
+   SubstitutePrintVar(ResultStr, SourceStr)
+ char ResultStr[STRLENGTH], SourceStr[STRLENGTH];
+ {
+   char SourceChar[STRLENGTH], DestStr[STRLENGTH], StrBuff[STRLENGTH];
+   int charpos, strlength;
+   PAGE          PageList[LISTSIZE];
+   register      LIST_LOCATION LocList, EndLocList;
+   
+   strcpy(SourceChar, SourceStr);
+   strlength=strlen(SourceChar);
+   DestStr[0] = NULL;
+   
+   for(charpos=0; charpos<strlength; charpos++) {
+     if (SourceChar[charpos]==VARMARK) { /* Is it a variable ? */
+       /* Probably it is a variable */
+       charpos++;
+       if (charpos<strlength) { /* Is the source string end ? */
+ /* No, the source string has more characters */
+ switch (SourceChar[charpos]) {
+ case VARMARK:
+   StrBuff[0] = VARMARK;
+   StrBuff[1] = NULL;
+   strcat(DestStr, StrBuff);
+   break;
+ case 'f':
+   strcat(DestStr, dvi_name);
+   break;
+ case 'F':
+   GetBaseName(dvi_name,StrBuff);
+   strcat(DestStr, StrBuff);
+   break;
+ case 'd':
+   GetDirName(dvi_name,StrBuff);
+   strcat(DestStr, StrBuff);
+   break;
+ case 'p':
+   strcat(DestStr, printer_name);
+   break;
+ case 'r':
+   sprintf(StrBuff, "%d", getpid());
+   strcat(DestStr, StrBuff);
+   break;
+ case 'c':
+   sprintf(StrBuff, "%d", current_page + 1);
+   strcat(DestStr, StrBuff);
+   break;
+ #ifdef MARKPAGE
+ case 'm':
+   sprintf(StrBuff, "%d", LastMarkPage() + 1);
+   strcat(DestStr, StrBuff);
+   break;
+ case 's':
+   sprintf(StrBuff, "%d", MIN(current_page + 1, LastMarkPage() + 1));
+   strcat(DestStr, StrBuff);
+   break;
+ case 'e':
+   sprintf(StrBuff, "%d", MAX(current_page + 1, LastMarkPage()+ 1));
+   strcat(DestStr, StrBuff);
+   break;
+ case 'l':
+   GetMarkedPageListAsString(StrBuff, NULL, NULL, ',');
+   strcat(DestStr, StrBuff);
+   break;
+ case 'L':
+   GetMarkedPageListAsString(StrBuff, NULL, NULL, ' ');
+   strcat(DestStr, StrBuff);
+   break;
+ case 't':
+   GetSortedMarkedPageListAsString(StrBuff, NULL, NULL, ',');
+   strcat(DestStr, StrBuff);
+   break;
+ case 'T':
+   GetSortedMarkedPageListAsString(StrBuff, NULL, NULL, ' ');
+   strcat(DestStr, StrBuff);
+   break;
+ case 'k':
+   GetMarkedPageListAsString(StrBuff, '=', NULL, ',');
+   strcat(DestStr, StrBuff);
+   break;
+ case 'K':
+   GetMarkedPageListAsString(StrBuff, '=', NULL, ' ');
+   strcat(DestStr, StrBuff);
+   break;
+ case 'a':
+   GetSortedMarkedPageListAsString(StrBuff, '=', NULL, ',');
+   strcat(DestStr, StrBuff);
+   break;
+ case 'A':
+   GetSortedMarkedPageListAsString(StrBuff, '=', NULL, ' ');
+   strcat(DestStr, StrBuff);
+   break;
+ #endif /* MARKPAGE */
+ default:
+   StrBuff[0] = VARMARK;
+   StrBuff[1] = SourceChar[charpos];
+   StrBuff[2] = NULL;
+   strcat(DestStr, StrBuff);
+   break;
+ }
+       }
+       else { /* The source string is end */
+ StrBuff[0] = VARMARK;
+ StrBuff[1] = NULL;
+ strcat(DestStr, StrBuff);
+ charpos--;
+       }
+     }
+     else { /* It is not a variable */
+       StrBuff[0] = SourceChar[charpos];
+       StrBuff[1] = NULL;
+       strcat(DestStr, StrBuff);
+     }
+   }
+   strcpy(ResultStr, DestStr);
+ }
+ 
+ static void
+   close_all_font_file()
+ {
+   register struct font *fontp;
+   
+   for (fontp = font_head; fontp != NULL; fontp = fontp->next)
+     if (fontp->file != NULL) {
+       Fclose(fontp->file);
+     }
+ }
+ 
+ static void
+   PrintDVI(widget, client_data, call_data)
+ Widget  widget;
+ XtPointer client_data, call_data;
+ {
+   int   PrintStyle, pid;
+   
+   PrintStyle = (int)client_data;
+ 
+   strcpy(printer_name, (char *)XawDialogGetValueString(dialog));
+   if (*printer_name==NULL) {
+     /* When the input of dialog widget as printer name is null string, */
+     /* Let it the default printer name */
+ #ifdef DVIPRINTER
+     strcpy(printer_name, DVIPRINTER);
+ #else
+     strcpy(printer_name, DEFAULTPRINTER);
+ #endif /* DVIPRINTER */
+   }
+ 
+   if ((pid = fork ()) < 0) {
+     perror("fork");
+     return;
+   }
+   /* Actual print-out work should be done with the child process */
+   /* Because the work takes long time */
+   
+   if (pid == 0) {
+     /* The following is the work for the child process */
+     /* It is the actual print-out work */
+     int  i;
+     char buff[STRLENGTH];
+     
+     close_all_font_file();
+     /* Forcedly close all font files */
+     
+     SubstitutePrintVar(buff, print_command[PrintStyle]);
+     system(buff);
+     exit(0);      
+   }
+ 
+   PrintMenuEnd = True;
+   /* Print-out pull down menu should be closed */
+ }
+ 
+ static void 
+   DestroyPopupPrompt(widget, client_data, call_data)
+ Widget  widget;
+ XtPointer client_data, call_data;
+ {
+   PrintMenuEnd = True;
+   /* Print-out pull down menu should be closed */
+ }
+ 
+ 
+ static char *
+   get_printer_name()
+ {
+   char  *p;
+   
+   if( p = getenv(ENVVARPRINTER) )
+     return(strdup(p));
+   else
+ #ifdef DVIPRINTER
+     return(strdup(DVIPRINTER));
+ #else
+     return(strdup(DEFAULTPRINTER));
+ #endif /* DVIPRINTER */
+ }
+ 
+ void
+   InitPrintMenu()
+ {
+   strcpy(printer_name, get_printer_name());
+ }
+ 
+ void
+   print_DVI_file(top_level)
+ Widget top_level;
+ {
+   Widget        entry;
+   Position      x, y;
+   Dimension     width, height;
+   int           i;
+   XtAppContext  PrintApp;
+   XEvent        event;
+   
+   XtVaGetValues(top_level,
+ XtNwidth, &width,
+ XtNheight, &height,
+ NULL);
+   XtTranslateCoords(top_level,
+     (Position) (width / 3), (Position) (height / 3),
+     &x, &y);
+   
+ 
+   popup = XtVaCreatePopupShell(LBLPRINTSH,
+        transientShellWidgetClass,
+        top_level,
+        XtNx, x,
+        XtNy, y,
+        NULL);
+   /* 
+    * The popup will contain a dialog box, prompting the user for input. 
+    */
+   
+   dialog = XtVaCreateManagedWidget(LBLPRINTER,
+    dialogWidgetClass,
+    popup,
+    XtNlabel,    (String)LBLPRINTER,
+    XtNvalue,    (String)printer_name,
+    NULL);
+ 
+   /*
+    * The prompting message's size is dynamic; allow it to request resize. 
+    */
+   
+   print_button = XtVaCreateManagedWidget(LBLPRINTOUT,
+  menuButtonWidgetClass,
+  dialog,
+  NULL);
+   XtVaSetValues(print_button,
+ XtNmenuName, LBLPRINTMENU,
+ NULL);
+   
+   XawDialogAddButton(dialog,
+      LBLCANCEL,
+      DestroyPopupPrompt,
+      (XtPointer)dialog);
+   
+   print_menu = XtVaCreatePopupShell(LBLPRINTMENU,
+     simpleMenuWidgetClass,
+     print_button,
+     NULL);
+   
+   for(i = 0; (int)XtNumber(print_style) > i; i++) {
+     switch (i) {
+     case PRINTALL:
+     case PRINTCUR:
+       entry = XtVaCreateManagedWidget(print_style[i],
+       smeBSBObjectClass,
+       print_menu,
+       NULL);
+       XtAddCallback(entry, XtNcallback, PrintDVI, (XtPointer)i);
+       break;
+ #ifdef MARKPAGE
+     case PRINTMARKED:
+     case PRINTREGION:
+     case PRINTALLMARKED:
+       if (EmptyPageMarkRing()) {
+ entry = XtVaCreateManagedWidget(print_style[i],
+ smeBSBObjectClass,
+ print_menu,
+ XtNsensitive, False,
+ NULL);
+       }
+       else {
+ entry = XtVaCreateManagedWidget(print_style[i],
+ smeBSBObjectClass,
+ print_menu,
+ NULL);
+       }
+       XtAddCallback(entry, XtNcallback, PrintDVI, (XtPointer)i);
+       break;
+ #endif
+     default:
+       break;
+     }
+   }
+ 
+   XtPopup(popup, XtGrabNone);
+ 
+   PrintMenuEnd = False;
+ 
+   XtAddGrab(popup, True, True);
+ 
+   PrintApp = XtWidgetToApplicationContext(popup);
+ 
+   while(! PrintMenuEnd) {
+     XtAppNextEvent(PrintApp, &event);
+     XtDispatchEvent(&event);
+   };
+ 
+   XtDestroyWidget(popup);
+ }
*** xdvi-18/print.h.origWed Mar 15 22:32:05 1995
--- xdvi-18/print.hWed Mar 15 22:32:05 1995
***************
*** 0 ****
--- 1,92 ----
+ /*
+  * print-out DVI
+  *
+  * Copyright (c) 1993
+  *      MATSUURA Syun           syun@fuka.info.waseda.ac.jp
+  *      HIRAHARA Atsushi        hirahara@fuka.info.waseda.ac.jp
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ /*
+  * Internal variables for print-out command string
+  *
+  * %f : filename of DVI file (full pathname)
+  * %F : filename of DVI file (basename of pathname)
+  * %d : directory where DVI file is placed (directory of pathname)
+  * %p : printer name (if the environment variable PRINTER is defined, use it)
+  * %r : proces id
+  *
+  * The following variables denote absolute page number.
+  * %c : current page number
+ #ifdef MARKPAGE
+  * %m : lastly marked page number
+  * %s : start page number of region; minimum of %c and %m
+  * %e : end page number of region; maximum of %c and %m
+  * %l : marked page list; marked order; separated by ","
+  * %L : marked page list; marked order; separated by " "
+  * %t : marked page list; sorted; separated by ","
+  * %T : marked page list; sorted; separated by " "
+  * %k : like %l; '=' is put on each page number (assumed dviselect)
+  * %K : like %L; '=' is put on each page number (assumed dviselect)
+  * %a : like %t; '=' is put on each page number (assumed dviselect)
+  * %A : like %T; '=' is put on each page number (assumed dviselect)
+ #endif
+  */
+ 
+ #define DEFAULTPRINTER  "lp"
+ #define ENVVARPRINTER   "PRINTER"
+ #define PRINTERNAMELEN  32
+ 
+ #define VARMARK    '%'
+ #ifndef PRCMDALL
+ #define PRCMDALL   "(cd %d; dvi2ps %F) | lpr -P%p -J'%F'"
+ #endif /* PRCMDALL */
+ #ifndef PRCMDCUR
+ #define PRCMDCUR   "(cd %d; dviselect -i %F -o /tmp/%F:%c@%r.dvi =%c; dvi2ps /tmp/%F:%c@%r.dvi) | lpr -P%p -J'%F (Page %c)'; /bin/rm /tmp/%F:%c@%r.dvi"
+ #endif /* PRCMDCUR */
+ #ifdef MARKPAGE
+ #ifndef PRCMDMRK
+ #define PRCMDMRK   "(cd %d; dviselect -i %F -o /tmp/%F:%m@%r.dvi =%m; dvi2ps /tmp/%F:%m@%r.dvi) | lpr -P%p -J'%F (Page %m)'; /bin/rm /tmp/%F:%m@%r.dvi"
+ #endif /* PRCMDMRK */
+ #ifndef PRCMDRGN
+ #define PRCMDRGN   "(cd %d; dviselect -i %F -o /tmp/%F:%s-%e@%r.dvi =%s:%e; dvi2ps /tmp/%F:%s-%e@%r.dvi) | lpr -P%p -J'%F (Page %s-%e)'; /bin/rm /tmp/%F:%s-%e@%r.dvi"
+ #endif /* PRCMDRGN */
+ #ifndef PRCMDLST
+ #define PRCMDLST   "(cd %d; dviselect -i %F -o /tmp/%F:%t@%r.dvi %A; dvi2ps /tmp/%F:%t@%r.dvi) | lpr -P%p -J'%F (Page %t)'; /bin/rm /tmp/%F:%t@%r.dvi"
+ #endif /* PRCMDLST */
+ #endif /* MARKPAGE */
+ 
+ #define LBLPRINTSH             "Print-out"
+ 
+ #define LBLPRINTER             "Printer name"
+ 
+ #define LBLPRINTOUT            "Print"
+ #define LBLCANCEL              "Cancel"
+ 
+ #define LBLPRINTMENU           "Print menu"
+ 
+ #define LBLPRINTALL            "All pages"
+ #define LBLPRINTCUR            "Current page"
+ #ifdef MARKPAGE
+ #define LBLPRINTMRK            "Marked page"
+ #define LBLPRINTRGN            "Region"
+ #define LBLPRINTAMK            "All marked pages"
+ #endif /* MARKPAGE */
+ 
+ #ifdef MARKPAGE
+ #define MIN(i,j)        ( (i) < (j) ? (i) : (j) )
+ #define MAX(i,j)        ( (i) > (j) ? (i) : (j) )
+ #endif /* MARKPAGE */
+ 
+ #define PATH_DELIMITER  '/'
+ 
+ typedef struct {
+   int           print_style;
+   Widget        widget;
+ } PrintOrder;
+ 
+ #define TEMPFILE        "/tmp/XDVI:%r"
+ 
+ extern void     InitPrintMenu();
+ extern void     print_DVI_file();
*** xdvi-18/toc.c.origWed Mar 15 22:32:04 1995
--- xdvi-18/toc.cThu Mar 16 01:06:43 1995
***************
*** 0 ****
--- 1,315 ----
+ /*
+  * Table of Contents / Page list for xdvi
+  *
+  * Copyright (c) 1993
+  *      MATSUURA Syun           syun@fuka.info.waseda.ac.jp
+  *      HIRAHARA Atsushi        hirahara@fuka.info.waseda.ac.jp
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ #include <stdlib.h>
+ #include <X11/Intrinsic.h>
+ #include <X11/StringDefs.h>
+ #include <X11/Shell.h>
+ 
+ #include <X11/Xaw/Dialog.h>
+ #include <X11/Xaw/Cardinals.h>
+ #include <X11/Xaw/Command.h>
+ #include <X11/Xaw/List.h>
+ #include <X11/Xaw/Viewport.h>
+ 
+ 
+ #include "xdvi.h"
+ #include "toc.h"
+ #ifdef MARKPAGE
+ #include "markpage.h"
+ #endif /* MARKPAGE */
+ 
+ externintpageno_correct;
+ 
+ static Widgetlist_widget, viewport=NULL;
+ static char*toc[MAX_PAGE];
+ static intpress_page_2 = -1;
+ static intpress_page_3 = -1;
+ 
+ externvoidkeystroke();
+ 
+ static  int
+   get_Page_size()
+ {
+   int  offset;
+   int  start_page = pageno_correct - 1;
+   int  end_page   = start_page + total_pages;
+   int  start_pageno_len;
+   int  end_pageno_len;
+   
+   if (start_page >= 0) {
+     offset = 0; /* plus symbol is hidden */
+   }
+   else {
+     offset = 1; /* offset for minus symbol */
+     start_page = - start_page;
+   }
+   for (start_pageno_len = offset; start_page > 0;
+        start_page /= 10, start_pageno_len++);
+   
+   if (end_page >= 0) {
+     offset = 0; /* plus symbol is hidden */
+   }
+   else {
+     offset = 1; /* offset for minus symbol */
+     end_page = - end_page;
+   }
+   for (end_pageno_len   = offset; end_page > 0;
+        end_page /= 10,   end_pageno_len++);
+   
+   return(MAX(start_pageno_len, end_pageno_len));
+   /* Plus 1 for minus symbol */
+ }
+ 
+ 
+ static int
+   /* get TOC's width size */
+   get_TOC_size()
+ {
+   /* Print format is "  NN<"    get_Page_size() is number of N */
+ #ifdef SMALL_PANEL
+   return  (get_Page_size()+3)*8+5;
+ #else
+   return  (get_Page_size()+3)*8+20;
+ #endif
+ }
+ 
+ 
+ static void
+   /* set TOC's string */
+   set_TOC()
+ {
+   int   i;
+   char  s[16];
+   
+   for( i=0; i<total_pages; i++){
+     if( toc[i] )   free(toc[i]);
+ #ifdef MARKPAGE
+     if (ThisPageIsMarked(i)) {
+       sprintf(s, "%c %*d%c",
+       i==LastMarkPage() ? LASTMRKPAGESYM : MRKPAGESYM,
+       get_Page_size(), i+pageno_correct,
+       i==current_page   ? CURPAGESYM     : NORMALPAGESYM);
+     }
+     else {
+       sprintf(s, "%c %*d%c",
+       NORMALPAGESYM,
+       get_Page_size(), i+pageno_correct,
+       i==current_page   ? CURPAGESYM     : NORMALPAGESYM);
+     }
+ #else
+     if(i==current_page) {
+       sprintf(s, "  %*d<", get_Page_size(), i+pageno_correct);
+     }
+     else {
+       sprintf(s, "  %*d ", get_Page_size(), i+pageno_correct);
+     }
+ #endif /* MARKPAGE */
+     toc[i] = (char *)strdup(s);
+   }
+   toc[total_pages] = NULL;
+ }
+ 
+ void
+   Set_Page()
+ {
+   set_TOC();
+   XawListChange(list_widget, toc, total_pages, 55, False);
+ }
+ 
+ 
+ /* ARGSUSED */
+ static void
+   /* Called when Button-1 Pressed */
+   SelectThisPage(w, closure, call_data)
+ Widget w;
+ XtPointer closure, call_data;
+ {
+   XawListReturnStruct *item = (XawListReturnStruct*)call_data;
+   
+   keystroke('g', item->list_index+pageno_correct, 1, (XEvent *) NULL);
+   
+   set_TOC();
+   XawListChange(w, toc, total_pages, 55, False);
+ }
+ 
+ 
+ #ifdef MARKPAGE
+ static void
+   /* Called when Button-2 | 3 pressed */
+   Press_Mark_Page(w, event, button)
+ Widget  w;
+ XEvent  *event;
+ int     button;
+ {
+   int   x;
+   
+   switch( button ) {
+     /* Get item number */
+   case  2 :  press_page_2 = x = (event->xbutton.y-1)/15;    break;
+   case  3 :  press_page_3 = x = (event->xbutton.y-1)/15;    break;
+   }
+   ReverseTheMarkOfPage(x);
+   
+   set_TOC();
+   XawListChange(w, toc, total_pages, 55, False);
+ }
+ 
+ 
+ 
+ static  void
+   /* Set or Reset TOC mark */
+   set_Drag_TOC(button, x)
+ int  button, x;
+ {
+   int  i;
+   
+   i = (button==2) ? press_page_2: press_page_3;
+   
+   if( i < x ) {
+     for( ; i<=x; i++) {
+       if (button==2) {
+ MarkPage(i);
+       }
+       else {
+ UnmarkPage(i);
+       }
+     }
+   }
+   else {
+     for( ; i>=x; i--) {
+       if (button==2) {
+ MarkPage(i);
+       }
+       else {
+ UnmarkPage(i);
+       }
+     }
+   }
+ }
+ 
+ 
+ static void
+   /* Called when Button-2 | 3 released */
+   Release_Mark_Page(w, event, button)
+ Widget  w;
+ XEvent  *event;
+ int      button;
+ {
+   int   x;
+   
+   x = (event->xbutton.y-1)/15;/* Get item number */
+   switch( button ) {
+   case  2 :  if( (press_page_2 != x) && (press_page_2 != -1) )
+     set_Drag_TOC(button, x);
+     press_page_2 = 0;
+     break;
+   case  3 :  if( (press_page_3 != x) && (press_page_3 != -1) )
+     set_Drag_TOC(button, x);
+     press_page_3 = 0;
+     break;
+   }
+   set_TOC();
+   XawListChange(w, toc, total_pages, 55, False);
+ }
+ 
+ 
+ static void
+   /* Called when mouse leaved the LIST-widget */
+   Leave_Mark_Page(w, event, button)
+ Widget  w;
+ XEvent  *event;
+ int      button;
+ {
+   press_page_2 = press_page_3 = -1;
+ }
+ #endif /* MARKPAGE */
+ 
+ 
+ static void
+   /* TOC's event handler */
+   TOCs_Event_Handler(w, n, event)
+ Widget          w;
+ int             n;
+ XEvent   *event;
+ {
+   switch( event->type ) {
+   case  ButtonPress :
+     /* when TOC pressed */
+     switch( event->xbutton.button ) {
+     case  2 : Press_Mark_Page(w, event, 2);  break;
+     case  3 : Press_Mark_Page(w, event, 3);  break;
+     }
+     break;
+     
+   case  ButtonRelease :
+     /* when TOC released */
+     switch( event->xbutton.button ) {
+     case  2 : Release_Mark_Page(w, event, 2);  break;
+     case  3 : Release_Mark_Page(w, event, 3);  break;
+     }
+     break;
+     
+   case  LeaveNotify :
+     /* when TOC leaved */
+     Leave_Mark_Page(w, event);
+     break;
+   }
+ }
+ 
+ 
+ void
+   Create_TOC(parent, h)
+ Widget    parent;
+ XtArgVal  h;
+ {
+   int   i;
+   char  s[16];
+ #ifdef SMALL_PANEL
+   int   height = h - 108;
+ #else
+   int   height = h - 208;
+ #endif
+   
+   if( total_pages > MAX_PAGE )  total_pages = MAX_PAGE;
+   
+   set_TOC();
+   
+   viewport = XtVaCreateManagedWidget("viewport", viewportWidgetClass, parent,
+      XtNallowVert,True,
+      XtNforceBars,True,
+ #ifdef SMALL_PANEL
+      XtNx,56,
+ #else
+      XtNx,78,
+ #endif
+      XtNy,20,
+      XtNheight,height,
+      XtNwidth,get_TOC_size(),
+      NULL);
+   
+   list_widget = XtVaCreateManagedWidget( "list", listWidgetClass, viewport,
+ XtNlist,toc,
+ XtNdefaultColumns,1,
+ XtNforceColumns,True,
+ XtNx,100,
+ XtNy,20,
+ XtNheight,height,
+ XtNwidth,get_TOC_size(),
+ XtNlongest,30,
+ XtNverticalList,True,
+ NULL);
+   XtAddCallback(list_widget, XtNcallback, SelectThisPage, (XtPointer) NULL);
+ #ifdef MARKPAGE
+   XtAddEventHandler(list_widget,
+     ButtonPressMask | ButtonReleaseMask | LeaveWindowMask,
+     False, TOCs_Event_Handler, NULL);
+ #endif /* MARKPAGE */
+ }
*** xdvi-18/toc.h.origWed Mar 15 22:32:04 1995
--- xdvi-18/toc.hWed Mar 15 22:32:04 1995
***************
*** 0 ****
--- 1,25 ----
+ /*
+  * Table of Contents / Page list for xdvi
+  *
+  * Copyright (c) 1993
+  *      MATSUURA Syun           syun@fuka.info.waseda.ac.jp
+  *      HIRAHARA Atsushi        hirahara@fuka.info.waseda.ac.jp
+  *      ONO Kouichi             onono@fuka.info.waseda.ac.jp
+  * All rights reserved.
+  */
+ 
+ #ifndef MAX_PAGE
+ #define MAX_PAGE        1024
+ #endif /* MAX_PAGE */
+ 
+ #define CURPAGESYM      '<'
+ #define MRKPAGESYM      '*'
+ #define LASTMRKPAGESYM  '>'
+ #define NORMALPAGESYM   ' '
+ 
+ #ifndef MAX
+ #define MAX(i,j)        ( (i) > (j) ? (i) : (j) )
+ #endif /* MAX */
+ 
+ extern  void    Create_TOC();
+ extern  void    Set_Page();
*** xdvi-18/xdvi.c.origWed Mar 15 16:01:51 1995
--- xdvi-18/xdvi.cWed Mar 15 23:34:11 1995
***************
*** 64,69 ****
--- 64,72 ----
   *PS_NEWSuse the NeWS server to render pictures/bounding boxes
   *PS_GSuse GhostScript to render pictures/bounding boxes
   *SELFILEsupport for the SelFile selection widget
+  *MARKPAGEsupport for MarkRing of page
+  *TOCsupport for Table-of-Contents widget as page list
+  *PRINTDVIsupport for print-out menu
   */
  
  #ifndeflint
***************
*** 71,76 ****
--- 74,80 ----
  "@(#) Copyright (c) 1994 Paul Vojta.  All rights reserved.\n";
  #endif
  
+ #include <stdio.h>
  #ifndefALTFONT
  #defineALTFONT"cmr10"
  #endif
***************
*** 92,97 ****
--- 96,105 ----
  #include <ctype.h>
  #include "xdvi.h"
  
+ #ifdefMARKPAGE
+ #include "markpage.h"
+ #endif/* MARKPAGE */
+ 
  #include "patchlevel.h"
  staticstruct {_Xconst chara[24], b, c, d;}
  version = {"This is xdvi patchlevel ", '0' + PATCHLEVEL / 10,
***************
*** 133,138 ****
--- 141,154 ----
  typedefintPosition;
  #endif/* TOOLKIT */
  
+ #ifdefTOC
+ #include "toc.h"
+ #endif/* TOC */
+ 
+ #ifdefPRINTDVI
+ #include "print.h"
+ #endif/* PRINTDVI */
+ 
  #ifdefVMS
  /*
   * Magnifying glass cursor
***************
*** 1199,1204 ****
--- 1215,1224 ----
  
  #endif/* TOOLKIT */
  
+ #ifdefMARKPAGE
+ CreateNewPageMarkRing();
+ #endif/* MARKPAGE */
+ 
  #ifdefSELFILE
  /* There isn't a filename by here, so pop up a selection box  JSP */
  if (dvi_name == NULL)
***************
*** 1234,1239 ****
--- 1254,1267 ----
  
  init_font_open();
  open_dvi_file();
+ 
+ #ifdefMARKPAGE
+ MakePageMarkRingNull();
+ #endif/* MARKPAGE */
+ #ifdefPRINTDVI
+ InitPrintMenu();
+ #endif/* PRINTDVI */
+ 
  if (curr_page) {
  current_page = (*curr_page ? atoi(curr_page) : total_pages) - 1;
  if (current_page < 0 || current_page >= total_pages) usage();
*** xdvi-18/xdvi.h.origWed Mar 15 16:01:51 1995
--- xdvi-18/xdvi.hThu Mar 16 01:05:54 1995
***************
*** 597,603 ****
--- 597,611 ----
  #ifdefTOOLKIT
  EXTERNWidgettop_level, vport_widget, draw_widget, clip_widget;
  #ifdefBUTTONS
+ #ifdefTOC
+ #ifdefSMALL_PANEL
+ #defineXTRA_WID112
+ #else
+ #defineXTRA_WID155
+ #endif
+ #else
  #defineXTRA_WID79
+ #endif
  EXTERNWidgetform_widget;
  #endif
  #else/* !TOOLKIT */
*** xdvi-18/xdvi_man.sed.origMon May 16 11:27:11 1994
--- xdvi-18/xdvi_man.sedWed Mar 15 22:32:05 1995
***************
*** 626,631 ****
--- 626,700 ----
  .B \-nopostscript
  option.
  #endif
+ #ifmarkpage
+ .TP
+ .B m
+ Marks the page with the given number. If no page number is given,
+ then it marks the current page.
+ Page marking behavior is like the Mark Ring of GNU Emacs (as Control-SPC),
+ but the detail is different from it; when the marks of a page are
+ duplicated, they are simplified to one mark, like the LRU-stack.
+ #iftoc
+ Also pushing Button 2 in TOC makes the page marked.
+ #endiftoc
+ .TP
+ .B U
+ Deletes mark of the page with the given number. If no page number is given,
+ then it deletes mark of the current page.
+ #iftoc
+ Also pushing Button 3 in TOC makes the page not marked.
+ #endiftoc
+ .TP
+ .B a
+ Marks all pages.
+ .TP
+ .B A
+ Deletes marks of all pages.
+ .TP
+ .B <
+ Marks the current page, and moves to the first page (like Meta-< of GNU Emacs).
+ It is same as 'm' and '1g'.
+ .TP
+ .B >
+ Marks the current page, and moves to the last page (like Meta-> of GNU Emacs).
+ It is same as 'm' and 'g'.
+ .TP
+ .B '
+ Moves to the lastly marked page.
+ .TP
+ .B \\\\"
+ Exchanges the current page and the lastly marked page, that is,
+ the current page is marked and moves to the lastly marked page,
+ then the last mark is deleted (like Control-x Control-x of GNU Emacs).
+ Exceptionally, if the current page was already marked, the last mark
+ would not be deleted. It marks the current page (this causes the current
+ page is lastly marked), and moves to the ex-lastly marked page.
+ .TP
+ .B `
+ Traces the page mark ring in the marked order, that is,
+ it moves to the lastly marked page, then
+ the lastly marked page is changed to the previous mark of it (like
+ Control-u Control-SPC of GNU Emacs).
+ When it reaches the oldest marked page, it loops back. Because the
+ page mark ring is cyclic.
+ #endifmarkpage
+ #ifprintdvi
+ .TP
+ .B o
+ Popup the print-out menu. The menu consists of ``All pages'',
+ ``Current page''
+ #ifmarkpage
+ , ``Marked page'', ``Region'', ``All marked pages''
+ #endifmarkpage
+ ; ``All pages'' means that all pages in the DVI file are printed.
+ ``Current page'' means that the current page is only printed.
+ #ifmarkpage
+ ``Marked page'' means that the lastly marked page is only printed.
+ ``Region'' means that pages in the region between the current page and
+ the lastly marked page are printed.
+ ``All marked pages'' means that the all marked page are printed.
+ #endifmarkpage
+ #endifprintdvi
  .SH MOUSE ACTIONS
  If the shrink factor is set to any number other than one, then clicking
  any mouse button will pop up a ``magnifying glass'' which shows the unshrunk
***************
*** 642,647 ****
--- 711,834 ----
  pushing Button 1 moves the image up or right by an amount equal to the distance
  from the button press to the upper left-hand corner of the window; pushing
  Button 3 moves the image down or left by the same amount.
+ #iftoc
+ .SH TABLE OF CONTENTS
+ The page number list is shown as TOC (table of contents).
+ The current page is marked with a '<' in the right margin of TOC.
+ #ifmarkpage
+ The marked pages are marked with a '*' in the left margin of TOC.
+ In particular, the lastly marked page is marked with '>' in the left
+ margin of TOC.
+ #endifmarkpage
+ Pushing Button 1 on a page number moves the current page to the page and
+ is marked with '<'.
+ #ifmarkpage
+ Pushing Button 2 on a page number makes the page marked.
+ Pushing Button 3 on a page number makes the page not marked.
+ Button 2 and 3 can be drugged, then makes all drugged pages marked/not
+ marked.
+ #endifmarkpage
+ #endiftoc
+ #ifprintdvi
+ .SH PRINT-OUT
+ Xdvi has no functions to select necessary pages for print-out and to
+ print-out these pages inside itself.
+ Therefore, xdvi requires external commands at the print-out work, for
+ example, dviselect, dvi2ps, dvips, and so on.
+ So these commands should be installed before xdvi is installed.
+ .PP
+ In order to print-out with these external commands, xdvi has command
+ strings. Xdvi interprets the corresponding command string to the
+ selected print-out work from popup menu. The interpretation is that the
+ internal variables in the command string are instantiated and the
+ instantiated command string is executed.
+ .PP
+ The meanings of internal variables are shown in the following.
+ .TP
+ .B %f
+ Filename of DVI file (full pathname)
+ .TP
+ .B %F
+ Filename of DVI file (basename of pathname)
+ .TP
+ .B %d
+ Directory where DVI file is placed (directory of pathname)
+ .TP
+ .B %p
+ Printer name (if the environment variable PRINTER is defined, use it)
+ .TP
+ .B %r
+ Proces id of xdvi
+ .PP
+ The following variables denote absolute page number.
+ .TP
+ .B %c
+ Current page number
+ #ifmarkpage
+ .TP
+ .B %m
+ Lastly marked page number
+ .TP
+ .B %s
+ Start page number of region; minimum of %c and %m
+ .TP
+ .B %e
+ End page number of region; maximum of %c and %m
+ .TP
+ .B %l
+ Marked page list; marked order; separated by ","
+ .TP
+ .B %L
+ Marked page list; marked order; separated by " "
+ .TP
+ .B %t
+ Marked page list; sorted; separated by ","
+ .TP
+ .B %T
+ Marked page list; sorted; separated by " "
+ .TP
+ .B %k
+ Like %l; '=' is put on each page number (assumed dviselect)
+ .TP
+ .B %K
+ Like %L; '=' is put on each page number (assumed dviselect)
+ .TP
+ .B %a
+ Like %t; '=' is put on each page number (assumed dviselect)
+ .TP
+ .B %A
+ Like %T; '=' is put on each page number (assumed dviselect)
+ #endifmarkpage
+ .PP
+ The print-out popup menu has the command strings as following.
+ .TP
+ .B ``All pages''
+ %%prcmdall%%
+ .TP
+ .B ``Current page''
+ %%prcmdcur%%
+ #ifmarkpage
+ .TP
+ .B ``Marked page''
+ %%prcmdmrk%%
+ .TP
+ .B ``Region''
+ %%prcmdrgn%%
+ .TP
+ .B ``All marked pages''
+ %%prcmdlst%%
+ #endifmarkpage
+ .PP
+ For example, it is assumed that the command string to print-out
+ ``Current page'' is defined as ``(cd %d; dviselect -i %F -o
+ /tmp/%F:%c@%r.dvi =%c; dvi2ps /tmp/%F:%c@%r.dvi) | lpr -P%p -J'%F (Page
+ %c)'; /bin/rm /tmp/%F:%c@%r.dvi'', and xdvi displays the file
+ /home/foo/bar.dvi. This command string is instantiated into ``(cd
+ /home/foo; dviselect -i bar.dvi -o /tmp/bar.dvi:13@3255.dvi =13; dvi2ps
+ /tmp/bar.dvi:13@3255.dvi) | lpr -Plp -J'bar.dvi (Page 13)'; /bin/rm
+ /tmp/bar.dvi:13@3255.dvi'', where the process ID of xdvi is 3255 and
+ current page is 13 and printer name is ``lp''.
+ #endifprintdvi
  .SH ENVIRONMENT
  Uses the environment variable
  .SB DISPLAY
--
Takanori Uchiyama
Dept. Computer and Systems Engineering, Faculty of Engineering,
KOBE University.
