DL Logo

HFT Definitions

BAD_SELECTOR

Header: CoreExpT.h:155

Syntax

#define BAD_SELECTOR 0

HFTEntryReplaceable

Header: CoreExpT.h:187

Description

    A flag that specifies whether an HFT entry is replaceable:
  • If the flag is set, the new entry can be replaced. Clients should generally use this value, allowing other clients to subsequently replace the method again.
  • If the flag is not set, the new entry cannot be replaced.

Related Methods

Syntax

#define HFTEntryReplaceable ( 0x00000001 )

HFT_ERROR_NO_VERSION

Header: ASExpT.h:586

Syntax

#define HFT_ERROR_NO_VERSION ( 0xFFFFFFFF )

kHFT_IN_BETA_FLAG

Header: CoreExpT.h:175

Syntax

#define kHFT_IN_BETA_FLAG 0x80000000

HFT Typedefs

ASVersion

Header: ASExpT.h:171

Description

An HFT version number.

Syntax

typedef ASUns32 ASVersion;

Returned From

Used By

Used In

HFT

Header: CoreExpT.h:172

Syntax

typedef HFTEntry *HFT;

Returned From

Used By

HFTData

Header: ASExpT.h:606

Syntax

typedef const HFTDataRec *HFTData;

Used By

HFTEntry

Header: CoreExpT.h:161

Description

An HFTEntry may be cast to a pointer to a function whose prototype must be provided by the HFT's description file.

Syntax

typedef void *HFTEntry;

Returned From

Used By

Used In

Selector

Header: CoreExpT.h:154

Description

Uniquely identifies an entry within an HFT. It is simply the integer offset of the entry from the start of the HFT.

Syntax

typedef ASInt32 Selector;

Used By

HFT Callback Signatures

HFTServerProvideHFTProc

Header: ASExpT.h:631

Description

A callback for an HFT server. This returns an HFT with the specified version number. If the HFT has not yet been created, create and return it. If the HFT already exists, do not create a new copy of it; simply return the existing copy.

Note: The version numeric type has changed in Acrobat 6.0.

Syntax

HFT HFTServerProvideHFTProc(HFTServer hftServer, ASVersion version, void *rock);

Parameters

hftServer
The HFT server associated with this proc.
version
The HFT version being requested.
rock
User-supplied data passed in the call to HFTServerNew().

Returns

The requested version of the HFT.

Used By

HFT Structures

_t_HFTData

Header: ASExpT.h:592

Description

A data structure to pass to an HFT server to create a new HFT.

Related Methods

Syntax

struct _t_HFTData {
ASUns32 size;
Set to sizeof(HFTDataRec)
ASCount numSelectors;
The number of entries in the new HFT. This determines the number of methods that the HFT can contain; each method occupies one entry.
ASVersion version;
The version number.
const void *hftProcs;
Optional. This should point to an HFT array of function pointers.
} HFTDataRec;

HFT Functions

HFTDestroy

Header: ASProcs.h:234

Description

Destroys an existing HFT by freeing all the HFT's memory. Call this method only if you are absolutely sure that neither your plug-in nor any other plug-in will use the HFT again. Because this is usually impossible to know, plug-ins should not destroy HFTs. It is even dangerous to destroy an HFT at unload time, because the order in which plug-ins are unloaded is not specified.

Related Methods

Syntax

void HFTDestroy(HFT hft);

Parameters

hft
The HFT to destroy.

HFTGetReplacedEntry

Header: ASProcs.h:308

Description

Gets the HFTEntry that was replaced by the specified HFTEntry in the specified entry. Plug-ins should generally not use this method directly, but use the CALL_REPLACED_PROC macro instead.

It is necessary to specify both a selector (the index of an entry in the HFT's table of callback pointers) and an HFTEntry (a callback pointer) because a method may be replaced several times, and the various replacement methods are kept in a linked list. The selector determines which linked list is examined, and the HFTEntry determines the entry in the linked list to return.

Related Methods

Syntax

HFTEntry HFTGetReplacedEntry(HFT hft, Selector sel, HFTEntry oldEntry);

Parameters

hft
The HFT in which a replaced entry is retrieved. See HFTReplaceEntry() for more information.
sel
The selector whose previous value is obtained. See HFTReplaceEntry() for more information.
oldEntry
The HFTEntry for which the previous value is obtained.

Returns

The entry present prior to being replaced. NULL is returned if the entry has not been replaced.

HFTGetVersion

Header: ASProcs.h:2491

Description

Returns the version of the HFT, if available.

Related Methods

Syntax

ASVersion HFTGetVersion(HFT hft);

Parameters

hft
The HFT whose version is obtained.

Returns

The version number if the HFT is valid and the version is available, HFT_ERROR_NO_VERSION otherwise.

HFTIsValid

Header: ASProcs.h:1577

Description

Tests whether an HFT is valid.

Syntax

ASBool HFTIsValid(HFT hft);

Parameters

hft
IN/OUT The HFT to test.

Returns

true if hft is valid, false otherwise.

HFTNew

Header: ASProcs.h:220

Description

Obsolete. See HFTNewEx(). Creates a new HFT by calling the specified HFT server's HFTServerProvideHFTProc().

Syntax

HFT HFTNew(HFTServer hftServer, ASTCount numSelectors);

Parameters

hftServer
The HFT server for the HFT being created. The HFT server must have been created previously using HFTServerNew().
numSelectors
The number of entries in the new HFT. This determines the number of methods that the HFT can contain; each method occupies one entry.

Returns

The newly created HFT.

HFTNewEx

Header: ASProcs.h:2515

Description

Extends HFTNew() with version information in Acrobat 6. Creates a new HFT by calling the specified HFT server's HFTServerProvideHFTProc().

Syntax

HFT HFTNewEx(HFTServer hftServer, HFTData data);

Parameters

hftServer
The HFT server for the HFT being created. The HFT server must have been created previously using HFTServerNew().
data
    The data to pass to the server, which includes:
  • The number of entries in the new HFT, which determines the number of methods that the HFT can contain. Each method occupies one entry.
  • The HFT version.

Returns

The newly created HFT.

HFTReplaceEntry

Header: ASProcs.h:281

Description

Replaces the specified entry in the specified HFT. This allows a plug-in to override and replace certain methods in Acrobat's API. See Replaceable Methods for a list of replaceable methods. This method can be used from anywhere in the plug-in, but it makes the most sense for most plug-ins to replace methods in the importReplaceAndRegisterCallback() procedure. Plug-ins register their HFTs in the export callback, but the code to populate the function table is only executed when the first client requests the HFT.

Plug-ins can use the REPLACE macro instead of calling HFTReplaceEntry() directly.

All plug-ins, and Acrobat itself, share a single copy of each HFT. As a result, when a plug-in replaces the implementation of a method, all other plug-ins and Acrobat also use the new implementation of that method. In addition, once a method's implementation has been replaced, there is no way to remove the new implementation without restarting Acrobat.

Note: The CALL_REPLACED_PROC macro is available to call the previous HFT entry function that was replaced.

Syntax

void HFTReplaceEntry(HFT hft, Selector sel, HFTEntry newEntry, ASFlagBits flags);

Parameters

hft
The HFT in which a method is replaced. Use ASExtensionMgrGetHFT() to get the HFT, given its name. For the HFTs built into the Acrobat viewer, global variables containing the HFTs have been defined, so you can skip calling ASExtensionMgrGetHFT() for these HFTs.
sel
The entry in the HFT to replace, derived from the method's name by appending SEL. For example, to replace AVAlert, sel must be AVAlertSEL.
newEntry
The function to replace the current one. The function pointer must be converted to an HFTEntry using the ASCallbackCreateReplacement() macro.
flags
The new entry's properties. Currently, only HFTEntryReplaceable is defined.

Exceptions

HFTReplaceEntryEx

Header: ASProcs.h:2097

Description

A new version of HFTReplaceEntry() that adds the extension argument.

Plug-ins can use the REPLACE macro instead of calling HFTReplaceEntryEx directly.

Note: The CALL_REPLACED_PROC macro is available to call the previous HFT entry function that was replaced.

Syntax

void HFTReplaceEntryEx(HFT hft, Selector sel, HFTEntry newEntry, ASExtension extension, ASFlagBits flags);

Parameters

hft
The HFT in which a method is replaced. Use ASExtensionMgrGetHFT() to get the HFT, given its name. For the HFTs built into the Acrobat viewer, global variables containing the HFTs have been defined, so you can skip calling ASExtensionMgrGetHFT() for these HFTs.
sel
The entry in the HFT to replace, derived from the method's name by appending SEL. For example, to replace AVAlert, sel must be AVAlertSEL.
newEntry
The function to replace the current one. The function pointer must be converted to an HFTEntry using the ASCallbackCreateReplacement() macro.
extension
Plug-ins should pass in gExtensionID for this parameter (see the code for the Acrobat 5.0 version of the REPLACE macro). This parameter is stored by Acrobat so that any entries that were replaced by a plug-in can be unreplaced in the event that the plug-in unloads.
flags
The new entry's properties. Currently, only HFTEntryReplaceable is defined.

Exceptions

HFTUnreplaceEntry

Header: ASProcs.h:2123

Description

Removes the oldEntry item from hft at sel if the extension fields match. It allows HFT replacements to be undone in cases such as with the DigSig plug-in, which replaces a method that Acrobat could use after DigSig unloads.

Syntax

void HFTUnreplaceEntry(HFT hft, Selector sel, HFTEntry oldEntry, ASExtension extension);

Parameters

hft
The HFT in which a method is un-replaced. Use ASExtensionMgrGetHFT() to get the HFT, given its name. For the HFTs built into the Acrobat viewer, global variables containing the HFTs have been defined, so you can skip calling ASExtensionMgrGetHFT() for these HFTs.
sel
The entry in the HFT to un-replace, derived from the method's name by appending SEL. For example, to replace AVAlert, sel must be AVAlertSEL.
oldEntry
The old function to be replaced. The function pointer must be converted to an HFTEntry using the ASCallbackCreateReplacement() macro.
extension
An object of type ASExtension.