00001 #ifndef __RUBY_INTERNALS_HH__ 00002 #define __RUBY_INTERNALS_HH__ 00003 00004 /* WARNING: this file contains copies of internal Ruby structures. They are not supposed to be copied (I think ;-)), but I had to nonetheless. 00005 * The following methods depend on these: 00006 * 00007 * Kernel.swap! 00008 * Proc#same_body? 00009 * Proc#file 00010 * Proc#line 00011 */ 00012 00013 #include <ruby.h> 00014 #include <ruby/intern.h> 00015 #include <ruby/re.h> 00016 00017 typedef struct RNode { 00018 unsigned long flags; 00019 char *nd_file; 00020 union { 00021 struct RNode *node; 00022 ID id; 00023 VALUE value; 00024 VALUE (*cfunc)(ANYARGS); 00025 ID *tbl; 00026 } u1; 00027 union { 00028 struct RNode *node; 00029 ID id; 00030 long argc; 00031 VALUE value; 00032 } u2; 00033 union { 00034 struct RNode *node; 00035 ID id; 00036 long state; 00037 struct global_entry *entry; 00038 long cnt; 00039 VALUE value; 00040 } u3; 00041 } NODE; 00042 00043 typedef struct RVALUE { 00044 union { 00045 struct { 00046 VALUE flags; /* always 0 for freed obj */ 00047 struct RVALUE *next; 00048 } free; 00049 struct RBasic basic; 00050 struct RObject object; 00051 struct RClass klass; 00052 struct RFloat flonum; 00053 struct RString string; 00054 struct RArray array; 00055 struct RRegexp regexp; 00056 struct RHash hash; 00057 struct RData data; 00058 struct RStruct rstruct; 00059 struct RBignum bignum; 00060 struct RFile file; 00061 struct RNode node; 00062 struct RMatch match; 00063 struct RRational rational; 00064 struct RComplex complex; 00065 } as; 00066 } RVALUE; 00067 00068 static const size_t SLOT_SIZE = sizeof(RVALUE); 00069 00070 #endif 00071