! TOPRINTRONIX Mark Tauntons program to send files to line printers. %external %routine %spec open output (%integer st, %string (255) file) %external %routine %spec open input (%integer st, %string (255) file) %external %routine %spec close input %external %routine %spec close output %const %integer max lines = 10 %const %integer CR = 13 %external %routine TOPRINTRONIX (%string (255) PARM) %string(255) out, rline, sline, line, spaces %integer term, outf, c, maxr, maxs, ms, mr, p %own %byte space = ' ' %routine READLINE (%string(*) %name line, %integername term) %integer s line = "" %cycle read ch (s) term = s %and %return %if s = NL %or s = CR line = line . tostring(s) %if length(line) < 255 %repeat %end %routine FAIL (%string (255) Message) select output (0) print string ("TOPRINTRONIX fails - ".message) newline %stop %end %on 9 %start close input close output %stop %finish parm = parm."/".out %if parm -> parm.(",").out outf = 1 FAIL ("Parameters are / ") %unless parm -> parm . ("/") . out %begin %on 9 %start FAIL ("Cannot open input file ".parm) %finish open input (1, parm) %end %begin %on 9 %start FAIL ("Cannot open output ".out) %finish open output (2, out) %end select input (1) select output (2) spaces = "" spaces = spaces." " %for maxr = 255,-1, 1 %cycle sline = spaces rline = spaces maxr = 0 maxs = 0 %cycle read line (line, term) ms = 0; mr = 0 %for p = 1, 1, length(line) %cycle c = charno(line, p) %if c = '_' %start charno(sline, p) = '_'; ms = p %finish %else %if c # ' ' %start charno(rline, p) = c; mr = p %finish %repeat maxs = ms %if maxs < ms maxr = mr %if maxr < mr %repeat %until term = nl length(rline) = maxr print string (rline) %if maxs > 0 %start print ch (CR) length(sline) = maxs print string (sline) %finish newline %repeat %end %external %routine TOLP15 (%string (255) FILE) FILE = FILE."/.LP15" %unless FILE -> (",") %or FILE -> ("/") TO PRINTRONIX (FILE) %end %external %routine TOLP41 (%string (255) FILE) FILE = FILE."/.LP41" %unless FILE -> (",") %or FILE -> ("/") TO PRINTRONIX (FILE) %end %external %routine TOLP78 (%string (255) FILE) FILE = FILE."/.LP78" %unless FILE -> (",") %or FILE -> ("/") TO PRINTRONIX (FILE) %end %endoffile