/* ex: set ro ft=c: -*- buffer-read-only:t -*-
 * !!!!!!!   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;
    Parrot_mutex mailbox_lock;
    PMC          * waiters;
    Parrot_mutex waiters_lock;
    PMC          * shared;
    PMC          * partner;
} 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_noargs(interp, 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_noargs(interp, 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_noargs(interp, 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_noargs(interp, 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 'mailbox_lock' attribute of Task PMC. */
#define GETATTR_Task_mailbox_lock(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->mailbox_lock; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_mutex' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Task_mailbox_lock(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_mutex' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->mailbox_lock = (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 'waiters_lock' attribute of Task PMC. */
#define GETATTR_Task_waiters_lock(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Task_attributes *)PMC_data(pmc))->waiters_lock; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_mutex' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Task_waiters_lock(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_mutex' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Task_attributes *)PMC_data(pmc))->waiters_lock = (value); \
    } while (0)


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


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


#endif /* PARROT_PMC_TASK_H_GUARD */

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

