Updated: 2022/Sep/29

Please read Privacy Policy. It's for your privacy.


PROP_NUMBER(3)             Library Functions Manual             PROP_NUMBER(3)

NAME
     prop_number, prop_number_create_signed, prop_number_create_unsigned,
     prop_number_copy, prop_number_size, prop_number_unsigned,
     prop_number_signed_value, prop_number_unsigned_value,
     prop_number_schar_value, prop_number_short_value, prop_number_int_value,
     prop_number_long_value, prop_number_longlong_value,
     prop_number_intptr_value, prop_number_int8_value,
     prop_number_int16_value, prop_number_int32_value,
     prop_number_int64_value, prop_number_uchar_value,
     prop_number_ushort_value, prop_number_uint_value,
     prop_number_ulong_value, prop_number_ulonglong_value,
     prop_number_uintptr_value, prop_number_uint8_value,
     prop_number_uint16_value, prop_number_uint32_value,
     prop_number_uint64_value, prop_number_equals, prop_number_equals_signed,
     prop_number_equals_unsigned - numeric value property object

LIBRARY
     Property Container Object Library (libprop, -lprop)

SYNOPSIS
     #include <prop/proplib.h>

     prop_number_t
     prop_number_create_signed(intmax_t val);

     prop_number_t
     prop_number_create_unsigned(uintmax_t val);

     prop_number_t
     prop_number_copy(prop_number_t number);

     int
     prop_number_size(prop_number_t number);

     bool
     prop_number_unsigned(prop_number_t number);

     intmax_t
     prop_number_signed_value(prop_number_t number);

     uintmax_t
     prop_number_usigned_value(prop_number_t number);

     bool
     prop_number_schar_value(prop_number_t number, signed char *valp);

     bool
     prop_number_short_value(prop_number_t number, short *valp);

     bool
     prop_number_int_value(prop_number_t number, int *valp);

     bool
     prop_number_long_value(prop_number_t number, long *valp);

     bool
     prop_number_longlong_value(prop_number_t number, long long *valp);

     bool
     prop_number_intptr_value(prop_number_t number, intptr_t *valp);

     bool
     prop_number_int8_value(prop_number_t number, int8_t *valp);

     bool
     prop_number_int16_value(prop_number_t number, int16_t *valp);

     bool
     prop_number_int32_value(prop_number_t number, int32_t *valp);

     bool
     prop_number_int64_value(prop_number_t number, int64_t *valp);

     bool
     prop_number_uchar_value(prop_number_t number, unsigned char *valp);

     bool
     prop_number_ushort_value(prop_number_t number, unsigned short *valp);

     bool
     prop_number_uint_value(prop_number_t number, unsigned int *valp);

     bool
     prop_number_ulong_value(prop_number_t number, unsigned long *valp);

     bool
     prop_number_ulonglong_value(prop_number_t number,
         unsigned long long *valp);

     bool
     prop_number_uintptr_value(prop_number_t number, uintptr_t *valp);

     bool
     prop_number_uint8_value(prop_number_t number, uint8_t *valp);

     bool
     prop_number_uint16_value(prop_number_t number, uint16_t *valp);

     bool
     prop_number_uint32_value(prop_number_t number, uint32_t *valp);

     bool
     prop_number_uint64_value(prop_number_t number, uint64_t *valp);

     bool
     prop_number_equals(prop_number_t num1, prop_number_t num2);

     bool
     prop_number_equals_signed(prop_number_t number, intmax_t val);

     bool
     prop_number_equals_unsigned(prop_number_t number, uintmax_t val);

DESCRIPTION
     The prop_number family of functions operate on a numeric value property
     object type.  Values are either signed or unsigned, and promoted to the
     maximum size integer type (intmax_t or uintmax_t, respectively).

     It is possible to compare number objects that differ in sign.  Such
     comparisons first test to see if each object is within the valid number
     range of the other:

        Signed numbers that are greater than or equal to 0 can be compared to
         unsigned numbers.

        Unsigned numbers that are less than or equal to the largest signed
         integer value (INTMAX_MAX) can be compared to signed numbers.

     Number objects have a different externalized representation depending on
     their sign:

        Signed numbers are externalized in base-10 (decimal).

        Unsigned numbers are externalized in base-16 (hexadecimal).

     When numbers are internalized, the sign of the resulting number object
     (and thus its valid range) is determined by a set of rules evaluated in
     the following order:

        If the first character of the number is a `-' then the number is
         signed.

        If the first two characters of the number are `0x' then the number is
         unsigned.

        If the number value fits into the range of a signed number then the
         number is signed.

        In all other cases, the number is unsigned.

     prop_number_create_signed(intmax_t val)
            Create a numeric value object with the signed value val.  Returns
            NULL on failure.

     prop_number_create_unsigned(uintmax_t val)
            Create a numeric value object with the unsigned value val.
            Returns NULL on failure.

     prop_number_copy(prop_number_t number)
            Copy a numeric value object.  If the supplied object isn't a
            numeric value, NULL is returned.

     prop_number_size(prop_number_t number)
            Returns 8, 16, 32, or 64, representing the number of bits required
            to hold the value of the object.  If the supplied object isn't a
            numeric value, 0 is returned.

     prop_number_unsigned(prop_number_t number)
            Returns true if the numeric value object has an unsigned value.

     prop_number_signed_value(prop_number_t number)
            Returns the signed value of the numeric value object.  If the
            supplied object isn't a numeric value, zero is returned.  Thus, it
            is not possible to distinguish between "not a prop_number_t" and
            "prop_number_t has a value of 0".

     prop_number_unsigned_value(prop_number_t number)
            Returns the unsigned value of the numeric value object.  If the
            supplied object isn't a numeric value, zero is returned.  Thus, it
            is not possible to distinguish between "not a prop_number_t" and
            "prop_number_t has a value of 0".

     prop_number_schar_value(prop_number_t number, signed char *valp)

     prop_number_short_value(prop_number_t number, short *valp)

     prop_number_int_value(prop_number_t number, int *valp)

     prop_number_long_value(prop_number_t number, long *valp)

     prop_number_longlong_value(prop_number_t number, long long *valp)

     prop_number_intptr_value(prop_number_t number, intptr_t *valp)

     prop_number_int8_value(prop_number_t number, int8_t *valp)

     prop_number_int16_value(prop_number_t number, int16_t *valp)

     prop_number_int32_value(prop_number_t number, int32_t *valp)

     prop_number_int64_value(prop_number_t number, int64_t *valp)

     prop_number_uchar_value(prop_number_t number, unsigned char *valp)

     prop_number_ushort_value(prop_number_t number, unsigned short *valp)

     prop_number_uint_value(prop_number_t number, unsigned int *valp)

     prop_number_ulong_value(prop_number_t number, unsigned long *valp)

     prop_number_ulonglong_value(prop_number_t number, unsigned long long
            *valp)

     prop_number_uintptr_value(prop_number_t number, uintptr_t *valp)

     prop_number_uint8_value(prop_number_t number, uint8_t *valp)

     prop_number_uint16_value(prop_number_t number, uint16_t *valp)

     prop_number_uint32_value(prop_number_t number, uint32_t *valp)

     prop_number_uint64_value(prop_number_t number, uint64_t *valp)
            These functions extract the numeric value as the specified type
            and store it in valp.  The value is bounds-checked against the
            minimum and maximum values of the type.  If the value can be
            represented in the specified type, these functions return true.
            Otherwise, they return false.

     prop_number_equals(prop_number_t num1, prop_number_t num2)
            Returns true if the two numeric value objects are equivalent.  If
            at least one of the supplied objects isn't a numeric value, false
            is returned.

     prop_number_equals_signed(prop_number_t number, intmax_t val)
            Returns true if the object's value is equivalent to the signed
            value val.  If the supplied object isn't a numerical value, false
            is returned.

     prop_number_equals_unsigned(prop_number_t number, uintmax_t val)
            Returns true if the object's value is equivalent to the unsigned
            value val.  If the supplied object isn't a numerical value, false
            is returned.

SEE ALSO
     prop_array(3), prop_bool(3), prop_data(3), prop_dictionary(3),
     prop_object(3), prop_string(3), proplib(3)

HISTORY
     The proplib(3) property container object library first appeared in
     NetBSD 4.0.

NetBSD 10.99                     June 2, 2020                     NetBSD 10.99