gen_eval 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gen_eval/compat.h +39 -0
- data/ext/gen_eval/extconf.rb +0 -3
- data/ext/gen_eval/gen_eval.c +6 -7
- data/lib/gen_eval/version.rb +1 -1
- metadata +5 -5
data/ext/gen_eval/compat.h
CHANGED
@@ -5,13 +5,52 @@
|
|
5
5
|
|
6
6
|
#include <ruby.h>
|
7
7
|
|
8
|
+
/* test for 1.9 */
|
9
|
+
#if !defined(RUBY_19) && defined(ROBJECT_EMBED_LEN_MAX)
|
10
|
+
# define RUBY_19
|
11
|
+
#endif
|
12
|
+
|
8
13
|
/* macros for backwards compatibility with 1.8 */
|
9
14
|
#ifndef RUBY_19
|
10
15
|
# define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl)
|
11
16
|
# define RCLASS_SUPER(c) (RCLASS(c)->super)
|
12
17
|
# define RCLASS_IV_TBL(c) (RCLASS(c)->iv_tbl)
|
18
|
+
# define OBJ_UNTRUSTED OBJ_TAINTED
|
19
|
+
# include "st.h"
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#ifdef RUBY_19
|
23
|
+
inline static VALUE
|
24
|
+
class_alloc(VALUE flags, VALUE klass)
|
25
|
+
{
|
26
|
+
rb_classext_t *ext = ALLOC(rb_classext_t);
|
27
|
+
NEWOBJ(obj, struct RClass);
|
28
|
+
OBJSETUP(obj, klass, flags);
|
29
|
+
obj->ptr = ext;
|
30
|
+
RCLASS_IV_TBL(obj) = 0;
|
31
|
+
RCLASS_M_TBL(obj) = 0;
|
32
|
+
RCLASS_SUPER(obj) = 0;
|
33
|
+
RCLASS_IV_INDEX_TBL(obj) = 0;
|
34
|
+
return (VALUE)obj;
|
35
|
+
}
|
13
36
|
#endif
|
14
37
|
|
38
|
+
inline static VALUE
|
39
|
+
create_class(VALUE flags, VALUE klass)
|
40
|
+
{
|
41
|
+
#ifdef RUBY_19
|
42
|
+
VALUE new_klass = class_alloc(flags, klass);
|
43
|
+
#else
|
44
|
+
NEWOBJ(new_klass, struct RClass);
|
45
|
+
OBJSETUP(new_klass, klass, flags);
|
46
|
+
#endif
|
47
|
+
|
48
|
+
return (VALUE)new_klass;
|
49
|
+
}
|
50
|
+
|
51
|
+
# define FALSE 0
|
52
|
+
# define TRUE 1
|
53
|
+
|
15
54
|
/* a useful macro. cannot use ordinary CLASS_OF as it does not return an lvalue */
|
16
55
|
#define KLASS_OF(c) (RBASIC(c)->klass)
|
17
56
|
|
data/ext/gen_eval/extconf.rb
CHANGED
data/ext/gen_eval/gen_eval.c
CHANGED
@@ -114,13 +114,14 @@ rb_mirror_object(VALUE context)
|
|
114
114
|
VALUE duped_context;
|
115
115
|
|
116
116
|
#ifdef RUBY_19
|
117
|
-
if(TYPE(context) == T_OBJECT)
|
117
|
+
if(TYPE(context) == T_OBJECT) {
|
118
118
|
duped_context = rb_funcall(rb_cObject, rb_intern("new"), 0);
|
119
|
-
|
120
|
-
|
121
|
-
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
duped_context = create_class(T_ICLASS, rb_cClass);
|
122
|
+
}
|
122
123
|
#else
|
123
|
-
duped_context =
|
124
|
+
duped_context = create_class(T_ICLASS, rb_cClass);
|
124
125
|
#endif
|
125
126
|
|
126
127
|
/* the duped_context shares the context's iv_tbl.
|
@@ -145,8 +146,6 @@ rb_mirror_object(VALUE context)
|
|
145
146
|
RCLASS_M_TBL(duped_context) = (struct st_table *) RCLASS_M_TBL(context);
|
146
147
|
RCLASS_IV_TBL(duped_context) = (struct st_table *) RCLASS_IV_TBL(context);
|
147
148
|
#endif
|
148
|
-
|
149
|
-
|
150
149
|
}
|
151
150
|
|
152
151
|
/* ensure singleton exists */
|
data/lib/gen_eval/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gen_eval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- John Mair (banisterfiend)
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-11-02 00:00:00 +13:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|