RE: Tsunami Record Manager
- Posted by tlmotl at trm-ug.com Oct 26, 2002
- 633 views
My attention was brought to this thread by an interested party who "suggested" that the author of the Tsunami Record Manager (that would be me) should contribute a little time to help produce a Euphoria interface. I agreed. I downloaded a copy of Euphoria (very nice language, btw) and took the first step by writing the following code to get things started. Not being familiar with the Euphorian way of doing things, I'm reluctant to push forward until some of you more experienced EUgurus bless or curse this first step. Am I headed in the right direction, or are there better ways to this? If anyone is interested in testing this, please get the latest TRM.DLL from the download page at www.trm-ug.com (ver 2.3). This code snippet looks for the trmdemo.dat file, which is a Tsunami data file created by running the Tsunami PowerBASIC demo on our site. I'd also recommend downloading the TRM.PDF file from the PowerBASIC section of our download page. Timm Motl Tsunami Users Group Advantage Systems -- Tsunami test ----------------------------------------------------- -- requires TRM.DLL and trmdemo.dat include msgbox.e procedure WinMain() atom trm, trm_Op, trm_File, trm_DataPtr, trm_DataLen, trm_KeyPtr, trm_KeyLen, trm_KeyNo sequence fileName atom fileNameAddress, result, total trm = define_c_func(open_dll("TRM.DLL"), "trm", {C_INT, C_INT, C_INT, C_INT, C_INT, C_INT, C_INT}, C_INT) if trm = -1 then result = message_box("Couldn't find TRM.DLL", "Error", MB_OK) else -- designate the Tsunami file name (and optional path) fileName = "Trmdemo.dat" fileNameAddress = allocate_string(fileName) -- initialize the call parameters to 4 bytes each trm_Op = allocate(4) trm_File = allocate(4) trm_DataPtr = allocate(4) trm_DataLen = allocate(4) trm_KeyPtr = allocate(4) trm_KeyLen = allocate(4) trm_KeyNo = allocate(4) -- set the necessary parameters for a call to trm_Open poke4(trm_Op, 0) -- trm_Open = 0 poke4(trm_KeyPtr, fileNameAddress) poke4(trm_KeyLen, length(fileName)) result = c_func(trm, {trm_Op, trm_File, trm_DataPtr, trm_DataLen, trm_KeyPtr, trm_KeyLen, trm_KeyNo}) if result then result = message_box("trm_Open ... Result code = " & sprint(result), "Error", MB_OK) else -- trm_File now holds the Tsunami file handle -- set the operation parameter for a call to trm_Count poke4(trm_Op, 17) -- trm_Count = 17 result = c_func(trm, {trm_Op, trm_File, trm_DataPtr, trm_DataLen, trm_KeyPtr, trm_KeyLen, trm_KeyNo}) if result then result = message_box("trm_Coumt ... Result code = " & sprint(result), "Error", MB_OK) else -- display the record count (returned in trm_KeyNo) total = peek4s(trm_KeyNo) result = message_box(fileName & " contains " & sprint(total) & " records", "Tsunami Test", MB_OK) end if end if end if -- no need to call trm_Close... -- Tsunami closes all open files upon exit end procedure WinMain()