'BEGIN' 'INTEGER' IN,OUT,C;


'COMMENT' THIS PROGRAM CONVERTS FROM
THE UPPER CASE IN QUOTES MODE TO THE
UPPER/LOWER CASE CONVENTION;

'PROCEDURE' SETO(A);
'VALUE' A; 'INTEGER' A; IOC(31);

'INTEGER' 'PROCEDURE' SWLIST;
IOC(39);

'PROCEDURE' GETC;
'BEGIN' C:=CHIN(IN);
	'IF' C<0 'OR' C=&^Z 'THEN' 'GOTO' FIN
'END' ;



	SETO(SWLIST+13);
	TEXT(10,"ALG");	{DEFAULT EXTENSION}
A1:	IOC(2); IN:=INPUT;
	'IF' IN<1 'THEN' 'GOTO' A1;
	OUT:=OUTPUT;
	'IF' OUT<1 'THEN' 
	'BEGIN' CLOSE(IN); 'GOTO' A1;
	'END' ;
LOOP:	GETC;
A2:	'IF' C=&' 'THEN' 
	'BEGIN' 
A3:		GETC;
		'IF' C=&' 'THEN' 
		'BEGIN' GETC;
			'IF' C>&*S 'AND' C#&; 'THEN'
			CHOUT(OUT,&*S); 'GOTO' A2;
		'END' 'ELSE'
		'IF' C<&A 'OR' C>&Z 'THEN' 'GOTO' A2
		'ELSE' CHOUT(OUT,C);
		'GOTO' A3
	'END' 'ELSE' 
	'IF' C>=&A 'AND' C<=&Z 'THEN'  C:=C+32;
	CHOUT(OUT,C);
	'IF' C=&& 'THEN' 
	'BEGIN' GETC; CHOUT(OUT,C);
		'IF' C=&** 'OR' C=&*^ 'THEN'
		'BEGIN' GETC; CHOUT(OUT,C);
		'END'
	'END' 'ELSE' 
	'IF' C=&" 'THEN' 
	'BEGIN' 
A4:		GETC; CHOUT(OUT,C);
		'IF' C=&** 'THEN' 
		'BEGIN' GETC; CHOUT(OUT,C);
		'END' 'ELSE' 
		'IF' C=&" 'THEN' 'GOTO' LOOP;
		'GOTO' A4;
	'END' ;
	'GOTO' LOOP;
FIN:	CHOUT(OUT,&^Z); CLOSE(OUT);
	CLOSE(IN); 'GOTO' A1;
'END' 
'FINISH'

