the smallest yet worst typo i've done so far

This commit is contained in:
husky 2023-07-21 03:42:55 -07:00
parent 046ca01923
commit 8035172bdb
No known key found for this signature in database
GPG key ID: 6B3D8CB511646891
2 changed files with 2 additions and 42 deletions

View file

@ -63,24 +63,11 @@ mod tests;
pub struct Args {
pub service: NTSTR,
// ieee 1275, 2.4.1 General conventions: "All numbers on the stack are signed integers, _32 bits[...]"
pub nrets: i32,
pub nargs: i32,
pub nrets: i32,
// inheriting structs will continue from here
}
/// # ServiceResult
/// a generic structure for accessing the results of a service call
#[allow(dead_code)]
pub struct ServiceResult<'a> {
/// whether or not the service call was successful
pub success: bool,
/// a buffer for storing the arguments and return values of the service call
/// should not be used directly
pub buf: &'a mut [i32],
/// a slice of the buffer containing the return values of the service call
pub rets: &'a [i32],
}
/// # call!
/// a macro for calling OpenFirmware services
/// ## example
@ -126,9 +113,6 @@ macro_rules! call {
///
/// let entry_fn: EntryFunction = unimplemented!("get the entry function from somewhere");
/// let package_instance: i32 = unimplemented!("get the package instance from somewhere");
/// // note the usage of the `method_service_result!` macro instead of `service_result!`
/// // this is required as the `call_method!` macro requires a
/// // slightly different ServiceResult struct configuration
/// // <entry function>, <package instance>, <method name>, <# of args>, <# of rets>, <args...>
/// let (success, returns): (bool, [i32; 1]) = call_method!(entry_fn, package_instance, ntstr!("seek"), 2, 1, 0, 0);
/// if success {
@ -158,30 +142,6 @@ macro_rules! call_method {
};
}
/// # service_result!
/// a macro for creating a ServiceResult struct, used with the `call!` macro
#[macro_export]
macro_rules! service_result {
($nargs:expr, $nrets:expr) => { $crate::ServiceResult {
success: false,
buf: &mut [0; $nargs + $nrets],
rets: &[],
}};
}
/// # method_service_result!
/// a macro for creating a ServiceResult struct, used with the `call_method!` macro
#[macro_export]
macro_rules! method_service_result {
($nargs:expr, $nrets:expr) => {
$crate::ServiceResult {
success: false,
buf: &mut [0; $nargs + $nrets + 1],
rets: &[],
}
};
}
/// # ofw_call
/// a function to call any OpenFirmware-provided service
/// usage of the macro `call!` is preferred, but this function can be used directly

View file

@ -39,7 +39,7 @@ fn call_ofw() {
let entry_fn: EntryFunction = test_entry_function;
let (success, results) = call!(entry_fn, ntstr!("test"), 1, 1, ntstr!("test"));
assert!(success);
assert_eq!(results[0], 0);
assert_eq!(results[0], OFW_FALSE);
}