msgpack 0.6.2-x64-mingw32 → 0.7.0dev1-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +33 -0
  3. data/README.rdoc +2 -6
  4. data/Rakefile +9 -0
  5. data/appveyor.yml +18 -0
  6. data/doclib/msgpack/error.rb +6 -1
  7. data/doclib/msgpack/extension_value.rb +9 -0
  8. data/doclib/msgpack/factory.rb +68 -0
  9. data/doclib/msgpack/packer.rb +38 -0
  10. data/doclib/msgpack/unpacker.rb +39 -2
  11. data/ext/java/org/msgpack/jruby/Buffer.java +4 -0
  12. data/ext/java/org/msgpack/jruby/Decoder.java +44 -0
  13. data/ext/java/org/msgpack/jruby/Encoder.java +46 -4
  14. data/ext/java/org/msgpack/jruby/ExtensionValue.java +55 -60
  15. data/ext/java/org/msgpack/jruby/MessagePackLibrary.java +18 -5
  16. data/ext/java/org/msgpack/jruby/Packer.java +17 -4
  17. data/ext/java/org/msgpack/jruby/Unpacker.java +59 -2
  18. data/ext/msgpack/buffer_class.c +2 -2
  19. data/ext/msgpack/buffer_class.h +1 -1
  20. data/ext/msgpack/compat.h +12 -0
  21. data/ext/msgpack/core_ext.c +15 -0
  22. data/ext/msgpack/extconf.rb +4 -1
  23. data/ext/msgpack/extension_value_class.c +34 -0
  24. data/ext/msgpack/extension_value_class.h +31 -0
  25. data/ext/msgpack/factory_class.c +213 -0
  26. data/ext/msgpack/factory_class.h +35 -0
  27. data/ext/msgpack/packer.c +14 -7
  28. data/ext/msgpack/packer.h +46 -8
  29. data/ext/msgpack/packer_class.c +92 -45
  30. data/ext/msgpack/packer_class.h +4 -2
  31. data/ext/msgpack/packer_ext_registry.c +87 -0
  32. data/ext/msgpack/packer_ext_registry.h +101 -0
  33. data/ext/msgpack/rbinit.c +4 -0
  34. data/ext/msgpack/unpacker.c +128 -23
  35. data/ext/msgpack/unpacker.h +11 -0
  36. data/ext/msgpack/unpacker_class.c +117 -38
  37. data/ext/msgpack/unpacker_class.h +4 -2
  38. data/ext/msgpack/unpacker_ext_registry.c +68 -0
  39. data/ext/msgpack/unpacker_ext_registry.h +62 -0
  40. data/lib/msgpack.rb +4 -0
  41. data/lib/msgpack/factory.rb +60 -0
  42. data/lib/msgpack/packer.rb +28 -0
  43. data/lib/msgpack/unpacker.rb +28 -0
  44. data/lib/msgpack/version.rb +1 -1
  45. data/msgpack.gemspec +4 -3
  46. data/spec/cruby/buffer_io_spec.rb +2 -3
  47. data/spec/cruby/buffer_spec.rb +1 -3
  48. data/spec/cruby/unpacker_spec.rb +14 -2
  49. data/spec/ext_value_spec.rb +99 -0
  50. data/spec/exttypes.rb +51 -0
  51. data/spec/factory_spec.rb +236 -0
  52. data/spec/jruby/msgpack/unpacker_spec.rb +25 -0
  53. data/spec/{jruby/msgpack_spec.rb → msgpack_spec.rb} +1 -1
  54. data/spec/pack_spec.rb +0 -6
  55. data/spec/packer_spec.rb +95 -0
  56. data/spec/spec_helper.rb +12 -1
  57. data/spec/unpack_spec.rb +1 -4
  58. data/spec/unpacker_spec.rb +133 -0
  59. metadata +49 -15
  60. data/Dockerfile +0 -55
@@ -19,6 +19,7 @@
19
19
  #define MSGPACK_RUBY_UNPACKER_H__
20
20
 
21
21
  #include "buffer.h"
22
+ #include "unpacker_ext_registry.h"
22
23
 
23
24
  #ifndef MSGPACK_UNPACKER_STACK_CAPACITY
24
25
  #define MSGPACK_UNPACKER_STACK_CAPACITY 128
@@ -55,11 +56,15 @@ struct msgpack_unpacker_t {
55
56
 
56
57
  VALUE reading_raw;
57
58
  size_t reading_raw_remaining;
59
+ int reading_raw_type;
58
60
 
59
61
  VALUE buffer_ref;
60
62
 
63
+ msgpack_unpacker_ext_registry_t ext_registry;
64
+
61
65
  /* options */
62
66
  bool symbolize_keys;
67
+ bool allow_unknown_ext;
63
68
  };
64
69
 
65
70
  #define UNPACKER_BUFFER_(uk) (&(uk)->buffer)
@@ -91,6 +96,11 @@ static inline void msgpack_unpacker_set_symbolized_keys(msgpack_unpacker_t* uk,
91
96
  uk->symbolize_keys = enable;
92
97
  }
93
98
 
99
+ static inline void msgpack_unpacker_set_allow_unknown_ext(msgpack_unpacker_t* uk, bool enable)
100
+ {
101
+ uk->allow_unknown_ext = enable;
102
+ }
103
+
94
104
 
95
105
  /* error codes */
96
106
  #define PRIMITIVE_CONTAINER_START 1
@@ -99,6 +109,7 @@ static inline void msgpack_unpacker_set_symbolized_keys(msgpack_unpacker_t* uk,
99
109
  #define PRIMITIVE_INVALID_BYTE -2
100
110
  #define PRIMITIVE_STACK_TOO_DEEP -3
101
111
  #define PRIMITIVE_UNEXPECTED_TYPE -4
112
+ #define PRIMITIVE_UNEXPECTED_EXT_TYPE -5
102
113
 
103
114
  int msgpack_unpacker_read(msgpack_unpacker_t* uk, size_t target_stack_depth);
104
115
 
@@ -19,6 +19,7 @@
19
19
  #include "unpacker.h"
20
20
  #include "unpacker_class.h"
21
21
  #include "buffer_class.h"
22
+ #include "factory_class.h"
22
23
 
23
24
  VALUE cMessagePack_Unpacker;
24
25
 
@@ -28,7 +29,9 @@ VALUE cMessagePack_Unpacker;
28
29
  static VALUE eUnpackError;
29
30
  static VALUE eMalformedFormatError;
30
31
  static VALUE eStackError;
31
- static VALUE eTypeError;
32
+ static VALUE eUnexpectedTypeError;
33
+ static VALUE eUnknownExtTypeError;
34
+ static VALUE mTypeError; // obsoleted. only for backward compatibility. See #86.
32
35
 
33
36
  #define UNPACKER(from, name) \
34
37
  msgpack_unpacker_t *name = NULL; \
@@ -42,23 +45,31 @@ static void Unpacker_free(msgpack_unpacker_t* uk)
42
45
  if(uk == NULL) {
43
46
  return;
44
47
  }
48
+ msgpack_unpacker_ext_registry_destroy(&uk->ext_registry);
45
49
  _msgpack_unpacker_destroy(uk);
46
50
  free(uk);
47
51
  }
48
52
 
49
- static VALUE Unpacker_alloc(VALUE klass)
53
+ static void Unpacker_mark(msgpack_unpacker_t* uk)
54
+ {
55
+ msgpack_unpacker_mark(uk);
56
+ msgpack_unpacker_ext_registry_mark(&uk->ext_registry);
57
+ }
58
+
59
+ VALUE MessagePack_Unpacker_alloc(VALUE klass)
50
60
  {
51
61
  msgpack_unpacker_t* uk = ALLOC_N(msgpack_unpacker_t, 1);
52
62
  _msgpack_unpacker_init(uk);
53
63
 
54
- VALUE self = Data_Wrap_Struct(klass, msgpack_unpacker_mark, Unpacker_free, uk);
64
+ VALUE self = Data_Wrap_Struct(klass, Unpacker_mark, Unpacker_free, uk);
55
65
 
66
+ msgpack_unpacker_ext_registry_init(&uk->ext_registry);
56
67
  uk->buffer_ref = MessagePack_Buffer_wrap(UNPACKER_BUFFER_(uk), self);
57
68
 
58
69
  return self;
59
70
  }
60
71
 
61
- static VALUE Unpacker_initialize(int argc, VALUE* argv, VALUE self)
72
+ VALUE MessagePack_Unpacker_initialize(int argc, VALUE* argv, VALUE self)
62
73
  {
63
74
  VALUE io = Qnil;
64
75
  VALUE options = Qnil;
@@ -90,21 +101,19 @@ static VALUE Unpacker_initialize(int argc, VALUE* argv, VALUE self)
90
101
 
91
102
  UNPACKER(self, uk);
92
103
 
93
- MessagePack_Unpacker_initialize(uk, io, options);
94
-
95
- return self;
96
- }
97
-
98
- void MessagePack_Unpacker_initialize(msgpack_unpacker_t* uk, VALUE io, VALUE options)
99
- {
100
- MessagePack_Buffer_initialize(UNPACKER_BUFFER_(uk), io, options);
104
+ MessagePack_Buffer_set_options(UNPACKER_BUFFER_(uk), io, options);
101
105
 
102
106
  if(options != Qnil) {
103
107
  VALUE v;
104
108
 
105
109
  v = rb_hash_aref(options, ID2SYM(rb_intern("symbolize_keys")));
106
110
  msgpack_unpacker_set_symbolized_keys(uk, RTEST(v));
111
+
112
+ v = rb_hash_aref(options, ID2SYM(rb_intern("allow_unknown_ext")));
113
+ msgpack_unpacker_set_allow_unknown_ext(uk, RTEST(v));
107
114
  }
115
+
116
+ return self;
108
117
  }
109
118
 
110
119
  static void raise_unpacker_error(int r)
@@ -117,7 +126,9 @@ static void raise_unpacker_error(int r)
117
126
  case PRIMITIVE_STACK_TOO_DEEP:
118
127
  rb_raise(eStackError, "stack level too deep");
119
128
  case PRIMITIVE_UNEXPECTED_TYPE:
120
- rb_raise(eTypeError, "unexpected type");
129
+ rb_raise(eUnexpectedTypeError, "unexpected type");
130
+ case PRIMITIVE_UNEXPECTED_EXT_TYPE:
131
+ rb_raise(eUnknownExtTypeError, "unexpected extension type");
121
132
  default:
122
133
  rb_raise(eUnpackError, "logically unknown error %d", r);
123
134
  }
@@ -283,6 +294,13 @@ static VALUE Unpacker_each(VALUE self)
283
294
 
284
295
  static VALUE Unpacker_feed_each(VALUE self, VALUE data)
285
296
  {
297
+ #ifdef RETURN_ENUMERATOR
298
+ {
299
+ VALUE argv[] = { data };
300
+ RETURN_ENUMERATOR(self, sizeof(argv) / sizeof(VALUE), argv);
301
+ }
302
+ #endif
303
+
286
304
  // TODO optimize
287
305
  Unpacker_feed(self, data);
288
306
  return Unpacker_each(self);
@@ -297,39 +315,83 @@ static VALUE Unpacker_reset(VALUE self)
297
315
  return Qnil;
298
316
  }
299
317
 
300
- VALUE MessagePack_unpack(int argc, VALUE* argv)
318
+ static VALUE Unpacker_registered_types_internal(VALUE self)
301
319
  {
302
- VALUE src;
303
- VALUE options = Qnil;
320
+ UNPACKER(self, uk);
304
321
 
305
- switch(argc) {
306
- case 2:
307
- options = argv[1];
308
- if(rb_type(options) != T_HASH) {
309
- rb_raise(rb_eArgError, "expected Hash but found %s.", rb_obj_classname(options));
322
+ VALUE mapping = rb_hash_new();
323
+ for(int i=0; i < 256; i++) {
324
+ if(uk->ext_registry.array[i] != Qnil) {
325
+ rb_hash_aset(mapping, INT2FIX(i - 128), uk->ext_registry.array[i]);
310
326
  }
311
- /* pass-through */
327
+ }
328
+
329
+ return mapping;
330
+ }
331
+
332
+ static VALUE Unpacker_register_type(int argc, VALUE* argv, VALUE self)
333
+ {
334
+ UNPACKER(self, uk);
335
+
336
+ int ext_type;
337
+ VALUE proc;
338
+ VALUE arg;
339
+ VALUE ext_class;
340
+
341
+ switch (argc) {
312
342
  case 1:
313
- src = argv[0];
343
+ /* register_type(0x7f) {|data| block... } */
344
+ rb_need_block();
345
+ #ifdef HAVE_RB_BLOCK_LAMBDA
346
+ proc = rb_block_lambda();
347
+ #else
348
+ /* MRI 1.8 */
349
+ proc = rb_block_proc();
350
+ #endif
351
+ arg = proc;
352
+ ext_class = Qnil;
353
+ break;
354
+ case 3:
355
+ /* register_type(0x7f, Time, :from_msgpack_ext) */
356
+ ext_class = argv[1];
357
+ arg = argv[2];
358
+ proc = rb_obj_method(ext_class, arg);
314
359
  break;
315
360
  default:
316
- rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
361
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1 or 3)", argc);
317
362
  }
318
363
 
319
- VALUE self = Unpacker_alloc(cMessagePack_Unpacker);
320
- UNPACKER(self, uk);
321
- //_msgpack_unpacker_reset(s_unpacker);
322
- //msgpack_buffer_reset_io(UNPACKER_BUFFER_(s_unpacker));
364
+ ext_type = rb_num2int(argv[0]);
365
+ if(ext_type < -128 || ext_type > 127) {
366
+ rb_raise(rb_eRangeError, "integer %d too big to convert to `signed char'", ext_type);
367
+ }
323
368
 
324
- /* prefer reference than copying; see MessagePack_Unpacker_module_init */
325
- msgpack_buffer_set_write_reference_threshold(UNPACKER_BUFFER_(uk), 0);
369
+ msgpack_unpacker_ext_registry_put(&uk->ext_registry, ext_class, ext_type, proc, arg);
370
+
371
+ return Qnil;
372
+ }
373
+
374
+ VALUE MessagePack_unpack(int argc, VALUE* argv)
375
+ {
376
+ VALUE src;
377
+ VALUE self;
378
+
379
+ if (argc < 0 || argc > 2) {
380
+ rb_raise(rb_eArgError, "wrong number of arguments (%d for 1..2)", argc);
381
+ }
382
+ src = argv[0];
326
383
 
327
384
  if(rb_type(src) == T_STRING) {
328
- MessagePack_Unpacker_initialize(uk, Qnil, options);
385
+ self = MessagePack_Factory_unpacker(argc - 1, argv + 1, cMessagePack_DefaultFactory);
386
+ UNPACKER(self, uk);
329
387
  msgpack_buffer_append_string(UNPACKER_BUFFER_(uk), src);
330
388
  } else {
331
- MessagePack_Unpacker_initialize(uk, src, options);
389
+ self = MessagePack_Factory_unpacker(argc, argv, cMessagePack_DefaultFactory);
332
390
  }
391
+ UNPACKER(self, uk);
392
+
393
+ /* prefer reference than copying; see MessagePack_Unpacker_module_init */
394
+ msgpack_buffer_set_write_reference_threshold(UNPACKER_BUFFER_(uk), 0);
333
395
 
334
396
  int r = msgpack_unpacker_read(uk, 0);
335
397
  if(r < 0) {
@@ -337,8 +399,9 @@ VALUE MessagePack_unpack(int argc, VALUE* argv)
337
399
  }
338
400
 
339
401
  /* raise if extra bytes follow */
340
- if(msgpack_buffer_top_readable_size(UNPACKER_BUFFER_(uk)) > 0) {
341
- rb_raise(eMalformedFormatError, "extra bytes follow after a deserialized object");
402
+ size_t extra = msgpack_buffer_top_readable_size(UNPACKER_BUFFER_(uk));
403
+ if(extra > 0) {
404
+ rb_raise(eMalformedFormatError, "%zd extra bytes after the deserialized object", extra);
342
405
  }
343
406
 
344
407
  #ifdef RB_GC_GUARD
@@ -362,9 +425,19 @@ static VALUE MessagePack_unpack_module_method(int argc, VALUE* argv, VALUE mod)
362
425
  return MessagePack_unpack(argc, argv);
363
426
  }
364
427
 
428
+ VALUE MessagePack_Unpacker_new(int argc, VALUE* argv)
429
+ {
430
+ VALUE self = MessagePack_Unpacker_alloc(cMessagePack_Unpacker);
431
+ MessagePack_Unpacker_initialize(argc, argv, self);
432
+ return self;
433
+ }
434
+
365
435
  void MessagePack_Unpacker_module_init(VALUE mMessagePack)
366
436
  {
367
437
  msgpack_unpacker_static_init();
438
+ msgpack_unpacker_ext_registry_static_init();
439
+
440
+ mTypeError = rb_define_module_under(mMessagePack, "TypeError");
368
441
 
369
442
  cMessagePack_Unpacker = rb_define_class_under(mMessagePack, "Unpacker", rb_cObject);
370
443
 
@@ -374,11 +447,14 @@ void MessagePack_Unpacker_module_init(VALUE mMessagePack)
374
447
 
375
448
  eStackError = rb_define_class_under(mMessagePack, "StackError", eUnpackError);
376
449
 
377
- eTypeError = rb_define_class_under(mMessagePack, "TypeError", rb_eStandardError);
450
+ eUnexpectedTypeError = rb_define_class_under(mMessagePack, "UnexpectedTypeError", eUnpackError);
451
+ rb_include_module(eUnexpectedTypeError, mTypeError);
452
+
453
+ eUnknownExtTypeError = rb_define_class_under(mMessagePack, "UnknownExtTypeError", eUnpackError);
378
454
 
379
- rb_define_alloc_func(cMessagePack_Unpacker, Unpacker_alloc);
455
+ rb_define_alloc_func(cMessagePack_Unpacker, MessagePack_Unpacker_alloc);
380
456
 
381
- rb_define_method(cMessagePack_Unpacker, "initialize", Unpacker_initialize, -1);
457
+ rb_define_method(cMessagePack_Unpacker, "initialize", MessagePack_Unpacker_initialize, -1);
382
458
  rb_define_method(cMessagePack_Unpacker, "buffer", Unpacker_buffer, 0);
383
459
  rb_define_method(cMessagePack_Unpacker, "read", Unpacker_read, 0);
384
460
  rb_define_alias(cMessagePack_Unpacker, "unpack", "read");
@@ -392,7 +468,10 @@ void MessagePack_Unpacker_module_init(VALUE mMessagePack)
392
468
  rb_define_method(cMessagePack_Unpacker, "feed_each", Unpacker_feed_each, 1);
393
469
  rb_define_method(cMessagePack_Unpacker, "reset", Unpacker_reset, 0);
394
470
 
395
- //s_unpacker_value = Unpacker_alloc(cMessagePack_Unpacker);
471
+ rb_define_private_method(cMessagePack_Unpacker, "registered_types_internal", Unpacker_registered_types_internal, 0);
472
+ rb_define_method(cMessagePack_Unpacker, "register_type", Unpacker_register_type, -1);
473
+
474
+ //s_unpacker_value = MessagePack_Unpacker_alloc(cMessagePack_Unpacker);
396
475
  //rb_gc_register_address(&s_unpacker_value);
397
476
  //Data_Get_Struct(s_unpacker_value, msgpack_unpacker_t, s_unpacker);
398
477
  /* prefer reference than copying */
@@ -24,9 +24,11 @@ extern VALUE cMessagePack_Unpacker;
24
24
 
25
25
  void MessagePack_Unpacker_module_init(VALUE mMessagePack);
26
26
 
27
- VALUE MessagePack_unpack(int argc, VALUE* argv);
27
+ VALUE MessagePack_Unpacker_alloc(VALUE klass);
28
+
29
+ VALUE MessagePack_Unpacker_initialize(int argc, VALUE* argv, VALUE self);
28
30
 
29
- void MessagePack_Unpacker_initialize(msgpack_unpacker_t* uk, VALUE io, VALUE options);
31
+ VALUE MessagePack_unpack(int argc, VALUE* argv);
30
32
 
31
33
  #endif
32
34
 
@@ -0,0 +1,68 @@
1
+ /*
2
+ * MessagePack for Ruby
3
+ *
4
+ * Copyright (C) 2008-2015 Sadayuki Furuhashi
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ #include "unpacker_ext_registry.h"
20
+
21
+ static ID s_call;
22
+ static ID s_dup;
23
+
24
+ void msgpack_unpacker_ext_registry_static_init()
25
+ {
26
+ s_call = rb_intern("call");
27
+ s_dup = rb_intern("dup");
28
+ }
29
+
30
+ void msgpack_unpacker_ext_registry_static_destroy()
31
+ { }
32
+
33
+ void msgpack_unpacker_ext_registry_init(msgpack_unpacker_ext_registry_t* ukrg)
34
+ {
35
+ for(int i=0; i < 256; i++) {
36
+ ukrg->array[i] = Qnil;
37
+ }
38
+ }
39
+
40
+ void msgpack_unpacker_ext_registry_mark(msgpack_unpacker_ext_registry_t* ukrg)
41
+ {
42
+ for(int i=0; i < 256; i++) {
43
+ rb_gc_mark(ukrg->array[i]);
44
+ }
45
+ }
46
+
47
+ void msgpack_unpacker_ext_registry_dup(msgpack_unpacker_ext_registry_t* src,
48
+ msgpack_unpacker_ext_registry_t* dst)
49
+ {
50
+ for(int i=0; i < 256; i++) {
51
+ dst->array[i] = src->array[i];
52
+ }
53
+ }
54
+
55
+ VALUE msgpack_unpacker_ext_registry_put(msgpack_unpacker_ext_registry_t* ukrg,
56
+ VALUE ext_class, int ext_type, VALUE proc, VALUE arg)
57
+ {
58
+ VALUE e = rb_ary_new3(3, ext_class, proc, arg);
59
+ VALUE before = ukrg->array[ext_type + 128];
60
+ ukrg->array[ext_type + 128] = e;
61
+ return before;
62
+ }
63
+
64
+ VALUE msgpack_unpacker_ext_registry_call(msgpack_unpacker_ext_registry_t* ukrg,
65
+ VALUE proc, VALUE ext_data)
66
+ {
67
+ return rb_funcall(proc, s_call, 1, ext_data);
68
+ }
@@ -0,0 +1,62 @@
1
+ /*
2
+ * MessagePack for Ruby
3
+ *
4
+ * Copyright (C) 2008-2015 Sadayuki Furuhashi
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ #ifndef MSGPACK_RUBY_PACKER_PACKER_EXT_REGISTRY_H__
19
+ #define MSGPACK_RUBY_PACKER_PACKER_EXT_REGISTRY_H__
20
+
21
+ #include "compat.h"
22
+ #include "ruby.h"
23
+
24
+ struct msgpack_unpacker_ext_registry_t;
25
+ typedef struct msgpack_unpacker_ext_registry_t msgpack_unpacker_ext_registry_t;
26
+
27
+ struct msgpack_unpacker_ext_registry_t {
28
+ VALUE array[256];
29
+ //int bitmap;
30
+ };
31
+
32
+ void msgpack_unpacker_ext_registry_static_init();
33
+
34
+ void msgpack_unpacker_ext_registry_static_destroy();
35
+
36
+ void msgpack_unpacker_ext_registry_init(msgpack_unpacker_ext_registry_t* ukrg);
37
+
38
+ static inline void msgpack_unpacker_ext_registry_destroy(msgpack_unpacker_ext_registry_t* ukrg)
39
+ { }
40
+
41
+ void msgpack_unpacker_ext_registry_mark(msgpack_unpacker_ext_registry_t* ukrg);
42
+
43
+ void msgpack_unpacker_ext_registry_dup(msgpack_unpacker_ext_registry_t* src,
44
+ msgpack_unpacker_ext_registry_t* dst);
45
+
46
+ VALUE msgpack_unpacker_ext_registry_put(msgpack_unpacker_ext_registry_t* ukrg,
47
+ VALUE ext_class, int ext_type, VALUE proc, VALUE arg);
48
+
49
+ static inline VALUE msgpack_unpacker_ext_registry_lookup(msgpack_unpacker_ext_registry_t* ukrg,
50
+ int ext_type)
51
+ {
52
+ VALUE e = ukrg->array[ext_type + 128];
53
+ if(e == Qnil) {
54
+ return Qnil;
55
+ }
56
+ return rb_ary_entry(e, 1);
57
+ }
58
+
59
+ VALUE msgpack_unpacker_ext_registry_call(msgpack_unpacker_ext_registry_t* ukrg,
60
+ VALUE proc, VALUE ext_data);
61
+
62
+ #endif