1/* 2 * Type definitions for libevtx 3 * 4 * Copyright (C) 2011-2021, Joachim Metz <joachim.metz@gmail.com> 5 * 6 * Refer to AUTHORS for acknowledgements. 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public License 19 * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 */ 21 22#if !defined( _LIBEVTX_TYPES_H ) 23#define _LIBEVTX_TYPES_H 24 25#include <libevtx/features.h> 26 27/* Integer type definitions 28 */ 29#if ( defined( _MSC_VER ) && ( _MSC_VER < 1600 ) ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) ) 30 31#ifdef __cplusplus 32extern "C" { 33#endif 34 35/* Microsoft Visual Studio C++ before Visual Studio 2010 or earlier versions of the Borland C++ Builder 36 * do not support the (u)int#_t type definitions but have __int# definitions instead 37 */ 38#if !defined( HAVE_INT8_T ) 39#define HAVE_INT8_T 40typedef __int8 int8_t; 41#endif 42 43#if !defined( HAVE_UINT8_T ) 44#define HAVE_UINT8_T 45typedef unsigned __int8 uint8_t; 46#endif 47 48#if !defined( HAVE_INT16_T ) 49#define HAVE_INT16_T 50typedef __int16 int16_t; 51#endif 52 53#if !defined( HAVE_UINT16_T ) 54#define HAVE_UINT16_T 55typedef unsigned __int16 uint16_t; 56#endif 57 58#if !defined( HAVE_INT32_T ) 59#define HAVE_INT32_T 60typedef __int32 int32_t; 61#endif 62 63#if !defined( HAVE_UINT32_T ) 64#define HAVE_UINT32_T 65typedef unsigned __int32 uint32_t; 66#endif 67 68#if !defined( HAVE_INT64_T ) 69#define HAVE_INT64_T 70typedef __int64 int64_t; 71#endif 72 73#if !defined( HAVE_UINT64_T ) 74#define HAVE_UINT64_T 75typedef unsigned __int64 uint64_t; 76#endif 77 78#ifdef __cplusplus 79} 80#endif 81 82#elif defined( _MSC_VER ) || defined( __BORLANDC__ ) 83 84/* Later versions of Microsoft Visual Studio C++ and Borland C/C++ define the types in <stdint.h> 85 */ 86#include <stdint.h> 87 88#else 89 90#if @HAVE_SYS_TYPES_H@ || defined( HAVE_SYS_TYPES_H ) 91#include <sys/types.h> 92 93#else 94#error Missing system type definitions (sys/types.h) 95#endif 96 97/* Type definitions for compilers that have access to 98 * <inttypes.h> or <stdint.h> 99 */ 100#if @HAVE_INTTYPES_H@ || defined( HAVE_INTTYPES_H ) 101#include <inttypes.h> 102 103#elif @HAVE_STDINT_H@ || defined( HAVE_STDINT_H ) 104#include <stdint.h> 105 106#else 107#error Missing integer type definitions (inttypes.h, stdint.h) 108#endif 109 110#endif 111 112#ifdef __cplusplus 113extern "C" { 114#endif 115 116#if defined( _MSC_VER ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) ) 117 118/* Microsoft Visual Studio C++ or earlier versions of the Borland C++ Builder 119 * do not support the ssize_t type definition 120 */ 121#if !defined( HAVE_SSIZE_T ) 122#define HAVE_SSIZE_T 123 124#if defined( _WIN64 ) 125typedef __int64 ssize_t; 126#else 127typedef __int32 ssize_t; 128#endif 129 130#endif /* !defined( HAVE_SSIZE_T ) */ 131 132#endif /* defined( _MSC_VER ) || ( defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) ) */ 133 134#if defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) 135 136/* Earlier versions of Borland C++ Builder do not support the intptr_t type definition 137 */ 138#if !defined( HAVE_INTPTR_T ) 139#define HAVE_INTPTR_T 140 141#if defined( _WIN64 ) 142typedef __int64 intptr_t; 143#else 144typedef __int32 intptr_t; 145#endif 146 147#endif /* !defined( HAVE_INTPTR_T ) */ 148 149#endif /* defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0560 ) */ 150 151#if ( !defined( HAVE_SIZE32_T ) && ! @HAVE_SIZE32_T@ ) || HAVE_SIZE32_T == 0 152#define HAVE_SIZE32_T 1 153typedef uint32_t size32_t; 154#endif 155 156#if ( !defined( HAVE_SSIZE32_T ) && ! @HAVE_SSIZE32_T@ ) || HAVE_SSIZE32_T == 0 157#define HAVE_SSIZE32_T 1 158typedef int32_t ssize32_t; 159#endif 160 161#if ( !defined( HAVE_SIZE64_T ) && ! @HAVE_SIZE64_T@ ) || HAVE_SIZE64_T == 0 162#define HAVE_SIZE64_T 1 163typedef uint64_t size64_t; 164#endif 165 166#if ( !defined( HAVE_SSIZE64_T ) && ! @HAVE_SSIZE64_T@ ) || HAVE_SSIZE64_T == 0 167#define HAVE_SSIZE64_T 1 168typedef int64_t ssize64_t; 169#endif 170 171#if ( !defined( HAVE_OFF64_T ) && ! @HAVE_OFF64_T@ ) || HAVE_OFF64_T == 0 172#define HAVE_OFF64_T 1 173typedef int64_t off64_t; 174#endif 175 176/* Wide character definition 177 */ 178#if defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x0520 ) 179#include <string.h> 180 181#elif defined( WINAPI ) 182#include <wchar.h> 183 184#elif @HAVE_WCHAR_H@ || defined( HAVE_WCHAR_H ) 185 186/* __USE_UNIX98 is required to add swprintf definition 187 */ 188#if !defined( __USE_UNIX98 ) 189#define __USE_UNIX98 190#define LIBEVTX_DEFINITION_UNIX98 191#endif 192 193#include <wchar.h> 194 195#if defined( LIBEVTX_DEFINITION_UNIX98 ) 196#undef __USE_UNIX98 197#undef LIBEVTX_DEFINITION_UNIX98 198#endif 199 200#endif 201 202/* The following type definitions hide internal data structures 203 */ 204typedef intptr_t libevtx_file_t; 205typedef intptr_t libevtx_record_t; 206typedef intptr_t libevtx_template_definition_t; 207 208#ifdef __cplusplus 209} 210#endif 211 212#endif /* !defined( _LIBEVTX_TYPES_H ) */ 213 214