save funccall
[m6w6/ext-http] / php_http_exception.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_EXCEPTION_H
14 #define PHP_HTTP_EXCEPTION_H
15
16 /* short hand for zend_throw_exception_ex */
17 #define php_http_throw(e, fmt, ...) \
18 zend_throw_exception_ex(php_http_exception_ ##e## _class_entry, 0 TSRMLS_CC, fmt, __VA_ARGS__)
19
20 /* wrap a call with replaced zend_error_handling */
21 #define php_http_expect(test, e, fail) \
22 do { \
23 zend_error_handling __zeh; \
24 zend_replace_error_handling(EH_THROW, php_http_exception_ ##e## _class_entry, &__zeh TSRMLS_CC); \
25 if (!(test)) { \
26 zend_restore_error_handling(&__zeh TSRMLS_CC); \
27 fail; \
28 } \
29 zend_restore_error_handling(&__zeh TSRMLS_CC); \
30 } while(0)
31
32 PHP_HTTP_API zend_class_entry *php_http_exception_interface_class_entry;
33 PHP_HTTP_API zend_class_entry *php_http_exception_runtime_class_entry;
34 PHP_HTTP_API zend_class_entry *php_http_exception_unexpected_val_class_entry;
35 PHP_HTTP_API zend_class_entry *php_http_exception_bad_method_call_class_entry;
36 PHP_HTTP_API zend_class_entry *php_http_exception_invalid_arg_class_entry;
37 PHP_HTTP_API zend_class_entry *php_http_exception_bad_header_class_entry;
38 PHP_HTTP_API zend_class_entry *php_http_exception_bad_url_class_entry;
39 PHP_HTTP_API zend_class_entry *php_http_exception_bad_message_class_entry;
40 PHP_HTTP_API zend_class_entry *php_http_exception_bad_conversion_class_entry;
41 PHP_HTTP_API zend_class_entry *php_http_exception_bad_querystring_class_entry;
42
43 PHP_MINIT_FUNCTION(http_exception);
44
45 #endif
46
47 /*
48 * Local variables:
49 * tab-width: 4
50 * c-basic-offset: 4
51 * End:
52 * vim600: noet sw=4 ts=4 fdm=marker
53 * vim<600: noet sw=4 ts=4
54 */
55