perm filename CHARS.SAI[DOC,AIL] blob
sn#076965 filedate 1974-02-08 generic text, type T, neo UTF8
BEGIN "CHARS"
REQUIRE "IOMODS.HDR[LEP,JRL]" SOURCE_FILE;
REQUIRE "[][]" DELIMITERS;
DEFINE DEBUG(X)= [
IF DEBSW THEN
BEGIN
X;
END;];
STRING FNAME,TSTR,THISLINE,INHIBIT;
SAFE BOOLEAN ARRAY ARR2[0:127];
BOOLEAN DEBSW,PROBLEMS;
INTEGER TEMP,LINENO,PAGENO,OLDPAGE,TCHAR,I;
PROCEDURE PRINTLIN;
BEGIN "PRINTLIN"
STRING TEMP;
IF ¬ARR2[TCHAR] THEN RETURN;
IF OLDPAGE=PAGENO THEN TEMP←CRLF ELSE
BEGIN OLDPAGE←PAGENO;
SETFORMAT(0,7);
TEMP ← CRLF&"PAGE "&CVS(PAGENO)&CRLF;
SETFORMAT(-5,7);
END;
TEMP←TEMP&CVS(LINENO)&TAB&THISLINE;
OUTTTY(TEMP);
DEBUG([
OUTSTR(CRLF&"OUT:"&TEMP);
]);
TSTR ← NULL;
PROBLEMS ← TRUE;
END "PRINTLIN";
PROCEDURE DRYROT;
USERERR(0,1,"THIS CAN'T HAPPEN HERE.");
BOOLEAN PROCEDURE INSTRING(INTEGER I; STRING S);
BEGIN "INSTRING"
WHILE LENGTH(S) DO
IF LOP(S)=I THEN RETURN(TRUE);
RETURN(FALSE);
END "INSTRING";
OUTSTR(CRLF&"DEBUG?");
IF (TEMP←INCHWL)="Y" ∨ TEMP = "y" THEN DEBSW ← TRUE ELSE DEBSW ← FALSE;
OUTSTR(CRLF&"INPUT FILE NAME =");
PROBLEMS ← FALSE; COMMENT SO FAR NO FUNNY CHARACTERS SEEN;
LINENO ← 0;
PAGENO ← 1;
FNAME ← INCHWL;
SETFORMAT(-5,7);
INITIN(FNAME,TRUE);
OUTSTR(CRLF&"OUTPUT FILE NAME =");
FNAME ← INCHWL;
INITOUT(FNAME);
INHIBIT ← "⊗≠¬"&TAB&VT&CR&LF&FF ; COMMENT CHARACTERS WE'RE NOT PROCESSING THIS TIME;
FOR I ← 1 STEP 1 UNTIL '37,"}" DO
IF ¬INSTRING(I,INHIBIT) THEN
ARR2[I]←TRUE;
WHILE ¬_INEOF DO
BEGIN "LINELOOP"
LINENO ← LINENO +1;
THISLINE ← TSTR ← INTTY;
DEBUG ([
OUTSTR(CRLF&"SRC:"&THISLINE);
]);
WHILE LENGTH(TSTR) DO
BEGIN "CHARLOOP"
TCHAR←LOP(TSTR);
CASE TCHAR OF
BEGIN "CASE"
[0] ;
[1] PRINTLIN;
[2] PRINTLIN;
[3] PRINTLIN;
[4] PRINTLIN;
[5] PRINTLIN;
[6] PRINTLIN;
[7] PRINTLIN;
['10]PRINTLIN;
[TAB];
[LF] ;
[VT] ;
[FF]
BEGIN;
PAGENO ← PAGENO+1;
LINENO←1;
IF ¬DEBSW THEN
BEGIN SETFORMAT(0,7);
OUTSTR(CVS(PAGENO)&" ");
SETFORMAT(-5,7);
END;
END;
[CR] ;
['16]PRINTLIN;
['17]PRINTLIN;
['20]PRINTLIN;
['21]PRINTLIN;
['22]PRINTLIN;
['23]PRINTLIN;
['24]PRINTLIN;
['25]PRINTLIN;
["⊗"]PRINTLIN;
['27]PRINTLIN;
['30]PRINTLIN;
['31]PRINTLIN;
['32]PRINTLIN;
['33]PRINTLIN;
['34]PRINTLIN;
['35]PRINTLIN;
['36]PRINTLIN;
['37]PRINTLIN;
["}"]PRINTLIN COMMENT FOR "}";
END "CASE";
END "CHARLOOP";
END "LINELOOP";
COMMENT FINAL CLOSING OF FILE;
ENDIN;
ENDOUT;
IF ¬PROBLEMS THEN OUTSTR(CRLF&"NO FUNNY CHARACTERS ENCOUNTERED");
OUTSTR(CRLF);
END "CHARS";