Google
 

Trailing-Edge - PDP-10 Archives - LCG_Integration_Tools_Clearinghouse_T20_v7_30Apr86 - tools/sed2/bldsedhlp.mar
There are 5 other files named bldsedhlp.mar in the archive. Click here to see a list.
.TITLE	BLDSEDHLP - Program to build the on-line help file for SED

.ENABLE DEBUG
.DISABLE GLOBAL
$RMSDEF

	.PSECT	DATA,WRT,NOEXE
BUFFER:	.BLKB	1536		;Output buffer
INBUFF:	.BLKB	128		;Input buffer
BUFFPTR:.BLKL	1		;Pointer into the output buffer
FILFLG:	.BLKL	1		;-1=data in buffer, 0=buffer empty
INPUT_FAB:	$FAB	FNM=<SEDONL.TXT>,FAC=GET,FOP=SQO
OUTPUT_FAB:	$FAB	FNM=<SEDONL.HLP>,FAC=<BIO,PUT>,FOP=MXV,-
			ORG=SEQ,RFM=FIX,MRS=1536
INPUT_RAB:	$RAB	FAB=INPUT_FAB,RAC=SEQ,UBF=INBUFF,USZ=128
OUTPUT_RAB:	$RAB	FAB=OUTPUT_FAB,RAC=SEQ,RBF=BUFFER,RSZ=1536

	.PSECT	CODE,NOWRT,EXE
START:	.WORD	0		;Entry mask
	BSBW	WRTREC		;Initialize the pointer
	$OPEN	FAB=INPUT_FAB	;Open the input file
	BLBS	R0,10$
	RET
10$:	$CREATE	FAB=OUTPUT_FAB	;Open the output file
	BLBS	R0,20$
	RET
20$:	$CONNECT RAB=INPUT_RAB	;Connect to the record blocks
	BLBS	R0,30$
	RET
30$:	$CONNECT RAB=OUTPUT_RAB
	BLBS	R0,COPY_LOOP
	RET

COPY_LOOP:
	$GET	RAB=INPUT_RAB	;Get a record
	BLBS	R0,WRITE	;Success?
	CMPL	R0,#RMS$_EOF	;Was the error end of file?
	BEQL	EOF		;Yes
	RET			;Otherwise it's fatal

EOF:	BSBW	WRTREC		;Output the last record if necessary
	$DISCONNECT RAB=INPUT_RAB
	$DISCONNECT RAB=OUTPUT_RAB
	$CLOSE	FAB=INPUT_FAB
	$CLOSE	FAB=OUTPUT_FAB
	RET

WRITE:	CMPB	#^O14,INBUFF	;Is the character a form feed?
	BNEQ	10$		;No
	BSBW	WRTREC		;Yes - dump the previous record to disk
	BRW	COPY_LOOP	;and go get some more
10$:	MOVC3	INPUT_RAB+RAB$W_RSZ,INBUFF,@BUFFPTR ;Copy the record for output
	MOVZWL	INPUT_RAB+RAB$W_RSZ,R1 ;Get the length
	ADDL	R1,BUFFPTR	;Increment the buffer pointer
	MOVW	#^X0A0D,@BUFFPTR ;End the line with CRLF
	ADDL	#2,BUFFPTR	;Account for the CRLF
	CVTBL	#-1,FILFLG	;Indicate data is in the buffer
	BRW	COPY_LOOP	;Go get another record

WRTREC:	TSTL	FILFLG		;Anything in the buffer?
	BEQL	20$		;No
	$WRITE	RAB=OUTPUT_RAB	;Yes - write the record
	BLBS	R0,10$		;Any errors?
	RET			;Yes
10$:	MOVC5	#0,BUFFER,#0,#1536,BUFFER ;Clear the buffer
20$:	CLRL	FILFLG		;Buffer is empty
	MOVAB	BUFFER,BUFFPTR	;Point to the buffer
	RSB			;and return

	.END	START