xref: /PHP-7.0/ext/bz2/php_bz2.h (revision 478f119a)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2017 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 /* $Id$ */
20 
21 #ifndef PHP_BZ2_H
22 #define PHP_BZ2_H
23 
24 #if HAVE_BZ2
25 
26 extern zend_module_entry bz2_module_entry;
27 #define phpext_bz2_ptr &bz2_module_entry
28 
29 /* Bzip2 includes */
30 #include <bzlib.h>
31 
32 #else
33 #define phpext_bz2_ptr NULL
34 #endif
35 
36 #ifdef PHP_WIN32
37 #	ifdef PHP_BZ2_EXPORTS
38 #		define PHP_BZ2_API __declspec(dllexport)
39 #	elif defined(COMPILE_DL_BZ2)
40 #		define PHP_BZ2_API __declspec(dllimport)
41 #	else
42 #		define PHP_BZ2_API /* nothing special */
43 #	endif
44 #elif defined(__GNUC__) && __GNUC__ >= 4
45 #	define PHP_BZ2_API __attribute__ ((visibility("default")))
46 #else
47 #	define PHP_BZ2_API
48 #endif
49 
50 #include "php_version.h"
51 #define PHP_BZ2_VERSION PHP_VERSION
52 
53 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);
54 PHP_BZ2_API php_stream *_php_stream_bz2open_from_BZFILE(BZFILE *bz, const char *mode, php_stream *innerstream STREAMS_DC);
55 
56 #define php_stream_bz2open_from_BZFILE(bz, mode, innerstream)	_php_stream_bz2open_from_BZFILE((bz), (mode), (innerstream) STREAMS_CC)
57 #define php_stream_bz2open(wrapper, path, mode, options, opened_path)	_php_stream_bz2open((wrapper), (path), (mode), (options), (opened_path), NULL STREAMS_CC)
58 
59 extern php_stream_filter_factory php_bz2_filter_factory;
60 extern php_stream_ops php_stream_bz2io_ops;
61 #define PHP_STREAM_IS_BZIP2	&php_stream_bz2io_ops
62 
63 /* 400kb */
64 #define PHP_BZ2_FILTER_DEFAULT_BLOCKSIZE        4
65 
66 /* BZ2 Internal Default */
67 #define PHP_BZ2_FILTER_DEFAULT_WORKFACTOR       0
68 
69 #endif
70 
71 
72 /*
73  * Local variables:
74  * tab-width: 4
75  * c-basic-offset: 4
76  * End:
77  */
78