xref: /PHP-5.3/ext/json/php_json.h (revision a2045ff3)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2013 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: Omar Kilani <omar@php.net>                                   |
16   +----------------------------------------------------------------------+
17 */
18 
19 /* $Id$ */
20 
21 #ifndef PHP_JSON_H
22 #define PHP_JSON_H
23 
24 #define PHP_JSON_VERSION "1.2.1"
25 #include "ext/standard/php_smart_str.h"
26 
27 extern zend_module_entry json_module_entry;
28 #define phpext_json_ptr &json_module_entry
29 
30 #if defined(PHP_WIN32) && defined(JSON_EXPORTS)
31 #define PHP_JSON_API __declspec(dllexport)
32 #else
33 #define PHP_JSON_API PHPAPI
34 #endif
35 
36 #ifdef ZTS
37 #include "TSRM.h"
38 #endif
39 
40 ZEND_BEGIN_MODULE_GLOBALS(json)
41 	int error_code;
42 ZEND_END_MODULE_GLOBALS(json)
43 
44 #ifdef ZTS
45 # define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v)
46 #else
47 # define JSON_G(v) (json_globals.v)
48 #endif
49 
50 PHP_JSON_API void php_json_encode(smart_str *buf, zval *val, int options TSRMLS_DC);
51 PHP_JSON_API void php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, long depth TSRMLS_DC);
52 
53 #define PHP_JSON_HEX_TAG	(1<<0)
54 #define PHP_JSON_HEX_AMP	(1<<1)
55 #define PHP_JSON_HEX_APOS	(1<<2)
56 #define PHP_JSON_HEX_QUOT	(1<<3)
57 #define PHP_JSON_FORCE_OBJECT	(1<<4)
58 #define PHP_JSON_NUMERIC_CHECK	(1<<5)
59 
60 #define PHP_JSON_OUTPUT_ARRAY 0
61 #define PHP_JSON_OUTPUT_OBJECT 1
62 
63 #endif  /* PHP_JSON_H */
64 
65 /*
66  * Local variables:
67  * tab-width: 4
68  * c-basic-offset: 4
69  * End:
70  * vim600: noet sw=4 ts=4 fdm=marker
71  * vim<600: noet sw=4 ts=4
72  */
73