dlite-misc#

Main header file for dlite.

Wrappers around error functions

*/

/**

The DLITE_NOERR() and DLITE_NOERR_END macros are intended to mark a code block in which the specified errors will not be printed. Use them as follows:

DLITE_NOERR(DLITE_ERRBIT(DLiteIOError) | DLITE_ERRBIT(DLiteRuntimeError));
  // code block where IO and runtime errors are ignored
  ...
DLITE_NOERR_END;
DLITE_ERRBIT(code)#
DLITE_NOERR(mask)#
DLITE_NOERR_END#
dlite_deprecation_warning(version_removed, descr)#
typedef int64_t DLiteErrMask#
DLiteErrMask *_dlite_err_mask_get(void)#
void _dlite_err_mask_set(DLiteErrMask mask)#
void dlite_err_ignored_set(DLiteErrCode code, int value)#

Set whether to ignore printing given error code.

int dlite_err_ignored_get(DLiteErrCode code)#

Return whether printing is ignored for given error code.

void dlite_fatal(int eval, const char *msg, ...)#
void dlite_fatalx(int eval, const char *msg, ...)#
int dlite_err(int eval, const char *msg, ...)#
int dlite_errx(int eval, const char *msg, ...)#
int dlite_warn(const char *msg, ...)#
int dlite_warnx(const char *msg, ...)#
void dlite_vfatal(int eval, const char *msg, va_list ap)#
void dlite_vfatalx(int eval, const char *msg, va_list ap)#
int dlite_verr(int eval, const char *msg, va_list ap)#
int dlite_verrx(int eval, const char *msg, va_list ap)#
int dlite_vwarn(const char *msg, va_list ap)#
int dlite_vwarnx(const char *msg, va_list ap)#
int dlite_errval(void)#
const char *dlite_errmsg(void)#
void dlite_errclr(void)#
FILE *dlite_err_get_stream(void)#
void dlite_err_set_stream(FILE *stream)#
void dlite_err_set_file(const char *filename)#
int dlite_err_set_warn_mode(int mode)#
int dlite_err_get_warn_mode(void)#
int dlite_err_set_debug_mode(int mode)#
int dlite_err_get_debug_mode(void)#
int dlite_err_set_override_mode(int mode)#
int dlite_err_get_override_mode(void)#
int _dlite_deprecation_warning(const char *version_removed, const char *filepos, const char *func, const char *descr)#

Parsing options

enum DLiteOptFlag#

Values:

enumerator dliteOptDefault#

Default option flags

enumerator dliteOptStrict#

Stict mode. Its an error if option is unknown

typedef struct _DLiteOpt DLiteOpt#

Struct used by dlite_getopt()

General dlite utility functions

const char *dlite_get_version(void)#

Returns static pointer to a string with the current version of DLite.

FUPlatform dlite_get_platform(void)#

Returns current platform based on the DLITE_PLATFORM environment variable. Used when initiating paths.

int dlite_get_uuid(char *buff, const char *id)#

Writes an UUID to buff based on id.

Whether and what kind of UUID that is generated depends on id:

  • If id is NULL or empty, a new random version 4 UUID is generated.

  • If id is not a valid UUID string, a new version 5 sha1-based UUID is generated from id using the DNS namespace.

  • Otherwise is id already a valid UUID and it is simply copied to buff.

Length of buff must at least (DLITE_UUID_LENGTH + 1) bytes (36 bytes for UUID + NUL termination).

Returns the UUID version if a new UUID is generated or zero if id is already a valid UUID. On error, -1 is returned.

int dlite_get_uuidn(char *buff, const char *id, size_t len)#

Like dlite_get_uuid(), but takes the the length of id as an additional parameter.

char *dlite_join_meta_uri(const char *name, const char *version, const char *namespace)#

Returns an unique uri for metadata defined by name, version and namespace as a newly malloc()’ed string or NULL on error.

The returned uri is constructed as follows:

namespace/version/name

int dlite_split_meta_uri(const char *uri, char **name, char **version, char **namespace)#

Splits metadata uri into its components. If name, version and/or namespace are not NULL, the memory they points to will be set to a pointer to a newly malloc()’ed string with the corresponding value.

Returns non-zero on error.

Defines

DLITE_UUID_LENGTH#

length of an uuid (excl. NUL-termination)

struct _DLiteOpt#
#include <dlite-misc.h>

Struct used by dlite_getopt()

Public Members

int c#

Integer identifier for this option

const char *key#

Option key

const char *value#

Option value, initialised with default value

const char *descr#

Description of this option