1mod _type;
4pub mod ce;
5mod class;
6mod ex;
7mod function;
8mod globals;
9mod handlers;
10mod ini_entry_def;
11mod linked_list;
12mod module;
13mod streams;
14mod try_catch;
15
16use crate::{
17 error::Result,
18 ffi::{php_printf, sapi_module},
19};
20use std::ffi::CString;
21
22pub use _type::ZendType;
23pub use class::ClassEntry;
24pub use ex::ExecuteData;
25pub use function::Function;
26pub use function::FunctionEntry;
27pub use globals::ExecutorGlobals;
28pub use globals::FileGlobals;
29pub use globals::ProcessGlobals;
30pub use globals::SapiGlobals;
31pub use globals::SapiHeader;
32pub use globals::SapiHeaders;
33pub use globals::SapiModule;
34pub use handlers::ZendObjectHandlers;
35pub use ini_entry_def::IniEntryDef;
36pub use linked_list::ZendLinkedList;
37pub use module::ModuleEntry;
38pub use streams::*;
39#[cfg(feature = "embed")]
40pub(crate) use try_catch::panic_wrapper;
41pub use try_catch::{bailout, try_catch, try_catch_first, CatchError};
42
43const FORMAT_STR: &[u8] = b"%s\0";
45
46pub fn printf(message: &str) -> Result<()> {
58 let message = CString::new(message)?;
59 unsafe {
60 php_printf(FORMAT_STR.as_ptr().cast(), message.as_ptr());
61 };
62 Ok(())
63}
64
65pub fn php_sapi_name() -> String {
73 let c_str = unsafe { std::ffi::CStr::from_ptr(sapi_module.name) };
74 c_str.to_str().expect("Unable to parse CStr").to_string()
75}