LZOCONF.H 6.7 KB

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