/* Ref.pmc
 *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
 *  CVS Info
 *     $Id: ref.pmc,v 1.2 2003/09/02 08:37:46 leo Exp $
 *  Overview:
 *     The vtable functions for the Ref base class.
 *  Data Structure and Algorithms:
 *  History:
 *     Initial revision by leo 2003.09.01
 *  Notes:
 *     All methods not present below get a default body autogenerated
 *     inside pmc2c.pl.
 *  References:
 */

#include "parrot/parrot.h"
#include "parrot/method_util.h"

pmclass Ref {

    void init () {
	internal_exception(1, "Ref init without PMC\n");
    }

    void init_pmc (PMC* initializer) {
	if (initializer) {
	    PMC_ptr2p(SELF) = initializer; /* the refered PMC itself */
	    PObj_custom_mark_SET(SELF);
	}
	else
	    internal_exception(1, "Ref init with NULL PMC\n");
    }

    void mark () {
	 pobject_lives(INTERP, (PObj *) PMC_ptr2p(SELF));
    }

    /* must implement these - they are not delegated */
    INTVAL type() {
	return SUPER();
    }

    STRING* name() {
	return SUPER();
    }
}

