1#![allow(clippy::all)]
4#![allow(warnings)]
5
6use std::{ffi::c_void, os::raw::c_char};
7
8pub const ZEND_MM_ALIGNMENT: isize = 8;
9pub const ZEND_MM_ALIGNMENT_MASK: isize = -8;
10
11#[link(name = "wrapper")]
15unsafe extern "C" {
16 pub fn ext_php_rs_zend_string_init(
17 str_: *const c_char,
18 len: usize,
19 persistent: bool,
20 ) -> *mut zend_string;
21 pub fn ext_php_rs_zend_string_release(zs: *mut zend_string);
22 pub fn ext_php_rs_is_known_valid_utf8(zs: *const zend_string) -> bool;
23 pub fn ext_php_rs_set_known_valid_utf8(zs: *mut zend_string);
24
25 pub fn ext_php_rs_php_build_id() -> *const c_char;
26 pub fn ext_php_rs_zend_object_alloc(obj_size: usize, ce: *mut zend_class_entry) -> *mut c_void;
27 pub fn ext_php_rs_zend_object_release(obj: *mut zend_object);
28 pub fn ext_php_rs_zend_object_store_ctor_failed(obj: *mut zend_object);
29 pub fn ext_php_rs_executor_globals() -> *mut zend_executor_globals;
30 pub fn ext_php_rs_compiler_globals() -> *mut zend_compiler_globals;
31 pub fn ext_php_rs_process_globals() -> *mut php_core_globals;
32 pub fn ext_php_rs_sapi_globals() -> *mut sapi_globals_struct;
33 pub fn ext_php_rs_file_globals() -> *mut php_file_globals;
34 pub fn ext_php_rs_sapi_module() -> *mut sapi_module_struct;
35 pub fn ext_php_rs_output_activated() -> bool;
36 pub fn ext_php_rs_zend_try_catch(
37 func: unsafe extern "C" fn(*const c_void) -> *const c_void,
38 ctx: *const c_void,
39 result: *mut *mut c_void,
40 ) -> bool;
41
42 pub fn ext_php_rs_zend_first_try_catch(
43 func: unsafe extern "C" fn(*const c_void) -> *const c_void,
44 ctx: *const c_void,
45 result: *mut *mut c_void,
46 ) -> bool;
47
48 pub fn ext_php_rs_zend_bailout() -> !;
49 pub fn ext_php_rs_zend_compile_string(
50 source: *mut zend_string,
51 filename: *const c_char,
52 ) -> *mut zend_op_array;
53 pub fn ext_php_rs_zend_execute(op_array: *mut zend_op_array);
54}
55
56include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
57
58#[cfg(php86)]
59pub use php86::*;
60
61#[cfg(php86)]
62mod php86 {
63 use super::{
64 HashTable, zend_call_known_function_ex, zend_class_entry, zend_function,
65 zend_is_callable_ex, zend_object, zend_string, zval,
66 };
67 use std::ptr;
68
69 pub use super::{
70 zend_result_FAILURE as ZEND_RESULT_CODE_FAILURE,
71 zend_result_SUCCESS as ZEND_RESULT_CODE_SUCCESS,
72 };
73
74 pub const ZEND_INTERNAL_FUNCTION: u32 = 1;
75 pub const ZEND_USER_FUNCTION: u32 = 2;
76 pub const ZEND_EVAL_CODE: u32 = 4;
77
78 pub unsafe fn zend_call_known_function(
79 fn_: *mut zend_function,
80 object: *mut zend_object,
81 called_scope: *mut zend_class_entry,
82 retval_ptr: *mut zval,
83 param_count: u32,
84 params: *mut zval,
85 named_params: *mut HashTable,
86 ) {
87 unsafe {
88 zend_call_known_function_ex(
89 fn_,
90 object,
91 called_scope,
92 retval_ptr,
93 param_count,
94 params,
95 named_params,
96 0,
97 );
98 }
99 }
100
101 pub unsafe fn zend_is_callable(
102 callable: *const zval,
103 check_flags: u32,
104 callable_name: *mut *mut zend_string,
105 ) -> bool {
106 unsafe {
107 zend_is_callable_ex(
108 callable,
109 ptr::null_mut(),
110 check_flags,
111 callable_name,
112 ptr::null_mut(),
113 ptr::null_mut(),
114 )
115 }
116 }
117}