dos_compilers/RHA (Minisystems) ALGOL v55/LCASE.ALG
2024-07-06 09:53:43 -07:00

65 lines
1.2 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'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'