forked from php-ds/ext-ds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_ds.c
94 lines (79 loc) · 1.86 KB
/
php_ds.c
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
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "main/php.h"
#include "ext/standard/info.h"
#include "ext/standard/php_var.h"
#include "php_ds.h"
#include "src/classes/php_ce_hashable.h"
#include "src/classes/php_ce_collection.h"
#include "src/classes/php_ce_sequence.h"
#include "src/classes/php_ce_vector.h"
#include "src/classes/php_ce_deque.h"
#include "src/classes/php_ce_set.h"
#include "src/classes/php_ce_map.h"
#include "src/classes/php_ce_stack.h"
#include "src/classes/php_ce_pair.h"
#include "src/classes/php_ce_priority_queue.h"
#include "src/classes/php_ce_queue.h"
#include "src/classes/php_ce_ds.h"
ZEND_DECLARE_MODULE_GLOBALS(ds);
static inline void php_ds_init_globals(zend_ds_globals *dsg) {
memset(dsg, 0, sizeof(zend_ds_globals));
}
PHP_MINIT_FUNCTION(ds)
{
ZEND_INIT_MODULE_GLOBALS(ds, php_ds_init_globals, NULL);
// Interfaces
register_hashable();
register_collection();
register_sequence();
// Classes
php_ds_register_vector();
register_deque();
php_ds_register_stack();
register_queue();
register_map();
register_set();
register_priority_queue();
register_pair();
// Shortcuts
register_ds();
return SUCCESS;
}
PHP_RINIT_FUNCTION(ds)
{
#if defined(COMPILE_DL_DS) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE();
#endif
return SUCCESS;
}
PHP_RSHUTDOWN_FUNCTION(ds)
{
return SUCCESS;
}
PHP_MINFO_FUNCTION(ds)
{
php_info_print_table_start();
php_info_print_table_header(2, "ds support", "enabled");
php_info_print_table_end();
}
zend_module_entry ds_module_entry = {
STANDARD_MODULE_HEADER,
"ds",
NULL,
PHP_MINIT(ds),
NULL,
PHP_RINIT(ds),
PHP_RSHUTDOWN(ds),
PHP_MINFO(ds),
PHP_DS_VERSION,
STANDARD_MODULE_PROPERTIES
};
#ifdef COMPILE_DL_DS
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(ds)
#endif