#[repr(C)]pub struct SPBasicSuite {
pub AcquireSuite: Option<unsafe extern "C" fn(name: *const c_char, version: c_int, suite: *mut *const c_void) -> SPErr>,
pub ReleaseSuite: Option<unsafe extern "C" fn(name: *const c_char, version: c_int) -> SPErr>,
pub IsEqual: Option<unsafe extern "C" fn(token1: *const c_char, token2: *const c_char) -> SPBoolean>,
pub AllocateBlock: Option<unsafe extern "C" fn(size: usize, block: *mut *mut c_void) -> SPErr>,
pub FreeBlock: Option<unsafe extern "C" fn(block: *mut c_void) -> SPErr>,
pub ReallocateBlock: Option<unsafe extern "C" fn(block: *mut c_void, newSize: usize, newblock: *mut *mut c_void) -> SPErr>,
pub Undefined: Option<unsafe extern "C" fn() -> SPErr>,
}Expand description
@ingroup Suites This suite provides basic memory management for PICA (the Adobe plug-in manager) and defines the basic functions for acquiring and releasing other suites.
A suite consists of a list of function pointers. The application, or a plug-in that loads a suite, provides valid pointers when the suite is acquired. When a suite is not available, the pointers are set to the address of the \c #Undefined() function.
Do not attempt to acquire a suite (other than the \c #SPBlocksSuite) in response to a PICA access (\c #kSPAccessCaller) or property (\c #kSPPropertiesCaller) message. Most suites are unavailable during these load and unload operations.
You can acquire all the suites you will need when your plug-in is first loaded, as long as you release them before your plug-in is unloaded. At shutdown, however, it is most efficient to acquire only those suites explicitly needed to shut down; for example, to free memory and save preferences.
The \c SPBasicSuite itself is a part of the message data passed to your plug-in with any call. To access it from the message data structure: @code SPBasicSuite sBasic = message->d.basic; sBasic->function( ) @endcode
Fields§
§AcquireSuite: Option<unsafe extern "C" fn(name: *const c_char, version: c_int, suite: *mut *const c_void) -> SPErr>Acquires a function suite. Loads the suite if necessary, and increments its reference count. For example: @code SPErr error; SPBasicSuite *sBasic = message->d.basic; AIRandomSuite *sRandom; sBasic->AcquireSuite( kAIRandomSuite, kAIRandomVersion, &sRandom ); @endcode @param name The suite name. @param version The suite version number. @param suite [out] A buffer in which to return the suite pointer. @see \c #SPSuitesSuite::AcquireSuite()
ReleaseSuite: Option<unsafe extern "C" fn(name: *const c_char, version: c_int) -> SPErr>Decrements the reference count of a suite and unloads it when the reference count reaches 0. @param name The suite name. @param version The suite version number.
IsEqual: Option<unsafe extern "C" fn(token1: *const c_char, token2: *const c_char) -> SPBoolean>Compares two strings for equality. @param token1 The first null-terminated string. @param token2 The second null-terminated string. @return True if the strings are the same, false otherwise.
AllocateBlock: Option<unsafe extern "C" fn(size: usize, block: *mut *mut c_void) -> SPErr>Allocates a block of memory. @param size The number of bytes. @param block [out] A buffer in which to return the block pointer. @see \c #SPBlocksSuite::AllocateBlock()
FreeBlock: Option<unsafe extern "C" fn(block: *mut c_void) -> SPErr>Frees a block of memory allocated with \c #AllocateBlock(). @param block The block pointer. @see \c #SPBlocksSuite::FreeBlock()
ReallocateBlock: Option<unsafe extern "C" fn(block: *mut c_void, newSize: usize, newblock: *mut *mut c_void) -> SPErr>Reallocates a block previously allocated with \c #AllocateBlock(). Increases the size without changing the location, if possible. @param block The block pointer. @param newSize The new number of bytes. @param newblock [out] A buffer in which to return the new block pointer. @see \c #SPBlocksSuite::ReallocateBlock()
Undefined: Option<unsafe extern "C" fn() -> SPErr>A function pointer for unloaded suites. This is a protective measure against other plug-ins that may mistakenly use the suite after they have released it.
A plug-in that exports a suite should unload the suite’s procedure pointers when it is unloaded, and restore them when the plug-in is reloaded. \li On unload, replace the suite’s procedure pointers with the address of this function. \li On reload, restore the suite’s procedure pointers with the updated addresses of their functions.
For example: @code SPErr UnloadSuite( MySuite *mySuite, SPAccessMessage *message ) { mySuite->functionA = (void *) message->d.basic->Undefined; mySuite->functionB = (void *) message->d.basic->Undefined; }
SPErr ReloadSuite( MySuite *mySuite, SPAccessMessage *message ) { mySuite->functionA = functionA; mySuite->functionB = functionB; } @endcode
Trait Implementations§
Source§impl Clone for SPBasicSuite
impl Clone for SPBasicSuite
Source§fn clone(&self) -> SPBasicSuite
fn clone(&self) -> SPBasicSuite
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more