Squeak and bluetooth
d.varvello at quinary.com
Wed Jan 11 14:03:44 UTC 2006
Thanks for explanations, I'll also download Tweak-Platforms to
On 10 Jan 2006, at 18:44, John M McIntosh wrote:
> Sure, you're missing the entire Sophie code base which uses this,
> however at the moment the implementation of the caller of this is via
> Tweak-Platforms from the impara tweak server.
> I had added these types (MacCFString, MacCFType, MacCFURL,
> MacCFURL), and the FFI interfaces to assist in getting the folder
> paths for known os-x folder locations, however I've not actually
> tested *all* the api calls yet.
> Usage is quite straightforward.
> buffer _ ByteArray new: 4096.
> error := self cFStringGetCString: possibleCFString buffer: buffer
> size: buffer size encoding: 0.
> self cFRelease: possibleCFString.
> Typically I've been copying the C definition into the method like
> so for documentation purposes.
> cFStringGetCString: aStringRef buffer: aBuffer size: aSize
> encoding: anEncoding
> <cdecl: bool 'CFStringGetCString' (MacCFString* char* long long)
> ^ self externalCallFailed
> "Boolean CFStringGetCString (
> CFStringRef theString,
> char *buffer,
> CFIndex bufferSize,
> CFStringEncoding encoding
> I'll note that I'm cheating and resolving CFIndes and
> CFStdringEncoding to long, but you could define a structured class
> with a long field for those.
> Save your image often, mistakes in coding the FFI logic will
> generally crash your VM.
> On 10-Jan-06, at 5:42 AM, Davide Varvello wrote:
>> Hi Bert,
>>> As for your questions, yes, FFI is just fine for this. And I'd
>>> recommend Carbon.
>>> For a bit of working recent Carbon FFI code have a look at
>>> The "Files-Locations" package uses FFI calls to locate system
>> I downloaded the Files-Locations-bf.18.mcz it contains 4 classes:
>> MacCFString, MacCFType, MacCFURL, MacCFURL but there are no
>> methods that call os libraries. Am I missing something?
> John M. McIntosh <johnmci at smalltalkconsulting.com> 1-800-477-2659
> Corporate Smalltalk Consulting Ltd. http://
More information about the Squeak-dev