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