1*3117ece4Schristos /** 2*3117ece4Schristos * \file zstddeclib.c 3*3117ece4Schristos * Single-file Zstandard decompressor. 4*3117ece4Schristos * 5*3117ece4Schristos * Generate using: 6*3117ece4Schristos * \code 7*3117ece4Schristos * python combine.py -r ../../lib -x legacy/zstd_legacy.h -o zstddeclib.c zstddeclib-in.c 8*3117ece4Schristos * \endcode 9*3117ece4Schristos */ 10*3117ece4Schristos /* 11*3117ece4Schristos * Copyright (c) Meta Platforms, Inc. and affiliates. 12*3117ece4Schristos * All rights reserved. 13*3117ece4Schristos * 14*3117ece4Schristos * This source code is licensed under both the BSD-style license (found in the 15*3117ece4Schristos * LICENSE file in the root directory of this source tree) and the GPLv2 (found 16*3117ece4Schristos * in the COPYING file in the root directory of this source tree). 17*3117ece4Schristos * You may select, at your option, one of the above-listed licenses. 18*3117ece4Schristos */ 19*3117ece4Schristos /* 20*3117ece4Schristos * Settings to bake for the standalone decompressor. 21*3117ece4Schristos * 22*3117ece4Schristos * Note: It's important that none of these affects 'zstd.h' (only the 23*3117ece4Schristos * implementation files we're amalgamating). 24*3117ece4Schristos * 25*3117ece4Schristos * Note: MEM_MODULE stops xxhash redefining BYTE, U16, etc., which are also 26*3117ece4Schristos * defined in mem.h (breaking C99 compatibility). 27*3117ece4Schristos * 28*3117ece4Schristos * Note: the undefs for xxHash allow Zstd's implementation to coincide with 29*3117ece4Schristos * standalone xxHash usage (with global defines). 30*3117ece4Schristos * 31*3117ece4Schristos * Note: if you enable ZSTD_LEGACY_SUPPORT the combine.py script will need 32*3117ece4Schristos * re-running without the "-x legacy/zstd_legacy.h" option (it excludes the 33*3117ece4Schristos * legacy support at the source level). 34*3117ece4Schristos */ 35*3117ece4Schristos #define DEBUGLEVEL 0 36*3117ece4Schristos #define MEM_MODULE 37*3117ece4Schristos #undef XXH_NAMESPACE 38*3117ece4Schristos #define XXH_NAMESPACE ZSTD_ 39*3117ece4Schristos #undef XXH_PRIVATE_API 40*3117ece4Schristos #define XXH_PRIVATE_API 41*3117ece4Schristos #undef XXH_INLINE_ALL 42*3117ece4Schristos #define XXH_INLINE_ALL 43*3117ece4Schristos #define ZSTD_LEGACY_SUPPORT 0 44*3117ece4Schristos #define ZSTD_STRIP_ERROR_STRINGS 45*3117ece4Schristos #define ZSTD_TRACE 0 46*3117ece4Schristos /* TODO: Can't amalgamate ASM function */ 47*3117ece4Schristos #define ZSTD_DISABLE_ASM 1 48*3117ece4Schristos 49*3117ece4Schristos /* Include zstd_deps.h first with all the options we need enabled. */ 50*3117ece4Schristos #define ZSTD_DEPS_NEED_MALLOC 51*3117ece4Schristos #include "common/zstd_deps.h" 52*3117ece4Schristos 53*3117ece4Schristos #include "common/debug.c" 54*3117ece4Schristos #include "common/entropy_common.c" 55*3117ece4Schristos #include "common/error_private.c" 56*3117ece4Schristos #include "common/fse_decompress.c" 57*3117ece4Schristos #include "common/zstd_common.c" 58*3117ece4Schristos 59*3117ece4Schristos #include "decompress/huf_decompress.c" 60*3117ece4Schristos #include "decompress/zstd_ddict.c" 61*3117ece4Schristos #include "decompress/zstd_decompress.c" 62*3117ece4Schristos #include "decompress/zstd_decompress_block.c" 63