!Send
!send a file to the CLAN Laser printer through the terminal's printer port,
!using V200 or Wy75 (default) "transparent mode", i.e. the stuff does not
!appear on the screen as it passes through the terminal.

%option "-nocheck-nodiag"
%begin
%include "inc:util.imp"
%string(31)fuseplotfile,device="WY75"
%integer raw=0,delay=-10,dev

%integer start,length
%constinteger esc=27

defineparam("Fuseplotfile",fuseplotfile,pammajor!pamnodefault)
defineparam("Terminaltype",device,pammajor)
defineintparam("Delay",delay,pammajor)
definebooleanparams("Raw",raw,0)
processparameters(cliparam)
dev = charno(device,1)&95

  %routine transparent mode on
    printsymbol(esc)
    %if dev='W' %start
      printstring("[5i")
    %else
      printsymbol('W')
      newline
    %finish
  %end

  %routine transparent mode off
    printsymbol(esc)
    %if dev='W' %start
      printstring("[4i")
    %else
      printsymbol('X')
    %finish
  %end

  %routine wait(%integer d)
    %if d>0 %start
      d = d+cputime
      %cycle
      %repeatuntil cputime>d
    %else
      %cycle
        d = d+1
      %repeatuntil d>0
    %finish
  %end

  connectfile(fuseplotfile,0,start,length)
  set terminalmode(nopage)
  transparent mode on
  %if raw<0 %start
    printline("$e=0"); printsymbol(esc); printline("l0")
  %finish
  %while length>0 %cycle
    length = length-1
    printsymbol(byteinteger(start))
    start = start+1
    wait(delay)
  %repeat
  %if raw<0 %start
    printsymbol(esc); printline("e*")
  %finish
  transparent mode off

%endofprogram
