SPBasicSuite

Struct SPBasicSuite 

Source
#[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

Source§

fn clone(&self) -> SPBasicSuite

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SPBasicSuite

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for SPBasicSuite

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.