Trailing-Edge
-
PDP-10 Archives
-
AP-D489C-SB
-
srtprm.mac
There are 24 other files named srtprm.mac in the archive. Click here to see a list.
SUBTTL SRTPRM - PARAMETER FILE FOR NEW SORT
SUBTTL D.M.NIXON/DMN/DPL/DZN 29-MAR-78
;COPYRIGHT (C) 1975, 1978 BY
;DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
;
;
;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
;ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
;INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
;COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
;OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
;TRANSFERRED.
;
;
;THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
;AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
;CORPORATION.
;
;DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
;SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
CUSTVR==0 ;CUSTOMER VERSION
DECVER==4 ;DEC VERSION
DECMVR==0 ;DEC MINOR VERSION
DECEVR==302 ;DEC EDIT VERSION
V%SORT==:<CUSTVR>B2+<DECVER>B11+<DECMVR>B17+DECEVR
SUBTTL SRTPRM TABLE OF CONTENTS
; Table of Contents for SRTPRM
;
;
; Section Page
;
; 1 SRTPRM - PARAMETER FILE FOR NEW SORT...................... 1
; 2 SRTPRM TABLE OF CONTENTS.................................. 2
; 3 CONDITIONAL ASSEMBLY PARAMETERS........................... 3
; 4 REVISION HISTORY.......................................... 4
; 5 DEFINITIONS
; 5.1 Accumulators....................................... 5
; 5.2 Recording Modes.................................... 6
; 5.3 FORTRAN Interface.................................. 7
; 5.4 Special Monitor Definitions........................ 8
; 5.5 Business Instruction Set OPcodes................... 9
; 5.6 Prototype File Spec, MTA and Key Blocks............ 10
; 5.7 File Control Block and File Flags.................. 11
; 5.8 Tree Node and Record Blocks........................ 12
; 5.9 Segment Control - ISEGMENT and SEGMENT............. 13
; 5.10 Error Handling
; 5.10.1 $ERROR..................................... 15
; 5.10.2 $MORE...................................... 16
; 5.10.3 $CRLF, $CHAR, $DIE......................... 17
; 5.11 Structure Macros
; 5.11.1 BEGIN, PROCEDURE, RETURN, END.............. 18
; 5.11.2 IF, THEN, ELSE, FI, CASE, ESAC............. 19
; 5.11.3 Temporary Labels........................... 20
SUBTTL CONDITIONAL ASSEMBLY PARAMETERS
;FTKL10 ;KL INSTRUCTIONS ALLOWED
;FTKI10 ;KI INSTRUCTIONS ALLOWED
;FTDEBUG ;DEBUGGING HELP
;FTOPS20 ;TOPS20 JSYS CODE
;FTCOBOL ;COBOL INTERFACE CODE
;FTFORTRAN ;FORTRAN-10 INTERFACE
;FTCOL ;ALTERNATE COLATING SEQUENCE
;FTVM ;TOPS-10 VIRTUAL MEMORY VERSION
IFNDEF FTOPS20,<FTOPS20==0>
IFN FTOPS20,<FTKL10==1
FTFORTRAN==0>
IFNDEF FTKL10,<FTKL10==0>
IFN FTKL10,<FTKI10==1>
IFNDEF FTKI10,<FTKI10==0>
IFNDEF FTDEBUG,<FTDEBUG==0>
IFNDEF FTCOL,<FTCOL==1>
IFNDEF FTFORTRAN,<FTFORTRAN==0>
IFNDEF FTCOBOL,<FTCOBOL==0>
IFN FTOPS20,<FTOPS10==0>
IFE FTOPS20,<FTOPS10==1>
EXTERN .JBFF,.JBHRL,.JBOPS,.JBREL
SEARCH MACTEN ;*** YES, MUST REALLY BE SEARCHED ON BOTH SYSTEMS ***
IFE FTOPS20,<SEARCH UUOSYM,SCNMAC>
IFN FTOPS20,<SEARCH MONSYM,MACSYM>
SALL
.DIRECTIVE FLBLST, SFCOND
IFN FTKI10,<.DIRECTIVE KI10>
SUBTTL REVISION HISTORY
;VERSION 1
;1 FIRST FIELD TEST RELEASE
;2 SECOND FIELD TEST RELEASE
;3 FIX QA FOUND BUGS
;4 FIX BUG IF RUN OF MORE THAN 400000 RECORDS
;5 FIX RANDOM BIT 35'S IN ASCII OUTPUT FILE
;6 TEST FOR DEVICE NUL:
;7 DON'T ADD EXTRA BUFFERS IF IN USE BIT IS ON FOR ALL BUFFERS IN RING
;10 ADD EXTRA BUFFERS IN CORRECT SEQUENCE
;11 STRIP LEADING NULLS AND TERMINATORS CORRECTLY AND EFFICIENTLY
;12 WAIT FOR ALL CHANNELS NOT JUST CHAN 0
;13 DON'T READ ONE CHAR TOO MANY AT GETAVR
;14 RECORD COUNT WRITTEN ONE TOO HIGH ON SIXBIT MTA FILES
;15 CALCULATE ELAPSED TIME CORRECTLY OVER MIDNIGHT
;16 DON'T RETURN CORE IF SOMEONE ELSE INCREASED IT AFTER SORT
;17 CORRECTLY HANDLE VARIABLE LENGTH ASCII RECORDS LESS THAN 6 CHAR LONG
;20 GET TO STOPR. CORRECTLY ON FATAL ERROR
;VERSION 2
;100 IMPLEMENT VERSION 2 FEATURES (EBCDIC, COMP-3, VARIABLE LENGTH, ETC)
;101 FIX BUG INTRODUCED IN PUTSXR & GETSXR
;102 FIX BUGS IN EBCDIC AND COMP-3 CODE
;103 IMPROVE TENEX CODE
;104 FIX VARIABLE ASCII WITH NUMERIC KEYS
;SORT %2(104) Released on TOPS-10.
;105 FORCE SIXBIT FILES TO BE VARIABLE
;106 SETUP PPN OR SFD CORRECTLY FOR NEXT INPUT FILE
;107 IGNORE NULL INPUT FILES
;110 SIMPLIFY HANDLING OF SEQUENCE NUMBERS
;111 MORE TOPS-20 IMPROVEMENTS
;112 DO ROUNDING CORRECTLY ON FLOATING POINT OUTPUT
;113 RENAME SINGLE TEMP FILE CORRECTLY IF FILE ALREADY EXISTS
;SORT %2(113) Released on TOPS-20.
;114 ACCEPT R SORT (COMMAND LINE) I.E. DO A RESCAN
;115 FIX VARIOUS PROBLEMS WITH DEFAULT PATHS
;116 MAKE MULTI-REEL FILES WORK CORRECTLY
;117 FIX SRTSCN SO THAT BLOCKED SIXBIT FILES THAT TAKE ONLY 1 RUN COME OUT BLOCKED
;120 FIX KL-10 BIS WRITE OF FIXED LENGTH ASCII AND EBCDIC RECORDS
;121 ADD ERJMP AFTER MTOPR ON TOPS-20
;122 FIX LAST RECORD OF FIXED LENGTH EBCDIC FILE
;123 DON'T ZERO TOO MANY WORDS WHEN CLEARING OUTPUT BUFFER
;124 CORRECT OUTPUT EBCDIC BYTE POINTER FOR DUMMY OUTPUT
;125 DELETE TEMP FILE IF USER ROUTINE EXITS BEFORE END-OF-FILE
;126 CORRECT BIS COMPARE WHEN BYTE POINTER IS 36 BITS (EBCDIC OR SIXBIT)
;127 CORRECT KL10 INPUT FOR VARIABLE LEN ASCII
;130 FIX VAR LNGTH RECS WITH XTRCTED KEYS
;131 FIX JUNK WRITTEN AT END OF LAST BLOCK ON OUTPUT FILE.
;132 FIX NEGATION OF DOUBLE PRECISION SIGNED NUMERICS ON KA.
;133 FIX CODE GEN OF DOUBLE PRECISION COMPARE ON KA.
;134 TYPE ERROR MESSAGES FOR ALL CROSS-CPU POSSIBILITIES.
;135 REMOVE USE OF MTOPR'S UNTIL SORT IS COMPLETELY JSYS-IZED FOR TOPS20
;136 DON'T SHARE BUFFER RING WHEN OUTPUT CHAN IS CLOSED IN COBOL SORT
;137 CLEAR ^O ON TOPS20 INSTEAD OF SETTING IT ON FATAL MESSAGES.
;140 CHANGE CHANNEL ALLOCATION SO MORE FILES CAN BE OPENED BY COBOL USER
;141 HANDLE MULTIPLE CORE EXPANSIONS PROPERLY SO SHRINK IN COBOL WORKS
;142 CAUSE SIXBIT RUNNING ON KL-10 TO SORT PROPERLY IN ALL CASES.
;143 HANDLE /FIX, /VAR MORE CONSISTENTLY, AND ISSUE BETTER ERROR MESSAGE
;144 MAKE NUMERIC UNSIGNED EBCDIC USE EBCDIC ROUTINES INSTEAD OF SIXBIT ONES.
;145 CAUSE EBCDIC ALPHANUMERIC RUNNING ON KL-10 TO SORT PROPERLY IN ALL CASES.
;146 USE WORD OFFSET IN CNVGEN SO SORTS WITH MORE THAN 1 CONVERTED KEY WORK.
;147 FIX AND CLEAN UP HANDLING OF EXTRACTED WORD COUNT IN ASCII I/O ROUTINES.
;150 FIX AND CLEAN UP HANDLING OF EXTRACTED WORD COUNT IN EBCDIC I/O ROUTINES.
;151 MAKE SRTSNA AND SRTROS FATAL ERRORS RATHER THAN WARNINGS.
;152 MAKE SURE R (AND RSAV) NEVER GETS -1 IN LH, DUE TO @RSAV.
;153 FIX ASCII ALPHANUMERIC COMPARISONS ON KL (BIS).
;154 FIX MORE ASCII AND EBCDIC I/O WHEN FTKL10==1.
;VERSION 3
;200 Implement stand-alone merge.
; Implement COBOL merge.
; Implement FORTRAN interface.
; Start to implement collating sequence.
;SORT %3A(200) Released.
;201 Separate MODE into MODE for keys and IOMODE for I/O to avoid confusion.
;202 Fix Ill UUO and defaulting of /FIX, /VAR, /SEQ, /RAN, /BIN, /COMP and /FORMAT.
;203 Fix FORTRAN binary data files of all flavors.
;204 Change SIXBIT input to ignore zero words.
;205 Fix handling of tapes in sort case.
;206 Turn on FTOPS20 conditional for TOPS-20 SORT.
;207 Write .TMP files variable length in COBOL SORT.
;210 Check forgotten case in edit 131 so files are not padded with zeros.
;211 Make sure the last I/O channel is freed before returning in FORTRAN SORT.
;212 Fix random errors on second command to SORT when using /TEMP.
;213 Fix major incompatibilities in FORTRAN SORT's command scanner.
;214 Skip .TMP structures if OPEN or ENTER fails.
;215 Fix tape label checking in stand-alone SORT.
;216 Fix handling of line-sequenced ASCII files in KL case.
;217 Fix edit 207 so data record gets copied after the keys.
;220 Fix illegal instruction when handling tapes in FORTRAN SORT.
;221 Stop FORTRAN SORT from expanding more and more on TOPS-20.
;222 Fix DECODE errors when using /FORMAT.
;223 See that R gets initialized in SCAN in SRTFOR for ? I/O to unassigned channel.
;224 Fix SRTTFC and I/O to unassigned channel errors in SRTCBL on early ENDS. calls.
;VERSION 4
;300 JSYSize SORT.
;301 Allow input and output to have different blocking factors (QAR 20-00136).
;302 Fix bugs found from second field test tape.
SUBTTL DEFINITIONS -- Accumulators
EF=0 ;END OF FILE STATUS
T0=0 ;USED IN EXTRACT ROUTINES
T1=1 ;TEMPORARY
T2=2
T3=3
T4=4
P1=5 ;PRESERVED
P2=6
P3=7
P4=10
F=11 ;FILE PTR
U=12 ;GENERAL AOBJN PTR
J=13 ;2ND RECORD PTR
R=14 ;1ST RECORD PTR
S=15 ;NODE PTR
L=16 ;EXTERN ARG-LIST PTR
P=17 ;PUSHDOWN PTR
PGSIZ==1000 ;SIZE OF ONE PAGE
PDLEN==100 ;SIZE OF STACK
IFE FTOPS20,<
MX.TMP==^D15 ;MAXIMUM NUMBER OF TEMP FILES
>
IFN FTOPS20,<
MX.TMP==^D26 ;ONE FOR EACH LETTER OF THE ALPHABET
>
U.CHN==3 ;NUMBER OF CHANNELS TO TRY TO LEAVE TO USER
MX.INP==^D100 ;MAX NUMBER OF INPUT FILES
MX.OUT==^D20 ;MAX NUMBER OF OUTPUT FILES
DEFINE $EDIT (N)<
IFNDEF E.'N,<E.'N==0>
E.'N==E.'N+1
IF2,<PURGE E.'N>
>
SUBTTL DEFINITIONS -- Recording Modes
RM.ASC==1B0 ;ASCII - DISPLAY-7
RM.SIX==1B1 ;SIXBIT - DISPLAY-6
RM.EBC==1B2 ;EBCDIC - DISPLAY-9
RM.BIN==1B3 ;BINARY - 36 BIT
RM.ALP==1B4 ;ALPHANUMERIC
RM.COM==1B5 ;COMPUTATIONAL
RM.NUM==1B6 ;NUMERIC
RM.PAC==1B7 ;PACKED - COMP-3
RM.SGN==1B8 ;SIGNED
RM.UNS==1B9 ;UNSIGNED
RM.FPA==1B16 ;FLOATING POINT
RM.FOR==1B17 ;FORTRAN DATA FILE
;INDEX BITS FOR RECORDING MODE. XX IS A MACRO THAT GETS REDEFINED AT VARIOUS
;TIMES. 1ST ARG IS DISPATCH ADDRESS AND 2ND ARG IS ONE OF THE FOLLOWING:
;
; A - ALWAYS EXTRACT KEYS
; C - CONDITIONALLY EXTRACT KEYS DEPENDING UPON COLLATING SEQ. FLAG
; N - NEVER EXTRACT KEYS
DEFINE IXMODE,<
XX (ALS,C) ;ALPHANUMERIC LOGICAL SIXBIT
XX (ALA,C) ;ALPHANUMERIC LOGICAL ASCII
XX (ALE,C) ;ALPHANUMERIC LOGICAL EBCDIC
XX (NSS,A) ;NUMERIC SIGNED SIXBIT
XX (NSA,A) ;NUMERIC SIGNED ASCII
XX (NSE,A) ;NUMERIC SIGNED EBCDIC
XX (NUS,A) ;NUMERIC UNSIGNED SIXBIT
XX (NUA,A) ;NUMERIC UNSIGNED ASCII
XX (NUE,A) ;NUMERIC UNSIGNED EBCDIC
XX (CSS,N) ;COMPUTATIONAL SIGNED SIXBIT
XX (CSA,N) ;COMPUTATIONAL SIGNED ASCII
XX (CSE,N) ;COMPUTATIONAL SIGNED EBCDIC
XX (CUS,N) ;COMPUTATIONAL UNSIGNED SIXBIT
XX (CUA,N) ;COMPUTATIONAL UNSIGNED ASCII
XX (CUE,N) ;COMPUTATIONAL UNSIGNED EBCDIC
XX (C3S,A) ;COMP-3 SIGNED
XX (C3U,A) ;COMP-3 UNSIGNED
XX (CSB,N) ;COMPUTATINAL SIGNED BINARY
XX (CUB,N) ;COMPUTATIONAL UNSIGNED BINARY
XX (FPA,A) ;FLOATING POINT ASCII
>
;GENERATE INDEX
ZZ==0
DEFINE XX(A,B)<
IX.'A==ZZ
ZZ==ZZ+1
>
IXMODES
SUBTTL DEFINITIONS -- FORTRAN Interface
;FORTRAN BINARY LSCW'S
S.LSCW==001000 ;START
C.LSCW==002000 ;CONTINUE
E.LSCW==003000 ;END
;FORTRAN DATA TYPES
TP%UDF==0 ;UNDEFINED TYPE
TP%LOG==1 ;LOGICAL
TP%INT==2 ;INTEGER
TP%REA==4 ;REAL
TP%OCT==6 ;OCTAL
TP%LBL==7 ;LABEL OR ADDRESS
TP%DOR==10
TP%DOT==12
TP%COM==14
TP%LIT==17 ;ASCIZ TEXT (LITERAL STRING)
;FORTRAN IOLST. FUNCTIONS
OPDEF DATA.[1B8] ;CONVERT SINGLE DATA ELEMENT
OPDEF SLIST.[2B8] ;CONVERT AN ENTIRE ARRAY
OPDEF FIN.[4B8] ;IMPLIED CALL TO FIN.
;FUNCT. ARGUMENTS
F.GAD==1 ;GET CORE AT SPECIFIC ADDRESS
F.COR==2 ;GET CORE AT ANY ADDRESS
F.RAD==3 ;RETURN CORE AT ADDRESS
F.GCH==4 ;GET CHANNEL ARGUMENT
F.RCH==5 ;RETURN CHANNEL NUMBER
F.GOT==6 ;GET CORE FROM OTS LIST
F.ROT==7 ;RETURN CORE TO OTS LIST
F.CBC==12 ;CUT BACK CORE (SHRINK)
SUBTTL DEFINITIONS -- Special Monitor Definitions
;TAPE LABEL DEFINITIONS--NOT YET IN UUOSYM
OPDEF TAPOP. [CALLI 154]
%SITLP==4,,126
.TFLBL==1024
.TFSET==1000
.TFLAL==1
.TFLIL==3
.TFLNL==7
;EXIT TO MONITOR--NOTE THAT BOTH OF THESE ARE CONTINUABLE!
IFE FTOPS20,<OPDEF MONRET[MONRT.]>
IFN FTOPS20,<OPDEF MONRET[HALTF]>
;OTHER USEFUL OPDEFS
DEFINE FASTSKIP<JRST .+2> ;FASTEST SKIP--DON'T USE IN LITERALS
IFE FTKL10,<OPDEF NOOP[JFCL]> ;FASTEST NO-OP ON KA10/KI10
IFN FTKL10,<OPDEF NOOP[TRN]> ;FASTEST NO-OP ON KL10
IFE FTOPS20,< ;DEFINED IN MACSYM ON TOPS20
OPDEF CALL[PUSHJ P,] ;JUST INCASE
OPDEF RET[POPJ P,] ; ..
OPDEF RETSKP[JRST CPOPJ1] ; ..
>
;DEFINE DMOVE, DMOVEM FOR KA10 IF NECESSARY, REMEMBERING REAL DEFINITIONS
IF1,<
OPDEF .DMOVE [DMOVE]
OPDEF .DMOVM [DMOVEM]
>
IFE FTKI10!FTKL10,< ;ASSEMBLE ONLY IF KA10
DEFINE DMOVE(AC,M)<
IFL <Z M>-<@>,<
MOVE AC,M
MOVE AC+1,1+M
>
IFGE <Z M>-<@>,<
MOVEI AC+1,M
MOVE AC,(AC+1)
MOVE AC+1,1(AC+1)
>
>
DEFINE DMOVEM(AC,M)<
MOVEM AC,M
MOVEM AC+1,1+M
>
>;END IFE FTKI10!FTKL10
;MACROS TO TYPE STRINGS AND CHARACTERS
DEFINE TYPE(MESSAGE)<
IFE FTOPS20,<
OUTSTR [ASCIZ \MESSAGE\]
>
IFN FTOPS20,<
HRROI T1,[ASCIZ \MESSAGE\]
PSOUT
>
>
DEFINE TYPEC(ACC)<
IFE FTOPS20,<
OUTCHR ACC
>
IFN FTOPS20,<
IFN <ACC>-T1,<
HRRZ T1,ACC
>
PBOUT
>
>
;MACRO TO CLEAR CTRL/O. NOTE THAT IT POTENTIALLY DESTROYS T1 AND T2.
DEFINE CLEARO<
IFE FTOPS20,<
SKPINL ;;ANY INPUT OPERATION CLEARS ^O
JFCL
>
IFN FTOPS20,<
MOVEI T1,.PRIOU ;;READ JFN MODE WORD
RFMOD ;; ..
TXZE T2,TT%OSP ;;TURN OFF OUTPUT-SUPPRESS
SFMOD ;; ..
>
>
;UUOSYM MNEMONICS THAT DIDN'T MAKE IT TO TOPS-20
.PTSFD==3
;MONITOR TYPE GETTAB. NOTE THAT THIS GETTAB IS SIMULATED ON TOPS-20 WITHOUT
;CALLING IN THE COMPATIBILITY PACKAGE.
%CNMNT==112,,11 ;CONFIGURATION GETTAB
CN%MNT==77B23 ;MASK FOR MONITOR TYPE
IFN FTOPS20,<
CSTKLN==50 ;LENGTH OF CORE ALLOCATOR STACK
>
;CPU TYPES
KA.CPU==0
KI.CPU==1
KL.CPU==2
SUBTTL DEFINITIONS -- Business Instruction Set OPcodes
;DEFINE BIS OPCODES--MACRO KNOWS THEM BUT DDT DOESN'T YET
OPDEF CMPSL [CMPSL] ;COMPARE STRINGS, SKIP IF LESS
OPDEF CMPSE [CMPSE] ;COMPARE STRINGS, SKIP IF EQUAL
OPDEF CMPSLE [CMPSLE] ;COMPARE STRINGS, SKIP IF LESS OR EQUAL
OPDEF CMPSGE [CMPSGE] ;COMPARE STRINGS, SKIP IF GREATER OR EQUAL
OPDEF CMPSN [CMPSN] ;COMPARE STRINGS, SKIP IF NOT EQUAL
OPDEF CMPSG [CMPSG] ;COMPARE STRINGS, SKIP IF GREATER
OPDEF EDIT [EDIT] ;PROCESS STRING ACCORDING TO MINI-PROGRAM PATTERN
OPDEF CVTDBO [CVTDBO] ;CONVERT DECIMAL TO BINARY BY OFFSET
OPDEF CVTDBT [CVTDBT] ;CONVERT DECIMAL TO BINARY BY TRANSLATION
OPDEF CVTBDO [CVTBDO] ;CONVERT BINARY TO DECIMAL BY OFFSET
OPDEF CVTBDT [CVTBDT] ;CONVERT BINARY TO DECIMAL BY TRANSLATION
OPDEF MOVSO [MOVSO] ;MOVE STRING WITH BYTE OFFSET
OPDEF MOVST [MOVST] ;MOVE STRING WITH BYTE TRANSLATION
OPDEF MOVSLJ [MOVSLJ] ;MOVE STRING UNMODFIED WITH LEFT JUSTIFICATION
OPDEF MOVSRJ [MOVSRJ] ;MOVE STRING UNMODIFIED WITH RIGHT JUSTIFICATION
OPDEF ADJBP [ADJBP] ;ADJUST BYTE POINTER
S.FLAG==1B0 ;SIGNIFICANCE FLAG
N.FLAG==1B1 ;NON-ZERO FLAG
M.FLAG==1B2 ;MINUS FLAG
E.SBIT==400000 ;SET S AND N FLAGS
E.ABRT==100000 ;ABORT EDIT (NO SKIP)
E.MCLR==200000 ;CLEAR M FLAG
E.MSET==300000 ;SET M FLAG
SUBTTL DEFINITIONS -- Prototype File Spec, MTA and Key Blocks
LOC 0
X.NXT:! BLOCK 1 ;POINTER TO NEXT
IFE FTOPS20,< ;ONLY WANT THESE ON TOPS10
X.OPN:! BLOCK 3 ;[215] OPEN BLOCK FOR FILE
X.DVSZ:!BLOCK 1 ;DEVSIZ UUO
X.DVCH:!BLOCK 1 ;DEVCHR UUO
X.RIB:! BLOCK .RBDEV+1 ;[215] LAST NEEDED + COUNT WORD
X.PTH:! BLOCK .PTMAX ;[215] SFDS
>;END IFE FTOPS20
IFN FTOPS20,< ;ONLY WANT THESE ON TOPS20
X.DVCH:!BLOCK 1 ;WORD RETURNED BY DVCHR JSYS
X.JFN:! BLOCK 1 ;JFN OF FILE (UNTIL COPIED TO FCB)
X.FLGM:!BLOCK 1 ;FLAG MASK WORD
X.RIB:! BLOCK 2 ;SIXBIT NAME, EXT, FOR LABEL CHECKING
>;END IFN FTOPS20
X.DEN:! BLOCK 1 ;[215] DENSITY FOR TAPOP.
X.REEL:!BLOCK 1 ;[215] REEL NUMBER FOR MULTI-REEL FILES
X.FLG:! BLOCK 1 ;[215] HOLDS FLAGS UNTIL MOVED TO FILFLG
X.BLKF:!BLOCK 1 ;BLOCKING FACTOR
X.LABL:!BLOCK 1 ;LABEL TYPE
LN.X==.-X.NXT
RELOC
IFN FTOPS20,<
;WORDS IN X.RIB TO HOLD SIXBIT FILENAME, EXT, FOR TAPE LABELS
.RBNAM==0
.RBEXT==1
>
;PROTOTYPE DATA BLOCK FOR MULTIPLE OUTPUT MTA SPECS
LOC 0
OM.NXT:!BLOCK 1 ;LINK TO NEXT
OM.DEV:!BLOCK 1 ;DEVICE
OM.LEN==.-OM.NXT
RELOC
;PROTOTYPE DATA BLOCK FOR KEYS
LOC 0
KY.NXT:!BLOCK 1 ;LINK TO NEXT
KY.INI:!BLOCK 1 ;INITIAL BYTE POSITION
KY.SIZ:!BLOCK 1 ;SIZE OF KEY IN BYTES OR DIGITS
KY.ORD:!BLOCK 1 ;ASCENDING OR DESCENDING
KY.MOD:!BLOCK 1 ;MODE OF KEY
KY.FMT:!BLOCK 2 ;FORMAT IF FPA
KY.LEN==.-KY.NXT
RELOC
SUBTTL DEFINITIONS -- File Control Block and File Flags
;FILE DEPENDENT FLAGS IN FILFLG
FI.VAR==1B0 ;VARIABLE LENGTH RECORDS
FI.IND==1B1 ;INDUSTRY COMPATIBLE MODE
FI.STA==1B2 ;STANDARD ASCII
FI.REW==1B3 ;REWIND BEFORE USE
FI.UNL==1B4 ;UNLOAD AFTER USE
FI.ATO==1B5 ;[215] TAPE LABEL PROCESSOR IS HANDLING LABELS
FI.EOT==1B6 ;[215] END-OF-TAPE FOR MULTI-REEL FILE
FI.MTA==1B7 ;FILE IS ON A MAGTAPE
FI.DSK==1B8 ;FILE IS ON DISK
FI.BF2==1B9 ;SECOND (MAGTAPE) BUFFER IN USE
FI.OUT==1B10 ;FILE IS AN OUTPUT FILE
FI.CLZ==1B11 ;CLOSE IN PROGRESS
FI.PHY==1B12 ;NO LOGICAL NAMES
FI.ODD==1B13 ;ODD PARITY
FI.EOF==1B14 ;EOF DETECTED (FOR ALL DEVICES BUT DSK)
FI.TMP==1B15 ;THIS IS A TEMP FILE
FI.LAB==1B16 ;LABEL PROCESSING IN PROGRESS
FI.BLK==1B17 ;BLOCKING FACTOR HACK IN PROGRESS
;FILE CONTROL BLOCK
LOC 0
FILSIZ:!BLOCK 1 ;SIZE OF FILE IN RECORDS
FILRUN:!BLOCK 0 ;RUN NUMBER (LHS)
FILNAM:!BLOCK 1 ;FILE NAME INDEX (RHS)
IFN FTOPS20,<
FILEOF:!BLOCK 1 ;EOF COUNTER (IN BYTES)
FILPGN:!BLOCK 1 ;JFN,,NEXT PAGE TO READ
>
DFBLEN==. ;LENGTH OF DORMANT BLOCK
IFN FTOPS20,<
FILBPB:!BLOCK 1 ;BYTES PER BUFFER ACCORDING TO I/O MODE
>
IFE FTOPS20,< ;ONLY NEED BUFFER HEADER ON TOPS10
FILHDR:!BLOCK 1 ;BUFFER HEADER
> ;END IFE FTOPS20
FILPTR:!BLOCK 1 ;POINTER TO NEXT WORD IN CURRENT BUFFER
FILCNT:!BLOCK 1 ;BUFFER COUNT
FILBUF:!BLOCK 1 ;WHERE BUFFERS START (BUFPTR)
FILBLK:!BLOCK 1 ;FILE BLOCKING FACTOR
FILFLG:!BLOCK 1 ;SEE FI.??? FLAGS ABOVE
FILXBK:!BLOCK 1 ;[215] POINTER TO X.???? BLOCK FOR FILE
FCBLEN==. ;SIZE OF FCB
RELOC
SUBTTL DEFINITIONS -- Tree Node and Record Blocks
;PROTOTYPE NODE FOR RECORD TREE
LOC 0
RN.RUN:! ;RUN NUMBER (LHS)
RN.LSR:!BLOCK 1 ;PTR. TO LOSE (RHS)
RN.FI:! ;PTR. TO INTERNAL NODE FATHER (LHS)
RN.FE:! BLOCK 1 ;PTR. TO EXTERNAL NODE FATHER (RHS)
RN.SEQ:! ;SEQUENCE # ON SORT PHASE (LHS)
RN.FCB:! ;PTR TO FCB ON MERGE PHASE (LHS)
RN.REC:!BLOCK 1 ;PTR. TO RECORD $ KEYS (RHS)
RN.LEN==. ;LENGTH
RELOC
;PROTOTYPE RECORD BLOCK
LOC 0
RC.CNT:!BLOCK 1 ;BYTE COUNT
RC.KEY:!BLOCK 1 ;FIRST DATA WORD
RELOC
;TYPE OF INPUT
T.SIX==0 ;SIXBIT
T.ASC==1 ;ASCII
T.EBC==2 ;EBCDIC
;FLAGS FOR LEFT SIDE OF P1 DURING CNVTDB
FL.SGN==1B0 ;VALUE IS SIGNED
FL.DP==1B1 ;VALUE IS 2 WORDS
LED.SG==(3) ;LEADING SIGN MASK
LED.PL==(1) ;LEADING +
LED.MI==(2) ;LEADING -
;SPECIAL FLAGS IN CONVERSION TABLES
CF.S==1B0 ;SPECIAL FLAG
CF.N==1B1 ;NEGATIVE SIGN
CF.P==1B2 ;PLUS SIGN
CF.L==1B3 ;LEADING CHARACTER (TAB SPACE)
CF.Z==1B4 ;NUL
CF.O==1B5 ;OVERPUNCHED NEGATIVE
CF.I==1B6 ;ILLEGAL CHAR
IFN FTOPS20,<
;NUMBER OF RECORDS TO ADD TO MINIMUM CORE SIZE FOR "DEFCOR"
NRECS==^D1000
>
SUBTTL DEFINITIONS -- Segment Control - ISEGMENT and SEGMENT
;SEGMENT ORIGINS
IFE FTOPS20,<
HILOC==400000
LOWLOC==0
>
IFN FTOPS20,<
HILOC==600000
LOWLOC==674000
>
DEFINE ISEGMENT<
IFE FTOPS20,<
IFE FTCOBOL!FTFORTRAN,<;; ONLY IN STAND-ALONE SORT
TWOSEG HILOC
RELOC HILOC
%SEG%==1
>
IFN FTCOBOL!FTFORTRAN,<
RELOC LOWLOC
%SEG%==0
>
>
IFN FTOPS20,<
TWOSEG HILOC
RELOC HILOC
%SEG%==1
>
DEFINE ISEGMENT<>
>
DEFINE SEGMENT(N)<
ISEGMENT
IFIDN <N><ABS>,<
IFG %SEG%,<
HILOC==.
>
IFE %SEG%,<
LOWLOC==.
>
LOC 0
%SEG%==-1
>
IFIDN <N><LOW>,<
IFG %SEG%,<
XLIST;; DUMP PENDING LITERALS
LIT
LIST
HILOC==.
>
IFN %SEG%,<
IFE FTOPS20,<
RELOC LOWLOC
%SEG%==0
>
IFN FTOPS20,<
LOC 0
PHASE LOWLOC
%SEG%==-1
>
>
>
IFIDN <N><LOW10>,<
IFE FTOPS20,<
IFG %SEG%,<
XLIST;; DUMP PENDING LITERALS
LIT
LIST
HILOC==.
>
IFN %SEG%,<
RELOC LOWLOC
%SEG%==0
>
>
>
IFE FTCOBOL!FTFORTRAN&FTOPS10,<;; ONLY IN STAND-ALONE SORT ON TOPS10
IFIDN <N><HIGH>,<
IFLE %SEG%,<
XLIST;; DUMP PENDING LITERALS
LIT
LIST
LOWLOC==.
IFN FTOPS20,<
DEPHASE
>
>
IFLE %SEG%,<
RELOC HILOC
%SEG%==1
>
>
IFIDN <N><HIGH20>,<
IFN FTOPS20,<
IFLE %SEG%,<
XLIST;; DUMP PENDING LITERALS
LIT
LIST
LOWLOC==.
DEPHASE
>
IFLE %SEG%,<
RELOC HILOC
%SEG%==1
>
>
>
>
>
DEFINE POW2(N)<<^L1-^L<N>>>
DEFINE $PURGE,<
PURGE END
PURGE ...SQB,..R..,..E..,..F..,..T..,..C..,ZZ
PURGE $.LAB,$.NST,$.END,$.IF,$.THN,$.INST,$.ORG
PURGE $.BEG0,$.BEG1,$.BEG2,$.BEG3,$.BEG4,$.BEG5,$.BEG6,$.BEG7,$.BEG8,$.BEG9
PURGE $.CAS0,$.CAS1,$.CAS2,$.CAS3,$.CAS4,$.CAS5,$.CAS6,$.CAS7,$.CAS8,$.CAS9
PURGE $.END0,$.END1,$.END2,$.END3,$.END4,$.END5,$.END6,$.END7,$.END8,$.END9
PURGE $.IF0,$.IF1,$.IF2,$.IF3,$.IF4,$.IF5,$.IF6,$.IF7,$.IF8,$.IF9
PURGE $.ORG0,$.ORG1,$.ORG2,$.ORG3,$.ORG4,$.ORG5,$.ORG6,$.ORG7,$.ORG8,$.ORG9
PURGE $.THN0,$.THN1,$.THN2,$.THN3,$.THN4,$.THN5,$.THN6,$.THN7,$.THN8,$.THN9
>
SUBTTL DEFINITIONS -- Error Handling -- $ERROR
;Error messages in SORT are handled via the $ERROR macro below. Four standard
;types of messages are handled, as shown below.
;
; TYPE CALL RESULTING MESSAGE
;
; Informative $ERROR ([,xxx,<Text>) [SRTxxx Text]
; Warning $ERROR (%,xxx,<Text>) %SRTxxx Text
; Fatal $ERROR (?,xxx,<Text>) ?SRTxxx Text
; Operator intervention $ERROR ($,xxx,<Text>) $SRTxxx Text
;
;For fatal error messages, $ERROR automatically generates a call to the $DIE
;macro to abort the sort, possibly returning error information for the FORTRAN
;user.
;
;Error messages which contain text that is a function of run-time parameters are
;handled by specifying '+' as the fourth argument to $ERROR, then using the
;$MORE or $CHAR macros as needed, and finishing with $CRLF. In this case, the
;final message disposition must be performed by manually calling $DIE for fatal
;errors.
;
;The label of $ERROR macros is E$$xxx by convention; in fact, the macro now
;generates this label automatically. If an error message routine must do some
;preliminary computations before calling $ERROR, then the actual error routine
;label should be ERRxxx.
DEFINE $ERROR (Q,CODE,TEXT,MORE)<
...SQB==0
E$$'CODE: MOVE T1,['SRT',,''CODE'']
IFB <MORE>,<
IFDIF <Q><[>,<
MOVE T2,["Q",,[ASCIZ \TEXT
\]]
>
IFIDN <Q><[>,<
MOVE T2,["Q",,[ASCIZ \TEXT]
\]]
>
>
IFNB <MORE>,<
MOVE T2,["Q",,[ASCIZ \TEXT\]]
IFIDN <Q><[>,<
...SQB==1
>
>
PUSHJ P,%ERMSG
IFB <MORE>,<
IFIDN <Q><?>,<
IFE FTOPS20,<
IFGE .-400000,<
JRST REINIT
>
IFL .-400000,<
JRST DIE
>
>
IFN FTOPS20,<
JRST DIE
>
>
>
>
SUBTTL DEFINITIONS -- Error Handling -- $MORE
;$MORE is used following a call to $ERROR with '+' as the fourth argument.
;Thus, a sample call might be:
;
; E$$SNR: $ERROR ([,SNR,<Sorted >,+)
; $MORE (DECIMAL,OUTREC)
; $MORE (TEXT,< records.>)
; $CRLF
DEFINE $MORE (TYPE,DATA)<
IFIDN <TYPE><OCTAL>,<
IFDIF <DATA><T1>,<
MOVE T1,DATA
>
PUSHJ P,%TOCTW
>
IFIDN <TYPE><DECIMAL>,<
IFDIF <DATA><T1>,<
MOVE T1,DATA
>
PUSHJ P,%TDECW
>
IFIDN <TYPE><TEXT>,<
IFDIF <DATA><T1>,<
MOVEI T1,[ASCIZ \DATA\]
>
PUSHJ P,%TSTRG
>
IFIDN <TYPE><SIXBIT>,<
IFDIF <DATA><T1>,<
MOVE T1,DATA
>
PUSHJ P,%TSIXN
>
IFIDN <TYPE><ASCII>,<
IFDIF <DATA><T1>,<
MOVEI T1,DATA
>
PUSHJ P,%TSTRG
>
IFIDN <TYPE><FILESPEC>,<
IFDIF <DATA><T2>,<
MOVE T2,DATA
>
IFE FTOPS20,<
MOVEI T1,X.OPN-X.RIB(T2)
>
PUSHJ P,%TOLEB
>
IFIDN <TYPE><CORE>,<
IFDIF <DATA><T1>,<
MOVE T1,DATA
>
PUSHJ P,%TCORW
>
>
SUBTTL DEFINITIONS -- Error Handling -- $CRLF, $CHAR, $DIE
DEFINE $CRLF<
IFN ...SQB,<
PUSHJ P,%TRBRK
...SQB==0
>
PUSHJ P,%TCRLF
>
...SQB==0
DEFINE $CHAR(CHAR)<
IFDIF <CHAR><T1>,<
MOVEI T1,CHAR
>
PUSHJ P,%TCHAR
>
DEFINE $DIE<
IFE FTOPS20,<
IFGE .-400000,<
$CRLF
JRST REINIT
>
IFL .-400000,<
JRST DIE
>
>
IFN FTOPS20,<
JRST DIE
>
>
DEFINE KEYZ (A,B)<
A'.L==0
IRP B,<
A'.L==A'.L+1
A'B==A'.L
>
>
SUBTTL DEFINITIONS -- Structure Macros -- BEGIN, PROCEDURE, RETURN, END
DEFINE BEGIN<
IFG $.NST-9,<PRINTX ? BEGIN-END nesting too deep>
..R..==..R.._3+..R..&7
..E..==..E.._3
$.NST==$.NST+1
$INITIAL \<$.NST>
$.LAB=$.LAB_4
>
DEFINE PROCEDURE (HOW,WHERE)<
IRP WHERE,<WHERE:>
IFIDN <HOW><PUSHJ P>,<..R..==..R..&<^-7>+1>
IFIDN <HOW><JSP P4>,<..R..==..R..&<^-7>+2>
IFIDN <HOW><JSP T4>,<..R..==..R..&<^-7>+3>
>
DEFINE RETURN<
IFE ..R..&7,<PRINTX ? Illegal RETURN code>
IFE ..R..&7-1,<POPJ P,>
IFE ..R..&7-2,<JRST (P4)>
IFE ..R..&7-3,<JRST (T4)>
>
DEFINE END<
IF2,< ZZ==1
REPEAT <$.LAB&17>,<
$REMOVE %,\<$.NST>,\<$.ORG+ZZ>
ZZ==ZZ+1
>
>
$UPDATE \<$.NST>
$.LAB==$.LAB_-4
..R..==..R.._-3
IFN ..E..&7,<
$LABEL E,\<$.NST>,\<$.END+1>
>
..E..==..E.._-3
IFL $.NST,<PRINTX ? BEGIN-END nesting underflow>
$.NST==$.NST-1
IFGE $.NST,<
$REINIT \<$.NST>
>
>
DEFINE $REMOVE (J,K,L)<
PURGE J'K'L
>
SUBTTL DEFINITIONS -- Structure Macros -- IF, THEN, ELSE, FI, CASE, ESAC
DEFINE IF<
IFG $.INST-5,<PRINTX ? IF nesting too deep>
$.INST==$.INST+1
..F..==..F.._3
..T..==..T.._3
$IFINITIAL \<$.INST>
REMARK>
DEFINE THEN<REMARK>
DEFINE ELSE<
IFN ..T..&7,<
$.THN==$.THN+1
$LABEL T,\<$.INST>,\<$.THN>
$THNUPDATE \<$.INST>
>
REMARK>
DEFINE FI<
IFN ..F..&7,<
$.IF==$.IF+1
$LABEL F,\<$.INST>,\<$.IF>
$IFUPDATE \<$.INST>
>
..F..==..F.._-3
..T..==..T.._-3
IFL $.INST,<PRINTX ? IF nesting underflow>
$.INST==$.INST-1
IFGE $.INST,<
$IFINITIAL \<$.INST>
>>
DEFINE CASE<
IFGE $.CNST-9<PRINTX ? CASE nesting overflow>
$.CNST==$.CNST+1
$CASEINITIAL \<$.CNST>
REMARK>
DEFINE ESAC<
$.CASE==$.CASE+1
$LABEL C,\<$.CNST>,\<$.CASE>
IF2,<$REMOVE C,\<$.CNST>,\<$.CASE>>
$CASEUPDATE \<$.CNST>
IFL $.CNST,<PRINTX ? CASE nesting underflow>
$.CNST==$.CNST-1
$CASEINITIAL \<$.CNST>
REMARK>
DEFINE WHILE<REMARK>
DEFINE UNTIL<REMARK>
DEFINE FOR<REMARK>
SUBTTL DEFINITIONS -- Structure Macros -- Temporary Labels
;DEFINE TEMPORARY LABELS. THEY EXIST ONLY BETWEEN BEGIN AND END.
DEFINE $TEMPORARY (M,D)<
..R..==0
..E..==0
..F..==0
..T..==0
..C..==0
$.IF==0
$.THN==0
$.END==0
$.ORG==0 ;;ORIGIN OF LABEL
$.LAB==0 ;;MAX. LABEL SPECIFIED
$.CASE==0 ;;CASE STATEMENT
$.NST==-1 ;;NESTING DEPTH
$.INST==-1 ;;IF NESTING DEPTH
$.CNST==-1 ;;[215] CASE NESTING DEPTH
.XCREF ..R..,$.ORG,$.LAB,$.NST
DEFINE $TEMP(N)<
DEFINE $'N'%<
$LABEL %,\<$.NST>,\<$.ORG+N>
IFG N-$.LAB&17,<$.LAB==$.LAB&<-1_4>+N>
>
;;DO NOT ADD CRLF'S TO THIS MACRO, OR IT WON'T WORK
DEFINE $'N<$REFERENCE %,\<$.NST>,\<$.ORG+N>>
>
DEFINE $NEST (N)<
$.ORG'N==0
$.END'N==0
$.BEG'N==0
$.IF'N==0
$.THN'N==0
$.CAS'N==0 ;;[215]
>
ZZ==0
REPEAT M,<
ZZ==ZZ+1
$TEMP \ZZ
>
ZZ==0
REPEAT D,<
$NEST \ZZ
ZZ==ZZ+1
>
PURGE ZZ
DEFINE $INITIAL (N)<
$.ORG==$.ORG'N
$.END==$.END'N
$.BEG'N==.
>
DEFINE $REINIT (N)<
$.ORG==$.ORG'N
$.END==$.END'N
>
DEFINE $UPDATE (N)<
$.ORG'N==$.ORG'N+$.LAB&17
IFN ..E..&7,<
$.END'N==$.END'N+1
>>
DEFINE $IFINITIAL (N)<
$.IF==$.IF'N
$.THN==$.THN'N
>
DEFINE $IFUPDATE (N)<
$.IF'N==$.IF'N+1
>
DEFINE $THNUPDATE (N)<
$.THN'N==$.THN'N+1
>
DEFINE $CASEINITIAL (N)<
$.CASE==$.CAS'N
>
DEFINE $CASEUPDATE (N)<
$.CAS'N==$.CAS'N+1
>
DEFINE $LABEL (J,K,L)<
IF1,<PURGE J'K'L>;;BUG IN MACRO 50
J'K'L:!
>
DEFINE $REFERENCE (J,K,L)<J'K'L>
>
DEFINE $B,<$BEG \<$.NST>>
DEFINE $BEG (N)<$.BEG'N>
DEFINE $E,<$REFERENCE E,\<$.NST>,\<$.END+1>
..E..==..E..!1
>
DEFINE $F,<$REFERENCE F,\<$.INST>,\<$.IF+1>
..F..==..F..!1
>
DEFINE $T,<$REFERENCE T,\<$.INST>,\<$.THN+1>
..T..==..T..!1
>
;DO NOT ADD CRLF'S TO THIS MACRO, OR IT WON'T WORK
DEFINE $C,<$REFERENCE C,\<$.CNST>,\<$.CASE+1>>
;NOW GENERATE THEM MAX = 10 FOR NOW
RADIX 10
$TEMPORARY (10,10)
RADIX 8