mirror of
https://github.com/icewind1991/ivory.git
synced 2026-06-03 18:54:07 +02:00
Added php::info::print_table_row()
This commit is contained in:
parent
b1a4a5fb8d
commit
28ecf2d162
2 changed files with 19 additions and 7 deletions
|
|
@ -32,9 +32,7 @@ pub extern fn php_module_shutdown(type_: c_int, module_number: c_int) -> c_int {
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern fn php_module_info() {
|
pub extern fn php_module_info() {
|
||||||
print_table_start();
|
print_table_start();
|
||||||
unsafe {
|
print_table_row(&["A demo PHP extension written in Rust", "enabled"]);
|
||||||
php_info_print_table_row(2, c_str!("A demo PHP extension written in Rust"), c_str!("enabled"));
|
|
||||||
}
|
|
||||||
print_table_end();
|
print_table_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
22
src/info.rs
22
src/info.rs
|
|
@ -1,16 +1,30 @@
|
||||||
use libc::*;
|
use libc::*;
|
||||||
|
use std::ffi::CString;
|
||||||
|
|
||||||
#[link_args = "-Wl,-undefined,dynamic_lookup"]
|
#[link_args = "-Wl,-undefined,dynamic_lookup"]
|
||||||
extern {
|
extern {
|
||||||
pub fn php_info_print_table_row(num_cols: c_int, ...) -> c_void;
|
|
||||||
pub fn php_info_print_table_row_ex(num_cols: c_int, a: *const c_char, ...);
|
|
||||||
pub fn php_info_print_table_start();
|
pub fn php_info_print_table_start();
|
||||||
|
pub fn php_info_print_table_row(num_cols: c_int, ...) -> c_void;
|
||||||
pub fn php_info_print_table_end();
|
pub fn php_info_print_table_end();
|
||||||
pub fn php_info_print_hr();
|
}
|
||||||
|
|
||||||
|
pub fn print_table_row(values: &[&str]) {
|
||||||
|
let nargs = values.len() as i32;
|
||||||
|
|
||||||
|
if nargs != 2 {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
|
|
||||||
|
let v1 = CString::new(values[0]).unwrap();
|
||||||
|
let v2 = CString::new(values[1]).unwrap();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
php_info_print_table_row(nargs, v1.as_ptr(), v2.as_ptr());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_table_start() {
|
pub fn print_table_start() {
|
||||||
unsafe { php_info_print_table_start() }
|
unsafe { php_info_print_table_start() };
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_table_end() {
|
pub fn print_table_end() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue