!* Machine: PDP-11/70 System: IAS V3.0 Author: John Guidi Date: 22-September-80 Residence: [?,?]ASCII.TES Version: V1 Language: TECO V34 Useage: PDS> MUNG [?,?]ASCII.TES [OUTFILE =] INFILE [:delimiter] Effect: If OUTFILE is not specified, OUTFILE := INFILE. If the delimiter is not specified, it becomes "/". Each line of INFILE is converted to the .ASCII directive in preparation for using the text in a Macro-11 program. The text in OUTFILE is preceded by a .MCALL C$C and then a C$C. The text is surrounded by .NLIST BEX and .LIST BEX directives. Numeric Registers: Qa = position of start of line Qb = position of end of line String registers: Qd = delimiter symbol Qm = command to open input and output files and yank in first page *! !* 0. If there is nothing in the text buffer, display help text. *! !* Otherwise, determine if a delimiter has been specified. *! ^d !* set radix to decimal *! j !* position to start of text buffer *! .-z "E !* is the buffer empty? *! !* Yes. display help text. *!  Useage is: PDS> MUNG [?,?]ASCII, [OUTFILE =] INFILE [:delimiter] Defaults: OUTFILE - OUTFILE := INFILE delimiter - delimiter := "/"  ^C !* then exit *! ' j !* position to start of text buffer *! :s: "N !* was a delimiter specified? *! -d !* yes. suck up / *! .,.+1xd !* load Qd with the delimiter *! d !* suck the delimiter up *! | !* no delimiter specified *! 47^ud !* load Qd with default delimiter ("/") *! ' !* 1. Obtain the command line, open the appropriate files and yank *! !* in the first page of the input file. *! j !* position at begining of text buffer *! :s= "E !* is there an "=" in command line? *! j !* No. position at begining of filename (text buffer) *! ieb !* set up for EB command *! zj !* position at end of filename *! @i/ hk y / !* add coomands to clean out buffer and yank first page *! hxm !* save text buffer in Qm *! | !* Yes. We have OUTFILE=INFILE *! -d !* suck up the "=" *! @i/ er/ !* set up INFILE for ER command *! zj !* position to tail of INFILE *! @i/ hk y / !* add commands to clean out buffer and yank first page *! j !* position to begining of OUTFILE *! iew !* set up OUTFILE for EW command *! hxm !* save text buffer in Qm *! ' mm !* execute Qm to open files, and yank in first page *! !* 2. At the top of the text, put the .MCALL directive and *! !* place the C$C macro there. As well as the .NLIST BEX *! j !* position to begining of text buffer *! 9i i.MCALL 9i iC$C !* indicate C$C macro desired *! 13i 10i !* add *! 9i iC$C !* fetch C$C macro definition *! 13i 10i !* add *! 9i i.NLIST 9i iBEX !* place no-list binary extension directive *! 13i 10i !* add *! !* 3. For each line in the file, code the line into an appropriate *! !* .ASCII directive. *! < !* 3a. Check for end of page, and end of file *! .-z "E !* we are at end of buffer *! ^N "N !* are we at end of file? *! 9i i.LIST 9i iBEX !* list binary extension directive *! 13i 10i !* add *! oend !* Yes. go exit *! | p !* No. next page please *! j !* set pointer to top of buffer *! ' ' !* 3b. translate each line into a .ASCII directive *! 0a-13 "E !* Is this an empty line? *! 9i i.ASCII 9i i !* Yes. *! | !* No. *! .ua !* Qa = position of start of line *! l !* skip a line *! 2r !* back over carriage control *! .ub !* Qb = position of end of line *! 0l !* position pointer to begining of line *! 50-qb+qa "L !* Is line longer than 50 characters? *! 9i i.ASCII 9i !* No. Add .ASCII *! gd !* add begining delimiter *! 50c !* skip 50 characters *! gd !* add ending delimiter *! 13i 10i !* then *! ' 9i i.ASCII 9i !* Add .ASCII directive *! gd !* add begining delimiter *! l !* skip over line *! 2r !* back over carriage control *! gd !* add ending delimiter *! i !* add *! ' !* 3c. skip to the next line *! l !* skip to next line *! > !end! !* terminate the TECO macro *! ex