/* ex: set ro ft=c: -*- buffer-read-only:t -*-
 * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
 *
 * This file is generated automatically from './src/pmc/exception.pmc'
 * by tools/build/pmc2c.pl.
 *
 * Any changes made here will be lost!
 *
 */

/* HEADERIZER HFILE: none */
/* HEADERIZER STOP */


#ifndef PARROT_PMC_EXCEPTION_H_GUARD
#define PARROT_PMC_EXCEPTION_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Exception_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Exception_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Exception_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Exception_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Exception_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Exception_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* Exception PMC's underlying struct. */
typedef struct Parrot_Exception_attributes {
    INTVAL id;
    FLOATVAL birthtime;
    STRING         * message;
    PMC            * payload;
    PMC            * resume;
    INTVAL severity;
    INTVAL type;
    INTVAL exit_code;
    PMC            * backtrace;
    INTVAL handled;
    PMC            * handler;
    PMC            * handler_ctx;
    INTVAL handlers_left;
    PMC            * thrower;
    PMC            * bt_strings;
} Parrot_Exception_attributes;

/* Macro to access underlying structure of a Exception PMC. */
#define PARROT_EXCEPTION(o) ((Parrot_Exception_attributes *) PMC_data(o))


/* Generated macro accessors for 'id' attribute of Exception PMC. */
#define GETATTR_Exception_id(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->id; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "id")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_id(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "id"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->id = (value); \
    } while (0)


/* Generated macro accessors for 'birthtime' attribute of Exception PMC. */
#define GETATTR_Exception_birthtime(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->birthtime; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "birthtime")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (FLOATVAL) 0.0: VTABLE_get_number(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_birthtime(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new(interp, enum_class_Float); \
            VTABLE_set_number_native(interp, attr_value, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "birthtime"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->birthtime = (value); \
    } while (0)


/* Generated macro accessors for 'message' attribute of Exception PMC. */
#define GETATTR_Exception_message(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->message; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "message")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_message(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new(interp, enum_class_String); \
            VTABLE_set_string_native(interp, attr_value, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "message"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->message = (value); \
    } while (0)


/* Generated macro accessors for 'payload' attribute of Exception PMC. */
#define GETATTR_Exception_payload(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->payload; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "payload")); \
        } \
    } while (0)
#define SETATTR_Exception_payload(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "payload"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->payload = (value); \
    } while (0)


/* Generated macro accessors for 'resume' attribute of Exception PMC. */
#define GETATTR_Exception_resume(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->resume; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "resume")); \
        } \
    } while (0)
#define SETATTR_Exception_resume(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "resume"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->resume = (value); \
    } while (0)


/* Generated macro accessors for 'severity' attribute of Exception PMC. */
#define GETATTR_Exception_severity(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->severity; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "severity")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_severity(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "severity"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->severity = (value); \
    } while (0)


/* Generated macro accessors for 'type' attribute of Exception PMC. */
#define GETATTR_Exception_type(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->type; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "type")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_type(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "type"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->type = (value); \
    } while (0)


/* Generated macro accessors for 'exit_code' attribute of Exception PMC. */
#define GETATTR_Exception_exit_code(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->exit_code; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "exit_code")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_exit_code(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "exit_code"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->exit_code = (value); \
    } while (0)


/* Generated macro accessors for 'backtrace' attribute of Exception PMC. */
#define GETATTR_Exception_backtrace(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->backtrace; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "backtrace")); \
        } \
    } while (0)
#define SETATTR_Exception_backtrace(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "backtrace"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->backtrace = (value); \
    } while (0)


/* Generated macro accessors for 'handled' attribute of Exception PMC. */
#define GETATTR_Exception_handled(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->handled; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "handled")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_handled(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "handled"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->handled = (value); \
    } while (0)


/* Generated macro accessors for 'handler' attribute of Exception PMC. */
#define GETATTR_Exception_handler(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->handler; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "handler")); \
        } \
    } while (0)
#define SETATTR_Exception_handler(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "handler"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->handler = (value); \
    } while (0)


/* Generated macro accessors for 'handler_ctx' attribute of Exception PMC. */
#define GETATTR_Exception_handler_ctx(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->handler_ctx; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "handler_ctx")); \
        } \
    } while (0)
#define SETATTR_Exception_handler_ctx(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "handler_ctx"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->handler_ctx = (value); \
    } while (0)


/* Generated macro accessors for 'handlers_left' attribute of Exception PMC. */
#define GETATTR_Exception_handlers_left(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->handlers_left; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "handlers_left")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Exception_handlers_left(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "handlers_left"), attr_value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->handlers_left = (value); \
    } while (0)


/* Generated macro accessors for 'thrower' attribute of Exception PMC. */
#define GETATTR_Exception_thrower(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->thrower; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "thrower")); \
        } \
    } while (0)
#define SETATTR_Exception_thrower(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "thrower"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->thrower = (value); \
    } while (0)


/* Generated macro accessors for 'bt_strings' attribute of Exception PMC. */
#define GETATTR_Exception_bt_strings(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Exception_attributes *)PMC_data(pmc))->bt_strings; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "bt_strings")); \
        } \
    } while (0)
#define SETATTR_Exception_bt_strings(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "bt_strings"), value); \
        } \
        else \
            ((Parrot_Exception_attributes *)PMC_data(pmc))->bt_strings = (value); \
    } while (0)


#endif /* PARROT_PMC_EXCEPTION_H_GUARD */

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

