Trailing-Edge
-
PDP-10 Archives
-
LCG_Integration_Tools_Clearinghouse_T20_v7_30Apr86
-
tools/phone20/hlpr20.mac
There are 3 other files named hlpr20.mac in the archive. Click here to see a list.
; CHECK FOR OUT OF DATE INDEX??
; APPEND INDEX TO END OF FILE??
; CHECK FOR INVALID INDEX??
; CEHCK FOR INVAILD ORIGIN
TITLE HLPR20 -- HIERARCHICAL HELP FACILITY FOR TOPS-20
SUBTTL PHIL BUDNE@DEC, FEBRUARY 22, 1984
; GENERALIZED HELP SYSTEM FOR TOPS-20:
; THIS MODULE USES THE "CMD" PACKAGE, AND ASSUMES THAT THE PARENT
; PROGRAM DOES AS WELL. HOWEVER, CMD.REL IS NOT LOADED BY US, NOR DO
; WE DEFINE THE GLOBALS (VIA CMDSTG). THIS MUST BE DONE BY THE HOST.
; THE PROGRAM "HLP" IS USED TO CREATE ".INDEX" FILES FOR US.
SEARCH MONSYM,MACSYM,CMD,HLPUNV
SALL ;MAKE PRETTIER LISTINGS
.DIRECTIVE FLBLST ;SAVE TREES
.REQUEST SYS:MACREL ;MAKE SURE MACREL GETS LOADED
ENTRY HLPFIL,HLPWLD
EXTERNAL ATMBUF
H20WHO==0 ;WHO LAST..
H20VER==1 ;MAJOR VERSION
H20MIN==0 ;MINOR VERSION (A,B...)
H20EDT==1 ;EDIT NUMBER
%%%H20==:<BYTE (3)H20WHO (9)H20VER (6)H20MIN (18)<H20EDT&377777>>
; PARAMETERS
TABLEN==^D200 ;THIS MANY TOPICS
STRLEN==^D40/5 ;MAX STRING LENGTH
BUFLEN==STRLEN/3*TABLEN ;THIS MUCH STRING SPACE
DEFHDR(600) ;DEFINE FILE HEADER AT 600K
; PARSE A WILD HELP FILE NAME
; A/ BP TO WILD FILESPEC
; CALL HLPWLD
; <ERROR>
; <OK>
HLPWLD: ACVAR <X1>
STKVAR <HLPJFN,WLDSTR>
MOVE B,A ;GET FS IN B
MOVEM B,WLDSTR ;SAVE BP TO STRING
MOVSI A,(GJ%OLD!GJ%IFG!GJ%SHT) ;OLD FILES, ALLOW STARS, SHORT FORM
GTJFN ;GET THE HANDLE
RET
MOVEM A,HLPJFN
TLNE A,(GJ%NAM) ;NOT WILD FILE?
TLNN A,(GJ%EXT!GJ%VER!GJ%DIR) ;WILD DIR, EXTENSION OR VERSION?
IFSKP. ;YES, YOU LOSE
HRRZ A,A ;GET JFN
RLJFN
TRN
RET
ENDIF.
MOVEI X1,BUFFER ;GET BUFFER ADDR
MOVEI A,TABLEN-1
MOVEM A,TABLE ;SET UP EMPTY TABLE
DO. ;LOOP...
HRROI A,(X1) ;POINTER TO AREA IN WHICH TO STORE NAME
HRRZ B,HLPJFN ;GET JFN OF HELP FILE
MOVSI C,(1B8) ;WE WANT JUST THE FILENAME
JFNS ;GET FILENAME (ENTRY FOR TABLE)
SETZ B,
IDPB B,A ;TIE OFF STRING
MOVEI D,1(A) ;GET UPDATED STRING ADDR
MOVEI A,TABLE ;TELL SYSTEM WHERE TABLE BEGINS
HRLZ B,X1 ;GET ENTRY FOR TABLE (POINTS TO FILENAME)
TBADD ;PUT NEW ENTRY IN TABLE
ERJMP ENDLP. ; SIGH.. QUIT NOW
MOVE X1,D ;GET UPDATED END OF STRING
MOVE A,HLPJFN ;GET JFN AGAIN
GNJFN ;STEP TO NEXT HELP FILE
ERJMP ENDLP. ;NO MORE IN THIS SET
LOOP.
OD. ;END OF LOOP
MOVEI A,TABLE
MOVEM A,WLDFDB+.CMDAT ;STORE DATA (TBLUK ADDR)
MOVEI A,WLDFDB
CALL RFIELD ;READ A FIELD
TSC C,C ;CHECK WHICH FDB WON
JUMPN C,BLURB ;GOT A KEY
HLRO B,(B) ;CONSTRUCT BYTE POINTER TO KEYWORD NAME
MOVE D,B ;SAVE BP
TLNE A,(CM%ESC) ;WAS KEYWORD EXPLICITLY COMPLETED?
JRST HLPCNF ;YES, SKIP CHECK
HRROI A,ATMBUF ;LOAD BYTE POINTER TO KEYWORD INPUT
STCMP ;COMPARE STRINGS
TXNE A,SC%SUB ;WAS A SUBSTRING INPUT?
RET ; YES, GIVE ERROR
HLPCNF: SKIPA B,D
BLURB: HRROI D,[ASCIZ 'HELP'] ;GET DEFAULT (** PERHAPS USER ARG? **)
; NOW BUILD SANE SPEC
MOVSI A,(GJ%IFG!GJ%OFG!GJ%SHT) ;GET NEW JFN, PARSE ONLY
MOVE B,WLDSTR ;GET STRING BUFFER
GTJFN
RET ;SO CLOSE...
MOVEM A,HLPJFN ;SAVE
HRROI A,FILBUF
MOVE B,HLPJFN ;GET WILD TEMPLATE
MOVE C,[<BYTE (3) 1,1>!JS%PAF] ;DEVICE & DIR
JFNS
MOVE B,D
SETZ C,
SOUT
MOVE B,HLPJFN
MOVE C,[<BYTE (3) 0,0,0,1>!JS%PAF] ;EXT
JFNS
SETZ B,
IDPB B,A ;TIE OFF STRING
MOVE A,HLPJFN
RLJFN
TRN
HRROI A,FILBUF
CALL HLPFIL ;GET HELP ON SANE FILESPEC
RET
CPOPJ1: AOS (P)
CPOPJ: RET
ENDAV.
ENDSV.
; ENTRY FOR HELP FROM A SPECIFIC HELP FILE
; *PARSE IN PROGRESS*
; A/ BP TO SANE FILESPEC
HLPFIL: ACVAR <SP,NP> ;STK PTR, NODE PTR
STKVAR <HLPJFN,IDXJFN,LCOUNT>
SETZM LCOUNT
MOVE B,A ;GET FS IN B
MOVSI A,(GJ%SHT!GJ%OLD) ;GET OLD FILE, SHORT FORM
GTJFN ;GET HANDLE
RET ; FAILURE!!
MOVEM A,HLPJFN
MOVE B,[FLD(7,OF%BSZ)!OF%RD]
OPENF
IFJER.
MOVE A,HLPJFN
RLJFN
TRN
RET
ENDIF.
HRROI A,BUFFER ;GET STRING BUFFER
MOVE B,HLPJFN ;GET .HLP FILE JFN
MOVE C,[<BYTE(3)1,1,1>!JS%PAF] ;DEVICE, DIR, NAME
JFNS
HRROI B,[ASCIZ '.INDEX']
SETZ C,
SOUT
SETZ B,
IDPB B,A
; TRY TO OPEN INDEX FILE
MOVSI A,(GJ%SHT!GJ%OLD) ;GET OLD FILE, SHORT FORM
HRROI B,BUFFER ;GET INDEX FILESPEC
GTJFN ;GET HANDLE
SETZ A, ; NO SUCH LUCK
MOVEM A,IDXJFN ;STORE
JUMPE A,NOINDX
MOVEI B,OF%RD ;36 BITS, READ ACCESS
OPENF ;OPEN SESAME!
JSHLT ; SIGH
SIZEF ;GET FILE SIZE IN PAGES
JSHLT ; SIGH
MOVSI A,(A) ;FILE JFN,,PAGE
MOVE B,[.FHSLF,,MAPPAG] ;FORK,,PAGE
TLO C,(PM%CNT!PM%RD) ;FLAGS,,SIZE
PMAP ;MAP IT IN
MOVE NP,$ROOT ;SET UP NODE POINTER...
MOVE SP,[IOWD TABLEN,TABLE] ;SET UP STACK
JRST KEYLOP ;GO!!
; HERE TO PROMPT FOR A TOPIC
TOPLOP: SKIPN $NDTBL(NP) ;HAVE A TABLE?
JRST POPLVL ; NO, AUTO-POP!
CALL CMDINI ;SET UP NEW PARSE
TLNE NP,-1 ;Have a topic string?
IFSKP. ;< No, just ask for a topic
;;;;; PROMPT (Topic ?)
PROMPT (Topic>)
ELSE. ;We have a topic string, use it
HRROI A,FILBUF
HLRO B,NP
SETZ C,
SOUT ;<
;;;;; HRROI B,[ASCIZ ' Sub-Topic ?']
HRROI B,[ASCIZ ' Sub-Topic>']
SOUT
HRROI A,FILBUF
CALL DPROMPT
ENDIF.
MOVEI A,WLDFDB ;GET WILD FDB
MOVE B,$NDTBL(NP) ;GET TOPIC TABLE
MOVEM B,WLDFDB+.CMDAT ;STORE
CALL RFIELD ;READ A FIELD
MOVEI C,(C) ;GET WINNER
CAIE C,CFMFDB ;CONFIRM?
JRST PSHLVL ; NO, PUSH
; HERE WHEN THE USER HAS TYPED <CR> TO POP A LEVEL
POPLVL: SOSGE LCOUNT ;ANY TOPICS LEFT?
JRST IDXDON ; NOPE..
POP SP,NP ;RESTORE NODE
ERJMP IDXDON ; NO MORE?
;;;;; JRST TYPNOD
JRST TOPLOP
PSHLVL: MOVE B,(B) ;GET NEW STR,,NODE
PUSH SP,NP ;SAVE NODE PTR
ERJMP KEYLOP ; NO MORE ROOM, STAY AS IS (**** WARN? ****)
AOS LCOUNT ;ADD A LEVEL
MOVE NP,B ;GET NEW NODE
KEYLOP: MOVEI A,CFMFDB ;ASSUME NO MORE TOPICS
SKIPN $NDTBL(NP) ;GET HELP TABLE
IFSKP.
NOISE (SUB-TOPIC)
MOVE A,$NDTBL(NP) ;GET HELP TABLE
MOVEM A,WLDFDB+.CMDAT ;STORE
MOVEI A,WLDFDB ;GET FDB
ENDIF.
CALL RFIELD ;PARSE A FIELD
HRRZ C,C ;GET WINNER
CAIN C,CFMFDB ;CONFIRM?
JRST TYPNOD ; YES, TYPE NODE
JRST PSHLVL ;PUSH NEW LEVEL
TYPNOD: MOVE A,HLPJFN ;GET FILE
MOVE B,$NDTXT(NP) ;GET TEXT POINTER
SFPTR ;SET POINTER
JSHLT ; SIGH
DO.
MOVE A,HLPJFN
HRROI B,BUFFER
MOVEI C,BUFLEN*5-1
MOVEI D,"J"-100
SIN
JUMPE C,ENDLP. ;***** LONG LINE *****
SUBI C,BUFLEN*5-1 ;GET NEG. CHARS READ
JUMPE C,ENDLP. ;END OF FILE?
MOVEI A,.PRIOU
LDB B,[POINT 7,BUFFER,6] ;GET FIRST CHAR
CAIN B,"*" ;HEADER?
EXIT. ; YES, DONE
CAIN B,"!" ;COMMENT?
LOOP. ; YES, IGNORE
MOVN C,C ;GET COUNT
HRROI B,BUFFER
SOUT
LOOP.
OD.
JRST TOPLOP
IDXDON: MOVE A,IDXJFN
SIZEF
JSHLT
SETO A,
MOVE B,[.FHSLF,,MAPPAG]
TLO C,(PM%CNT)
PMAP
MOVE A,IDXJFN
CLOSF
JSHLT
JRST HLPDON
NOINDX: NOISE (UN-INDEXED)
CONFRM
DUMP: DO.
MOVE A,HLPJFN
HRROI B,BUFFER
MOVNI C,BUFLEN*5-1
SIN
ADDI C,BUFLEN*5-1
JUMPE C,ENDLP.
MOVN C,C
MOVEI A,.PRIOU
HRROI B,BUFFER
SOUT
LOOP.
OD.
HLPDON: MOVE A,HLPJFN
CLOSF
TRN
JRST CPOPJ1
ENDSV.
ENDAV.
TABLE: BLOCK TABLEN ;BUFFER FOR HELP TABLE
BUFFER: BLOCK BUFLEN ;BUFFER FOR .HLP FILE NAMES
FILBUF: BLOCK 10 ;TEMP BUFFER FOR FILE NAMES
WLDFDB: FLDDB. .CMKEY,,0,,,CFMFDB ;DATA FILLED IN LATER
CFMFDB: FLDDB. .CMCFM
IF1, PRINTX [END OF PASS1]
JUNK: END