[Vm-dev] discuss: [Squeak 0001144]: [ENH] SmartSyntaxInterpreterPlugin

Martin Kuball martinkuball at web.de
Sun Aug 20 09:40:44 UTC 2006


Am Sunday, 20. August 2006 00:16 schrieb David T. Lewis:
> On Sat, Aug 19, 2006 at 09:17:11PM +0200, Martin Kuball wrote:
> > When evaluating my sugested changes, Andreas made the following
> >
> > comment:
> > > There are no good reasons that I can think of to suddenly start
> > > using C pointers in plugins (lazyness on behalf of the plugin writer
> > > does not count) and there are many good reasons against it.
> >
> > Unfortunately I do not realy understand his arguments. From the code
> > of the plugins that come with VMMaker I can see that there are
> > plugins that use c-pointers and do pass them to smalltalk. E.g. the
> > Mpeg3 Plugin does it and the OsProecess plugin is another example.
>
> I don't remember having done this in OSProcessPlugin. I did lots of
> other horrible things, but I did not pass any C pointers to or from
> primitives.  Signal handlers, aio event handlers and the like require
> function pointers, but there is no need pass these pointers to or from
> the image.

Well here's what I understand by looking at your code. Let's take 
primitiveCreatePipe. It returns an array with two ByteArrays in it that 
contain information about the reader and the writer of the pipe. Let's 
take the first ByteArray, the writer. You create it, take the pointer to 
the bytes and interpret them as a struct of type SQFile. Than you set the 
field "file" inside the struct to the value of writerIOStream which is (on 
unix) a pointer to a FILE structrue optained from a call to fdopen.

	writer _ self newSQFileByteArray.
	writerPtr _ self fileValueOf: writer.
	self cCode: 'writerPtr->file = writerIOStream'.

So to me this looks very much like you'r passing pointers to C data 
structures to the image. But I admit that I might still not really 
understand this plugin stuff.

Martin


More information about the Vm-dev mailing list