Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-11 - decus/20-192/helper.mac
There are 58 other files named helper.mac in the archive. Click here to see a list.
;<IMPORTS.COLUMBIA.MACRO>HELPER.MAC.20, 21-Feb-84 13:20:00, Edit by FORDYCE
;[drf-3] Corrected some problems with using HELPRF as an entry point so
;         that if user program uses HELPRF as the HELPER entry point, then
;         he can better handle the cases when he wants to use his own
;         '[no...' message
;<IMPORTS.COLUMBIA.MACRO>HELPER.MAC.15,  7-Apr-83 21:29:53, Edit by FORDYCE
;[drf-2] Add second entry point HELPRF to allow caller the versatility of 
;         specifying whether or not he wants the '[no help...]' message
;         output or not
;        Add HLPWRN to indicate the above at entry, and at end (before
;         returning to the caller) to indicate whether or not help was
;         output successfully
;           hrroi t2,[asciz/..../]
;           seto t3,     ; go ahead and output '[no help...]' msg if need be
;             or
;           setz t3,     ; don't output '[no help...]' msg
;           call helprF	 ; new entry point
;           		 ; at this point (ac3) = -1 ==> (no) help output ok
;                        ;               (ac3) =  0 ==> no help output
;
;<IMPORTS.COLUMBIA.MACRO>HELPER.MAC.14, 22-Mar-83 13:52:15, Edit by FORDYCE
;[drf-1] Add GJ%IFG to GTJFN call in case some users have HLP: defined as
;          something like <HELP*>
;        Zero out left half of ac1 as returned on ok GTJFN call to get
;          rid of flags returned by GTJFN

	title Helper -- Help file printer

	search CUsym
	%setenv

	entry	helper, helprf		; What we're known as


; Helper
;
; Types the desired help file at the job's controlling
; terminal.  Actually, it will type any 7-bit ASCII file,
; but the error messages all refer to help files.
;
; Input:
;
;   t2/ 7-bit byte pointer to ASCIZ filespec.
;
; Effects:
;   If the specified file is found and accessible
;     then it is typed, otherwise an appropriate
;     error message is typed.
;
; Returns +1 always.
;
; Calling sequence:
;
;	search	CUsym
;	extern	helper
;	  :
;	%setup
;	  :
;	move	t2, [point 7, [asciz\HLP:FILE.HLP\]]
;	call	helper
;	  :
;
;			 	F. da Cruz, CUCCA, 8-Feb-78
;				C. Ryland	   1-Jun-78

; Get a JFN for the file and open it.

helprF: saveac <t1,t2>		;[drf-2] Save our work ac's
	stkvar <hlpjfn>		;[drf-2] Local for help file jfn
	setom hlpwrn		;[drf-2] Assume out '[no help...]' msg
	skipn t3		;[drf-2] unless otherwise instructed
	 setzm hlpwrn		;[drf-2] So instructed
	jrst helpr2		;[drf-2] Continue normally
helper:	saveac <t1,t2>		; Save our work ac's
	stkvar <hlpjfn>		; Local for help file jfn
	setom hlpwrn		;[drf-3] assume output '[no ...' message
helpr2:	setom hlpjfn		; Don't have one yet [drf-2]
	movx t1, gj%sht!gj%old!gj%ifg	; Short form, old file [drf-1]
	push p,t2		;[drf-2]
	hrli t2,440700		;[drf-2] Save original bp
	movem t2,hlpbp		;[drf-2]
	pop p,t2		;[drf-2]
	GTJFN			; Get help file jfn
	 erjmp nohelp		; Exit on error
	hrrzm t1, hlpjfn	; Save the jfn
	hrrz t1,t1		;[drf-1] get rid of flags that GTJFN returns
	movx t2, fld(7,of%bsz)!of%rd ; 7-bit bytes, read only
	OPENF			; Open help file
	 erjmp nohelp		; Again, exit on error
	setom hlpwrn		;[drf-2] Indicate something output to terminal

; Type the file at the terminal, a byte at a time.

hlplup: move t1, hlpjfn		; Load the jfn
	BIN			; Get a byte
	 erjmp hlpeof		; On error, go find cause
	movei	t1, (t2)	; Copy the byte
	PBOUT			;  and type it
	 %jserr (,hlpend)	; Allow for unlikely error
	jrst	hlplup		;  and loop for more

; Get here when a BIN error has occurred.

hlpeof:	move t1, hlpjfn		; Load jfn
	GTSTS			;  and get the status of the file
	 %jserr (,hlpend)	;  taking care of errors...
	txnn t2, gs%eof		; Was it an end of file?
	 %ermsg <error reading help file>, hlpend ; no, tell them and leave
	move t1, hlpjfn		; Yes, it was eof, so
	CLOSF			;  close the file,
	 jfcl			;  ignoring errors
	setom hlpjfn		; Empty the jfn, since it's gone
				;  and fall through to...
	move t3,hlpwrn		;[drf-2] Put saved value in ac3

; Get here to finish up in all cases, always returning to caller.

hlpend:	move t1, hlpjfn		; Get the help jfn
	camn t1, [-1]		; Empty?
	 ret			; Yes, all finished
	RLJFN			; No, try to relinquish it
	 erjmp r		; Just ignore failure
	ret			; All done

; Get here if there was a GTJFN or OPENF error.

nohelp:	move 3,hlpwrn		;[drf-3]
	move t1,hlpbp		;[drf-2]
	ildb t2,t1		;[drf-2]
	cain t2,40		;[drf-2] If a space, then ok
         setz t3,		;[drf-2] Indicate to caller no help output
	skipn hlpwrn		;[drf-2]
	 jrst hlpend		;[drf-2]
	%typecr < [help is not currently available]>
	jrst hlpend		; Tell 'er and clean up

hlpwrn:	block 1			;[drf-2]
hlpbp:	block 1			;[drf-2]

	end



; Local modes:
; Comment Start:; 
; Comment Rounding: +1
; Mode: Midas
; End: