mixico 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -7,13 +7,16 @@ have to really read this once.
7
7
 
8
8
  % installation %
9
9
  with gem:
10
- $ gem install mixico -s http://gemcutter.org
10
+ $ gem install mixico
11
11
 
12
12
  without:
13
13
  $ ruby setup.rb config
14
14
  $ ruby setup.rb setup
15
15
  $ sudo ruby setup.rb install
16
16
 
17
+ % documentation %
18
+ http://rubydoc.info/github/rkh/mixico/master/file/README
19
+
17
20
  % source code %
18
21
  mixico is written in c. it is very quick (basically atomic.)
19
22
 
@@ -175,5 +178,5 @@ no sign of the mixin at all.
175
178
  Until _why might reappear someday, this project is maintained by Konstantin Haase (rkh).
176
179
  konstantin.mailinglists <at> googlemail <dot> com
177
180
  http://github.com/rkh/mixico
178
- * updated for Ruby 1.9 by banisterfiend
181
+ * updated for Ruby 1.9 + other changes by banisterfiend
179
182
  http://github.com/banister
@@ -5,17 +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)
13
18
  # define OBJ_UNTRUSTED OBJ_TAINTED
14
- # define FALSE 0
15
- # define TRUE 1
16
19
  # include "st.h"
17
20
  #endif
18
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
+ }
36
+ #endif
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
+
19
54
  /* a useful macro. cannot use ordinary CLASS_OF as it does not return an lvalue */
20
55
  #define KLASS_OF(c) (RBASIC(c)->klass)
21
56
 
@@ -1,6 +1,3 @@
1
1
  require 'mkmf'
2
2
 
3
- # 1.9 compatibility
4
- $CFLAGS += " -DRUBY_19" if RUBY_VERSION =~ /1.9/
5
-
6
3
  create_makefile("mixico")
@@ -9,22 +9,6 @@
9
9
 
10
10
  static VALUE mixin_eval, mixout_eval;
11
11
 
12
- #ifdef RUBY_19
13
- static VALUE
14
- class_alloc(VALUE flags, VALUE klass)
15
- {
16
- rb_classext_t *ext = ALLOC(rb_classext_t);
17
- NEWOBJ(obj, struct RClass);
18
- OBJSETUP(obj, klass, flags);
19
- obj->ptr = ext;
20
- RCLASS_IV_TBL(obj) = 0;
21
- RCLASS_M_TBL(obj) = 0;
22
- RCLASS_SUPER(obj) = 0;
23
- RCLASS_IV_INDEX_TBL(obj) = 0;
24
- return (VALUE)obj;
25
- }
26
- #endif
27
-
28
12
  static VALUE
29
13
  rb_mod_disable_mixin(VALUE module, VALUE super)
30
14
  {
@@ -66,13 +50,8 @@ static VALUE
66
50
  rb_mod_mixin_object(VALUE target, VALUE obj)
67
51
  {
68
52
  VALUE singleton = rb_singleton_class(obj);
53
+ VALUE iclass = create_class(T_ICLASS, rb_cClass);
69
54
 
70
- #ifdef RUBY_19
71
- VALUE iclass = class_alloc(T_ICLASS, rb_cClass);
72
- #else
73
- NEWOBJ(iclass, struct RClass);
74
- OBJSETUP(iclass, rb_cClass, T_ICLASS);
75
- #endif
76
55
  Check_Type(target, T_MODULE);
77
56
  if (!RCLASS_IV_TBL(obj))
78
57
  RCLASS_IV_TBL(obj) = st_init_numtable();
@@ -1,3 +1,7 @@
1
+ # mixico.rb
2
+ # added by John Mair (banisterfiend) 2010
3
+ # License: MIT
4
+
1
5
  direc = File.dirname(__FILE__)
2
6
 
3
7
  begin
@@ -1,3 +1,3 @@
1
1
  module Mixico
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - why the lucky stiff
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-10-11 00:00:00 +13:00
19
+ date: 2010-10-30 00:00:00 +13:00
20
20
  default_executable:
21
21
  dependencies: []
22
22