Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_version.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Version Header
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_VERSION_H__
10 #define __AFW_VERSION_H__
11 
12 #include "afw_common.h"
13 
35 
37 AFW_DECLARE(unsigned int)
39 
41 AFW_DECLARE(const afw_utf8_t *)
43 
47 
58 afw_version_check(unsigned int version);
59 
64 #define AFW_VERSION_CHECK afw_version_check(AFW_VERSION_HEX)
65 
76 #define AFW_VERSION_THROW_ERROR_SUPPLIED_HEX_VERSION_IF_NOT_COMPATIBLE( \
77  info, compiled_version, xctx) \
78 do { \
79  const afw_utf8_z_t *msg_z; \
80  msg_z = afw_version_check(compiled_version); \
81  if (msg_z) { \
82  AFW_THROW_ERROR_FZ(general, xctx, \
83  "%" AFW_UTF8_FMT " %s", \
84  AFW_UTF8_FMT_ARG(info), msg_z); \
85  } \
86 } while (0)
87 
98 #define AFW_VERSION_THROW_ERROR_IF_NOT_COMPATIBLE(id_z, xctx) \
99 do { \
100  const afw_utf8_z_t *msg_z; \
101  msg_z = AFW_VERSION_CHECK; \
102  if (msg_z) { \
103  AFW_THROW_ERROR_FZ(general, xctx, "%s %s", id_z, msg_z); \
104  } \
105 } while (0)
106 
119 #define AFW_VERSION_ABORT_IF_NOT_COMPATIBLE(id_z) \
120 do { \
121  const afw_utf8_z_t *msg_z; \
122  msg_z = AFW_VERSION_CHECK; \
123  if (msg_z) { \
124  fprintf(stderr, "%s %s", id_z, msg_z); \
125  abort(); \
126  } \
127 } while (0)
128 
129 AFW_END_DECLARES
130 
133 #endif /* __AFW_VERSION_H__ */
Adaptive Framework Common Header.
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
Definition: afw_common.h:523
const afw_utf8_t * afw_version_string()
const afw_utf8_z_t * afw_version_check(unsigned int version)
Version check.
unsigned int afw_version()
const afw_utf8_z_t * afw_version_string_z()
NFC normalized UTF-8 string.
Definition: afw_common.h:545