! PRINT {RWT, January 1991} adapted from the recently revised ! COPY program which automatically switches between filestores ! MOUSE version adapted from FMACS version. %option "-low-nodiag-nocheck" %include "inc:fs.imp" %include "inc:util.imp" %include "inc:fsutil.imp" %begin %constinteger lpi=1,cpi=2,qual=3 %constinteger lpinormal=2{6}, cpinormal=1{12}, qualnormal=0{draft} %byte lpival=lpinormal,cpival=cpinormal,qualval=qualnormal,banner=1 %string(255)thisone,therest,filename %routine setparam(%integer parameter,value) printsymbol(27); printsymbol('?') printsymbol(parameter+' '); printsymbol(value+' ') %end %routine transfer %integer k=nl %on 9 %start closeinput newline %unless k=nl selectoutput(0) %return %finish selectinput(1); selectoutput(1) %cycle readsymbol(k); printsymbol(k) %repeat %end ! Draw box around text %constinteger maxwidth=80,maxheight=71 %string(maxwidth)%array line(1:maxheight) %integer p=1,max=0 %routine newbox p = 1; max = 0 %end %routine add(%string(maxwidth)s) ! Add line S to the box %returnif p>maxheight-2 %or length(s)>=maxwidth-2 max = length(s) %if length(s)>max line(p) = s; p = p+1 %end %routine enbox(%integer margin) ! MARGIN is number of spaces wanted between text and horizontal border. ! For vertical equivalent, user is obliged to call ADD("") appropriately. ! For multiple borders, ENBOX may be called repeatedly. %integer i %string(maxwidth)%name s %returnif p>maxheight-1 %or (1+margin)*2+max>=maxwidth %for i = p-1,-1,1 %cycle s == line(i+1) s = "|" s = s." " %while length(s)<=margin s = s.line(i) s = s." " %while length(s)<=2*margin+max s = s."|" %repeat s == line(1) s = "+"; s = s."-" %while length(s)<=2*margin+max s = s."+" line(p+1) = s p = p+2; max = (1+margin)*2+max %end %routine printbox(%integer pos) ! POS>0 aligns it to the left, with an extra POS-1 spaces. ! POS<0 aligns it to the right, (-POS)-1 spaces from the RH margin. ! POS=0 aligns it to the middle. %integer i %if pos>0 %then pos = pos-1 - %elseif pos<0 %then pos = pos-max+maxwidth+1 - %else pos = (maxwidth-max)>>1 %for i = 1,1,p-1 %cycle spaces(pos); printstring(line(i)); newline %repeat %end %routine print(%string(255)file) %on 3 %start selectoutput(0); printline(event_message) selectinput(1); closeinput %return %finish openinput(1,file) openoutput(1,"c::lp:!".currentuser) selectoutput(0) printstring("Printing ".file); newline selectoutput(1) setparam(lpi,lpival) setparam(cpi,cpival) setparam(qual,qualval) transfer selectoutput(1) setparam(lpi,lpinormal) %unless lpival=lpinormal setparam(cpi,cpinormal) %unless cpival=cpinormal setparam(qual,qualnormal) %unless qual=qualnormal %unless banner=0 %start printsymbol(12) printstring("THIS SHOULD BE THE FIRST LINE ON THE PAGE"); newlines(3) ! 3 lines so far newbox add("IMPORTANT:") add("Please check whether the top-of-form is set correctly, with the above") add("'first line' appearing immediately adjacent to, but not overlapping,") add("the inter-sheet perforations. If it is wrong, PLEASE CORRECT IT NOW,") add("as follows:") add("* Raise the hood.") add("* Raise the platen lever on your left. This unlocks the tractor feed") add(" mechanism, allowing you to adjust the paper alignment by rotating") add(" the black knob on your right.") add("* Move the paper until the inter-sheet perforations are in line with") add(" the middle of the black plastic 'gates' which hold the paper to the") add(" tractor feed mechanism. A little 'nose' poking out of each of the") add(" two gates marks the place.") add("* Lower the platen lever to re-engage the motor drive.") add("* NOW FOR THE CLEVER BIT: While holding down the reset button, press") add(" the form feed button once. This is a special 'partial-form-feed'") add(" instruction which tells the printer to advance the paper by the") add(" difference between the sheet length and the distance from the") add(" top-of-form position and the alignment 'noses'.") add("* Lower the hood. Press the on-line button.") enbox(1); printbox(0) ! plus 20 plus 2 = 25 lines so far newlines(50-25) ! 50 lines so far newbox add(datetime) add("The file just printed was ".file) add("It was sent by ".currentuser) enbox(1); enbox(1); enbox(1); printbox(0) %finish closeoutput; selectoutput(0) %end %on 0 %start selectoutput(0); printstring("*Aborted") selectinput(1); closeinput selectoutput(1); resetoutput; closeoutput selectoutput(0); newline %return %finish therest = cliparam."," %while therest -> thisone.(",").therest %cycle filename = "" defineparam("File",filename,0) defineenumparam("c10,c12,c13,c17 - cpi",cpival,0) defineenumparam("l3,l4,l6,l8 - lpi",lpival,0) defineenumparam("draft,,letter - quality",qualval,0) defineenumparam("nobanner,banner - trailer",banner,0) processparameters(thisone) %continueif filename="" filename = currentdirectory.":".filename %unless filename -> (":") print(filename) %repeat %end