[futurebasic] Replace INSTR$ stuff with munger

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

From: "Bob Bryce" <rrbryce@...>
Date: Mon, 03 Mar 2008 23:55:41 +0000
O.K. Robert you are teaching an old dog new tricks.
I've made a clone of my program and am trying to get your munger
stuff working within my program. I need more help here as I've never
used munger calls before.

First problem;
Your example quits as soon as it processes the output text.
So it stops my program too.
I've put the whole Open File stuff in my menu choice to Format text;

CASE 6  'in File Menu Format Doc/G
'FN CalcRTF

dim err		'FB made me do this
dim @fs
dim @textH
   long if ( files$( _fsSpecOpen,,, fs ) )
err = fn OpenFileToHandle( @fs, @textH )
if ( err ) then shutdown "OpenFileToHandle error " + str$( err )
fn ReplaceFormatMarkersByEquivalentRTF( textH )
long if ( files$( _fsSpecSave,,, fs ) )
err = fn SaveHandleToFile( textH, @fs )
if ( err ) then shutdown "SaveHandleToFile error " + str$( err )
end if
def DisposeH( textH )
end if

Opens the File Dialog O.K. then quits after choosing file
does not process the  text.

FN CalcRTF calculates all MainTitle$, SectionHead$ stuff etc
so all this stuff then exists in memory.
Until I get things working I am simply giving this info as global
before your -

MainTitle$="\pard\plain \s3\qc\sa160 20s44"
SectionHead$="\pard\plain \s4\qc 20s28"
Para$="\pard\plain \s5 \ql 20s22"

local fn ReplaceFormatMarkersByEquivalentRTF( textH as Handle )

How do I call the functions;

fn PrependToHandle( h  as Handle, Insert  as Str255)

fn AppendToHandle( h as Handle, insertMe as Str255 )

Can I call them from within fn ReplaceFormatMarkersByEquivalentRTF( textH as 
Handle )

FB gives me a lot of errors about things already dim'd etc.

I want to prepend the RTFid$= "{
tf1\mac\deff2 "
Then call a FN that makes a font table from the fonts used,
Then call a FN that creates a stylesheet,
other FN's  that calculate Indents, page layout info etc.

THEN replace the SFM tags.

Finally I need to append the final "}" to make it an RTF doc.

And thanks Robert and Herbie re Unicode; I've set Text Edit to UTF8 and my 
unicode
shows up fine now.

Robert your munger calls, _when_ I get it working looks more straight 
forward
than the LOOOOONNNNG INSTR$ function I had to search for the SFM tags.
One glitch on incrementing Z%+Z%+n can cause a lot of grief.

Thanks guys for all your help and patience.

Bob Bryce