[Vm-dev] Re: help on creating plugin
Bert Freudenberg
bert at freudenbergs.de
Wed Sep 17 15:54:13 UTC 2008
In the RomePlugin I added a hack that translates
self cairoFooBar: x baz: y
as
cairo_foo_bar(x, y)
by matching selectors beginning with "cairo". Very handy for
underscore-hating Slang hackers, though not exactly a beginner's
topic ;)
- Bert -
Am 17.09.2008 um 17:22 schrieb John M McIntosh:
> There is no slang defined methods.
>
> The rule is
>
> self blafoobar: thing
> becomes blafoobar(thing) when it builds the C code because it is
> methodName: argument becomes methodName(argument)
>
> For methods with more than one argument SLANG concatinates the parts
> into one Name.
> Thus you can construct something like
>
> self mem: foo c: bar py: too
>
> then becomes
> memcpy(foo,bar,too);
>
> Or so I remember
>
> You can also use this to code procedures in SLANG for the plugin.
> For example in the GStreamer plugin I code a SLANG method
>
> cb: element new: newPad pad: data
> "Ok the trick here is on the signal pad_add we may have multiple
> pads being created.
> Therefore we must find the sink pad that can handle the request.
> Note for ogg you could have the
> audio and video stream for example"
>
> | max result gstPadValue gstCapsValue |
>
> self var: #gstPadValue declareC: 'GstPad* gstPadValue'.
> self var: #gstCapsValue declareC: 'GstCaps* gstCapsValue'.
> self var: #data declareC: 'sqInt *data'.
>
>
> that becomes a C procedure
> static sqInt cbnewpad(sqInt element, sqInt newPad, sqInt *data)
>
>
> On Sep 16, 2008, at 8:17 PM, Esteban Lorenzano wrote:
>
>> Hi,
>> Thanks for the answers... I'm trying to advance my plugin with your
>> advices, but is a little hard to understand (and no much time
>> available).
>> I have a question, maybe very basic, but I'm a newbie at plugin
>> development:
>>
>> Is there a place where I can see all the Slang defined methods? I'm
>> asking because in some places I see a "self strlen: blah" and I
>> would like to know which ones are available for use, instead of
>> fill my code of "self cCode: 'blah') sentences.
>>
>> Many thanks,
>> Esteban
>>
>>
>
> --
> =
> =
> =
> =
> =
> ======================================================================
> John M. McIntosh <johnmci at smalltalkconsulting.com>
> Corporate Smalltalk Consulting Ltd. http://
> www.smalltalkconsulting.com
> =
> =
> =
> =
> =
> ======================================================================
>
>
More information about the Vm-dev
mailing list