add functions for php cli

This commit is contained in:
Mark McCaskey 2019-03-21 17:18:25 -07:00
parent c58a7e0c37
commit b9e7449f64
2 changed files with 70 additions and 1 deletions

View File

@ -12,9 +12,24 @@ pub fn getTempRet0(_ctx: &mut Ctx) -> i32 {
debug!("emscripten::getTempRet0");
0
}
pub fn nullFunc_d(_ctx: &mut Ctx, _a: i32) {
debug!("emscripten::nullFunc_d");
}
pub fn nullFunc_ji(_ctx: &mut Ctx, _a: i32) {
debug!("emscripten::nullFunc_ji");
}
pub fn nullFunc_viidii(_ctx: &mut Ctx, _a: i32) {
debug!("emscripten::nullFunc_viidii");
}
pub fn nullFunc_iiiiiii(_ctx: &mut Ctx, _a: i32) {
debug!("emscripten::nullFunc_iiiiiii");
}
pub fn nullFunc_iiiiiiii(_ctx: &mut Ctx, _a: i32) {
debug!("emscripten::nullFunc_iiiiiiii");
}
pub fn nullFunc_iiiiiiiiii(_ctx: &mut Ctx, _a: i32) {
debug!("emscripten::nullFunc_iiiiiiiiii");
}
pub fn invoke_i(ctx: &mut Ctx, index: i32) -> i32 {
debug!("emscripten::invoke_i");
if let Some(dyn_call_i) = &get_emscripten_data(ctx).dyn_call_i {
@ -343,7 +358,48 @@ pub fn invoke_iiiiiii(
panic!("dyn_call_iiiiiii is set to None");
}
}
pub fn invoke_iiiiiiii(
ctx: &mut Ctx,
index: i32,
a1: i32,
a2: i32,
a3: i32,
a4: i32,
a5: i32,
a6: i32,
a7: i32,
) -> i32 {
debug!("emscripten::invoke_iiiiiiii");
if let Some(dyn_call_iiiiiiii) = &get_emscripten_data(ctx).dyn_call_iiiiiiii {
dyn_call_iiiiiiii
.call(index, a1, a2, a3, a4, a5, a6, a7)
.unwrap()
} else {
panic!("dyn_call_iiiiiiii is set to None");
}
}
pub fn invoke_iiiiiiiiii(
ctx: &mut Ctx,
index: i32,
a1: i32,
a2: i32,
a3: i32,
a4: i32,
a5: i32,
a6: i32,
a7: i32,
a8: i32,
a9: i32,
) -> i32 {
debug!("emscripten::invoke_iiiiiiiiii");
if let Some(dyn_call_iiiiiiiiii) = &get_emscripten_data(ctx).dyn_call_iiiiiiiiii {
dyn_call_iiiiiiiiii
.call(index, a1, a2, a3, a4, a5, a6, a7, a8, a9)
.unwrap()
} else {
panic!("dyn_call_iiiiiiiiii is set to None");
}
}
pub fn invoke_vd(ctx: &mut Ctx, index: i32, a1: f64) {
debug!("emscripten::invoke_vd");
if let Some(dyn_call_vd) = &get_emscripten_data(ctx).dyn_call_vd {

View File

@ -95,6 +95,8 @@ pub struct EmscriptenData<'a> {
pub dyn_call_iiiii: Option<Func<'a, (i32, i32, i32, i32, i32), i32>>,
pub dyn_call_iiiiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32), i32>>,
pub dyn_call_iiiiiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32), i32>>,
pub dyn_call_iiiiiiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32, i32), i32>>,
pub dyn_call_iiiiiiiiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32), i32>>,
pub dyn_call_vd: Option<Func<'a, (i32, f64)>>,
pub dyn_call_viiiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32)>>,
pub dyn_call_viiiiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32)>>,
@ -149,6 +151,8 @@ impl<'a> EmscriptenData<'a> {
let dyn_call_iiiii = instance.func("dynCall_iiiii").ok();
let dyn_call_iiiiii = instance.func("dynCall_iiiiii").ok();
let dyn_call_iiiiiii = instance.func("dynCall_iiiiiii").ok();
let dyn_call_iiiiiiii = instance.func("dynCall_iiiiiiii").ok();
let dyn_call_iiiiiiiiii = instance.func("dynCall_iiiiiiiiii").ok();
let dyn_call_vd = instance.func("dynCall_vd").ok();
let dyn_call_viiiii = instance.func("dynCall_viiiii").ok();
let dyn_call_viiiiii = instance.func("dynCall_viiiiii").ok();
@ -196,6 +200,8 @@ impl<'a> EmscriptenData<'a> {
dyn_call_iiiii,
dyn_call_iiiiii,
dyn_call_iiiiiii,
dyn_call_iiiiiiii,
dyn_call_iiiiiiiiii,
dyn_call_vd,
dyn_call_viiiii,
dyn_call_viiiiii,
@ -625,6 +631,11 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"setTempRet0" => func!(crate::emscripten_target::setTempRet0),
"getTempRet0" => func!(crate::emscripten_target::getTempRet0),
"nullFunc_ji" => func!(crate::emscripten_target::nullFunc_ji),
"nullFunc_d" => func!(crate::emscripten_target::nullFunc_d),
"nullFunc_viidii" => func!(crate::emscripten_target::nullFunc_viidii),
"nullFunc_iiiiiii" => func!(crate::emscripten_target::nullFunc_iiiiiii),
"nullFunc_iiiiiiii" => func!(crate::emscripten_target::nullFunc_iiiiiiii),
"nullFunc_iiiiiiiiii" => func!(crate::emscripten_target::nullFunc_iiiiiiiiii),
"invoke_i" => func!(crate::emscripten_target::invoke_i),
"invoke_ii" => func!(crate::emscripten_target::invoke_ii),
"invoke_iii" => func!(crate::emscripten_target::invoke_iii),
@ -689,6 +700,8 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"invoke_iiiii" => func!(crate::emscripten_target::invoke_iiiii),
"invoke_iiiiii" => func!(crate::emscripten_target::invoke_iiiiii),
"invoke_iiiiiii" => func!(crate::emscripten_target::invoke_iiiiiii),
"invoke_iiiiiiii" => func!(crate::emscripten_target::invoke_iiiiiiii),
"invoke_iiiiiiiiii" => func!(crate::emscripten_target::invoke_iiiiiiiiii),
"invoke_vd" => func!(crate::emscripten_target::invoke_vd),
"invoke_viiiii" => func!(crate::emscripten_target::invoke_viiiii),
"invoke_viiiiii" => func!(crate::emscripten_target::invoke_viiiiii),