| udunits2.h | | udunits2.h | |
| /* | | /* | |
|
| * Copyright 2008, 2009 University Corporation for Atmospheric Research | | * Copyright 2013 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 COPYRIGHT | |
| * 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_UNITS2_H_INCLUDED | | #ifndef UT_UNITS2_H_INCLUDED | |
| #define UT_UNITS2_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 { | | enum utStatus { | |
| UT_SUCCESS = 0, /* Success */ | | UT_SUCCESS = 0, /* Success */ | |
| UT_BAD_ARG, /* An argument violates the function's contr
act */ | | UT_BAD_ARG, /* An argument violates the function's contr
act */ | |
| UT_EXISTS, /* Unit, prefix, or identifier already exists */ | | UT_EXISTS, /* Unit, prefix, or identifier already exists */ | |
| UT_NO_UNIT, /* No such unit exists */ | | UT_NO_UNIT, /* No such unit exists */ | |
| UT_OS, /* Operating-system error. See "errno". */ | | UT_OS, /* Operating-system error. See "errno". */ | |
| UT_NOT_SAME_SYSTEM, /* The units belong to different unit-system
s */ | | UT_NOT_SAME_SYSTEM, /* The units belong to different unit-system
s */ | |
| UT_MEANINGLESS, /* The operation on the unit(s) is meaningless */ | | UT_MEANINGLESS, /* The operation on the unit(s) is meaningless */ | |
| UT_NO_SECOND, /* The unit-system doesn't have a unit named "second
" */ | | UT_NO_SECOND, /* The unit-system doesn't have a unit named "second
" */ | |
| UT_VISIT_ERROR, /* An error occurred while visiting a unit */ | | UT_VISIT_ERROR, /* An error occurred while visiting a unit */ | |
| UT_CANT_FORMAT, /* A unit can't be formatted in the desired manner *
/ | | UT_CANT_FORMAT, /* A unit can't be formatted in the desired manner *
/ | |
| UT_SYNTAX, /* string unit representation contains syntax error
*/ | | UT_SYNTAX, /* string unit representation contains syntax error
*/ | |
| UT_UNKNOWN, /* string unit representation contains unkno
wn word */ | | UT_UNKNOWN, /* string unit representation contains unkno
wn word */ | |
| UT_OPEN_ARG, /* Can't open argument-specified unit database */ | | UT_OPEN_ARG, /* Can't open argument-specified unit database */ | |
| UT_OPEN_ENV, /* Can't open environment-specified unit database */ | | UT_OPEN_ENV, /* Can't open environment-specified unit database */ | |
| UT_OPEN_DEFAULT, /* Can't open installed, default, unit database */ | | UT_OPEN_DEFAULT, /* Can't open installed, default, unit database */ | |
| UT_PARSE /* Error parsing unit specification */ | | UT_PARSE /* Error parsing unit specification */ | |
|
| } ut_status; | | }; | |
| | | typedef enum utStatus ut_status; | |
| | | | |
|
| typedef enum { | | enum utEncoding { | |
| UT_ASCII = 0, | | UT_ASCII = 0, | |
| UT_ISO_8859_1 = 1, | | UT_ISO_8859_1 = 1, | |
| UT_LATIN1 = UT_ISO_8859_1, | | UT_LATIN1 = UT_ISO_8859_1, | |
| UT_UTF8 = 2 | | UT_UTF8 = 2 | |
|
| } ut_encoding; | | }; | |
| | | typedef enum utEncoding ut_encoding; | |
| | | | |
| #define UT_NAMES 4 | | #define UT_NAMES 4 | |
| #define UT_DEFINITION 8 | | #define UT_DEFINITION 8 | |
| | | | |
| /* | | /* | |
| * Data-structure for a visitor to a unit: | | * Data-structure for a visitor to a unit: | |
| */ | | */ | |
|
| typedef struct { | | typedef struct ut_visitor { | |
| /* | | /* | |
| * Visits a basic-unit. A basic-unit is a base unit like "meter" or a
non- | | * Visits a basic-unit. A basic-unit is a base unit like "meter" or a
non- | |
| * dimensional but named unit like "radian". | | * dimensional but named unit like "radian". | |
| * | | * | |
| * Arguments: | | * Arguments: | |
| * unit Pointer to the basic-unit. | | * unit Pointer to the basic-unit. | |
| * arg Client pointer passed to ut_accept_visitor(). | | * arg Client pointer passed to ut_accept_visitor(). | |
| * Returns: | | * Returns: | |
| * UT_SUCCESS Success. | | * UT_SUCCESS Success. | |
| * else Failure. | | * else Failure. | |
| | | | |
| skipping to change at line 144 | | skipping to change at line 146 | |
| typedef int (*ut_error_message_handler)(const char* fmt, va_list args); | | typedef int (*ut_error_message_handler)(const char* fmt, va_list args); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| /**************************************************************************
**** | | /**************************************************************************
**** | |
| * Unit System: | | * Unit System: | |
| **************************************************************************
****/ | | **************************************************************************
****/ | |
| | | | |
|
| | | /** | |
| | | * Returns the pathname of the XML database. | |
| | | * | |
| | | * @param path The pathname of the XML file or NULL. | |
| | | * @param status Status. One of UT_OPEN_ARG, UT_OPEN_ENV, or UT_OPEN_DEF | |
| | | AULT. | |
| | | * @return If "path" is not NULL, then it is returned; otherwise, | |
| | | the | |
| | | * pathname specified by the environment variable | |
| | | * UDUNITS2_XML_PATH is returned if set; otherwise, the | |
| | | * compile-time pathname of the installed, default, unit | |
| | | * database is returned. | |
| | | */ | |
| | | const char* | |
| | | ut_get_path_xml( | |
| | | const char* path, | |
| | | ut_status* status); | |
| | | | |
| /* | | /* | |
| * Returns the unit-system corresponding to an XML file. This is the usual
way | | * Returns the unit-system corresponding to an XML file. This is the usual
way | |
| * that a client will obtain a unit-system. | | * that a client will obtain a unit-system. | |
| * | | * | |
| * Arguments: | | * Arguments: | |
| * path The pathname of the XML file or NULL. If NULL, then the | | * path The pathname of the XML file or NULL. If NULL, then the | |
| * pathname specified by the environment variable UDUNITS2_XML_
PATH | | * pathname specified by the environment variable UDUNITS2_XML_
PATH | |
| * is used if set; otherwise, the compile-time pathname of the | | * is used if set; otherwise, the compile-time pathname of the | |
| * installed, default, unit database is used. | | * installed, default, unit database is used. | |
| * Returns: | | * Returns: | |
| | | | |
End of changes. 8 change blocks. |
| 7 lines changed or deleted | | 27 lines changed or added | |
|