diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-09-24 04:28:45 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-09-24 04:28:45 +0200 |
commit | 08a01723af9cd52c078d5ca6c38c34d375b39fa0 (patch) | |
tree | 6eadea9c67f4bb56a9e4ee09f4982efaf61deece /pcilib/unit.h | |
parent | 924adedb2928f5657c6668f606dbb3294b3c45da (diff) | |
parent | ae7f83a7948d8c3760f8019899a45e6ec90c2c6a (diff) | |
download | pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.gz pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.bz2 pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.tar.xz pcitool-08a01723af9cd52c078d5ca6c38c34d375b39fa0.zip |
Finalyze XML support and provide initial support for views (only descriptions so far)
Diffstat (limited to 'pcilib/unit.h')
-rw-r--r-- | pcilib/unit.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/pcilib/unit.h b/pcilib/unit.h new file mode 100644 index 0000000..9c62ff3 --- /dev/null +++ b/pcilib/unit.h @@ -0,0 +1,36 @@ +#ifndef _PCILIB_UNIT_H +#define _PCILIB_UNIT_H + +#include <pcilib.h> + +#define PCILIB_UNIT_INVALID ((pcilib_unit_t)-1) +#define PCILIB_MAX_TRANSFORMS_PER_UNIT 16 /**< Limits number of supported transforms per unit */ + +typedef struct pcilib_unit_context_s *pcilib_unit_context_t; + +/** + * unit transformation routines + */ +typedef struct { + char *unit; /**< Name of the resulting unit */ + char *transform; /**< String, similar to view formula, explaining transform to this unit */ +} pcilib_unit_transform_t; + +typedef struct { + char *name; /**< Unit name */ + pcilib_unit_transform_t transforms[PCILIB_MAX_TRANSFORMS_PER_UNIT + 1]; /**< Transforms to other units */ +} pcilib_unit_description_t; + +#ifdef __cplusplus +extern "C" { +#endif + +int pcilib_add_units(pcilib_t *ctx, size_t n, const pcilib_unit_description_t *desc); +pcilib_unit_t pcilib_find_unit_by_name(pcilib_t *ctx, const char *unit); + +#ifdef __cplusplus +} +#endif + + +#endif /* _PCILIB_UNIT_H */ |