-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathext_math.cpp
More file actions
97 lines (86 loc) · 2.25 KB
/
Copy pathext_math.cpp
File metadata and controls
97 lines (86 loc) · 2.25 KB
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
/*
* This file is part of ext-math.
* Native C++23 port of pmmp/math <https://github.com/pmmp/Math> @ 1872272
*
* ext-math is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
extern "C" {
#include "php.h"
#include "ext/standard/info.h"
#include "php_ext_math.h" //this one has to be C always, so the engine can understand it
}
#if PHP_VERSION_ID < 80200
# error "ext-math requires PHP 8.2 or later"
#endif
#include "src/PhpClasses.h"
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(ext_math)
{
#if defined(ZTS) && defined(COMPILE_DL_EXT_MATH)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
REGISTER_STRING_CONSTANT("EXT_MATH_VERSION", (char *) PHP_EXT_MATH_VERSION, CONST_CS | CONST_PERSISTENT);
math_register_axis();
math_register_facing();
math_register_math();
math_register_vector2();
math_register_vector3(); //after Vector2 (maxPlainDistance references it)
math_register_vector_math();
math_register_axis_aligned_bb();
math_register_ray_trace_result(); //property types reference AxisAlignedBB/Vector3
math_register_matrix();
math_register_voxel_ray_trace();
return SUCCESS;
}
/* }}} */
/* {{{ PHP_RINIT_FUNCTION
*/
PHP_RINIT_FUNCTION(ext_math)
{
#if defined(ZTS) && defined(COMPILE_DL_EXT_MATH)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
/* }}} */
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(ext_math)
{
php_info_print_table_start();
php_info_print_table_header(2, "ext_math support", "enabled");
php_info_print_table_row(2, "ext_math version", PHP_EXT_MATH_VERSION);
php_info_print_table_row(2, "provides", "pocketmine\\math (native port of pmmp/math)");
php_info_print_table_end();
}
/* }}} */
/* {{{ ext_math_module_entry
*/
zend_module_entry ext_math_module_entry = {
STANDARD_MODULE_HEADER,
"ext_math",
NULL,
PHP_MINIT(ext_math),
NULL, /* MSHUTDOWN */
PHP_RINIT(ext_math),
NULL, /* RSHUTDOWN */
PHP_MINFO(ext_math),
PHP_EXT_MATH_VERSION,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_EXT_MATH
extern "C" {
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE()
#endif
ZEND_GET_MODULE(ext_math)
}
#endif