lzoconf.h 8.4 KB

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