Trailing-Edge
-
PDP-10 Archives
-
bb-d549g-sb
-
corfih.mac
There are 3 other files named corfih.mac in the archive. Click here to see a list.
TITLE CORFIH VERSION 3
SUBTTL CORRECTION FILE HANDLING ROUTINES CWRU/CAM
;EDIT==6
;COPYRIGHT 1971, DIGITAL EQUIPMENT CORP., MAYNARD, MASS.
HISEG
ENTRY PTSTOR
ENTRY FILBFR,MANCOR,UCOR,STSYNC,FLM.2,FLU.2,FLUSH
EXTERN CAMOPT,CBGET,BASDDB,LOGOUT,CONVRT,MCIN,UCIN
EXTERN I,STORE,STORE2,STORED,STORD2,SAVR14
EXTERN CORSAV,PTNF,PTNE,PTOF,PTOE,SAV23,ARROWD
EXTERN BOL,XCLAMD,MESAPS,A5STOR,TEM,PFLAG,MCBUF,UCBUF
EXTERN FED
EXTERN MRGOUT,LSTOUT,LINEIN,T2,DIALOG
A1=1
A2=2
A3=3
A4=4
A5=5
A7=7
PERIOD=56
LARROW=137
CHAR=13
RETURN=14
LF=12
VT=13
FF=14
CR=15
EXCLAM=41
EXTERN TEMP
QUOTES=42
MINUS=55
DEFINE FILBUF(A,B) <XLIST
JSP A7,FILBFR
XWD A,B
LIST>
DEFINE CNVT(A,B,C,D) <XLIST
JSP RETURN,CONVRT
XWD A,B
XWD C,D
LIST>
DEFINE FCAL(A,B,C) <XLIST
JSP RETURN,A
B
C
LIST>
DEFINE GET.IT <XLIST
JSP RETURN,0(A2)
CAIN CHAR,0
JRST PEOF
LIST>
DEFINE SAV1T4 <XLIST
MOVE [XWD A1,SAVR14]
BLT 0,SAVR14+3
LIST>
DEFINE RES1T4 <XLIST
MOVE [XWD SAVR14,A1]
BLT 0,A4
LIST>
DEFINE CHECK <XLIST
CAIL CHAR,LF
CAILE CHAR,CR
CAIA
LIST>
DEFINE FLSH(A,B) <XLIST
JSP A1,FLUSH
XWD A,B
LIST>
DEFINE PUT.IT(A) <XLIST
IDPB CHAR,A
SUBI CHAR,40
IDPB CHAR,A+1
LIST>
DEFINE ERROR <XLIST
JRST ERROR1
LIST>
CRLFPT: POINT 14,7(A1),34
PTSTORE:
POINT 7,2(A1),
POINT 6,10(A1),
POINT 7,4(A1),
POINT 6,11(A1),
POINT 7,5(A1),
POINT 6,12(A1),
POINT 7,7(A1),
POINT 6,13(A1),
EXCL: ASCIZ /-!/
OPDEF OUTSTR[TTCALL 3,0]
OPDEF OUTCHR[TTCALL 1,0]
MESK: ASCIZ /MANUFACTURER'S CORRECTION SUBFILE HEADER IN ERROR : /
MESL2: ASCIZ /USER'S CORRECTION SUBFILE HEADER IN ERROR : /
MESH: ASCIZ/*** INSUFFICIENT CORE FOR COMPAR WHILE PROCESSING:
/
MESHPT: POINT 7,MESH+11,27
DEFINE GETCHR <XLIST
JSP RETURN,0(A2)
CAIN CHAR,0
JRST 1(A1)
LIST>
DEFINE OUTHED(A) <XLIST
FCAL MRGOUT,[43],A+1
XLIST
JSP RETURN,LINEIN ;LINE NUMBER FOR LST
FCAL LSTOUT,[43],A+1
XLIST
SETOM T2
LIST>
MESE: ASCIZ /- *** FILE HEADERS BELOW IN CONFLICT ***
/
MESF: ASCIZ /- *** END OF FILE HEADER CONFLICT ***
/
; FILBUF - - FILL UCBUF OR MCBUF
; CALL IS JSP A7,FILBFR
; <BUFFER ADDR,INPUT ROUTINE ADDR>
; <PEOF RETURN>
; <NORMAL RETURN>
; TYPE=-1:INSERT 0:CORRECTION 1:DELETION
FILBFR:
SAV1T4
HRRZ A2,0(A7) ;INPUT ROUTINE ADDRESS
SETZM ARROWD ;NO ARROW YET
SETZM A3
CAIE A2,MCIN ;IS IT MCIN ?
ADDI A3,1 ;NO-UCIN
SETZM XCLAMD(A3) ;NO HEADER YET
JRST CHEKSN
FILHER:
HLRZ A1,0(A7) ;BUFFER ADDRESS
SETZM 0(A1) ;ZERO FIRST WORD OF BUFFER
HRRZ 0,A1 ;
ADDI 0,1 ;
HRL 0,A1 ;
BLT 0,13(A1) ;ZERO BUFFER
MOVE EXCL ;
MOVEM 1(A1) ;SET -!
MOVEI 3212 ;CR LF
DPB CRLFPT ;SET CRLF IN BUFFER
MOVE 0,[XWD PTSTOR,PTNF]
BLT 0,PTOE+1
MOVEI A4,6 ;NEW FILE ROUTINE
SETZM 0(A1)
L.2: GET.IT ;GET CHAR
CHECK ;IS IT FEED ?
ERROR ;YES
CAIN CHAR,PERIOD ;PERIOD ?
JRST L.3 ;YES
CAIN CHAR,LARROW ;LARROW ?
JRST L.5 ;YES
SOJL A4,L.2 ;MORE THAN 6 CHARS ?
PUT.IT PTNF ;NO
SETOM 0(A1) ;GOT NEW FILE
JRST L.2 ;GET NEXT CHAR
L.3: SKIPN 0(A1)
ERROR
IDPB CHAR,PTNF
MOVEI A4,3 ;NEW FILE EXTENSION ROUTINE
L.4: GET.IT ;GET CHAR
CHECK ;IS IT FEED ?
ERROR ;YES
CAIN CHAR,LARROW ;LARROW ?
JRST L.5 ;YES
SOJL A4,L.4 ;MORE THAN 3 CHARS ?
PUT.IT PTNE ;NO
JRST L.4 ;GET NEXT CHAR
L.5: SETOM ARROWD ;GOT ARROW
IDPB CHAR,PTNE
MOVEI A4,6 ;OLD FILE ROUTINE
L.5.1: GET.IT ;GET CHAR
CHECK ;FEED ?
JRST L.9 ;YES
CAIN CHAR,PERIOD ;PERIOD ?
JRST L.7 ;YES
SOJL A4,L.5.1 ;MORE THAN 6 CHARS ?
PUT.IT PTOF ;
JRST L.5.1 ;GET NEXT
L.7: CAIN A4,6 ;GOT .
ERROR ;EXT BUT NO FILE
MOVEI A4,3 ;OLD FILE EXTENSION ROUTINE
IDPB CHAR,PTOF
L.7.1: GET.IT ;GET CHAR
CHECK ;FEED ?
JRST L.10 ;YES
SOJL A4,L.7.1 ;MORE THAN 3 CHARS ?
PUT.IT PTOE ;
JRST L.7.1 ;GET NEXT CHAR
L.9: CAIE A4,6 ;OLD FILE ?
JRST L.10
SKIPE 0(A1) ;ANY NEW FILE ?
JRST L.10.0 ;YES
ERROR ;NO
L.10: AOS 0(A1) ;GOT OLD FILE
L.10.0:
GET.IT ;GET FEED CHAR
CAIL CHAR,LF
CAILE CHAR,FF
JRST L.10.0
L.10.1:
SETOM XCLAMD(A3)
JRST M.88 ;RESUME HEADER SYNTAX CHECK
ERROR1: SETZM XCLAMD(A3) ;NO HEADER YET
MOVEM CHAR,TEMP ;STORE CHAR
JUMPG A3,ERR.1 ;UC ?
SKIPE FED ; FED RUNNING?
JRST NOOUT ; NO, PUT ERR MSG IN RIGHT PLACE
FCAL MRGOUT,[64],MESK
FCAL MRGOUT,[41],MCBUF
NOOUT: FCAL LOGOUT,[64],MESK
FCAL LOGOUT,[41],MCBUF
ERR.01: FCAL LOGOUT,[0],TEMP
SKIPE FED ;FED RUNNING/
JRST NOOUT1
FCAL MRGOUT,[0],TEMP
NOOUT1: MOVE CHAR,TEMP
CAIL CHAR,LF
CAILE CHAR,FF ;FEED ?
JRST ERR.2 ;NO
SETOM BOL(A3) ;BEG OF LINE
FLSH MCIN,1 ;FLUSH SUBFILE
JRST PEOF
JRST CHEKSN ;TRY NEXT HEADER
ERR.1: FCAL LOGOUT,[54],MESL2
FCAL LOGOUT,[41],UCBUF
SKIPE FED
JRST ERR.11
FCAL MRGOUT,[54],MESL2
FCAL MRGOUT,[41],UCBUF
ERR.11: FCAL LOGOUT,[0],TEMP
SKIPE FED
JRST NOOUT2
FCAL MRGOUT,[0],TEMP
NOOUT2: MOVE CHAR,TEMP ;
CAIL CHAR,LF ;
CAILE CHAR,FF ;FEED ?
JRST ERR.2 ;NO
SETOM BOL(A3) ;BEG OF LINE
FLSH UCIN,1 ;FLUSH SUBFILE
JRST PEOF
JRST CHEKSN ;TRY NEXT HEADER
ERR.2: GET.IT
MOVEM CHAR,TEMP ;STORE CHAR
JUMPG A3,ERR.11 ;UC ?
JRST ERR.01 ;NO
PEOF: SKIPE XCLAMD(A3) ;DID WE GET HEADER YET
JRST PEOF.2 ;YES
RES1T4 ;
JRST 1(A7) ;NO
PEOF.2: RES1T4 ;
JRST 2(A7) ;
; SUBFILE HEADER SYNTAX CHECKING ROUTINE
; AND -" " MSG HANDLER
CHEKSN:
MOVE CHAR,STORE(A3) ;GET STORED CHAR
SETZM STORED(A3) ;
SKIPN FED
JRST ENDFDG
SKIPE STORD2
MOVE CHAR,STORE2
SETZM STORD2
ENDFDG:
M.6: CAIE CHAR,QUOTES ;QUOTES ?
JRST M.10 ;YES
SKIPL FED ;IS IT FED ?
JRST M.7 ;NO
OUTSTR [ASCIZ /-"/] ;
M.7: GET.IT ;GET CHAR
SKIPL FED ;FED ?
JRST M.8 ;NO
OUTCHR CHAR ;OUT CHAR ON TTY
M.8: CAIL CHAR,LF ;
CAILE CHAR,FF ;FEED ?
JRST M.7 ;NO
SKIPL FED
JRST M.88
RELEAS 2,
RELEAS 3,
MOVEM A2,FIRST
JSP A1,DIALOG ;GIVE GUY A CHANCE TO CHANGE OUTPUT TAPE
JFCL
HLRZ A1,0(A7) ;RESTORE A7
EXTERN FIRST
MOVE A2,FIRST
M.88:
SKIPGE 0(A1)
JRST M.11
GET.IT
M.9: CAIE CHAR,MINUS ;MINUS ?
JRST FFEEDD ;FORM FEED?
GET.IT ;GET CHAR
JRST M.6 ;
FFEEDD: CAIE CHAR,14
ERROR
TTCALL 3,[ASCIZ/? FORM FEED AFTER HEADER ?
/]
GET.IT
CAIN CHAR,MINUS
JRST M.9
ERROR
M.10: CAIN CHAR,EXCLAM ;EXCAM ?
JRST M.11 ;YES
SKIPL XCLAMD(A3) ;DO WE HAVE A ! ?
ERROR ;NO
M.111: SKIPGE 0(A1)
JRST M.112
SETOM STORED(A3)
MOVEI MINUS ;
MOVEM STORE(A3) ;
SETOM STORD2(A3) ;
MOVEM CHAR,STORE2(A3) ;STORE CHAR
M.112:
SETOM BOL(A3) ;BEG OF LINE IN CORR FILE
RES1T4
JRST 2(A7) ;NORMAL RETURN
M.11: SKIPGE XCLAMD(A3) ;DO WE HAVE A ! YET
JRST M.111 ;YES-STORE THIS ONE
JRST FILHER ;FIL HER UP
; UCOR - - USER CORRECTION FILE CHARACTER FETCH ROUTINE
; CALL IS JSA 16,MANCOR OR UCCOR
; ADDR OF PARAMETER
; <ERROR RETURN>
; <EOF RETURN> CHAR=-1:EOSF CHAR=0:PEOF
; <NORMAL RETURN>
UCOR:
SKIPG CAMOPT ;CAMOPT ?
JRST UCCOR
MOVEM 16,TEM
PUSH 16,17
PUSHJ 16,CBGET
POP 16,17
MOVE 16,TEM
MOVE RETURN,0(16)
MOVEM CHAR,@0(RETURN)
SKIPLE CHAR ;EOF ?
AOS (16)
AOS (16)
POPJ 16,
; MANCOR - UCCOR CORRECTION FILE FETCH ROUTINES
;CALL IS JSA 16,MANCOR OR UCCOR
; <ADDR OF PARAMETER>
; <ERROR RETURN>
; <EOF RETURN>
; <NORMAL RETURN>
UCCOR:
MOVE 0,[XWD A1,CORSAV]
BLT 0,CORSAV+3
MOVEI A3,1 ;SET UCOR INDEX
MOVEI A2,UCIN ;UCOR INPUT ROUTINE
JRST COR ;
MANCOR:
MOVE 0,[XWD A1,CORSAV]
BLT 0,CORSAV+3
MOVEI A3,0 ;SET MANCOR INDEX
MOVEI A2,MCIN ;MANCOR INPUT ROUTINE
COR: SKIPL STORED(A3) ;ANY STORED CHAR ?
JRST M.2 ;NO
SETZM STORED(A3) ;ZERO STORE SWITCH
MOVE CHAR,STORE(A3) ;GET STORED CHAR
JRST M.2.3
M.1: MOVE A1,0(16)
MOVEM CHAR,@0(A1)
MOVE 0,[XWD CORSAV,A1]
BLT 0,A4
SKIPLE CHAR ;EOF ?
AOS (16)
AOS (16)
POPJ 16,
M.2: SKIPL STORD2(A3) ;STORE 2 ?
JRST M.2.2 ;NOT STORED
SETZM STORD2(A3) ;
MOVE CHAR,STORE2(A3) ;GET STORED CHAR
JRST M.2.3
M.2.2: JSP RETURN,0(A2) ;GET CHAR
M.2.3:
CAIL CHAR,LF ;
CAILE CHAR,FF ;FEED ?
JRST M.3 ;NO
SETOM BOL(A3) ;YES-SET BOL
JRST M.1 ;RETURN
M.3: SKIPL BOL(A3) ;BOL ?
JRST M.1 ;NO-RETURN
SETZM BOL(A3) ;ZERO BOL
CAIE CHAR,MINUS ;MINUS ?
JRST M.1 ;NO-RETURN WITH CHAR
SKIPL STORD2(A3) ;STORE 2
JRST M.3.3 ;NO
SETZM STORD2(A3) ;ZERO STORE WORD
MOVE CHAR,STORE2(A3) ;GET STORED CHAR
SKIPA
M.3.3: JSP RETURN,0(A2) ;GET CHAR
SETOM STORED(A3) ;SET STORE SWITCH
CAIN CHAR,QUOTES ;QUOTES ?
JRST M.4 ;YES
CAIN CHAR,EXCLAM ;EXCLAM ?
JRST M.4 ;YES
MOVEM CHAR,STORE(A3) ;STORE CHAR
MOVEI CHAR,MINUS ;RETURN WITH -
JRST M.1 ;
M.4: MOVEM CHAR,STORE(A3) ;STORE ! OR "
HRREI CHAR,-1 ;SET EOSF
JRST M.1 ;RETURN
; CORRECTION SUBFILE SYNCHRONIZING ROUTINE
;
; CALL IS JSP A5,STSYNC
; <PEOF RETURN>
; <NORMAL RETURN>
; USES REGISTERS A1,A2,A3,A4
STSYNC:
SKIPGE MCBUF ;MCTYPE ?
JRST MINS ;INSERTION
MOVE A3,MCBUF+12 ;MC OLD FILE
MOVE A4,MCBUF+13 ;MC OLD EXT
STP.1: SKIPGE UCBUF ;UC TYPE ?
JRST UINS ;INSERTION
MOVE A1,UCBUF+12 ;UC OLD FILE
MOVE A2,UCBUF+13 ;UC OLD EXT
JRST STP.2 ;
MINS: MOVE A3,MCBUF+10 ;MC NEW FILE
MOVE A4,MCBUF+11 ;MC NEW EXT
JRST STP.1 ;
UINS: MOVE A1,UCBUF+10 ;UC NEW FILE
MOVE A2,UCBUF+11 ;UC NEW EXT
STP.2: CAMN A3,A1 ;UCFILE=MCFILE ?
JRST FEQ ;YES
JUMPL A3,ALZ ;MCFILE<0 ?
JUMPL A1,FLUSHM ;UCFILE<0 & MCFILE>0
COM1: CAML A3,A1 ;MCFILE< UCFILE ?
JRST FLUSHU ;UC FILE LESS
JRST FLUSHM ;MC FILE LESS
FEQ: CAMN A4,A2 ;EXTS EQUAL ?
JRST FEEQ ;YES
JUMPL A4,ALZ.2 ;MC EXT<0 ?
JUMPL A2,FLUSHM ;MC>0 & UC<0 ?
COM2: CAML A4,A2 ;UC<MC EXT ?
JRST FLUSHU ;UC EXT LESS
JRST FLUSHM ;MC EXT LESS
ALZ: JUMPL A1,COM1 ;MC<0 & UC<0 ?
JRST FLUSHU ;MC<0 & UC>0
ALZ.2: JUMPL A2,COM2 ;MC<0 & UC<0 EXTS ?
JRST FLUSHU ;MC<0 & UC>0
FEEQ: SKIPE MCBUF ;CORRECTION COMMMAND ?
JRST FLUSHA ;;NO-FLUSH BOTH
SKIPE UCBUF ;CORRECTION COMMAND ?
JRST FLUSHA ;N0- FLUSH BOTH
JRST 1(A5) ;NORMAL RETURN
; FLUSH MANUFACTURER SUBFILE
FLUSHM: OUTHED MCBUF ;OUTPUT SUBFILE HEADER
FLSH MCIN,0
JRST FLU ;PEOF
FILBUF MCBUF,MCIN ;FILL MCBUF
JRST FLU
JRST STSYNC ;TRY AGAIN
; FLUSH USER CORRECTION SUBFILE
FLUSHU: OUTHED UCBUF ;OUT HEADER
FLSH UCIN,0
JRST FLM ;PEOF
FILBUF UCBUF,UCIN ;GET NEXT FILE HEADER
JRST FLM
JRST STSYNC ;TRY AGAIN
FLUSHA: FCAL MRGOUT,[53],MESE;OUTPUT CONFLICT HEADER
JSP RETURN,LINEIN
FCAL LSTOUT,[53],MESE
OUTHED MCBUF ;OUTPUT HEADER
MOVEM A5,A5STOR ;SAVE A5
FLSH MCIN,-1
JSP A5,FLU
SKIPN I ;PEOF MC & UC
JRST FLA.2 ;YES
OUTHED UCBUF ;OUT UC HEADER
FLSH UCIN,-1
JSP A5,FLM ;FLUSH ALL OF MC
FLA.2:
MOVE A5,A5STOR ;RESTORE A5
FCAL MRGOUT,[47],MESF;END OF CONFLICT
JSP RETURN,LINEIN
FCAL LSTOUT,[47],MESF
FILBUF MCBUF,MCIN ;GET NEXT FILE HEADERS
JRST FLU
FILBUF UCBUF,UCIN ;GET NEXT UC SUBFILE HEADER
JRST FLM
JRST STSYNC ;
; FLUSH ROUTINE
;
; CALL IS JSP A1,FLUSH
; <INPUT ROUTINE ADDR,TYPE>
; <PEOF RETURN>
; <NORMAL RETURN>
; WHERE A2 HAS ADDR OF INPUT ROUTINE
; TYPE IS A FLAG. -1:MRGOUT,LSTOUT
; 0:MRGOUT
; 1:NO OUTPUT
FLUSH:
MOVE 0,[XWD A2,SAV23]
BLT 0,SAV23+1 ;STORE REGS 2,3
HLRZ A2,0(A1) ;
HRRE A3,0(A1) ;TYPE
SETZM T2 ;NOT BEG OF LINE
SETZM PFLAG ;PEOF FLAG=NO
CAIGE A3,2 ;SHOULD IT BE ON ?
JRST FL.ST ;NO
SETOM PFLAG ;YES
SUBI A3,2 ;ADJUST TYPE
FL.ST: CAIE A2,MCIN ;MC ?
JRST FL.2 ;NO
PUSHJ 16,MANCOR ;YES-GET CHAR
+ I ;PARAMETER
JRST FL.11 ;EOF
JRST FL.OUT ;NORMAL
FL.2: PUSHJ 16,UCCOR ;UCOR
+ I ;PARAMETER
JRST FL.11 ;EOF RETURN
FL.OUT: MOVE I ;GET CHAR
CAIL 0,LF ;
CAILE 0,FF ;IS IT FEED ?
CAIA ;
SETOM T2 ;YES-SET BEG OF LINE
FL.OUX:
JUMPG A3,FL.ST ;ANY OUTPUT ?
FCAL MRGOUT,[0],I ;YES-MRGOUT
JUMPE A3,FL.ST ;LSTOUT ?
SKIPE T2 ;YES-BEG OF LINE ?
JSP RETURN,LINEIN ;YES-INSERT LINENUM
FCAL LSTOUT,[0],I ;LSTOUT
JRST FL.ST ;NEXT CHAR
FL.11:
SKIPL PFLAG ;PEOF FLAG ?
JRST FL.112 ;NOT ON
SKIPN I ;PEOF ?
JRST FL.112 ;YES
MOVEI MINUS ;NO-LOAD -
MOVEM I ;
SETOM T2 ;BEG OF LINE
JRST FL.OUX ;OUT -
FL.112: MOVE 0,[XWD SAV23,A2]
BLT 0,A3
SKIPN I ;
JRST 1(A1) ;PEOF
JRST 0,2(A1) ;EOSF
; FLUSH ALL OF USER CORRECTION FILE
FLU: OUTHED UCBUF ;OUT HEADER
FLU.2:
FLSH UCIN,2 ;FLUSH UNTIL PEOF AND MRGOUT
JRST 0(A5)
;FLUSH ALL OF MANUFACTURER CORRECTION FILE
FLM: OUTHED MCBUF
FLM.2:
FLSH MCIN,2 ;FLUSH UNTIL PEOF AND MRGOUT
JRST 0(A5) ;PEOF RETURN
END