[futurebasic] Re: [FB] Whyfor this thou behavior? (FB5 vs FB4)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : April 2010 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Fri, 23 Apr 2010 20:31:40 -0400
On Apr 23, 2010, at 8:10 PM, Robert Purves wrote:

>
> I wrote:
>
>> Robert Covington wrote:
>>
>>> Researching why the "Sanctioned by Chris Stasny Himself" FB4 Fn  
>>> stripSpaces does not work when re-installed into FB5...it turns  
>>> out non-remarkstyle string chars are flagged incorrectly as  
>>> remark style in the test after Fn calcLineStyles.
>>>
>>> This has the resulting effect that "Local Fn DoEvent" after  
>>> "stripping" (in error) becomes "Local FnDoEvent" in FB5 (causing  
>>> mass indenting heck), but is left alone in FB4.
>>> INSTR finds a _remarkStyle at position 10 for some reason when  
>>> the styleRun is filled with  3's by Fn calcLineStyles, which it  
>>> does not do, in FB4, despite carrying the same data in styleRun.
>>> If this is why the feature was removed, then I'll give the guilty  
>>> parties a pass, but otherwise, I want my mojo back!
>>
>> Great detective work! In FB5, instr() converts its arguments to C  
>> strings, then calls strstr() to do the heavy lifting. It therefore  
>> mis-handles strings that contain chr$( 0 ), because strstr()  
>> understands a zero byte to indicate the end of the string.
>
> That's not quite accurate. In the conversion to C strings, null  
> characters are changed to chr$( 1 ).
> The effect is that
>   foundPos = instr( startPos, haystack, needle )
> fails only when haystack or needle contain both 0 and 1 characters.
>
> Robert P.

Is it repairable?