/*
Copyright (C) 2001-2007, The Perl Foundation.
$Id: /mirror/trunk/src/pmc/null.pmc 33448 2008-12-01T10:08:07.401264Z julianalbo  $

=head1 NAME

src/pmc/null.pmc - NULL

=head1 DESCRIPTION

This simply creates a way of catching C<NULL> register accesses without
really slowing down the bytecode execution.

=head2 Methods

=over 4

=cut

*/

#include "parrot/parrot.h"

pmclass Null singleton {

/*

=item C<void init()>

Overrides the default to do nothing.

=cut

*/

    VTABLE void init() {
    }

    PARROT_CAN_RETURN_NULL
    VTABLE void *get_pointer() {
        return PMCNULL;
    }

    VTABLE void set_pointer(void *p) {
        PMCNULL = (PMC *)p;
    }

    VTABLE INTVAL does(STRING *what) {
        /* XXX maybe a hack to get TGE running again */
        return 0;
    }

/*

=item C<INTVAL is_same(PMC *value)>

Returns true if value is also a null PMC, false otherwise.

=cut

*/
    VTABLE INTVAL is_same(PMC *value) {
        return PMC_IS_NULL(value);
    }

}

/*

=back

=cut

*/

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */
