' ########################################################################################
' Microsoft Windows
' File: ElsCore.inc
' Contents: Structures and function prototypes that are common for ELS.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_ElsCore_PBI)
#DEFINE PBX_ElsCore_PBI
%EQUATE `ELSCORE_INC = 1
'struct _MAPPING_PROPERTY_BAG;
'typedef void (CALLBACK* PFN_MAPPINGCALLBACKPROC)(struct _MAPPING_PROPERTY_BAG *pBag, LPVOID data, DWORD dwDataSize, HRESULT Result);
'SUB MAPPINGCALLBACKPROC(BYREF pBag AS MAPPING_PROPERTY_BAG, BYVAL pData AS DWORD, BYVAL dwDataSize AS DWORD, BYVAL Result AS LONG)
'//
'// Service types constants used in MAPPING_ENUM_OPTIONS (ServiceType field)
'//
%EQUATE `ALL_SERVICE_TYPES = 0
%EQUATE `HIGHLEVEL_SERVICE_TYPES = 1
%EQUATE `LOWLEVEL_SERVICE_TYPES = 2
'//
'// Online service constants used in MAPPING_ENUM_OPTIONS (OnlineService field)
'//
%EQUATE `ALL_SERVICES = 0
%EQUATE `ONLINE_SERVICES = 1
%EQUATE `OFFLINE_SERVICES = 2
'//
'// Public ELS structures
'//
' // Size = 104 bytes
TYPE MAPPING_SERVICE_INFO BYTE
 Size AS DWORD ' size_t
 pszCopyright AS WSTRINGZ PTR ' LPWSTR *
 wMajorVersion AS WORD ' WORD
 wMinorVersion AS WORD ' WORD
 wBuildVersion AS WORD ' WORD
 wStepVersion AS WORD ' WORD
 dwInputContentTypesCount AS DWORD
 prgInputContentTypes AS WSTRINGZ PTR ' LPWSTR *
 dwOutputContentTypesCount AS DWORD
 prgOutputContentTypes AS WSTRINGZ PTR ' LPWSTR *
 dwInputLanguagesCount AS DWORD
 prgInputLanguages AS WSTRINGZ PTR ' LPWSTR *
 dwOutputLanguagesCount AS DWORD
 prgOutputLanguages AS WSTRINGZ PTR ' LPWSTR *
 dwInputScriptsCount AS DWORD
 prgInputScripts AS WSTRINGZ PTR ' LPWSTR *
 dwOutputScriptsCount AS DWORD
 prgOutputScripts AS WSTRINGZ PTR ' LPWSTR *
 guid AS GUID ' GUID
 pszCategory AS WSTRINGZ PTR ' LPWSTR *
 pszDescription AS WSTRINGZ PTR ' LPWSTR *
 dwPrivateDataSize AS DWORD
 pPrivateData AS DWORD
 pContext AS DWORD
 IsOneToOneLanguageMapping AS BIT * 1 IN DWORD ' unsigned
 HasSubservices AS BIT * 1
 OnlineOnly AS BIT * 1
 ServiceType AS BIT * 2
END TYPE
' // Size = 40 bytes
TYPE MAPPING_ENUM_OPTIONS BYTE
 Size AS DWORD ' size_t
 pszCategory AS WSTRINGZ PTR
 pszInputLanguage AS WSTRINGZ PTR
 pszOutputLanguage AS WSTRINGZ PTR
 pszInputScript AS WSTRINGZ PTR
 pszOutputScript AS WSTRINGZ PTR
 pszInputContentType AS WSTRINGZ PTR
 pszOutputContentType AS WSTRINGZ PTR
 pGuid AS GUID PTR ' GUID *
 OnlineService AS BIT * 2 IN DWORD ' unsigned
 ServiceType AS BIT * 2
END TYPE
' // Size = 64 bytes
TYPE MAPPING_OPTIONS BYTE
 Size AS DWORD ' size_t
 pszInputLanguage AS WSTRINGZ PTR
 pszOutputLanguage AS WSTRINGZ PTR
 pszInputScript AS WSTRINGZ PTR
 pszOutputScript AS WSTRINGZ PTR
 pszInputContentType AS WSTRINGZ PTR
 pszOutputContentType AS WSTRINGZ PTR
 pszUILanguage AS WSTRINGZ PTR
 pfnRecognizeCallback AS DWORD ' PFN_MAPPINGCALLBACKPROC
 pRecognizeCallerData AS DWORD
 dwRecognizeCallerDataSize AS DWORD
 pfnActionCallback AS DWORD ' PFN_MAPPINGCALLBACKPROC
 pActionCallerData AS DWORD
 dwActionCallerDataSize AS DWORD
 dwServiceFlag AS DWORD
 GetActionDisplayName AS BIT * 1 IN DWORD ' unsigned
END TYPE
' // Size = 40 bytes
TYPE MAPPING_DATA_RANGE BYTE
 dwStartIndex AS DWORD
 dwEndIndex AS DWORD
 pszDescription AS WSTRINGZ PTR
 dwDescriptionLength AS DWORD
 pData AS DWORD
 dwDataSize AS DWORD
 pszContentType AS WSTRINGZ PTR
 prgActionIds AS WSTRINGZ PTR ' LPWSTR *
 dwActionsCount AS DWORD
 prgActionDisplayNames AS WSTRINGZ PTR ' LPWSTR *
END TYPE
' // Size = 32 bytes
TYPE MAPPING_PROPERTY_BAG BYTE
 Size AS DWORD ' size_t
 prgResultRanges AS MAPPING_DATA_RANGE PTR ' PMAPPING_DATA_RANGE
 dwRangesCount AS DWORD
 pServiceData AS DWORD
 dwServiceDataSize AS DWORD
 pCallerData AS DWORD
 dwCallerDataSize AS DWORD
 pContext AS DWORD
END TYPE
'//
'// Public ELS APIs
'//
DECLARE FUNCTION MappingGetServices LIB "elscore.dll" ALIAS "MappingGetServices" ( BYREF pOptions AS MAPPING_ENUM_OPTIONS , BYREF prgServices AS MAPPING_SERVICE_INFO , BYREF pdwServicesCount AS QUAD ) AS LONG
DECLARE FUNCTION MappingFreeServices LIB "elscore.dll" ALIAS "MappingFreeServices" ( BYREF pServiceInfo AS MAPPING_SERVICE_INFO
 ) AS LONG
DECLARE FUNCTION MappingRecognizeText LIB "elscore.dll" ALIAS "MappingRecognizeText" ( BYREF pServiceInfo AS MAPPING_SERVICE_INFO
 , BYREF pszText AS WSTRINGZ
 , BYVAL dwLength AS DWORD
 , BYVAL dwIndex AS DWORD
 , BYREF pOptions AS MAPPING_OPTIONS
 , BYREF pbag AS MAPPING_PROPERTY_BAG
 ) AS LONG
DECLARE FUNCTION MappingDoAction LIB "elscore.dll" ALIAS "MappingDoAction" ( BYREF pBag AS MAPPING_PROPERTY_BAG
 , BYVAL dwRangeIndex AS DWORD
 , BYREF pszActionId AS WSTRINGZ
 ) AS LONG
DECLARE FUNCTION MappingFreePropertyBag LIB "elscore.dll" ALIAS "MappingFreePropertyBag" ( BYREF pBag AS MAPPING_PROPERTY_BAG
 ) AS LONG
#ENDIF
