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

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


#ifndef PARROT_PMC_CALLBACK_H_GUARD
#define PARROT_PMC_CALLBACK_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Callback_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Callback_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Callback_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Callback_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Callback_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Callback_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* Callback PMC's underlying struct. */
typedef struct Parrot_Callback_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;
    PMC * user_data;
    PMC * external_data;
} Parrot_Callback_attributes;

/* Macro to access underlying structure of a Callback PMC. */
#define PARROT_CALLBACK(o) ((Parrot_Callback_attributes *) PMC_data(o))


/* Generated macro accessors for 'id' attribute of Callback PMC. */
#define GETATTR_Callback_id(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Callback_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_Callback_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_Callback_attributes *)PMC_data(pmc))->id = (value); \
    } while (0)


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


/* Generated macro accessors for 'interp' attribute of Callback PMC. */
#define GETATTR_Callback_interp(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Callback_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_Callback_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_Callback_attributes *)PMC_data(pmc))->interp = (value); \
    } while (0)


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

#define SETATTR_Callback_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_Callback_attributes *)PMC_data(pmc))->code = (value); \
    } while (0)


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

#define SETATTR_Callback_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_Callback_attributes *)PMC_data(pmc))->data = (value); \
    } while (0)


/* Generated macro accessors for 'killed' attribute of Callback PMC. */
#define GETATTR_Callback_killed(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Callback_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_Callback_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_Callback_attributes *)PMC_data(pmc))->killed = (value); \
    } while (0)


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

#define SETATTR_Callback_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_Callback_attributes *)PMC_data(pmc))->mailbox = (value); \
    } while (0)


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

#define SETATTR_Callback_mailbox_lock(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_mutex' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Callback_attributes *)PMC_data(pmc))->mailbox_lock = (value); \
    } while (0)


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

#define SETATTR_Callback_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_Callback_attributes *)PMC_data(pmc))->waiters = (value); \
    } while (0)


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

#define SETATTR_Callback_waiters_lock(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_mutex' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Callback_attributes *)PMC_data(pmc))->waiters_lock = (value); \
    } while (0)


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

#define SETATTR_Callback_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_Callback_attributes *)PMC_data(pmc))->shared = (value); \
    } while (0)


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

#define SETATTR_Callback_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_Callback_attributes *)PMC_data(pmc))->partner = (value); \
    } while (0)


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

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


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

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


#endif /* PARROT_PMC_CALLBACK_H_GUARD */

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

