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
125
126
|
From b6c4b90482558b18e0dba665768b1ad0855684d5 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 21 Mar 2022 08:21:19 +0100
Subject: [PATCH 1/2] fix PHP 8.0 build
---
src/pixels.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/pixels.c b/src/pixels.c
index ef1525b..4594d58 100644
--- a/src/pixels.c
+++ b/src/pixels.c
@@ -20,6 +20,12 @@
#include "zend_interfaces.h"
#include "zend_operators.h"
+/* for PHP 8.0 */
+#ifndef ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX
+#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+ ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args)
+#endif
+
static zend_class_entry *php_sdl_color_ce;
static zend_object_handlers php_sdl_color_handlers;
struct php_sdl_color {
From c5105dc060edec6d1291e36c3aed30e892630b14 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 21 Mar 2022 09:07:45 +0100
Subject: [PATCH 2/2] register rect functions in rect.c
---
src/php_sdl.c | 18 +++---------------
src/rect.c | 11 +++++++++++
src/rect.h | 1 +
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/php_sdl.c b/src/php_sdl.c
index 531f842..c409c6c 100644
--- a/src/php_sdl.c
+++ b/src/php_sdl.c
@@ -31,7 +31,6 @@
#include "power.h"
#include "pixels.h"
#include "rect.h"
-#include "rect_arginfo.h"
#include "render.h"
#include "rwops.h"
#include "sdl.h"
@@ -68,6 +67,7 @@ zend_bool php_sdl_check_overflow(int a, int b, int silent)
#define PHP_MINIT_CALL(func) PHP_MINIT(func)(INIT_FUNC_ARGS_PASSTHRU)
+#define PHP_MSHUTDOWN_CALL(func) PHP_MSHUTDOWN(func)(SHUTDOWN_FUNC_ARGS_PASSTHRU)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(sdl)
@@ -107,6 +107,8 @@ PHP_MINIT_FUNCTION(sdl)
/* {{{ PHP_MSHUTDOWN_FUNCTION */
PHP_MSHUTDOWN_FUNCTION(sdl)
{
+ PHP_MSHUTDOWN_CALL(sdl_rect);
+
return SUCCESS;
}
/* }}} */
@@ -260,20 +262,6 @@ static zend_function_entry sdl_functions[] = {
//PHP_FALIAS(SDL_BlitSurface, SDL_UpperBlit, arginfo_SDL_UpperBlit)
//PHP_FALIAS(SDL_BlitScaled, SDL_UpperBlitScaled, arginfo_SDL_UpperBlit)
- // Rect
- ZEND_FE(SDL_RectEmpty, arginfo_SDL_RectEmpty)
- ZEND_FE(SDL_RectEquals, arginfo_SDL_RectEquals)
- ZEND_FE(SDL_HasIntersection, arginfo_SDL_HasIntersection)
- ZEND_FE(SDL_IntersectRect, arginfo_SDL_IntersectRect)
- ZEND_FE(SDL_UnionRect, arginfo_SDL_UnionRect)
- ZEND_FE(SDL_IntersectRectAndLine, arginfo_SDL_IntersectRectAndLine)
- ZEND_FE(SDL_EnclosePoints, arginfo_SDL_EnclosePoints)
- ZEND_FE(SDL_PointInRect, arginfo_SDL_PointInRect)
-
- ZEND_FE(SDL_FRectEmpty, arginfo_SDL_FRectEmpty)
- ZEND_FE(SDL_HasIntersectionF, arginfo_SDL_HasIntersectionF)
- ZEND_FE(SDL_IntersectFRect, arginfo_SDL_IntersectFRect)
-
// Events
ZEND_FE(SDL_WaitEvent, arginfo_SDL_WaitEvent)
ZEND_FE(SDL_PollEvent, arginfo_SDL_PollEvent)
diff --git a/src/rect.c b/src/rect.c
index 6773f56..926d1b2 100644
--- a/src/rect.c
+++ b/src/rect.c
@@ -697,6 +697,8 @@ PHP_FUNCTION(SDL_PointInRect)
/* {{{ MINIT */
PHP_MINIT_FUNCTION(sdl_rect)
{
+ zend_register_functions(NULL, ext_functions, NULL, type);
+
php_sdl_rect_ce = register_class_SDL_Rect();
memcpy(&php_sdl_rect_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
@@ -712,3 +714,12 @@ PHP_MINIT_FUNCTION(sdl_rect)
return SUCCESS;
}
/* }}} */
+
+/* {{{ PHP_MSHUTDOWN_FUNCTION */
+PHP_MSHUTDOWN_FUNCTION(sdl_rect)
+{
+ zend_unregister_functions(ext_functions, -1, NULL);
+
+ return SUCCESS;
+}
+/* }}} */
diff --git a/src/rect.h b/src/rect.h
index 67ba131..baddfd6 100644
--- a/src/rect.h
+++ b/src/rect.h
@@ -40,6 +40,7 @@ zend_class_entry *get_php_sdl_fpoint_ce(void);
zend_bool zval_to_sdl_fpoint(zval *value, SDL_FPoint *rect);
PHP_MINIT_FUNCTION(sdl_rect);
+PHP_MSHUTDOWN_FUNCTION(sdl_rect);
#ifdef __cplusplus
} // extern "C"
|