[Info-vax] Very simple DCL question
Arne Vajhøj
arne at vajhoej.dk
Wed Dec 28 21:08:12 EST 2022
On 12/28/2022 3:39 PM, Arne Vajhøj wrote:
> On 12/28/2022 3:07 PM, Craig A. Berry wrote:
>>>> On 28/12/2022 16:45, Arne Vajhøj wrote:
>>>>> $ type z.com
>>>>> $ write sys$output "''p1'"
>>>>> $ @z a
>>>>> A
>>>>> $ @z "a"
>>>>> a
>>>>>
>>>>> This is not really surprising.
>>>>>
>>>>> But are there any way to preserve pn case without
>>>>> double-quoting it?
>>>>>
>>>>> Like this hypothetical syntax:
>>>>>
>>>>> $ set proc/parse=(extended,pnkeepcase)
>
>> Case sensitivity doesn't really have anything to do with case
>> preservation. I don't know of any way to do what Arne wants here except
>> to avoid DCL. Write a C program (or use something written in C, such as
>> Perl or Python, instead of DCL) and set extended parse in the process
>> and DECC$ARGV_PARSE_STYLE in the environment before running the C
>> program.
>
> :-(
>
> But thanks.
I will use the double quotes.
But just for fun:
$ type zz.com
$ write sys$output "''p1' ''p2' ''p3'"
$ run realp
$ write sys$output "''p1' ''p2' ''p3'"
$ @zz aaaa BBBB CcCc
AAAA BBBB CCCC
aaaa BBBB CcCc
But there is a gazillion things that can go wrong with that
realp.
Code below.
Arne
.title realp
$SSDEF
$DSCDEF
.macro if_end_command,lbl
cmpl r3,r4
bgeq lbl
.endm
.macro if_space,lbl
cmpb (r3),#32
beql lbl
.endm
.psect $LOCAL quad,pic,con,lcl,noshr,noexe,wrt
cmdlen: .blkw 1
cmdbuf: .blkb 256
pnam: .ascid "P1"
pval: .blkw 1
.byte DSC$K_DTYPE_T
.byte DSC$K_CLASS_S
.address pvala
pvala: .blkb 256
.psect $CODE quad,pic,con,lcl,shr,exe,nowrt
.entry realp,^m<r2,r3,r4,r5>
; grab copy of command line
movl #CTL$AG_CLIDATA,r0
movl W^PPD$L_PRC(r0),r0
movl W^PRC_L_RECALLPTR(r0),r0 ; r0 = next command
subl2 #2,r0
cvtwl (r0),r1 ; r1 = length current command
subl2 r1,r0 ; r0 = current command
movw r1,cmdlen ; copy of length of command line
movc3 r1,(r0),cmdbuf ; copy of command line
movab cmdbuf,r3 ; r3 = current character on
command line
cvtwl cmdlen,r1
addl3 r1,r3,r4 ; r4 = end of command line
; skip command itself
100$: if_end_command done
if_space start
incl r3 ; move to next character
brb 100$
; process parameters
start: incl r3 ; r3 = start first argument
movl #1,r2 ; r2 = n = 1
200$: if_end_command done
movw #0,pval ; reset parameter data
movab pvala,r5 ; r5 = where to copy parameter data
300$: if_end_command 500$
if_space 400$
incw pval ; add to pval/pvala
movb (r3),(r5)
incl r3
incl r5
brb 300$
400$: incl r3 ; skip space between parameters
500$: pushl #0
pushab pval
pushab pnam
calls #3,G^LIB$SET_SYMBOL
incb pnam+9 ; Pn -> Pn+1
incl r2 ; n = n + 1
cmpl r2,#8 ; while n <= 8
bleq 200$
done: movl #SS$_NORMAL,r0
ret
.end realp
More information about the Info-vax
mailing list