LotusScript to C API Programming Guide

rtLib Domino Rich Text Management template
Home
Hide details for ContentContent
Getting started
Basic declaration conversion
Data and reference types
Editing reference type items
Purchase
Ready-to-use samples
Show details for Online resourcesOnline resources
Forum
Links
Happy readers

Anonymous

login


 

Hosted by Prominic.NET, Inc.

Data and reference types


The table below contains a cheat list of data type correspondence between C and LotusScript. One characteristic mismatching feature is that C may contain both signed and unsigned types. All LotusScript datatypes with the exception of BYTE and String are signed. If WORD value in C is from 0 to 65535, Integer value in LotusScript is from -32768 to 32767.

It does not mean much when passing variables or when they get processed by C code – in hexadecimal representation it makes in both cases 0 to 0xFFFF; however when calculating in LotusScript special provisions should be made to treat the overflow correctly.
CLotusScriptComments
BYTEBytedoes not exist in LotusScript prior to Notes Domino 6
WORDIntegerSigned in LotusScript
SWORDIntegerSigned word/integer
DWORDLong-“”-
LONGLongSigned in both – LotusScript and C
HANDLE, NOTEHANDLE, DBHANDLEIntegerMacintosh, UNIXEes (except Linux, OS/390 and Solaris x86)
LongOS/2, Win32, Linux, Solaris x86, OS/400, OS/390
MEMHANDLELongUnsigned in C
Char *, Char * farString

Most of the parameters are passed by reference, i.e. passed a pointer to the variable; with little exceptions by value passed are WORD or DWORD flags and handles.

The following table shows when to pass variables by Value and when by Reference
Declared in CDeclared in LotusScriptComments
WORD someWordByVal someWord as IntegerThe arguments contain one word (or 2 bytes) value of variable
* WORD pSomeWordSomeWord as Integer

Or

ByRef someWord as Integer

Pointer to word value; arguments contain a pointer to value – usually Long or DWORD
* * DWORD hSomeWordsomePointer as Long

or

ByRef somePointer as Long

Pointer to pointer; this one is a bit tricky; pointer is long in all OSes except OS400 where it is 16 bytes – so this is not applicable to OS/400
Char *, Char * far SomeStrByVal someStr as StringFor some esoteric reason to pass a pointer to string we need to declare it by value; according to Designer help declaration byRef is possible, but C program must expect the specific format – C API does expect a normal pointer.
Char * far *far SomeStrpSomeString as LongPointer to pointer to string
* SOMESTRTYPE someStrSomeStr as SomeStrTypeStructure by reference
SOMESTRTYPE someStrByVal SomeStrElement1 as Integer, ByVal SomeStrElement2 as Integer,This one is nasty, structure is passed by value; only way in LotusScript is to declare several parameters byVal, besides there may be alignment issues between different platforms