OSAPI
0.29
Open System API
status_macros.h
Go to the documentation of this file.
1
// *****************************************************************************************
2
//
3
// File description:
4
//
5
// Author: Joao Costa
6
// Purpose: Provide Status module macros & other definitions
7
//
8
// *****************************************************************************************
9
10
#ifndef OSAPI_STATUS_MACROS_H_
11
#define OSAPI_STATUS_MACROS_H_
12
15
16
// *****************************************************************************************
17
//
18
// Section: Import headers
19
//
20
// *****************************************************************************************
21
22
// Include standard C headers
23
#include <stdbool.h>
24
25
// Include OSAPI headers
26
#include "error/error_types.h"
27
28
29
// *****************************************************************************************
30
//
31
// Section: Constants/Macros for client applications
32
//
33
// *****************************************************************************************
34
35
// TODO: Move pointer to reference to speedup operations
37
#define status_reset( x ) ( (x)->code = 0 )
38
40
#define status_set( m, t, f, e, r ) status_instance_set( m, t, f, e, r )
41
43
#define status_setString( m, t, f, s, r ) status_instance_setString( m, t, f, s, r )
44
45
// Helper definitions for a correct way to check for success/failure of operations
48
#define status_success( x ) ( x.code == 0 )
49
52
#define status_failure( x ) ( x.code != 0 )
53
56
#define status_error( s, e ) ( s.code == e )
57
60
#define status_true( x ) ( status_failure( x ) ? 0 : 1 )
61
64
#define status_false( x ) ( status_success( x ) ? 1 : 0 )
65
67
#define status_result( x ) ( x.code == 0 ? true : false )
68
71
#define status_unsupported( s ) ( s.code == OSAPI_ERROR_SUPPORT )
72
73
74
#endif
/* OSAPI_STATUS_MACROS_H_ */
code
status
status_macros.h
Generated by
1.8.17