bug-recutils
[Top][All Lists]
Advanced

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

Re: [bug-recutils] [bug #41598] doc: Percentage_t example?


From: Jose E. Marchesi
Subject: Re: [bug-recutils] [bug #41598] doc: Percentage_t example?
Date: Mon, 17 Feb 2014 22:38:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

[Let's have the discussion in bug-recutils.  I actually plan to remove
 the savannah bug tracker from the project's features.]
    
    In the Types and Fields node, there's an example:
    
    %typedef: Percentage_t range 0 100
    
    I was under the impression that that always meant integers.  In practice,
    percentages are much more commonly real numbers.  Is it possible to have
    ranges of reals?  Anyway, it should be discussed, whatever the answer is.
    
Ranges of reals are not currently supported: a range is always an
integer.  It would be indeed nice to support ranges of values of other
types, such as dates, enumerated values or strings (lexicographic
ordered).  It could use the following backwards-compatible syntax:

    range [TYPE] [MIN_VALUE] MAX_VALUE

Where TYPE is the name of a type or a type specification.  It is
optional and defaults to 'int'.  MIN_VALUE is the minimum inclusive
value in the range.  It is optional and its default value depends on the
type of the range:

- int    => MIN_VALUE = 0
- real   => MIN_VALUE = 0.0
- date   => MIN_VALUE = unix epoch ??
- enum   => MIN_VALUE = first enumerated value
- string, line, regexp => MIN_VALUE = "" ??

MAX_VALUE is the maximum value of the given type, and must be specified
in the range declaration.

Example:

%typedef: Interrupt_t enum INT0 INT1 INT2 INT3 INT4 INT5
%typedef: Maskable_Int_t range Interrupt_t INT2 INT5
%typedef: Percentage_t range real 0 100
%typedef: NumDoors_t range int 0 4
%typedef: NumDoors_t range 0 4

What do you think?

Now, I agree that the percentage example may be misleading.  I changed
it to Interrupt_t (not the one above, but a numerical one).

 



reply via email to

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