DVItype change file for Tops-20 Copyright (C) 1983 by David Fuchs. All rights are reserved. @x Tell WEAVE to print only the changes: \pageno=\contentspagenumber \advance\pageno by 1 @y \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iffalse \def\title{DVI$\,$\lowercase{type} changes for Tops-20} @z @x TOPS-20's banner: @d banner=='This is DVItype, Version 2.9' {printed when the program starts} @y Version 2.9a adds output of page coordinates in pixels, |hh_page| measured from the left edge of the output page, |vv_up| measured from the bottom edge, and |vv_down| measured from the top edge. Page size is assumed to be 8.5in by 11in, with the TeX origin placed one inch over and down from the upper-left corner, as decreed by the Stanford TeX Project. In addition, commands which update the current |h| or |v| positions now display the page coordinates before as well as after the operation. This additional output should simplify checking of DVI driver programs for actual output devices. @d banner=='This is DVItype, Tops-20 Version 2.9a with (hhpage,vvpage) output' @z @x Identify input vs. output files so version numbers are properly handled: @p program DVI_type(@!dvi_file,@!output); @y @p program DVI_type(@!dvi_file:-,@!output:+,TTY:/); @z @x Open dvi_file in binary mode: begin reset(dvi_file); @y begin reset(dvi_file,'','/B:8'); @z @x Open tfm_file in binary mode: begin reset(tfm_file,cur_name); @y begin reset(tfm_file,cur_name,'/B:8'); @z @x @!resolution:real; {pixels per inch} @y @!resolution:real; {pixels per inch} @!hh_max:integer; { page width in pixels } @!hh_offset:integer; { left margin offset } @!hh_page:integer; { page coordinate in pixels } @!vv_down:integer; { page coordinate in pixels } @!vv_max:integer; { page height in pixels } @!vv_offset:integer; { top margin in pixels } @!vv_up:integer; { page coordinate in pixels } @z @x Hardwire term_in and term_out to TTY: and |term_out| for terminal output. @^system dependencies@> @= @!buffer:array[0..terminal_line_length] of ASCII_code; @!term_in:text_file; {the terminal, considered as an input file} @!term_out:text_file; {the terminal, considered as an output file} @y and |term_out| for terminal output. @^system dependencies@> @d term_in==TTY {the terminal, considered as an input file} @d term_out==TTY {the terminal, considered as an output file} @= @!buffer:array[0..terminal_line_length] of ASCII_code; @z @x Update_terminal does nothing: @d update_terminal == break(term_out) {empty the terminal output buffer} @y @d update_terminal == do_nothing {empty the terminal output buffer} @z @x begin update_terminal; reset(term_in); @y begin update_terminal; @z @x begin rewrite(term_out); {prepare the terminal for output} @y begin {no need to prepare the terminal for output} @z @x print_ln(' Resolution = ',resolution:12:8,' pixels per inch'); @y print_ln(' Resolution = ',resolution:12:8,' pixels per inch'); hh_max:=round(8.5 * resolution); { page width in pixels } vv_max:=round(11.0 * resolution); { page height in pixels } hh_offset:=round(1.0 * resolution); { left margin 1.0in in } vv_offset:=round(1.0 * resolution); { top margin 1.0in down } print_ln(' Page size = ',hh_max:1,'H x ',vv_max:1,'V pixels'); print_ln(' TeX top left page corner is ',hh_offset:1,' pixels over and ', vv_offset:1,' pixels down on physical page'); @z @x hhh:=pixel_round(h+q); @y if showing then begin hhh:=pixel_round(h); hh_page:=hh_offset + hhh; print_ln(' ':6,'old_hh:=',hhh:1,', old_hh_page:=',hh_page:1,','); print(' ':5); end; hhh:=pixel_round(h+q); @z @x print(q:1,'=',h+q:1,', hh:=',hh:1); @y print(q:1,'=',h+q:1,', hh:=',hh:1); hh_page:=hh_offset + hh; print(', hh_page:=',hh_page:1); @z @x vvv:=pixel_round(v+p); @y if showing then begin vvv:=pixel_round(v); vv_down:=vvv + vv_offset; vv_up:=vv_max - vv_down; print_ln(' old_vv:=',vvv:1,', old_vv_up:=',vv_up:1, ', old_vv_down:=',vv_down:1,','); print(' ':5); end; vvv:=pixel_round(v+p); @z @x print(p:1,'=',v+p:1,', vv:=',vv:1); @y print(p:1,'=',v+p:1,', vv:=',vv:1); vv_down:=vv + vv_offset; vv_up:=vv_max - vv_down; print(', vv_up:=',vv_up:1,', vv_down:=',vv_down:1); @z @x print('level ',ss:1,':(h=',h:1,',v=',v:1, ',w=',w:1,',x=',x:1,',y=',y:1,',z=',z:1, ',hh=',hh:1,',vv=',vv:1,')'); @y hh_page:=hh_offset + hh; vv_down:=vv + vv_offset; vv_up:=vv_max - vv_down; print_ln('level ',ss:1,':(h=',h:1,',v=',v:1, ',w=',w:1,',x=',x:1,',y=',y:1,',z=',z:1, ',hh=',hh:1,',vv=',vv:1,','); print(' ':6,'hh_page=',hh_page:1, ',vv_up=',vv_up:1,',vv_down=',vv_down:1,')'); @z