goat3d

annotate libs/openctm/liblzma/Types.h @ 43:1dcbe87b6a5d

ops, screwed up the GOAT3DAPI define
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 05 Dec 2013 18:49:19 +0200
parents
children
rev   line source
nuclear@14 1 /* Types.h -- Basic types
nuclear@14 2 2008-11-23 : Igor Pavlov : Public domain */
nuclear@14 3
nuclear@14 4 #ifndef __7Z_TYPES_H
nuclear@14 5 #define __7Z_TYPES_H
nuclear@14 6
nuclear@14 7 #include <stddef.h>
nuclear@14 8
nuclear@14 9 #ifdef _WIN32
nuclear@14 10 #include <windows.h>
nuclear@14 11 #endif
nuclear@14 12
nuclear@14 13 #include "NameMangle.h"
nuclear@14 14
nuclear@14 15 #define SZ_OK 0
nuclear@14 16
nuclear@14 17 #define SZ_ERROR_DATA 1
nuclear@14 18 #define SZ_ERROR_MEM 2
nuclear@14 19 #define SZ_ERROR_CRC 3
nuclear@14 20 #define SZ_ERROR_UNSUPPORTED 4
nuclear@14 21 #define SZ_ERROR_PARAM 5
nuclear@14 22 #define SZ_ERROR_INPUT_EOF 6
nuclear@14 23 #define SZ_ERROR_OUTPUT_EOF 7
nuclear@14 24 #define SZ_ERROR_READ 8
nuclear@14 25 #define SZ_ERROR_WRITE 9
nuclear@14 26 #define SZ_ERROR_PROGRESS 10
nuclear@14 27 #define SZ_ERROR_FAIL 11
nuclear@14 28 #define SZ_ERROR_THREAD 12
nuclear@14 29
nuclear@14 30 #define SZ_ERROR_ARCHIVE 16
nuclear@14 31 #define SZ_ERROR_NO_ARCHIVE 17
nuclear@14 32
nuclear@14 33 typedef int SRes;
nuclear@14 34
nuclear@14 35 #ifdef _WIN32
nuclear@14 36 typedef DWORD WRes;
nuclear@14 37 #else
nuclear@14 38 typedef int WRes;
nuclear@14 39 #endif
nuclear@14 40
nuclear@14 41 #ifndef RINOK
nuclear@14 42 #define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
nuclear@14 43 #endif
nuclear@14 44
nuclear@14 45 typedef unsigned char Byte;
nuclear@14 46 typedef short Int16;
nuclear@14 47 typedef unsigned short UInt16;
nuclear@14 48
nuclear@14 49 #ifdef _LZMA_UINT32_IS_ULONG
nuclear@14 50 typedef long Int32;
nuclear@14 51 typedef unsigned long UInt32;
nuclear@14 52 #else
nuclear@14 53 typedef int Int32;
nuclear@14 54 typedef unsigned int UInt32;
nuclear@14 55 #endif
nuclear@14 56
nuclear@14 57 #ifdef _SZ_NO_INT_64
nuclear@14 58
nuclear@14 59 /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
nuclear@14 60 NOTES: Some code will work incorrectly in that case! */
nuclear@14 61
nuclear@14 62 typedef long Int64;
nuclear@14 63 typedef unsigned long UInt64;
nuclear@14 64
nuclear@14 65 #else
nuclear@14 66
nuclear@14 67 #if defined(_MSC_VER) || defined(__BORLANDC__)
nuclear@14 68 typedef __int64 Int64;
nuclear@14 69 typedef unsigned __int64 UInt64;
nuclear@14 70 #else
nuclear@14 71 typedef long long int Int64;
nuclear@14 72 typedef unsigned long long int UInt64;
nuclear@14 73 #endif
nuclear@14 74
nuclear@14 75 #endif
nuclear@14 76
nuclear@14 77 #ifdef _LZMA_NO_SYSTEM_SIZE_T
nuclear@14 78 typedef UInt32 SizeT;
nuclear@14 79 #else
nuclear@14 80 typedef size_t SizeT;
nuclear@14 81 #endif
nuclear@14 82
nuclear@14 83 typedef int Bool;
nuclear@14 84 #define True 1
nuclear@14 85 #define False 0
nuclear@14 86
nuclear@14 87
nuclear@14 88 #ifdef _MSC_VER
nuclear@14 89
nuclear@14 90 #if _MSC_VER >= 1300
nuclear@14 91 #define MY_NO_INLINE __declspec(noinline)
nuclear@14 92 #else
nuclear@14 93 #define MY_NO_INLINE
nuclear@14 94 #endif
nuclear@14 95
nuclear@14 96 #define MY_CDECL __cdecl
nuclear@14 97 #define MY_STD_CALL __stdcall
nuclear@14 98 #define MY_FAST_CALL MY_NO_INLINE __fastcall
nuclear@14 99
nuclear@14 100 #else
nuclear@14 101
nuclear@14 102 #define MY_CDECL
nuclear@14 103 #define MY_STD_CALL
nuclear@14 104 #define MY_FAST_CALL
nuclear@14 105
nuclear@14 106 #endif
nuclear@14 107
nuclear@14 108
nuclear@14 109 /* The following interfaces use first parameter as pointer to structure */
nuclear@14 110
nuclear@14 111 typedef struct
nuclear@14 112 {
nuclear@14 113 SRes (*Read)(void *p, void *buf, size_t *size);
nuclear@14 114 /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
nuclear@14 115 (output(*size) < input(*size)) is allowed */
nuclear@14 116 } ISeqInStream;
nuclear@14 117
nuclear@14 118 /* it can return SZ_ERROR_INPUT_EOF */
nuclear@14 119 SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
nuclear@14 120 SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
nuclear@14 121 SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
nuclear@14 122
nuclear@14 123 typedef struct
nuclear@14 124 {
nuclear@14 125 size_t (*Write)(void *p, const void *buf, size_t size);
nuclear@14 126 /* Returns: result - the number of actually written bytes.
nuclear@14 127 (result < size) means error */
nuclear@14 128 } ISeqOutStream;
nuclear@14 129
nuclear@14 130 typedef enum
nuclear@14 131 {
nuclear@14 132 SZ_SEEK_SET = 0,
nuclear@14 133 SZ_SEEK_CUR = 1,
nuclear@14 134 SZ_SEEK_END = 2
nuclear@14 135 } ESzSeek;
nuclear@14 136
nuclear@14 137 typedef struct
nuclear@14 138 {
nuclear@14 139 SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
nuclear@14 140 SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
nuclear@14 141 } ISeekInStream;
nuclear@14 142
nuclear@14 143 typedef struct
nuclear@14 144 {
nuclear@14 145 SRes (*Look)(void *p, void **buf, size_t *size);
nuclear@14 146 /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
nuclear@14 147 (output(*size) > input(*size)) is not allowed
nuclear@14 148 (output(*size) < input(*size)) is allowed */
nuclear@14 149 SRes (*Skip)(void *p, size_t offset);
nuclear@14 150 /* offset must be <= output(*size) of Look */
nuclear@14 151
nuclear@14 152 SRes (*Read)(void *p, void *buf, size_t *size);
nuclear@14 153 /* reads directly (without buffer). It's same as ISeqInStream::Read */
nuclear@14 154 SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
nuclear@14 155 } ILookInStream;
nuclear@14 156
nuclear@14 157 SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
nuclear@14 158 SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
nuclear@14 159
nuclear@14 160 /* reads via ILookInStream::Read */
nuclear@14 161 SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
nuclear@14 162 SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
nuclear@14 163
nuclear@14 164 #define LookToRead_BUF_SIZE (1 << 14)
nuclear@14 165
nuclear@14 166 typedef struct
nuclear@14 167 {
nuclear@14 168 ILookInStream s;
nuclear@14 169 ISeekInStream *realStream;
nuclear@14 170 size_t pos;
nuclear@14 171 size_t size;
nuclear@14 172 Byte buf[LookToRead_BUF_SIZE];
nuclear@14 173 } CLookToRead;
nuclear@14 174
nuclear@14 175 void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
nuclear@14 176 void LookToRead_Init(CLookToRead *p);
nuclear@14 177
nuclear@14 178 typedef struct
nuclear@14 179 {
nuclear@14 180 ISeqInStream s;
nuclear@14 181 ILookInStream *realStream;
nuclear@14 182 } CSecToLook;
nuclear@14 183
nuclear@14 184 void SecToLook_CreateVTable(CSecToLook *p);
nuclear@14 185
nuclear@14 186 typedef struct
nuclear@14 187 {
nuclear@14 188 ISeqInStream s;
nuclear@14 189 ILookInStream *realStream;
nuclear@14 190 } CSecToRead;
nuclear@14 191
nuclear@14 192 void SecToRead_CreateVTable(CSecToRead *p);
nuclear@14 193
nuclear@14 194 typedef struct
nuclear@14 195 {
nuclear@14 196 SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
nuclear@14 197 /* Returns: result. (result != SZ_OK) means break.
nuclear@14 198 Value (UInt64)(Int64)-1 for size means unknown value. */
nuclear@14 199 } ICompressProgress;
nuclear@14 200
nuclear@14 201 typedef struct
nuclear@14 202 {
nuclear@14 203 void *(*Alloc)(void *p, size_t size);
nuclear@14 204 void (*Free)(void *p, void *address); /* address can be 0 */
nuclear@14 205 } ISzAlloc;
nuclear@14 206
nuclear@14 207 #define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
nuclear@14 208 #define IAlloc_Free(p, a) (p)->Free((p), a)
nuclear@14 209
nuclear@14 210 #endif