Headers/API/PIMain.c
/* pass in name of hft and minimum required version.  
   returns hft and version of the returned hft (>= requiredVer) and true if successful
   on failure, both resultHFT and resultingVer return as NULL
*/
pass in name of hft and minimum required version.
returns hft and version of the returned hft (>= requiredVer) and true if successful
on failure, both resultHFT and resultingVer return as NULL
pass in name of hft and minimum required version . returns hft and version of the returned hft ( > = requiredVer ) and true if successful on failure both resultHFT and resultingVer return as NULL
ASBool GetRequestedHFT(const char* table, ASUns32 requiredVer, ASUns32 *resultingVer, HFT *resultHFT)
{
	ASAtom tablename = ASAtomFromString(table);
	ASVersion resultVer = HFT_ERROR_NO_VERSION;
	static const ASUns32 versionLessVersions[] = {0x00050001, 0x00050000, 0x00040005, 0x00040000, 0x00020003, 0x00020002, 0x00020001};
	static const ASSize_t kNUMVERSIONS = sizeof(versionLessVersions) / sizeof(ASUns32);
	ASSize_t i;
	HFT thft = NULL; 
	if (gAcroSupportVersion >= ASCallsHFT_VERSION_6) {
		thft = ASExtensionMgrGetHFT(tablename, requiredVer); 
		if (thft) {
			resultVer = HFTGetVersion(thft);
				ACROASSERT(resultVer != HFT_ERROR_NO_VERSION); 
			}
	}
	if (resultVer == HFT_ERROR_NO_VERSION){
		for (i=0;i<kNUMVERSIONS;i++) {
			if (versionLessVersions[i]<requiredVer)
				break;
			thft = ASExtensionMgrGetHFT(tablename, versionLessVersions[i]);
			if (thft)
				break;
		}
		if (thft) 
			resultVer = versionLessVersions[i];
		else 
			resultVer = 0;
	}
	*resultHFT = thft;
	*resultingVer = resultVer;
#if TEST_OLD_VERSION < 0xFFFFFFFF
	if (*resultingVer > TEST_OLD_VERSION)
		*resultingVer = TEST_OLD_VERSION;
#endif
#if WIN_PLATFORM && DEBUG
	if (*resultingVer ==0) 
	{
		TCHAR err[255];
		wsprintf(err,_T("failed on %s version %s%x\n"),table,(requiredVer & kHFT_IN_BETA_FLAG) ?_T("(beta)"):_T(""),requiredVer & ~kHFT_IN_BETA_FLAG);
		OutputDebugString(err);
	}
#endif
	return *resultingVer != 0;
}
ASBool GetRequestedHFT ( const char * table , ASUns32 requiredVer , ASUns32 * resultingVer , HFT * resultHFT ) { ASAtom tablename = ASAtomFromString ( table ) ; ASVersion resultVer = HFT_ERROR_NO_VERSION ; static const ASUns32 versionLessVersions [ ] = { 0x00050001 , 0x00050000 , 0x00040005 , 0x00040000 , 0x00020003 , 0x00020002 , 0x00020001 } ; static const ASSize_t kNUMVERSIONS = sizeof ( versionLessVersions ) / sizeof ( ASUns32 ) ; ASSize_t i ; HFT thft = NULL ; if ( gAcroSupportVersion >= ASCallsHFT_VERSION_6 ) { thft = ASExtensionMgrGetHFT ( tablename , requiredVer ) ; if ( thft ) { resultVer = HFTGetVersion ( thft ) ; ACROASSERT ( resultVer != HFT_ERROR_NO_VERSION ) ; } } if ( resultVer == HFT_ERROR_NO_VERSION ) { for ( i = 0 ; i < kNUMVERSIONS ; i ++ ) { if ( versionLessVersions [ i ] < requiredVer ) break ; thft = ASExtensionMgrGetHFT ( tablename , versionLessVersions [ i ] ) ; if ( thft ) break ; } if ( thft ) resultVer = versionLessVersions [ i ] ; else resultVer = 0 ; } * resultHFT = thft ; * resultingVer = resultVer ; #if TEST_OLD_VERSION < 0xFFFFFFFF if ( * resultingVer > TEST_OLD_VERSION ) * resultingVer = TEST_OLD_VERSION ; #endif #if WIN_PLATFORM && DEBUG if ( * resultingVer == 0 ) { TCHAR err [ 255 ] ; wsprintf ( err , _T ( " \n " ) , table , ( requiredVer & kHFT_IN_BETA_FLAG ) ? _T ( " " ) : _T ( " " ) , requiredVer & ~ kHFT_IN_BETA_FLAG ) ; OutputDebugString ( err ) ; } #endif return * resultingVer != 0 ; }
pass in name of hft and minimum required version.
pass in name of hft and minimum required version .
/* these are the versions of Acrobat where we did not support GetVersion of an HFT. */ /* we use a temp hft in case we are replacing gCoreHFT */ /* all Acrobat HFTs support HFTGetVersion */ /* without a GetVersion version of the HFT, we must try all versions from latest on down and see what we get */