[futurebasic] Merging ZTXTs for BB

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 2002 : Group Archive : Group : All Groups

From: Jay <jktr@...>
Date: Tue, 28 May 02 10:19:22 -0500
>the slowness is mostly because it's
>searching up to 2700 ztxt resources.
>if someone could show me how to
>merge them into one handle to search
>(and, actually, just the text part of the ztxt resource,
>not the styl data that is appended to the end of it),
>that would probably make the search routine go very fast.
>
BB,

Just pass your accumulation handle and your ZTXT handle to this FN. It 
will append the ZTXT text and return its offset, which you may wish to 
store in an array for identification. (Untested)

BTW, I don't know that this will save you that much time, as it requires 
reading and copying all your text handles before searching. Once the 
accumulation handle is built, though, you can continue to use it at high 
speed.

 e-e
 =J= a  y
  "

local mode
dim offset,addLen
local fn appendZTXT(addThis&, toThis&)
'Appends the text from ZTXT handle addThis to generic handle toThis, 
'and returns the offset to the start of the text being appended.
'NOTE: toThis must NOT be a ZTXT handle. Create an empty handle to
'start the accumulation:
'mergedTxtH& = FN NEWHANDLE( 0 )
long if addThis& and toThis& > 0
addLen = {[addThis&]}
offset = fn gethandlesize(toThis&)
call sethandlesize( toThis&, offset + addLen )
if fn memerr then stop "Can't append ZTXT handle."'May need change for 
FBII
blockmove( [addThis&] + 2, [toThis&] + offset, addLen ]
end if
end fn = offset