Google
 

Trailing-Edge - PDP-10 Archives - CFS_TSU04_19910205_1of1 - update/cblsrc/line.mac
There are 17 other files named line.mac in the archive. Click here to see a list.
; UPD ID= 1603 on 5/15/84 at 9:39 AM by HOFFMAN                         
TITLE	LINE FOR LIBOL

	SEARCH COPYRT
	SALL

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

COPYRIGHT (C) 1974, 1983, 1984 BY DIGITAL EQUIPMENT CORPORATION

	SEARCH	FTDEFS		;GET FILE TABLE DEFINITIONS

;V13*******
;JSM	29-FEB-84	[1125] Set flag RPTW.
;**********
;**; EDIT 404 FIX SO THAT PH STARTS AT HEADING. ALSO FIX CALL TO LINE.5 FORM LINE.6
;**; EDIT 331 LINE SPACING FIX AFTER FORCED PAGING
;**; EDIT 325 PRINTED LINE 1> THAN LINE COUNT
;	 PAGE COUNT 1 TOO HIGH
;	ALSO FIXES THE CODE  REPLACES EDIT 303 FOR REPORT CODE.


	HISEG
	.COPYRIGHT		;Put standard copyright statement in REL file

;THIS ROUTINE GETS THE REPORT PAGE TO THE APPROPRIATE LINE, IN PREP-
;ERATION FOR PUTTING OUT A DETAIL, CONTROL, REPORT OR PAGE LINE.

;IF WE ARE ALREADY AT THE CORRECT LINE, NO ACTION IS TAKEN. OTHERWISE,
;THE DESIRED LINE IS CHECKED TO SEE IF IT IS WITHIN THE APPROPRIATE
;LIMITS (FIRST-DETAIL THRU LAST-DETAIL FOR DETAIL LINES, FIRST-DETAIL
;THRU LAST-FOOTING FOR CONTROL LINES). IF NOT, OR IF THE DESIRED LINE IS
;LESS THAN THE CURRENT LINE, PAGE FOOTING/HEADINGS ARE WRITTEN.

;CALLING SEQUENCE:
;	MOVEI 15,<DESIRED LINE NUMBER>
;	MOVEI 16,<ADDRESS OF REPORT TABLE>
;	PUSHJ 17,LINE.C/LINE.D/LINE.H

EXTERNAL UOCAL.,KILL.,RET.2,WRPW.
EXTERNAL RPTW.				;[1125]

ENTRY LINE.C	;FOR CONTROL LINES
ENTRY LINE.D	;FOR DETAIL LINES
ENTRY LINE.H	;FOR PAGE HEADING/FOOTING LINES
ENTRY LIN.RH	;TEST TO SEE IF REPORT IS INITIATED
ENTRY INIT.	;'INITIATE'
ENTRY TERM.	;'TERMINATE'

;ACCUMULATORS:
	PP=17	;PUSH-DOWN POINTER
	PA=16	;ADDRESS OF REPORT TABLE
	DL=15	;DESIRED LINE NUMBER
	LA=14	;ADDRESS OF CURRENT LINE NUMBER
	TA=13	;TEMPORARY
	TB=11	;TEMPORARY
	TC=10	;TEMPORARY
	TD=7	;TEMPORARY

;UUO CODE FOR 'WADV.'

WADV.==002200
;FORMAT OF REPORT TABLE:
;	(1)	PAGE-LIMIT, CURRENT-LINE ADDRESS
;	(2)	FIRST-DETAIL LINE, LAST-DETAIL LINE
;	(3)	FOOTING LIMIT, REPORT-HEADING ROUTINE
;	(4)	PAGE-HEADING ROUTINE, PAGE-FOOTING ROUTINE
; [404]	(5)	ADDRESS OF ASSOCIATED FILE TABLE,HEADING
;	(6)	SIZE OF CODE, ADDRESS OF CODE

	PAGLIM==0
	CURLIN==0
	FIRSTD==1
	LASTD==1
	FOOT==2
	REPORT==2
	PAGEH==3
	PAGEF==3
	FILTAB==4
	HEADNG==4		; [404] LOCATION OF HEADING
	CODER==5
;[325]	AFTER CODER DEFINITION
	CD.MASC==40		;RECORD USAGE IS DISPLAY-7.
	CD.EBC==20		;RECORD USAGE IS DISPLAY-9.
	HIGBIT==400000		; [420] START ON FIRST DETAIL.
;ENTRY FOR A DETAIL LINE

LINE.D:	SKIPA	TA,LASTD(PA)	;PICK UP LAST-DETAIL LIMIT

;ENTRY FOR CONTROL LINE

LINE.C:	MOVS	TA,FOOT(PA)	;PICK UP CONTROL-FOOTING LIMIT

	MOVE	LA,CURLIN(PA)	;PICK UP ADDRESS OF CURRENT LINE COUNT
	SKIPLE	TB,(LA)		; [420] IS START FIRST LINE ON?
	JRST	LINEC1		; [420] NO BEYOND FIRST LINE; NORMAL PROCESSING
	MOVSI	TB,HIGBIT	; [420] TURN OFF NO START
	ANDCAM	TB,0(LA)	; [420] IN REAL LINE NUMBER
	TLZE	DL,HIGBIT	; [420] AND IN DESIRED LINE TOO; FIRST LINE?
	HLRZ	DL,FIRSTD(PA)	; [420] FIRST DE LINE WITH NO HEADERS AND WITH LINE PLUS
				; [420] START AT FIRST DETAIL
LINEC1:	CAMN	DL,0(LA)	;ARE WE AT DESIRED LINE?
	POPJ	PP,		;YES--SIMPLY RETURN

	MOVE	TB,(PP)		;SET ERROR LOCATION FOR
	MOVEM	TB,UOCAL.	;  'KILL.'


	HLRZ	TB,PAGLIM(PA)	;IF THERE IS NO PAGE LIMIT,
	JUMPE	TB,LINE.0	;  DON'T TEST FOR LIMIT
	CAILE	DL,0(TA)	;ARE WE PAST THE LIMIT LINE?
	JRST	LINE.2		;YES

LINE.0:	CAML	DL,0(LA)	;IS DESIRED LINE BEFORE CURRENT ONE?
	JRST	LINE.1		;NO
	PUSH	PP,DL		;YES--SAVE DESIRED LINE NUMBER
	PUSHJ	PP,LINE.6	;PUT OUT PAGE FOOTING/HEADING
	POP	PP,DL		;RESTORE DESIRED LINE NUMBER
	CAMLE	DL,0(LA)	;IF DESIRED LINE IS AFTER CURRENT ONE,
	JRST	LINE.3		;  GO DO SOME MORE
	POPJ	PP,		;  OTHERWISE WE ARE DONE


LINE.1:	JUMPE	TB,LINE.3	;IF NO PAGE-LIMIT, NO TEST
	HLRZ	TA,FIRSTD(PA)	;ARE WE BEFORE THE FIRST DETAIL LINE?
	CAIGE	DL,(TA)
	MOVEI	DL,(TA)		;YES--PRETEND WE WANT FIRST DETAIL
	JRST	LINE.3		;NO

LINE.2:	SUB	DL,0(LA)	; [331] GET DIFFERENCE BETWEEN DL AND REAL LINE
	PUSH	PP,DL		; [331] SAVE DIFFERENCE
	SETZ	DL,		; [420] START AT TOP OF NEW LINE
				;  (THIS HERE IN CASE NO HEADING OR FOOTING)
	PUSHJ	PP,LINE.6	;PUT OUT PAGE FOOTING/HEADING
	POP	PP,TA		; [331] GET BACK SAVED SPACING DIFFERENCE
	HLRZ	DL,FIRSTD(PA)	;PRETEND WE WANT FIRST-DETAIL LINE
	PUSHJ	PP,PHDR		; [420] SEE IF REAL PAGE HEADER
	JRST	LINE.3		; [331] YES WANT FIRST DE
	HRRZ	TB,(LA)		; [420] NO USE FIRST DETAIL
	ADD	TB,TA		; [420] ADD BACK DIFFERENCE
	CAMG	DL,TB		; [420] USE LARGER OF NEW LINE OR FIRST DE
	MOVE	DL,TB		; [420] NEW LINE LARGER USE IT.
	JRST	LINE.3		; [331] NOW WE GOT CORRECT SPACING

;ENTRY FOR 'PAGE' AND 'REPORT' HEADING/FOOTING LINES

LINE.H:	MOVE	TB,(PP)		;SET ERROR LOCATION FOR
	MOVEM	TB,UOCAL.	;  'KILL.'
	MOVE	LA,CURLIN(PA)	;PICK UP ADDRESS OF CURRENT LINE

LINE.3:	CAMN	DL,0(LA)	;ARE WE AT DESIRED LINE?
	POPJ	PP,		;YES--RETURN

	CAMG	DL,0(LA)	;ARE WE BEFORE DESIRED LINE?
	JRST	LINE.5		;NO

	MOVE	TA,0(LA)	;YES--STASH NEW
LINE.4:	MOVEM	DL,0(LA)	;  VALUE AND
	SUB	DL,TA		;  COMPUTE DIFFERENCE

LINE.7:	HRLI	DL,120		;SET 'BEFORE' AND 'LINE-FEED' CODES
	JRST	LINE.W		;WRITE LINE AND RETURN
;WE ARE ALREADY AFTER THE DESIRED LINE

LINE.5:	PUSH	PP,DL		;SAVE
	PUSH	PP,PA		;  IMPORTANT AC'S

	MOVE	DL,[XWD 121,1]	;SET 'BEFORE' AND 'FORM-FEED'
	PUSHJ	PP,LINE.W	;WRITE OUT A FORM-FEED

	POP	PP,PA		;RESTORE
	HRRZ	LA,0(PA)	;  THE
	HRRZ	DL,(PP)		;  AC'S

	MOVEI	TD,1		; [325] START AT 1.
	MOVEM	TD,(LA)		; [325] FOR LINE NO.

	CAILE	DL,1		;IF WE WANTED LINE 1, QUIT
	PUSHJ	PP,LINE.3	; [325]  ELSE ADVANCE THE FORM
	POP	PP,DL		;RESTORE AC
	POPJ	PP,

;PUT OUT PAGE FOOTING/HEADING

LINE.6:	PUSH	PP,PA		;SAVE RPWTAB POINTER
	PUSH	PP,DL		; [420] SAVE DESIRED LINE
	HRRZ	TA,PAGEF(PA)	;EXECUTE ANY
	PUSHJ	PP,LINE.R	;  PAGE-FOOTING ROUTINE
	POP	PP,DL		; [420] RESTORE DESIRED LINE ON NEXT PAGE
	MOVE	PA,(PP)		;RESTORE PA
	PUSHJ	PP,PHDR		; [420] SEE IF REAL OR NOT DEFINED PAGE HDR
	PUSHJ	PP,LINE.5	;IF THE LATTER, PUT OUT A FORM FEED
	MOVE	PA,(PP)		;RESTORE PA
	HLRZ	TA,PAGEH(PA)	;EXECUTE ANY
	PUSHJ	PP,LINE.R	;  PAGE-HEADING ROUTINE
	POP	PP,PA		;RESTORE THE
	HRRZ	LA,CURLIN(PA)	;  ACCUMULATORS
	POPJ	PP,

PHDR:	HLRZ	TC,PAGEH(PA)	; [420] GET ADDR OF PAGE HEADING ROUTINE
	HLRZ	TC,1(TC)	; [420] USER-DEFINED PAGE HEADING OR
	CAIE	TC,(JRST)	; [420]  JUST "AOS PAGE-COUNTER- JRST GI"?
	AOS	(PP)		; [420] REAL PAGE HEADER - SKIP RETURN.
	POPJ	PP,		; [420]
;CALL THE 'WADV.' ROUTINE

LINE.W:	MOVE	TB,CODER(PA)	;GET SIZE AND ADDRESS OF CODE
	HLRZ	TC,TB		;GET SIZE OF CODE
	DPB	TC,[POINT 12,DL,11];STASH IN PARAMETER

	HLRZ	PA,FILTAB(PA)	;GET FILTAB ADDRESS
	HRLI	PA,WADV.+1B18	;SET 'WADV.' UUO CODE
	SOS	(PP)		;DEFEAT THE SKIP RETURN FROM WADV

	JUMPE	TC,LINW2	;[1125] IF NO CODE, SET RPTW FLAG AND TO WADV 

	MOVE	TA,F.WFLG(PA)	;GET RECORD ADDRESS AND FLAGS
	MOVEI	TD,(POINT 6,0)	;ASSUME RECORD IS SIXBIT
	TLNE	TA,CD.MASC	; [325] IS IT REALLY SIXBIT?
	MOVEI	TD,(POINT 7,0)	;NO--IT IS ASCII
	HRLI	TA,(TD)		;MAKE 'TA' BE A BYTE-POINTER

	HRLI	TB,(POINT 6,0)	;CODE IS SIXBIT

LINW1:	ILDB	TD,TB		;GET CODE CHARACTER
	TLNE	TA,100		;IS RECORD ASCII?
	ADDI	TD,40		;YES--CONVERT BYTE TO ASCII
	TLNE	TA,1000
	LDB	TD,RPC.79##
	IDPB	TD,TA		;STASH IT IN RECORD
	SOJG	TC,LINW1	;LOOP

LINW2:				;[1125]
	SETOM	RPTW.##		;[1125] SET FLAG TO SHOW CALL FROM LINE.x RTN
	JRST	WRPW.		;GO TO 'WADV'
;PUT OUT REPORT HEADING & PAGE HEADING IF NECESSARY
;IF NOT, SKIP RETURN

LIN.RH:	MOVE	LA,CURLIN(PA)	;GET ADDRESS OF CURRENT LINE
	SKIPLE	TA,0(LA)	;IS LINE-COUNT POSITIVE?
	JRST	RET.2		;YES--QUIT

	HRRZ	TB,-1(PP)	;SET ADDRESS FOR
	MOVEM	TB,UOCAL.	;  ANY ERROR

	CAMN	TA,[EXP -1]	;IF LINE-COUNT IS -1 -- ERROR.
	JRST	LINRHE
	TDNE	TA,[XWD	377777,-1]
	JRST	RET.2

	MOVEI	TD,1		; [325] RESET TO 1
	MOVEM	TD,0(LA)	; [325] THE LINE NUMBER
	HLRZ	TD,PAGEH(PA)	;GET ADDRESS OF PAGE-HEADER ROUTINE
	SKIPE	@(TD)		;IF PAGE NUMBER IS ALREADY ZERO LEAVE IT
	SOS	@(TD)		;ELSE REDUCE SINCE WE WILL ADVANCE IT NEXT

	PUSH	PP,PA		;SAVE 'PA'

;IF A TERMINATE HAS ALREADY BEEN DONE, PUT A FORM FEED OUT TO
; SEPARATE THE TWO REPORTS.
	HLRZ	PA,FILTAB(PA)	;GET ADDRESS OF FILTAB
	LDB	TA,[F%BRPT]	;CHECK FLAG TO SEE IF
	JUMPE	TA,LIN.R0	; A 'TERMINATE' WAS DONE
	MOVE	DL,[XWD 121,1]	;YES, PUT OUT
	MOVE	PA,(PP)		;LINE.W NEEDS ORIGINAL PA
	PUSHJ	PP,LINE.W	; FORM-FEED

LIN.R0:	MOVE	PA,(PP)		;FETCH PA AGAIN
	HRRZ	TA,REPORT(PA)	;EXECUTE ANY
	JUMPN	TA,LIN.R1	; [420] IF ANY DON'T SET START
	PUSHJ	PP,PHDR		; [420] SEE IF ANY USER DEFINED PAGE HEADER
	TRNA			; [420] GO TO SET START
	JRST	LIN.R1		; [420] PAGE HEADER LINE STARTING OKAY
	MOVSI	TD,HIGBIT	; [420] SET START SO THAT FIRST
				; [420]  DETAIL LINE WILL START ON FIRST DETAIL
	ADDM	TD,(LA)		; [420] ADD IN START BIT
LIN.R1:	PUSHJ	PP,LINE.R	; [420] REPORT-HEADING ROUTINE
	POP	PP,PA		;RESTORE PA AGAIN
	HLRZ	TA,PAGEH(PA)	;EXECUTE ANY PAGE-HEADING ROUTINE

;PUT OUT A HEADING/FOOTING ROUTINE IF NECESSARY

LINE.R:	JUMPN	TA,(TA)
	POPJ	PP,
SUBTTL 'INITIATE' AND 'TERMINATE' ROUTINES

;'INITIATE'

INIT.:	MOVE	LA,0(PA)	;PICK UP ADDRESS OF LINE-COUNTER
	SKIPL	0(LA)		;IS IT NEGATIVE?
	JRST	INIT.E		;NO--ERROR

	SETZM	0(LA)		;YES--SET IT TO ZERO
	POPJ	PP,

;'TERMINATE'

TERM.:	MOVE	LA,0(PA)	;PICK UP ADDRESS OF LINE-COUNTER
	SKIPGE	LA,(LA)		;IF IT ISN'T -1
	CAME	LA,[EXP -1]
	 CAIA			;OK
	 JRST	LINRHE		;ERROR

;SET BIT SAYING THAT THE REPORT HAS BEEN TERMINATED. THEN
; IF ANOTHER INITIATE IS DONE, A FORM FEED WILL BE PUT OUT
; TO SEPARATE THE TWO REPORTS.
	HLRZ	PA,FILTAB(PA)	;ADDRESS OF FILTAB
	SETO	TA,		;GET A 1 BIT
	DPB	TA,[F%BRPT]	;SET IT
	POPJ	PP,		; RETURN-- ALL IS WELL


;ERROR--REPORT IS NOT INITIATED

LINRHE:	PUSHJ	PP,REP.ER		;PRINT REPORT [NAME]
	OUTSTR	[ASCIZ 'is not initiated']
	JRST	KILL.

INIT.E:	PUSHJ	PP,REP.ER		;PRINT REPORT [NAME]
	OUTSTR	[ASCIZ 'is already initiated']
	JRST	KILL.

REP.ER:	OUTSTR	[ASCIZ 'Report [']
	HLRZ	TA,FILTAB(PA)		;GET ADDRESS OF FILTAB
	HRLI	TA,(POINT 6,)		;FORM BYTE POINTER
	MOVEI	TB,^D30			;MAX. LENGTH OF NAME
REP.E1:	ILDB	TC,TA
	JUMPE	TC,REP.E2		;ALL DONE
	ADDI	TC," "			;MAKE ASCII
	OUTCHR	TC
	SOJG	TB,REP.E1
REP.E2:	OUTSTR	[ASCIZ '] ']
	POPJ	PP,

	END