[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: |
Roland Plüss |
Subject: |
Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language |
Date: |
Fri, 30 Oct 2009 22:51:55 +0100 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090926) |
>>> So with other words no damage is done if I hijack #new for the creation
>>> purpose and leaving #initialize to the scripts only for code to setup
>>> their smalltalk type parameters.
>>
>> Yeah, you can even hijack #basicNew (normally a primitive, but a cCall
>> is also a "primitive") and do the usual
>>
>> new [ ^super new initialize ]
>
> I had a 50% chance of getting it right, and didn't. I obviously meant
>
> new [ ^self basicNew initialize ]
Got stumped :( . I forgot that the class I try to wrap right now is a
singleton. With other words in that case I need to assign a c-pointer
somehow to the class itself not the instance of it. But the class object
is created by smalltalk so I can't mess with it. In fact I need to hack
the class itself since using a cCall #new for an object I need to have
access to the wrapped engine already. Maybe that's not clear. So let's
make an example.
class STSomething which wrapps CSomething.
to create CSomething in c++ land I need a pointer to CEngine in c++
land. But when I assign a cCall for #new in STSomething I do not have
access to the CEngine pointer. For this to work I need the STSomething
class object to store the pointer to the CEngine so that once the cCall
#new is called on STSomething I can create the new object with a brand
new pointer to CSomething.
So basically I need to mess with the STSomething object. Can I do the
same hack you mentioned simply for STSomething like this?
Object subclass: STSomething [
STSomething class [
<shape: #byte>
new [ <cCall: 'CSomething_new' returning: #void args: #(#self)> ]
]
]
Or is GST going to whip my ass for that?
--
Yours sincerely
Plüss Roland
Leader and Head Programmer
- Game: Epsylon ( http://epsylon.rptd.ch/ ,
http://www.moddb.com/games/4057/epsylon )
- Game Engine: Drag(en)gine ( http://dragengine.rptd.ch ,
http://www.moddb.com/engines/9/dragengine )
- Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )
signature.asc
Description: OpenPGP digital signature
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, (continued)
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Roland Plüss, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Roland Plüss, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Roland Plüss, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/29
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Roland Plüss, 2009/10/30
- Re: [Help-smalltalk] Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/30
- [Help-smalltalk] Re: Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/30
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language,
Roland Plüss <=
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/30
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Roland Plüss, 2009/10/30
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/30
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Roland Plüss, 2009/10/30
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/31
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Roland Plüss, 2009/10/31
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/31
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Roland Plüss, 2009/10/31
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Paolo Bonzini, 2009/10/31
- Re: [Help-smalltalk] Re: Using Smalltalk as a scripting language, Roland Plüss, 2009/10/31