Adobe Acrobat SDK
Developing Plug-ins and Applications
Example 16.2 Creating new Host Table Functions
ACCB1 HFT ACCB2 ProvideMyHFT(HFTServer server, ASUns32 version,void *rock)
{
//Ensure version is 1
if (version != 1)
return NULL;
DURING
//Create a new HFT
gMyHFT = HFTNew(gMyHFTServer, NUMSELECTORS);
/*
** Replace the entries in the HFT
** with the methods that you want to make available.
*/
HFTReplaceEntry (gMyHFT,
BeepOnceSEL,ASCallbackCreateReplacement(BeepOnceSEL,&BeepOnce
Implementation), 0);
HFTReplaceEntry (gMyHFT,
BeepTwiceSEL,ASCallbackCreateReplacement(BeepTwiceSEL,&BeepTwice
Implementation), 0);
HFTReplaceEntry (gMyHFT,
BeepNTimesSEL,ASCallbackCreateReplacement(BeepNTimesSEL,&BeepNTimes
Implementation), 0);
HANDLER
END_HANDLER
return gMyHFT;
}
Examining HFT header and source files
To make it clear how to create HFTs, this section shows a typical header and source file that is used to
create an HFT. All concepts that are discussed up to this point are shown.
Examining
The following code example shows the syntax of a header file named myhft.h that is used to define HFT
constructs.
Example 16.3 Examining an HFT header file
#include "corcalls.h"
#include "avcalls.h"
#include "coscalls.h"
#include "pdcalls.h"
#include "ascalls.h"
return NULL;
an HFT header file
Working with Host Function Tables
Examining HFT header and source files
170