Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tag: RELEASE_2_0_0
Fetching contributors…

Cannot retrieve contributors at this time

105 lines (68 sloc) 1.591 kB
/*
Copyright (C) 2001-2007, Parrot Foundation.
$Id$
=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
*/
PARROT_DOES_NOT_RETURN
static void
null_pmc_access(PARROT_INTERP, int index)
{
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
"Null PMC access in %s()",
Parrot_get_vtable_name(interp, index));
}
pmclass Null singleton {
/*
=item C<void init()>
Overrides the default to do nothing.
=cut
*/
VTABLE void init() {
}
VTABLE void *get_pointer() {
return PMCNULL;
}
VTABLE void set_pointer(void *p) {
PMCNULL = (PMC *)p;
}
VTABLE INTVAL does(STRING *what) {
UNUSED(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);
}
/*
=item C<PMC *find_method(STRING *method_name)>
=cut
Gives a more informative message than the automaticaaly generated version.
*/
VTABLE PMC *find_method(STRING *method_name) {
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
"Null PMC access in find_method('%Ss')",
method_name);
}
}
/*
=back
=cut
*/
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4:
*/
Jump to Line
Something went wrong with that request. Please try again.