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

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


#ifndef PARROT_PMC_TASK_H_GUARD
#define PARROT_PMC_TASK_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Task_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Task_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Task_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Task_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Task_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Task_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* Task PMC's underlying struct. */
typedef struct Parrot_Task_attributes {
    UINTVAL id;
    FLOATVAL birthtime;
    Parrot_Interp interp;
    PMC          * code;
    PMC          * data;
    INTVAL killed;
    PMC          * mailbox;
    PMC          * waiters;
    Parrot_jump_buff abort_jump;
} Parrot_Task_attributes;

/* Macro to access underlying structure of a Task PMC. */
#define PARROT_TASK(o) ((Parrot_Task_attributes *) PMC_data(o))


/* Generated macro accessors for 'id' attribute of Task PMC. */
#define GETATTR_Task_id(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->id; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'UINTVAL' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_Task_id(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'UINTVAL' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->id = (value); \
    } while (0)


/* Generated macro accessors for 'birthtime' attribute of Task PMC. */
#define GETATTR_Task_birthtime(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_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_Task_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_Task_attributes *)PMC_data(pmc))->birthtime = (value); \
    } while (0)


/* Generated macro accessors for 'interp' attribute of Task PMC. */
#define GETATTR_Task_interp(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->interp; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_Interp' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_Task_interp(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_Interp' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->interp = (value); \
    } while (0)


/* Generated macro accessors for 'code' attribute of Task PMC. */
#define GETATTR_Task_code(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->code; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "code")); \
        } \
    } while (0)

#define SETATTR_Task_code(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "code"), value); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->code = (value); \
    } while (0)


/* Generated macro accessors for 'data' attribute of Task PMC. */
#define GETATTR_Task_data(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->data; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "data")); \
        } \
    } while (0)

#define SETATTR_Task_data(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "data"), value); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->data = (value); \
    } while (0)


/* Generated macro accessors for 'killed' attribute of Task PMC. */
#define GETATTR_Task_killed(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->killed; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "killed")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)

#define SETATTR_Task_killed(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, "killed"), attr_value); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->killed = (value); \
    } while (0)


/* Generated macro accessors for 'mailbox' attribute of Task PMC. */
#define GETATTR_Task_mailbox(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->mailbox; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "mailbox")); \
        } \
    } while (0)

#define SETATTR_Task_mailbox(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "mailbox"), value); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->mailbox = (value); \
    } while (0)


/* Generated macro accessors for 'waiters' attribute of Task PMC. */
#define GETATTR_Task_waiters(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->waiters; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "waiters")); \
        } \
    } while (0)

#define SETATTR_Task_waiters(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "waiters"), value); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->waiters = (value); \
    } while (0)


/* Generated macro accessors for 'abort_jump' attribute of Task PMC. */
#define GETATTR_Task_abort_jump(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->abort_jump; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_jump_buff' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_Task_abort_jump(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_jump_buff' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->abort_jump = (value); \
    } while (0)


#endif /* PARROT_PMC_TASK_H_GUARD */

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

