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

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


#ifndef PARROT_PMC_TIMER_H_GUARD
#define PARROT_PMC_TIMER_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Timer_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Timer_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Timer_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Timer_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Timer_get_mro(PARROT_INTERP, ARGIN_NULLOK(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Timer_get_isa(PARROT_INTERP, ARGIN_NULLOK(Hash* isa));

/* Timer PMC's underlying struct. */
typedef struct Parrot_Timer_attributes {
    INTVAL id;
    INTVAL priority;
    FLOATVAL birthtime;
    STRING       * type;
    STRING       * subtype;
    STRING       * status;
    Parrot_Interp interp;
    PMC          * codeblock;
    PMC          * data;
    char         * cb_data;
    FLOATVAL duration;
    FLOATVAL interval;
    INTVAL repeat;
} Parrot_Timer_attributes;

/* Macro to access underlying structure of a Timer PMC. */
#define PARROT_TIMER(o) ((Parrot_Timer_attributes *) PMC_data(o))


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


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

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


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


/* Generated macro accessors for 'type' attribute of Timer PMC. */
#define GETATTR_Timer_type(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Timer_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) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)

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


/* Generated macro accessors for 'subtype' attribute of Timer PMC. */
#define GETATTR_Timer_subtype(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Timer_attributes *)PMC_data(pmc))->subtype; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "subtype")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)

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


/* Generated macro accessors for 'status' attribute of Timer PMC. */
#define GETATTR_Timer_status(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Timer_attributes *)PMC_data(pmc))->status; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "status")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)

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


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


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

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


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

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


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

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


/* Generated macro accessors for 'duration' attribute of Timer PMC. */
#define GETATTR_Timer_duration(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Timer_attributes *)PMC_data(pmc))->duration; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "duration")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (FLOATVAL) 0.0: VTABLE_get_number(interp, attr_value)); \
        } \
    } while (0)

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


/* Generated macro accessors for 'interval' attribute of Timer PMC. */
#define GETATTR_Timer_interval(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Timer_attributes *)PMC_data(pmc))->interval; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "interval")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (FLOATVAL) 0.0: VTABLE_get_number(interp, attr_value)); \
        } \
    } while (0)

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


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

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


#endif /* PARROT_PMC_TIMER_H_GUARD */

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

