refactor: add WF prefix for c/c++ binding members
This commit is contained in:
@@ -9,11 +9,9 @@
|
||||
//! The only thing that outer programs should note is that this string is volatile,
|
||||
//! once they get it, they must dupliate it immediately before any futher calling to this dynamic library.
|
||||
use std::cell::RefCell;
|
||||
use std::ffi::{CStr, CString, c_char};
|
||||
use std::ffi::{CStr, CString};
|
||||
use thiserror::Error as TeError;
|
||||
|
||||
/// The type representing the raw pointer to immutable C-style NUL-terminated string.
|
||||
pub type CStyleString = *const c_char;
|
||||
use crate::ffi_types::CStyleString;
|
||||
|
||||
// region: Error
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
//! The module including all FFI types used by this crate, except string type.
|
||||
//! For string type, see also [crate::cstr_ffi].
|
||||
|
||||
use std::ffi::c_void;
|
||||
use std::ffi::{c_void, c_char};
|
||||
use num_enum::TryFromPrimitive;
|
||||
|
||||
// region: File Extension Index
|
||||
// region: Misc Types and Constants
|
||||
|
||||
/// The type representing the raw pointer to immutable C-style NUL-terminated string.
|
||||
pub type CStyleString = *const c_char;
|
||||
|
||||
/// The invalid value of index.
|
||||
pub const INVALID_INDEX: usize = usize::MAX;
|
||||
|
||||
// endregion
|
||||
@@ -23,7 +27,7 @@ pub type HICON = *mut c_void;
|
||||
|
||||
/// The invalid value of Win32 HICON handle.
|
||||
///
|
||||
/// The same reason like [HICON] to re-define it in there.
|
||||
/// The same reason like [WFHICON] to re-define it in there.
|
||||
pub const INVALID_HICON: HICON = std::ptr::null_mut();
|
||||
|
||||
// endregion
|
||||
|
||||
@@ -202,9 +202,11 @@ static ICON_RC_POOL: LazyLock<RwLock<ObjectPool<wfassoc::win32::concept::IconRc>
|
||||
|
||||
// region: Exposed Types
|
||||
|
||||
pub use cstr_ffi::CStyleString;
|
||||
pub use ffi_types::{HICON, Scope, View};
|
||||
pub use object_pool::Token;
|
||||
pub use ffi_types::{
|
||||
CStyleString as WFCString, HICON as WFHICON, Scope as WFScope, View as WFView,
|
||||
};
|
||||
pub use ffi_types::{INVALID_HICON as WF_INVALID_HICON, INVALID_INDEX as WF_INVALID_INDEX};
|
||||
pub use object_pool::Token as WFToken;
|
||||
|
||||
// endregion
|
||||
|
||||
@@ -244,7 +246,7 @@ pub extern "C" fn WFShutdown() -> bool {
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFGetLastError() -> CStyleString {
|
||||
pub extern "C" fn WFGetLastError() -> WFCString {
|
||||
last_error::get_last_error()
|
||||
}
|
||||
|
||||
@@ -254,7 +256,7 @@ pub extern "C" fn WFHasPrivilege() -> bool {
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFInvalidToken() -> Token {
|
||||
pub extern "C" fn WFInvalidToken() -> WFToken {
|
||||
object_pool::invalid_token()
|
||||
}
|
||||
|
||||
@@ -263,16 +265,16 @@ pub extern "C" fn WFInvalidToken() -> Token {
|
||||
// region: Schema
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaCreate(out_schema: out_param_ty!(Token)) -> bool {
|
||||
cffi_wrapper!(|| -> (out_schema: Token) {
|
||||
pub extern "C" fn WFSchemaCreate(out_schema: out_param_ty!(WFToken)) -> bool {
|
||||
cffi_wrapper!(|| -> (out_schema: WFToken) {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
Ok(pool.allocate(Schema::new())?)
|
||||
})
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaDestroy(in_schema: in_param_ty!(Token)) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token| {
|
||||
pub extern "C" fn WFSchemaDestroy(in_schema: in_param_ty!(WFToken)) -> bool {
|
||||
cffi_wrapper!(|in_schema: WFToken| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
Ok(pool.free(in_schema)?)
|
||||
})
|
||||
@@ -280,10 +282,10 @@ pub extern "C" fn WFSchemaDestroy(in_schema: in_param_ty!(Token)) -> bool {
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaSetIdentifier(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token, in_value: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.set_identifier(cstr_ffi::parse_ffi_string(in_value)?);
|
||||
@@ -293,10 +295,10 @@ pub extern "C" fn WFSchemaSetIdentifier(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaSetPath(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token, in_value: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.set_path(cstr_ffi::parse_ffi_string(in_value)?);
|
||||
@@ -306,10 +308,10 @@ pub extern "C" fn WFSchemaSetPath(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaSetClsid(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token, in_value: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.set_clsid(cstr_ffi::parse_ffi_string(in_value)?);
|
||||
@@ -319,10 +321,10 @@ pub extern "C" fn WFSchemaSetClsid(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaSetName(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token, in_value: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
|
||||
@@ -338,10 +340,10 @@ pub extern "C" fn WFSchemaSetName(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaSetIcon(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token, in_value: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
|
||||
@@ -357,10 +359,10 @@ pub extern "C" fn WFSchemaSetIcon(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaSetBehavior(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token, in_value: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
|
||||
@@ -376,12 +378,12 @@ pub extern "C" fn WFSchemaSetBehavior(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaAddStr(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_name: in_param_ty!(CStyleString),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_name: in_param_ty!(WFCString),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(
|
||||
|in_schema: Token, in_name: CStyleString, in_value: CStyleString| {
|
||||
|in_schema: WFToken, in_name: WFCString, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.add_str(
|
||||
@@ -395,12 +397,12 @@ pub extern "C" fn WFSchemaAddStr(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaAddIcon(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_name: in_param_ty!(CStyleString),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_name: in_param_ty!(WFCString),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(
|
||||
|in_schema: Token, in_name: CStyleString, in_value: CStyleString| {
|
||||
|in_schema: WFToken, in_name: WFCString, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.add_icon(
|
||||
@@ -414,12 +416,12 @@ pub extern "C" fn WFSchemaAddIcon(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaAddBehavior(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_name: in_param_ty!(CStyleString),
|
||||
in_value: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_name: in_param_ty!(WFCString),
|
||||
in_value: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(
|
||||
|in_schema: Token, in_name: CStyleString, in_value: CStyleString| {
|
||||
|in_schema: WFToken, in_name: WFCString, in_value: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.add_behavior(
|
||||
@@ -433,17 +435,17 @@ pub extern "C" fn WFSchemaAddBehavior(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSchemaAddExt(
|
||||
in_schema: in_param_ty!(Token),
|
||||
in_ext: in_param_ty!(CStyleString),
|
||||
in_ext_name: in_param_ty!(CStyleString),
|
||||
in_ext_icon: in_param_ty!(CStyleString),
|
||||
in_ext_behavior: in_param_ty!(CStyleString),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
in_ext: in_param_ty!(WFCString),
|
||||
in_ext_name: in_param_ty!(WFCString),
|
||||
in_ext_icon: in_param_ty!(WFCString),
|
||||
in_ext_behavior: in_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token,
|
||||
in_ext: CStyleString,
|
||||
in_ext_name: CStyleString,
|
||||
in_ext_icon: CStyleString,
|
||||
in_ext_behavior: CStyleString| {
|
||||
cffi_wrapper!(|in_schema: WFToken,
|
||||
in_ext: WFCString,
|
||||
in_ext_name: WFCString,
|
||||
in_ext_icon: WFCString,
|
||||
in_ext_behavior: WFCString| {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.get_mut(in_schema)?;
|
||||
schema.add_ext(
|
||||
@@ -462,10 +464,10 @@ pub extern "C" fn WFSchemaAddExt(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramCreate(
|
||||
in_schema: in_param_ty!(Token),
|
||||
out_program: out_param_ty!(Token),
|
||||
in_schema: in_param_ty!(WFToken),
|
||||
out_program: out_param_ty!(WFToken),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_schema: Token| -> (out_program: Token) {
|
||||
cffi_wrapper!(|in_schema: WFToken| -> (out_program: WFToken) {
|
||||
let mut pool = pull_writer!(SCHEMA_POOL)?;
|
||||
let schema = pool.pop(in_schema)?;
|
||||
|
||||
@@ -476,8 +478,8 @@ pub extern "C" fn WFProgramCreate(
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramDestroy(in_program: in_param_ty!(Token)) -> bool {
|
||||
cffi_wrapper!(|in_program: Token| {
|
||||
pub extern "C" fn WFProgramDestroy(in_program: in_param_ty!(WFToken)) -> bool {
|
||||
cffi_wrapper!(|in_program: WFToken| {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
Ok(pool.free(in_program)?)
|
||||
})
|
||||
@@ -485,10 +487,10 @@ pub extern "C" fn WFProgramDestroy(in_program: in_param_ty!(Token)) -> bool {
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramResolveName(
|
||||
in_program: in_param_ty!(Token),
|
||||
out_name: out_param_ty!(CStyleString),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
out_name: out_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token| -> (out_name: CStyleString) {
|
||||
cffi_wrapper!(|in_program: WFToken| -> (out_name: WFCString) {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
|
||||
@@ -500,10 +502,10 @@ pub extern "C" fn WFProgramResolveName(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramResolveIcon(
|
||||
in_program: in_param_ty!(Token),
|
||||
out_icon_rc: out_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
out_icon_rc: out_param_ty!(WFToken),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token| -> (out_icon_rc: Token) {
|
||||
cffi_wrapper!(|in_program: WFToken| -> (out_icon_rc: WFToken) {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
|
||||
@@ -515,10 +517,10 @@ pub extern "C" fn WFProgramResolveIcon(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramExtsLen(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
out_len: out_param_ty!(usize),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token| -> (out_len: usize) {
|
||||
cffi_wrapper!(|in_program: WFToken| -> (out_len: usize) {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
Ok(program.exts_len())
|
||||
@@ -527,18 +529,18 @@ pub extern "C" fn WFProgramExtsLen(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramFindExt(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_body: in_param_ty!(CStyleString),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_body: in_param_ty!(WFCString),
|
||||
out_index: out_param_ty!(usize),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_body: CStyleString| -> (out_index: usize) {
|
||||
cffi_wrapper!(|in_program: WFToken, in_body: WFCString| -> (out_index: usize) {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
|
||||
let body = cstr_ffi::parse_ffi_string(in_body)?;
|
||||
let index = match program.find_ext(body) {
|
||||
Some(index) => index,
|
||||
None => ffi_types::INVALID_INDEX,
|
||||
None => WF_INVALID_INDEX,
|
||||
};
|
||||
Ok(index)
|
||||
})
|
||||
@@ -546,11 +548,11 @@ pub extern "C" fn WFProgramFindExt(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramResolveExt(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_index: in_param_ty!(usize),
|
||||
out_self_ext_status: out_param_ty!(Token),
|
||||
out_self_ext_status: out_param_ty!(WFToken),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_index: usize| -> (out_self_ext_status: Token) {
|
||||
cffi_wrapper!(|in_program: WFToken, in_index: usize| -> (out_self_ext_status: WFToken) {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
|
||||
@@ -563,13 +565,13 @@ pub extern "C" fn WFProgramResolveExt(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramRegister(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_scope: in_param_ty!(u32),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_scope: u32| {
|
||||
cffi_wrapper!(|in_program: WFToken, in_scope: u32| {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
let scope = resolve_enum!(Scope, in_scope)?;
|
||||
let scope = resolve_enum!(WFScope, in_scope)?;
|
||||
program.register(scope.into())?;
|
||||
Ok(())
|
||||
})
|
||||
@@ -577,13 +579,13 @@ pub extern "C" fn WFProgramRegister(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramUnregister(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_scope: in_param_ty!(u32),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_scope: u32| {
|
||||
cffi_wrapper!(|in_program: WFToken, in_scope: u32| {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
let scope = resolve_enum!(Scope, in_scope)?;
|
||||
let scope = resolve_enum!(WFScope, in_scope)?;
|
||||
program.unregister(scope.into())?;
|
||||
Ok(())
|
||||
})
|
||||
@@ -591,28 +593,28 @@ pub extern "C" fn WFProgramUnregister(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramIsRegistered(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_scope: in_param_ty!(u32),
|
||||
out_is_registered: out_param_ty!(bool),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_scope: u32| -> (out_is_registered: bool) {
|
||||
cffi_wrapper!(|in_program: WFToken, in_scope: u32| -> (out_is_registered: bool) {
|
||||
let pool = pull_reader!(PROGRAM_POOL)?;
|
||||
let program = pool.get(in_program)?;
|
||||
let scope = resolve_enum!(Scope, in_scope)?;
|
||||
let scope = resolve_enum!(WFScope, in_scope)?;
|
||||
Ok(program.is_registered(scope.into())?)
|
||||
})
|
||||
}
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramLinkExt(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_scope: in_param_ty!(u32),
|
||||
in_index: in_param_ty!(usize),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_scope: u32, in_index: usize| {
|
||||
cffi_wrapper!(|in_program: WFToken, in_scope: u32, in_index: usize| {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
let scope = resolve_enum!(Scope, in_scope)?;
|
||||
let scope = resolve_enum!(WFScope, in_scope)?;
|
||||
program.link_ext(scope.into(), in_index)?;
|
||||
Ok(())
|
||||
})
|
||||
@@ -620,14 +622,14 @@ pub extern "C" fn WFProgramLinkExt(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramUnlinkExt(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_scope: in_param_ty!(u32),
|
||||
in_index: in_param_ty!(usize),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_scope: u32, in_index: usize| {
|
||||
cffi_wrapper!(|in_program: WFToken, in_scope: u32, in_index: usize| {
|
||||
let mut pool = pull_writer!(PROGRAM_POOL)?;
|
||||
let program = pool.get_mut(in_program)?;
|
||||
let scope = resolve_enum!(Scope, in_scope)?;
|
||||
let scope = resolve_enum!(WFScope, in_scope)?;
|
||||
program.unlink_ext(scope.into(), in_index)?;
|
||||
Ok(())
|
||||
})
|
||||
@@ -635,15 +637,15 @@ pub extern "C" fn WFProgramUnlinkExt(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFProgramQueryExt(
|
||||
in_program: in_param_ty!(Token),
|
||||
in_program: in_param_ty!(WFToken),
|
||||
in_view: in_param_ty!(u32),
|
||||
in_index: in_param_ty!(usize),
|
||||
out_ext_status: out_param_ty!(Token),
|
||||
out_ext_status: out_param_ty!(WFToken),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_program: Token, in_view: u32, in_index: usize| -> (out_ext_status: Token) {
|
||||
cffi_wrapper!(|in_program: WFToken, in_view: u32, in_index: usize| -> (out_ext_status: WFToken) {
|
||||
let pool = pull_reader!(PROGRAM_POOL)?;
|
||||
let program = pool.get(in_program)?;
|
||||
let view = resolve_enum!(View, in_view)?;
|
||||
let view = resolve_enum!(WFView, in_view)?;
|
||||
|
||||
let ext_status = program.query_ext(view.into(), in_index)?;
|
||||
let token = match ext_status {
|
||||
@@ -662,8 +664,8 @@ pub extern "C" fn WFProgramQueryExt(
|
||||
// region: Extension Status
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFExtStatusDestroy(in_ext_status: in_param_ty!(Token)) -> bool {
|
||||
cffi_wrapper!(|in_ext_status: Token| {
|
||||
pub extern "C" fn WFExtStatusDestroy(in_ext_status: in_param_ty!(WFToken)) -> bool {
|
||||
cffi_wrapper!(|in_ext_status: WFToken| {
|
||||
let mut pool = pull_writer!(EXT_STATUS_POOL)?;
|
||||
Ok(pool.free(in_ext_status)?)
|
||||
})
|
||||
@@ -671,10 +673,10 @@ pub extern "C" fn WFExtStatusDestroy(in_ext_status: in_param_ty!(Token)) -> bool
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFExtStatusGetName(
|
||||
in_ext_status: in_param_ty!(Token),
|
||||
out_name: out_param_ty!(CStyleString),
|
||||
in_ext_status: in_param_ty!(WFToken),
|
||||
out_name: out_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_ext_status: Token| -> (out_name: CStyleString) {
|
||||
cffi_wrapper!(|in_ext_status: WFToken| -> (out_name: WFCString) {
|
||||
let pool = pull_reader!(EXT_STATUS_POOL)?;
|
||||
let ext_status = pool.get(in_ext_status)?;
|
||||
|
||||
@@ -685,10 +687,10 @@ pub extern "C" fn WFExtStatusGetName(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFExtStatusGetIcon(
|
||||
in_ext_status: in_param_ty!(Token),
|
||||
out_icon: out_param_ty!(HICON),
|
||||
in_ext_status: in_param_ty!(WFToken),
|
||||
out_icon: out_param_ty!(WFHICON),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_ext_status: Token| -> (out_icon: HICON) {
|
||||
cffi_wrapper!(|in_ext_status: WFToken| -> (out_icon: WFHICON) {
|
||||
let pool = pull_reader!(EXT_STATUS_POOL)?;
|
||||
let ext_status = pool.get(in_ext_status)?;
|
||||
|
||||
@@ -702,8 +704,8 @@ pub extern "C" fn WFExtStatusGetIcon(
|
||||
// region: Self Extension Status
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSelfExtStatusDestroy(in_self_ext_status: in_param_ty!(Token)) -> bool {
|
||||
cffi_wrapper!(|in_self_ext_status: Token| {
|
||||
pub extern "C" fn WFSelfExtStatusDestroy(in_self_ext_status: in_param_ty!(WFToken)) -> bool {
|
||||
cffi_wrapper!(|in_self_ext_status: WFToken| {
|
||||
let mut pool = pull_writer!(SELF_EXT_STATUS_POOL)?;
|
||||
Ok(pool.free(in_self_ext_status)?)
|
||||
})
|
||||
@@ -711,10 +713,10 @@ pub extern "C" fn WFSelfExtStatusDestroy(in_self_ext_status: in_param_ty!(Token)
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSelfExtStatusGetName(
|
||||
in_self_ext_status: in_param_ty!(Token),
|
||||
out_name: out_param_ty!(CStyleString),
|
||||
in_self_ext_status: in_param_ty!(WFToken),
|
||||
out_name: out_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_self_ext_status: Token| -> (out_name: CStyleString) {
|
||||
cffi_wrapper!(|in_self_ext_status: WFToken| -> (out_name: WFCString) {
|
||||
let pool = pull_reader!(SELF_EXT_STATUS_POOL)?;
|
||||
let self_ext_status = pool.get(in_self_ext_status)?;
|
||||
|
||||
@@ -725,10 +727,10 @@ pub extern "C" fn WFSelfExtStatusGetName(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSelfExtStatusGetIcon(
|
||||
in_self_ext_status: in_param_ty!(Token),
|
||||
out_icon: out_param_ty!(HICON),
|
||||
in_self_ext_status: in_param_ty!(WFToken),
|
||||
out_icon: out_param_ty!(WFHICON),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_self_ext_status: Token| -> (out_icon: HICON) {
|
||||
cffi_wrapper!(|in_self_ext_status: WFToken| -> (out_icon: WFHICON) {
|
||||
let pool = pull_reader!(SELF_EXT_STATUS_POOL)?;
|
||||
let self_ext_status = pool.get(in_self_ext_status)?;
|
||||
|
||||
@@ -739,10 +741,10 @@ pub extern "C" fn WFSelfExtStatusGetIcon(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSelfExtStatusGetExt(
|
||||
in_self_ext_status: in_param_ty!(Token),
|
||||
out_inner: out_param_ty!(CStyleString),
|
||||
in_self_ext_status: in_param_ty!(WFToken),
|
||||
out_inner: out_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_self_ext_status: Token| -> (out_inner: CStyleString) {
|
||||
cffi_wrapper!(|in_self_ext_status: WFToken| -> (out_inner: WFCString) {
|
||||
let pool = pull_reader!(SELF_EXT_STATUS_POOL)?;
|
||||
let self_ext_status = pool.get(in_self_ext_status)?;
|
||||
|
||||
@@ -753,10 +755,10 @@ pub extern "C" fn WFSelfExtStatusGetExt(
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFSelfExtStatusGetDottedExt(
|
||||
in_self_ext_status: in_param_ty!(Token),
|
||||
out_inner: out_param_ty!(CStyleString),
|
||||
in_self_ext_status: in_param_ty!(WFToken),
|
||||
out_inner: out_param_ty!(WFCString),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_self_ext_status: Token| -> (out_inner: CStyleString) {
|
||||
cffi_wrapper!(|in_self_ext_status: WFToken| -> (out_inner: WFCString) {
|
||||
let pool = pull_reader!(SELF_EXT_STATUS_POOL)?;
|
||||
let self_ext_status = pool.get(in_self_ext_status)?;
|
||||
|
||||
@@ -770,8 +772,8 @@ pub extern "C" fn WFSelfExtStatusGetDottedExt(
|
||||
// region: Icon Resource
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFIconRcDestroy(in_icon_rc: in_param_ty!(Token)) -> bool {
|
||||
cffi_wrapper!(|in_icon_rc: Token| {
|
||||
pub extern "C" fn WFIconRcDestroy(in_icon_rc: in_param_ty!(WFToken)) -> bool {
|
||||
cffi_wrapper!(|in_icon_rc: WFToken| {
|
||||
let mut pool = pull_writer!(ICON_RC_POOL)?;
|
||||
Ok(pool.free(in_icon_rc)?)
|
||||
})
|
||||
@@ -779,10 +781,10 @@ pub extern "C" fn WFIconRcDestroy(in_icon_rc: in_param_ty!(Token)) -> bool {
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
pub extern "C" fn WFIconRcGetIcon(
|
||||
in_icon_rc: in_param_ty!(Token),
|
||||
out_icon: out_param_ty!(HICON),
|
||||
in_icon_rc: in_param_ty!(WFToken),
|
||||
out_icon: out_param_ty!(WFHICON),
|
||||
) -> bool {
|
||||
cffi_wrapper!(|in_icon_rc: Token| -> (out_icon: HICON) {
|
||||
cffi_wrapper!(|in_icon_rc: WFToken| -> (out_icon: WFHICON) {
|
||||
let pool = pull_reader!(ICON_RC_POOL)?;
|
||||
let icon_rc = pool.get(in_icon_rc)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user