fix codetest failure - trailing whitespace
[parrot.git] / src / pmc / null.pmc
blob1011ff525dcce8d108141b4524a155b0d192ba25
1 /*
2 Copyright (C) 2001-2007, Parrot Foundation.
3 $Id$
5 =head1 NAME
7 src/pmc/null.pmc - NULL
9 =head1 DESCRIPTION
11 This simply creates a way of catching C<NULL> register accesses without
12 really slowing down the bytecode execution.
14 =head2 Methods
16 =over 4
18 =cut
22 PARROT_DOES_NOT_RETURN
23 static void
24 null_pmc_access(PARROT_INTERP, int index)
26     Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
27             "Null PMC access in %s()",
28             Parrot_get_vtable_name(interp, index));
31 pmclass Null singleton {
35 =item C<void init()>
37 Overrides the default to do nothing.
39 =cut
43     VTABLE void init() {
44         UNUSED(interp)
45     }
47     VTABLE void *get_pointer() {
48         UNUSED(interp)
49         return PMCNULL;
50     }
52     VTABLE void set_pointer(void *p) {
53         UNUSED(interp)
54         PMCNULL = (PMC *)p;
55     }
57     VTABLE INTVAL does(STRING *what) {
58         UNUSED(interp)
59         UNUSED(what)
60         /* XXX maybe a hack to get TGE running again */
61         return 0;
62     }
66 =item C<INTVAL is_same(PMC *value)>
68 Returns true if value is also a null PMC, false otherwise.
70 =cut
73     VTABLE INTVAL is_same(PMC *value) {
74         return PMC_IS_NULL(value);
75     }
79 =item C<PMC *find_method(STRING *method_name)>
81 =cut
83 Gives a more informative message than the automaticaaly generated version.
87     VTABLE PMC *find_method(STRING *method_name) {
88         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
89                 "Null PMC access in find_method('%Ss')",
90                 method_name);
91     }
97 =back
99 =cut
104  * Local variables:
105  *   c-file-style: "parrot"
106  * End:
107  * vim: expandtab shiftwidth=4:
108  */