[Info-vax] Local Versus Global Command Options

Arne Vajhøj arne at vajhoej.dk
Thu Feb 13 21:37:04 EST 2025


On 2/13/2025 8:06 PM, Arne Vajhøj wrote:
> On 2/13/2025 5:52 PM, Lawrence D'Oliveiro wrote:
>> What would DCL-style syntax for ffmpeg look like? I suppose one
>> obvious equivalence would be
>>
>>      ffmpeg -
>>          «infile-1»/«local-input-options-1»,«infile-2»/«local-input- 
>> options-2»,... -
>>          «outfile-1»/«local-output-options-1»,«outfile-2»/«local- 
>> output-options-2»,... -
>>
>> (being very careful about where the commas go), but what about the
>> syntax for filtergraphs? Would it be something like
>>
>>      /vf=(«filter-name-1»=«filter-params-1»,«filter-name-2»=«filter- 
>> params-2»...)
>>
>> Does DCL have provision for this sort of complexity?
> 
> You can do quite a bit with CDU, CLD and CLI$:
> 
> $ type fun.cld
> define verb fun
>      image "sys$disk:[]fun"
>      parameter p1, value(type=$file)
>      parameter p2, value(type=$file)
>      parameter p3, value(type=$file)
>      parameter p4, value(type=$file)
>      parameter p5, value(type=$file)
>      parameter p6, value(type=$file)
>      parameter p7, value(type=$file)
>      parameter p8, value(type=$file)
> qualifier q1, placement=local
> qualifier q2, value(type=a_and_b, list, required), placement=local
> define type a_and_b
>      keyword a, value(type=$number, required)
>      keyword b, value(type=$number, required)
> $ type fun.pas
> [inherit('sys$library:pascal$cli_routines')]
> program fun(input,output);
> 
> type
>     pstr = varying [255] of char;
> 
> procedure check(pn : pstr);
> 
> var
>     fnm, a, b : pstr;
> 
> begin
>     if odd(cli$present(pn)) then begin
>        cli$get_value(pn, fnm.body, fnm.length);
>        write(pn, '=', fnm);
>        if odd(cli$present('Q1')) then begin
>           write(' Q1=present')
>        end else begin
>           write(' Q1=notpresent')
>        end;
>        if odd(cli$present('Q2')) then begin
>           cli$get_value('Q2.A', a.body, a.length);
>           write(' A=', a);
>           cli$get_value('Q2.B', b.body, b.length);
>           write(' B=', b);
>        end;
>        writeln;
>     end;
> end;
> 
> begin
>     check('P1');
>     check('P2');
>     check('P3');
>     check('P4');
>     check('P5');
>     check('P6');
>     check('P7');
>     check('P8');
> end.
> $ pas fun
> $ lin fun
> $ set comm fun
> $ fun x.dat /q2=(a:1,b:2) y.dat /q1 /q2=(a:3,b:4) z.dat /q2=(a:5,b:6)
> P1=x.dat Q1=notpresent A=1 B=2
> P2=y.dat Q1=present A=3 B=4
> P3=z.dat Q1=notpresent A=5 B=6

Or with a P1 list:

$ type fun2.cld
define verb fun2
     image "sys$disk:[]fun2"
     parameter p1, value(type=$file, list, required)
qualifier q1, placement=local
qualifier q2, value(type=a_and_b, list, required), placement=local
define type a_and_b
     keyword a, value(type=$number, required)
     keyword b, value(type=$number, required)
$ type fun2.pas
[inherit('sys$library:pascal$cli_routines')]
program fun2(input,output);

type
    pstr = varying [255] of char;

var
    fnm, a, b : pstr;

begin
    while odd(cli$get_value('P1', fnm.body, fnm.length)) do begin
       write(fnm);
       if odd(cli$present('Q1')) then begin
          write(' Q1=present')
       end else begin
          write(' Q1=notpresent')
       end;
       if odd(cli$present('Q2')) then begin
          cli$get_value('Q2.A', a.body, a.length);
          write(' A=', a);
          cli$get_value('Q2.B', b.body, b.length);
          write(' B=', b);
       end;
       writeln;
    end;
end.
$ pas fun2
$ lin fun2
$ set comm fun2
$ fun2 x.dat/q2=(a:1,b:2), y.dat/q1/q2=(a:3,b:4), z.dat/q2=(a:5,b:6)
x.dat Q1=notpresent A=1 B=2
y.dat Q1=present A=3 B=4
z.dat Q1=notpresent A=5 B=6

Arne



More information about the Info-vax mailing list