mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add a context for the callback so different compression scenarios can be
distinguished. Tidy up documentation. Thanks, Chris. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16652 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -14,25 +14,25 @@
|
||||
#ifndef LLVM_SUPPORT_COMPRESSOR_H
|
||||
#define LLVM_SUPPORT_COMPRESSOR_H
|
||||
|
||||
#include <llvm/Support/DataTypes.h>
|
||||
#include "llvm/Support/DataTypes.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
/// This class provides an abstraction for compressing a block of memory using
|
||||
/// a standard compression utility such as bzip2 or libz. This interface
|
||||
/// allos us to abstraction the notion of compression and deal with alternate
|
||||
/// allows us to abstract the notion of compression and deal with alternate
|
||||
/// compression scheme availability depending on the configured platform. This
|
||||
/// facility will always favor a bzip2 implementation if its available.
|
||||
/// Otherwise, libz will be used if its available. If neither zlib nor bzip2
|
||||
/// Otherwise, libz will be used if it is available. If neither zlib nor bzip2
|
||||
/// are available, a very simple algorithm provided by the Compressor class
|
||||
/// will be used The type of compression used can be determined by inspecting
|
||||
/// will be used. The type of compression used can be determined by inspecting
|
||||
/// the first byte of the compressed output. ASCII values '0', '1', and '2',
|
||||
/// denote the compression type as given in the Algorithm enumeration below.
|
||||
/// The Compressor is intended for use with memory mapped files where the
|
||||
/// entire data block to be compressed or decompressed is available in
|
||||
/// memory. Output, however, can be gathered in repeated calls to a callback.
|
||||
/// memory. However, output can be gathered in repeated calls to a callback.
|
||||
/// @since 1.4
|
||||
/// @brief An abstraction for memory to memory data compression
|
||||
/// @brief An abstraction for memory to memory data (de)compression
|
||||
class Compressor {
|
||||
/// @name Types
|
||||
/// @{
|
||||
@@ -50,7 +50,8 @@ namespace llvm {
|
||||
/// @returns 0 for success, 1 for failure
|
||||
/// @throws nothing
|
||||
/// @brief Output callback function type
|
||||
typedef unsigned (OutputDataCallback)(char*& buffer, unsigned& size);
|
||||
typedef unsigned (OutputDataCallback)(char*& buffer, unsigned& size,
|
||||
void* context);
|
||||
|
||||
/// @}
|
||||
/// @name Methods
|
||||
@@ -72,7 +73,8 @@ namespace llvm {
|
||||
/// @returns the total size of the compressed data
|
||||
/// @brief Compress a block of memory.
|
||||
static uint64_t compress(char* in, unsigned size, OutputDataCallback* cb,
|
||||
Algorithm hint = COMP_TYPE_BZIP2);
|
||||
Algorithm hint = COMP_TYPE_BZIP2,
|
||||
void* context = 0);
|
||||
|
||||
/// This function does the decompression work. The block of memory
|
||||
/// starting at \p in and extending for \p size bytes is decompressed. The
|
||||
@@ -88,7 +90,7 @@ namespace llvm {
|
||||
/// @returns the total size of the decompressed data
|
||||
/// @brief Decompress a block of memory.
|
||||
static uint64_t decompress(char *in, unsigned size,
|
||||
OutputDataCallback* cb);
|
||||
OutputDataCallback* cb, void* context = 0);
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
Reference in New Issue
Block a user