| 1 | /* |
| 2 | * Copyright 2009 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * "Daniel Kopecek" <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | #ifndef SEXP_TYPES_H |
| 25 | #define SEXP_TYPES_H |
| 26 | |
| 27 | #include <stdint.h> |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
| 33 | typedef uint8_t SEXP_numtype_t; |
| 34 | |
| 35 | /* Number types */ |
| 36 | #define SEXP_NUM_NONE 0x00 |
| 37 | #define SEXP_NUM_BOOL 0x01 |
| 38 | #define SEXP_NUM_INT8 0x07 |
| 39 | #define SEXP_NUM_UINT8 0x08 |
| 40 | #define SEXP_NUM_INT16 0x0f |
| 41 | #define SEXP_NUM_UINT16 0x10 |
| 42 | #define SEXP_NUM_INT32 0x1f |
| 43 | #define SEXP_NUM_UINT32 0x20 |
| 44 | #define SEXP_NUM_INT64 0x3f |
| 45 | #define SEXP_NUM_UINT64 0x40 |
| 46 | #define SEXP_NUM_DOUBLE 0x41 |
| 47 | |
| 48 | /* Aliases */ |
| 49 | |
| 50 | #define SEXP_NUM_BOOLEAN SEXP_NUM_BOOL |
| 51 | #define SEXP_NUM_CHAR SEXP_NUM_INT8 |
| 52 | #define SEXP_NUM_UCHAR SEXP_NUM_UINT8 |
| 53 | #define SEXP_NUM_SHORTINT SEXP_NUM_INT16 |
| 54 | #define SEXP_NUM_USHORTINT SEXP_NUM_UINT16 |
| 55 | #define SEXP_NUM_SHORTUINT SEXP_NUM_UINT16 |
| 56 | #define SEXP_NUM_INT SEXP_NUM_INT32 |
| 57 | #define SEXP_NUM_LONGINT SEXP_NUM_INT32 |
| 58 | #define SEXP_NUM_UINT SEXP_NUM_UINT32 |
| 59 | #define SEXP_NUM_ULONGINT SEXP_NUM_UINT32 |
| 60 | #define SEXP_NUM_LONGUINT SEXP_NUM_UINT32 |
| 61 | #define SEXP_NUM_LONLONGINT SEXP_NUM_INT64 |
| 62 | #define SEXP_NUM_ULONGLONGINT SEXP_NUM_UINT64 |
| 63 | #define SEXP_NUM_LONGLONGUINT SEXP_NUM_UINT64 |
| 64 | #define SEXP_NUM_FLOAT SEXP_NUM_DOUBLE |
| 65 | |
| 66 | /* S-expression format */ |
| 67 | typedef uint8_t SEXP_format_t; |
| 68 | |
| 69 | #define SEXP_FMT_UNDEFINED 0 |
| 70 | #define SEXP_FMT_TRANSPORT 1 |
| 71 | #define SEXP_FMT_CANONICAL 2 |
| 72 | #define SEXP_FMT_ADVANCED 3 |
| 73 | #define SEXP_FMT_AUTODETECT 4 |
| 74 | |
| 75 | #define SEXP_TYPE_EMPTY 0 |
| 76 | #define SEXP_TYPE_STRING 1 |
| 77 | #define SEXP_TYPE_NUMBER 2 |
| 78 | #define SEXP_TYPE_LIST 3 |
| 79 | |
| 80 | typedef uint8_t SEXP_type_t; |
| 81 | |
| 82 | struct SEXP { |
| 83 | #if !defined(NDEBUG) || defined(VALIDATE_SEXP) |
| 84 | volatile uint16_t __magic0; |
| 85 | #endif |
| 86 | |
| 87 | void *s_type; |
| 88 | uintptr_t s_valp; |
| 89 | |
| 90 | #if !defined(NDEBUG) || defined(VALIDATE_SEXP) |
| 91 | volatile uint16_t __magic1; |
| 92 | #endif |
| 93 | }; |
| 94 | |
| 95 | typedef struct SEXP SEXP_t; |
| 96 | |
| 97 | #ifdef __cplusplus |
| 98 | } |
| 99 | #endif |
| 100 | |
| 101 | #endif /* SEXP_TYPES_H */ |