simple named primative based on Greenberg's "Extending the Squeak Virtual Machine" example plugin not loading.

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

simple named primative based on Greenberg's "Extending the Squeak Virtual Machine" example plugin not loading.

mwkohout
Thanks for those who forwarded me information on how to build a 3.8 vm
on OS X.  I was able to finally build a vm for my 3.8 image.

I also went ahead and built a simple named primative(based on the
example from Andrew Greenber's "Extending the Squeak Virtual Machine"
from the NuBlue book-but instead of extending InterpreterPlugin used
SmartSyntaxInterpreterPlugin.

But after rerunning VMMaker(which I then verify is generating the .c
files) and rebuilding the vm(and I do see the generated .c files in
the "compile sources" step of the debug build target), I do a call out
to my test plugin while using the new vm.  For some reason my code
doesn't seem to find it(when I do a call out to the plugin via the
interface, it reverts to using the code after the call to the
primitive).

Here is my plugin class def:
SmartSyntaxInterpreterPlugin subclass: #ExamplePlugin
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'My Stuff-Plugins'

-it's single method-
answerSeventeen
        "comment stating purpose of message"
        self export: true.
        interpreterProxy
                pop: 1
                thenPush:(interpreterProxy integerObjectOf:17)

-it's single class method-
declareHeaderFilesIn: aCCodeGenerator
                aCCodeGenerator addHeaderFile: '<occi.h>'

the interface class:
Object subclass: #ExampleCaller
        instanceVariableNames: ''
        classVariableNames: ''
        poolDictionaries: ''
        category: 'My Stuff-Plugins'

-it's single method-
call
        <primitive:'answerSeventeen' module: 'ExamplePlugin'>
        ^false.

Why doesn't the plugin load and run?  I apologize in advance if I've
not looked at some documentation that already answers these questions.
I've also included the fileouts of these two classes if you'd prefer
looking at them in that format.

thanks for your help,
Mike Kohout



ExamplePlugin.st (1K) Download Attachment
ExampleCaller.st (395 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: simple named primative based on Greenberg's "Extending the Squeak Virtual Machine" example plugin not loading.

johnmci
My I suggest you look at
JMMMacSpellingPlugin.1.cs

for usage of things like
        self primitive: 'primitiveGetGuessesForWordListLength' parameters:#
(Oop SmallInteger).

&

^size asSmallIntegerObj

which help avoid having to mess with
> interpreterProxy
> pop: 1
> thenPush:

Likely the method would become

answerSeventeen
        self primitive: 'primitiveAnswerSeventeen'.
        ^17 asSmallIntegerObj


As for the plugin, how did you build it?

See SqueakQuicktime.xcodeproj
in the mac os plugins quicktimeplugin directory for an example xcode  
project to build a quicktime plugin bundle.

On 19-Jan-06, at 2:17 PM, Michael Kohout wrote:

> Thanks for those who forwarded me information on how to build a 3.8 vm
> on OS X.  I was able to finally build a vm for my 3.8 image.
>
> I also went ahead and built a simple named primative(based on the
> example from Andrew Greenber's "Extending the Squeak Virtual Machine"
> from the NuBlue book-but instead of extending InterpreterPlugin used
> SmartSyntaxInterpreterPlugin.
>
> But after rerunning VMMaker(which I then verify is generating the .c
> files) and rebuilding the vm(and I do see the generated .c files in
> the "compile sources" step of the debug build target), I do a call out
> to my test plugin while using the new vm.  For some reason my code
> doesn't seem to find it(when I do a call out to the plugin via the
> interface, it reverts to using the code after the call to the
> primitive).
>
> Here is my plugin class def:
> SmartSyntaxInterpreterPlugin subclass: #ExamplePlugin
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'My Stuff-Plugins'
>
> -it's single method-
> answerSeventeen
> "comment stating purpose of message"
> self export: true.
> interpreterProxy
> pop: 1
> thenPush:(interpreterProxy integerObjectOf:17)
>
> -it's single class method-
> declareHeaderFilesIn: aCCodeGenerator
> aCCodeGenerator addHeaderFile: '<occi.h>'
>
> the interface class:
> Object subclass: #ExampleCaller
> instanceVariableNames: ''
> classVariableNames: ''
> poolDictionaries: ''
> category: 'My Stuff-Plugins'
>
> -it's single method-
> call
> <primitive:'answerSeventeen' module: 'ExamplePlugin'>
> ^false.
>
> Why doesn't the plugin load and run?  I apologize in advance if I've
> not looked at some documentation that already answers these questions.
> I've also included the fileouts of these two classes if you'd prefer
> looking at them in that format.
>
> thanks for your help,
> Mike Kohout
> <ExamplePlugin.st>
> <ExampleCaller.st>
>

--
========================================================================
===
John M. McIntosh <[hidden email]> 1-800-477-2659
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
========================================================================
===