Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 55 lines (45 sloc) 1.911 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
/* oo_private.h
* Copyright (C) 2007-2008, Parrot Foundation.
* Overview:
* Structs, typedefs and macros for the Class, Object, and PMCProxy PMCs.
* This header file is only included by files within the OO subsystem.
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/

#ifndef PARROT_OO_PRIVATE_H_GUARD
#define PARROT_OO_PRIVATE_H_GUARD

#include "parrot/parrot.h"

/*
* Class private flags
*/
typedef enum {
    CLASS_instantiated_FLAG = PObj_private0_FLAG,
    CLASS_is_anon_FLAG = PObj_private1_FLAG,
    CLASS_has_alien_parents_FLAG = PObj_private2_FLAG
} class_flags_enum;

#define CLASS_get_FLAGS(o) (PObj_get_FLAGS(o))
#define CLASS_flag_TEST(flag, o) (CLASS_get_FLAGS(o) & CLASS_ ## flag ## _FLAG)
#define CLASS_flag_SET(flag, o) (CLASS_get_FLAGS(o) |= CLASS_ ## flag ## _FLAG)
#define CLASS_flag_CLEAR(flag, o) (CLASS_get_FLAGS(o) &= ~(UINTVAL)(CLASS_ ## flag ## _FLAG))

/* Mark if the class has been instantiated */
#define CLASS_instantiated_TEST(o) CLASS_flag_TEST(instantiated, (o))
#define CLASS_instantiated_SET(o) CLASS_flag_SET(instantiated, (o))
#define CLASS_instantiated_CLEAR(o) CLASS_flag_CLEAR(instantiated, (o))

/* Mark if the class is anonymous */
#define CLASS_is_anon_TEST(o) CLASS_flag_TEST(is_anon, (o))
#define CLASS_is_anon_SET(o) CLASS_flag_SET(is_anon, (o))
#define CLASS_is_anon_CLEAR(o) CLASS_flag_CLEAR(is_anon, (o))

/* Mark if the class has parents from a different object model (for
* example, a PMC). */
#define CLASS_has_alien_parents_TEST(o) CLASS_flag_TEST(has_alien_parents, (o))
#define CLASS_has_alien_parents_SET(o) CLASS_flag_SET(has_alien_parents, (o))
#define CLASS_has_alien_parents_CLEAR(o) CLASS_flag_CLEAR(has_alien_parents, (o))

#endif /* PARROT_OO_PRIVATE_H_GUARD */

/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/
Something went wrong with that request. Please try again.