Trailing-Edge
-
PDP-10 Archives
-
decuslib10-05
-
43,50337/10/d1.mac
There is 1 other file named d1.mac in the archive. Click here to see a list.
SEARCH SIMMAC,SIMMC1
CTITLE D1
SUBTTL WRITTEN BY OLOF BJ@RNER/ENEA JUN -73
COMMENT ;
AUTHOR: OLOF BJ@RNER
VERSION: 13
PURPOSES: THIS MODULE CONTAINS CERTAIN GLOBAL TABLES
USED IN PASS 1
CONTENTS: THE FOLLOWING TABLES:
- YI1SWT TABLE WITH SWITCH NAMES
- YI1SRT JUMP TABLE TO SWITCH ROUTINES
- YI1SWA ACCESS TABLE TO YI1SWT
- YI1ERT TABLE WITH ERRORS
- YI1ERA ACCESS TABLE TO YI1ERT
- TABLES CONTAING RESERVED WORDS
;
TWOSEG
RELOC 400000
SALL
MACINIT
INTERN YI1SWT,YI1SWA,YI1SWL,IZSE1,IZSE2,IZSE3,IZHT
INTERN YI1SRT,YI1ERT,YI1ERA
SUBTTL LOCAL DECLARATIONS
; LOCAL MACRO
; ===========
COMMENT ;
THE MACRO YI1TAB CREATES THREE TABLES, YI1SRT, YI1SWT AND YI1SWA.
YI1SRT IS A JUMP TABLE THAT IS USED TO ROUTE THE FLOW
TO THE APPROPRIATE SWITCH-ROUTINE.
YI1SWT CONTAINS THE LONG FORMS (EXCEPT THE FIRST LETTER)
OF ALL COMPILER SWITCHES PACKED TOGETHER IN CONSECUTIVE WORDS.
YI1SWA IS AN ACCESS TABLE FOR YI1SWT.
EACH ENTRY IS A WORD WHERE THE LEFT
HALFWORD CONTAINS THE SHORT ONE-LETTER FORM OF THE SWITCH
AND THE RIGHT HALFWORD CONTAINS THE BYTE INDEX TO THE
START OF THE LONG FORM IN YI1SWT. YI1TAB ALSO DEFINES
THE CONSTANT YI1SWL WHICH CONTAINS THE LENGTH OF YI1SWA.
;
DEFINE YI1TAB=<
DEFINE X(A)=<
$$SWL=0 ;;NO OF LETTERS IN SWITCH NAME
IRPC A,<
$$SWL=$$SWL+1
IFE <$$SWL-1>,<
TINQ ("A") ;;IF FIRST CHARACTER SAVE IT IN QUEUE
IFN <"A"-"@">,<
EXTERN I1SRT'A
GOTO I1SRT'A ;;ENTRY IN ROUTINE TABLE
>
>
IFN <$$SWL-1>,<
$$ENTR=$$ENTR+"A"B<$$BIT>
$$BIT=$$BIT+7
IFG <$$BIT-^D34>,<
JINQ $$ENTR ;;IF FULL WORD ENTER IT INTO QUEUE J
$$JNO=$$JNO+1 ;;COUNT ENTRIES IN QUEUE J
$$BIT=6
$$ENTR=0
>
>
>;; END OF IRPC
TINQ ($$IND) ;;SAVE BYTE INDEX
$$IND=$$IND+$$SWL-1
$$SWNO=$$SWNO+1
>;;END OF X
GETQUE (T) ;;GET A QUEUE FOR YI1SWA
GETQUE (J) ;;GET A QUEUE FOR YI1SWT
$$SWNO=0 ;;NO OF SWITCH NAMES
$$IND=0 ;;BYTE INDEX TO YI1SWT
$$ENTR=0 ;;ENTRY IN YI1SWT
$$BIT=6 ;;BIT POSITION
$$JNO=0 ;;NO OF ENTRIES IN QUEUE J
;; NOW USE X
YI1SRT: ;;SWITCH ROUTINE TABLE
X ARRAY
X CREF
X DEBUGS
X EXTERNAL
X HELP
X IDENTIFICATION
X LIST
X NOERR
X PAGE
X QUALIFICATION
X RUNSWITCHES
X SEARCH ;;[13]
X WARNING
X Y
$$BIT=^D34 ;;INSERT DUMMY CHARACTER
X @
;; SET UP ACCESS TABLE
$$TMP1=<$$TMP2=0>
YI1SWA: ;;ACCESS TABLE
REPEAT $$SWNO,<
TOUTQ ($$TMP1) ;;GET SHORT FORM
TOUTQ ($$TMP2) ;;GET BYTE INDEX
XWD $$TMP1,$$TMP2
>
YI1SWT: ;;CHARACTER TABLE
REPEAT $$JNO,<
JOUTQ ($$TMP1) ;;GET ENTRY IN YI1SWT
EXP $$TMP1
>
YI1SWL:: EXP -$$SWNO
PURGE $$IND,$$TMP1,$$TMP2,$$SWL,$$SWNO,$$JNO,$$ENTR,$$BIT
>;END OF MACRO YI1TAB
COMMENT ;
THE MACRO YI1ERR CREATES TWO TABLES, YI1ERT WITH ERROR
MESSAGES TO BE PRINTED DURING PASS 1 ON THE USER'S TTY AND
YI1ERAC WHICH IS AN ACCESS TABLE TO YI1ERT. EACH ELEMENT IN YI1ERAC
IS A WORD WITH THE FOLLOWING FORMAT:
BITS NAME MEANING
==== ==== =======
0 YI1TTY SWITCH: ON IF MESSAGE TO TTY
1 YI1P3 SWITCH: ON IF MESSAGE TO PASS 3
2 YI1AST SWITCH: ON IF MESSAGE CONTAINS REPLACEMENT WORD
3-17 YI1ERN ERROR NUMBER. ARGUMENT TO ERR AND ERRT
18-26 YI1STR INDEX TO START OF MESSAGE IN YI1ERT
27-35 YI1EMP INDEX TO REPLACEMENT WORD IN MESSAGE
YI1ERR DEFINES THE NAMES ABOVE. THE CONSTANTS QI1En, WHERE n IS AN
ERROR NUMBER, ARE ALSO DEFINED.
;
DEFINE YI1ERR=<
DEFINE X(A,B1,C,D)=<
$$SW=0 ;;SWITCH, IF NOT 0 THEN * ALREADY
;;ENCOUNTERED
$$TAB=0 ;;ELEMENT IN YI1ERAC
IFNB <B1>,<
$$TAB=$$TAB+1B1+<$$ERR>B17
>
IFNB <A>,<
$$SCR=$$IND
$$TAB=$$TAB+<$$IND>B26+1B0
$$EXP=0 ;;ELEMENT IN YI1ERT
$$NO=0 ;;NO OF WORDS IN SWITCH
$$BIT=6 ;;BYTE POINTER TO $$EXP
IRPC C,<
IFE <"C"-"*">,<
IFN $$SW,<
$$E(<MORE THAN ONE ASTERISK IN I1-MESSAGE>)
>
IFE $$SW,<
$$SW=1 ;;FLAG ASTERISK ENCOUNTERED
$$TAB=$$TAB+1B2
$$LOOP=<^D34-$$BIT>/7+1
IFN <$$LOOP-5>,<
REPEAT $$LOOP,<
$$EXP=$$EXP+" "B<$$BIT> ;;PAD WITH SPACES
$$BIT=$$BIT+7
>
EXP $$EXP
$$EXP=0
$$NO=$$NO+1
$$BIT=6
>
EXP 0 ;;EMPTY WORD FOR ASTERISK
$$TAB=$$TAB+$$NO+$$SCR
$$NO=$$NO+1
>
> ;;END OF IF *
IFN <"C"-"*">,<
$$EXP=$$EXP+"C"B<$$BIT>
$$BIT=$$BIT+7 ;;UPDATE BYTE POINTER
IFG <$$BIT-^D34>,<
$$NO=$$NO+1
EXP $$EXP
$$BIT=6
$$EXP=0
>
> ;;END OF IF NOT *
> ;;END OF IRPC
EXP $$EXP ;;SET UP LAST WORD
$$IND=$$IND+$$NO+1
> ;;END IF IFNB
$$LEN=$$LEN+1
TINQ ($$TAB) ;;SAVE YI1ERA-ELEMENT
YI1E'D:: $$LEN-1
$$IND=$$IND+1
$$ERR=$$ERR+1
> ;; END OF MACRO X
$$ERR=Q1I1.W
$$LEN=0 ;;LENGTH OF YI1ERAC
$$IND=0 ;;INDEX TO YI1ERT
; NOW USE X TO GENERATE YI1ERT:
YI1ERT:
X(TTY,P3,<MINUS NOT VALID BEFORE * . MINUS IGNORED.>,1)
X(TTY,P3,<COLON AFTER * NOT SUCCEEDED BY QUOTE. TEXT CONSTANT IGNORED.>,2)
X(TTY,P3,<FINAL QUOTE IN TEXT CONSTANT MISSING. QUOTE ASSUMED.>,3)
X(TTY,,<COLON AFTER * NOT ALLOWED IN COMMAND. CONSTANT IGNORED.>,4)
X(,P3,<HELP NOT VALID IN OPTION STATEMENT. IGNORED.>,5)
X(TTY,P3,<NUMBER BEFORE * NOT VALID. NUMBER IGNORED.>,6)
X(TTY,P3,<UNRECOGNIZABLE SWITCH * . SWITCH IGNORED>,7)
X(TTY,P3,<MISSPELLED SWITCH: * . FIRST LETTER USED.>,8)
X(TTY,P3,<SWITCH * NOT VALID AFTER PROGRAM START. SWITCH IGNORED.>,9)
X(TTY,P3,<NUMBER NOT VALID WITH MINUS IN * . NUMBER IGNORED.>,10)
X(TTY,P3,<EXTERNAL SWITCH ALREADY SPECIFIED. IGNORED.>,11)
X(TTY,P3,<KEYWORD (NO)CHECK EXPECTED AFTER CODE IN EXTERNAL LIST. LIST IGNORED.>,12)
X(TTY,P3,<INCOMPLETE EXTERNAL LIST>,13)
X(TTY,P3,<KEYWORD FORTRAN, F40 OR CODE EXPECTED AFTER : IN EXTERNAL. LIST IGNORED.>,14)
X(TTY,P3,<COLON AFTER -E NOT ALLOWED. LIST IGNORED.>,15)
X(TTY,P3,<TEXT CONSTANT AFTER -R NOT ALLOWED. TEXT CONSTANT IGNORED.>,16)
X(TTY,P3,<?INVALID DEVICE. ONLY DSK ALLOWED>,17)
X(TTY,P3,<?COMMA MISSING IN PPN>,18)
X(TTY,P3,<?RIGHT SQUARE BRACKET MISSING IN PPN>,19)
X(TTY,P3,<?MORE THAN 6 DIGITS IN PPN>,20)
;;NOTE!!
;;NEW MESSAGES MUST BE INSERTED AFTER THE LAST MESSAGE!!
; NOW CREATE THE ACCESS TABLE:
YI1ERA:
REPEAT $$LEN,<
TOUTQ $$EXP
EXP $$EXP
>
PURGE $$SW,$$ERR,$$TAB,$$NO,$$IND
PURGE $$EXP,$$BIT,$$LOOP,$$LEN,$$SCR
DEFINE X=<>
DEFINE YI1ERR=<>
PURGE X,YI1ERR
> ;;END OF YI1ERR
COMMENT ;
THE FOLLOWING SET OF MACROS WILL CREATE THE TABLES
ZHT, ZSE1, ZSE2 AND ZSE3.
;
DEFINE RESW$(A1,A2,A3,A4)=<
SY=SY+1
RX=0
RY1=0
RY2=0
;; MAKE RY1 AND RY2 CONTAIN RESWORD IN SIXBIT LEFT JUSTIFIED:
IRPC A1,<
RX=RX+1
IFLE <RX-6>,<
RY1=<RY1>B29+''A1''
>
IFG <RX-6>,<
RY2=<RY2>B29+''A1''
>
>;;END OF IRP
REPEAT <6-RX>,<
RY1=<RY1>B29
>
IFG <RX-6>,<
REPEAT <14-RX>,<
RY2=<RY2>B29
>
>
;; HASH RESERVED WORD
B1=QHASHM&7777
B2=<QHASHM_-14>&7777
B3=QHASHM_-30
C1=RY1&7777
C2=<RY1_-14>&7777
C3=RY1_-30
Q1=<<<<B1*C1>_-14>+C2*B1+C1*B2>_-14>+C3*B1+C2*B2+C1*B3
HASH=<<Q1_-13>+<B3*C2+B2*C3+B1*7777>_1>&177
;; LINK RESERVED WORD
RXX(\SY,RY1,RY2,\HASH)
> ;END OF RESW$
DEFINE RXX(A1,A2,A3,A4)=<
ZS1'A1=A2
ZS2'A1=A3
ZS3'A1=0
IFN ZHT'A4,<
RXXX(A1,\<ZHT'A4+QNRESW-QLOWID>)
>
IFE ZHT'A4,<
ZHT'A4=A1+QLOWID-QNRESW
>
>;END OF RXX
DEFINE RXXX(A1,A2)=<
IFG <ZS1'A1-ZS1'A2>,<
IFN <ZS3'A2&7777000000>,<
RXXX(A1,\<ZS3'A2/1000000+QNRESW-QLOWID>)
>
IFE <ZS3'A2&7777000000>,<
ZS3'A2=ZS3'A2+<A1+QLOWID-QNRESW>B17
>
>
IFL <ZS1'A1-ZS1'A2>,<
IFN <ZS3'A2&7777>,<
RXXX(A1,\<ZS3'A2&7777+QNRESW-QLOWID>)
>
IFE <ZS3'A2&7777>,<
ZS3'A2=ZS3'A2+A1+QLOWID-QNRESW
>
>
>;END OF RXXX
DEFINE RY(N)=<
IZSE'N:
RX=-1
REPEAT QNRESW+QNSYSID,<
RX=RX+1
$$C(ZS'N,\RX)
>
>; END OF RY
; END OF LOCAL MACRO DEFINITIONS
; ------------------------------
SUBTTL CONSTANTS AND TABLES
; [13] Standard search list for external classes and procedures
EXP YSRCL-YI1SRC ;number of words in table
YI1SRC::EXP QEXLIB ;Library name
XWD 0,0 ;ppn
EXP QEXDEV ;Device
EXP 0,0,0 ;For patching - not used while 1st word = 0
EXP QEXLIB,0,SIXBIT/DSK/
YSRCL=. ;[13] End of table - Note that list is searched backwards!
; NOW SET UP TABLES FOR SWITCH PROCESSING AND ERROR MESSAGES:
YI1TAB
YI1ERR
RX=-1
REPEAT 200,<
RX=RX+1
$$C(ZHT,\RX)=0
>
SY=-1
RESWORD ;SET UP TABLES WITH RESERVED WORDS
SYSID
IZHT:
RX=-1
REPEAT 200,<
RX=RX+1
$$C(ZHT,\RX)
>
RY(1) ;CREATE ZSE1
RY(2) ;CREATE ZSE2
RY(3) ;CREATE ZSE3
XPUNGE
END