LZOCONF.H 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* lzoconf.h -- configuration for the LZO real-time data compression library
  15. This file is part of the LZO real-time data compression library.
  16. Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
  17. The LZO library is free software; you can redistribute it and/or
  18. modify it under the terms of the GNU Library General Public
  19. License as published by the Free Software Foundation; either
  20. version 2 of the License, or (at your option) any later version.
  21. The LZO library is distributed in the hope that it will be useful,
  22. but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. Library General Public License for more details.
  25. You should have received a copy of the GNU Library General Public
  26. License along with the LZO library; see the file COPYING.LIB.
  27. If not, write to the Free Software Foundation, Inc.,
  28. 675 Mass Ave, Cambridge, MA 02139, USA.
  29. Markus F.X.J. Oberhumer
  30. [email protected]
  31. */
  32. #ifndef __LZOCONF_H
  33. #define __LZOCONF_H
  34. #define LZO_VERSION 0x0200
  35. #define LZO_VERSION_STRING "0.20"
  36. #define LZO_VERSION_DATE "11 Aug 1996"
  37. #include <limits.h> /* CHAR_BIT, UINT_MAX, ULONG_MAX */
  38. #if !defined(CHAR_BIT) || (CHAR_BIT != 8)
  39. # error invalid CHAR_BIT
  40. #endif
  41. //#ifdef __cplusplus
  42. //extern "C" {
  43. //#endif
  44. /***********************************************************************
  45. // defines
  46. ************************************************************************/
  47. #if defined(__MSDOS__) || defined(MSDOS)
  48. # define __LZO_MSDOS
  49. # if (UINT_MAX < 0xffffffffL)
  50. # define __LZO_MSDOS16
  51. # endif
  52. #endif
  53. /***********************************************************************
  54. // integral and pointer types
  55. ************************************************************************/
  56. /* Unsigned type with 32 bits or more */
  57. #if (UINT_MAX >= 0xffffffffL)
  58. typedef unsigned int lzo_uint;
  59. typedef int lzo_int;
  60. # define LZO_UINT_MAX UINT_MAX
  61. #elif (ULONG_MAX >= 0xffffffffL)
  62. typedef unsigned long lzo_uint;
  63. typedef long lzo_int;
  64. # define LZO_UINT_MAX ULONG_MAX
  65. #else
  66. # error lzo_uint
  67. #endif
  68. /* Memory model that allows to access memory at offsets of lzo_uint.
  69. * Huge pointers (16 bit MSDOS) are somewhat slow, but they work
  70. * fine and I really don't care about 16 bit compiler
  71. * optimizations nowadays.
  72. */
  73. #if (LZO_UINT_MAX <= UINT_MAX)
  74. # define __LZO_MMODEL
  75. #elif defined(__LZO_MSDOS16)
  76. # define __LZO_MMODEL huge
  77. # define __LZO_ENTRY __cdecl
  78. #else
  79. # error __LZO_MMODEL
  80. #endif
  81. /* no typedef here because of const-pointer issues */
  82. #define lzo_byte unsigned char __LZO_MMODEL
  83. #define lzo_voidp void __LZO_MMODEL *
  84. #define lzo_bytep unsigned char __LZO_MMODEL *
  85. #define lzo_uintp lzo_uint __LZO_MMODEL *
  86. #define lzo_intp lzo_int __LZO_MMODEL *
  87. #define lzo_voidpp lzo_voidp __LZO_MMODEL *
  88. #define lzo_bytepp lzo_bytep __LZO_MMODEL *
  89. /* Unsigned type that can store all bits of a lzo_voidp */
  90. typedef unsigned long lzo_ptr_t;
  91. /* Align a pointer on a boundary that is a multiple of 'size' */
  92. #define LZO_ALIGN(ptr,size) \
  93. ((lzo_voidp) (((lzo_ptr_t)(ptr) + (size)-1) & ~((lzo_ptr_t)((size)-1))))
  94. /***********************************************************************
  95. // function types
  96. ************************************************************************/
  97. //#ifdef __cplusplus
  98. //# define LZO_EXTERN_C extern "C"
  99. //#else
  100. # define LZO_EXTERN_C extern
  101. //#endif
  102. #if !defined(__LZO_ENTRY) /* calling convention */
  103. # define __LZO_ENTRY
  104. #endif
  105. #if !defined(__LZO_EXPORT) /* DLL export (and maybe size) information */
  106. # define __LZO_EXPORT
  107. #endif
  108. #if !defined(LZO_EXTERN)
  109. # define LZO_EXTERN(_rettype) LZO_EXTERN_C _rettype __LZO_ENTRY __LZO_EXPORT
  110. #endif
  111. typedef int __LZO_ENTRY
  112. (__LZO_EXPORT *lzo_compress_t) ( const lzo_byte *src, lzo_uint src_len,
  113. lzo_byte *dst, lzo_uint *dst_len,
  114. lzo_voidp wrkmem );
  115. typedef int __LZO_ENTRY
  116. (__LZO_EXPORT *lzo_decompress_t)( const lzo_byte *src, lzo_uint src_len,
  117. lzo_byte *dst, lzo_uint *dst_len,
  118. lzo_voidp wrkmem );
  119. /* a progress indicator callback function */
  120. typedef void __LZO_ENTRY
  121. (__LZO_EXPORT *lzo_progress_callback_t)(lzo_uint,lzo_uint);
  122. /***********************************************************************
  123. // error codes and prototypes
  124. ************************************************************************/
  125. /* Error codes for the compression/decompression functions. Negative
  126. * values are errors, positive values will be used for special but
  127. * normal events.
  128. */
  129. #define LZO_E_OK 0
  130. #define LZO_E_ERROR (-1)
  131. #define LZO_E_NOT_COMPRESSIBLE (-2) /* not used right now */
  132. #define LZO_E_EOF_NOT_FOUND (-3)
  133. #define LZO_E_INPUT_OVERRUN (-4)
  134. #define LZO_E_OUTPUT_OVERRUN (-5)
  135. #define LZO_E_LOOKBEHIND_OVERRUN (-6)
  136. #define LZO_E_OUT_OF_MEMORY (-7) /* not used right now */
  137. /* this should be the first function you call. Check the return code ! */
  138. LZO_EXTERN(int) lzo_init(void);
  139. /* version functions (useful for shared libraries) */
  140. LZO_EXTERN(unsigned) lzo_version(void);
  141. LZO_EXTERN(const char *) lzo_version_string(void);
  142. /* string functions */
  143. LZO_EXTERN(int)
  144. lzo_memcmp(const lzo_voidp _s1, const lzo_voidp _s2, lzo_uint _len);
  145. LZO_EXTERN(lzo_voidp)
  146. lzo_memcpy(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
  147. LZO_EXTERN(lzo_voidp)
  148. lzo_memmove(lzo_voidp _dest, const lzo_voidp _src, lzo_uint _len);
  149. LZO_EXTERN(lzo_voidp)
  150. lzo_memset(lzo_voidp _s, int _c, lzo_uint _len);
  151. /* checksum functions */
  152. LZO_EXTERN(lzo_uint)
  153. lzo_adler32(lzo_uint _adler, const lzo_byte *_buf, lzo_uint _len);
  154. /* misc. */
  155. LZO_EXTERN(int) lzo_assert(int _expr);
  156. LZO_EXTERN(int) _lzo_config_check(void);
  157. //#ifdef __cplusplus
  158. //} /* extern "C" */
  159. //#endif
  160. #endif /* already included */
  161. /*
  162. vi:ts=4
  163. */