From e793205336a0b8547439d4c2fb787b036098c087 Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Sat, 10 Dec 2016 18:58:48 -0800 Subject: [PATCH] Added STYLOG. --- README.md | 1 + build/build.tcl | 4 + src/sysen1/stylog.35 | 293 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 298 insertions(+) create mode 100644 src/sysen1/stylog.35 diff --git a/README.md b/README.md index 264cbd3a..a7452f0f 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,7 @@ There's a [DDT cheat sheet](doc/DDT.md) for Unix users. - SRCCOM, Compares/merges source files, compares binary files. - STINK, linker. - STY, pseudo-terminal for multiple sessions. + - STYLOG, convert PTY output file into ascii file. - SUPDUP, Supdup client. - SYSMSG, displays system messages. - TAGS, generate tags table for sources. diff --git a/build/build.tcl b/build/build.tcl index 5270186a..1d5c6872 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -859,6 +859,10 @@ expect ":KILL" respond "*" ":midas sys2;ts tags_sysen2;tags\r" expect ":KILL" +# STYLOG +respond "*" ":midas sys2;ts stylog_sysen1;stylog\r" +expect ":KILL" + # ndskdmp tape respond "*" ":link kshack;good ram,.;ram ram\r" respond "*" ":link kshack;ddt bin,.;@ ddt\r" diff --git a/src/sysen1/stylog.35 b/src/sysen1/stylog.35 new file mode 100644 index 00000000..81185b41 --- /dev/null +++ b/src/sysen1/stylog.35 @@ -0,0 +1,293 @@ +title STYLOG -- Convert a PTY output file to a ascii log file + +X=0 +a=1 +b=2 +c=3 +d=4 +e=5 +f=6 +t=7 +tt=10 + +sp=17 +p=sp + +pdllen==40 +buflen==1000 + +dski==1 +dsko==2 +dspc==3 +tboc==4 +tyic==5 + +call=pushj sp, +ret=popj sp, +pjrst==jrst ;JRST hack JRST, I.e. PUSHJ SP, ? RET + +$$RFN==-1 ;we want the RFN routine +$$SWITCH==-1 ;we want to handle switches + +.insrt syseng;rfn > + +define syscal a,b + .call [setz ? sixbit/a/ ? b ? setz+errret+calerr] termin + +argi==1000,,0 +val==2000,,0 +errret==3000,,0 +cnt==4000,,0 +cnti==5000,,0 + +define type &string + move t,[440700,,[ascii string]] + movei tt,<.length string> + syscal siot,[argi dspc ? t ? tt] + .lose %lsfil +termin + +go: move sp,[-pdllen,,pdl] + syscal open,[cnti .uao+%TJDIS + argi dspc + [sixbit /TTY/]] + .lose %lsfil + + syscal open,[cnti .uai ;TTY input channel + argi tyic + [sixbit /TTY/]] + .lose %lsfil + + syscal open,[cnti .uio+%TJSIO ;super-image output channel + argi tboc ; (TTY Buffer Output Channel) + [sixbit /TTY/]] + .lose %lsfil + .suset [.rsnam,,ifile+$dir] + + .break 12,[5,,jclbuf] ;Get JCL + + skipn jclbuf ;did he give JCL? + jrst help ; nope, give him help + + ldb b,[350700,,jclbuf] + camn b,"? ;asking for help? + jrst help ; give it to him! + + move d,[440700,,jclbuf] + movei b,ifile ;read it as the INPUT file + call rfn"rfn + + skipn outp ;is this the output file instead? + jrst indef ; no, go default the input + + move x,[ifile,,ofile] + blt x,ofile+3 ;make it the output file instead + + setzm ifile + move x,[ifile,,ifile+1] ;Clear the input file block + blt x,ifile+3 + + movei b,ifile + call rfn"rfn ;read the input file again. + +indef: skipn ifile+$dev ;was the device given? + jrst [move x,[sixbit /DSK/] + movem x,ifile+$dev + jrst .+1] + skipn ifile+$fn1 ;was the FN1 specified? + jrst [move x,[sixbit /STYOUT/] + movem x,ifile+$fn1 + jrst .+1] + skipn ifile+$fn2 ;was the fn2 specified? + jrst [move x,[sixbit />/] + movem x,ifile+$fn2 + jrst .+1] + skipn ifile+$dir ;was the dir specified? + .suset [.rsname,,ifile+$dir] ; use the default + + syscal open,[cnti .uii + argi dski + ifile+$dev + ifile+$fn1 + ifile+$fn2 + ifile+$dir] + .lose %lsfil + +outdef: skipn ttyswp ;is it /T + skipe out ; with no output file? + caia ; nope + jrst out ; yes, don't write a file + + skipn ofile+$dev ;was the default specified? + jrst [move x,ifile+$dev + movem x,ofile+$dev + jrst .+1] + skipn ofile+$fn1 ;was the fn1 specivied? + jrst [move x,ifile+$fn1 ; no, use the input default! + movem x,ofile+$fn1 + jrst .+1] + skipn ofile+$fn2 ;was the fn2 spec'd? + jrst [move x,[sixbit /STYLOG/] + movem x,ofile+$fn2 + jrst .+1] + skipn ofile+$dir ;was the dir spec'd? + jrst [move x,ifile+$dir + movem x,ofile+$dir + jrst .+1] + + syscal open,[cnti .uao ;open output channel + argi dsko + ofile+$dev + ofile+$fn1 + ofile+$fn2 + ofile+$dir] + .lose %lsfil + + +out: skipe ttyswp ;are we typeing? + jrst [type /C/ ; yes, clear the screen first! + jrst .+1] + + setz b, ;not at end of file... + setz c, ;but have no characters left in buffer +outlop: call getchr ;get a character + skipe ttyswp ;is the /T switch on? + .iot tboc,d ; yes, type it out + + skipn ttyswp ;is it /T + skipe out ; with no output file? + caia ; nope + jrst outlop ; yes, don't write a file + + caige d,200 ;is it ascii? + .iot dsko,d ; yes, output it + + cail d,%TDMAX ;is it legal? + jrst [type /AUnknown %TD code received!/ + jrst outlop] ;continue + + cail d,200 ;is it a buffer code? + xct buftab-200(d) ; yes, dispatch to an operation to handle + ;it + jrst outlop ;keep on trucking! + + +;;; get a eight-bit character from disk +getchr: sosl c ;are there still chars in buffer? + jrst [ildb d,a ; yes, get the character + ret] ; and return it + skipe b ;is there more? + jrst [.close dsko, ; nope! + .logout 1,] ; all done! + + move a,[444400,,buffer] + movei b,buflen + syscal SIOT,[argi dski ? a ? b] + .lose 1400 + move a,[441000,,buffer] + movei c,buflen*4 + movei d,(b) + imuli d,4 + subi c,(d) ;approximate + jrst getchr ;and actually get the character + +jclbuf: block 100 + +buffer: block buflen + block 2 + +buftab: call 4flush ;200 - %TDMOV flush 4 bytes + call 2flush ;201 - %TDMV1 flush 2 bytes + jfcl ;202 - %TDEOF nothing I can think of + jfcl ;203 - %TDEOL nothing I can think of + jfcl ;204 - %TDDLF nothing I can think of + jfcl ;205 - %TDMTF Ignore, no motors in files! + jfcl ;206 - %TDMTN Ignore, no motors in files! + call crlf ;207 - %TDCRL new line + jfcl ;210 - %TDNOP nothing at all + .iot dsko,[^H] ;211 - %TDBS backspace + .iot dsko,[^J] ;212 - %TDLF linefeed + .iot dsko,[^M] ;213 - %TDCR carraige return + jfcl ;214 - %TDORS Output reset?? Foo! + jfcl ;215 - %TDQOT quote next char + .iot dsko,[40] ;216 - %TDFS Space forward one + call 2flush ;217 - %TDMV0 flush 2 bytes + call [skipe pausep ;220 - %TDCLR clear screen ... just terpri + jrst [type /STZ/ + .iot tyic,x + type /R/ + jrst .+1] + pjrst crlf] + .iot dsko,[^G] ;221 - %TDBEL [DING] + jfcl ;222 - %TDINI System startup??? + call [call crlf ;223 - %TDILP insert line + pjrst 1flush] + call [call crlf ;224 - %TDDLP delete line (insert a CRLF to + pjrst 1flush] ; avoid confusions + jfcl ;225 - %TDICP nothing I can think of + jfcl ;226 - %TDDCP nothing I can think of + jfcl ;227 - %TDBOW nothing I can think of + jfcl ;230 - %TDRST nothing I can think of + jfcl ;231 - I dunno what this is + jfcl ;232 - I dunno what this is + +crlf: .iot dsko,[^M] ;CR + .iot dsko,[^J] ;LF + ret + +1flush: call getchr ;Get a character + skipe ttyswp ;type it? + .iot tboc,d ; yes, gotta do it! + ret + +2flush: call 1flush ;flush twice + pjrst 1flush + +4flush: call 2flush ;flush twice twice + pjrst 2flush + +pdl: block pdllen + +$DEV==0 ;offsets into a file block +$FN1==1 +$FN2==2 +$DIR==3 + +IFILE: block 4 ;input file names go here +OFILE: block 4 ;output file names go here +outp: 0 ;non-zero if we got an output file + +rsixtp: caie a,"/ ;is it a start of a switch? + cain a,"( + jrst popj1 + + caie a,"_ ;_ terminates + ret + setom outp ;note we got an output file first +popj1: aos (sp) ;skip return + ret + +switch: cain a,"T ;is it a T? + setom ttyswp ; yes, so we want to type + cain a,"P ;is it a P? + setom pausep ; yes, so we want to pause on %TDCLR + ret + +ttyswp: 0 +pausep: 0 + + +calerr: 0 ;error return for SYSCAL's + +help: type /AUsage: :STYLOG _ +Default output file is to use the same FN1 as the input file +or vice versa, and FN2 of STYLOG + +There are 2 switches, T and P: +T means to print the file on the TTY instead, unless an explicit output file + was given. +P means to pause before clearing the screen. +/ + .logout 1, + + end go