-
Notifications
You must be signed in to change notification settings - Fork 1
/
php_rsvg.h
124 lines (101 loc) · 3.77 KB
/
php_rsvg.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2008 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Michael Maclean <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id: header 252479 2008-02-07 19:39:50Z iliaa $ */
#ifndef PHP_RSVG_H
#define PHP_RSVG_H
#define PHP_RSVG_VERSION "0.1.0-alpha"
extern zend_module_entry rsvg_module_entry;
#define phpext_rsvg_ptr &rsvg_module_entry
extern zend_object_handlers rsvg_std_object_handlers;
zend_class_entry *rsvg_ce_rsvgexception;
#ifdef PHP_WIN32
# define PHP_RSVG_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_RSVG_API __attribute__ ((visibility("default")))
#else
# define PHP_RSVG_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#ifdef ZTS
#define RSVG_G(v) TSRMG(rsvg_globals_id, zend_rsvg_globals *, v)
#else
#define RSVG_G(v) (rsvg_globals.v)
#endif
/* turn error handling to exception mode and restore */
/* Borrowed from pecl/cairo, ta auroraeosrose */
#if PHP_VERSION_ID >= 50300
/* 5.3 version of the macros */
#define PHP_RSVG_ERROR_HANDLING(force_exceptions) \
zend_error_handling error_handling; \
if(force_exceptions || getThis()) { \
zend_replace_error_handling(EH_THROW, rsvg_ce_rsvgexception, &error_handling TSRMLS_CC); \
}
#define PHP_RSVG_RESTORE_ERRORS(force_exceptions) \
if(force_exceptions || getThis()) { \
zend_restore_error_handling(&error_handling TSRMLS_CC); \
}
#else
/* 5.2 versions of the macros */
#define PHP_RSVG_ERROR_HANDLING(force_exceptions) \
if(force_exceptions || getThis()) { \
php_set_error_handling(EH_THROW, rsvg_ce_rsvgexception TSRMLS_CC); \
}
#define PHP_RSVG_RESTORE_ERRORS(force_exceptions) \
if(force_exceptions || getThis()) { \
php_std_error_handling(); \
}
#endif
#include <glib.h>
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
#include "php_cairo_api.h"
typedef struct _rsvg_handle_object {
zend_object std;
RsvgHandle *handle;
} rsvg_handle_object;
PHP_MINIT_FUNCTION(rsvg);
PHP_MSHUTDOWN_FUNCTION(rsvg);
PHP_MINFO_FUNCTION(rsvg);
PHP_FUNCTION(rsvg_create);
PHP_FUNCTION(rsvg_create_from_file);
PHP_FUNCTION(rsvg_get_dimensions);
PHP_FUNCTION(rsvg_get_title);
PHP_FUNCTION(rsvg_get_description);
PHP_FUNCTION(rsvg_has_element);
PHP_FUNCTION(rsvg_render);
/* {{{ object fetch functions - check for internal RsvgHandle */
static inline rsvg_handle_object* rsvg_handle_object_get(zval *zobj TSRMLS_DC)
{
rsvg_handle_object *pobj = zend_object_store_get_object(zobj TSRMLS_CC);
if (pobj->handle == NULL) {
php_error(E_ERROR, "Internal context object missing in %s wrapper, you must call parent::__construct in extended classes", Z_OBJCE_P(zobj)->name);
}
return pobj;
}
/* }}} */
#endif /* PHP_RSVG_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/