
Adobe Acrobat SDK
Working with Host Function Tables
Developing Plug-ins and Applications
Examining HFT header and source files 171
enum
{
DUMMYBLANKSELECTOR,
BeepOnceSEL,
BeepTwiceSEL,
BeepNTimesSEL,
NUMSELECTORSPlusOne
};
extern HFT gMyHFT;
#define NUMSELECTORS (NUMSELECTORSPlusOne - 1)
typedef ACCBPROTO1 void (ACCBPROTO2 *BeepOnceSELPROTO)(void);
#define BeepOnce (*((BeepOnceSELPROTO)(gMyHFT[BeepOnceSEL])))
typedef ACCBPROTO1 void (ACCBPROTO2 *BeepTwiceSELPROTO)(void);
#define BeepTwice (*((BeepTwiceSELPROTO)(gMyHFT[BeepTwiceSEL])))
typedef ACCBPROTO1 void (ACCBPROTO2 *BeepNTimesSELPROTO)(ASInt32 numtimes);
#define BeepNTimes (*((BeepNTimesSELPROTO)(gMyHFT[BeepNTimesSEL])))
/* End of MyHFT.h */
Examining
an HFT source file
The following code example shows the syntax of a source file used to create an HFT. Notice that the
methods (
BeepOnceImplementation
,
BeepTwiceImplementation
, and
BeepNTimesImplementation
) that the HFT will make available to other plug-ins are defined. Also
notice that the
PluginExportHFTs
method is defined. For information about this method, see
“Importing HFTs and registering for notifications” on page 29
.
Example 16.4
Examining an HFT source file
#include "corcalls.h"
#include "avcalls.h"
#include "coscalls.h"
#include "pdcalls.h"
#include "ascalls.h"
#include "myhft.h"
//Declare global variables
HFTServer gMyHFTServer = NULL;
HFT gMyHFT = NULL;
/*
** The implementation for the BeepOnce() function. Note it
** has a different name than the #define for the function
** in MyHFT.h
*/
ACCB1 void ACCB2 BeepOnceImplementation ()
{