[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language

From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language
Date: Sat, 31 Oct 2009 01:02:57 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4

On 10/31/2009 12:18 AM, Roland Plüss wrote:
Something I didn't understand on the way you manipulate ST data from C?

You forgot the instance variables defined by superclasses of "DEEngine class". Better initialize uniqueInstance lazily:

    DEEngine class [
        | uniqueInstance |
        uniqueInstance [ ^uniqueInstance ifNil: [self new] ]
        new [ <cCall: '' returning: #smalltalk args: #() ]


    // in the creation function
    OOP oopClass = gst_class_name_to_oop( "DEEngine" );
    deEngine::m_stUniqueInstance = pST->CreateNewObject( oopClass );
    gst_register_oop (deEngine::m_stUniqueInstance);


    static OOP deEngine::stNew ()
      return deEngine::m_stUniqueInstance;


    gst_define_cfunc ("", deEngine::stNew);

Nice to see some code in this thread!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]