@@ -2,10 +2,10 @@ use phper::{c_str_ptr, php_fn, ebox};
2
2
use phper:: sys:: { ZEND_RESULT_CODE_SUCCESS , zend_parse_parameters, zend_internal_arg_info, zend_function_entry, PHP_INI_SYSTEM } ;
3
3
use phper:: sys:: { zend_ini_entry_def, zend_module_entry, zend_register_ini_entries, zend_unregister_ini_entries, OnUpdateBool } ;
4
4
use phper:: sys:: { OnUpdateString } ;
5
- use phper:: zend:: api:: { FunctionEntries , ModuleGlobals } ;
6
- use phper:: zend:: compile:: InternalArgInfos ;
5
+ use phper:: zend:: api:: { FunctionEntries , ModuleGlobals , function_entry_end } ;
6
+ use phper:: zend:: compile:: { InternalArgInfos , internal_arg_info_begin } ;
7
7
use phper:: zend:: ini:: { IniEntryDefs , ini_entry_def_end} ;
8
- use phper:: zend:: modules:: ModuleEntry ;
8
+ use phper:: zend:: modules:: { ModuleEntry , create_zend_module_entry } ;
9
9
use phper:: zend:: types:: { ExecuteData , Val , SetVal , Value } ;
10
10
use phper:: {
11
11
php_function, php_minit, php_minit_function, php_mshutdown, php_mshutdown_function,
@@ -18,6 +18,7 @@ use std::mem::{size_of, transmute};
18
18
use std:: os:: raw:: { c_char, c_int, c_uchar, c_uint, c_ushort} ;
19
19
use std:: ptr:: { null, null_mut} ;
20
20
use phper:: zend:: exceptions:: MyException ;
21
+ use phper:: sys:: { php_info_print_table_start, php_info_print_table_row, php_info_print_table_end} ;
21
22
22
23
static SIMPLE_ENABLE : ModuleGlobals < bool > = ModuleGlobals :: new ( false ) ;
23
24
static SIMPLE_TEXT : ModuleGlobals < * const c_char > = ModuleGlobals :: new ( null ( ) ) ;
@@ -56,6 +57,12 @@ fn r_shutdown_simple(type_: c_int, module_number: c_int) -> bool {
56
57
57
58
#[ php_minfo_function]
58
59
fn m_info_simple ( zend_module : * mut :: phper:: sys:: zend_module_entry ) {
60
+ unsafe {
61
+ php_info_print_table_start ( ) ;
62
+ php_info_print_table_row ( 2 , c_str_ptr ! ( "simple.enable" ) , format ! ( "{}\0 " , * SIMPLE_ENABLE . get( ) ) . as_ptr ( ) ) ;
63
+ php_info_print_table_row ( 2 , c_str_ptr ! ( "simple.text" ) , format ! ( "{}\0 " , CStr :: from_ptr( ( * SIMPLE_TEXT . get( ) ) ) . to_str( ) . unwrap( ) ) . as_ptr ( ) ) ;
64
+ php_info_print_table_end ( ) ;
65
+ }
59
66
}
60
67
61
68
#[ php_function]
@@ -90,12 +97,7 @@ pub fn test_simple(execute_data: ExecuteData) -> impl SetVal {
90
97
}
91
98
92
99
static ARG_INFO_TEST_SIMPLE : InternalArgInfos < 3 > = InternalArgInfos :: new ( [
93
- zend_internal_arg_info {
94
- name : 2 as * const _ ,
95
- type_ : 0 ,
96
- pass_by_reference : 0 ,
97
- is_variadic : 0 ,
98
- } ,
100
+ internal_arg_info_begin ( 2 , false ) ,
99
101
zend_internal_arg_info {
100
102
name : c_str_ptr ! ( "a" ) ,
101
103
type_ : 0 ,
@@ -118,38 +120,21 @@ static FUNCTION_ENTRIES: FunctionEntries<2> = FunctionEntries::new([
118
120
num_args : 2 ,
119
121
flags : 0 ,
120
122
} ,
121
- unsafe { transmute ( [ 0u8 ; size_of :: < zend_function_entry > ( ) ] ) } ,
123
+ function_entry_end ( ) ,
122
124
] ) ;
123
125
124
- static MODULE_ENTRY : ModuleEntry = ModuleEntry :: new ( zend_module_entry {
125
- size : size_of :: < zend_module_entry > ( ) as c_ushort ,
126
- zend_api : phper:: sys:: ZEND_MODULE_API_NO as c_uint ,
127
- zend_debug : phper:: sys:: ZEND_DEBUG as c_uchar ,
128
- zts : phper:: sys:: USING_ZTS as c_uchar ,
129
- ini_entry : std:: ptr:: null ( ) ,
130
- deps : std:: ptr:: null ( ) ,
131
- name : c_str_ptr ! ( env!( "CARGO_PKG_NAME" ) ) ,
132
- functions : FUNCTION_ENTRIES . get ( ) ,
133
- module_startup_func : Some ( php_minit ! ( m_init_simple) ) ,
134
- module_shutdown_func : Some ( php_mshutdown ! ( m_shutdown_simple) ) ,
135
- request_startup_func : Some ( php_rinit ! ( r_init_simple) ) ,
136
- request_shutdown_func : Some ( php_rshutdown ! ( r_shutdown_simple) ) ,
137
- info_func : Some ( php_minfo ! ( m_info_simple) ) ,
138
- version : c_str_ptr ! ( env!( "CARGO_PKG_VERSION" ) ) ,
139
- globals_size : 0usize ,
140
- #[ cfg( phper_zts) ]
141
- globals_id_ptr : std:: ptr:: null_mut ( ) ,
142
- #[ cfg( not( phper_zts) ) ]
143
- globals_ptr : std:: ptr:: null_mut ( ) ,
144
- globals_ctor : None ,
145
- globals_dtor : None ,
146
- post_deactivate_func : None ,
147
- module_started : 0 ,
148
- type_ : 0 ,
149
- handle : null_mut ( ) ,
150
- module_number : 0 ,
151
- build_id : phper:: sys:: PHP_MODULE_BUILD_ID ,
152
- } ) ;
126
+ static MODULE_ENTRY : ModuleEntry = ModuleEntry :: new ( create_zend_module_entry (
127
+ c_str_ptr ! ( env!( "CARGO_PKG_NAME" ) ) ,
128
+ c_str_ptr ! ( env!( "CARGO_PKG_VERSION" ) ) ,
129
+ FUNCTION_ENTRIES . get ( ) ,
130
+ Some ( php_minit ! ( m_init_simple) ) ,
131
+ Some ( php_mshutdown ! ( m_shutdown_simple) ) ,
132
+ Some ( php_rinit ! ( r_init_simple) ) ,
133
+ Some ( php_rshutdown ! ( r_shutdown_simple) ) ,
134
+ Some ( php_minfo ! ( m_info_simple) ) ,
135
+ None ,
136
+ None ,
137
+ ) ) ;
153
138
154
139
#[ zend_get_module]
155
140
pub fn get_module ( ) -> & ' static ModuleEntry {
0 commit comments