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

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


#ifndef PARROT_PMC_STRINGHANDLE_H_GUARD
#define PARROT_PMC_STRINGHANDLE_H_GUARD

PARROT_EXPORT VTABLE* Parrot_StringHandle_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_StringHandle_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_StringHandle_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_StringHandle_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_StringHandle_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_StringHandle_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* StringHandle PMC's underlying struct. */
typedef struct Parrot_StringHandle_attributes {
    PIOHANDLE os_handle;
    STRING    * record_separator;
    IO_VTABLE * io_vtable;
    IO_BUFFER * read_buffer;
    IO_BUFFER * write_buffer;
    STRING * encoding;
    INTVAL flags;
    STRING * stringhandle;
    STRING * mode;
    STRING * filename;
    INTVAL read_offset;
} Parrot_StringHandle_attributes;

/* Macro to access underlying structure of a StringHandle PMC. */
#define PARROT_STRINGHANDLE(o) ((Parrot_StringHandle_attributes *) PMC_data(o))


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


#endif /* PARROT_PMC_STRINGHANDLE_H_GUARD */

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

