[Info-vax] RECALL command
Arne Vajhøj
arne at vajhoej.dk
Thu Jun 22 21:05:26 EDT 2023
On 6/22/2023 2:06 PM, Jim wrote:
> On Thursday, June 22, 2023 at 1:47:37 PM UTC-4, Chris Townley wrote:
>> On 22/06/2023 18:35, Chris Townley wrote:
>>> Just being playing with a routine to squirrel away the command buffer on
>>> logout, which be quite useful after a system maintenance session.
>>>
>>> However when run in a command procedure, it just doesn't produce anything.
>>>
>>> Is this normal?
>>>
>>> BTW on E9.2-1
>>>
>> Just checked on AXP V8.4-2L1 and that is the same. Using the /output
>> qualifier.
>>
>> I could understand it not being available with other than the output
>> qualifier, or perhaps /ERASE, but seems a bit off!
>
> RECALL demands that the caller be at procedure depth 0 (the DCL prompt).
> Execution within a command procedure has a procedure depth of 1 (or
> more if a command procedure call another, etc). See
>
> $ write sys$output f$environment("depth")
DCL may not be cooperative.
But the data is there, so if one is willing to wander
into unsupported territory, then ...
This code seems to accidental work on VMS Alpha 8.4:
.title sys2
PRC_C_CMDBUFSIZ=4097
.psect $PDATA quad,pic,con,lcl,shr,noexe,nowrt
;
buf1: .blkb PRC_C_CMDBUFSIZ ; first copy of recall-buffer
buf2: .blkb PRC_C_CMDBUFSIZ ; second copy of recall-buffer
.psect $CODE quad,pic,con,lcl,shr,exe,nowrt
;***************************************
;
; SYS2_RECALL ( CMDSTR , CMDLEN , NCMD )
;
; recall commands
;
;***************************************
.entry sys2_recall,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
movl B^4(ap),r11
cvtwl (r11),r8 ; r8 = string length
movl B^4(r11),r11 ; r11 = string address
movl B^8(ap),r10 ; r10 = length address
movl #0,r9 ; r9 = count
movl #CTL$AG_CLIDATA,r0
movl W^PPD$L_PRC(r0),r0
movl W^PRC_L_RECALLPTR(r0),r7
moval W^PRC_G_COMMANDS(r0),r0
subl2 r0,r7
moval buf1,r1
movc3 #PRC_C_CMDBUFSIZ,(r0),(r1)
moval buf1,r1
moval buf2,r2
movc3 #PRC_C_CMDBUFSIZ,(r1),(r2)
moval buf2,r6
addl2 r6,r7 ; r7 = pointer in buf2
subl3 #PRC_C_CMDBUFSIZ,r7,r6 ; r6 = start in buf1
100$: subl2 #2,r7 ; move back to trailing length
cmpl r7,r6 ; if past start in buf1 done
blss 200$
tstw (r7) ; if zero length done
bleq 200$
cvtwl (r7),(r10) ; save length
subl2 (r10),r7
movc3 (r10),(r7),(r11) ; save string
addl2 #4,r10 ; increment length address
addl2 r8,r11 ; increment string address
incl r9 ; increment count
subl2 #4,r7 ; skip 4 bytes (new in later
VMS versions??)
brb 100$
200$: movl r9, at B^12(ap) ; save count
ret
.end
Test program:
program rdump
implicit none
integer*4 MAX_CMD
parameter (MAX_CMD=200)
character*256 cmd(MAX_CMD)
integer*4 lcmd(MAX_CMD), ncmd, i
call sys2_recall(cmd, lcmd, ncmd)
do 100 i = 1,ncmd
write(*,*) '|'//cmd(i)(1:lcmd(i))//'|'
100 continue
end
Arne
More information about the Info-vax
mailing list