| 1 | /* Types.h -- Basic types |
| 2 | 2008-11-23 : Igor Pavlov : Public domain */ |
| 3 | |
| 4 | #ifndef __7Z_TYPES_H |
| 5 | #define __7Z_TYPES_Hcxx . . $ `compression/lzma/Types.h:5:9`! |
| 6 | |
| 7 | #include <stddef.h> |
| 8 | |
| 9 | #ifdef _WIN32 |
| 10 | #include <windows.h> |
| 11 | #endif |
| 12 | |
| 13 | #define SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`! 0 |
| 14 | |
| 15 | #define SZ_ERROR_DATAcxx . . $ `compression/lzma/Types.h:15:9`! 1 |
| 16 | #define SZ_ERROR_MEMcxx . . $ `compression/lzma/Types.h:16:9`! 2 |
| 17 | #define SZ_ERROR_CRCcxx . . $ `compression/lzma/Types.h:17:9`! 3 |
| 18 | #define SZ_ERROR_UNSUPPORTEDcxx . . $ `compression/lzma/Types.h:18:9`! 4 |
| 19 | #define SZ_ERROR_PARAMcxx . . $ `compression/lzma/Types.h:19:9`! 5 |
| 20 | #define SZ_ERROR_INPUT_EOFcxx . . $ `compression/lzma/Types.h:20:9`! 6 |
| 21 | #define SZ_ERROR_OUTPUT_EOFcxx . . $ `compression/lzma/Types.h:21:9`! 7 |
| 22 | #define SZ_ERROR_READcxx . . $ `compression/lzma/Types.h:22:9`! 8 |
| 23 | #define SZ_ERROR_WRITEcxx . . $ `compression/lzma/Types.h:23:9`! 9 |
| 24 | #define SZ_ERROR_PROGRESScxx . . $ `compression/lzma/Types.h:24:9`! 10 |
| 25 | #define SZ_ERROR_FAILcxx . . $ `compression/lzma/Types.h:25:9`! 11 |
| 26 | #define SZ_ERROR_THREADcxx . . $ `compression/lzma/Types.h:26:9`! 12 |
| 27 | |
| 28 | #define SZ_ERROR_ARCHIVEcxx . . $ `compression/lzma/Types.h:28:9`! 16 |
| 29 | #define SZ_ERROR_NO_ARCHIVEcxx . . $ `compression/lzma/Types.h:29:9`! 17 |
| 30 | |
| 31 | typedef int SRescxx . . $ SRes#; |
| 32 | |
| 33 | #ifdef _WIN32 |
| 34 | typedef DWORD WRes; |
| 35 | #else |
| 36 | typedef int WRescxx . . $ WRes#; |
| 37 | #endif |
| 38 | |
| 39 | #ifndef RINOK |
| 40 | #define RINOKcxx . . $ `compression/lzma/Types.h:40:9`!(x) { int __result__ = (x); if (__result__ != 0) return __result__; } |
| 41 | #endif |
| 42 | |
| 43 | typedef unsigned char Bytecxx . . $ Byte#; |
| 44 | typedef short Int16cxx . . $ Int16#; |
| 45 | typedef unsigned short UInt16cxx . . $ UInt16#; |
| 46 | |
| 47 | #ifdef _LZMA_UINT32_IS_ULONG |
| 48 | typedef long Int32; |
| 49 | typedef unsigned long UInt32; |
| 50 | #else |
| 51 | typedef int Int32cxx . . $ Int32#; |
| 52 | typedef unsigned int UInt32cxx . . $ UInt32#; |
| 53 | #endif |
| 54 | |
| 55 | #ifdef _SZ_NO_INT_64 |
| 56 | |
| 57 | /* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers. |
| 58 | NOTES: Some code will work incorrectly in that case! */ |
| 59 | |
| 60 | typedef long Int64; |
| 61 | typedef unsigned long UInt64; |
| 62 | |
| 63 | #else |
| 64 | |
| 65 | #if defined(_MSC_VER) || defined(__BORLANDC__) |
| 66 | typedef __int64 Int64; |
| 67 | typedef unsigned __int64 UInt64; |
| 68 | #else |
| 69 | typedef long long int Int64cxx . . $ Int64#; |
| 70 | typedef unsigned long long int UInt64cxx . . $ UInt64#; |
| 71 | #endif |
| 72 | |
| 73 | #endif |
| 74 | |
| 75 | #ifdef _LZMA_NO_SYSTEM_SIZE_T |
| 76 | typedef UInt32 SizeT; |
| 77 | #else |
| 78 | typedef size_tcxx . . $ size_t# SizeTcxx . . $ SizeT#; |
| 79 | #endif |
| 80 | |
| 81 | typedef int Boolcxx . . $ Bool#; |
| 82 | #define Truecxx . . $ `compression/lzma/Types.h:82:9`! 1 |
| 83 | #define Falsecxx . . $ `compression/lzma/Types.h:83:9`! 0 |
| 84 | |
| 85 | |
| 86 | #ifdef _MSC_VER |
| 87 | |
| 88 | #if _MSC_VER >= 1300 |
| 89 | #define MY_NO_INLINE __declspec(noinline) |
| 90 | #else |
| 91 | #define MY_NO_INLINE |
| 92 | #endif |
| 93 | |
| 94 | #define MY_CDECL __cdecl |
| 95 | #define MY_STD_CALL __stdcall |
| 96 | #define MY_FAST_CALL MY_NO_INLINE __fastcall |
| 97 | |
| 98 | #else |
| 99 | |
| 100 | #define MY_CDECLcxx . . $ `compression/lzma/Types.h:100:9`! |
| 101 | #define MY_STD_CALLcxx . . $ `compression/lzma/Types.h:101:9`! |
| 102 | #define MY_FAST_CALLcxx . . $ `compression/lzma/Types.h:102:9`! |
| 103 | |
| 104 | #endif |
| 105 | |
| 106 | |
| 107 | /* The following interfaces use first parameter as pointer to structure */ |
| 108 | |
| 109 | typedef struct ISeqInStreamcxx . . $ ISeqInStream# |
| 110 | { |
| 111 | SRescxx . . $ SRes# (*Readcxx . . $ ISeqInStream#Read.)(void *p, void *buf, size_tcxx . . $ size_t# *size); |
| 112 | /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. |
| 113 | (output(*size) < input(*size)) is allowed */ |
| 114 | } ISeqInStreamcxx . . $ ISeqInStream#; |
| 115 | |
| 116 | /* it can return SZ_ERROR_INPUT_EOF */ |
| 117 | SRescxx . . $ SRes# SeqInStream_Readcxx . . $ SeqInStream_Read(62c30610801b8968).(ISeqInStreamcxx . . $ ISeqInStream# *stream, void *buf, size_tcxx . . $ size_t# size); |
| 118 | SRescxx . . $ SRes# SeqInStream_Read2cxx . . $ SeqInStream_Read2(ab7d966e5d8065bf).(ISeqInStreamcxx . . $ ISeqInStream# *stream, void *buf, size_tcxx . . $ size_t# size, SRescxx . . $ SRes# errorType); |
| 119 | SRescxx . . $ SRes# SeqInStream_ReadBytecxx . . $ SeqInStream_ReadByte(5ca12151d40fc2f5).(ISeqInStreamcxx . . $ ISeqInStream# *stream, Bytecxx . . $ Byte# *buf); |
| 120 | |
| 121 | typedef struct ISeqOutStreamcxx . . $ ISeqOutStream# |
| 122 | { |
| 123 | size_tcxx . . $ size_t# (*Writecxx . . $ ISeqOutStream#Write.)(void *p, const void *buf, size_tcxx . . $ size_t# size); |
| 124 | /* Returns: result - the number of actually written bytes. |
| 125 | (result < size) means error */ |
| 126 | } ISeqOutStreamcxx . . $ ISeqOutStream#; |
| 127 | |
| 128 | typedef enum ESzSeekcxx . . $ ESzSeek# |
| 129 | { |
| 130 | SZ_SEEK_SETcxx . . $ SZ_SEEK_SET. = 0, |
| 131 | SZ_SEEK_CURcxx . . $ SZ_SEEK_CUR. = 1, |
| 132 | SZ_SEEK_ENDcxx . . $ SZ_SEEK_END. = 2 |
| 133 | } ESzSeekcxx . . $ ESzSeek#; |
| 134 | |
| 135 | typedef struct ISeekInStreamcxx . . $ ISeekInStream# |
| 136 | { |
| 137 | SRescxx . . $ SRes# (*Readcxx . . $ ISeekInStream#Read.)(void *p, void *buf, size_tcxx . . $ size_t# *size); /* same as ISeqInStream::Read */ |
| 138 | SRescxx . . $ SRes# (*Seekcxx . . $ ISeekInStream#Seek.)(void *p, Int64cxx . . $ Int64# *pos, ESzSeekcxx . . $ ESzSeek# origin); |
| 139 | } ISeekInStreamcxx . . $ ISeekInStream#; |
| 140 | |
| 141 | typedef struct ILookInStreamcxx . . $ ILookInStream# |
| 142 | { |
| 143 | SRescxx . . $ SRes# (*Lookcxx . . $ ILookInStream#Look.)(void *p, void **buf, size_tcxx . . $ size_t# *size); |
| 144 | /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream. |
| 145 | (output(*size) > input(*size)) is not allowed |
| 146 | (output(*size) < input(*size)) is allowed */ |
| 147 | SRescxx . . $ SRes# (*Skipcxx . . $ ILookInStream#Skip.)(void *p, size_tcxx . . $ size_t# offset); |
| 148 | /* offset must be <= output(*size) of Look */ |
| 149 | |
| 150 | SRescxx . . $ SRes# (*Readcxx . . $ ILookInStream#Read.)(void *p, void *buf, size_tcxx . . $ size_t# *size); |
| 151 | /* reads directly (without buffer). It's same as ISeqInStream::Read */ |
| 152 | SRescxx . . $ SRes# (*Seekcxx . . $ ILookInStream#Seek.)(void *p, Int64cxx . . $ Int64# *pos, ESzSeekcxx . . $ ESzSeek# origin); |
| 153 | } ILookInStreamcxx . . $ ILookInStream#; |
| 154 | |
| 155 | SRescxx . . $ SRes# LookInStream_LookReadcxx . . $ LookInStream_LookRead(a1e836c4924378ea).(ILookInStreamcxx . . $ ILookInStream# *stream, void *buf, size_tcxx . . $ size_t# *size); |
| 156 | SRescxx . . $ SRes# LookInStream_SeekTocxx . . $ LookInStream_SeekTo(9e87856dc9babb7b).(ILookInStreamcxx . . $ ILookInStream# *stream, UInt64cxx . . $ UInt64# offset); |
| 157 | |
| 158 | /* reads via ILookInStream::Read */ |
| 159 | SRescxx . . $ SRes# LookInStream_Read2cxx . . $ LookInStream_Read2(fbdef408d3842817).(ILookInStreamcxx . . $ ILookInStream# *stream, void *buf, size_tcxx . . $ size_t# size, SRescxx . . $ SRes# errorType); |
| 160 | SRescxx . . $ SRes# LookInStream_Readcxx . . $ LookInStream_Read(6c146b9e635922e9).(ILookInStreamcxx . . $ ILookInStream# *stream, void *buf, size_tcxx . . $ size_t# size); |
| 161 | |
| 162 | #define LookToRead_BUF_SIZEcxx . . $ `compression/lzma/Types.h:162:9`! (1 << 14) |
| 163 | |
| 164 | typedef struct CLookToReadcxx . . $ CLookToRead# |
| 165 | { |
| 166 | ILookInStreamcxx . . $ ILookInStream# scxx . . $ CLookToRead#s.; |
| 167 | ISeekInStreamcxx . . $ ISeekInStream# *realStreamcxx . . $ CLookToRead#realStream.; |
| 168 | size_tcxx . . $ size_t# poscxx . . $ CLookToRead#pos.; |
| 169 | size_tcxx . . $ size_t# sizecxx . . $ CLookToRead#size.; |
| 170 | Bytecxx . . $ Byte# bufcxx . . $ CLookToRead#buf.[LookToRead_BUF_SIZEcxx . . $ `compression/lzma/Types.h:162:9`!]; |
| 171 | } CLookToReadcxx . . $ CLookToRead#; |
| 172 | |
| 173 | void LookToRead_CreateVTablecxx . . $ LookToRead_CreateVTable(a28284ae8422eec9).(CLookToReadcxx . . $ CLookToRead# *p, int lookahead); |
| 174 | void LookToRead_Initcxx . . $ LookToRead_Init(81c89bd0cac403f9).(CLookToReadcxx . . $ CLookToRead# *p); |
| 175 | |
| 176 | typedef struct CSecToLookcxx . . $ CSecToLook# |
| 177 | { |
| 178 | ISeqInStreamcxx . . $ ISeqInStream# scxx . . $ CSecToLook#s.; |
| 179 | ILookInStreamcxx . . $ ILookInStream# *realStreamcxx . . $ CSecToLook#realStream.; |
| 180 | } CSecToLookcxx . . $ CSecToLook#; |
| 181 | |
| 182 | void SecToLook_CreateVTablecxx . . $ SecToLook_CreateVTable(6ba0bdf0f6f47cd1).(CSecToLookcxx . . $ CSecToLook# *p); |
| 183 | |
| 184 | typedef struct CSecToReadcxx . . $ CSecToRead# |
| 185 | { |
| 186 | ISeqInStreamcxx . . $ ISeqInStream# scxx . . $ CSecToRead#s.; |
| 187 | ILookInStreamcxx . . $ ILookInStream# *realStreamcxx . . $ CSecToRead#realStream.; |
| 188 | } CSecToReadcxx . . $ CSecToRead#; |
| 189 | |
| 190 | void SecToRead_CreateVTablecxx . . $ SecToRead_CreateVTable(6dc10112f64d0a40).(CSecToReadcxx . . $ CSecToRead# *p); |
| 191 | |
| 192 | typedef struct ICompressProgresscxx . . $ ICompressProgress# |
| 193 | { |
| 194 | SRescxx . . $ SRes# (*Progresscxx . . $ ICompressProgress#Progress.)(void *p, UInt64cxx . . $ UInt64# inSize, UInt64cxx . . $ UInt64# outSize); |
| 195 | /* Returns: result. (result != SZ_OK) means break. |
| 196 | Value (UInt64)(Int64)-1 for size means unknown value. */ |
| 197 | } ICompressProgresscxx . . $ ICompressProgress#; |
| 198 | |
| 199 | typedef struct ISzAlloccxx . . $ ISzAlloc# |
| 200 | { |
| 201 | void *(*Alloccxx . . $ ISzAlloc#Alloc.)(void *p, size_tcxx . . $ size_t# size); |
| 202 | void (*Freecxx . . $ ISzAlloc#Free.)(void *p, void *address); /* address can be 0 */ |
| 203 | } ISzAlloccxx . . $ ISzAlloc#; |
| 204 | |
| 205 | #define IAlloc_Alloccxx . . $ `compression/lzma/Types.h:205:9`!(p, size) (p)->Alloc((p), size) |
| 206 | #define IAlloc_Freecxx . . $ `compression/lzma/Types.h:206:9`!(p, a) (p)->Free((p), a) |
| 207 | |
| 208 | #endif |