Trailing-Edge
-
PDP-10 Archives
-
decuslib10-02
-
43,50252/uflip.mac
There are 2 other files named uflip.mac in the archive. Click here to see a list.
CS
CLOUT: RELEAS L., ;CLOSE OUT OUT IF WE HAVEN'T ALREADY
UFLIP: MOVE P,[IOWD PLEN,PDLIST] ;SET UP PUSH DOWN POINTER
RESET ;RESET THE WORLD
MOVE T,.JBFF ;WHAT IS THE END OF LOW SEGMENT
CORE T, ;CORE DOWN TO THAT POINT
HALT .+1 ;HALT IF WE CAN'T CORE DOWN
SETZM LHED ;WE HAD BETTER ZERO THIS HERE
OUTCHR ["*"] ;SEND OUT AN ASTERISK
INIT D.,1 ;INITIALIZE A CHANNEL FOR TTY INPUT
SIXBIT /TTY/
EXP DHED
CAI
INBUF D.,1
SETZB S,V ;CLEAR THE WORLD
ON S,DOT+CMA+SLA+ARO+EOL
SETOM LIST ;SET LIST TO -1
MOVE I,[XWD LIST,LIST+1] ;SET UP FOR BLT
BLT I,LIST+VMAX-1 ;SET ENTIRE LIST TO -1
NAMSCN: MOVE T,[POINT 6,R] ;GET POINTER FOR FN CHARACTERS
SETZM (T) ;ZERO OUT FILE NAME
SETZM 1(T) ;ZERO OUT EXTENSION
MOVEI U,6 ;THERE WILL BE 6 IN A FILE NAME
JRST NXTSCN ;GO PICK UP THE CHARACTERS
EXTSCN: MOVE T,[POINT 6,C] ;GET POINTER FOR EXTENSION
MOVEI U,3 ;THERE WILL BE 3 CHARACTERS IN EXT
NXTSCN: PUSHJ P,INCHR ;GO GET A CHARACTER
CAIL W,"0" ;IS IT A NUMBER
CAILE W,"Z" ;OR A LETTER
JRST SPECHR ;NO LOOK FOR SPECIAL CHARACTERS
CAIGE W,"A" ;MORE CHECKING
CAIG W,"9"
CAIA
JRST SPECHR ;A FEW BAD CHARS IN BETWEEN
SUBI W,40 ;YES CONVERT IT TO SIXBIT
NEEDCR: SOJL U,NXTSCN ;HAVE WE GOT ENOUGH CHARACTERS
DEPCHR: IDPB W,T ;NO PACK THIS ONE
JRST NXTSCN ;GO LOOK FOR MORE CHARACTERS
DONSCN: CAIL V,VMAX ;IS V TOO BIG
JRST BIGERR ;YES IT'S ALL OVER MAKE HIM TRY AGAIN
CAIE V, ;ALLOW NULL FIRST ENTRY
JUMPE R,NONE ;IS IT A NULL NAME
MOVEM R,LIST(V) ;PUT FILE NAME
MOVEM C,LIST+1(V) ;AND EXTENSION
ADDI V,2 ;INTO FILE LIST
NONE: FOF S,ARO+EOL,FUN ;HAVE WE FINISHED THE LINE
FONZ S,FNC ;DO WE NEED A FENCE
ADDI V,2 ;YES PUT ONE IN BETWEEN SRCS AND DESTS
ON S,DOT ;ALLOW FOR A DOT AGAIN
JRST NAMSCN ;GO GET NEXT FILENAME
FUN: RESET ;WHO NEEDS TTY CHAN NOW?
FON S,LIS,LISFIL ;GO LIST IF IT IS TO BE
FON S,EXT,EXTFIL ;GO EXTRACT IF IT IS TO BE
FON S,DEL,DELFIL ;GO DELETE IF IT IS TO BE
FON S,ADF,ADDFIL ;GO ADD IF IT IS TO BE
; ROUTINE TO PROCESS SPECIAL CHARACTERS
SPECHR: CAIE W,"." ;IS IT A DOT
JRST NODOT ;NO TRY SOMETHING ELSE
FOFZ S,DOT,SYNERR ;YES IS IT ALLOWED
JRST EXTSCN ;THE EXTENSION SHOULD FOLLOW
NODOT: CAIE W,"*" ;IS IT AN ASTERISK
JRST NOAST ;NO TRY SOMETHING ELSE
MOVEI W,77 ;ENTER WILD CARD CHARACTER
SOJL U,NXTSCN ;DO WE NEED MORE CHARACTERS
IDPB W,T ;YES PUT IN A WILD CARD
JRST .-2 ;GET MORE IF NECESSARY
NOAST: CAIE W,"?" ;IS IT A QUESTION MARK
JRST NOQST ;NO TRY SOMETHING ELSE
MOVEI W,77 ;YES ENTER THE WILD CARD
JRST NEEDCR ;GO DEPOSIT IF WE NEED IT
NOQST: CAIE W,"/" ;IS IT A SLASH
JRST NOSLA ;NO TRY SOMETHING ELSE
FOFZ S,SLA,SYNERR ;YES CAN WE USE A SLASH
PUSHJ P,INCHR ;GO GET NEXT CHARACTER
CAIN W,"C" ;DOES HE WANT TO CREATE A LIB
ON S,ADF+EOF ;YES SET UP CREATE FUNCTION
CAIN W,"A" ;IS IT AN A
ON S,ADF+RAD ;YES SET UP ADD FUNCTION
CAIN W,"E" ;IS IT AN E
ON S,EXT ;YES SET UP EXTRACT FUNCTION
CAIN W,"D" ;IS IT A DELETE FUNCTION
ON S,DEL ;YES SET UP DELETE FUNCTION
CAIN W,"R" ;IS IT A REPLACE FUNCTION
ON S,DEL+ADF ;SET UP ADD AND DELETE FUNCTIONS
CAIN W,"L" ;IS IT A L
ON S,LIS+LNG ;YES SET UP LIST FUNCTION
CAIN W,"F" ;IS IT AN F
ON S,LIS ;YES SET UP SHORT LIST FUNCTION
CAIE W,"H" ;IS IT A HELP
JRST DONSCN ;NO NOW RETURN FILE NAME
OUTSTR HELP ;YES TYPE HELP MESSAGE
JRST CRLF ;NOW RETURN
NOSLA: CAIE W,"_" ;IS IT AN ARROW
JRST NOARO ;NO TRY SOMETHING ELSE
FOFZ S,ARO,SYNERR ;HAVE WE HAD AN ARROW YET
ON S,EOL+FNC ;NEXT WE WILL LOOK FOR AN END OF LINE
JRST DONSCN ;GO BACK HAVING COMPLETED SCAN
NOARO: CAIE W,"," ;IS IT A COMMA
JRST NOCMA ;NO TRY SOMETHING ELSE
FOF S,CMA,SYNERR ;ARE THEY LEGAL
JRST DONSCN ;YES RETURN FILE NAME
NOCMA: CAILE W,15 ;IS IT A FEED CHARACTER
CAIL W,175 ;OR AN $
FOFZ S,EOL,SYNERR ;ARE WE LOOKING FOR END OF LINE
CAIN V, ;HAVE WE ALREADY GOT SOME WORDS
CAME T,[POINT 6,R] ;OR PART OF A WORD
JRST DONSCN ;RETURN LAST FILE NAME
EXIT ;EXIT IF A SIMPLE EOL
; ROUTINE TO LIST A LIBRARY FILE
LISFIL: MOVE U,LIST+3 ;GET FENCE EXT
FOF U,1,SPCERR ;IS IT A FENCE EXTENSION
SKIPN N,LIST ;IS OUTPUT TO A FILE
JRST LISTTY ;NO USE USER'S TTY
MOVE E,LIST+1 ;GET EXTENSION
SETZB R,C ;ZERO OUT DATES AND PPN
INIT L.,0 ;INIT A DSK CHAN FOR OUTPUT
SIXBIT /DSK/
XWD LHED,0
CAI
ENTER L.,N
CAI
JRST LISGO ;GO START LISTING
LISTTY: INIT L.,0 ;INIT A TTY CHANNEL FOR OUTPUT
SIXBIT /TTY/
XWD LHED,0
CAI
LISGO: SETZ T, ;ZERO OUT BLOCK COUNTER
OUTBUF L.,2 ;GET A PAIR OF OUTPUT BUFFERS
SKIPN N,LIST+4 ;GET NAME OF LIBRARY FILE
JRST SPCERR ;IF ZERO THIS IS A SPCERR ERROR
MOVE E,LIST+5 ;GET EXTIESION
SETZB R,C ;CLEAR OUT DATES AND PPN
PUSHJ P,INIDIR ;DO INIT ON DIRECTORY
FON S,EOF,SPCERR ;TILT IF NO LIBRARY
LISNXT: PUSHJ P,NXTDIR
JUMPE R,.-1 ;WAS THIS ENTRY EMPTY
CAIN R,LLEN ;ARE WE INTO A FILE
JRST LISLNG ;YES CLOSE OUT LISTING
FON S,LNG,LISNXT ;NO ARE WE DOING SHORT LISTING
MOVE X,[POINT 6,R] ;YES GET FILE NAME POINTER
PUSHJ P,LISOUT ;GO LIST THE FILE NAME
MOVEI W,"." ;GET A DOT
FON C,777777000000 ;IS IT A NULL EXTENSION
PUSHJ P,LISPEC ;NO SEND OUT A DOT
HRRI C,151200 ;PUT CRLF INTO EXTENSION
PUSHJ P,LISOUT ;GO LIST EXTENSION
JRST LISNXT ;GO GET NEXT NAME AND EXT
LISCLS: RELEAS L., ;DO A RELEASE ON THE OUTPUT CHANNEL
JRST UFLIP ;GO GET NEXT SET OF COMMANDS
LISOUT: ILDB W,X ;GET ANOTHER CHARACTER
JUMPE W,LISCYC ;IS IT A NULL
FON X,100000000,LISPEC ;IS IT ALREADY ASCII
CAILE W,15 ;NO IS IT A SPEC CHR
ADDI W,40 ;NO CONVERT IT TO ASCII
LISPEC: SUBI J,1 ;KEEP TRACK OF CHARACTERS
SOSG LHED+2 ;IS THERE SPACE IN THE BUFFER
OUTPUT L., ;NO OUTPUT THE BUFFER
IDPB W,LHED+1 ;NOW THERE IS STASH IT
LISCYC: FON X,760000000000,LISOUT ;ARE WE DONE WITH THIS WORD
POPJ P, ;YES RETURN
LISLNG: FOF S,LNG,LISCLS ;CLOSE IF DOING SHORT LISTING
MOVEI J,12 ;FILE + EXT + . TAKES 10 CHARS
MOVE Y,DHED ;GET START OF FLE'S RIB
MOVE X,[POINT 6,.RBNAM(Y)] ;SET TO GET NAME
PUSHJ P,LISOUT ;GO SEND OUT NAME
MOVEI W,"." ;PICK UP A DOT
SKIPN .RBEXT(Y) ;IS THERE AN EXTENSION
JRST LISBLK ;NO FORGET IT
PUSHJ P,LISPEC ;YES SEND OUT THE DOT
PUSHJ P,LISOUT ;AND THE EXTENSION
LISBLK: MOVE V,.RBSIZ(Y) ;GET THE NO OF BWORDS IN FILE
ADDI V,177 ;ROUND UP
LSH V,-7 ;CONVERT TO BLOCKS
ADDI T,1(V) ;REMEMBER WHERE NEXT FILE IS
ADDI J,5 ;NEED 5 SPACES + EMPTY IN FN AND EXT
PUSHJ P,LISDE2 ;GO LIST BLOCKS
MOVE Y,.RBPRV(Y) ;PICK UP DATE
ROTC Y,-^D12 ;SAVE DATE
ANDI Y,3777 ;GET TIME
SETZ X, ;ZERO OUT X
DIVI X,^D60 ;PUT HRS INTO X AND MINS INTO Y
MOVEI V,(X) ;HRS TO V ALSO
MOVEI J,3 ;WILL NEED 3 CHARS FOR IT
PUSHJ P,LISDE2 ;GO PRINT IT
MOVEI W,":" ;NEED A COLON TOO
PUSHJ P,LISPEC ;PRINT IT
EXCH U,Y ;PUT MINS IN U
MOVEI W,"0" ;GET A 0
CAIG U,^D9 ;MORE THAN 9 MINS
PUSHJ P,LISPEC ;NO PRINT A 0
PUSHJ P,LISDEC ;GO PRINT MINS
ROTC Y,^D12 ;GET THE DATE
MOVEI J,3 ;THERE WILL BE 3 CHARS IN DAY
SETZ X,
DIVI X,^D31 ;PUT DAY -1 INTO Y
MOVEI V,1(Y) ;PUT DAY INTO V
PUSHJ P,LISDE2 ;GO PRINT IT
MOVEI Y,(X)
SETZ X,
DIVI X,^D12 ;PUT MONTH -1 INTO Y
MOVEI V,100(X) ;AND YEAR INTO V
MOVE X,[POINT 7,MON(Y)] ;GET A MONTH POINTER
PUSHJ P,LISOUT ;GO PRINT MONTH
PUSHJ P,LISDE2 ;GO PRINT YEAR
MOVEI W,15 ;LOAD A CR
PUSHJ P,LISPEC ;GO PRINT IT
MOVEI W,12 ;LOAD A LF
PUSHJ P,LISPEC ;PRINT IT TOO
USETI D.,(T) ;SET TO READ NEXT RIB
PUSHJ P,EXTCLR ;GO CLEAR OUT INPUT BUFFERS
PUSHJ P,LIBIN1 ;GO GET IT
FON S,EOF,LISCLS ;START OVER IF AT END OF FILE
JRST LISLNG ;OK GO PRINT ENTRY
LISDEC: MOVEI V,(U) ;PUT NO INTO RIGHT PLACE
LISDE2: SETZ U, ;ZERO OUT U
DIVI U,^D10 ;DIVIDE BY 10
ADDI V,60 ;CONVERT TO ASCII
SUBI J,1 ;NOTE A CHARACTER
PUSH P,V ;SAVE IT
PUSH P,LISDE3 ;SAVE A LOOP PLACE
JUMPN U,LISDEC ;GO BACK FOR ANOTHER DIVISION
MOVEI W," " ;GET A SPACE
CAIA
PUSHJ P,LISPEC ;GO PRINT ONE
JUMPG J,.-1 ;ANY SPACES LEFT
POPJ P, ;JUMP TO LISDE1
LISDE1: POP P,W ;PICK UP CHARACTER
JRST LISPEC ;GO PRINT IT
LISDE3: EXP LISDE1 ;WE NEED A LOC WITH LISDE1 IN IT
; ROUTINE TO ADD A FILE TO A LIBRARY
ADDFIL: GETPPN N, ;GET USER'S PPN
HRLZI E,(SIXBIT /UFD/) ;USE UFD AS EXTENSION
PUSHJ P,SEEDIR ;SEARCH HIS DIRECTORY FOR MATCHES
RESET ;CLOSE OUT THE DIRECTORY
SKIPN N,LIST ;GET NAME OF LIBRARY FILE
JRST SPCERR ;TILT IF NO NAME
HLLZ E,LIST+1 ;GET EXTENSION
FOF S,RAD,ADDSET ;ARE WE DOING RANDOM IO
PUSHJ P,SETDIR ;YES GO SET UP LIBRARY FOR READING
SETZ T, ;CLEAR BLOCK COUNTER
ADDCYC: PUSHJ P,NXTDIR ;GO GET A DIR ENTRY
CAIN R,LLEN ;ARE WE AT THE END OF A BUFFER INDEX
JRST ADDCPY ;YES WE HAVE TO COPY INSTEAD OF SIMPLE APPEND
JUMPN R,ADDCYC ;HAVE WE LOOKED AT ALL INDEX YET
MOVE W,DHED+2 ;GET WORDS LEFT TO READ
ADDI W,2 ;WE HAVE TO FORGET THE 2 ZERO WORDS
CAILE U,(W) ;DO WE HAVE TOO MANY ITEMS LEFT IN LST
JRST ADDCPY ;NO, GO DO COPY
SUBI W,203
ADDM W,DHED+1 ;FIX INPUT POINTER
CLOSE D., ;CLOSE OUT READ
MOVEI W,200
MOVEM W,DHED+2 ;FIX WORD COUNT
JRST ADDRND ;GO DO RANDOM ADD (APPEND)
ADDCPY: RESET ;WE HAVE TO COPY, START OVER
OF S,RAD ;NOTE WE CAN'T APPEND
ADDSET: PUSHJ P,SETDIR ;GO RESET INPUT
ADDRND: SETZB R,C ;ZERO OUT PPN AND DATES
PUSHJ P,LIBINI ;GO SET UP OUTPUT OF LIBRARY
PUSHJ P,ADDINI ;GO SET UP INPUT OF FILE(S) TO BE ADDED
SETZ W, ;CLEAR A LST COUNTER NOW
FON S,EOF,ADDLST ;ARE WE CREATING
ADDNXT: PUSHJ P,NXTDIR ;NO GET A FILE NAME FROM LIBRARY INDEX
JUMPE R,.-1 ;IS IT AN EMPTY ENTRY
CAIN R,LLEN ;NO IS IT THE END OF THE INDEX
JRST ADDLST ;YES GO ADD LST TO INDEX
PUSHJ P,ADDOUT ;NO JUST COPY THIS ENTRY TO OUTPUT
JRST ADDNXT ;GO BACK AND GET ANOTHER ENTRY
ADDLST: CAIL W,(U) ;ARE WE DONE WITH THE LST
JRST DARFIL ;YES GO ADD THE FILE(S)
MOVE R,LST(W) ;NO GET A LST FILE NAME
MOVE C,LST+1(W) ;GET A LST EXTENSION
PUSHJ P,ADDOUT ;WRITE IT IN NEW INDEX
ADDI W,2 ;GO UP IN THE LST
JRST ADDLST ;GO BACK FOR ANOTHER ENTRY
ADDOUT: SOSG LHED+2 ;IS OUTPUT BUFFER FULL
PUSHJ P,LIBOUT ;YES GO WRITE IT OUT
IDPB R,LHED+1 ;NOT NOW, DEPOSIT FILE NAME
SOS LHED+2
IDPB C,LHED+1 ;AND EXTENSION
POPJ P, ;RETURN
ADDLKP: SKIPA Z,.+1 ;NOTE WE ONLY WANT TO LOOKUP
ADDINI: SETZ Z, ;NOTE WE WILL NEED BUFFERS TOO
INIT A.,10 ;INIT A CHANNEL FOR ADDING FILES
SIXBIT /DSK/
EXP AHED
CAI
CAIN Z, ;DO WE NEED BUFFERS
INBUF A.,ABUFS ;PICK UP A FEW
POPJ P, ;RETURN
ADDIN: IN A., ;INPUT A RECORD
POPJ P, ;GOOD READ,RETURN
GETSTS A.,I ;ERROR FIND OUT WHAT
FOF I,EOFBIT,ADDERR ;TILT IF NOT EOF
POPJ P, ;LEAVE IF EOF
; ROUTINE TO EXTRACT FILES FROM LIBRARY
EXTFIL: SKIPN N,LIST-2(V) ;IS IT A NULL LIBRARY
JRST SPCERR ;YES THATS A NONO
MOVE E,LIST-1(V) ;GET EXTENSION
PUSHJ P,SETDIR ;GO SET UP INDEX FOR READING
FON S,EOF,SPCERR ;TILT IF NO LIBRARY
MOVEI W,LIST ;WE WILL START AT BEGINNING
MOVEI V,LIST-4(V) ;AND END BEFORE FENCE
PUSHJ P,MAKLST ;GO MAKE A LST OF FILES TO EXTRACT
SETZ V, ;ZERO FILE COUNTER
MOVEI Z,(T) ;GET START COUNTER
MOVEI K,LLEN ;GET TABLE LENGTH
EXTNXT: CAIL V,(U) ;ARE WE DONE EXTRACTING
JRST CLOUT ;YES START IT ALL UP AGAIN
PUSHJ P,EXTCLR ;GO CLEAR INPUT BUFFERS
HRRZ W,LST+1(V) ;GET BLOCK NO OF THIS FILE
ADDI V,2 ;GET READY FOR NEXT ONE LATER
ADDI W,(Z) ;ADD IN THE BLOCK OF START OF FILES
USETI D.,(W) ;READY THE RIB BLOCK
PUSHJ P,LIBIN ;GO GET IT
HRRZ Y,DHED ;FIND THE BUFFER
CAME K,.RBCNT(Y) ;IS IT A RIB
JRST RIBERR ;GO TYPE RIB ERROR MESSAGE
MOVE N,.RBNAM(Y) ;SAVE NAME OF FILE
HLLZ E,.RBEXT(Y) ;AND EXTENSION
MOVE R,.RBPRV(Y) ;GET THE PRV WORD
SETZ C, ;ZERO OUT PPN
MOVE X,.RBSIZ(Y) ;GET THE NO OF WORDS IN FILE
ADDI X,177 ;ROUND UP
LSHC X,-7 ;CONVERT TO BLOCKS
LSH Y,-35 ;KEEP REMAINDER-1
MOVEI J,1(Y) ;SAVE REMAINDER
PUSHJ P,LIBINI ;GO SET UP OUTPUT OF FILE
PUSHJ P,LIBOUT ;DO DUMMY OUTPUT
EXTCYC: SOJL X,EXTNXT ;HAVE WE WRITTEN OUT THE FILE
PUSHJ P,LIBIN ;NO GET A RECORD
CAIN X, ;ARE WE WRITING LAST RECORD
MOVEM J,LHED+2 ;YES FIX WORD COUNT
PUSHJ P,DARBLT ;MOVE RECORD TO OUTPUT BUFFER
PUSHJ P,LIBOUT ;SEND IT OUT
JRST EXTCYC ;GO TRY FOR ANOTHER RECORD
EXTCLR: WAIT D., ;WAIT TILL ALL INPUT DONE
MOVE Y,DHED ;PICK UP BUFFER HEADER
MOVEI J,DBUFS ;GET NO OF BUFFERS
HRLZI I,400000 ;LOAD A HIGH BIT
ANDCAM I,(Y) ;MAKE BUFFER NOT USED
MOVE Y,(Y) ;GET NEXT BUFFER
SOJG J,.-2 ;HAVE WE FIXED ALL BUFFERS
IORM I,DHED ;FIX HEADER TOO
POPJ P, ;RETURN
; ROUTINE TO DELETE FILES FROM A LIBRARY
DELFIL: SKIPN N,LIST ;CAN'T HAVE A NULL NAME
JRST SPCERR ;GAK! WE DO
MOVE E,LIST+1 ;OK GET EXTENSION
SETZB R,C ;ZERO OUT PPN AND DATES
PUSHJ P,LIBINI ;SET UP LIBRARY FOR OUTPUT
PUSHJ P,SEEDIR ;GO FIX INDEX
JRST DARFIL ;GO DELETE FILES FROM LIBRARY
DARFIL: PUSHJ P,LIBOUT ;WRITE OUT LAST RECORD OF DIRECTORY
MOVEI W,LLEN ;SET UP TABLE LENGTH
SETO V, ;CLEAR THE LST COUNTER
FOF S,RAD,DARNXT ;ARE WE APPENDING
ON S,EOF ;YES SET EOF BIT
USETO L.,(K) ;SET TO APPEND
HLRM X,(X) ;RESTORE THE FULL BUFFER RING
DARNXT: ADDI V,2 ;GET NEXT LST ENTRY
CAIGE V,(U) ;ARE WE AT END OF LST
JRST DARLST ;NO GET NEXT ENTRY
FON S,EOF,CLOUT ;YES AND HAVE WE REACHED AN EOF TOO
OF S,ADF+DEL ;NO BUT NOW WE'RE ONLY COPYING
DARLST: HLLZ C,LST(V) ;NO PICK UP EXTENSION
MOVE R,LST-1(V) ;AND FILE NAME
DARLOP: FON S,EOF,DARNCP ;DON'T COPY IF NO INPUT
PUSHJ P,DARBLT ;MOVE FROM DHED TO LHED
CAME W,.RBCNT(Y) ;IS IT A RIB
JRST RIBERR ;NO GO TYPE RIB ERROR MESSAGE
MOVE X,.RBSIZ(Y) ;GET NO OF WORDS IN FILE
ADDI X,377 ;ROUND UP AND ADD 1
LSH X,-7 ;CONVERT TO BLOCKS
FOF S,DEL,DARCPY ;MUST COPY IF NOT DELETING
CAMN R,.RBNAM(Y) ;DO FILE NAMES MATCH
CAME C,.RBEXT(Y) ;AND DO EXTENSIONS MATCH
JRST DARCPY ;NO JUST COPY THIS PART OF FILE
DARNCP: FOF S,ADF,DARDEL ;ARE WE ADDING FILES
FON S,DEL,DARREP ;YES REPLACING FILES ?
HRRZ Y,LHED ;GET BUFFER HEADER
HRRI I,3(Y) ;GET SECOND WORD OF BUFFER
HRLI I,2(Y) ;AND FIRST WORD
SETZM 2(Y) ;ZERO IT OUT
BLT I,LLEN+2(Y) ;ZERO AN EXTENDED LOOKUP TABLE
MOVEM W,.RBCNT(Y) ;NO SET UP COUNT OF RIB SIZE
MOVEM R,.RBNAM(Y) ;AND FILE NAME
HLLZM C,.RBEXT(Y) ;AND EXTENSION
DARREP: SETZM .RBPPN(Y) ;ZERO OUT PPN (MAYBE NOT HIS)
LOOKUP A.,.RBCNT(Y) ;FILL RIB WITH NEW STUFF
JRST SYSERR ;WE CANNOT GET AN ERROR HERE
HLLZS .RBEXT(Y) ;ZERO OUT EXTENSION RH
HRRZ Z,LST(V) ;GET BLOCK COUNT FOR THIS FILE
DARADD: PUSHJ P,LIBOUT ;WRITE OUT THE RECORD
PUSHJ P,ADDIN ;READ A RECORD
SOJLE Z,DARDEL ;ARE WE DONE WITH THIS ENTRY
HRRZ I,AHED ;NO
PUSHJ P,DARBLA ;MOVE ANOTHER RECORD FROM DBUF TO LHED
JRST DARADD ;GO BACK AND SEND IT OUT
DARDEL: FOF S,DEL,DARNXT ;ARE WE DELETING
ADDI T,-1(X) ;ADD TO RECORD COUNT
PUSHJ P,EXTCLR ;GO CLEAR BUFFER
USETI D.,1(T) ;SET TO READ NEXT FILE
PUSHJ P,LIBIN ;YES SKIP A RECORD
JRST DARNXT ;NOW GO FOR NEXT ENTRY
DARCPY: PUSHJ P,LIBOUT ;WRITE A RECORD
PUSHJ P,LIBIN ;READ NEXT RECORD
SOJLE X,DARLOP ;HAVE WE COPIED A FILE
PUSHJ P,DARBLT ;NO MOVE ANOTHER RECORD FROM DHED TO LHED
JRST DARCPY ;GO BACK AND SEND IT OUT
DARBLT: HRRZ I,DHED ;GET ADDRESS OF DHED RING
DARBLA: HRRZ Y,LHED ;GET ADDRESS OF OUTPUT BUFFER RING
HRLI I,2(I) ;GET 1ST WORD OF INPUT BUFFER
HRRI I,2(Y) ;GET 1ST WORD OF LHED BUFFER
BLT I,201(Y) ;COPY 200 WORDS
POPJ P, ;RETURN
; ROUTINE TO COMPARE LIST WITH DIR TO GET LST
MAKLST: SETZB U,T ;ZERO THE FILE COUNTER
CHDLST: PUSHJ P,NXTDIR ;GET ANOTHER NAME AND EXTENSION
JUMPE R,.-1 ;IS IT AN EMPTY ENTRY
CAIN R,LLEN ;IS IT THE END OF THE DIRECTORY
JRST ENDLST ;YES LEAVE
MOVEI Z,(W) ;NO BEGINNING OF LIST
FOF S,EXT,CHLLST ;ARE WE EXTRACTING
HRLZI X,(C) ;YES PICK UP BLOCK COUNT FOR FILE
HLR C,T ;SAVE TOTAL UP TO NOW
ADD T,X ;MAKE NEW BLOCK COUNT TOTAL
CHLLST: MOVE X,[POINT 6,(Z)] ;GET LIST POINTER FOR FN.EXT
MOVE Y,[POINT 6,R] ;GET DIR POINTER FOR FN.EXT
MOVEI I,11 ;WE WANT TO LOOK AT 9 CHARS
NXTLST: SOJL I,MATLST ;FOUND A MATCH?
ILDB J,Y ;GET A DIR CHAR
ILDB K,X ;GET A LIST CHAR TOO
CAIE K,77 ;IS IT A WILD CARD
CAIN K,(J) ;OR DO CHARS MATCH
JRST NXTLST ;YES GO GET NEXT SET OF CHARS
ADDI Z,2 ;NO MOVE UP IN LIST
CAIGE Z,(V) ;HAVE WE EXHAUSTED LIST
JRST CHLLST ;NO WE'RE OK
CPYLST: FOF S,DEL,CHDLST ;YES ARE WE DELETING FILES
SOSG LHED+2 ;YES WE HAVE TO OUTPUT THIS ENTRY NOW
PUSHJ P,LIBOUT
IDPB R,LHED+1 ;PUT IT IN THE BUFFER
SOS LHED+2
IDPB C,LHED+1 ;ALSO EXTENSION
JRST CHDLST ;GO TO NEXT DIRECTORY ENTRY
MATLST: CAIL U,UMAX ;ANY MORE SPACE
JRST SPAERR ;NO GIVE HIM A SPACE ERROR
MOVEM R,LST(U) ;YES SAVE FN IN LST
MOVEM C,LST+1(U) ;SAVE EXT IN LST
FOF S,ADF,PUTLST ;ARE WE ADDING FILES
MOVEI Y,5
MOVEM Y,LIST-6 ;YES SET UP LOOKUP TABLE
SETZM LIST-5
MOVEM R,LIST-4
MOVEM C,LIST-3
LOOKUP A.,LIST-6
JRST NOLST ;CAN'T DELETE IF CAN'T REPLACE
MOVE Z,LIST-1 ;GET WORD COUNT
ADDI Z,377 ;ROUND UP AND ADD ONE
LSH Z,-7 ;CONVERT TO BLOCKS
HRRM Z,LST+1(U) ;PUT IT IN BLOCK COUNTER
HRRI C,(Z) ;BOTH OF THEM
PUTLST: ADDI U,2 ;INCREASE FILE COUNTER
NOLST: FON S,ADF,CPYLST ;ARE WE ADDING
JRST CHDLST ;NO GO GET NEXT ENTRY
ENDLST: JUMPE U,LSTERR ;IS THE LIST EMPTY
POPJ P, ;NORETURN
; ROUTINE TO GET AN INPUT CHARACTER
INCHR: SOSG DHED+2 ;ARE THERE CHARACTERS IN THE BUFFER
INPUT D., ;NO FILL IT
ILDB W,DHED+1 ;GET A CHARACTER
CAIN W," " ;IS IT A SPACE
JRST INCHR ;YES FORGET IT
POPJ P, ;RETURN
; ROUTINE TO PROCESS A DIRECTORY
INIDIR: INIT D.,10 ;INIT A DIRECTORY CHANNEL
SIXBIT /DSK/
EXP DHED
CAI
INBUF D.,DBUFS ;YES GET A FEW INPUT BUFFERS
LOOKUP D.,N ;DO THE LOOKUP
ON S,EOF ;NOTE NO INPUT DIRECTORY
POPJ P, ;RETURN
NXTDIR: MOVEI R,LLEN ;SET FOR EOF ON DIRECTORY
SOSG DHED+2 ;IS BUFFER EMPTY
JRST INDIR ;YES GO DO AN INPUT
RTNDIR: ILDB R,DHED+1 ;FULL NOW, GET A FILE NAME
SOS DHED+2
ILDB C,DHED+1 ;GET AN EXTENSION
POPJ P, ;RETURN
INDIR: ADDI T,1 ;EXTFIL NEEDS THIS
IN D., ;READ A RECORD
JRST RTNDIR ;GOOD RETURN
POPJ P, ;NO DONE
; ROUTINE TO SETUP A DIRECTORY FOR SCANNING
SETDIR: FON S,EXT ;IF EXTRACTING FILES
SKIPA I,LIST-4(V) ;FENCE SHOULD BE NEAR THE END
MOVE I,LIST+3 ;GET FENCE EXTENSION
FOF I,1,SPCERR ;IS IT REALLY A FENCE
SETZB R,C ;YES CLEAR OUT PPN AND DATES
CAME E,[SIXBIT /UFD/] ;IS IT A UFD
JRST INIDIR ;NO GO INITIATE DIRECTORY
AOBJP C,INIDIR ;SET 1,1 AS PPN
; ROUTINE FOR ADD AND DEL TO SET UP SEARCHES
SEEDIR: PUSHJ P,SETDIR ;GO SET UP USER'S DIRECTORY FOR READING
MOVEI W,LIST+4 ;START AFTER FENCE IN LIST
MOVEI V,LIST(V) ;NOTE END OF LIST
FON S,ADF ;IF WE'RE ADDING THEN
PUSHJ P,ADDLKP ;INITIALIZE CHAN FOR LOOKUPS
PUSHJ P,MAKLST ;GO FIND FILES TO ADD TO LIBRARY
POPJ P, ;RETURN
; ROUTINE TO INITIALIZE LIBRARY OUTPUT
LIBINI: RELEAS L., ;RELEASE THE GD THING FIRST
MOVE I,LHED ;SAVE HEADER FOR EXTRACTING
INIT L.,10
SIXBIT /DSK/
XWD LHED,0
CAI
CAIE I, ;IF WE HAD BUFFERS
MOVEM I,LHED ;RESTORE THEM
FOF S,RAD,LIBENT ;ARE WE DOING AN APPEND
MOVEI K,5 ;YES PREPARE TO LOOKUP
SETZ J,
LOOKUP L.,K ;LOOKUP UP THE FILE
ON S,EOF ;TILT THE FILE ISN'T THERE
FON S,EOF,ADDCPY ;LEAVE, WE CAN'T DO IT THIS WAY
ADDI C,377 ;ROUND UP WORDS AND ADD 1
LSH C,-7 ;CONVERT TO WORDS
MOVEI K,(C) ;SAVE IN REG K
SETZB R,C ;ZERO OUT DATES AND PRVS
HRRI E, ;CLEAR ACCESS DATE
LIBENT: ENTER L.,N ;GO ENTER THE FILE
JRST ENTERR ;TILT ON ERROR HERE
CAIN I, ;DO WE HAVE BUFFERS
OUTBUF L.,LBUFS ;NO GET A FEW
FOF S,RAD ;ARE WE APPENDING
POPJ P, ;NO RETURN
HRR X,LHED ;GET ADDRESS OF FIRST BUFFER IN RING
HRL X,(X) ;SAVE ADDRESS OF SECOND BUFFER
HRRM X,(X) ;REPLACE WITH TAHT OF FIRST
USETO L.,(T) ;SET TO OUTPUT TO LAST INDEX BLOCK
POPJ P, ;RETURN
; ROUTINE TO PUT A RECORD OUT TO LIBRARY FILE
LIBOUT: SKIPL I,LHED+2 ;GET NO OF WORDS LEFT TO BE WRITTEN
ADDM I,LHED+1 ;FIX THE POINTER
OUT L., ;OUTPUT A RECORD
POPJ P, ;GOOD WRITE, RETURN
JRST OUTERR ;BAD ONE, TILT!
;ROUTINE TO GET AN INCOMING LIBRARY RECORD
LIBIN: ADDI T,1 ;ADD ONE TO BLOCK COUNT
LIBIN1: IN D., ;READ A RECORD
POPJ P, ;GOOD READ, RETURN
GETSTS D.,I ;ERROR FIND OUT WHAT
FOF I,EOFBIT,LIBERR ;IF NOT EOF TILT
ON S,EOF ;NOTE NO MORE LIBRARY
POPJ P, ;IF EOF LEAVE
; ROUTINES TO PRINT ASSORTED ERROR MESSSAGES
LSTERR: OUTSTR ERRLST
JRST UFLIP
SYSERR: OUTSTR ERRSYS
JRST UFLIP
SYNERR: OUTSTR ERRSYN
OUTCHR W
JRST CRLF
BIGERR: OUTSTR ERRBIG
JRST UFLIP
SPCERR: OUTSTR ERRSPC
JRST UFLIP
SPAERR: OUTSTR ERRSPA
JRST UFLIP
OUTERR: OUTSTR ERROUT
JRST TYPERR
LIBERR: OUTSTR ERRLIB
JRST TYPERR
ADDERR: OUTSTR ERRADD
MOVE N,R
HLLZ E,C
JRST TYPERR
RIBERR: OUTSTR ERRRIB
JRST TYPERR
ENTERR: OUTSTR ERRENT
TYPERR: MOVE W,[POINT 6,N] ;GET POINTER TO FN
HRRI E, ;SET RH OF E TO 0
PUSHJ P,NAMERR ;GO SEND OUT FN
OUTCHR ["."] ;AND A DOT
PUSHJ P,NAMERR ;SEND OUT EXTENSION
CRLF: OUTSTR [ASCIZ /
/]
JRST UFLIP
NAMERR: ILDB V,W ;PICK UP A CHARACTER
JUMPE V,CYCERR ;IF NULL FORGET IT
ADDI V," " ;CONVERT TO ASCII
OUTCHR V ;SEND IT OUT
CYCERR: FON W,770000000000,NAMERR ;SENT OUT 6 CHARS?
POPJ P, ;YES RETURN
; THE MONTHS OF THE YEAR
MON: ASCII /-JAN--FEB--MAR--APR--MAY--JUN--JUL--AUG-/
ASCII /-SEP--OCT--NOV--DEC-/
; VARIOUS MESSAGES
HELP: ASCIZ ?TYPE ONE OF THE FOLLOWING:
libnam.ext/C_list to create a library
libnam.ext/A_list to add to a library
libnam.ext/D_list to delete from a library
libnam.ext/R_list to update a library
/L_libnam.ext to list a library (LONG
FORM)
/F_libnam.ext to list a library (SHORT
FORM)
list/E_libnam.ext to extract from a library
/H to type this message?
ERRLST: ASCIZ /LST EMPTY, NOTHING TO DO
/
ERRSYS: ASCIZ /SYSTEM ERROR GAK!
/
ERRSYN: ASCIZ /SYNTAX ERROR CHARACTER /
ERRBIG: ASCIZ /SPECIFICATION TOO LARGE
/
ERRSPC: ASCIZ /SPECIFICATION ERROR
/
ERRSPA: ASCIZ /TOO MANY FILES IN LIST
/
ERROUT: ASCIZ /OUTPUT ERROR ON FILE /
ERRLIB: ASCIZ /INPUT ERROR ON LIBRARY FILE /
ERRADD: ASCIZ /ERROR READING FILE /
ERRRIB: ASCIZ /BAD FORM IN FILE /
ERRENT: ASCIZ /COULD NOT ENTER FILE /
; SOME LITERALS AND THE BIG END
CLIT: LIT
CDEND: END UFLIP