Function : Canonical Format Conversion

ODSWriteMemory - Convert a structure from machine-specific format to canonical format.
----------------------------------------------------------------------------------------------------------

#include <ods.h>

void LNPUBLIC ODSWriteMemory(
void far *ppDest,
WORD type,
const void far *pSrc,
WORD iterations);

Description :

This function converts Domino data structures from machine-specific (host) format to Domino canonical format. It writes the result into a memory buffer provided by the caller.

You must convert data structures to Domino canonical format before appending them to a note if (1) your API program runs on non-Intel architecture machines, and (2) your API program is writing a Domino data item of one of the data types listed below:

TYPE_COMPOSITE
TYPE_COLLATION
TYPE_OBJECT
TYPE_VIEW_FORMAT
TYPE_ICON
TYPE_SIGNATURE
TYPE_SEAL
TYPE_SEALDATA
TYPE_SEAL_LIST
TYPE_WORKSHEET_DATA
TYPE_USERDATA
Parameters :

Sample Usage :


void               *pCBuf;
COLLATION           Collation;
COLLATE_DESCRIPTOR  CollateDesc;
COLLATE_DESCRIPTOR  CollateDesc2;

/*
* Initialize pCBuf. Keep pCollationBuffer pointing to the top
* of the buffer, and pCBuf pointing to the next available byte.
*/
   pCBuf = (void *)pCollationBuffer;

/* Initialize the Collation structure. */

   Collation.Items = 1;
   Collation.Flags = NIF_STAT_NONE;
   Collation.signature = COLLATION_SIGNATURE;
   Collation.BufferSize = wCollationBufLen;
/*
* Convert the Collation structure to Domino canonical format and
* store it in the ODS buffer.
*/

   ODSWriteMemory( &pCBuf, _COLLATION, &Collation, 1 );
   
/*
*  Initialize the collation descriptor for the first column. The
*  first column is a category.
*/

   CollateDesc.Flags = 0;  
   CollateDesc.signature = COLLATE_DESCRIPTOR_SIGNATURE;
   CollateDesc.keytype = COLLATE_TYPE_CATEGORY;
   CollateDesc.NameOffset = 0;
   CollateDesc.NameLength = wItemName_1_Len;

/*
* Convert the collation descriptor for the first column to Domino
* canonical format, and store it in the buffer.
*/

   ODSWriteMemory( &pCBuf, _COLLATE_DESCRIPTOR, &CollateDesc, 1 );

/*
* Initialize the collation descriptor for the second column. The
* second column is sorted.
*/

   CollateDesc2.Flags = 0;
   CollateDesc2.signature = COLLATE_DESCRIPTOR_SIGNATURE;
   CollateDesc2.keytype = COLLATE_TYPE_KEY;
   CollateDesc2.NameOffset =  wItemName_1_Len;
   CollateDesc2.NameLength = wItemName_2_Len;

/*
* Convert the collation descriptor for the second column to Domino
* canonical format, and store it in the buffer.
*/

   ODSWriteMemory( &pCBuf, _COLLATE_DESCRIPTOR, &CollateDesc2, 1 );

/*  Append the column 1 item name to the buffer. */
   
   memcpy( pCBuf, szItemName_1, wItemName_1_Len );
   pCBuf += wItemName_1_Len;

/*  Append the column 2 item name to the buffer. */
   
   memcpy( pCBuf, szItemName_2, wItemName_2_Len );
   pCBuf += wItemName_2_Len;

/*  Now append the $COLLATION item to the note. */
   
   sError = NSFItemAppend( hNote,
                           ITEM_SUMMARY,
                           VIEW_COLLATION_ITEM,
                           sizeof(VIEW_COLLATION_ITEM) - 1,
                           TYPE_COLLATION,
                           pCollationBuffer,
                           (DWORD) wCollationBufLen );

   OSUnlockObject( hCollationBuffer);
   OSMemFree( hCollationBuffer );


See Also :

NSFItemAppend
----------------------------------------------------------------------------------------------------------