' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * ' * Retrieving and updating Db replica information, timedate handling and other samples ' * (class memoryManagerExt code) ' * ' * sample code from ' * LotusScript to Lotus C API Programmer Guide by Normunds Kalnberzins, (c) 2000-2003 ' * ' * http://www.ls2capi.com ' * ' * Author: Normunds Kalnberzins ' * ' * This code has been written as a sample to illustrate aspects of handling of Lotus C API from LotusScript ' * and may be reused, modified on full responsibility of the developer and provided this notice is preserved ' * ' * The author does not guaranty it to fit any particular purpose and it is up to the developer ' * to modify, test it and determine the limits of its applicability ' * ' * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ' * * * * * * * * START (Class) [MEMORYMANAGEREXT] ' * * * * * * * * ' * ' * extends simple memory manager. This class provides a buffer pointer and frees memory when goes out of scope. Do not pass pointers out of subroutine in case memoryManager instance used is defined within subroutine scope. ' * %include "C:\lss\capis\samples\memoryManager" Public Class memoryManagerExt As memoryManager buffers List As Long ' * * * * * * * * START (Method) [NEWBUFFER] ' * * * * * * * * ' * ' * reserves a memory buffer and returns the pointer ' * Public Function newBuffer (lenBuff As Long) As Long Dim irc As Integer, hBuff As Long ' these handles are Long in all OSes irc =W32_OSMemoryAllocate (0, lenBuff, hBuff) If irc=0 Then If hBuff = 0 Then Exit Function ' paranoid chek - it should not be 0 if retrun code is OK buffers(hBuff)= W32_OSMemoryLock (hBuff) newBuffer = buffers(hBuff) Else Print getError(irc) End If End Function ' * * * * * * * * END (Method) [NEWBUFFER] ' * * * * * * * * ' * * * * * * * * START (Method) [DELETE] ' * * * * * * * * ' * ' * releases reserved memory ' * Public Sub Delete Forall p In Me.buffers W32_OSMemoryUnlock Listtag(p) W32_OSMemoryFree Listtag(p) End Forall End Sub ' * * * * * * * * END (Method) [DELETE] ' * * * * * * * * End Class' * memoryManagerExt ' * * * * * * * * END (Class) [MEMORYMANAGEREXT] ' * * * * * * * *