Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - utilities/2col.sai
There are no other files named 2col.sai in the archive.
begin
define crlf = "'15&'12";
boolean flag;
string blanks,s1;
string array lines[1:120];
integer kount,ksave,colwid;
integer ochan,tchan,ichan;
integer count;
integer brchar;
boolean eof;
string ff;
procedure dopage(integer x);
	begin
	integer btemp;
	for btemp:=1 step 1 until x do cprint (ochan,lines[btemp],crlf);
	cprint(ochan,ff);
	end;
procedure place!line (string st);
	begin
	if st=12 then
		begin
		integer i;
		if flag then
		  begin
		  ksave:=kount-1;
		  for i:=kount step 1 until 120 do lines[i]:=" "
		  end
		else
		  dopage(if ksave > kount then ksave else kount);
		kount:=1;
		flag:=not flag;
		ff:=lop(st)
		end;
	if flag then
		lines[kount]:=st
	else
		lines[kount]:=lines[kount]&blanks[1 to (colwid - length
			(lines[kount]))]&st;
	kount:=kount+1
	end;
blanks:="                                                                        ";
flag:=true;
ksave:=0;
kount:=1;
print("Would you like instructions?  ");
if not equ (s1:=intty[1 for 1],"n") and not equ(s1,"N") then
	print("This program makes two column output by taking one tabless
text page (delimitted by ^L's or Edit page marks) after another and, based
on a promised column width given by the user (which must include the
spacing between columns), slapping each odd numbered page across
from the preceding even numbered page in the output, making two columns.
Exit from Edit with ""EU"" so as not to have line numbers in the file.
");
print("Type the input file name:  ");
ichan:=openfile("","rc");
setinput(ichan,count,brchar,eof);
print("Number of characters in left column (including spaces to
leave between columns:  ");
tchan:=openfile("tty:","rwa");
colwid:=intin(tchan);
print("And lastly the file name for two column output (use ""LPT:""
to send output directly to printer:  ");
ochan:=openfile("","wac");
while not eof do
	begin
	s1:=sini(ichan,'300,'12);
	s1:=s1[1 to length(s1)-2];
	place!line(s1);
	end;
dopage(if flag then (kount - 1) else if ksave > kount then ksave else kount);
closf(ochan);
end