My Project
Loading...
Searching...
No Matches
flags.h File Reference

Go to the source code of this file.

Macros

#define SET_FLAG(a, b)
 
#define GET_FLAG(a, b)
 
#define SAFE_FLAG(a, b)
 
#define UNSET_FLAG(a, b)
 
#define _FLAG_FUNC(A, a)
 
#define FLAG_FUNC(A, a)
 

Enumerations

enum  __attribute__ {
  ae_flag_none = 1 << 0 , ae_flag_static = 1 << 1 , ae_flag_private = 1 << 2 , ae_flag_global = 1 << 3 ,
  ae_flag_const = 1 << 4 , ae_flag_late = 1 << 5 , ae_flag_abstract = 1 << 6 , ae_flag_final = 1 << 7 ,
  ae_flag_protect = 1 << 8
}
 

Macro Definition Documentation

◆ _FLAG_FUNC

#define _FLAG_FUNC ( A,
a )
Value:
ANN static inline int a##flag(const A a, const enum a##flag flag) { \
return (a->a##flag & flag) == flag; \
} \
static inline int safe_##a##flag(const A a, const enum a##flag flag) { \
return a ? ((a->a##flag & flag) == flag) : 0; \
}

Definition at line 33 of file flags.h.

33#define _FLAG_FUNC(A, a) \
34 ANN static inline int a##flag(const A a, const enum a##flag flag) { \
35 return (a->a##flag & flag) == flag; \
36 } \
37 static inline int safe_##a##flag(const A a, const enum a##flag flag) { \
38 return a ? ((a->a##flag & flag) == flag) : 0; \
39 }

◆ FLAG_FUNC

#define FLAG_FUNC ( A,
a )
Value:
ANN static inline void set_##a##flag(A a, const enum a##flag flag) { \
a->a##flag |= flag; \
} \
static inline void unset_##a##flag(A a, const enum a##flag flag) { \
a->a##flag &= ~flag; \
} \
_FLAG_FUNC(A, a)

Definition at line 41 of file flags.h.

41#define FLAG_FUNC(A, a) \
42 ANN static inline void set_##a##flag(A a, const enum a##flag flag) { \
43 a->a##flag |= flag; \
44 } \
45 static inline void unset_##a##flag(A a, const enum a##flag flag) { \
46 a->a##flag &= ~flag; \
47 } \
48 _FLAG_FUNC(A, a)

◆ GET_FLAG

#define GET_FLAG ( a,
b )
Value:
(((a)->flag & ae_flag_##b) == (ae_flag_##b))

Definition at line 16 of file flags.h.

◆ SAFE_FLAG

#define SAFE_FLAG ( a,
b )
Value:
(a && ((a)->flag & (ae_flag_##b)) == (ae_flag_##b))

Definition at line 17 of file flags.h.

◆ SET_FLAG

#define SET_FLAG ( a,
b )
Value:
(a)->flag |= (ae_flag_##b)

Definition at line 8 of file flags.h.

◆ UNSET_FLAG

#define UNSET_FLAG ( a,
b )
Value:
((a)->flag &= ~(ae_flag_##b))

Definition at line 18 of file flags.h.

Enumeration Type Documentation

◆ __attribute__

Enumerator
ae_flag_none 
ae_flag_static 
ae_flag_private 
ae_flag_global 
ae_flag_const 
ae_flag_late 
ae_flag_abstract 
ae_flag_final 
ae_flag_protect 

Definition at line 20 of file flags.h.

20 {
21 ae_flag_none = 1 << 0,
22 ae_flag_static = 1 << 1,
23 ae_flag_private = 1 << 2,
24 ae_flag_global = 1 << 3,
25 ae_flag_const = 1 << 4,
26 ae_flag_late = 1 << 5,
27 ae_flag_abstract = 1 << 6,
28 ae_flag_final = 1 << 7,
29 ae_flag_protect = 1 << 8,
30} __attribute__((packed)) ae_flag;
__attribute__
Definition flags.h:20
@ ae_flag_protect
Definition flags.h:29
@ ae_flag_static
Definition flags.h:22
@ ae_flag_global
Definition flags.h:24
@ ae_flag_private
Definition flags.h:23
@ ae_flag_late
Definition flags.h:26
@ ae_flag_none
Definition flags.h:21
@ ae_flag_const
Definition flags.h:25
@ ae_flag_abstract
Definition flags.h:27
@ ae_flag_final
Definition flags.h:28