#ifndef _USERWORD_H
#define _USERWORD_H

#include "basapi.h"


#define ERR_INVALID_RANGE          ( ERRORID ) 140 
/*@doc ASRADDED ASRERR 
*/
/*@type ERR_INVALID_RANGE | (140) invalid range specified.*/

/*@doc ASRTYPES
*/

typedef PVOID USERWORDBUF, *PUSERWORDBUF;
/* @type USERWORDBUF  | <t PVOID> representing a pointer to a user word buffer.*/
/* @type PUSERWORDBUF | pointer to <t USERWORDBUF>. */

/*@doc ASRADDED
*/
/* @func  Gives an acknowledge (and a decision) to the engine to continue the 
          user word training.*/
/* @rdesc Error code. */
ERRORID CasrAcknowledge(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to an engine installed opened with 
                <f CasrOpen> [INPUT].*/
  DWORD Decision/*@parm <t DWORD> | Decision | Decision of the application (PROMPT_OK, 
                  PROMPT_NOK or PROMPT_CANCEL) [INPUT].*/
);

/* @func This function adds a user word to a context. */
/* @rdesc Error code. */
/* @comm The parameter userWordBuf can be filled in with the buffer pointer returned
  via the API function CasrStartUserWordTraining, after the training process has been
  completed.
  <nl>When calling this function a next available user word ID range is assigned to
  the user word.  The range is returned via the first ID and the ID count.
  It can be a range because the specified class can occur several times in the
  grammar.  For each occurrence a new user word ID is generated. */
ERRORID CasrAddContextUserWord(
  HCONT hCont,                /* @parm <t HCONT> | hCont | Context instance handle [INPUT]. */
  HCLASSES hClasses,          /* @parm <t HCLASSES> | hClasses | Class names instance handle [INPUT]. */
  char *pszClass,             /* @parm Class name string [INPUT]. */
  USERWORDBUF userWordBuf,    /* @parm <t USERWORDBUF> | userWordBuf |User word data buffer [INPUT]. */
  DWORD dwUserWordSize,       /* @parm <t DWORD> | dwUserWordSize |User word data buffer byte size [INPUT]. */
  PCWORDID pnFirstUserWordId, /* @parm <t PCWORDID> | pnFirstUserWordId |First user word ID assigned [OUTPUT]. */
  PDWORD pcUserWordIds        /* @parm <t PDWORD> | pcUserWordIds |Number of user word IDs assigned [OUTPUT]. */
);

/* @func This function deletes a user word from a context. */
/* @rdesc Error code. */
/* @comm When calling this function all user word IDs bigger than nFirstUserWordId
  are decremented by cUserWordIds.
  <nl>User word IDs start from 0x80000000.
  <nl>This function deletes the range of user word IDs, as returned by the
  function CasrAddContextUserWord.
  <nl>Remark that only user words that have been added since the last context
  import can be deleted with this function. */
ERRORID CasrDeleteContextUserWord(
  HCONT hCont,              /* @parm <t HCONT> | hCont | Context instance handle [INPUT]. */
  HCLASSES hClasses,        /* @parm <t HCLASSES> | hClasses | Class names instance handle [INPUT]. */
  char *pszClass,           /* @parm Class name string [INPUT]. */
  CWORDID nFirstUserWordId, /* @parm <t CWORDID> | nFirstUserWordId | First user word ID. [INPUT]. */
  DWORD cUserWordIds        /* @parm <t DWORD> | cUserWordIds | Number of user word IDs [INPUT]. */
);


/* @func Starts the user word training.*/
/* @rdesc Error code. */
ERRORID CasrStartUserWordTraining(
  HASR hAsr,/*@parm <t HCASR> | hcAsr | Handle to the engine instance [INPUT].*/
  PUSERWORDBUF pUserWordBuf,/*@parm <t PUSERWORDBUF> | pUserWordBuf | Address of a variable 
							       that will receive a pointer to a buffer containing the 
								   user word data. This data can be used to add the word to
								   a context or to a dictionary by the user of the API. 
								   This buffer will only be valid upon a successful 
								   receipt of a <t PROMPTTYPE_TRAINEND> notification [OUTPUT].*/
  PDWORD pdwSize/*@parm <t PDWORD> | pdwSize | Address of variable that receives the length of the buffer [OUTPUT].*/
);

#endif
