[fonc] Retrieving an object's base

2007-06-18 Thread Dan Amelang
Anyone know how to retrieve an object's base? I think all I want is
the delegate member of the object's vtable, but I can't seem to get
that from within jolt. _vtable objects don't respond to the delegate
message.

Basically, I just want to walk one step up the clone family. Similar
existing code (the various implementations of isKindOf) all have some
way to get their grubby little paws on the delegate member of the
vtable. Besides poking around in memory, I don't see a way to do this
in jolt.

Dan
___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc


Re: [fonc] Copying a pepsi object

2007-06-18 Thread Dan Amelang
On 6/17/07, Ian Piumarta [EMAIL PROTECTED] wrote:
 On Jun 16, 2007, at 10:51 PM, Dan Amelang wrote:

  Anyone know how I can make a copy of a pepsi object?

 Here's one cheap, cheerful and potentially dangerous (it assumes
 'self _sizeof' returns the correct value, which may not be true for
 objects that implement 'inline indexable fields') way to do it...

 Object shallowCopy
 [
  | _size clone |
  _size := self _sizeof.
  clone := self _vtable _alloc: _size.
  { memcpy(v_clone, v_self, (long)v__size); }.
  ^clone
 ]

Beautiful, thanks!

Dan
___
fonc mailing list
fonc@vpri.org
http://vpri.org/mailman/listinfo/fonc