gzdoom-last-svn/lzma/C/Types.h

213 lines
4.8 KiB
C
Raw Normal View History

/* Types.h -- Basic types
2008-11-23 : Igor Pavlov : Public domain */
#ifndef __7Z_TYPES_H
#define __7Z_TYPES_H
#include <stddef.h>
Update to ZDoom r1552: - Gave the intermission screen sounds their own SNDINFO entries. - Removed obsolete snd_surround cvar. - Changing screen resolution now adjusts the automap scale to be constant relative to screen resolution. - Fixed: When FMultiPatchTexture::MakeTexture() needed to work in RGB colorspace, it didn't zero out the temporary buffer. - Fixed memory leak from leftover code for 7z loading and added the LUMPF_ZIPFILE flag to their contents so they have the same semantics as zips. - Added support for 7z archives. - Added -noautoload option. - Added default Raven automap colors set. Needs to be tested because I can't compare against the DOS version myself. - Extened A_PlaySound and A_StopSound to be able to set all parameters of the internal sound code. - Changed gravity doubling so that it only happens when you run off a ledge. - Fixed: World panning was ignored for the X offset of masked midtextures. - Extended MF5_MOVEWITHSECTOR so that it always keeps the actor on the ground of a moving floor, regardless of movement speed. For NOBLOCKMAP items this is necessary because otherwise they can be left in the air and it also adds some options for other things. - Changed A_FreezeDeathChunks() so that instead of directly destroying an actor, it sets it to the "Null" state, which will make it invisible and destroy it one tic later. - Added a NULL pointer check to A_Fire() and copied the target to a local variable inside A_VileAttack() so that if P_DamageMobj() destroys the target, the function will still have a valid pointer to it (since reading it from the actor's instance data invokes the read barrier, which would return NULL). - Added NOBLOCKMAP/MOVEWITHSECTOR combination to a few items that had their NOBLOCKMAP flag taken away previously to make them move with a sector. This should fix the performance problem Claustrophobia had with recent ZDoom versions. - Added MF5_MOVEWITHSECTOR flag, so you can have the benefits of MF_NOBLOCKMAP but still have actors that will move up and down with the floor. IceChunk now uses both of these flags. - Performance optimization for FBlockThingsIterator::Next(): Actors that exist in only one block don't need to be added to the CheckArray or scanned for in it. Also changed the array used to keep track of visited actors into a hash table. - added some default definitions for constants that may miss in some headers. - replaced __va_copy with va_copy per Chris's suggestion. - replaced #include <malloc.h> with #include <stdlib.h> where possible. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@322 b0f79afe-0144-0410-b225-9a4edf0717df
2009-04-19 06:46:53 +00:00
#ifdef __cplusplus
extern "C" {
#endif
#define SZ_OK 0
#define SZ_ERROR_DATA 1
#define SZ_ERROR_MEM 2
#define SZ_ERROR_CRC 3
#define SZ_ERROR_UNSUPPORTED 4
#define SZ_ERROR_PARAM 5
#define SZ_ERROR_INPUT_EOF 6
#define SZ_ERROR_OUTPUT_EOF 7
#define SZ_ERROR_READ 8
#define SZ_ERROR_WRITE 9
#define SZ_ERROR_PROGRESS 10
#define SZ_ERROR_FAIL 11
#define SZ_ERROR_THREAD 12
#define SZ_ERROR_ARCHIVE 16
#define SZ_ERROR_NO_ARCHIVE 17
typedef int SRes;
#ifndef RINOK
#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
#endif
#if defined(__APPLE__) && !__LP64__
#define _LZMA_UINT32_IS_ULONG
#endif
#ifndef ZCONF_H
typedef unsigned char Byte;
#endif
typedef short Int16;
typedef unsigned short UInt16;
#ifdef _LZMA_UINT32_IS_ULONG
typedef long Int32;
typedef unsigned long UInt32;
#else
typedef int Int32;
typedef unsigned int UInt32;
#endif
#ifdef _SZ_NO_INT_64
/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
NOTES: Some code will work incorrectly in that case! */
typedef long Int64;
typedef unsigned long UInt64;
#else
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef __int64 Int64;
typedef unsigned __int64 UInt64;
#else
typedef long long int Int64;
typedef unsigned long long int UInt64;
#endif
#endif
#ifdef _LZMA_NO_SYSTEM_SIZE_T
typedef UInt32 SizeT;
#else
typedef size_t SizeT;
#endif
typedef int Bool;
#define True 1
#define False 0
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#define MY_NO_INLINE __declspec(noinline)
#else
#define MY_NO_INLINE
#endif
#define MY_CDECL __cdecl
#define MY_STD_CALL __stdcall
#define MY_FAST_CALL MY_NO_INLINE __fastcall
#else
#define MY_CDECL
#define MY_STD_CALL
#define MY_FAST_CALL
#endif
/* The following interfaces use first parameter as pointer to structure */
typedef struct
{
SRes (*Read)(void *p, void *buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) < input(*size)) is allowed */
} ISeqInStream;
/* it can return SZ_ERROR_INPUT_EOF */
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size);
SRes SeqInStream_Read2(ISeqInStream *stream, void *buf, size_t size, SRes errorType);
SRes SeqInStream_ReadByte(ISeqInStream *stream, Byte *buf);
typedef struct
{
size_t (*Write)(void *p, const void *buf, size_t size);
/* Returns: result - the number of actually written bytes.
(result < size) means error */
} ISeqOutStream;
typedef enum
{
SZ_SEEK_SET = 0,
SZ_SEEK_CUR = 1,
SZ_SEEK_END = 2
} ESzSeek;
typedef struct
{
SRes (*Read)(void *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
} ISeekInStream;
typedef struct
{
SRes (*Look)(void *p, void **buf, size_t *size);
/* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
(output(*size) > input(*size)) is not allowed
(output(*size) < input(*size)) is allowed */
SRes (*Skip)(void *p, size_t offset);
/* offset must be <= output(*size) of Look */
SRes (*Read)(void *p, void *buf, size_t *size);
/* reads directly (without buffer). It's same as ISeqInStream::Read */
SRes (*Seek)(void *p, Int64 *pos, ESzSeek origin);
} ILookInStream;
SRes LookInStream_LookRead(ILookInStream *stream, void *buf, size_t *size);
SRes LookInStream_SeekTo(ILookInStream *stream, UInt64 offset);
/* reads via ILookInStream::Read */
SRes LookInStream_Read2(ILookInStream *stream, void *buf, size_t size, SRes errorType);
SRes LookInStream_Read(ILookInStream *stream, void *buf, size_t size);
#define LookToRead_BUF_SIZE (1 << 14)
typedef struct
{
ILookInStream s;
ISeekInStream *realStream;
size_t pos;
size_t size;
Byte buf[LookToRead_BUF_SIZE];
} CLookToRead;
void LookToRead_CreateVTable(CLookToRead *p, int lookahead);
void LookToRead_Init(CLookToRead *p);
typedef struct
{
ISeqInStream s;
ILookInStream *realStream;
} CSecToLook;
void SecToLook_CreateVTable(CSecToLook *p);
typedef struct
{
ISeqInStream s;
ILookInStream *realStream;
} CSecToRead;
void SecToRead_CreateVTable(CSecToRead *p);
typedef struct
{
SRes (*Progress)(void *p, UInt64 inSize, UInt64 outSize);
/* Returns: result. (result != SZ_OK) means break.
Value (UInt64)(Int64)-1 for size means unknown value. */
} ICompressProgress;
typedef struct
{
void *(*Alloc)(void *p, size_t size);
void (*Free)(void *p, void *address); /* address can be 0 */
} ISzAlloc;
#define IAlloc_Alloc(p, size) (p)->Alloc((p), size)
#define IAlloc_Free(p, a) (p)->Free((p), a)
Update to ZDoom r1552: - Gave the intermission screen sounds their own SNDINFO entries. - Removed obsolete snd_surround cvar. - Changing screen resolution now adjusts the automap scale to be constant relative to screen resolution. - Fixed: When FMultiPatchTexture::MakeTexture() needed to work in RGB colorspace, it didn't zero out the temporary buffer. - Fixed memory leak from leftover code for 7z loading and added the LUMPF_ZIPFILE flag to their contents so they have the same semantics as zips. - Added support for 7z archives. - Added -noautoload option. - Added default Raven automap colors set. Needs to be tested because I can't compare against the DOS version myself. - Extened A_PlaySound and A_StopSound to be able to set all parameters of the internal sound code. - Changed gravity doubling so that it only happens when you run off a ledge. - Fixed: World panning was ignored for the X offset of masked midtextures. - Extended MF5_MOVEWITHSECTOR so that it always keeps the actor on the ground of a moving floor, regardless of movement speed. For NOBLOCKMAP items this is necessary because otherwise they can be left in the air and it also adds some options for other things. - Changed A_FreezeDeathChunks() so that instead of directly destroying an actor, it sets it to the "Null" state, which will make it invisible and destroy it one tic later. - Added a NULL pointer check to A_Fire() and copied the target to a local variable inside A_VileAttack() so that if P_DamageMobj() destroys the target, the function will still have a valid pointer to it (since reading it from the actor's instance data invokes the read barrier, which would return NULL). - Added NOBLOCKMAP/MOVEWITHSECTOR combination to a few items that had their NOBLOCKMAP flag taken away previously to make them move with a sector. This should fix the performance problem Claustrophobia had with recent ZDoom versions. - Added MF5_MOVEWITHSECTOR flag, so you can have the benefits of MF_NOBLOCKMAP but still have actors that will move up and down with the floor. IceChunk now uses both of these flags. - Performance optimization for FBlockThingsIterator::Next(): Actors that exist in only one block don't need to be added to the CheckArray or scanned for in it. Also changed the array used to keep track of visited actors into a hash table. - added some default definitions for constants that may miss in some headers. - replaced __va_copy with va_copy per Chris's suggestion. - replaced #include <malloc.h> with #include <stdlib.h> where possible. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@322 b0f79afe-0144-0410-b225-9a4edf0717df
2009-04-19 06:46:53 +00:00
#ifdef __cplusplus
}
#endif
#endif