lwes 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7d62fc6afb8a36f919d448037c91b33586ac1776
4
+ data.tar.gz: 0f0162861c07777ef845e989ee1c8f6e6db467e9
5
+ SHA512:
6
+ metadata.gz: 3a7834f09cafd4ab8ba7c4c9ff6243f92ac9fc14e3cbe957f4c3a229b3743a2898b5e1c9c46e766471f9a6e75a61c1be00e2608e4db749547a88247ae2afbd59
7
+ data.tar.gz: 189ed6c5a8f779477d3fbb851058808e65b63325e4c116b7243337159f40e6076d68f45a7fa0f7f4e53078feb8e32c7d2f41fe878da31a75f2792ff2912b9414
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  *.so
3
3
  *.log
4
4
  /tmp
5
+ *.tar.gz
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ Version 0.8.6 (erik-s-chang)
2
+ * Fix Ruby 2.1.0preview1 compatibility
3
+
1
4
  Version 0.8.5 (erik-s-chang)
2
5
  * Fix Ruby 2.0.0 compatibility
3
6
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  static VALUE ENC; /* LWES_ENCODING */
9
9
  static ID id_TYPE_DB, id_TYPE_LIST, id_NAME, id_HAVE_ENCODING;
10
- static ID id_new, id_enc, id_size;
10
+ static ID id_new, id_enc, id_size, id_to_a;
11
11
  static VALUE sym_enc;
12
12
 
13
13
  static void dump_name(char *name, LWES_BYTE_P buf, size_t *off)
@@ -111,13 +111,12 @@ static VALUE event_hash_iter_i(VALUE kv, VALUE memo)
111
111
  int rv = 0;
112
112
  LWES_BYTE_P buf = hash_memo->buf;
113
113
  size_t *off = &hash_memo->off;
114
- VALUE *tmp;
115
114
 
116
115
  if (TYPE(kv) != T_ARRAY || RARRAY_LEN(kv) != 2)
117
116
  rb_raise(rb_eTypeError,
118
117
  "hash iteration not giving key-value pairs");
119
- tmp = RARRAY_PTR(kv);
120
- name = tmp[0];
118
+
119
+ name = rb_ary_entry(kv, 0);
121
120
 
122
121
  if (name == sym_enc) return Qnil; /* already dumped first */
123
122
 
@@ -127,7 +126,7 @@ static VALUE event_hash_iter_i(VALUE kv, VALUE memo)
127
126
  if (strcmp(attr_name, LWES_ENCODING) == 0)
128
127
  return Qnil;
129
128
 
130
- val = tmp[1];
129
+ val = rb_ary_entry(kv, 1);
131
130
 
132
131
  switch (TYPE(val)) {
133
132
  case T_TRUE:
@@ -243,30 +242,15 @@ static void lwes_struct_class(
243
242
  *have_enc = rb_const_get(*event_class, id_HAVE_ENCODING);
244
243
  }
245
244
 
246
- #if !defined(RSTRUCT_PTR) && defined(RSTRUCT)
247
- # define RSTRUCT_PTR(s) (RSTRUCT(s)->ptr)
248
- #endif
249
- static VALUE * rstruct_ptr(VALUE *ary, VALUE rstruct)
250
- {
251
- #ifdef RSTRUCT_PTR
252
- return RSTRUCT_PTR(*ary = rstruct);
253
- #else
254
- *ary = rb_funcall(rstruct, rb_intern("to_a"), 0, 0);
255
- return RARRAY_PTR(*ary);
256
- #endif
257
- }
258
-
259
245
  static VALUE emit_struct(VALUE self, VALUE event)
260
246
  {
261
- VALUE event_class, name, type_list, have_enc;
247
+ VALUE event_class, name, type_list, have_enc, event_ary;
262
248
  struct _rb_lwes_emitter *rle = _rle(self);
263
249
  LWES_BYTE_P buf = rle->emitter->buffer;
264
250
  size_t off = 0;
265
- long i;
266
- VALUE *tmp;
251
+ long i, len;
267
252
  LWES_U_INT_16 num_attr = 0;
268
253
  size_t num_attr_off;
269
- VALUE *flds;
270
254
  char *str;
271
255
 
272
256
  lwes_struct_class(&event_class, &name, &type_list, &have_enc, event);
@@ -290,24 +274,26 @@ static VALUE emit_struct(VALUE self, VALUE event)
290
274
  }
291
275
  }
292
276
 
293
- i = RARRAY_LEN(type_list);
294
- flds = rstruct_ptr(&name, event);
295
- tmp = RARRAY_PTR(type_list);
296
- for (; --i >= 0; tmp++, flds++) {
297
- /* inner: [ :field_sym, "field_name", type ] */
298
- VALUE *inner = RARRAY_PTR(*tmp);
277
+ len = RARRAY_LEN(type_list);
278
+ event_ary = rb_funcall(event, id_to_a, 0, 0);
279
+ for (i = 0; i < len; i++) {
280
+ /* type_list [ [ :field_sym, "field_name", ltype ] ] */
281
+ VALUE tlent = rb_ary_entry(type_list, i);
282
+ VALUE field_sym = rb_ary_entry(tlent, 0);
283
+ VALUE field_name;
299
284
  VALUE val;
300
285
  LWES_TYPE type;
301
286
 
302
- if (inner[0] == sym_enc) /* encoding was already dumped */
287
+ if (field_sym == sym_enc) /* encoding was already dumped */
303
288
  continue;
304
289
 
305
- val = *flds;
290
+ val = rb_ary_entry(event_ary, i);
306
291
  if (NIL_P(val))
307
292
  continue; /* LWES doesn't know nil */
308
293
 
309
- str = StringValueCStr(inner[1]);
310
- type = NUM2INT(inner[2]);
294
+ field_name = rb_ary_entry(tlent, 1);
295
+ str = StringValueCStr(field_name);
296
+ type = NUM2INT(rb_ary_entry(tlent, 2));
311
297
  ++num_attr;
312
298
  marshal_field(str, type, val, buf, &off);
313
299
  }
@@ -565,6 +551,7 @@ void lwesrb_init_emitter(void)
565
551
  LWESRB_MKID(new);
566
552
  LWESRB_MKID(size);
567
553
  id_enc = rb_intern(LWES_ENCODING);
554
+ id_to_a = rb_intern("to_a");
568
555
  sym_enc = ID2SYM(id_enc);
569
556
 
570
557
  ENC = rb_obj_freeze(rb_str_new2(LWES_ENCODING));
@@ -36,8 +36,7 @@ void lwesrb_dump_num_ary(VALUE array, LWES_BYTE_P buf, size_t *off);
36
36
  # define RSTRING_LEN(s) (RSTRING(s)->len)
37
37
  #endif
38
38
 
39
- #ifndef RARRAY_PTR
40
- # define RARRAY_PTR(s) (RARRAY(s)->ptr)
39
+ #ifndef RARRAY_LEN
41
40
  # define RARRAY_LEN(s) (RARRAY(s)->len)
42
41
  #endif
43
42
 
@@ -111,7 +111,6 @@ void lwesrb_dump_num_ary(VALUE array, LWES_BYTE_P buf, size_t *off)
111
111
  volatile VALUE raise_inspect;
112
112
  int i, rv;
113
113
  struct _type_fn_map *head;
114
- VALUE *ary;
115
114
  ID type;
116
115
 
117
116
  assert(TYPE(array) == T_ARRAY && "need array here");
@@ -119,15 +118,14 @@ void lwesrb_dump_num_ary(VALUE array, LWES_BYTE_P buf, size_t *off)
119
118
  if (RARRAY_LEN(array) != 2)
120
119
  rb_raise(rb_eArgError, "expected a two element array");
121
120
 
122
- ary = RARRAY_PTR(array);
123
- type = ary[0];
121
+ type = rb_ary_entry(array, 0);
124
122
 
125
123
  i = sizeof(type_fn_map) / sizeof(type_fn_map[0]);
126
124
  for (head = type_fn_map; --i >= 0; head++) {
127
125
  if (head->type != type)
128
126
  continue;
129
127
 
130
- rv = head->fn(ary[1], buf, off);
128
+ rv = head->fn(rb_ary_entry(array, 1), buf, off);
131
129
  if (rv > 0)
132
130
  return;
133
131
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{lwes}
3
- s.version = "0.8.5"
3
+ s.version = "0.8.6"
4
4
  s.date = Time.now
5
5
  s.authors = ["Erik S. Chang", "Frank Maritato"]
6
6
  s.email = %q{lwes-devel@lists.sourceforge.net}
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lwes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
5
- prerelease:
4
+ version: 0.8.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Erik S. Chang
@@ -10,34 +9,28 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-02-28 00:00:00.000000000 Z
12
+ date: 2013-09-24 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rake-compiler
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: 0.7.6
23
21
  type: :development
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - '>='
29
26
  - !ruby/object:Gem::Version
30
27
  version: 0.7.6
31
- description: ! 'The LWES Light-Weight Event System is a framework for allowing the
32
- exchange of
33
-
28
+ description: |-
29
+ The LWES Light-Weight Event System is a framework for allowing the exchange of
34
30
  information from many machines to many machines in a controlled, platform
35
-
36
31
  neutral, language neutral way. The exchange of information is done in a
37
-
38
32
  connectless fashion using multicast or unicast UDP, and using self describing
39
-
40
- data so that any platform or language can translate it to it''s local dialect.'
33
+ data so that any platform or language can translate it to it's local dialect.
41
34
  email: lwes-devel@lists.sourceforge.net
42
35
  executables: []
43
36
  extensions:
@@ -86,27 +79,26 @@ files:
86
79
  - ext/lwes_ext/lwes-0.23.1.tar.gz
87
80
  homepage: http://lwes.rubyforge.org/
88
81
  licenses: []
82
+ metadata: {}
89
83
  post_install_message:
90
84
  rdoc_options: []
91
85
  require_paths:
92
86
  - lib
93
87
  required_ruby_version: !ruby/object:Gem::Requirement
94
- none: false
95
88
  requirements:
96
- - - ! '>='
89
+ - - '>='
97
90
  - !ruby/object:Gem::Version
98
91
  version: '0'
99
92
  required_rubygems_version: !ruby/object:Gem::Requirement
100
- none: false
101
93
  requirements:
102
- - - ! '>='
94
+ - - '>='
103
95
  - !ruby/object:Gem::Version
104
96
  version: '0'
105
97
  requirements: []
106
98
  rubyforge_project: lwes
107
- rubygems_version: 1.8.25
99
+ rubygems_version: 2.0.3
108
100
  signing_key:
109
- specification_version: 3
101
+ specification_version: 4
110
102
  summary: Ruby bindings for the Light Weight Event System
111
103
  test_files:
112
104
  - test/unit/test_emit_struct.rb