(DEFINE-FILE-INFO READTABLE "XCL" PACKAGE "INTERLISP") (FILECREATED " 9-Nov-89 15:32:46" {ICE}LISP>LYRIC>READEBCDIC.\;1 1847 |changes| |to:| (VARS READEBCDICCOMS) (FNS READEBCDIC)) (PRETTYCOMPRINT READEBCDICCOMS) (RPAQQ READEBCDICCOMS ((FNS READEBCDIC))) (DEFINEQ (READEBCDIC (LAMBDA (INFILE OUTFILE ADDCR) (* \; "Edited 9-Nov-89 15:31 by MJD") (* |;;| "Converts EBCDIC to ASCII. If ADDCR is T, adds a CR after every 80 chars.") (PROG (TRTAB TRLIST SPCHARS LCASE UCASE NUMBERS INSTREAM OUTSTREAM (COL 0)) (SETQ TRTAB (ARRAY 256 NIL " " 0)) (SETQ SPCHARS " .<(+|& !$*);~ / ,%_>? :#@'=\" ") (SETQ LCASE "abcdefghi jklmnopqr stuvwxyz ") (SETQ UCASE "ABCDEFGHI JKLMNOPQR STUVWXYZ ") (SETQ NUMBERS "0123456789") (SETQ TRLIST (UNPACK (CONCAT SPCHARS LCASE UCASE NUMBERS))) (|for| I |from| 0 |to| 31 |do| (SETA TRTAB I (CHARACTER I))) (|for| I |from| 64 |as| CHAR |in| TRLIST |do| (SETA TRTAB I CHAR)) (SETQ INSTREAM (OPENSTREAM INFILE 'INPUT 'OLD)) (SETQ OUTSTREAM (OPENSTREAM OUTFILE 'OUTPUT 'NEW)) (|until| (EOFP INSTREAM) |do| (PRIN1 (ELT TRTAB (BIN INSTREAM)) OUTSTREAM) (ADD COL 1) (IF (EQ COL 80) THEN (SETQ COL 0) (AND ADDCR (TERPRI OUTSTREAM)))) (CLOSEF INSTREAM) (CLOSEF OUTSTREAM)))) ) (DECLARE\: DONTCOPY (FILEMAP (NIL (312 1824 (READEBCDIC 322 . 1822))))) STOP