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 <intern.h> 00015 #include <node.h> 00016 #include <re.h> 00017 #include <env.h> 00018 00019 typedef struct RVALUE { 00020 union { 00021 struct { 00022 unsigned long flags; /* always 0 for freed obj */ 00023 struct RVALUE *next; 00024 } free; 00025 struct RBasic basic; 00026 struct RObject object; 00027 struct RClass klass; 00028 struct RFloat flonum; 00029 struct RString string; 00030 struct RArray array; 00031 struct RRegexp regexp; 00032 struct RHash hash; 00033 struct RData data; 00034 struct RStruct rstruct; 00035 struct RBignum bignum; 00036 struct RFile file; 00037 struct RNode node; 00038 struct RMatch match; 00039 struct RVarmap varmap; 00040 struct SCOPE scope; 00041 } as; 00042 #ifdef GC_DEBUG 00043 char *file; 00044 int line; 00045 #endif 00046 } RVALUE; 00047 static const size_t SLOT_SIZE = sizeof(RVALUE); 00048 00049 /* This is a copy of Ruby 1.8.5 BLOCK structure. It sucks to copy it here, 00050 * but it is not public in Ruby and it is needed to define same_body? */ 00051 struct BLOCK { 00052 NODE *var; 00053 NODE *body; 00054 VALUE self; 00055 struct FRAME frame; 00056 struct SCOPE *scope; 00057 VALUE klass; 00058 NODE *cref; 00059 int iter; 00060 int vmode; 00061 int flags; 00062 int uniq; 00063 struct RVarmap *dyna_vars; 00064 VALUE orig_thread; 00065 VALUE wrapper; 00066 VALUE block_obj; 00067 struct BLOCK *outer; 00068 struct BLOCK *prev; 00069 }; 00070 00071 #endif 00072