Application programming interface for adding editors

OpenTM2 provides an application programming interface (API) that lets you use various editors as translation editors. Using this API the editor can access all functions required for a translation, namely the Translation Memory, the automatic dictionary lookup, and the dictionary lookup dialog. OpenTM2 prepares the “Dictionary” and “Translation Memory” windows, establishes the communication links, handles all error conditions, and prepares and accesses the dictionaries and Translation Memory databases. The editor must provide the end-user interface to access the provided services and handle the retrieved data.

All API functions are provided as a dynamic-link library (DLL).

An editor that can be used as a translation editor must meet the following requirements:

  • Run as a Presentation Manager (R) application. A VIOwindowed application is not sufficient.
  • Be programmable.
  • Be able to access programs and DLLs written in C for multithread environments.
  • Be able to recognize specific tags and extract and decompose text according to this information.

The following sections describe the data types used by the API interface, possible error conditions, and the individual API calls for the interface provided by OpenTM2.
The editor must use the following structure to communicate with OpenTM2. The C interface binding is available in the file EQFTWBS.H.

Data types

typedef struct _STEQFSTRUCT
{
HWND hwndEdit ;                       /* handle of editor window */
CHAR szSemaphore [EQF_NAME];          /* space for the semaphore name */
HWND hwndEQFPropWnd;                  /* handle of proposal window */
HWND hwndEQFDictWnd;                  /* handle of dictionary window */
USHORT usIndustryCode;                /* industry code */
CHAR szProjPath [EQF_NAME];           /* path of file to be translated*/
CHAR szFileName [EQF_NAME];           /* currently transl. file */
RECTL rectlEQFPropWnd;                /* coordinates of proposal wnd */
RECTL rectlEQFDictWnd;                /* coordinates of dictionary wnd*/
SHORT sOS2;                           /* Error code */
} STEQFSTRUCT;

Return codes

The following list contains all return codes provided by OpenTM2. If an operating-system error is found, the EQFERR_SYSTEM is set and the extended return code is updated in the line stEQFStruct sOS2.

  • EQFERR_TM_ACCESS
The Translation Memory could not be accessed.
  • EQFERR_DICT_ACCESS
The dictionary or the dictionary lookup program could not be accessed.
  • EQF_OKAY
The request completed successfully.
  • EQFERR_INIT
The system must first be initialized.
  • EQFERR_CLOSE_DICT
An error occurred during the closing of the dictionary.
  • EQFERR_CLOSE_TM
An error occurred during the closing of the Translation Memory.
  • EQFERR_ENTRY_NOT_AVAIL
The selected proposal is not available.
  • EQFERR_DISK_FULL
OpenTM2 detected that the disk is full.
  • EQFERR_TM_NOT_ACTIVE
The Translation Memory is not active.
  • EQFERR_SEG_EMPTY
The passed segment was empty and therefore was not stored in the Translation Memory.
  • EQFERR_TM_CORRUPTED
The Translation Memory is corrupted.
  • EQFERR_SEG_NOT_FOUND
The specified segment was not found.
  • EQFERR_DICTLOOK_NOT_FOUND
The dictionary lookup dialog could not be loaded.
  • EQFERR_DICT_LOOKUP_PENDING
The dictionary lookup request is pending.
  • EQFERR_NO_ENTRY_AVAIL
The dictionary entry is not available.
  • EQFERR_SYSTEM
A system error occurred.

API calls

The following sections describe the individual API calls for the interface provided by OpenTM2. The following calls are available:

 

Call… described in
EQFCLEAR EQFCLEAR
EQFCLOSE EQFCLOSE
EQFCONVERTFILENAMES EQFCONVERTFILENAMES
EQFDELSEG EQFDELSEG
EQFDICTLOOK EQFDICTLOOK
EQFFILECONVERSIONEX EQFFILECONVERSIONEX
EQFGETDICT EQFGETDICT
EQFGETDOCFORMAT EQFGETDOCFORMAT
EQFGETPROP EQFGETPROP
EQFGETSEGNUM EQFGETSEGNUM
EQFGETSOURCELANG EQFGETSOURCELANG
EQFGETTARGETLANG EQFGETTARGETLANG
EQFINIT EQFINIT
EQFQUERYEXITINFO EQFQUERYEXITINFO
EQFSAVESEG EQFSAVESEG
EQFSEGFILECONVERTASCII2UNICODE EQFSEGFILECONVERTASCII2UNICODE
EQFSEGFILECONVERTUNICODE2ASCII EQFSEGFILECONVERTUNICODE2ASCII
EQFTRANSSEG EQFTRANSSEG
EQFWORDCNTPERSEG EQFWORDCNTPERSEG
EQFWRITEHISTLOG EQFWRITEHISTLOG

EQFCLEAR

Purpose

EQFCLEAR EQFCLEAR resets or clears the information stored.

Format

Chap20 Figure1.gif

Parameters
  • usFlag(USHORT)
Can be either of the following:
  • EQFF_NODICTWND
The “Dictionary” window is hidden.
  • EQFF_NOPRDPWND
The “Proposals” window is hidden.
Return codes
  • EQF_OKAY
The request completed successfully.
  • EQFERR_INIT
The system must first be initialized.
Remarks

This call is used to initialize the buffers and clear the “Dictionary” and “Translation Memory” windows after a new document is loaded.

EQFCLOSE

Purpose

EQFCLOSE EQFCLOSE closes the session with OpenTM2.

Format

Chap20 Figure2.gif

Parameters
  • fShutdown
Can be either of the following:
  • EQF_CLOSE_STANDBY
The services session is closed, the services remain active.
  • EQF_CLOSE_EXIT
The services are closed and destroyed.
Return codes
  • EQF_OKAY
The request completed successfully.
  • EQFERR_INIT
The system must first be initialized.
  • EQFERR_CLOSE_DICT
An error occurred during the closing of the dictionary.
  • EQFERR_CLOSE_TM
An error occurred during the closing of the Translation Memory.
  • EQFERR_SYSTEM
A system error occurred.
Remarks

This call must be the last OpenTM2 call, implicitly issued by OpenTM2.

EQFCONVERTFILENAMES

Purpose

EQFCONVERTFILENAMES converts long file names into short file names, and vice versa.

If the long file name is an empty string, the long file name is created from the short file name, and vice versa. If the short file name meets the 8.3 DOS naming conventions, the long file name is returned as a null pointer.

Format

Chap20 Figure3.gif

Parameters
  • pszFolder(PSTRING) — input
The name of the folder with path information, for example :\eqf\.f00.  can be extracted from pSegTarget or pSegSource as defined in eqf_xstart.
  • pszLongFileName(PSTRING) — input or output
The long file name without path information. It is used to get the short file name. If pszLongFileName==NULL, pszLongFileName is output.
  • pszShortFileName(PSTRING) — input or output
The short file name (8.3 DOS naming convention) without path information. It is used to get the long file name. If pszShortFileName==NULL, pszShortFileName is output.
Return codes

A OpenTM2 return code as defined in the file OS2TOWIN.H. A return code of null indicates successful processing.

Remarks

If a long file name is to be created from a short file name and the result is an empty string for pszLongFileName, the short file name applies to the 8.3 naming conventions.

Notes: Either pszLongFileName or pszShortFileName must be an empty string. The non-empty string must be a valid file name, otherwise an error is recorded.

EQFDELSEG

Purpose

EQFDELSEG EQFDELSEG deletes the specified segment from the Translation Memory, together with its information.

Format

Chap20 Figure4.gif

Parameters
  • pszBuffer1(PSTRING) — input
The buffer for the source segment to be deleted. It must have a length of EQF_BUFFERLEN. EQF_BUFFERLEN is defined in the file EQFTWBS.H.
  • pszBuffer2(PSTRING) — input
The buffer for the corresponding translation to be deleted. It must have a length of EQF_BUFFERLEN. EQF_BUFFERLEN is defined in the file EQFTWBS.H.
  • usSegNum(USHORT) — input
The segment number.
Return codes
  • EQFERR_SEG_NOT_FOUND
The specified segment was not found.
  • EQFERR_TM_ACCESS
The Translation Memory could not be accessed.
  • EQFERR_TM_CORRUPTED
The Translation Memory is corrupted.
  • EQF_OKAY
The request completed successfully.
  • EQFERR_INIT
The system must first be initialized.
Remarks

This call is useful if parts of combined segments are already translated. These parts are now meaningless and can therefore be deleted from the Translation Memory.

EQFDICTLOOK

Purpose

EQFDICTLOOK EQFDICTLOOK invokes the dictionary lookup dialog.

Format

Chap20 Figure5.gif

Parameters
  • pszBuffer1(PSTRING) — input
The buffer for the active segment. It must have a length of EQF_BUFFERLEN. EQF_BUFFERLEN is defined in the file EQFTWBS.H.
  • pszBuffer2(PSTRING) — input
The buffer for the marked area. It must have a length of EQF_BUFFERLEN. EQF_BUFFERLEN is defined in the file EQFTWBS.H.
  • usCursorPos(USHORT) — output
The position of the input cursor.
  • fSource — output
Determines whether the term looked up is in the source or target language (not used in the current OpenTM2 version).
Return codes
  • EQFERR_DICTLOOK_NOT_FOUND
The dictionary lookup dialog could not be loaded.
  • EQF_OKAY
The dictionary term is selected and copied into the provided buffer.
  • EQFERR_INIT
The system must first be initialized.
  • EQFERR_DICT_LOOKUP_PENDING
The dictionary lookup request is pending.
  • EQFERR_NO_ENTRY_AVAIL
The dictionary entry is not available.
Remarks

EQFERR_DICT_LOOKUP_PENDING indicates that a dictionary lookup is active. After selecting an entry or leaving the dictionary lookup dialog, the return code is reset to either EQF_OKAY or EQF_NO_ENTRY_AVAIL. From an editor’s point of view, this call is handled in the same way as EQFGETDICT (see EQFGETDICT).

EQFFILECONVERSIONEX

Purpose

EQFFILECONVERSIONEX is a helper function for user exits which require the files to be converted.

The new API function gives the possibility

  • to convert an ASCII file into ANSI (EQF_ASCII2ANSI)
  • to convert an ANSI file into ASCII (EQF_ANSI2ASCII)
  • to convert an ASCII file into UTF8 (EQF_ASCII2UTF8)
  • to convert an UTF8 file into ASCII (EQF_UTF82ASCII)
  • to convert an ASCII file into UTF16 (EQF_ASCII2UTF16)
  • to convert an UTF16 file into ASCII (EQF_UTF162ASCII)
  • to convert an ANSI file into UTF8 (EQF_ANSI2UTF8)
  • to convert an UTF8 file into ANSI (EQF_UTF82ANSI)
  • to convert an ANSI file into UTF16 (EQF_ANSI2UTF16)
  • to convert an UTF16 file into ANSI (EQF_UTF162ANSI)
  • to convert an UTF8 file into UTF16 (EQF_UTF82UTF16)
  • to convert an UTF16 file into UTF8 (EQF_UTF162UTF8)
Format

Chap20 Figure6.gif

Parameters
  • pszInFile(PSZ) — input
the fully qualified filename of the input file. or as defined in .
  • pszOutFile(PSZ) — input
the fully qualified filename of the output file.
  • pszLanguage(PSZ) — input
the language of the file (e.g. it can be retrieved with EQFGETSOURCELANG/EQFGETTARGETLANG).
  • usConversionType(USHORT) — input
identifier of type of conversion: ASCII2ANSI, ANSI2ASCII
  • EQF_ASCII2ANSI
  • EQF_ANSI2ASCII
  • EQF_ASCII2UTF8
  • EQF_UTF82ASCII
  • EQF_ASCII2UTF16
  • EQF_UTF162ASCII
  • EQF_ANSI2UTF8
  • EQF_UTF82ANSI
  • EQF_ANSI2UTF16
  • EQF_UTF162ANSI
  • EQF_UTF82UTF16
  • EQF_UTF162UTF8
  • usReturn(USHORT) — output
  • EQFRC_OK successfully completed
  • EQFS_FILE_OPEN_FAILED file cannot be opened
  • ERROR_STORAGE allocation of memory failed
  • ERROR_FILE_INVALID_DATA file contains data that cannot be converted
  • EQFRS_INVALID_PARM in all other cases of error
Return codes
  • EQFRC_OK successfully completed
  • EQFS_FILE_OPEN_FAILED file cannot be opened
  • ERROR_STORAGE allocation of memory failed
  • ERROR_FILE_INVALID_DATA file contains data that cannot be converted
  • EQFRS_INVALID_PARM in all other cases of error
Remarks

If the file pszOutFile exists already, it is overwritten.

The API EQFFILECONVERSION is not available any more in TM6.0.2. It has been replaced by the new API EQFFILECONVERSIONEX.

The pszInFile is converted according to the conversion type and written as the file pszOutFile. Output file and input file should be different files.

The input language is used to determine the ASCII and ANSI codepage for the conversion. Inside TM, exactly one ASCII /one ANSI codepage is attached to each possible language. The input language must be a valid TM source or target language.

If the language is NULL, the default target language of the system preferences is used for conversion.

If EQF_ASCII2ANSI is specified, it is assumed that the input file is in ASCII. If EQF_ANSI2ASCII is specified, it is assumed that the input file is in ANSI. If EQF_UTF162ANSI or EQF_UTF162ASCII or EQF_UTF162UTF8 is specified, the input file is checked for the byte order mark. For UTF16 files, a byte-order-mark is required. If the input file does not contain such a mark, ERROR_FILE_INVALID_DATA is returned.

For UTF8 input files, a byte-order-mark is accepted, however it is not required. UTF8 output files are written without a byte-order-mark.

If the input file contains characters which are not valid in the codepage of the input language, the API EQFFILECONVERSIONEX may fail with the error return ERROR_FILE_INVALID_DATA. EQFRS_INVALID_PARM is returned as error code if usConversionType is invalid.

Examples

Example

CHAR szInFile[145];
CHAR szOutFile[145];
CHAR szLanguage[20];
USHORT usRC = 0;
strcpy(szOutFile, "d:\temp\b.tst");
strcpy(szInFile,"d:\input\b.tst");
strcpy(szLanguage, "English(U.S)");

usRC = EQFFILECONVERSIONEX( szInFile, szOutFile, szLanguage, EQF_ASCII2ANSI );

EQFGETDICT

Purpose

EQFGETDICT retrieves the selected dictionary word and copies it into the provided buffer.

EQF_UP or EQF_DOWN scrolls the contents of the “Dictionary” window in the selected direction, if possible. EQF_LOOKUP can be used to retrieve the selected dictionary lookup term. The appropriate return code is set if the dictionary lookup is pending or no term is selected. EQF_UP, EQF_DOWN, and EQF_LOOKUP are defined in the file EQFTWBS.H.

Format

Chap20 Figure7.gif

Parameters
  • usNum(USHORT) — input
The number of the selected dictionary word (0…9, EQF_UP, EQF_DOWN, EQF_LOOKUP).
  • pszBuffer(PSTRING) — output
The buffer for the dictionary word. It must have a length of EQF_BUFFERLEN. EQF_BUFFERLEN is defined in the file EQFTWBS.H.
Return codes
  • EQFERR_ENTRY_NOT_AVAIL
The selected dictionary entry is not available.
  • EQF_OKAY
The selected dictionary term is available and copied into the provided buffer.
  • EQFERR_INIT
The system must first be initialized.
Remarks

If the selected dictionary word is not available, a warning message is issued.

EQFGETDOCFORMAT

Purpose

EQFGETDOCFORMAT retrieves the format (markup language) of the specified document.

Format

Chap20 Figure8.gif

Parameters
  • pszFolder(PSTRING) — input
The name of the folder with path information, for example :\eqf\.f00.  can be extracted from pSegTarget or pSegSource as defined in eqf_xstart .
  • pszFileName(PSTRING) — input
The short file name (8.3 DOS naming convention) without path information.
  • pszFormat(PSTRING) — output
The format (markup language) of the specified document.

EQFGETPROP

Purpose

EQFGETPROP retrieves the selected proposal and copies it to the provided buffer.

EQF_UP or EQF_DOWN scrolls the contents of the “Translation Memory” window in the selected direction, if possible. EQF_UP and EQF_DOWN are defined in the file EQFTWBS.H .

Format

Chap20 Figure9.gif

Parameters
  • usNum(USHORT) — input
The number of the selected proposal or match (0…9, EQF_UP, EQF_DOWN).
  • pszBuffer(PSTRING) — output
The buffer for the Translation Memory proposals. It must have a length of EQF_BUFFERLEN . EQF_BUFFERLEN is defined in the file EQFTWBS.H .
  • pusLevel(PUSHORT)
The pointer to the variable for the return match level.
Return codes
  • EQFERR_ENTRY_NOT_AVAIL
The selected proposal is not available.
  • EQF_OKAY
The selected proposal is available and copied into the provided buffer.
  • EQFERR_INIT
The system must first be initialized.
Remarks

If the selected proposal is not available, a warning message is issued and the appropriate return code is set.

EQFGETSEGNUM

Purpose

EQFGETSEGNUM retrieves the segment number of the currently selected proposal (the segment that was used before by the EQFGETPROP call).

Format

Chap20 Figure10.gif

Parameters
  • pulSegNum(PULONG) — output
The pointer to the ULONG variable receiving the segment number.
Return codes

One of the values listed in Return codes.

Remarks

You can use the retrieved segment number, for example, as input parameter with the EQFDELSEG call.

EQFGETSOURCELANG

Purpose

EQFGETSOURCELANG retrieves the source language of the specified document.

Format

Chap20 Figure11.gif

Parameters
  • pszFolder(PSTRING) — input
The name of the folder with path information, for example :\eqf\.f00.  can be extracted from pSegTarget or pSegSource as defined in eqf_xstart .
  • pszFileName(PSTRING) — input
The short file name (8.3 DOS naming convention) without path information.
  • pszSrcLang(PSTRING) — output
The source language.

EQFGETTARGETLANG

Purpose

EQFGETTARGETLANG retrieves the target language of the specified document.

Format

Chap20 Figure12.gif

Parameters
  • pszFolder(PSTRING) — input
The name of the folder with path information, for example :\eqf\.f00.  can be extracted from pSegTarget or pSegSource as defined in eqf_xstart .
  • pszFileName(PSTRING) — input or output
The short file name (8.3 DOS naming convention) without path information.
  • pszSrcLang(PSTRING) — output
The target language.

EQFINIT

Purpose

EQFINIT initializes OpenTM2 for use by an editor. This means, it creates the “Dictionary” and “Translation Memory” windows, establishes the communication links, attaches the Translation Memoryand dictionaries, and allocates the internal structures required by OpenTM2.

Format

Chap20 Figure13.gif

Parameters
  • pstEQFStruct(PSTEQFSTRUCT) — input
The number of sentences (0…9).
  • pszTranslationMemoryDatabases
The file name of the Translation Memory databases.
  • pszUserDictionaries
The name of the user-supplied dictionaries.
Return codes
  • EQFERR_TM_ACCESS
The Translation Memory could not be accessed.
  • EQFERR_TM_CORRUPTED
The Translation Memory is corrupted.
  • EQFERR_DICT_ACCESS
The dictionary or the dictionary lookup program could not be accessed.
  • EQF_OKAY
The request completed successfully.
  • EQFERR_SYSTEM
A system error occurred.
Remarks

The application must set the initial values for the position and size of the “Dictionary” and “Translation Memory” windows. If nothing is specified, the default values are used. If a problem occurs, a warning message is issued and the appropriate return code is set.

Notes: This call is implicitly issued by OpenTM2 and only listed for completeness reasons.

EQFQUERYEXITINFO

Purpose

The entry point EQFQUERYEXITINFOin QUERYEXIT_ADDFILES mode is called by OpenTM2 during folder export when a markup table having a user exit is added to the exported folder.

If the user exit requires other files beside the markup table (.TBL) file, the user exit DLL and the .markup table control file (.CHR) to be exported and imported with the folder it should place a list of these files in the supplied buffer area.

The list of files is a comma separated list of file names terminated by a null character (C string syntax).

The file names may not contain wildcard characters.

All files are specified with their relative path in the \EQF directory.

Files not located in the \EQF directory cannot be exported and imported using folder import.

Example:

The file list “TABLE\ADDFILE.CHR,WIN\MYDLL.DLL,WIN\LOCALE\XYZ.CNV” will export the files \EQF\TABLE\ADDFILE.CHR, \EQF\WIN\MYDLL.DLL and the file \EQF\WIN\LOCALE\YXZ.CNV in the exported folder. OpenTM2 versions prior to TP603 will only import the files contained in the \EQF\TABLE directory, files in other directories will be ignored.

If the user exit places a list of additional files in the supplied buffer it should return a return code of zero all other values are assumed to be error codes.

In the future there will be other modes of the entry point EQFQUERYEXITINFO, so the requested mode should be checked by the user exit.

Format

Chap20 Figure14.gif

Parameters
  • pszTagTable(PSZ) — input

The name of the active tag table; e.g. “IBMHTM32”

  • usMode(USHORT) — input
Mode of the function, currently on “QUERYEXIT_ADDFILES” is being used
  • pszBuffer(PSZ) — input
Points to a buffer which will receive the list of additional markup table files
  • usBufLen(USHORT) — input
Length of the supplied buffer area in number of bytes
Return codes

USHORT (zero = function completed successfully)

Example:

USHORT APIENTRY16 EQFQUERYEXITINFO
(
 PSZ pszTagTable,           // name of the markup table, e.g. "IBMHTM32"
 USHORT usMode,             // type of information being queried
 PSZ pszBuffer,             // buffer area receiving the information
                                   returned by the exit
 USHORT usBufLen            // length of buffer area
)
{
switch( usMode )
{
case QUERYEXIT_ADDFILES:
 strcpy( pszBuffer, "TABLE\MYINFO.CTL,WIN\MYDLL.DLL" );
 break;
default:
 usRC = 1;                  // mode is not supported by user exit
 } /* endswitch */
} /* end of function EQFQUERYEXITINFO */

In this sample the files \EQF\TABLE\MYINFO.CTL and \EQF\WIN\MYDLL.DLL are exported within the exported folder package.

EQFSAVESEG

Purpose

EQFSAVESEG saves the passed segment information in the Translation Memory.

Format

Chap20 Figure15.gif

Parameters
  • pszBuffer1(PSTRING) — input
The buffer for the source segment. It must have a length of EQF_BUFFERLEN . is defined in the file EQFTWBS.H .
  • pszBuffer2(PSTRING) — input
The buffer for the translated segment. It must have a length of EQF_BUFFERLEN . EQF_BUFFERLEN is defined in the file EQFTWBS.H .
  • usSegNum(USHORT) — input
The segment number.
Return codes
  • EQFERR_DISK_FULL
OpenTM2 detected that the disk is full.
  • EQFERR_TM_NOT_ACTIVE
The Translation Memory is not active.
  • EQFERR_SEG_EMPTY
The passed segment was empty and therefore was not stored in the Translation Memory.
  • EQF_OKAY
The dictionary term is selected and copied into the provided buffer.
  • EQFERR_INIT
The system must first be initialized.
Remarks

The editor must ensure that only correct data is saved in the Translation Memory. This means that the application must first check the spelling of the data.

EQFSEGFILECONVERTASCII2UNICODE

Purpose

EQFSEGFILECONVERTASCII2UNICODE gives the possibility to convert the segmented ASCII file to UTF16-Unicode (EQFSEGFILECONVERTASCII2UNICODE).

EQFSegFileConvertASCII2Unicode are helper functions for user exits which require the segmented files to be in ASCII whereas OpenTM2 expects the segmented files to be saved in Unicode.

The pszInFile is converted from ASCII to Unicode and written as the file pszOutFile. If the file pszOutFile already exists, it is overwritten. Only files which are correctly segmented, can be converted with this API.

Format

Chap20 Figure16.gif

Parameters
  • pszInFile(PSZ) — input
The fully qualified filename of a segmented file in ASCII format which should be converted .
  • pszOutFile(PSZ) — input
the fully qualified filename of the file to which pszInFile should be converted.
  • usReturn(USHORT) — output
Return codes
  • EQFRC_OK
successfully completed
  • ERROR_FILE_OPEN_FAILED
file read error
  • ERROR_STORAGE
allocation of memory failed.
  • ERROR_FILE_INVALID_DATA
segmentation of file is erraneous
  • EQFRS_INVALID_PARM
table cannot be accessed
Remarks

If the file pszOutFile exists already, it is overwritten.

EQFSEGFILECONVERTUNICODE2ASCII

Purpose

EQFSEGFILECONVERTUNICODE2ASCII gives the possibility to convert the segmented UTF16 -Unicode file to ASCII
(EQFSEGFILECONVERTUNICODE2ASCII)

EQFSegFileConvertUNICODE2ASCII are helper functions for user exits which require the segmented files to be in ASCII whereas OpenTM2 expects the segmented files to be saved in Unicode.

The pszInFile is converted from Unicode to ASCII and written as the file pszOutFile. If the file pszOutFile already exists, it is overwritten. Only files which are correctly segmented, can be converted with this API.

Format

Chap20 Figure17.gif

Parameters
  • pszInFile(PSZ) — input
The fully qualified filename of a segmented file in UTF16 Unicode format which should be converted .
  • pszOutFile(PSZ) — input
the fully qualified filename of the file to which pszInFile should be converted.
  • usReturn(USHORT) — output
Return codes
  • EQFRC_OK
successfully completed
  • ERROR_FILE_OPEN_FAILED
file read error
  • ERROR_STORAGE
allocation of memory failed.
  • ERROR_FILE_INVALID_DATA
segmentation of file is erraneous
  • EQFRS_INVALID_PARM
table cannot be accessed
Remarks

If the file pszOutFile exists already, it is overwritten.

EQFTRANSSEG

Purpose

EQFTRANSSEG retrieves the information available for the current segment and puts it into the internal waiting list.

OpenTM2 handles the layout and scrolling of the “Dictionary” and “Translation Memory” windows and the selection of entries.

Format

Chap20 Figure18.gif

Parameters
  • pszBuffer(PSTRING) — input
The buffer for the source segment. It must have a length of EQF_BUFFERLEN. EQF_BUFFERLEN is defined in the file EQFTWBS.H.
  • usSegNum(USHORT) — input
The segment number.
  • fShow(BOOL) — input
Determines whether the segment must immediately be displayed in the “Dictionary” or “Translation Memory” window:
  • TRUE – Put the segment into the “Dictionary” or “Translation Memory” window.
  • FALSE – Use the segment information as sentence.
  • fFlags(FLAG) — input
Determines what is displayed:
  • EQF_NODICTWND
No “Dictionary” window is displayed.
  • EQF_NOPROPWND
No “Translation Memory” window is displayed.
  • EQF_NOAUTODICT
The automatic dictionary lookup is disabled.
Return codes
  • EQFERR_DISK_FULL
OpenTM2 detected that the disk is full.
  • EQFERR_TM_CORRUPTED
The Translation Memory is corrupted.
  • EQFERR_TM_ACCESS
The Translation Memory could not be accessed.
  • EQFERR_DICT_ACCESS
The dictionary or the dictionary lookup program could not be accessed.
  • EQF_OKAY
The request completed successfully.
  • EQFERR_INIT
The system must first be initialized.
Remarks

If fShow is set to FALSE, the success indicator is immediately set to TRUE. In addition, the sentence is treated as a sentence and processed in the background. Any error information produced during background processing is stored and displayed when this segment is displayed.

If fShow is set to TRUE, this call first checks if the segment information is already prepared and can be immediately retrieved. If this is not the case, it is processed in the foreground.

The EQF_NOAUTODICT flag is used to determine if the dynamic dictionary lookup, which consumes a lot of performance, should be skipped.

EQFWORDCNTPERSEG

Purpose

EQFWORDCNTPERSEG counts the number of words and markup tags in the specified segment using the specified language and markup. To count the number of words in a document, the words must be counted segment by segment.

Format

Chap20 Figure19.gif

Parameters
  • pszSeg(PSTRING) — input
The segment of which the number of words and markup tags must be counted.
  • pszLang(PSTRING) — input’
The source or target language as provided by EQFGETSOURCELANG (see EQFGETSOURCELANG) or EQFGETTARGETLANG (see EQFGETTARGETLANG).
  • pszFormat(PSTRING) — input
The format of the document as provided by EQFGETDOCFORMAT (see EQFGETDOCFORMAT).
  • pulResult(PULONG) — output
The result of word counting.
  • pulMarkUp(PULONG) — output
The result of markup-tag counting.

EQFWRITEHISTLOG

Purpose

EQFWRITEHISTLOG writes the word-counting information to the history log file of the specified folder. The word-counting information for the entire document is needed.

Format

Chap20 Figure20.gif

Parameters
  • pszFolder(PSTRING) — input
The name of the folder with path information, for example :\eqf\.f00.  can be extracted from pSegTarget or pSegSource as defined in eqf_xstart .
  • pszFileName(PSTRING) — input
The short file name (8.3 DOS naming convention) without path information.
  • pszHistLogApi(PAPIDOCSAVEHIST) — input
The structure of the history log file:typedef struct _APISumPerClass
 {
 USHORT usNumSegs;                       // number of segments in this class
 ULONG ulSrcWords;                       // sum of all source words
 ULONG ulTgtWords;                       // sum of all target words
 } APISUMPERCLASS, *PAPISUMPERCLASS;

 typedef struct _APICriteriaSum
 {
 APISUMPERCLASS SimpleSum;               // number of segments in this class
 APISUMPERCLASS MediumSum;               // number of segments in this class
 APISUMPERCLASS ComplexSum; // number of segments in this class
 } APICRITERIASUM, *PAPICRITERIASUM;
 typedef struct _APIDocSaveHist
 {
 APICRITERIASUM EditAutoSubst;           // sums for segments translated by
 // Edit Auto
 APICRITERIASUM ExactExist;              // sums for segments with exact
 // proposals
 APICRITERIASUM ExactUsed;               // sums for segments with exact
 // proposals used by translator
 APICRITERIASUM FuzzyExist;              // sums for segments with fuzzy
 // proposals
 APICRITERIASUM FuzzyUsed;               // sums for segments with fuzzy
 // proposals used by translator
 APICRITERIASUM FuzzyExist_1;            // sums for segments with fuzzy
 // proposals
 APICRITERIASUM FuzzyUsed_1;             // sums for segments with fuzzy
 // proposals used by translator
 APICRITERIASUM FuzzyExist_2;            // sums for segments with fuzzy
 // proposals
 APICRITERIASUM FuzzyUsed_2;             // sums for segments with fuzzy
 // proposals used by translator
 APICRITERIASUM FuzzyExist_3;            // sums for segments with fuzzy
 // proposals
 APICRITERIASUM FuzzyUsed_3;             // sums for segments with fuzzy
 // proposals used by translator
 APICRITERIASUM MachExist;               // sums for segments with machine
 // proposals
 APICRITERIASUM MachUsed;                // sums for segments with machine
 // proposals used by translator
 APICRITERIASUM NoneExist;               // sums for segments with no proposal
 APICRITERIASUM NotXlated;               // sums for TOBE, ATTR, CURRENT
 } APIDOCSAVEHIST, *PAPIDOCSAVEHIST;

The various classes are described in The report layout. For this structure the thresholds of the standard editor were used, namely:

 

// defines for fuzzy classes
 #define FUZZY_THRESHOLD_1        0.7    // Threshold for different fuzzy
 // classes
 #define FUZZY_THRESHOLD_2        0.9    // Threshold for different fuzzy
 // classes

 // defines for the classes: simple sentences, medium sentences,
 // complex sentences
 #define SIMPLE_SENT_BOUND          5
 #define MEDIUM_SENT_BOUND         15