Last active
July 2, 2023 21:10
-
-
Save saivert/0df2ec9e824c0728240e6d3083c66c7d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! cstr { | |
($s:expr) => ( | |
concat!($s, "\0") as *const str as *const [std::ffi::c_char] as *const std::ffi::c_char | |
); | |
} | |
#[macro_export] | |
macro_rules! wp_spa_pod_new_object { | |
($object_type_name:expr, $object_id_name:expr, $( $name:expr, $type:expr, $value:expr ),*) => {{ | |
unsafe { | |
// wp_spa_pod_new_object ( | |
// "Spa:Pod:Object:Param:Profile", "Profile", | |
// "index", "i", cmdline.set_profile.index, | |
// NULL)); | |
let rawpod = wp::ffi::wp_spa_pod_new_object(cstr!($object_type_name), cstr!($object_id_name), | |
$( cstr!($name), cstr!($type), $value ),*, | |
std::ptr::null::<std::ffi::c_char>()); | |
let pod: wp::spa::SpaPod = glib::translate::from_glib_full(rawpod); | |
pod | |
} | |
}}; | |
} | |
macro_rules! wp_spa_pod_builder_add { | |
($builder:ident, $( $args:expr ),*) => {{ | |
unsafe { | |
let rawbuilder = $builder.as_ptr(); | |
wp::ffi::wp_spa_pod_builder_add(rawbuilder, $($args),* , std::ptr::null::<std::ffi::c_char>()); | |
} | |
}}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment