This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| d769c944 » | evanphx | 2008-03-25 | 1 | #ifndef RBX_BUILTIN_CLASS_HPP | |
| 2 | #define RBX_BUILTIN_CLASS_HPP | ||||
| 3 | |||||
| 9eb47483 » | evanphx | 2008-04-20 | 4 | #include "objects.hpp" | |
| d769c944 » | evanphx | 2008-03-25 | 5 | ||
| 6 | namespace rubinius { | ||||
| 7 | class Module : public BuiltinType { | ||||
| 8 | public: | ||||
| feb91b43 » | evanphx | 2008-05-07 | 9 | const static size_t fields = 5; | |
| 22ef7b8b » | evanphx | 2008-04-16 | 10 | const static object_type type = ModuleType; | |
| 4c08cc4b » | evanphx | 2008-04-10 | 11 | ||
| feb91b43 » | evanphx | 2008-05-07 | 12 | OBJECT __ivars__; // slot | |
| 13 | LookupTable* method_table; // slot | ||||
| 14 | SYMBOL name; // slot | ||||
| 15 | LookupTable* constants; // slot | ||||
| 16 | Module* superclass; // slot | ||||
| d769c944 » | evanphx | 2008-03-25 | 17 | ||
| 9eb47483 » | evanphx | 2008-04-20 | 18 | static Module* create(STATE); | |
| d769c944 » | evanphx | 2008-03-25 | 19 | void setup(STATE); | |
| 304caf31 » | evanphx | 2008-04-04 | 20 | void setup(STATE, char* name, Module* under = NULL); | |
| 9eb47483 » | evanphx | 2008-04-20 | 21 | void setup(STATE, SYMBOL name, Module* under = NULL); | |
| 304caf31 » | evanphx | 2008-04-04 | 22 | void set_const(STATE, OBJECT sym, OBJECT val); | |
| fceff3d8 » | evanphx | 2008-04-09 | 23 | void set_const(STATE, char* name, OBJECT val); | |
| 9eb47483 » | evanphx | 2008-04-20 | 24 | OBJECT get_const(STATE, SYMBOL sym); | |
| 25 | OBJECT get_const(STATE, SYMBOL sym, bool* found); | ||||
| 304caf31 » | evanphx | 2008-04-04 | 26 | OBJECT get_const(STATE, char* sym); | |
| 9eb47483 » | evanphx | 2008-04-20 | 27 | ||
| 28 | void set_name(STATE, Module* under, SYMBOL name); | ||||
| feb91b43 » | evanphx | 2008-05-07 | 29 | ||
| 30 | class Info : public TypeInfo { | ||||
| 31 | public: | ||||
| 879a0469 » | evanphx | 2008-05-15 | 32 | BASIC_TYPEINFO(TypeInfo) | |
| feb91b43 » | evanphx | 2008-05-07 | 33 | }; | |
| d769c944 » | evanphx | 2008-03-25 | 34 | }; | |
| 35 | |||||
| 36 | class Class : public Module { | ||||
| 37 | public: | ||||
| feb91b43 » | evanphx | 2008-05-07 | 38 | const static size_t fields = 9; | |
| 22ef7b8b » | evanphx | 2008-04-16 | 39 | const static object_type type = ClassType; | |
| 40 | |||||
| feb91b43 » | evanphx | 2008-05-07 | 41 | FIXNUM instance_fields; // slot | |
| 42 | OBJECT has_ivars; // slot | ||||
| 43 | OBJECT needs_cleanup; // slot | ||||
| 44 | FIXNUM instance_type; // slot | ||||
| d769c944 » | evanphx | 2008-03-25 | 45 | ||
| fceff3d8 » | evanphx | 2008-04-09 | 46 | void set_object_type(size_t type) { | |
| 22ef7b8b » | evanphx | 2008-04-16 | 47 | instance_type = Object::i2n(type); | |
| fceff3d8 » | evanphx | 2008-04-09 | 48 | } | |
| 9eb47483 » | evanphx | 2008-04-20 | 49 | ||
| 50 | static Class* create(STATE, Class* super); | ||||
| feb91b43 » | evanphx | 2008-05-07 | 51 | ||
| 52 | class Info : public TypeInfo { | ||||
| 53 | public: | ||||
| 879a0469 » | evanphx | 2008-05-15 | 54 | BASIC_TYPEINFO(TypeInfo) | |
| feb91b43 » | evanphx | 2008-05-07 | 55 | }; | |
| d769c944 » | evanphx | 2008-03-25 | 56 | }; | |
| 57 | |||||
| 58 | class MetaClass : public Class { | ||||
| 59 | public: | ||||
| feb91b43 » | evanphx | 2008-05-07 | 60 | const static size_t fields = 10; | |
| 22ef7b8b » | evanphx | 2008-04-16 | 61 | const static object_type type = MetaclassType; | |
| 62 | |||||
| feb91b43 » | evanphx | 2008-05-07 | 63 | OBJECT attached_instance; // slot | |
| d769c944 » | evanphx | 2008-03-25 | 64 | ||
| 9eb47483 » | evanphx | 2008-04-20 | 65 | static MetaClass* attach(STATE, OBJECT obj, OBJECT sup = NULL); | |
| feb91b43 » | evanphx | 2008-05-07 | 66 | ||
| 67 | class Info : public TypeInfo { | ||||
| 68 | public: | ||||
| 879a0469 » | evanphx | 2008-05-15 | 69 | BASIC_TYPEINFO(TypeInfo) | |
| feb91b43 » | evanphx | 2008-05-07 | 70 | }; | |
| d769c944 » | evanphx | 2008-03-25 | 71 | }; | |
| 72 | |||||
| 73 | class IncludedModule : public Module { | ||||
| 74 | public: | ||||
| feb91b43 » | evanphx | 2008-05-07 | 75 | const static size_t field = 6; | |
| 76 | const static object_type type = IncModType; | ||||
| d769c944 » | evanphx | 2008-03-25 | 77 | ||
| feb91b43 » | evanphx | 2008-05-07 | 78 | OBJECT module; // slot | |
| 79 | |||||
| 80 | class Info : public TypeInfo { | ||||
| 81 | public: | ||||
| 879a0469 » | evanphx | 2008-05-15 | 82 | BASIC_TYPEINFO(TypeInfo) | |
| feb91b43 » | evanphx | 2008-05-07 | 83 | }; | |
| d769c944 » | evanphx | 2008-03-25 | 84 | }; | |
| 85 | |||||
| 879a0469 » | evanphx | 2008-05-15 | 86 | /* See t1 */ | |
| 87 | template <> | ||||
| 88 | static bool kind_of<Module>(OBJECT obj) { | ||||
| 89 | return obj->reference_p() && | ||||
| 90 | (obj->obj_type == Module::type || | ||||
| 91 | obj->obj_type == Class::type || | ||||
| 92 | obj->obj_type == MetaClass::type || | ||||
| 93 | obj->obj_type == IncludedModule::type); | ||||
| 94 | } | ||||
| 95 | |||||
| 96 | |||||
| d769c944 » | evanphx | 2008-03-25 | 97 | }; | |
| 98 | |||||
| 99 | #endif | ||||







