msgpack 0.3.9-mswin32 → 0.4.0-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/ext/pack.c CHANGED
@@ -51,6 +51,15 @@ static ID s_append;
51
51
  rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc); \
52
52
  }
53
53
 
54
+
55
+ /*
56
+ * Document-method: NilClass#to_msgpack
57
+ *
58
+ * call-seq:
59
+ * nil.to_msgpack(out = '') -> String
60
+ *
61
+ * Serializes the nil into raw bytes.
62
+ */
54
63
  static VALUE MessagePack_NilClass_to_msgpack(int argc, VALUE *argv, VALUE self)
55
64
  {
56
65
  ARG_BUFFER(out, argc, argv);
@@ -58,6 +67,15 @@ static VALUE MessagePack_NilClass_to_msgpack(int argc, VALUE *argv, VALUE self)
58
67
  return out;
59
68
  }
60
69
 
70
+
71
+ /*
72
+ * Document-method: TrueClass#to_msgpack
73
+ *
74
+ * call-seq:
75
+ * true.to_msgpack(out = '') -> String
76
+ *
77
+ * Serializes the true into raw bytes.
78
+ */
61
79
  static VALUE MessagePack_TrueClass_to_msgpack(int argc, VALUE *argv, VALUE self)
62
80
  {
63
81
  ARG_BUFFER(out, argc, argv);
@@ -65,6 +83,15 @@ static VALUE MessagePack_TrueClass_to_msgpack(int argc, VALUE *argv, VALUE self)
65
83
  return out;
66
84
  }
67
85
 
86
+
87
+ /*
88
+ * Document-method: FalseClass#to_msgpack
89
+ *
90
+ * call-seq:
91
+ * false.to_msgpack(out = '') -> String
92
+ *
93
+ * Serializes false into raw bytes.
94
+ */
68
95
  static VALUE MessagePack_FalseClass_to_msgpack(int argc, VALUE *argv, VALUE self)
69
96
  {
70
97
  ARG_BUFFER(out, argc, argv);
@@ -73,6 +100,14 @@ static VALUE MessagePack_FalseClass_to_msgpack(int argc, VALUE *argv, VALUE self
73
100
  }
74
101
 
75
102
 
103
+ /*
104
+ * Document-method: Fixnum#to_msgpack
105
+ *
106
+ * call-seq:
107
+ * fixnum.to_msgpack(out = '') -> String
108
+ *
109
+ * Serializes the Fixnum into raw bytes.
110
+ */
76
111
  static VALUE MessagePack_Fixnum_to_msgpack(int argc, VALUE *argv, VALUE self)
77
112
  {
78
113
  ARG_BUFFER(out, argc, argv);
@@ -85,6 +120,14 @@ static VALUE MessagePack_Fixnum_to_msgpack(int argc, VALUE *argv, VALUE self)
85
120
  #define RBIGNUM_SIGN(b) (RBIGNUM(b)->sign)
86
121
  #endif
87
122
 
123
+ /*
124
+ * Document-method: Bignum#to_msgpack
125
+ *
126
+ * call-seq:
127
+ * bignum.to_msgpack(out = '') -> String
128
+ *
129
+ * Serializes the Bignum into raw bytes.
130
+ */
88
131
  static VALUE MessagePack_Bignum_to_msgpack(int argc, VALUE *argv, VALUE self)
89
132
  {
90
133
  ARG_BUFFER(out, argc, argv);
@@ -97,6 +140,15 @@ static VALUE MessagePack_Bignum_to_msgpack(int argc, VALUE *argv, VALUE self)
97
140
  return out;
98
141
  }
99
142
 
143
+
144
+ /*
145
+ * Document-method: Float#to_msgpack
146
+ *
147
+ * call-seq:
148
+ * float.to_msgpack(out = '') -> String
149
+ *
150
+ * Serializes the Float into raw bytes.
151
+ */
100
152
  static VALUE MessagePack_Float_to_msgpack(int argc, VALUE *argv, VALUE self)
101
153
  {
102
154
  ARG_BUFFER(out, argc, argv);
@@ -104,6 +156,15 @@ static VALUE MessagePack_Float_to_msgpack(int argc, VALUE *argv, VALUE self)
104
156
  return out;
105
157
  }
106
158
 
159
+
160
+ /*
161
+ * Document-method: String#to_msgpack
162
+ *
163
+ * call-seq:
164
+ * string.to_msgpack(out = '') -> String
165
+ *
166
+ * Serializes the String into raw bytes.
167
+ */
107
168
  static VALUE MessagePack_String_to_msgpack(int argc, VALUE *argv, VALUE self)
108
169
  {
109
170
  ARG_BUFFER(out, argc, argv);
@@ -112,6 +173,15 @@ static VALUE MessagePack_String_to_msgpack(int argc, VALUE *argv, VALUE self)
112
173
  return out;
113
174
  }
114
175
 
176
+
177
+ /*
178
+ * Document-method: Symbol#to_msgpack
179
+ *
180
+ * call-seq:
181
+ * symbol.to_msgpack(out = '') -> String
182
+ *
183
+ * Serializes the Symbol into raw bytes.
184
+ */
115
185
  static VALUE MessagePack_Symbol_to_msgpack(int argc, VALUE *argv, VALUE self)
116
186
  {
117
187
  ARG_BUFFER(out, argc, argv);
@@ -122,6 +192,16 @@ static VALUE MessagePack_Symbol_to_msgpack(int argc, VALUE *argv, VALUE self)
122
192
  return out;
123
193
  }
124
194
 
195
+
196
+ /*
197
+ * Document-method: Array#to_msgpack
198
+ *
199
+ * call-seq:
200
+ * array.to_msgpack(out = '') -> String
201
+ *
202
+ * Serializes the Array into raw bytes.
203
+ * This calls to_msgpack method reflectively for internal elements.
204
+ */
125
205
  static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self)
126
206
  {
127
207
  ARG_BUFFER(out, argc, argv);
@@ -134,6 +214,7 @@ static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self)
134
214
  return out;
135
215
  }
136
216
 
217
+
137
218
  #ifndef RHASH_SIZE // Ruby 1.8
138
219
  #define RHASH_SIZE(h) (RHASH(h)->tbl ? RHASH(h)->tbl->num_entries : 0)
139
220
  #endif
@@ -146,6 +227,15 @@ static int MessagePack_Hash_to_msgpack_foreach(VALUE key, VALUE value, VALUE out
146
227
  return ST_CONTINUE;
147
228
  }
148
229
 
230
+ /*
231
+ * Document-method: Hash#to_msgpack
232
+ *
233
+ * call-seq:
234
+ * hash.to_msgpack(out = '') -> String
235
+ *
236
+ * Serializes the Hash into raw bytes.
237
+ * This calls to_msgpack method reflectively for internal keys and values.
238
+ */
149
239
  static VALUE MessagePack_Hash_to_msgpack(int argc, VALUE *argv, VALUE self)
150
240
  {
151
241
  ARG_BUFFER(out, argc, argv);
@@ -155,6 +245,17 @@ static VALUE MessagePack_Hash_to_msgpack(int argc, VALUE *argv, VALUE self)
155
245
  }
156
246
 
157
247
 
248
+ /**
249
+ * Document-method: MessagePack.pack
250
+ *
251
+ * call-seq:
252
+ * MessagePack.pack(object, out = '') -> String
253
+ *
254
+ * Serializes the object into raw bytes. The encoding of the string is ASCII-8BIT on Ruby 1.9.
255
+ * This method is same as object.to_msgpack(out = '').
256
+ *
257
+ * _out_ is an object that implements *<<* method like String or IO.
258
+ */
158
259
  static VALUE MessagePack_pack(int argc, VALUE* argv, VALUE self)
159
260
  {
160
261
  VALUE out;
@@ -173,16 +274,22 @@ void Init_msgpack_pack(VALUE mMessagePack)
173
274
  {
174
275
  s_to_msgpack = rb_intern("to_msgpack");
175
276
  s_append = rb_intern("<<");
176
- rb_define_method_id(rb_cNilClass, s_to_msgpack, MessagePack_NilClass_to_msgpack, -1);
177
- rb_define_method_id(rb_cTrueClass, s_to_msgpack, MessagePack_TrueClass_to_msgpack, -1);
178
- rb_define_method_id(rb_cFalseClass, s_to_msgpack, MessagePack_FalseClass_to_msgpack, -1);
179
- rb_define_method_id(rb_cFixnum, s_to_msgpack, MessagePack_Fixnum_to_msgpack, -1);
180
- rb_define_method_id(rb_cBignum, s_to_msgpack, MessagePack_Bignum_to_msgpack, -1);
181
- rb_define_method_id(rb_cFloat, s_to_msgpack, MessagePack_Float_to_msgpack, -1);
182
- rb_define_method_id(rb_cString, s_to_msgpack, MessagePack_String_to_msgpack, -1);
183
- rb_define_method_id(rb_cArray, s_to_msgpack, MessagePack_Array_to_msgpack, -1);
184
- rb_define_method_id(rb_cHash, s_to_msgpack, MessagePack_Hash_to_msgpack, -1);
185
- rb_define_method_id(rb_cSymbol, s_to_msgpack, MessagePack_Symbol_to_msgpack, -1);
277
+
278
+ rb_define_method(rb_cNilClass, "to_msgpack", MessagePack_NilClass_to_msgpack, -1);
279
+ rb_define_method(rb_cTrueClass, "to_msgpack", MessagePack_TrueClass_to_msgpack, -1);
280
+ rb_define_method(rb_cFalseClass, "to_msgpack", MessagePack_FalseClass_to_msgpack, -1);
281
+ rb_define_method(rb_cFixnum, "to_msgpack", MessagePack_Fixnum_to_msgpack, -1);
282
+ rb_define_method(rb_cBignum, "to_msgpack", MessagePack_Bignum_to_msgpack, -1);
283
+ rb_define_method(rb_cFloat, "to_msgpack", MessagePack_Float_to_msgpack, -1);
284
+ rb_define_method(rb_cString, "to_msgpack", MessagePack_String_to_msgpack, -1);
285
+ rb_define_method(rb_cArray, "to_msgpack", MessagePack_Array_to_msgpack, -1);
286
+ rb_define_method(rb_cHash, "to_msgpack", MessagePack_Hash_to_msgpack, -1);
287
+ rb_define_method(rb_cSymbol, "to_msgpack", MessagePack_Symbol_to_msgpack, -1);
288
+
289
+ /**
290
+ * MessagePack module is defined in rbinit.c file.
291
+ * mMessagePack = rb_define_module("MessagePack");
292
+ */
186
293
  rb_define_module_function(mMessagePack, "pack", MessagePack_pack, -1);
187
294
  }
188
295
 
data/ext/pack.h CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby packing routine
3
3
  *
4
- * Copyright (C) 2008-2009 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2010 FURUHASHI Sadayuki
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby
3
3
  *
4
- * Copyright (C) 2008-2009 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2010 FURUHASHI Sadayuki
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,26 @@
20
20
 
21
21
  static VALUE mMessagePack;
22
22
 
23
+ /**
24
+ * Document-module: MessagePack
25
+ *
26
+ * MessagePack is a binary-based efficient object serialization library.
27
+ * It enables to exchange structured objects between many languages like JSON.
28
+ * But unlike JSON, it is very fast and small.
29
+ *
30
+ * You can install MessagePack with rubygems.
31
+ *
32
+ * gem install msgpack
33
+ *
34
+ * Simple usage is as follows:
35
+ *
36
+ * require 'msgpack'
37
+ * msg = [1,2,3].to_msgpack #=> "\x93\x01\x02\x03"
38
+ * MessagePack.unpack(msg) #=> [1,2,3]
39
+ *
40
+ * Use Unpacker class for streaming deserialization.
41
+ *
42
+ */
23
43
  void Init_msgpack(void)
24
44
  {
25
45
  mMessagePack = rb_define_module("MessagePack");
@@ -27,11 +27,17 @@ static ID s_readpartial;
27
27
  int s_ascii_8bit;
28
28
  #endif
29
29
 
30
+ struct unpack_buffer {
31
+ size_t size;
32
+ size_t free;
33
+ char* ptr;
34
+ };
35
+
30
36
  typedef struct {
31
37
  int finished;
32
38
  VALUE source;
33
39
  size_t offset;
34
- VALUE buffer;
40
+ struct unpack_buffer buffer;
35
41
  VALUE stream;
36
42
  VALUE streambuf;
37
43
  ID stream_append_method;
@@ -124,7 +130,14 @@ static inline int template_callback_map_item(unpack_user* u, VALUE* c, VALUE k,
124
130
  #endif
125
131
 
126
132
  static inline int template_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l, VALUE* o)
127
- { *o = (l <= COW_MIN_SIZE) ? rb_str_new(p, l) : rb_str_substr(u->source, p - b, l); return 0; }
133
+ {
134
+ if(u->source == Qnil || l <= COW_MIN_SIZE) {
135
+ *o = rb_str_new(p, l);
136
+ } else {
137
+ *o = rb_str_substr(u->source, p - b, l);
138
+ }
139
+ return 0;
140
+ }
128
141
 
129
142
 
130
143
  #include "msgpack/unpack_template.h"
@@ -203,20 +216,58 @@ static int template_execute_wrap(msgpack_unpack_t* mp,
203
216
  return ret;
204
217
  }
205
218
 
219
+ static int template_execute_wrap_each(msgpack_unpack_t* mp,
220
+ const char* ptr, size_t dlen, size_t* from)
221
+ {
222
+ VALUE args[4] = {
223
+ (VALUE)mp,
224
+ (VALUE)ptr,
225
+ (VALUE)dlen,
226
+ (VALUE)from,
227
+ };
228
+
229
+ // FIXME execute実行中はmp->topが更新されないのでGC markが機能しない
230
+ rb_gc_disable();
231
+
232
+ int ret = (int)rb_rescue(template_execute_do, (VALUE)args,
233
+ template_execute_rescue, Qnil);
234
+
235
+ rb_gc_enable();
236
+
237
+ return ret;
238
+ }
239
+
206
240
 
207
241
  static VALUE cUnpacker;
242
+
243
+
244
+ /**
245
+ * Document-module: MessagePack::UnpackerError
246
+ *
247
+ */
208
248
  static VALUE eUnpackError;
209
249
 
210
250
 
251
+ #ifndef MSGPACK_UNPACKER_BUFFER_INIT_SIZE
252
+ #define MSGPACK_UNPACKER_BUFFER_INIT_SIZE (32*1024)
253
+ #endif
254
+
255
+ #ifndef MSGPACK_UNPACKER_BUFFER_RESERVE_SIZE
256
+ #define MSGPACK_UNPACKER_BUFFER_RESERVE_SIZE (8*1024)
257
+ #endif
258
+
211
259
  static void MessagePack_Unpacker_free(void* data)
212
260
  {
213
- if(data) { free(data); }
261
+ if(data) {
262
+ msgpack_unpack_t* mp = (msgpack_unpack_t*)data;
263
+ free(mp->user.buffer.ptr);
264
+ free(mp);
265
+ }
214
266
  }
215
267
 
216
268
  static void MessagePack_Unpacker_mark(msgpack_unpack_t *mp)
217
269
  {
218
270
  unsigned int i;
219
- rb_gc_mark(mp->user.buffer);
220
271
  rb_gc_mark(mp->user.stream);
221
272
  rb_gc_mark(mp->user.streambuf);
222
273
  for(i=0; i < mp->top; ++i) {
@@ -243,6 +294,22 @@ static ID append_method_of(VALUE stream)
243
294
  }
244
295
  }
245
296
 
297
+ /**
298
+ * Document-method: MessagePack::Unpacker#initialize
299
+ *
300
+ * call-seq:
301
+ * MessagePack::Unpacker.new(stream = nil)
302
+ *
303
+ * Creates instance of MessagePack::Unpacker.
304
+ *
305
+ * You can specify a _stream_ for input stream.
306
+ * It is required to implement *sysread* or *readpartial* method.
307
+ *
308
+ * With the input stream, buffers will be feeded into the deserializer automatically.
309
+ *
310
+ * Without the input stream, use *feed* method manually. Or you can manage the buffer manually
311
+ * with *execute*, *finished?*, *data* and *reset* methods.
312
+ */
246
313
  static VALUE MessagePack_Unpacker_initialize(int argc, VALUE *argv, VALUE self)
247
314
  {
248
315
  VALUE stream;
@@ -261,19 +328,38 @@ static VALUE MessagePack_Unpacker_initialize(int argc, VALUE *argv, VALUE self)
261
328
  template_init(mp);
262
329
  mp->user.finished = 0;
263
330
  mp->user.offset = 0;
264
- mp->user.buffer = rb_str_new("",0);
331
+ mp->user.buffer.size = 0;
332
+ mp->user.buffer.free = 0;
333
+ mp->user.buffer.ptr = NULL;
265
334
  mp->user.stream = stream;
266
- mp->user.streambuf = rb_str_new("",0);
335
+ mp->user.streambuf = rb_str_buf_new(MSGPACK_UNPACKER_BUFFER_RESERVE_SIZE);
267
336
  mp->user.stream_append_method = append_method_of(stream);
268
337
  return self;
269
338
  }
270
339
 
340
+
341
+ /**
342
+ * Document-method: MessagePack::Unpacker#stream
343
+ *
344
+ * call-seq:
345
+ * unpacker.stream
346
+ *
347
+ * Gets the input stream.
348
+ */
271
349
  static VALUE MessagePack_Unpacker_stream_get(VALUE self)
272
350
  {
273
351
  UNPACKER(self, mp);
274
352
  return mp->user.stream;
275
353
  }
276
354
 
355
+ /**
356
+ * Document-method: MessagePack::Unpacker#stream=
357
+ *
358
+ * call-seq:
359
+ * unpacker.stream = stream
360
+ *
361
+ * Resets the input stream. You can set nil not to use input stream.
362
+ */
277
363
  static VALUE MessagePack_Unpacker_stream_set(VALUE self, VALUE val)
278
364
  {
279
365
  UNPACKER(self, mp);
@@ -282,14 +368,126 @@ static VALUE MessagePack_Unpacker_stream_set(VALUE self, VALUE val)
282
368
  return val;
283
369
  }
284
370
 
371
+
372
+ #ifdef RUBY_VM
373
+ # ifndef STR_SHARED
374
+ # define STR_SHARED FL_USER2
375
+ # endif
376
+ # ifndef STR_NOEMBED
377
+ # define STR_NOEMBED FL_USER1
378
+ # endif
379
+ # ifndef STR_ASSOC
380
+ # define STR_ASSOC FL_USER3
381
+ # endif
382
+ # ifndef STR_NOCAPA_P
383
+ # define STR_NOCAPA_P(s) (FL_TEST(s,STR_NOEMBED) && FL_ANY(s,STR_SHARED|STR_ASSOC))
384
+ # endif
385
+ # define NEED_MORE_CAPA(s,size) (!STR_NOCAPA_P(s) && RSTRING(s)->as.heap.aux.capa < size)
386
+ #else
387
+ # ifndef STR_NOCAPA
388
+ # ifndef STR_ASSOC
389
+ # define STR_ASSOC FL_USER3
390
+ # endif
391
+ # ifndef ELTS_SHARED
392
+ # define ELTS_SHARED FL_USER2
393
+ # endif
394
+ # define STR_NOCAPA (ELTS_SHARED|STR_ASSOC)
395
+ # endif
396
+ # define NEED_MORE_CAPA(s,size) (!FL_TEST(s,STR_NOCAPA) && RSTRING(s)->aux.capa < size)
397
+ #endif
398
+
399
+ static void feed_buffer(msgpack_unpack_t* mp, const char* ptr, size_t len)
400
+ {
401
+ struct unpack_buffer* buffer = &mp->user.buffer;
402
+
403
+ if(buffer->size == 0) {
404
+ char* tmp = (char*)malloc(MSGPACK_UNPACKER_BUFFER_INIT_SIZE);
405
+ // FIXME check tmp == NULL
406
+ buffer->ptr = tmp;
407
+ buffer->free = MSGPACK_UNPACKER_BUFFER_INIT_SIZE;
408
+ buffer->size = 0;
409
+
410
+ } else if(buffer->size <= mp->user.offset) {
411
+ /* clear buffer and rewind offset */
412
+ buffer->free += buffer->size;
413
+ buffer->size = 0;
414
+ mp->user.offset = 0;
415
+ }
416
+
417
+ if(len <= buffer->free) {
418
+ /* enough free space: just copy */
419
+ memcpy(buffer->ptr+buffer->size, ptr, len);
420
+ buffer->size += len;
421
+ buffer->free -= len;
422
+ return;
423
+ }
424
+
425
+ size_t csize = buffer->size + buffer->free;
426
+
427
+ if(mp->user.offset <= buffer->size / 2) {
428
+ /* parsed less than half: realloc and copy */
429
+ csize *= 2;
430
+ while(csize < buffer->size + len) {
431
+ csize *= 2;
432
+ }
433
+ char* tmp = (char*)realloc(buffer->ptr, csize);
434
+ // FIXME check tmp == NULL
435
+ memcpy(tmp + buffer->size, ptr, len);
436
+ buffer->ptr = tmp;
437
+ buffer->free = csize - buffer->size;
438
+ return;
439
+ }
440
+
441
+ size_t not_parsed = buffer->size - mp->user.offset;
442
+
443
+ if(csize < not_parsed + len) {
444
+ /* more buffer size */
445
+ csize *= 2;
446
+ while(csize < not_parsed + len) {
447
+ csize *= 2;
448
+ }
449
+ char* tmp = (char*)realloc(buffer->ptr, csize);
450
+ // FIXME check tmp == NULL
451
+ buffer->ptr = tmp;
452
+ }
453
+
454
+ memcpy(buffer->ptr+not_parsed, ptr, not_parsed);
455
+ buffer->size = not_parsed;
456
+ buffer->free = csize - buffer->size;
457
+ buffer->ptr = buffer->ptr;
458
+ mp->user.offset = 0;
459
+ }
460
+
461
+ /**
462
+ * Document-method: MessagePack::Unpacker#feed
463
+ *
464
+ * call-seq:
465
+ * unpacker.feed(data)
466
+ *
467
+ * Fills the internal buffer with the specified buffer.
468
+ */
285
469
  static VALUE MessagePack_Unpacker_feed(VALUE self, VALUE data)
286
470
  {
287
471
  UNPACKER(self, mp);
288
472
  StringValue(data);
289
- rb_str_cat(mp->user.buffer, RSTRING_PTR(data), RSTRING_LEN(data));
473
+ feed_buffer(mp, RSTRING_PTR(data), RSTRING_LEN(data));
290
474
  return Qnil;
291
475
  }
292
476
 
477
+ /**
478
+ * Document-method: MessagePack::Unpacker#fill
479
+ *
480
+ * call-seq:
481
+ * unpacker.fill -> length of read data
482
+ *
483
+ * Fills the internal buffer using the input stream.
484
+ *
485
+ * If the input stream is not specified, it returns nil.
486
+ * You can set it on *initialize* or *stream=* methods.
487
+ *
488
+ * This methods raises exceptions that _stream.sysread_ or
489
+ * _stream.readpartial_ method raises.
490
+ */
293
491
  static VALUE MessagePack_Unpacker_fill(VALUE self)
294
492
  {
295
493
  UNPACKER(self, mp);
@@ -298,21 +496,28 @@ static VALUE MessagePack_Unpacker_fill(VALUE self)
298
496
  return Qnil;
299
497
  }
300
498
 
301
- long len;
302
- if(RSTRING_LEN(mp->user.buffer) == 0) {
303
- rb_funcall(mp->user.stream, mp->user.stream_append_method, 2,
304
- LONG2FIX(64*1024), mp->user.buffer);
305
- len = RSTRING_LEN(mp->user.buffer);
306
- } else {
307
- rb_funcall(mp->user.stream, mp->user.stream_append_method, 2,
308
- LONG2FIX(64*1024), mp->user.streambuf);
309
- len = RSTRING_LEN(mp->user.streambuf);
310
- rb_str_cat(mp->user.buffer, RSTRING_PTR(mp->user.streambuf), RSTRING_LEN(mp->user.streambuf));
311
- }
499
+ rb_funcall(mp->user.stream, mp->user.stream_append_method, 2,
500
+ LONG2FIX(MSGPACK_UNPACKER_BUFFER_RESERVE_SIZE),
501
+ mp->user.streambuf);
502
+
503
+ size_t len = RSTRING_LEN(mp->user.streambuf);
504
+ feed_buffer(mp, RSTRING_PTR(mp->user.streambuf), len);
312
505
 
313
506
  return LONG2FIX(len);
314
507
  }
315
508
 
509
+
510
+ /**
511
+ * Document-method: MessagePack::Unpacker#each
512
+ *
513
+ * call-seq:
514
+ * unpacker.each {|object| }
515
+ *
516
+ * Deserializes objects repeatedly. This calls *fill* method automatically.
517
+ *
518
+ * UnpackError is throw when parse error is occured.
519
+ * This method raises exceptions that *fill* method raises.
520
+ */
316
521
  static VALUE MessagePack_Unpacker_each(VALUE self)
317
522
  {
318
523
  UNPACKER(self, mp);
@@ -323,7 +528,7 @@ static VALUE MessagePack_Unpacker_each(VALUE self)
323
528
  #endif
324
529
 
325
530
  while(1) {
326
- if(RSTRING_LEN(mp->user.buffer) <= mp->user.offset) {
531
+ if(mp->user.buffer.size <= mp->user.offset) {
327
532
  do_fill:
328
533
  {
329
534
  VALUE len = MessagePack_Unpacker_fill(self);
@@ -333,8 +538,9 @@ static VALUE MessagePack_Unpacker_each(VALUE self)
333
538
  }
334
539
  }
335
540
 
336
- ret = template_execute_wrap(mp, mp->user.buffer,
337
- RSTRING_LEN(mp->user.buffer), &mp->user.offset);
541
+ ret = template_execute_wrap_each(mp,
542
+ mp->user.buffer.ptr, mp->user.buffer.size,
543
+ &mp->user.offset);
338
544
 
339
545
  if(ret < 0) {
340
546
  rb_raise(eUnpackError, "parse error.");
@@ -352,6 +558,7 @@ static VALUE MessagePack_Unpacker_each(VALUE self)
352
558
  return Qnil;
353
559
  }
354
560
 
561
+
355
562
  static inline VALUE MessagePack_unpack_impl(VALUE self, VALUE data, unsigned long dlen)
356
563
  {
357
564
  msgpack_unpack_t mp;
@@ -376,12 +583,34 @@ static inline VALUE MessagePack_unpack_impl(VALUE self, VALUE data, unsigned lon
376
583
  }
377
584
  }
378
585
 
586
+ /**
587
+ * Document-method: MessagePack::Unpacker.unpack_limit
588
+ *
589
+ * call-seq:
590
+ * MessagePack::Unpacker.unpack_limit(data, limit) -> object
591
+ *
592
+ * Deserializes one object over the specified buffer upto _limit_ bytes.
593
+ *
594
+ * UnpackError is throw when parse error is occured, the buffer is insufficient
595
+ * to deserialize one object or there are extra bytes.
596
+ */
379
597
  static VALUE MessagePack_unpack_limit(VALUE self, VALUE data, VALUE limit)
380
598
  {
381
599
  CHECK_STRING_TYPE(data);
382
600
  return MessagePack_unpack_impl(self, data, NUM2ULONG(limit));
383
601
  }
384
602
 
603
+ /**
604
+ * Document-method: MessagePack::Unpacker.unpack
605
+ *
606
+ * call-seq:
607
+ * MessagePack::Unpacker.unpack(data) -> object
608
+ *
609
+ * Deserializes one object over the specified buffer.
610
+ *
611
+ * UnpackError is throw when parse error is occured, the buffer is insufficient
612
+ * to deserialize one object or there are extra bytes.
613
+ */
385
614
  static VALUE MessagePack_unpack(VALUE self, VALUE data)
386
615
  {
387
616
  CHECK_STRING_TYPE(data);
@@ -411,7 +640,20 @@ static VALUE MessagePack_Unpacker_execute_impl(VALUE self, VALUE data,
411
640
  }
412
641
  }
413
642
 
414
- /* compat */
643
+ /**
644
+ * Document-method: MessagePack::Unpacker#execute_limit
645
+ *
646
+ * call-seq:
647
+ * unpacker.unpack_limit(data, offset, limit) -> next offset
648
+ *
649
+ * Deserializes one object over the specified buffer from _offset_ bytes upto _limit_ bytes.
650
+ *
651
+ * This method doesn't use the internal buffer.
652
+ *
653
+ * Call *reset()* method before calling this method again.
654
+ *
655
+ * UnpackError is throw when parse error is occured.
656
+ */
415
657
  static VALUE MessagePack_Unpacker_execute_limit(VALUE self, VALUE data,
416
658
  VALUE off, VALUE limit)
417
659
  {
@@ -420,7 +662,24 @@ static VALUE MessagePack_Unpacker_execute_limit(VALUE self, VALUE data,
420
662
  (size_t)NUM2ULONG(off), (size_t)NUM2ULONG(limit));
421
663
  }
422
664
 
423
- /* compat */
665
+ /**
666
+ * Document-method: MessagePack::Unpacker#execute
667
+ *
668
+ * call-seq:
669
+ * unpacker.unpack(data, offset) -> next offset
670
+ *
671
+ * Deserializes one object over the specified buffer from _offset_ bytes.
672
+ *
673
+ * This method doesn't use the internal buffer.
674
+ *
675
+ * Call *reset()* method before calling this method again.
676
+ *
677
+ * This returns offset that was parsed to.
678
+ * Use *finished?* method to check an object is deserialized and call *data*
679
+ * method if it returns true.
680
+ *
681
+ * UnpackError is throw when parse error is occured.
682
+ */
424
683
  static VALUE MessagePack_Unpacker_execute(VALUE self, VALUE data, VALUE off)
425
684
  {
426
685
  CHECK_STRING_TYPE(data);
@@ -428,7 +687,16 @@ static VALUE MessagePack_Unpacker_execute(VALUE self, VALUE data, VALUE off)
428
687
  (size_t)NUM2ULONG(off), (size_t)RSTRING_LEN(data));
429
688
  }
430
689
 
431
- /* compat */
690
+ /**
691
+ * Document-method: MessagePack::Unpacker#finished?
692
+ *
693
+ * call-seq:
694
+ * unpacker.finished?
695
+ *
696
+ * Returns true if an object is ready to get with data method.
697
+ *
698
+ * Use this method with execute method.
699
+ */
432
700
  static VALUE MessagePack_Unpacker_finished_p(VALUE self)
433
701
  {
434
702
  UNPACKER(self, mp);
@@ -438,14 +706,30 @@ static VALUE MessagePack_Unpacker_finished_p(VALUE self)
438
706
  return Qfalse;
439
707
  }
440
708
 
441
- /* compat */
709
+ /**
710
+ * Document-method: MessagePack::Unpacker#data
711
+ *
712
+ * call-seq:
713
+ * unpacker.data
714
+ *
715
+ * Gets the object deserialized by execute method.
716
+ *
717
+ * Use this method with execute method.
718
+ */
442
719
  static VALUE MessagePack_Unpacker_data(VALUE self)
443
720
  {
444
721
  UNPACKER(self, mp);
445
722
  return template_data(mp);
446
723
  }
447
724
 
448
- /* compat */
725
+ /**
726
+ * Document-method: MessagePack::Unpacker#reset
727
+ *
728
+ * call-seq:
729
+ * unpacker.reset
730
+ *
731
+ * Resets the internal state of the unpacker.
732
+ */
449
733
  static VALUE MessagePack_Unpacker_reset(VALUE self)
450
734
  {
451
735
  UNPACKER(self, mp);
@@ -467,20 +751,97 @@ void Init_msgpack_unpack(VALUE mMessagePack)
467
751
  eUnpackError = rb_define_class_under(mMessagePack, "UnpackError", rb_eStandardError);
468
752
  cUnpacker = rb_define_class_under(mMessagePack, "Unpacker", rb_cObject);
469
753
  rb_define_alloc_func(cUnpacker, MessagePack_Unpacker_alloc);
754
+
470
755
  rb_define_method(cUnpacker, "initialize", MessagePack_Unpacker_initialize, -1);
756
+
757
+ /* Buffered API */
471
758
  rb_define_method(cUnpacker, "feed", MessagePack_Unpacker_feed, 1);
472
759
  rb_define_method(cUnpacker, "fill", MessagePack_Unpacker_fill, 0);
473
760
  rb_define_method(cUnpacker, "each", MessagePack_Unpacker_each, 0);
474
761
  rb_define_method(cUnpacker, "stream", MessagePack_Unpacker_stream_get, 0);
475
762
  rb_define_method(cUnpacker, "stream=", MessagePack_Unpacker_stream_set, 1);
476
- rb_define_module_function(mMessagePack, "unpack", MessagePack_unpack, 1);
477
- rb_define_module_function(mMessagePack, "unpack_limit", MessagePack_unpack_limit, 2);
478
763
 
479
- /* backward compatibility */
764
+ /* Unbuffered API */
480
765
  rb_define_method(cUnpacker, "execute", MessagePack_Unpacker_execute, 2);
481
766
  rb_define_method(cUnpacker, "execute_limit", MessagePack_Unpacker_execute_limit, 3);
482
767
  rb_define_method(cUnpacker, "finished?", MessagePack_Unpacker_finished_p, 0);
483
768
  rb_define_method(cUnpacker, "data", MessagePack_Unpacker_data, 0);
484
769
  rb_define_method(cUnpacker, "reset", MessagePack_Unpacker_reset, 0);
770
+
771
+ /**
772
+ * MessagePack module is defined in rbinit.c file.
773
+ * mMessagePack = rb_define_module("MessagePack");
774
+ */
775
+ rb_define_module_function(mMessagePack, "unpack", MessagePack_unpack, 1);
776
+ rb_define_module_function(mMessagePack, "unpack_limit", MessagePack_unpack_limit, 2);
485
777
  }
486
778
 
779
+ /**
780
+ * Document-module: MessagePack::Unpacker
781
+ *
782
+ * Deserializer class that includes Buffered API and Unbuffered API.
783
+ *
784
+ *
785
+ * Buffered API uses the internal buffer of the Unpacker.
786
+ * Following code uses Buffered API with an input stream:
787
+ *
788
+ * # create an unpacker with input stream.
789
+ * pac = MessagePack::Unpacker.new(STDIN)
790
+ *
791
+ * # deserialize object one after another.
792
+ * pac.each {|obj|
793
+ * # ...
794
+ * }
795
+ *
796
+ *
797
+ * Following code doesn't use the input stream and feeds buffer
798
+ * manually. This is useful to use special stream or with
799
+ * event-driven I/O library.
800
+ *
801
+ * # create an unpacker without input stream.
802
+ * pac = MessagePack::Unpacker.new()
803
+ *
804
+ * # feed buffer to the internal buffer.
805
+ * pac.feed(input_bytes)
806
+ *
807
+ * # deserialize object one after another.
808
+ * pac.each {|obj|
809
+ * # ...
810
+ * }
811
+ *
812
+ *
813
+ * You can manage the buffer manually with the combination of
814
+ * *execute*, *finished?*, *data* and *reset* method.
815
+ *
816
+ * # create an unpacker.
817
+ * pac = MessagePack::Unpacker.new()
818
+ *
819
+ * # manage buffer and offset manually.
820
+ * offset = 0
821
+ * buffer = ''
822
+ *
823
+ * # read some data into the buffer.
824
+ * buffer << [1,2,3].to_msgpack
825
+ * buffer << [4,5,6].to_msgpack
826
+ *
827
+ * while true
828
+ * offset = pac.execute(buffer, offset)
829
+ *
830
+ * if pac.finished?
831
+ * obj = pac.data
832
+ *
833
+ * buffer.slice!(0, offset)
834
+ * offset = 0
835
+ * pac.reset
836
+ *
837
+ * # do something with the object
838
+ * # ...
839
+ *
840
+ * # repeat execution if there are more data.
841
+ * next unless buffer.empty?
842
+ * end
843
+ *
844
+ * break
845
+ * end
846
+ */
847
+
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * MessagePack for Ruby unpacking routine
3
3
  *
4
- * Copyright (C) 2008-2009 FURUHASHI Sadayuki
4
+ * Copyright (C) 2008-2010 FURUHASHI Sadayuki
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
Binary file
Binary file
@@ -16,12 +16,12 @@
16
16
  * limitations under the License.
17
17
  */
18
18
 
19
- #ifdef __LITTLE_ENDIAN__
19
+ #if defined(__LITTLE_ENDIAN__)
20
20
  #define TAKE8_8(d) ((uint8_t*)&d)[0]
21
21
  #define TAKE8_16(d) ((uint8_t*)&d)[0]
22
22
  #define TAKE8_32(d) ((uint8_t*)&d)[0]
23
23
  #define TAKE8_64(d) ((uint8_t*)&d)[0]
24
- #elif __BIG_ENDIAN__
24
+ #elif defined(__BIG_ENDIAN__)
25
25
  #define TAKE8_8(d) ((uint8_t*)&d)[0]
26
26
  #define TAKE8_16(d) ((uint8_t*)&d)[1]
27
27
  #define TAKE8_32(d) ((uint8_t*)&d)[3]
@@ -377,14 +377,24 @@ msgpack_pack_inline_func(_int64)(msgpack_pack_user x, int64_t d)
377
377
 
378
378
  msgpack_pack_inline_func_cint(_short)(msgpack_pack_user x, short d)
379
379
  {
380
- #if defined(SIZEOF_SHORT) || defined(SHRT_MAX)
381
- #if SIZEOF_SHORT == 2 || SHRT_MAX == 0x7fff
380
+ #if defined(SIZEOF_SHORT)
381
+ #if SIZEOF_SHORT == 2
382
382
  msgpack_pack_real_int16(x, d);
383
- #elif SIZEOF_SHORT == 4 || SHRT_MAX == 0x7fffffff
383
+ #elif SIZEOF_SHORT == 4
384
384
  msgpack_pack_real_int32(x, d);
385
385
  #else
386
386
  msgpack_pack_real_int64(x, d);
387
387
  #endif
388
+
389
+ #elif defined(SHRT_MAX)
390
+ #if SHRT_MAX == 0x7fff
391
+ msgpack_pack_real_int16(x, d);
392
+ #elif SHRT_MAX == 0x7fffffff
393
+ msgpack_pack_real_int32(x, d);
394
+ #else
395
+ msgpack_pack_real_int64(x, d);
396
+ #endif
397
+
388
398
  #else
389
399
  if(sizeof(short) == 2) {
390
400
  msgpack_pack_real_int16(x, d);
@@ -398,14 +408,24 @@ if(sizeof(short) == 2) {
398
408
 
399
409
  msgpack_pack_inline_func_cint(_int)(msgpack_pack_user x, int d)
400
410
  {
401
- #if defined(SIZEOF_INT) || defined(INT_MAX)
402
- #if SIZEOF_INT == 2 || INT_MAX == 0x7fff
411
+ #if defined(SIZEOF_INT)
412
+ #if SIZEOF_INT == 2
403
413
  msgpack_pack_real_int16(x, d);
404
- #elif SIZEOF_INT == 4 || INT_MAX == 0x7fffffff
414
+ #elif SIZEOF_INT == 4
405
415
  msgpack_pack_real_int32(x, d);
406
416
  #else
407
417
  msgpack_pack_real_int64(x, d);
408
418
  #endif
419
+
420
+ #elif defined(INT_MAX)
421
+ #if INT_MAX == 0x7fff
422
+ msgpack_pack_real_int16(x, d);
423
+ #elif INT_MAX == 0x7fffffff
424
+ msgpack_pack_real_int32(x, d);
425
+ #else
426
+ msgpack_pack_real_int64(x, d);
427
+ #endif
428
+
409
429
  #else
410
430
  if(sizeof(int) == 2) {
411
431
  msgpack_pack_real_int16(x, d);
@@ -419,14 +439,24 @@ if(sizeof(int) == 2) {
419
439
 
420
440
  msgpack_pack_inline_func_cint(_long)(msgpack_pack_user x, long d)
421
441
  {
422
- #if defined(SIZEOF_LONG) || defined(LONG_MAX)
423
- #if SIZEOF_LONG == 2 || LONG_MAX == 0x7fffL
442
+ #if defined(SIZEOF_LONG)
443
+ #if SIZEOF_LONG == 2
424
444
  msgpack_pack_real_int16(x, d);
425
- #elif SIZEOF_LONG == 4 || LONG_MAX == 0x7fffffffL
445
+ #elif SIZEOF_LONG == 4
426
446
  msgpack_pack_real_int32(x, d);
427
447
  #else
428
448
  msgpack_pack_real_int64(x, d);
429
449
  #endif
450
+
451
+ #elif defined(LONG_MAX)
452
+ #if LONG_MAX == 0x7fffL
453
+ msgpack_pack_real_int16(x, d);
454
+ #elif LONG_MAX == 0x7fffffffL
455
+ msgpack_pack_real_int32(x, d);
456
+ #else
457
+ msgpack_pack_real_int64(x, d);
458
+ #endif
459
+
430
460
  #else
431
461
  if(sizeof(long) == 2) {
432
462
  msgpack_pack_real_int16(x, d);
@@ -440,14 +470,24 @@ if(sizeof(long) == 2) {
440
470
 
441
471
  msgpack_pack_inline_func_cint(_long_long)(msgpack_pack_user x, long long d)
442
472
  {
443
- #if defined(SIZEOF_LONG_LONG) || defined(LLONG_MAX)
444
- #if SIZEOF_LONG_LONG == 2 || LLONG_MAX == 0x7fffL
473
+ #if defined(SIZEOF_LONG_LONG)
474
+ #if SIZEOF_LONG_LONG == 2
475
+ msgpack_pack_real_int16(x, d);
476
+ #elif SIZEOF_LONG_LONG == 4
477
+ msgpack_pack_real_int32(x, d);
478
+ #else
479
+ msgpack_pack_real_int64(x, d);
480
+ #endif
481
+
482
+ #elif defined(LLONG_MAX)
483
+ #if LLONG_MAX == 0x7fffL
445
484
  msgpack_pack_real_int16(x, d);
446
- #elif SIZEOF_LONG_LONG == 4 || LLONG_MAX == 0x7fffffffL
485
+ #elif LLONG_MAX == 0x7fffffffL
447
486
  msgpack_pack_real_int32(x, d);
448
487
  #else
449
488
  msgpack_pack_real_int64(x, d);
450
489
  #endif
490
+
451
491
  #else
452
492
  if(sizeof(long long) == 2) {
453
493
  msgpack_pack_real_int16(x, d);
@@ -461,14 +501,24 @@ if(sizeof(long long) == 2) {
461
501
 
462
502
  msgpack_pack_inline_func_cint(_unsigned_short)(msgpack_pack_user x, unsigned short d)
463
503
  {
464
- #if defined(SIZEOF_SHORT) || defined(USHRT_MAX)
465
- #if SIZEOF_SHORT == 2 || USHRT_MAX == 0xffffU
504
+ #if defined(SIZEOF_SHORT)
505
+ #if SIZEOF_SHORT == 2
506
+ msgpack_pack_real_uint16(x, d);
507
+ #elif SIZEOF_SHORT == 4
508
+ msgpack_pack_real_uint32(x, d);
509
+ #else
510
+ msgpack_pack_real_uint64(x, d);
511
+ #endif
512
+
513
+ #elif defined(USHRT_MAX)
514
+ #if USHRT_MAX == 0xffffU
466
515
  msgpack_pack_real_uint16(x, d);
467
- #elif SIZEOF_SHORT == 4 || USHRT_MAX == 0xffffffffU
516
+ #elif USHRT_MAX == 0xffffffffU
468
517
  msgpack_pack_real_uint32(x, d);
469
518
  #else
470
519
  msgpack_pack_real_uint64(x, d);
471
520
  #endif
521
+
472
522
  #else
473
523
  if(sizeof(unsigned short) == 2) {
474
524
  msgpack_pack_real_uint16(x, d);
@@ -482,14 +532,24 @@ if(sizeof(unsigned short) == 2) {
482
532
 
483
533
  msgpack_pack_inline_func_cint(_unsigned_int)(msgpack_pack_user x, unsigned int d)
484
534
  {
485
- #if defined(SIZEOF_INT) || defined(UINT_MAX)
486
- #if SIZEOF_INT == 2 || UINT_MAX == 0xffffU
535
+ #if defined(SIZEOF_INT)
536
+ #if SIZEOF_INT == 2
487
537
  msgpack_pack_real_uint16(x, d);
488
- #elif SIZEOF_INT == 4 || UINT_MAX == 0xffffffffU
538
+ #elif SIZEOF_INT == 4
489
539
  msgpack_pack_real_uint32(x, d);
490
540
  #else
491
541
  msgpack_pack_real_uint64(x, d);
492
542
  #endif
543
+
544
+ #elif defined(UINT_MAX)
545
+ #if UINT_MAX == 0xffffU
546
+ msgpack_pack_real_uint16(x, d);
547
+ #elif UINT_MAX == 0xffffffffU
548
+ msgpack_pack_real_uint32(x, d);
549
+ #else
550
+ msgpack_pack_real_uint64(x, d);
551
+ #endif
552
+
493
553
  #else
494
554
  if(sizeof(unsigned int) == 2) {
495
555
  msgpack_pack_real_uint16(x, d);
@@ -503,18 +563,28 @@ if(sizeof(unsigned int) == 2) {
503
563
 
504
564
  msgpack_pack_inline_func_cint(_unsigned_long)(msgpack_pack_user x, unsigned long d)
505
565
  {
506
- #if defined(SIZEOF_LONG) || defined(ULONG_MAX)
507
- #if SIZEOF_LONG == 2 || ULONG_MAX == 0xffffUL
566
+ #if defined(SIZEOF_LONG)
567
+ #if SIZEOF_LONG == 2
508
568
  msgpack_pack_real_uint16(x, d);
509
- #elif SIZEOF_LONG == 4 || ULONG_MAX == 0xffffffffUL
569
+ #elif SIZEOF_LONG == 4
510
570
  msgpack_pack_real_uint32(x, d);
511
571
  #else
512
572
  msgpack_pack_real_uint64(x, d);
513
573
  #endif
574
+
575
+ #elif defined(ULONG_MAX)
576
+ #if ULONG_MAX == 0xffffUL
577
+ msgpack_pack_real_uint16(x, d);
578
+ #elif ULONG_MAX == 0xffffffffUL
579
+ msgpack_pack_real_uint32(x, d);
514
580
  #else
515
- if(sizeof(unsigned int) == 2) {
581
+ msgpack_pack_real_uint64(x, d);
582
+ #endif
583
+
584
+ #else
585
+ if(sizeof(unsigned long) == 2) {
516
586
  msgpack_pack_real_uint16(x, d);
517
- } else if(sizeof(unsigned int) == 4) {
587
+ } else if(sizeof(unsigned long) == 4) {
518
588
  msgpack_pack_real_uint32(x, d);
519
589
  } else {
520
590
  msgpack_pack_real_uint64(x, d);
@@ -524,14 +594,24 @@ if(sizeof(unsigned int) == 2) {
524
594
 
525
595
  msgpack_pack_inline_func_cint(_unsigned_long_long)(msgpack_pack_user x, unsigned long long d)
526
596
  {
527
- #if defined(SIZEOF_LONG_LONG) || defined(ULLONG_MAX)
528
- #if SIZEOF_LONG_LONG == 2 || ULLONG_MAX == 0xffffUL
597
+ #if defined(SIZEOF_LONG_LONG)
598
+ #if SIZEOF_LONG_LONG == 2
529
599
  msgpack_pack_real_uint16(x, d);
530
- #elif SIZEOF_LONG_LONG == 4 || ULLONG_MAX == 0xffffffffUL
600
+ #elif SIZEOF_LONG_LONG == 4
531
601
  msgpack_pack_real_uint32(x, d);
532
602
  #else
533
603
  msgpack_pack_real_uint64(x, d);
534
604
  #endif
605
+
606
+ #elif defined(ULLONG_MAX)
607
+ #if ULLONG_MAX == 0xffffUL
608
+ msgpack_pack_real_uint16(x, d);
609
+ #elif ULLONG_MAX == 0xffffffffUL
610
+ msgpack_pack_real_uint32(x, d);
611
+ #else
612
+ msgpack_pack_real_uint64(x, d);
613
+ #endif
614
+
535
615
  #else
536
616
  if(sizeof(unsigned long long) == 2) {
537
617
  msgpack_pack_real_uint16(x, d);
metadata CHANGED
@@ -3,9 +3,9 @@ name: msgpack
3
3
  version: !ruby/object:Gem::Version
4
4
  segments:
5
5
  - 0
6
- - 3
7
- - 9
8
- version: 0.3.9
6
+ - 4
7
+ - 0
8
+ version: 0.4.0
9
9
  platform: mswin32
10
10
  authors:
11
11
  - FURUHASHI Sadayuki
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2010-04-23 00:00:00 +09:00
16
+ date: 2010-05-26 00:00:00 +09:00
17
17
  default_executable:
18
18
  dependencies: []
19
19
 
@@ -23,14 +23,9 @@ executables: []
23
23
 
24
24
  extensions: []
25
25
 
26
- extra_rdoc_files:
27
- - README
28
- - ChangeLog
29
- - AUTHORS
26
+ extra_rdoc_files: []
27
+
30
28
  files:
31
- - AUTHORS
32
- - ChangeLog
33
- - README
34
29
  - ext/extconf.rb
35
30
  - ext/pack.c
36
31
  - ext/pack.h
@@ -52,8 +47,8 @@ homepage: http://msgpack.sourceforge.net/
52
47
  licenses: []
53
48
 
54
49
  post_install_message:
55
- rdoc_options: []
56
-
50
+ rdoc_options:
51
+ - ext
57
52
  require_paths:
58
53
  - lib
59
54
  required_ruby_version: !ruby/object:Gem::Requirement
data/AUTHORS DELETED
@@ -1 +0,0 @@
1
- FURUHASHI Sadayuki <frsyuki _at_ users.sourceforge.jp>
data/ChangeLog DELETED
File without changes
data/README DELETED
@@ -1,29 +0,0 @@
1
-
2
- = MessagePack
3
-
4
-
5
- == Description
6
-
7
-
8
- == Installation
9
-
10
- === Archive Installation
11
-
12
- rake install
13
-
14
- === Gem Installation
15
-
16
- gem install msgpack
17
-
18
-
19
- == Features/Problems
20
-
21
-
22
- == Synopsis
23
-
24
-
25
- == Copyright
26
-
27
- Author:: frsyuki <frsyuki@users.sourceforge.jp>
28
- Copyright:: Copyright (c) 2008-2009 frsyuki
29
- License:: Apache License, Version 2.0