1 /////////////////////////////////////////////////////////////////////////////// 2 // 3 /// \file coder.h 4 /// \brief Compresses or uncompresses a file 5 // 6 // Author: Lasse Collin 7 // 8 // This file has been put into the public domain. 9 // You can do whatever you want with this file. 10 // 11 /////////////////////////////////////////////////////////////////////////////// 12 13 enum operation_mode { 14 MODE_COMPRESS, 15 MODE_DECOMPRESS, 16 MODE_TEST, 17 MODE_LIST, 18 }; 19 20 21 // NOTE: The order of these is significant in suffix.c. 22 enum format_type { 23 FORMAT_AUTO, 24 FORMAT_XZ, 25 FORMAT_LZMA, 26 #ifdef HAVE_LZIP_DECODER 27 FORMAT_LZIP, 28 #endif 29 FORMAT_RAW, 30 }; 31 32 33 /// Operation mode of the command line tool. This is set in args.c and read 34 /// in several files. 35 extern enum operation_mode opt_mode; 36 37 /// File format to use when encoding or what format(s) to accept when 38 /// decoding. This is a global because it's needed also in suffix.c. 39 /// This is set in args.c. 40 extern enum format_type opt_format; 41 42 /// If true, the compression settings are automatically adjusted down if 43 /// they exceed the memory usage limit. 44 extern bool opt_auto_adjust; 45 46 /// If true, stop after decoding the first stream. 47 extern bool opt_single_stream; 48 49 /// If non-zero, start a new .xz Block after every opt_block_size bytes 50 /// of input. This has an effect only when compressing to the .xz format. 51 extern uint64_t opt_block_size; 52 53 /// This is non-NULL if --block-list was used. This contains the Block sizes 54 /// as an array that is terminated with 0. 55 extern uint64_t *opt_block_list; 56 57 /// Set the integrity check type used when compressing 58 extern void coder_set_check(lzma_check check); 59 60 /// Set preset number 61 extern void coder_set_preset(uint32_t new_preset); 62 63 /// Enable extreme mode 64 extern void coder_set_extreme(void); 65 66 /// Add a filter to the custom filter chain 67 extern void coder_add_filter(lzma_vli id, void *options); 68 69 /// Set and partially validate compression settings. This can also be used 70 /// in decompression or test mode with the raw format. 71 extern void coder_set_compression_settings(void); 72 73 /// Compress or decompress the given file 74 extern void coder_run(const char *filename); 75 76 #ifndef NDEBUG 77 /// Free the memory allocated for the coder and kill the worker threads. 78 extern void coder_free(void); 79 #endif 80