xref: /dragonfly/contrib/xz/src/xz/coder.h (revision 0db87cb7)
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 
45 /// Set the integrity check type used when compressing
46 extern void coder_set_check(lzma_check check);
47 
48 /// Set preset number
49 extern void coder_set_preset(uint32_t new_preset);
50 
51 /// Enable extreme mode
52 extern void coder_set_extreme(void);
53 
54 /// Add a filter to the custom filter chain
55 extern void coder_add_filter(lzma_vli id, void *options);
56 
57 ///
58 extern void coder_set_compression_settings(void);
59 
60 /// Compress or decompress the given file
61 extern void coder_run(const char *filename);
62