00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #pragma once
00024 #ifndef _SEXP_TYPES_H
00025 #define _SEXP_TYPES_H
00026
00027 #include <stddef.h>
00028 #include <stdint.h>
00029 #include <stdbool.h>
00030 #include "public/sexp-types.h"
00031 #include "_sexp-datatype.h"
00032 #include "../../../common/util.h"
00033
00034 OSCAP_HIDDEN_START;
00035
00036
00037 #if !defined(NDEBUG) || defined(VALIDATE_SEXP)
00038 # define SEXP_MAGIC0 0xf3f3
00039 # define SEXP_MAGIC0_INV 0xffff
00040 # define SEXP_MAGIC1 0x6767
00041 # define SEXP_MAGIC1_INV 0x0000
00042 #endif
00043
00044 struct SEXP {
00045 #if !defined(NDEBUG) || defined(VALIDATE_SEXP)
00046 volatile uint16_t __magic0;
00047 #endif
00048
00049 SEXP_datatypePtr_t *s_type;
00050 uintptr_t s_valp;
00051 uint8_t s_flgs;
00052
00053 #if !defined(NDEBUG) || defined(VALIDATE_SEXP)
00054 volatile uint16_t __magic1;
00055 #endif
00056 };
00057
00058 #define SEXP_FLAG_SREF 0x01
00059 #define SEXP_FLAG_INVAL 0x02
00060 #define SEXP_FLAG_UNFIN 0x04
00061
00062 static inline void SEXP_flag_set (SEXP_t *s_exp, uint8_t flag)
00063 {
00064 s_exp->s_flgs |= flag;
00065 }
00066
00067 static inline void SEXP_flag_unset (SEXP_t *s_exp, uint8_t flag)
00068 {
00069 s_exp->s_flgs &= ~flag;
00070 }
00071
00072 static inline bool SEXP_flag_isset (SEXP_t *s_exp, uint8_t flag)
00073 {
00074 return ((s_exp->s_flgs & flag) == flag);
00075 }
00076
00077 OSCAP_HIDDEN_END;
00078
00079 #endif