perm filename MUNGE.SAI[USE,CSR] blob sn#628590 filedate 1981-12-16 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin "munge"
C00007 ENDMK
C⊗;
begin "munge"

require "⊂⊃" delimiters;
define # = ⊂;comment⊃;
define crlf = ⊂('15&'12)⊃;

define cvc(i) = ⊂(if i<10 then "0"+i else ("A"-10)+i)⊃ # encodes
			small integer as a single character -- digit or letter;


boolean eof # end of file indicator;
integer bhash # break table;
integer brchar # break character;
integer flag # input-output flag;
integer ichan, ochan # channels for input, output;

string lf,ff,tab, str, st;

open(ichan←getchan,"DSK",0,19,0,450,brchar,eof) # channel for character and addfil input;
open(ochan←getchan,"DSK",0,0,19,0,0,eof) # channel for character output;
lookup(ichan,"ADDFIL.DSK",flag);
enter(ochan,"ADDFIL.FIX",flag);

setbreak(bhash←getbreak,"#",null,"IA");

eof←0;

str←input(ichan,bhash) # strip off the segment up to the first hash sign;
while ¬eof do begin
	st←str[∞-1 for 1];
	if (st<"0" ∨ st>"Z") ∧ st≠" " then 
	    str ← str[1 to ∞-2]&"Z"&"#";
	out(ochan,str);
	str←input(ichan,bhash) # strip off the segment up to the next hash sign;
end;
out(ochan,str);

close(ichan);
close(ochan);

end "munge";