[futurebasic] Re: [FB] more help on prepend/append functions

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2008 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Mon, 10 Mar 2008 08:21:35 -0700
On Mar 10, 2008, at 6:20 AM, Bob Bryce wrote:

> I still have no idea on how to call the functions;
>
> fn PrependToHandle(h, s)
> fn AppendToHandle (h, s)

The calls as shown above are correct assuming 'h' is defined as a  
handle and 's' is defined as Str255

Here is some of your code ( needs work but compiles clean in FB )  
with RP's munger wrappers. I assumed a handle ( known as textH ) is  
passed to fn ReplaceFormatMarkersByEquivalentRTF.

local mode
local fn PrependToHandle( h as Handle, insert as Str255 )
'~'1
call Munger( h, 0, 0, 0, @insert + 1, insert[0] )
end fn

local mode
local fn AppendToHandle( h as Handle, insert as Str255 )
'~'1
call Munger( h, fn GetHandleSize( h ), 0, 0, @insert + 1, insert[0] )
end fn

clear local
local fn ReplaceFormatMarkersByEquivalentRTF( textH as Handle )

dim as Str255 standardFormatMarker(10)
dim as Str255 rtfEquivFormatString(10)
dim as Str255 MainTitle, SectionHead
dim as long   j
dim as str255Insert(5)

Insert(1) = "{tf1\mac\deff2 "  // This is the FIRST thing to write to  
file

fn PrependToHandle ( textH, Insert(1) )

_nFormatMarkers = 3
standardFormatMarker(0) = "\mt "
rtfEquivFormatString(0) = MainTitle +" "
standardFormatMarker(1) = "\sh "
rtfEquivFormatString(1) = SectionHead +" "
standardFormatMarker(2) = "\p "
end fn



Brian S.