groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] www.tmac -- .MPIMG enhancement


From: Ralph Corderoy
Subject: Re: [Groff] www.tmac -- .MPIMG enhancement
Date: Thu, 17 Jul 2003 22:36:40 +0100

Hi Heinz,

> > > Would
> > >
> > >     .\" MPIMG [-R|-L] [-G gap] filename [width] [height]
> > >
> > > be more consistent?
> 
> I like this one more too.  The reason for asking was more or less
> getting a hint of argument handling of the macros. I took a while to
> see that one of '-R' or '-L' is mandatory, not optional like the
> comment:  
> .MPIMG [-R|-L]  ....
> suggests when using the [...] syntax.

If that's the case, then, given the limitations of the syntax we're
using perhaps

    Usage: .MPIMG justification [-G gap] image [width [height]]

    where `justification' is `-L' or `-R', `image' is a file
    containing...

would be better.  Then the bracketed text *is* optional and can be
nested.  Brackets aren't normally used for grouping AFAIK so `[-L | -R]'
means one or `', `-L', or `-R'.

> Look for example at line 531 or 583, the picture is always $2, the
> second macro argument. That means, deciding that
>
> -R | -L      is  $1
> -G gap       is  $2 and $3

If we've coped without `-G gap' until now, I don't see why it should be
mandatory.

> image        is  $4
>  - and really optional
> width        is  $5
> height       is  $6
> 
> implementing '-G gap' is than simple and straight forward Do you all
> agree ?

It does make implementation simpler to have `-G gap' mandatory, but we
only have to implement this once but use it often.  Can the macro test
$2 to see if it's -G and decide how to interpret the rest of the
arguments based on that?

Or should we just

    while $1 starts with a `-'
        if $1 is -L then
            justify = -L
        else if $1 is -R then
            justify = -R
        else if $1 is -G then
            if $2 doesn't exist then error.
            gap = $2
            `shift'
        else
            error `unknown option'
        endif
        `shift'

    image = $1
    if $2 exists then
        width = $2
        if $3 exists then height = $3

Cheers,


Ralph.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]