summaryrefslogtreecommitdiff
path: root/package/cfgfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'package/cfgfs/src')
-rw-r--r--package/cfgfs/src/BSDmakefile32
-rw-r--r--package/cfgfs/src/LICENCE35
-rw-r--r--package/cfgfs/src/Makefile40
-rw-r--r--package/cfgfs/src/Makefile.inc45
-rw-r--r--package/cfgfs/src/adler.h60
-rw-r--r--package/cfgfs/src/bundled/README.LZO123
-rw-r--r--package/cfgfs/src/bundled/lzoconf.h413
-rw-r--r--package/cfgfs/src/bundled/lzodefs.h1545
-rw-r--r--package/cfgfs/src/bundled/minilzo.c3826
-rw-r--r--package/cfgfs/src/bundled/minilzo.h102
-rw-r--r--package/cfgfs/src/c_lzo1x1.c126
-rw-r--r--package/cfgfs/src/c_null.c78
-rw-r--r--package/cfgfs/src/c_zlib.c84
-rw-r--r--package/cfgfs/src/compress.c78
-rw-r--r--package/cfgfs/src/compress.h52
-rw-r--r--package/cfgfs/src/cpr_get.c63
-rw-r--r--package/cfgfs/src/cpr_list.c46
-rw-r--r--package/cfgfs/src/cpr_lsth.c41
-rw-r--r--package/cfgfs/src/defs.h34
-rw-r--r--package/cfgfs/src/ft_creat.c304
-rw-r--r--package/cfgfs/src/ft_dump.c135
-rw-r--r--package/cfgfs/src/ft_pack.c134
-rw-r--r--package/cfgfs/src/ft_packm.c71
-rw-r--r--package/cfgfs/src/fts.c1118
-rw-r--r--package/cfgfs/src/fts_debg.c51
-rw-r--r--package/cfgfs/src/fts_gnu.h137
-rw-r--r--package/cfgfs/src/fts_subs.c163
-rw-r--r--package/cfgfs/src/fts_subs.h37
-rw-r--r--package/cfgfs/src/fwcf.helper/Makefile51
-rw-r--r--package/cfgfs/src/fwcf.sh384
-rw-r--r--package/cfgfs/src/fwcf.txt434
-rw-r--r--package/cfgfs/src/header.c83
-rw-r--r--package/cfgfs/src/lib/Makefile28
-rw-r--r--package/cfgfs/src/minilzop.c178
-rw-r--r--package/cfgfs/src/minilzop.h19
-rw-r--r--package/cfgfs/src/mkfwcf/Makefile23
-rw-r--r--package/cfgfs/src/mkfwcf/mkfwcf.c109
-rw-r--r--package/cfgfs/src/mtd.c379
-rw-r--r--package/cfgfs/src/pack.h95
-rw-r--r--package/cfgfs/src/replace.c39
-rw-r--r--package/cfgfs/src/replace.h6
-rw-r--r--package/cfgfs/src/sys_bsd.c96
-rw-r--r--package/cfgfs/src/sys_linux.c61
-rw-r--r--package/cfgfs/src/sysdeps.h17
-rw-r--r--package/cfgfs/src/tool.c302
-rw-r--r--package/cfgfs/src/tool/Makefile59
-rw-r--r--package/cfgfs/src/unfwcf/Makefile28
-rw-r--r--package/cfgfs/src/unfwcf/unfwcf.c100
-rw-r--r--package/cfgfs/src/unwraps.c95
-rw-r--r--package/cfgfs/src/wraps.c103
50 files changed, 11662 insertions, 0 deletions
diff --git a/package/cfgfs/src/BSDmakefile b/package/cfgfs/src/BSDmakefile
new file mode 100644
index 000000000..4d3bf7a11
--- /dev/null
+++ b/package/cfgfs/src/BSDmakefile
@@ -0,0 +1,32 @@
+# $MirOS: contrib/hosted/fwcf/BSDmakefile,v 1.8 2007/03/13 18:14:30 tg Exp $
+#-
+# This file is part of the FreeWRT project. FreeWRT is copyrighted
+# material, please see the LICENCE file in the top-level directory
+# or at http://www.freewrt.org/licence for details.
+
+ SUBDIR+= lib
+ SUBDIR+= mkfwcf
+ SUBDIR+= unfwcf
+ SUBDIR+= tool
+ SUBDIR+= fwcf.helper
+
+test: _SUBDIRUSE
+
+.include <bsd.own.mk>
+COPTS?= # for OpenBSD
+.if !${COPTS:M-fhonour-copts} || !${CFLAGS:M-fhonour-copts}
+CFLAGS+= ${COPTS}
+.endif
+
+gmake:
+ -rm -rf gmake_test
+ mkdir -p gmake_test
+ cd gmake_test && lndir -e gmake_test ${.CURDIR}
+ cd gmake_test && CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} gmake
+
+clean_gmake:
+ -rm -rf gmake_test
+
+.include <bsd.subdir.mk>
+
+clean cleandir: clean_gmake
diff --git a/package/cfgfs/src/LICENCE b/package/cfgfs/src/LICENCE
new file mode 100644
index 000000000..af7542c91
--- /dev/null
+++ b/package/cfgfs/src/LICENCE
@@ -0,0 +1,35 @@
+FWCF is licenced material and developed for the FreeWRT Project by
+the following authors and contributors:
+
+Copyright © 2006, 2007
+ Thorsten Glaser <tg@mirbsd.de> (initial author)
+
+For more information on FreeWRT please visit http://freewrt.org/
+
+Provided that these terms and disclaimer and all copyright notices
+are retained or reproduced in an accompanying document, permission
+is granted to deal in this work without restriction, including un-
+limited rights to use, publicly perform, distribute, sell, modify,
+merge, give away, or sublicence.
+
+This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
+the utmost extent permitted by applicable law, neither express nor
+implied; without malicious intent or gross negligence. In no event
+may a licensor, author or contributor be held liable for indirect,
+direct, other damage, loss, or other issues arising in any way out
+of dealing in the work, even if advised of the possibility of such
+damage or existence of a defect, except proven that it results out
+of said person's immediate fault when using the work as intended.
+
+The initial author would really appreciate users to credit his na-
+me and that of the FreeWRT Project and/or add links to the CVS re-
+pository of the original source in derived works.
+
+The FWCF specification is licenced under different terms. Also the
+c_lzo1x plug-in is covered by the GNU General Public License, Ver-
+sion 1 or higher. The files in the bundled/ subdirectory are not a
+part of FWCF and covered by their own licenced. The version 1.0 of
+FWCF bundles MiniLZO from lzo-2.02 under the GPL 2 or higher only.
+
+⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼⎼
+$MirOS: contrib/hosted/fwcf/LICENCE,v 1.5 2007/03/13 18:31:07 tg Exp $
diff --git a/package/cfgfs/src/Makefile b/package/cfgfs/src/Makefile
new file mode 100644
index 000000000..7ab068c69
--- /dev/null
+++ b/package/cfgfs/src/Makefile
@@ -0,0 +1,40 @@
+# $MirOS: contrib/hosted/fwcf/GNUmakefile,v 1.8 2007/03/09 23:09:34 tg Exp $
+#-
+# This file is part of the FreeWRT project. FreeWRT is copyrighted
+# material, please see the LICENCE file in the top-level directory
+# or at http://www.freewrt.org/licence for details.
+
+SRCS+= tool.c
+SRCS+= sys_linux.c
+SRCS+= replace.c
+SRCS+= compress.c
+#SRCS+= fts_debg.c
+SRCS+= cpr_get.c
+SRCS+= cpr_list.c
+SRCS+= cpr_lsth.c
+SRCS+= ft_creat.c
+SRCS+= ft_pack.c
+SRCS+= ft_packm.c
+SRCS+= fts_subs.c
+SRCS+= header.c
+SRCS+= minilzop.c
+SRCS+= unwraps.c
+SRCS+= wraps.c
+
+# the compressor
+SRCS+= c_lzo1x1.c
+CPPFLAGS+= -Ibundled
+
+OBJS= ${SRCS:.c=.o}
+
+# build for the target
+CPPFLAGS+= -DSMALL -D__USE_GNU
+
+# missing in uClibc
+SRCS+= fts.c
+CPPFLAGS+= -I.
+
+all: fwcf.helper.out
+
+fwcf.helper.out: ${OBJS}
+ ${CC} -o $@ ${OBJS} ${LDFLAGS}
diff --git a/package/cfgfs/src/Makefile.inc b/package/cfgfs/src/Makefile.inc
new file mode 100644
index 000000000..82f7eb8f9
--- /dev/null
+++ b/package/cfgfs/src/Makefile.inc
@@ -0,0 +1,45 @@
+# $MirOS: contrib/hosted/fwcf/Makefile.inc,v 1.10 2007/05/08 21:52:53 tg Exp $
+#-
+# This file is part of the FreeWRT project. FreeWRT is copyrighted
+# material, please see the LICENCE file in the top-level directory
+# or at http://www.freewrt.org/licence for details.
+
+__CRAZY= Yes
+MKC_DEBG= cpp
+
+UNAME_S!= uname -s
+
+.ifndef LIB
+. if exists(${.CURDIR}/../lib/${__objdir})
+DPADD+= ${.CURDIR}/../lib/${__objdir}/libfwcf.a
+LDADD+= -L${.CURDIR}/../lib/${__objdir} -lfwcf
+. else
+DPADD+= ${.CURDIR}/../lib/libfwcf.a
+LDADD+= -L${.CURDIR}/../lib -lfwcf
+. endif
+.endif
+
+CPPFLAGS+= -I${.CURDIR}/..
+.PATH: ${.CURDIR}/..
+
+test: .NOTMAIN all
+
+COMPRESSORS+= c_null.c
+COMPRESSORS+= c_zlib.c
+CPPFLAGS+= -DZCONST=const
+
+COMPRESSORS+= c_lzo1x1.c
+MKDEP+= -I${.CURDIR}/../bundled
+CFLAGS_c_lzo1x1.o+= -I${.CURDIR}/../bundled -Wno-undef
+_CFLADD+= c_lzo1x1.o
+
+.if make(test)
+CFLAGS_sys_bsd.o+= -DRND_DISABLE
+_CFLADD+= sys_bsd.o
+.endif
+
+.if ${UNAME_S} == "OpenBSD"
+. for _i in ${_CFLADD}
+CFLAGS+= ${CFLAGS_${_i}}
+. endfor
+.endif
diff --git a/package/cfgfs/src/adler.h b/package/cfgfs/src/adler.h
new file mode 100644
index 000000000..a1608705f
--- /dev/null
+++ b/package/cfgfs/src/adler.h
@@ -0,0 +1,60 @@
+/* $MirOS: contrib/hosted/fwcf/adler.h,v 1.10 2007/05/07 16:15:56 tg Exp $ */
+
+/*-
+ * Copyright (c) 2006, 2007
+ * Thorsten Glaser <tg@mirbsd.de>
+ * The adler32 algorithm is
+ * Copyright (C) 1995 Mark Adler
+ *
+ * Provided that these terms and disclaimer and all copyright notices
+ * are retained or reproduced in an accompanying document, permission
+ * is granted to deal in this work without restriction, including un-
+ * limited rights to use, publicly perform, distribute, sell, modify,
+ * merge, give away, or sublicence.
+ *
+ * This work is provided "AS IS" and WITHOUT WARRANTY of any kind, to
+ * the utmost extent permitted by applicable law, neither express nor
+ * implied; without malicious intent or gross negligence. In no event
+ * may a licensor, author or contributor be held liable for indirect,
+ * direct, other damage, loss, or other issues arising in any way out
+ * of dealing in the work, even if advised of the possibility of such
+ * damage or existence of a defect, except proven that it results out
+ * of said person's immediate fault when using the work as intended.
+ *-
+ * See also:
+ * contrib/hosted/fwcf/adler.h
+ * src/lib/libc/hash/adh32.c
+ * src/kern/z/adler32s.c
+ * src/kern/z/adler32_i386.S
+ */
+
+#ifndef ADLER_H
+#define ADLER_H "$MirOS: contrib/hosted/fwcf/adler.h,v 1.10 2007/05/07 16:15:56 tg Exp $"
+
+/*
+ * ADLER-32 implementation
+ */
+
+#define ADLER_BASE 65521 /* largest prime smaller than 65536 */
+#define ADLER_NMAX 5552 /* largest n: 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
+
+/* declare everything needed by the adler32 routine */
+#define ADLER_DECL unsigned s1 = 1, s2 = 0, n
+
+/* calculate the adler32 crc of the data pointed to
+ by the 'buffer' argument, size expected in 'len'
+ which is TRASHED; stores the result in s1 and s2 */
+#define ADLER_CALC(buffer) do { \
+ const uint8_t *adler_buf = (const uint8_t *)(buffer); \
+ while (len) { \
+ len -= (n = MIN(len, ADLER_NMAX)); \
+ while (n--) { \
+ s1 += *adler_buf++; \
+ s2 += s1; \
+ } \
+ s1 %= ADLER_BASE; \
+ s2 %= ADLER_BASE; \
+ } \
+ } while (0)
+
+#endif
diff --git a/package/cfgfs/src/bundled/README.LZO b/package/cfgfs/src/bundled/README.LZO
new file mode 100644
index 000000000..2601baed0
--- /dev/null
+++ b/package/cfgfs/src/bundled/README.LZO
@@ -0,0 +1,123 @@
+
+ ============================================================================
+ miniLZO -- mini subset of the LZO real-time data compression library
+ ============================================================================
+
+ Author : Markus Franz Xaver Johannes Oberhumer
+ <markus@oberhumer.com>
+ http://www.oberhumer.com/opensource/lzo/
+ Version : 2.02
+ Date : 17 Oct 2005
+
+ I've created miniLZO for projects where it is inconvenient to
+ include (or require) the full LZO source code just because you
+ want to add a little bit of data compression to your application.
+
+ miniLZO implements the LZO1X-1 compressor and both the standard and
+ safe LZO1X decompressor. Apart from fast compression it also useful
+ for situations where you want to use pre-compressed data files (which
+ must have been compressed with LZO1X-999).
+
+ miniLZO consists of one C source file and three header files:
+ minilzo.c
+ minilzo.h, lzoconf.h, lzodefs.h
+
+ To use miniLZO just copy these files into your source directory, add
+ minilzo.c to your Makefile and #include minilzo.h from your program.
+ Note: you also must distribute this file (`README.LZO') with your project.
+
+ minilzo.o compiles to about 6 kB (using gcc or Visual C on a i386), and
+ the sources are about 30 kB when packed with zip - so there's no more
+ excuse that your application doesn't support data compression :-)
+
+ For more information, documentation, example programs and other support
+ files (like Makefiles and build scripts) please download the full LZO
+ package from
+ http://www.oberhumer.com/opensource/lzo/
+
+ Have fun,
+ Markus
+
+
+ P.S. minilzo.c is generated automatically from the LZO sources and
+ therefore functionality is completely identical
+
+
+ Appendix A: building miniLZO
+ ----------------------------
+ miniLZO is written such a way that it should compile and run
+ out-of-the-box on most machines.
+
+ If you are running on a very unusual architecture and lzo_init() fails then
+ you should first recompile with `-DLZO_DEBUG' to see what causes the failure.
+ The most probable case is something like `sizeof(char *) != sizeof(long)'.
+ After identifying the problem you can compile by adding some defines
+ like `-DSIZEOF_CHAR_P=8' to your Makefile.
+
+ The best solution is (of course) using Autoconf - if your project uses
+ Autoconf anyway just add `-DMINILZO_HAVE_CONFIG_H' to your compiler
+ flags when compiling minilzo.c. See the LZO distribution for an example
+ how to set up configure.in.
+
+
+ Appendix B: list of public functions available in miniLZO
+ ---------------------------------------------------------
+ Library initialization
+ lzo_init()
+
+ Compression
+ lzo1x_1_compress()
+
+ Decompression
+ lzo1x_decompress()
+ lzo1x_decompress_safe()
+
+ Checksum functions
+ lzo_adler32()
+
+ Version functions
+ lzo_version()
+ lzo_version_string()
+ lzo_version_date()
+
+ Portable (but slow) string functions
+ lzo_memcmp()
+ lzo_memcpy()
+ lzo_memmove()
+ lzo_memset()
+
+
+ Appendix C: suggested macros for `configure.in' when using Autoconf
+ -------------------------------------------------------------------
+ Checks for typedefs and structures
+ AC_CHECK_TYPE(ptrdiff_t,long)
+ AC_TYPE_SIZE_T
+ AC_CHECK_SIZEOF(short)
+ AC_CHECK_SIZEOF(int)
+ AC_CHECK_SIZEOF(long)
+ AC_CHECK_SIZEOF(long long)
+ AC_CHECK_SIZEOF(__int64)
+ AC_CHECK_SIZEOF(void *)
+ AC_CHECK_SIZEOF(size_t)
+ AC_CHECK_SIZEOF(ptrdiff_t)
+
+ Checks for compiler characteristics
+ AC_C_CONST
+
+ Checks for library functions
+ AC_CHECK_FUNCS(memcmp memcpy memmove memset)
+
+
+ Appendix D: Copyright
+ ---------------------
+ LZO and miniLZO are Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005 Markus Franz Xaver Johannes Oberhumer
+
+ LZO and miniLZO are distributed under the terms of the GNU General
+ Public License (GPL). See the file COPYING.
+
+ Special licenses for commercial and other applications which
+ are not willing to accept the GNU General Public License
+ are available by contacting the author.
+
+
diff --git a/package/cfgfs/src/bundled/lzoconf.h b/package/cfgfs/src/bundled/lzoconf.h
new file mode 100644
index 000000000..7a745ad51
--- /dev/null
+++ b/package/cfgfs/src/bundled/lzoconf.h
@@ -0,0 +1,413 @@
+/* lzoconf.h -- configuration for the LZO real-time data compression library
+
+ This file is part of the LZO real-time data compression library.
+
+ Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
+ Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
+ All Rights Reserved.
+
+ The LZO library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License,
+ version 2, as published by the Free Software Foundation.
+
+ The LZO library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the LZO library; see the file COPYING.
+ If not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+ Markus F.X.J. Oberhumer
+ <markus@oberhumer.com>
+ http://www.oberhumer.com/opensource/lzo/
+ */
+
+
+#ifndef __LZOCONF_H_INCLUDED
+#define __LZOCONF_H_INCLUDED
+
+#define LZO_VERSION 0x2020
+#define LZO_VERSION_STRING "2.02"
+#define LZO_VERSION_DATE "Oct 17 2005"
+
+/* internal Autoconf configuration file - only used when building LZO */
+#if defined(LZO_HAVE_CONFIG_H)
+# include <config.h>
+#endif
+#include <limits.h>
+#include <stddef.h>
+
+
+/***********************************************************************
+// LZO requires a conforming <limits.h>
+************************************************************************/
+
+#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
+# error "invalid CHAR_BIT"
+#endif
+#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
+# error "check your compiler installation"
+#endif
+#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
+# error "your limits.h macros are broken"
+#endif
+
+/* get OS and architecture defines */
+#ifndef __LZODEFS_H_INCLUDED
+#include "lzodefs.h"
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/***********************************************************************
+// some core defines
+************************************************************************/
+
+#if !defined(LZO_UINT32_C)
+# if (UINT_MAX < LZO_0xffffffffL)
+# define LZO_UINT32_C(c) c ## UL
+# else
+# define LZO_UINT32_C(c) ((c) + 0U)
+# endif
+#endif
+
+/* memory checkers */
+#if !defined(__LZO_CHECKER)
+# if defined(__BOUNDS_CHECKING_ON)
+# define __LZO_CHECKER 1
+# elif defined(__CHECKER__)
+# define __LZO_CHECKER 1
+# elif defined(__INSURE__)
+# define __LZO_CHECKER 1
+# elif defined(__PURIFY__)
+# define __LZO_CHECKER 1
+# endif
+#endif
+
+
+/***********************************************************************
+// integral and pointer types
+************************************************************************/
+
+/* lzo_uint should match size_t */
+#if !defined(LZO_UINT_MAX)
+# if defined(LZO_ABI_LLP64) /* WIN64 */
+# if defined(LZO_OS_WIN64)
+ typedef unsigned __int64 lzo_uint;
+ typedef __int64 lzo_int;
+# else
+ typedef unsigned long long lzo_uint;
+ typedef long long lzo_int;
+# endif
+# define LZO_UINT_MAX 0xffffffffffffffffull
+# define LZO_INT_MAX 9223372036854775807LL
+# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
+# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
+ typedef unsigned int lzo_uint;
+ typedef int lzo_int;
+# define LZO_UINT_MAX UINT_MAX
+# define LZO_INT_MAX INT_MAX
+# define LZO_INT_MIN INT_MIN
+# elif (ULONG_MAX >= LZO_0xffffffffL)
+ typedef unsigned long lzo_uint;
+ typedef long lzo_int;
+# define LZO_UINT_MAX ULONG_MAX
+# define LZO_INT_MAX LONG_MAX
+# define LZO_INT_MIN LONG_MIN
+# else
+# error "lzo_uint"
+# endif
+#endif
+
+/* Integral types with 32 bits or more. */
+#if !defined(LZO_UINT32_MAX)
+# if (UINT_MAX >= LZO_0xffffffffL)
+ typedef unsigned int lzo_uint32;
+ typedef int lzo_int32;
+# define LZO_UINT32_MAX UINT_MAX
+# define LZO_INT32_MAX INT_MAX
+# define LZO_INT32_MIN INT_MIN
+# elif (ULONG_MAX >= LZO_0xffffffffL)
+ typedef unsigned long lzo_uint32;
+ typedef long lzo_int32;
+# define LZO_UINT32_MAX ULONG_MAX
+# define LZO_INT32_MAX LONG_MAX
+# define LZO_INT32_MIN LONG_MIN
+# else
+# error "lzo_uint32"
+# endif
+#endif
+
+/* The larger type of lzo_uint and lzo_uint32. */
+#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
+# define lzo_xint lzo_uint
+#else
+# define lzo_xint lzo_uint32
+#endif
+
+/* Memory model that allows to access memory at offsets of lzo_uint. */
+#if !defined(__LZO_MMODEL)
+# if (LZO_UINT_MAX <= UINT_MAX)
+# define __LZO_MMODEL
+# elif defined(LZO_HAVE_MM_HUGE_PTR)
+# define __LZO_MMODEL_HUGE 1
+# define __LZO_MMODEL __huge
+# else
+# define __LZO_MMODEL
+# endif
+#endif
+
+/* no typedef here because of const-pointer issues */
+#define lzo_bytep unsigned char __LZO_MMODEL *
+#define lzo_charp char __LZO_MMODEL *
+#define lzo_voidp void __LZO_MMODEL *
+#define lzo_shortp short __LZO_MMODEL *
+#define lzo_ushortp unsigned short __LZO_MMODEL *
+#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
+#define lzo_int32p lzo_int32 __LZO_MMODEL *
+#define lzo_uintp lzo_uint __LZO_MMODEL *
+#define lzo_intp lzo_int __LZO_MMODEL *
+#define lzo_xintp lzo_xint __LZO_MMODEL *
+#define lzo_voidpp lzo_voidp __LZO_MMODEL *
+#define lzo_bytepp lzo_bytep __LZO_MMODEL *
+/* deprecated - use `lzo_bytep' instead of `lzo_byte *' */
+#define lzo_byte unsigned char __LZO_MMODEL
+
+typedef int lzo_bool;
+
+
+/***********************************************************************
+// function types
+************************************************************************/
+
+/* name mangling */
+#if !defined(__LZO_EXTERN_C)
+# ifdef __cplusplus
+# define __LZO_EXTERN_C extern "C"
+# else
+# define __LZO_EXTERN_C extern
+# endif
+#endif
+
+/* calling convention */
+#if !defined(__LZO_CDECL)
+# define __LZO_CDECL __lzo_cdecl
+#endif
+
+/* DLL export information */
+#if !defined(__LZO_EXPORT1)
+# define __LZO_EXPORT1
+#endif
+#if !defined(__LZO_EXPORT2)
+# define __LZO_EXPORT2
+#endif
+
+/* __cdecl calling convention for public C and assembly functions */
+#if !defined(LZO_PUBLIC)
+# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
+#endif
+#if !defined(LZO_EXTERN)
+# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
+#endif
+#if !defined(LZO_PRIVATE)
+# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
+#endif
+
+/* function types */
+typedef int
+(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
+ lzo_bytep dst, lzo_uintp dst_len,
+ lzo_voidp wrkmem );
+
+typedef int
+(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
+ lzo_bytep dst, lzo_uintp dst_len,
+ lzo_voidp wrkmem );
+
+typedef int
+(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
+ lzo_bytep dst, lzo_uintp dst_len,
+ lzo_voidp wrkmem );
+
+typedef int
+(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
+ lzo_bytep dst, lzo_uintp dst_len,
+ lzo_voidp wrkmem,
+ const lzo_bytep dict, lzo_uint dict_len );
+
+typedef int
+(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
+ lzo_bytep dst, lzo_uintp dst_len,
+ lzo_voidp wrkmem,
+ const lzo_bytep dict, lzo_uint dict_len );
+
+
+/* Callback interface. Currently only the progress indicator ("nprogress")
+ * is used, but this may change in a future release. */
+
+struct lzo_callback_t;
+typedef struct lzo_callback_t lzo_callback_t;
+#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
+
+/* malloc & free function types */
+typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
+ (lzo_callback_p self, lzo_uint items, lzo_uint size);
+typedef void (__LZO_CDECL *lzo_free_func_t)
+ (lzo_callback_p self, lzo_voidp ptr);
+
+/* a progress indicator callback function */
+typedef void (__LZO_CDECL *lzo_progress_func_t)
+ (lzo_callback_p, lzo_uint, lzo_uint, int);
+
+struct lzo_callback_t
+{
+ /* custom allocators (set to 0 to disable) */
+ lzo_alloc_func_t nalloc; /* [not used right now] */
+ lzo_free_func_t nfree; /* [not used right now] */
+
+ /* a progress indicator callback function (set to 0 to disable) */
+ lzo_progress_func_t nprogress;
+
+ /* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
+ * callbacks points back to this struct, so you are free to store
+ * some extra info in the following variables. */
+ lzo_voidp user1;
+ lzo_xint user2;
+ lzo_xint user3;
+};
+
+
+/***********************************************************************
+// error codes and prototypes
+************************************************************************/
+
+/* Error codes for the compression/decompression functions. Negative
+ * values are errors, positive values will be used for special but
+ * normal events.
+ */
+#define LZO_E_OK 0
+#define LZO_E_ERROR (-1)
+#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
+#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
+#define LZO_E_INPUT_OVERRUN (-4)
+#define LZO_E_OUTPUT_OVERRUN (-5)
+#define LZO_E_LOOKBEHIND_OVERRUN (-6)
+#define LZO_E_EOF_NOT_FOUND (-7)
+#define LZO_E_INPUT_NOT_CONSUMED (-8)
+#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
+
+
+#ifndef lzo_sizeof_dict_t
+# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
+#endif
+
+/* lzo_init() should be the first function you call.
+ * Check the return code !
+ *
+ * lzo_ini