xref: /dragonfly/contrib/xz/src/xz/coder.h (revision 2b3f93ea)
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 	// HEADER_GZIP,
27 	FORMAT_RAW,
28 };
29 
30 
31 /// Operation mode of the command line tool. This is set in args.c and read
32 /// in several files.
33 extern enum operation_mode opt_mode;
34 
35 /// File format to use when encoding or what format(s) to accept when
36 /// decoding. This is a global because it's needed also in suffix.c.
37 /// This is set in args.c.
38 extern enum format_type opt_format;
39 
40 /// If true, the compression settings are automatically adjusted down if
41 /// they exceed the memory usage limit.
42 extern bool opt_auto_adjust;
43 
44 /// If true, stop after decoding the first stream.
45 extern bool opt_single_stream;
46 
47 /// If non-zero, start a new .xz Block after every opt_block_size bytes
48 /// of input. This has an effect only when compressing to the .xz format.
49 extern uint64_t opt_block_size;
50 
51 /// This is non-NULL if --block-list was used. This contains the Block sizes
52 /// as an array that is terminated with 0.
53 extern uint64_t *opt_block_list;
54 
55 /// Set the integrity check type used when compressing
56 extern void coder_set_check(lzma_check check);
57 
58 /// Set preset number
59 extern void coder_set_preset(uint32_t new_preset);
60 
61 /// Enable extreme mode
62 extern void coder_set_extreme(void);
63 
64 /// Add a filter to the custom filter chain
65 extern void coder_add_filter(lzma_vli id, void *options);
66 
67 ///
68 extern void coder_set_compression_settings(void);
69 
70 /// Compress or decompress the given file
71 extern void coder_run(const char *filename);
72 
73 #ifndef NDEBUG
74 /// Free the memory allocated for the coder and kill the worker threads.
75 extern void coder_free(void);
76 #endif
77