2 Copyright (C) 2001-2010, Parrot Foundation.
7 src/pmc/null.pmc - NULL
11 This simply creates a way of catching C<NULL> register accesses without
12 really slowing down the bytecode execution.
18 /* HEADERIZER HFILE: none */
19 /* HEADERIZER BEGIN: static */
20 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
22 PARROT_DOES_NOT_RETURN
23 static void null_pmc_access(PARROT_INTERP, int index)
24 __attribute__nonnull__(1);
26 #define ASSERT_ARGS_null_pmc_access __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
27 PARROT_ASSERT_ARG(interp))
28 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
29 /* HEADERIZER END: static */
31 pmclass Null singleton {
35 =head2 Vtable functions
41 Overrides the default to do nothing.
51 VTABLE void *get_pointer() {
56 VTABLE void set_pointer(void *p) {
61 VTABLE INTVAL does(STRING *what) {
64 /* XXX maybe a hack to get TGE running again */
70 =item C<INTVAL is_same(PMC *value)>
72 Returns true if value is also a null PMC, false otherwise.
77 VTABLE INTVAL is_same(PMC *value) {
78 return PMC_IS_NULL(value);
83 =item C<PMC *find_method(STRING *method_name)>
85 Gives a more informative message than the automaticaly generated version.
91 VTABLE PMC *find_method(STRING *method_name) {
92 Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_NULL_REG_ACCESS,
93 "Null PMC access in find_method('%Ss')",
103 =head2 Auxiliar functions
107 =item C<static void null_pmc_access(PARROT_INTERP, int index)>
109 Throws the Null PMC access exception.
115 PARROT_DOES_NOT_RETURN
117 null_pmc_access(PARROT_INTERP, int index)
119 ASSERT_ARGS(null_pmc_access)
120 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_NULL_REG_ACCESS,
121 "Null PMC access in %s()",
122 Parrot_get_vtable_name(interp, index));
135 * c-file-style: "parrot"
137 * vim: expandtab shiftwidth=4: