xref: /PHP-7.3/ext/bz2/php_bz2.h (revision 8d3f8ca1)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2018 The PHP Group                                |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Author: Sterling Hughes <sterling@php.net>                           |
16   +----------------------------------------------------------------------+
17 */
18 
19 #ifndef PHP_BZ2_H
20 #define PHP_BZ2_H
21 
22 #if HAVE_BZ2
23 
24 extern zend_module_entry bz2_module_entry;
25 #define phpext_bz2_ptr &bz2_module_entry
26 
27 /* Bzip2 includes */
28 #include <bzlib.h>
29 
30 #else
31 #define phpext_bz2_ptr NULL
32 #endif
33 
34 #ifdef PHP_WIN32
35 #	ifdef PHP_BZ2_EXPORTS
36 #		define PHP_BZ2_API __declspec(dllexport)
37 #	elif defined(COMPILE_DL_BZ2)
38 #		define PHP_BZ2_API __declspec(dllimport)
39 #	else
40 #		define PHP_BZ2_API /* nothing special */
41 #	endif
42 #elif defined(__GNUC__) && __GNUC__ >= 4
43 #	define PHP_BZ2_API __attribute__ ((visibility("default")))
44 #else
45 #	define PHP_BZ2_API
46 #endif
47 
48 #include "php_version.h"
49 #define PHP_BZ2_VERSION PHP_VERSION
50 
51 PHP_BZ2_API php_stream *_php_stream_bz2open(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, zend_string **opened_path, php_stream_context *context STREAMS_DC);
52 PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *mode, php_stream *innerstream STREAMS_DC);
53 
54 #define php_stream_bz2open_from_BZFILE(bz, mode, innerstream)	_php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC)
55 #define php_stream_bz2open(wrapper, path, mode, options, opened_path)	_php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC)
56 
57 extern const php_stream_filter_factory php_bz2_filter_factory;
58 extern const php_stream_ops php_stream_bz2io_ops;
59 #define PHP_STREAM_IS_BZIP2	&php_stream_bz2io_ops
60 
61 /* 400kb */
62 #define PHP_BZ2_FILTER_DEFAULT_BLOCKSIZE        4
63 
64 /* BZ2 Internal Default */
65 #define PHP_BZ2_FILTER_DEFAULT_WORKFACTOR       0
66 
67 #endif
68 
69 
70 /*
71  * Local variables:
72  * tab-width: 4
73  * c-basic-offset: 4
74  * End:
75  */
76