From afb4b907c65ea2f0a8775d196ea8ff823dd98511 Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Mon, 19 Dec 2016 08:44:47 -0800 Subject: [PATCH] Added FDIR (fast directory listing). Resolves #313. --- README.md | 1 + build/build.tcl | 5 + doc/_info_/fdir.info | 14 ++ src/syseng/fdir.84 | 391 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 411 insertions(+) create mode 100755 doc/_info_/fdir.info create mode 100755 src/syseng/fdir.84 diff --git a/README.md b/README.md index d166c613..6ba1118b 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ A list of [known ITS machines](doc/machines.md). - DSKUSE, disk usage information. - DUMP/LOAD, tape backup and restore. - EMACS, editor. + - FDIR, fast directory listing. - FED, font editor. - FIND, search for files. - FRETTY, display list of free TTYs. diff --git a/build/build.tcl b/build/build.tcl index 26b25048..0b9bebb6 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -772,6 +772,11 @@ expect ":KILL" respond "*" ":link sys;ts copy,sys;ts print\r" respond "*" ":link sys;ts listf,sys;ts print\r" +# fdir +respond "*" ":midas sys2;ts fdir_syseng;fdir\r" +respond "Use what filename instead?" "gren;\r" +expect ":KILL" + # timoon respond "*" ":midas sys1;ts timoon_syseng;timoon\r" expect ":KILL" diff --git a/doc/_info_/fdir.info b/doc/_info_/fdir.info new file mode 100755 index 00000000..254e229d --- /dev/null +++ b/doc/_info_/fdir.info @@ -0,0 +1,14 @@ +There is a new way to list directories on the system called "FDIR". +Output is similiar to the D device, but it is neater and is more convenient +to use. + +To use it, type: FDIR + or: FDIR + or: FDIR : + etc. + +Archives, other ITS hosts etc. will work when explicitly specified. If no +directory is given, the current defaults will be used. If the directory is +on disk,a "dskuse %" will be done. The advantage of this program over the +D deviceis that the defaults are not changed (you have to change it back to +DSK to read from it otherwise). \ No newline at end of file diff --git a/src/syseng/fdir.84 b/src/syseng/fdir.84 new file mode 100755 index 00000000..bd164bd5 --- /dev/null +++ b/src/syseng/fdir.84 @@ -0,0 +1,391 @@ +;-*-Midas-*- + + Title :FDIR - Fast DIRectory listing. + +A=1 ;G. Porp. +B=2 +C=3 +D=4 +E=5 + +T1=6 +T2=7 +T3=10 + +J=11 +M=12 +AR=13 + +P=17 + +Call= +Return= + +TTYi==1 +TTYo==2 +UFDi==3 +MFDi==4 + +PDLen==10 +JCLen==10 + + ;;; +;;;;; + ;;; + +.INSRT SYSTEM;FSDEFS > + +.INSRT KP;MACROS > + + ;;; +;;;;; + ;;; + +PDList: -PDLen,,. + Block PDLen + +JCLbuf: Block JCLen + -1 + +Tsint: Loc 42 + -TsintL,,Tsint + Loc Tsint + P + 0 ? 1_TTYi ? -1 ? 1_TTYo ? Intrup + 0 ? 1_TTYo ? 0 ? 0 ? More +TsintL==.-Tsint + +Device: Sixbit /DSK/ +Sname: 0 +FN1: 0 +FN2: Sixbit /(DIR)/ + +SWild: 0 +SFree: Block 6 +SChar: Block 6 + +DFree: Block 6 +DChar: Block 6 + +ArWild: 0 +LoseOK: 0 + +FDefs: Block 4 + +Free: Block 6 +Char: Block 6 + +NPairs: 0 + + ;;; +;;;;; + ;;; + +Begin: Move P,PDList + Syscal OPEN,[%Clbit,,.uao\%TJDIS + %Climm,,TTYo + [Sixbit /TTY/]] + .Lose %LsFil + Syscal OPEN,[%Clbit,,.uai + %Climm,,TTYi + [Sixbit /TTY/]] + .Lose %LsFil + .Suset [.sOPTION,,[Optint,,]] ;New-style interrupts + .Suset [.sMSK2,,[1_TTYi+1_TTYo]] + Syscal TTYVAR,[%Climm,,TTYo + [Sixbit /WIDTH/] + %Clout,,T1] + .Lose %LsSys + Addi T1,2 + IDivi T1,16. + Movem T1,NPairs + .Break 12,[..rJCL,,JCLbuf] + Skipn JCLbuf + Jrst dFalt + Move J,[440700,,JCLbuf] + +Parse: Setzb A,D ;Word, # *'s + Setzb B,Free + Move T1,[Free,,Free+1] + BLT T1,Char+5 + Move C,[440600,,A] +PgChar: Ildb T1,J + Caie T1,^M + Cain T1,^C + Jrst Check + Caie T1,40 ; + Cain T1,"; + Jrst Check + Caie T1,": + Cain T1,^_ + Jrst Check + Cail B,6 ;Only 1st 6 character per word are significant + Jrst PgChar + Cain T1,"* + Jrst [Setom Free(B) ;Flag this char as W*I*L*D + Aoja D,Pg2] + Cail T1,"a + Trz T1,40 ;lc -> UC +Pg2: Subi T1,40 ;7bit -> 6bit + Idpb T1,C + Movem T1,Char(B) + Aoja B,PgChar + +Check: Jumpe A,dFalt + Caie T1,": + Jrst Check1 + Jumpn D,[And A,[777700,,0] ;Only look at two two letters + Came A,[Sixbit /AR/] + .Value [Ascii /: Can't wildcard that device? KILL /] + Setom ArWild + Move T1,[Free,,DFree] + BLT T1,DChar+5 + Jrst Parse] + Movem A,Device + Jrst Parse +Check1: Cain T1,"; + Jrst [Movem A,Sname + Move T1,[Free,,SFree] + BLT T1,SChar+5 + Movem D,SWild + Jrst Parse] + Movei T2,FN1 + Skipe FN1 + Movei T2,FN2 + Movem A,(T2) + Caie T1,^M + Cain T1,^C + Skipa + Jrst Parse + +dFalt: Skipn FN1 + Jrst [Move T1,[Sixbit /.FILE./] + Movem T1,FN1 + Jrst .+1] + Skipn Sname + Jrst [.Break 12,[6,,FDefs] + Move A,FDefs+1 + Movem A,Sname + Jrst .+1] + +Transl: Syscal TRANS,[Device ? FN1 ? FN2 ? Sname + %Clout,,Device + %Clout,,FN1 + %Clout,,FN2 + %Clout,,Sname] + .Lose %LsSys + +One: Skipn SWild + Jrst [Call UFDprt + Jrst Die] + +Wild: Syscal OPEN,[%Clbit,,.uii + %Climm,,MFDi + [Sixbit /DSK/] + [Sixbit /M.F.D./] + [Sixbit /(FILE)/]] + .Value [Ascii /: Can't open MFD? KILL /] + Syscal SIOT,[%Climm,,MFDi + [444400,,MFDbuf] + [2000]] + .Value [Ascii /: Can't read in MFD? KILL /] + + Move M,MFDbuf+1 ;Start of names (offset) + +Wild1: Move T1,MFDbuf(M) + Jumpe T1,WNext + Setz C, + Move B,[440600,,T1] +Wild2: Ildb T2,B + Skipe SFree(C) + Jrst Wild3 + Came T2,SChar(C) + Jrst WNext +Wild3: Aoj C, + Caie C,6 + Jrst Wild2 + Movem T1,Sname + Call UFDprt +WNext: Addi M,2 + Caie M,2000 + Jrst Wild1 + + ;;; +;;;;; + ;;; + +Die: .Logout 1, + +FilTyp: Move T1,Device + Call 6Type + .Iot TTYo,[":] + Move T1,Sname + Call 6Type + .Iot TTYo,[";] + Move T1,FN1 + Camn T1,[Sixbit /.FILE./] + Return + Call 6Type + .Iot TTYo,[" ] + Move T1,FN2 + Call 6Type + Return + +6Type: Setz T2, + Rotc T1,6 + Addi T2,40 + .Iot TTYo,T2 + Jumpn T1,6Type + Return + +UFDprt: Syscal OPEN,[%Clbit,,.uii + %Climm,,UFDi + Device ? FN1 ? FN2 ? Sname] + Jrst [Skipe LoseOK + Return + Type ,"No such directory as " + Call FilTyp + Jrst Die] + Movei T1,UFDbuf + Skipe ArWild + Movei T1,ARCbuf + Hrli T1,444400 + Movei T2,2000 + Syscal SIOT,[%Climm,,UFDi ? T1 ? T2] + Jrst [Type ,"?Can't read in UFD" + Return] + .Close UFDi, + Skipn ArWild + Jrst UFDp0 + +ArLook: Move AR,ARCbuf+1 ;Start of names (offset) + Cail AR,2000 + Jrst [Type ,"ADirectory empty?" + Return] + Setzm ArWild + Setom LoseOK +ArL1: Move T1,ARCbuf(AR) + Move T2,T1 + And T2,[777700,,0] + Came T2,[Sixbit /AR/] + Jrst NextAr + Movei C,2 + Move B,[300600,,T1] +ArL2: Ildb T2,B + Skipe DFree(C) + Jrst ArL3 + Came T2,DChar(C) + Jrst NextAr +ArL3: Aoj C, + Caie C,6 + Jrst ArL2 + Movem T1,Device + Call UFDprt + .Iot TTYo,[^M] + +NextAr: Addi AR,5 + Caie AR,2000 + Jrst ArL1 + Setom ArWild + Move T1,[Sixbit /DSK/] + Movem T1,Device + Return + +UFDp0: Call FilTyp + Setz E, ;# files + Move A,UFDbuf+UDNAMP + Cail A,2000 + Jrst [Type ," is Empty" + Return] + Move T1,Device + Came T1,[Sixbit /DSK/] + Jrst UFDp1 +;;; +;;; This section of code swiped from DSKUSE +;;; +UFULL0: MOVE D,UDESCP+UFDbuf + MOVEI C,UDDESC+UFDbuf ; D/ desc count + HRLI C,440600 ; "BYTE PTR" + SETZ T2, ; "COUNT" +NEXTA: SETZ T1, +NEXTB: SOJL D,FEND + ILDB C + JUMPE NBYTE ; "ZERO BYTE?" + SETO T1, ; "NON-ZERO BYTE" + JRST NEXTB ; "LOOP" +NBYTE: JUMPN T1,NEXTA ; "ZERO, WAS LAST ZERO?" + SETZ T1, + AOJA T2,NEXTB ; "AOS NULL COUNT" +FEND: MOVE T1,UDESCP+UFDbuf + SUB T1,T2 + IDIVI T1,6 ; "NUMBER OF WORDS" + ADDI T1,2000 + SUB T1,UDNAMP+UFDbuf +;;; +;;; End of code stolen from DSKUSE +;;; + .Iot TTYo,[" ] + .Iot TTYo,["(] + IMuli T1,100. + IDivi T1,2000-UDDESC + Move T3,T2 ;Save fractional part for now + IDivi T1,10. + Addi T1,"0 + Caie T1,"0 + .Iot TTYo,T1 + Addi T2,"0 + .Iot TTYo,T2 + .Iot TTYo,[".] + Move T1,T3 + IMuli T1,10. + IDivi T1,2000-UDDESC + Addi T1,"0 + .Iot TTYo,T1 + Type ,"% used)" + +UFDp1: .Iot TTYo,[^M] + Move B,NPairs + +UFDp2: .Iot TTYo,[" ] + Move T1,UFDbuf(A) + Call 6Type + .Iot TTYo,[^I] + Move T1,UFDbuf+1(A) + Call 6Type + Addi A,5 + Cail A,2000 + Jrst [.Iot TTYo,[^P] + .Iot TTYo,["A] + Return] + Soj B, + Jumpe B,UFDp1 + .Iot TTYo,[^I] + Jrst UFDp2 + +Intrup: .Reset TTYo, + .Reset TTYi, + Syscal TTYFLS,[%Clbit,,1 ? %Climm,,1] + .Lose %LsSys + Jrst Flush + +More: Type ,"--More--" + .Iot TTYi,T1 + Cain T1,40 ;space + Jrst [.Iot TTYo,[^M] + Syscal DISMIS,[P] + .Lose] +Flush: Type ," Flushed" + Jrst Die + + ;;; +;;;;; + ;;; + +UFDbuf: Block 2000 +MFDbuf: Block 2000 +ARCbuf: Block 2000 + +Variables +Constants + + END Begin \ No newline at end of file