Re: Spam:Spam:Small DLLCC Enhancement and questions.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Spam:Spam:Small DLLCC Enhancement and questions.

Travis Griggs-3
On Sep 11, 2007, at 21:04, Antony Blakey wrote:


Comrades,
         as part of my work enhancing the DLLCC front end, I've developed a standalone enhancement to DLLCC that enables customisation of the datum wrapper classes.

If you have a DLLCC struct definition like this:

  OSXFuseLibrary>>fuse_args
    <C: struct fuse_args { int argc; char **argv; int allocated; } >

then doing this for example:

   OSXFuseLibrary current fuse_args gcCalloc

will return an instance of CCompositePointer. The same thing happens if you call a function that returns a fuse_args* struct, or access a member of another struct that is a fuse_args*, and so on. Of course you might get a CComposite if you access by-value. You have to access the struct members using #memberAt:/#memberAt:put:/#refMemberAt:

My enhancement allows you to do this for example:

  OSXFuseLibrary>>fuse_args
    <CX: pointer=Nitro.FUSE.FuseArgsPointer datum=Nitro.FUSE.FuseArgs >
    <C: struct fuse_args { int argc; char **argv; int allocated; } >

This means that rather than CCompositePointer being returned, a Nitro.FUSE.FuseArgsPointer (which must be a subclass of CCompositePointer) will be returned, in every situation where fuse_args* is used. If your API is pointer-focused then you won't need the datum spec, in which case CComposite will be used for by-value returns.

The obvious benefit is the FuseArgsPointer can not only have accessors/setters but can also contain other methods, such as external library routines applicable to the datum etc.

I want your FUSE implementation no matter how you implemented it. :) I've wanted to play with that a number of times. If you've got a working FUSE interface, I'd love to have it up in the open repository.

One trick I've learned to play over the years is to use fixed space subclasses of UninterpretedBytes to do this same kind of thing, so that you can have a real live object to represent the structures. Sounds like what you're doing is similar.

--
Travis Griggs
Objologist
Time and Countertops. They both get used up way too fast.