udunits2.h   udunits2.h 
/* /*
* Copyright 2008, 2009 University Corporation for Atmospheric Research * Copyright 2008, 2009 University Corporation for Atmospheric Research
* *
* This file is part of the UDUNITS-2 package. See the file LICENSE * This file is part of the UDUNITS-2 package. See the file LICENSE
* in the top-level source-directory of the package for copying and * in the top-level source-directory of the package for copying and
* redistribution conditions. * redistribution conditions.
*/ */
#ifndef UT_UNITS_H_INCLUDED #ifndef UT_UNITS2_H_INCLUDED
#define UT_UNITS_H_INCLUDED #define UT_UNITS2_H_INCLUDED
#include <stdarg.h> #include <stdarg.h>
#include <stddef.h> #include <stddef.h>
#include "converter.h" #include "converter.h"
typedef struct ut_system ut_system; typedef struct ut_system ut_system;
typedef union ut_unit ut_unit; typedef union ut_unit ut_unit;
typedef enum { typedef enum {
skipping to change at line 227 skipping to change at line 227
* will be returned. * will be returned.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be: * NULL Failure. "ut_get_status()" will be:
* UT_BAD_ARG "system" is NULL. * UT_BAD_ARG "system" is NULL.
* else Pointer to the dimensionless-unit one associated with "syste m". * else Pointer to the dimensionless-unit one associated with "syste m".
* While not necessary, the pointer may be passed to ut_free() * While not necessary, the pointer may be passed to ut_free()
* when the unit is no longer needed by the client. * when the unit is no longer needed by the client.
*/ */
ut_unit* ut_unit*
ut_get_dimensionless_unit_one( ut_get_dimensionless_unit_one(
ut_system* const system); const ut_system* const system);
/* /*
* Returns the unit with a given name from a unit-system. Name comparisons * Returns the unit with a given name from a unit-system. Name comparisons
* are case-insensitive. * are case-insensitive.
* *
* Arguments: * Arguments:
* system Pointer to the unit-system. * system Pointer to the unit-system.
* name Pointer to the name of the unit to be returned. * name Pointer to the name of the unit to be returned.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be * NULL Failure. "ut_get_status()" will be
* UT_SUCCESS "name" doesn't map to a unit of * UT_SUCCESS "name" doesn't map to a unit of
* "system". * "system".
* UT_BAD_ARG "system" or "name" is NULL. * UT_BAD_ARG "system" or "name" is NULL.
* else Pointer to the unit of the unit-system with the given name. * else Pointer to the unit of the unit-system with the given name.
* The pointer should be passed to ut_free() when the unit is * The pointer should be passed to ut_free() when the unit is
* no longer needed. * no longer needed.
*/ */
ut_unit* ut_unit*
ut_get_unit_by_name( ut_get_unit_by_name(
ut_system* const system, const ut_system* const system,
const char* const name); const char* const name);
/* /*
* Returns the unit with a given symbol from a unit-system. Symbol * Returns the unit with a given symbol from a unit-system. Symbol
* comparisons are case-sensitive. * comparisons are case-sensitive.
* *
* Arguments: * Arguments:
* system Pointer to the unit-system. * system Pointer to the unit-system.
* symbol Pointer to the symbol associated with the unit to be * symbol Pointer to the symbol associated with the unit to be
* returned. * returned.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be * NULL Failure. "ut_get_status()" will be
* UT_SUCCESS "symbol" doesn't map to a unit of * UT_SUCCESS "symbol" doesn't map to a unit of
* "system". * "system".
* UT_BAD_ARG "system" or "symbol" is NULL. * UT_BAD_ARG "system" or "symbol" is NULL.
* else Pointer to the unit in the unit-system with the given symbol . * else Pointer to the unit in the unit-system with the given symbol .
* The pointer should be passed to ut_free() when the unit is n o * The pointer should be passed to ut_free() when the unit is n o
* longer needed. * longer needed.
*/ */
ut_unit* ut_unit*
ut_get_unit_by_symbol( ut_get_unit_by_symbol(
ut_system* const system, const ut_system* const system,
const char* const symbol); const char* const symbol);
/* /*
* Sets the "second" unit of a unit-system. This function must be called b efore * Sets the "second" unit of a unit-system. This function must be called b efore
* the first call to "ut_offset_by_time()". ut_read_xml() calls this functi on if the * the first call to "ut_offset_by_time()". ut_read_xml() calls this functi on if the
* resulting unit-system contains a unit named "second". * resulting unit-system contains a unit named "second".
* *
* Arguments: * Arguments:
* second Pointer to the "second" unit. * second Pointer to the "second" unit.
* Returns: * Returns:
* UT_BAD_ARG "second" is NULL. * UT_BAD_ARG "second" is NULL.
* UT_EXISTS The second unit of the unit-system to which "second" * UT_EXISTS The second unit of the unit-system to which "second"
* belongs is set to a different unit. * belongs is set to a different unit.
* UT_SUCCESS Success. * UT_SUCCESS Success.
*/ */
ut_status ut_status
ut_set_second( ut_set_second(
ut_unit* const second); const ut_unit* const second);
/************************************************************************** **** /************************************************************************** ****
* Defining Unit Prefixes: * Defining Unit Prefixes:
************************************************************************** ****/ ************************************************************************** ****/
/* /*
* Adds a name-prefix to a unit-system. A name-prefix is something like "m ega" * Adds a name-prefix to a unit-system. A name-prefix is something like "m ega"
* or "milli". Comparisons between name-prefixes are case-insensitive. * or "milli". Comparisons between name-prefixes are case-insensitive.
* *
* Arguments: * Arguments:
skipping to change at line 428 skipping to change at line 428
* NULL Failure. "ut_get_status()" will be * NULL Failure. "ut_get_status()" will be
* UT_BAD_ARG "unit" is NULL. * UT_BAD_ARG "unit" is NULL.
* UT_SUCCESS "unit" doesn't map to a name in * UT_SUCCESS "unit" doesn't map to a name in
* in the given encoding. * in the given encoding.
* else Pointer to the name in the given encoding to which * else Pointer to the name in the given encoding to which
* "unit" maps. * "unit" maps.
*/ */
const char* const char*
ut_get_name( ut_get_name(
const ut_unit* const unit, const ut_unit* const unit,
const ut_encoding encoding); const ut_encoding encoding);
/* /*
* Adds a mapping from a name to a unit. * Adds a mapping from a name to a unit.
* *
* Arguments: * Arguments:
* name Pointer to the name to be mapped to "unit". May be * name Pointer to the name to be mapped to "unit". May be
* freed upon return. * freed upon return.
* encoding The character encoding of "name". * encoding The character encoding of "name".
* unit Pointer to the unit to be mapped-to by "name". May be * unit Pointer to the unit to be mapped-to by "name". May be
* freed upon return. * freed upon return.
* Returns: * Returns:
* UT_BAD_ARG "name" or "unit" is NULL. * UT_BAD_ARG "name" or "unit" is NULL.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* UT_EXISTS "name" already maps to a different unit. * UT_EXISTS "name" already maps to a different unit.
* UT_SUCCESS Success. * UT_SUCCESS Success.
*/ */
ut_status ut_status
ut_map_name_to_unit( ut_map_name_to_unit(
const char* const name, const char* const name,
const ut_encoding encoding, const ut_encoding encoding,
ut_unit* const unit); const ut_unit* const unit);
/* /*
* Removes a mapping from a name to a unit. After this function, * Removes a mapping from a name to a unit. After this function,
* ut_get_unit_by_name(system,name) will no longer return a unit. * ut_get_unit_by_name(system,name) will no longer return a unit.
* *
* Arguments: * Arguments:
* system The unit-system to which the unit belongs. * system The unit-system to which the unit belongs.
* name The name of the unit. * name The name of the unit.
* encoding The character encoding of "name". * encoding The character encoding of "name".
* Returns: * Returns:
skipping to change at line 487 skipping to change at line 487
* encoding The encoding of "name". * encoding The encoding of "name".
* Returns: * Returns:
* UT_SUCCESS Success. * UT_SUCCESS Success.
* UT_BAD_ARG "unit" or "name" is NULL, or "name" is not in the * UT_BAD_ARG "unit" or "name" is NULL, or "name" is not in the
* specified encoding. * specified encoding.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* UT_EXISTS "unit" already maps to a name. * UT_EXISTS "unit" already maps to a name.
*/ */
ut_status ut_status
ut_map_unit_to_name( ut_map_unit_to_name(
ut_unit* const unit, const ut_unit* const unit,
const char* const name, const char* const name,
ut_encoding encoding); ut_encoding encoding);
/* /*
* Removes a mapping from a unit to a name. * Removes a mapping from a unit to a name.
* *
* Arguments: * Arguments:
* unit Pointer to the unit. May be freed upon return. * unit Pointer to the unit. May be freed upon return.
* encoding The encoding to be removed. No other encodings will be * encoding The encoding to be removed. No other encodings will be
* removed. * removed.
* Returns: * Returns:
* UT_BAD_ARG "unit" is NULL. * UT_BAD_ARG "unit" is NULL.
* UT_SUCCESS Success. * UT_SUCCESS Success.
*/ */
ut_status ut_status
ut_unmap_unit_to_name( ut_unmap_unit_to_name(
ut_unit* const unit, const ut_unit* const unit,
ut_encoding encoding); ut_encoding encoding);
/************************************************************************** **** /************************************************************************** ****
* Mapping between Units and Symbols: * Mapping between Units and Symbols:
************************************************************************** ****/ ************************************************************************** ****/
/* /*
* Returns the symbol in a given encoding to which a unit maps. * Returns the symbol in a given encoding to which a unit maps.
* *
* Arguments: * Arguments:
* unit Pointer to the unit whose symbol should be returned. * unit Pointer to the unit whose symbol should be returned.
skipping to change at line 547 skipping to change at line 547
* unit Pointer to the unit to be mapped-to by "symbol". Ma y * unit Pointer to the unit to be mapped-to by "symbol". Ma y
* be freed upon return. * be freed upon return.
* Returns: * Returns:
* UT_BAD_ARG "symbol" or "unit" is NULL. * UT_BAD_ARG "symbol" or "unit" is NULL.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* UT_EXISTS "symbol" already maps to a different unit. * UT_EXISTS "symbol" already maps to a different unit.
* UT_SUCCESS Success. * UT_SUCCESS Success.
*/ */
ut_status ut_status
ut_map_symbol_to_unit( ut_map_symbol_to_unit(
const char* const symbol, const char* const symbol,
const ut_encoding encoding, const ut_encoding encoding,
ut_unit* const unit); const ut_unit* const unit);
/* /*
* Removes a mapping from a symbol to a unit. After this function, * Removes a mapping from a symbol to a unit. After this function,
* ut_get_unit_by_symbol(system,symbol) will no longer return a unit. * ut_get_unit_by_symbol(system,symbol) will no longer return a unit.
* *
* Arguments: * Arguments:
* system The unit-system to which the unit belongs. * system The unit-system to which the unit belongs.
* symbol The symbol of the unit. * symbol The symbol of the unit.
* encoding The character encoding of "symbol". * encoding The character encoding of "symbol".
* Returns: * Returns:
skipping to change at line 586 skipping to change at line 586
* be freed upon return. * be freed upon return.
* encoding The encoding of "symbol". * encoding The encoding of "symbol".
* Returns: * Returns:
* UT_SUCCESS Success. * UT_SUCCESS Success.
* UT_BAD_ARG "unit" or "symbol" is NULL. * UT_BAD_ARG "unit" or "symbol" is NULL.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* UT_EXISTS "unit" already maps to a symbol. * UT_EXISTS "unit" already maps to a symbol.
*/ */
ut_status ut_status
ut_map_unit_to_symbol( ut_map_unit_to_symbol(
ut_unit* unit, const ut_unit* unit,
const char* const symbol, const char* const symbol,
ut_encoding encoding); ut_encoding encoding);
/* /*
* Removes a mapping from a unit to a symbol. * Removes a mapping from a unit to a symbol.
* *
* Arguments: * Arguments:
* unit Pointer to the unit to be unmapped to a symbol. May be * unit Pointer to the unit to be unmapped to a symbol. May be
* freed upon return. * freed upon return.
* encoding The encoding to be removed. The mappings for "unit" in * encoding The encoding to be removed. The mappings for "unit" in
* other encodings will not be removed. * other encodings will not be removed.
* Returns: * Returns:
* UT_SUCCESS Success. * UT_SUCCESS Success.
* UT_BAD_ARG "unit" is NULL. * UT_BAD_ARG "unit" is NULL.
*/ */
ut_status ut_status
ut_unmap_unit_to_symbol( ut_unmap_unit_to_symbol(
ut_unit* const unit, const ut_unit* const unit,
ut_encoding encoding); ut_encoding encoding);
/************************************************************************** **** /************************************************************************** ****
* Getting Information about a Unit: * Getting Information about a Unit:
************************************************************************** ****/ ************************************************************************** ****/
/* /*
* Indicates if a given unit is dimensionless or not. Note that logarithmi c * Indicates if a given unit is dimensionless or not. Note that logarithmi c
* units are dimensionless by definition. * units are dimensionless by definition.
* *
* Arguments: * Arguments:
* unit Pointer to the unit in question. * unit Pointer to the unit in question.
* Returns: * Returns:
* 0 "unit" is dimensionfull or an error occurred. "ut_get_statu s()" * 0 "unit" is dimensionfull or an error occurred. "ut_get_statu s()"
* will be * will be
* UT_BAD_ARG "unit" is NULL. * UT_BAD_ARG "unit" is NULL.
* UT_SUCCESS "unit" is dimensionfull. * UT_SUCCESS "unit" is dimensionfull.
* else "unit" is dimensionless. * else "unit" is dimensionless.
*/ */
int int
ut_is_dimensionless( ut_is_dimensionless(
ut_unit* const unit); const ut_unit* const unit);
/* /*
* Indicates if two units belong to the same unit-system. * Indicates if two units belong to the same unit-system.
* *
* Arguments: * Arguments:
* unit1 Pointer to a unit. * unit1 Pointer to a unit.
* unit2 Pointer to another unit. * unit2 Pointer to another unit.
* Returns: * Returns:
* 0 Failure or the units belong to different unit-system s. * 0 Failure or the units belong to different unit-system s.
* "ut_get_status()" will be * "ut_get_status()" will be
skipping to change at line 687 skipping to change at line 687
* UT_NOT_SAME_SYSTEM "unit1" and "unit2" belong t o * UT_NOT_SAME_SYSTEM "unit1" and "unit2" belong t o
* different unit-sytems. * different unit-sytems.
* UT_SUCCESS Conversion between the units is * UT_SUCCESS Conversion between the units is
* not possible (e.g., "unit1" is * not possible (e.g., "unit1" is
* "meter" and "unit2" is * "meter" and "unit2" is
* "kilogram"). * "kilogram").
* else Numeric values can be converted between the units. * else Numeric values can be converted between the units.
*/ */
int int
ut_are_convertible( ut_are_convertible(
ut_unit* const unit1, const ut_unit* const unit1,
ut_unit* const unit2); const ut_unit* const unit2);
/* /*
* Returns a converter of numeric values in one unit to numeric values in * Returns a converter of numeric values in one unit to numeric values in
* another unit. The returned converter should be passed to cv_free() when it is * another unit. The returned converter should be passed to cv_free() when it is
* no longer needed by the client. * no longer needed by the client.
* *
* NOTE: Leap seconds are not taken into account when converting between * NOTE: Leap seconds are not taken into account when converting between
* timestamp units. * timestamp units.
* *
* Arguments: * Arguments:
skipping to change at line 742 skipping to change at line 742
* NULL Failure. "ut_get_status()" will be * NULL Failure. "ut_get_status()" will be
* UT_BAD_ARG "factor" is 0 or "unit" is N ULL. * UT_BAD_ARG "factor" is 0 or "unit" is N ULL.
* UT_OS Operating-system error. See * UT_OS Operating-system error. See
* "errno". * "errno".
* else Pointer to the resulting unit. The pointer should b e * else Pointer to the resulting unit. The pointer should b e
* passed to ut_free() when the unit is no longer neede d by * passed to ut_free() when the unit is no longer neede d by
* the client. * the client.
*/ */
ut_unit* ut_unit*
ut_scale( ut_scale(
const double factor, const double factor,
ut_unit* const unit); const ut_unit* const unit);
/* /*
* Returns a unit equivalent to another unit offset by a numeric amount, * Returns a unit equivalent to another unit offset by a numeric amount,
* e.g., * e.g.,
* const ut_unit* kelvin = ... * const ut_unit* kelvin = ...
* const ut_unit* celsius = ut_offset(kelvin, 273.15); * const ut_unit* celsius = ut_offset(kelvin, 273.15);
* *
* Arguments: * Arguments:
* unit Pointer to the unit to be offset. * unit Pointer to the unit to be offset.
* offset The numeric offset. * offset The numeric offset.
skipping to change at line 765 skipping to change at line 765
* NULL Failure. "ut_get_status()" will be * NULL Failure. "ut_get_status()" will be
* UT_BAD_ARG "unit" is NULL. * UT_BAD_ARG "unit" is NULL.
* UT_OS Operating-system error. See * UT_OS Operating-system error. See
* "errno". * "errno".
* else Pointer to the resulting unit. The pointer should b e * else Pointer to the resulting unit. The pointer should b e
* passed to ut_free() when the unit is no longer neede d by * passed to ut_free() when the unit is no longer neede d by
* the client. * the client.
*/ */
ut_unit* ut_unit*
ut_offset( ut_offset(
ut_unit* const unit, const ut_unit* const unit,
const double offset); const double offset);
/* /*
* Returns a unit equivalent to another unit relative to a particular time. * Returns a unit equivalent to another unit relative to a particular time.
* e.g., * e.g.,
* const ut_unit* second = ... * const ut_unit* second = ...
* const ut_unit* secondsSinceTheEpoch = * const ut_unit* secondsSinceTheEpoch =
* ut_offset_by_time(second, ut_encode_time(1970, 1, 1, 0, 0, 0.0)); * ut_offset_by_time(second, ut_encode_time(1970, 1, 1, 0, 0, 0.0));
* *
* Arguments: * Arguments:
skipping to change at line 792 skipping to change at line 792
* UT_MEANINGLESS Creation of a timestamp unit based o n * UT_MEANINGLESS Creation of a timestamp unit based o n
* "unit" is not meaningful. * "unit" is not meaningful.
* UT_NO_SECOND The associated unit-system doesn't * UT_NO_SECOND The associated unit-system doesn't
* contain a "second" unit. See * contain a "second" unit. See
* ut_set_second(). * ut_set_second().
* else Pointer to the resulting unit. The pointer should be passed * else Pointer to the resulting unit. The pointer should be passed
* to ut_free() when the unit is no longer needed by the client . * to ut_free() when the unit is no longer needed by the client .
*/ */
ut_unit* ut_unit*
ut_offset_by_time( ut_offset_by_time(
ut_unit* const unit, const ut_unit* const unit,
const double origin); const double origin);
/* /*
* Returns the result of multiplying one unit by another unit. * Returns the result of multiplying one unit by another unit.
* *
* Arguments: * Arguments:
* unit1 Pointer to a unit. * unit1 Pointer to a unit.
* unit2 Pointer to another unit. * unit2 Pointer to another unit.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be: * NULL Failure. "ut_get_status()" will be:
* UT_BAD_ARG "unit1" or "unit2" is NULL. * UT_BAD_ARG "unit1" or "unit2" is NULL.
* UT_NOT_SAME_SYSTEM "unit1" and "unit2" belong to * UT_NOT_SAME_SYSTEM "unit1" and "unit2" belong to
* different unit-systems. * different unit-systems.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* else Pointer to the resulting unit. The pointer should be passed * else Pointer to the resulting unit. The pointer should be passed
* to ut_free() when the unit is no longer needed by the client . * to ut_free() when the unit is no longer needed by the client .
*/ */
ut_unit* ut_unit*
ut_multiply( ut_multiply(
ut_unit* const unit1, const ut_unit* const unit1,
ut_unit* const unit2); const ut_unit* const unit2);
/* /*
* Returns the inverse (i.e., reciprocal) of a unit. This convenience func tion * Returns the inverse (i.e., reciprocal) of a unit. This convenience func tion
* is equal to "ut_raise(unit, -1)". * is equal to "ut_raise(unit, -1)".
* *
* Arguments: * Arguments:
* unit Pointer to the unit. * unit Pointer to the unit.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be: * NULL Failure. "ut_get_status()" will be:
* UT_BAD_ARG "unit" is NULL. * UT_BAD_ARG "unit" is NULL.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* else Pointer to the resulting unit. The pointer should be passed to * else Pointer to the resulting unit. The pointer should be passed to
* ut_free() when the unit is no longer needed by the client. * ut_free() when the unit is no longer needed by the client.
*/ */
ut_unit* ut_unit*
ut_invert( ut_invert(
ut_unit* const unit); const ut_unit* const unit);
/* /*
* Returns the result of dividing one unit by another unit. This convenien ce * Returns the result of dividing one unit by another unit. This convenien ce
* function is equivalent to the following sequence: * function is equivalent to the following sequence:
* { * {
* ut_unit* inverse = ut_invert(denom); * ut_unit* inverse = ut_invert(denom);
* ut_multiply(numer, inverse); * ut_multiply(numer, inverse);
* ut_free(inverse); * ut_free(inverse);
* } * }
* *
skipping to change at line 855 skipping to change at line 855
* NULL Failure. "ut_get_status()" will be: * NULL Failure. "ut_get_status()" will be:
* UT_BAD_ARG "numer" or "denom" is NULL. * UT_BAD_ARG "numer" or "denom" is NULL.
* UT_NOT_SAME_SYSTEM "unit1" and "unit2" belong to * UT_NOT_SAME_SYSTEM "unit1" and "unit2" belong to
* different unit-systems. * different unit-systems.
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* else Pointer to the resulting unit. The pointer should be passed to * else Pointer to the resulting unit. The pointer should be passed to
* ut_free() when the unit is no longer needed by the client. * ut_free() when the unit is no longer needed by the client.
*/ */
ut_unit* ut_unit*
ut_divide( ut_divide(
ut_unit* const numer, const ut_unit* const numer,
ut_unit* const denom); const ut_unit* const denom);
/* /*
* Returns the result of raising a unit to a power. * Returns the result of raising a unit to a power.
* *
* Arguments: * Arguments:
* unit Pointer to the unit. * unit Pointer to the unit.
* power The power by which to raise "unit". Must be greater than or * power The power by which to raise "unit". Must be greater than or
* equal to -255 and less than or equal to 255. * equal to -255 and less than or equal to 255.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be: * NULL Failure. "ut_get_status()" will be:
* UT_BAD_ARG "unit" is NULL or "power" is invalid . * UT_BAD_ARG "unit" is NULL or "power" is invalid .
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* else Pointer to the resulting unit. The pointer should be passed to * else Pointer to the resulting unit. The pointer should be passed to
* ut_free() when the unit is no longer needed by the client. * ut_free() when the unit is no longer needed by the client.
*/ */
ut_unit* ut_unit*
ut_raise( ut_raise(
ut_unit* const unit, const ut_unit* const unit,
const int power); const int power);
/* /*
* Returns the result of taking the root of a unit. * Returns the result of taking the root of a unit.
* *
* Arguments: * Arguments:
* unit Pointer to the unit. * unit Pointer to the unit.
* root The root to take of "unit". Must be greater than or * root The root to take of "unit". Must be greater than or
* equal to 1 and less than or equal to 255. * equal to 1 and less than or equal to 255.
* Returns: * Returns:
* NULL Failure. "ut_get_status()" will be: * NULL Failure. "ut_get_status()" will be:
* UT_BAD_ARG "unit" is NULL, or "root" is invalid . * UT_BAD_ARG "unit" is NULL, or "root" is invalid .
* In particular, all powers of base un its * In particular, all powers of base un its
* in "unit" must be integral multiples of * in "unit" must be integral multiples of
* "root". * "root".
* UT_OS Operating-system error. See "errno". * UT_OS Operating-system error. See "errno".
* else Pointer to the resulting unit. The pointer should be passed to * else Pointer to the resulting unit. The pointer should be passed to
* ut_free() when the unit is no longer needed by the client. * ut_free() when the unit is no longer needed by the client.
*/ */
ut_unit* ut_unit*
ut_root( ut_root(
ut_unit* const unit, const ut_unit* const unit,
const int root); const int root);
/* /*
* Returns the logarithmic unit corresponding to a logarithmic base and a * Returns the logarithmic unit corresponding to a logarithmic base and a
* reference level. For example, the following creates a decibel unit with a * reference level. For example, the following creates a decibel unit with a
* one milliwatt reference level: * one milliwatt reference level:
* *
* const ut_unit* watt = ...; * const ut_unit* watt = ...;
* const ut_unit* milliWatt = ut_scale(0.001, watt); * const ut_unit* milliWatt = ut_scale(0.001, watt);
* *
* if (milliWatt != NULL) { * if (milliWatt != NULL) {
skipping to change at line 940 skipping to change at line 940
* UT_BAD_ARG "base" is invalid or "refere nce" * UT_BAD_ARG "base" is invalid or "refere nce"
* is NULL. * is NULL.
* UT_OS Operating-system error. See * UT_OS Operating-system error. See
* "errno". * "errno".
* else Pointer to the resulting unit. The pointer should b e * else Pointer to the resulting unit. The pointer should b e
* passed to ut_free() when the unit is no longer neede d by * passed to ut_free() when the unit is no longer neede d by
* the client. * the client.
*/ */
ut_unit* ut_unit*
ut_log( ut_log(
const double base, const double base,
ut_unit* const reference); const ut_unit* const reference);
/************************************************************************** **** /************************************************************************** ****
* Parsing and Formatting Units: * Parsing and Formatting Units:
************************************************************************** ****/ ************************************************************************** ****/
/* /*
* Returns the binary representation of a unit corresponding to a string * Returns the binary representation of a unit corresponding to a string
* representation. * representation.
* *
* Arguments: * Arguments:
skipping to change at line 971 skipping to change at line 971
* UT_SYNTAX "string" contained a syntax * UT_SYNTAX "string" contained a syntax
* error. * error.
* UT_UNKNOWN "string" contained an unknow n * UT_UNKNOWN "string" contained an unknow n
* identifier. * identifier.
* UT_OS Operating-system failure. S ee * UT_OS Operating-system failure. S ee
* "errno". * "errno".
* else Pointer to the unit corresponding to "string". * else Pointer to the unit corresponding to "string".
*/ */
ut_unit* ut_unit*
ut_parse( ut_parse(
ut_system* const system, const ut_system* const system,
const char* const string, const char* const string,
const ut_encoding encoding); const ut_encoding encoding);
/* /*
* Removes leading and trailing whitespace from a string. * Removes leading and trailing whitespace from a string.
* *
* Arguments: * Arguments:
* string NUL-terminated string. Will be modified if it conta ins * string NUL-terminated string. Will be modified if it conta ins
* whitespace.. * whitespace..
* encoding The character-encoding of "string". * encoding The character-encoding of "string".
* Returns: * Returns:
* "string", with all leading and trailing whitespace removed. * "string", with all leading and trailing whitespace removed.
 End of changes. 24 change blocks. 
46 lines changed or deleted 46 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/