info-vax (12/24/82)
>From EPS@MIT-MC Fri Dec 24 07:22:27 1982
Mail-From: ARPANET host MIT-MC rcvd at 24-Dec-82 0443-PST
To: Info-VAX@SRI-CSL
Remailed-Date: 24 Dec 1982 0457-PST
Remailed-From: the tty of Geoffrey S. Goodfellow <Geoff5 at SRI-CSL>
Remailed-To: Info-VAX@SRI-CSL: ;
Whilst you are busy trying to cons up foreign terminal packages, you
might be interested in this: a plug-compatible SCRFT call tracer. All
it does is display the calls and their arguments, but it might be
useful for debugging an application that uses the terminal-independent
screen procedures (or just to satisfy the curious--like why SYSGEN
does illegal SCR$ calls).
Question: Have any of you written a SCRFT that works fine with
everything but MONITOR? I have and it's driving me bananas!
Observation: Installing SCRFT /OPEN/SHARE is ok, but /HEADER is asking
for trouble.
-=EPS=-
-------
.title scrftdbg fake SCRFT that traces calls
;;; Eric P. Scott, Caltech/Jet Propulsion Laboratory, December 1982
$dscdef
.default displacement,word
.psect scrftdbg,nowrt,exe,shr,pic,long
BUFSIZ=256
.entry scrftdbg,^m<r10,r11>
cmpb (ap),#7 ; Make sure called via LIB$CALL_IMAGE
blssu 10$
movab -512(sp),sp ; make an output buffer
movl 28(ap),r0 ; pick up SCRFT argument list
movq 4(r0),r10
pushab (sp)
pushl r10 ; SCR$ argument list
pushl r11 ; function #
calls #3,outfun
subl2 sp,r0 ; output line
pushab (sp)
addl3 r0,#<dsc$k_dtype_t@16>!<dsc$k_class_s@24>,-(sp)
pushaq (sp)
calls #1,g^lib$put_output
blbc r0,9$
cmpb r11,#1 ; test if GET_SCREEN
bneq 9$
callg (r10),g^lib$get_input
9$: ret
10$: movzwl #^x114,r0 ; SS$_INSFARG
ret
.entry outfun,^m<r2,r3,r4,r5,r10,r11>
movl 12(ap),r3 ; buffer pointer
movl #^a/SCR$/,(r3)+
movzbl 4(ap),r11 ; function #
cmpb r11,#10 ; something we know about?
blequ 202$
movb #^a/?/,(r3)+ ; oh well
brb 203$
202$: movaw ntbl,r0 ; move function name into buffer
cvtwl (r0)[r11],r11
addl2 r0,r11
movzbl (r11)+,r10
movc3 r10,(r11),(r3)
203$: movb #^a/(/,(r3)+ ; parenthesize argument list
pushl r3
pushl 8(ap)
pushl 4(ap)
calls #3,outarg
movb #^a/)/,(r0)+
ret
.entry outarg,^m<r2,r3,r4,r5,r7,r8,r9,r10,r11>
movl 8(ap),r11 ; SCR$ argument list
movl 12(ap),r3 ; buffer pointer
movzbl (r11),r10 ; # of SCR$ arguments
beql 310$
moval 4(r11),r9 ; pointer to each item
cmpb 4(ap),#1 ; special hack for GET_SCREEN
beql 311$
303$: movl (r9)+,r8 ; get next item
cmpl r8,#132 ; if <=132 assume it's a cursor address
blequ 306$
prober #0,#8,(r8) ; could be a pointer to a descriptor
beql 306$ ; nothing I can read
movl r8,r0
jsb g^str$analyze_sdesc_r1
movl r0,r7
beql 305$ ; null string
prober #0,r7,(r1)
beql 306$ ; bleah
movl r1,r8 ; r7,r8 = count,address
305$: movab as,r1
brb 307$
306$: movab ul,r1 ; display as unsigned decimal
307$: movab -BUFSIZ(sp),sp ; make buffer for $FAO
pushab (sp) ; and a descriptor to it
pushl #BUFSIZ!<dsc$k_dtype_t@16>!<dsc$k_class_s@24>
movzbl (r1)+,r0 ; push descriptor to control string
movq r0,-(sp)
movq r7,-(sp)
pushaq 16(sp)
pushaw 20(sp)
pushaq 16(sp)
calls #5,@#sys$fao
movc3 8(sp),16(sp),(r3) ; move to output buffer
movab <BUFSIZ+8+8>(sp),sp ; clean stack
decl r10 ; any more arguments?
beql 310$
movb #^a/,/,(r3)+ ; yes, output comma
brb 303$ ; back for more
310$: movl r3,r0 ; return updated buffer pointer
ret
311$: movl (r9)+,r8
movab xl,r1 ; always display first argument in hex
brb 307$
f0: .ascic /PUT_SCREEN/
f1: .ascic /GET_SCREEN/
f2: .ascic /ERASE_PAGE/
f3: .ascic /ERASE_LINE/
f4: .ascic /SET_CURSOR/
f5: .ascic /DOWN_SCROLL/
f6: .ascic /SCREEN_INFO/
f7: .ascic /PUT_LINE/
f8: .ascic /MOVE_CURSOR/
f9: .ascic /SET_SCROLL/
f10: .ascic /UP_SCROLL/
.align word
ntbl: .word f0-ntbl
.word f1-ntbl
.word f2-ntbl
.word f3-ntbl
.word f4-ntbl
.word f5-ntbl
.word f6-ntbl
.word f7-ntbl
.word f8-ntbl
.word f9-ntbl
.word f10-ntbl
as: .ascic /'!AF'/
ul: .ascic /!+!UL/
xl: .ascic /!+!XL/
.end scrftdbg