This commit is contained in:
Robin Appelman 2019-03-18 17:22:32 +01:00
commit 2c6fc98b87
7 changed files with 50 additions and 51 deletions

View file

@ -1,7 +1,7 @@
use libc::*;
use std::ffi::CString;
extern {
extern "C" {
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();
@ -29,4 +29,3 @@ pub fn print_table_start() {
pub fn print_table_end() {
unsafe { php_info_print_table_end() }
}

View file

@ -1,11 +1,10 @@
#![allow(dead_code)]
#![allow(unused_variables)]
extern crate libc;
#[macro_use]
pub mod macros;
pub mod zend;
pub mod info;
pub mod zend;

View file

@ -1,7 +1,6 @@
#[macro_export]
macro_rules! c_str {
($s:expr) => { {
($s:expr) => {{
concat!($s, "\0").as_ptr() as *const c_char
} }
}
}};
}

View file

@ -1,3 +1,3 @@
pub use self::module::*;
mod module;
mod module;

View file

@ -1,14 +1,14 @@
use libc::*;
use std;
use std::mem;
use libc::*;
type StartupFunc = extern fn (type_: c_int, module_number: c_int) -> c_int;
type ShutdownFunc = extern fn (type_: c_int, module_number: c_int) -> c_int;
type InfoFunc = extern fn () ;
type GlobalsCtorFunc = extern fn (global: *const c_void) -> c_void;
type GlobalsDtorFunc = extern fn (global: *const c_void) -> c_void;
type PostDeactivateFunc = extern fn () -> c_int;
type HandlerFunc = extern fn (execute_data: &ExecuteData, retval: &Value);
type StartupFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int;
type ShutdownFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int;
type InfoFunc = extern "C" fn();
type GlobalsCtorFunc = extern "C" fn(global: *const c_void) -> c_void;
type GlobalsDtorFunc = extern "C" fn(global: *const c_void) -> c_void;
type PostDeactivateFunc = extern "C" fn() -> c_int;
type HandlerFunc = extern "C" fn(execute_data: &ExecuteData, retval: &Value);
pub struct ExecuteData {}
pub struct Value {}
@ -16,16 +16,21 @@ pub struct ModuleDep {}
#[repr(C)]
pub struct ArgInfo {
name: *const c_char,
class_name: *const c_char,
type_hint: c_uchar,
pass_by_reference: c_uchar,
allow_null: c_uchar,
is_variadic: c_uchar,
}
name: *const c_char,
class_name: *const c_char,
type_hint: c_uchar,
pass_by_reference: c_uchar,
allow_null: c_uchar,
is_variadic: c_uchar,
}
impl ArgInfo {
pub fn new(name: *const c_char, allow_null: c_uchar, is_variadic: c_uchar, by_reference: c_uchar) -> ArgInfo {
pub fn new(
name: *const c_char,
allow_null: c_uchar,
is_variadic: c_uchar,
by_reference: c_uchar,
) -> ArgInfo {
ArgInfo {
name: name,
class_name: std::ptr::null(),
@ -39,11 +44,11 @@ impl ArgInfo {
#[repr(C)]
pub struct Function {
fname: *const c_char,
fname: *const c_char,
handler: Option<HandlerFunc>,
arg_info: *const ArgInfo,
num_args: u32,
flags: u32,
arg_info: *const ArgInfo,
num_args: u32,
flags: u32,
}
impl Function {
@ -57,7 +62,11 @@ impl Function {
}
}
pub fn new_with_args(name: *const c_char, handler: HandlerFunc, args: Box<[ArgInfo]>) -> Function {
pub fn new_with_args(
name: *const c_char,
handler: HandlerFunc,
args: Box<[ArgInfo]>,
) -> Function {
let num_args = args.len() as u32;
Function {
@ -78,7 +87,6 @@ impl Function {
flags: 0,
}
}
}
pub struct INI {}