[futurebasic] Re: [FB] CFString

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

From: Bernie <fblist.bw@...>
Date: Sat, 19 Jan 2008 16:27:32 +0000
FBtoC supports all the index$ related commands, so it might be easier  
to include "CFIndex.incl" in your app and use FB's IndexF function.  
One thing you'll need to do is compile out the header for FBtoC:

#if ndef _FBtoC
include "CFIndex.incl"
#endif// _FBtoC



If you must use the code posted, replace the toolbox definition with  
the following. Note the lowercase "c" on the local fn  
cFStringFindWithOptions.

'------------
// CFString.h
#if def _FBtoC
local fn cFStringFindWithOptions( theString as CFStringRef,  
stringToFind as CFStringRef, searchLocation as CFIndex, searchLength  
as CFIndex, searchOptions as CFOptionFlags, resultLocation as  
^CFIndex, resultLength as ^CFIndex )
'~'1
#if def _PASSTHROUGH
CFRange range;
Boolean found = CFStringFindWithOptions( theString, stringToFind,  
CFRangeMake( searchLocation, searchLength ), searchOptions, &range );
*resultLocation = range.location;
*resultLength = range.length;
return found;
#endif// _PASSTHROUGH
end fn
#else
toolbox fn CFStringFindWithOptions( CFStringRef theString, CFStringRef  
stringToFind, CFIndex rangeToSearchLocation, CFIndex  
rangeToSearchLength, CFOptionFlags searchOptions, CFIndex  
*resultLocation, CFIndex *resultLength ) = Boolean
#endif// _FBtoC
'------------

Bernie



Steve wrote:

> Bernie supplied me with some code that used CF functions to replace  
> FB INDEX$ and it used the following  fn CFStringFindWithOptions  
> (...)  which FBtoC does not like :
>
> FB does not see this as a valid toolbox either.  So again, I am  
> stumped.  What should be passed to this function instead of  0 which  
> I understand is the incompatible type to a CFIndex type ?
>
> tia
>
> Steve
>
>  fn CFStringFindWithOptions( string, stringToFind, 0, fn  
> CFStringGetLength( string ), 0, #0, #0 )
>
> /Users/mactech/Desktop/newmacpos/build_temp/_8_CFUtilities.c:266:  
> error: incompatible type for argument 3 of 'CFStringFindWithOptions'
> /Users/mactech/Desktop/newmacpos/build_temp/_8_CFUtilities.c:266:  
> error: too many arguments to function 'CFStringFindWithOptions'
>
> // CFString.h
> toolbox fn CFStringFindWithOptions( CFStringRef theString,  
> CFStringRef stringToFind, CFIndex rangeToSearchLocation, CFIndex  
> rangeToSearchLength, CFOptionFlags searchOptions, CFIndex  
> *resultLocation, CFIndex *resultLength ) = Boolean
>