Permalink
Browse files

updates rdoc

  • Loading branch information...
1 parent afbef61 commit 26aa0a0426306126dd4b4dcb2ffe760f24a072fe @frsyuki frsyuki committed Nov 28, 2010
View
@@ -177,7 +177,8 @@ <h3 class="section-header">Public Instance Methods</h3>
static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
- msgpack_pack_array(out, RARRAY_LEN(self));
+ // FIXME check sizeof(long) &gt; sizeof(unsigned int) &amp;&amp; RARRAY_LEN(self) &gt; UINT_MAX
+ msgpack_pack_array(out, (unsigned int)RARRAY_LEN(self));
VALUE* p = RARRAY_PTR(self);
VALUE* const pend = p + RARRAY_LEN(self);
for(;p != pend; ++p) {
@@ -175,10 +175,9 @@ <h3 class="section-header">Public Instance Methods</h3>
static VALUE MessagePack_Bignum_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
- // FIXME bignum
- if(RBIGNUM_SIGN(self)) { // positive
+ if(RBIGNUM_POSITIVE_P(self)) {
msgpack_pack_uint64(out, rb_big2ull(self));
- } else { // negative
+ } else {
msgpack_pack_int64(out, rb_big2ll(self));
}
return out;
View
@@ -177,7 +177,8 @@ <h3 class="section-header">Public Instance Methods</h3>
static VALUE MessagePack_Hash_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
- msgpack_pack_map(out, RHASH_SIZE(self));
+ // FIXME check sizeof(st_index_t) &gt; sizeof(unsigned int) &amp;&amp; RARRAY_LEN(self) &gt; UINT_MAX
+ msgpack_pack_map(out, (unsigned int)RHASH_SIZE(self));
rb_hash_foreach(self, MessagePack_Hash_to_msgpack_foreach, out);
return out;
}</pre>
@@ -81,6 +81,8 @@ <h3 class="section-header">Methods</h3>
<li><a href="#method-i-feed">#feed</a></li>
+ <li><a href="#method-i-feed_each">#feed_each</a></li>
+
<li><a href="#method-i-fill">#fill</a></li>
<li><a href="#method-i-finished%3F">#finished?</a></li>
@@ -293,6 +295,7 @@ <h3 class="section-header">Public Class Methods</h3>
mp-&gt;user.stream = stream;
mp-&gt;user.streambuf = rb_str_buf_new(MSGPACK_UNPACKER_BUFFER_RESERVE_SIZE);
mp-&gt;user.stream_append_method = append_method_of(stream);
+ mp-&gt;user.buffer_free_size = MSGPACK_BUFFER_FREE_SIZE;
return self;
}</pre>
@@ -387,7 +390,7 @@ <h3 class="section-header">Public Instance Methods</h3>
#endif
while(1) {
- if(mp-&gt;user.buffer.size &lt;= mp-&gt;user.offset) {
+ if(mp-&gt;user.buffer.used &lt;= mp-&gt;user.offset) {
do_fill:
{
VALUE len = MessagePack_Unpacker_fill(self);
@@ -398,7 +401,7 @@ <h3 class="section-header">Public Instance Methods</h3>
}
ret = template_execute_wrap_each(mp,
- mp-&gt;user.buffer.ptr, mp-&gt;user.buffer.size,
+ mp-&gt;user.buffer.ptr, mp-&gt;user.buffer.used,
&amp;mp-&gt;user.offset);
if(ret &lt; 0) {
@@ -414,6 +417,8 @@ <h3 class="section-header">Public Instance Methods</h3>
}
}
+ try_free_buffer(mp, 0);
+
return Qnil;
}</pre>
</div>
@@ -446,7 +451,7 @@ <h3 class="section-header">Public Instance Methods</h3>
This method doesn&#8217;t use the internal buffer.
</p>
<p>
-Call *reset()* method before calling this method again.
+Call <b>reset</b> method before calling this method again.
</p>
<p>
This returns offset that was parsed to. Use <b>finished?</b> method to
@@ -499,7 +504,7 @@ <h3 class="section-header">Public Instance Methods</h3>
This method doesn&#8217;t use the internal buffer.
</p>
<p>
-Call *reset()* method before calling this method again.
+Call <b>reset</b> method before calling this method again.
</p>
<p>
<a href="UnpackError.html">UnpackError</a> is throw when parse error is
@@ -566,6 +571,51 @@ <h3 class="section-header">Public Instance Methods</h3>
</div>
+ <div id="feed-each-method" class="method-detail ">
+ <a name="method-i-feed_each"></a>
+
+ <div class="method-heading">
+
+ <span class="method-callseq">feed_each(data) {|object| }</span>
+ <span class="method-click-advice">click to toggle source</span>
+
+ </div>
+
+ <div class="method-description">
+
+ <p>
+Same as feed(data) + each {|object| }, but tries to avoid copying of the
+buffer.
+</p>
+
+
+
+ <div class="method-source-code"
+ id="feed-each-source">
+<pre>
+static VALUE MessagePack_Unpacker_feed_each(VALUE self, VALUE data)
+{
+ size_t consumed = 0;
+ StringValue(data);
+
+ VALUE args[3];
+ args[0] = self;
+ args[1] = data;
+ args[2] = (VALUE)&amp;consumed;
+
+ return rb_ensure(feed_each_impl, (VALUE)args,
+ feed_each_ensure, (VALUE)args);
+}</pre>
+ </div>
+
+ </div>
+
+
+
+
+ </div>
+
+
<div id="fill-method" class="method-detail ">
<a name="method-i-fill"></a>
@@ -690,6 +740,7 @@ <h3 class="section-header">Public Instance Methods</h3>
UNPACKER(self, mp);
template_init(mp);
mp-&gt;user.finished = 0;
+ try_free_buffer(mp, 0);
return self;
}</pre>
</div>
@@ -175,6 +175,14 @@ <h3 class="section-header">Public Instance Methods</h3>
static VALUE MessagePack_String_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
+#ifdef COMPAT_HAVE_ENCODING
+ int enc = ENCODING_GET(self);
+ if(enc != s_enc_utf8 &amp;&amp; enc != s_enc_ascii8bit &amp;&amp; enc != s_enc_usascii) {
+ if(!ENC_CODERANGE_ASCIIONLY(self)) {
+ self = rb_str_encode(self, s_enc_utf8_value, 0, Qnil);
+ }
+ }
+#endif
msgpack_pack_raw(out, RSTRING_LEN(self));
msgpack_pack_raw_body(out, RSTRING_PTR(self), RSTRING_LEN(self));
return out;
@@ -174,12 +174,16 @@ <h3 class="section-header">Public Instance Methods</h3>
<pre>
static VALUE MessagePack_Symbol_to_msgpack(int argc, VALUE *argv, VALUE self)
{
+#ifdef COMPAT_HAVE_ENCODING
+ return MessagePack_String_to_msgpack(argc, argv, rb_id2str(SYM2ID(self)));
+#else
ARG_BUFFER(out, argc, argv);
const char* name = rb_id2name(SYM2ID(self));
size_t len = strlen(name);
msgpack_pack_raw(out, len);
msgpack_pack_raw_body(out, name, len);
return out;
+#endif
}</pre>
</div>
@@ -1,4 +1,4 @@
-Tue, 29 Jun 2010 15:20:36 +0900
-pack.c Sun, 23 May 2010 21:59:50 +0900
-unpack.c Tue, 29 Jun 2010 14:54:39 +0900
-rbinit.c Tue, 29 Jun 2010 15:09:58 +0900
+Sun, 28 Nov 2010 23:09:47 +0900
+pack.c Tue, 31 Aug 2010 08:07:21 +0900
+unpack.c Sun, 28 Nov 2010 23:09:40 +0900
+rbinit.c Tue, 31 Aug 2010 06:55:44 +0900
View
@@ -80,6 +80,8 @@ <h2 id="methods">Methods</h2>
<li><a href="MessagePack/Unpacker.html#method-i-feed">#feed &mdash; MessagePack::Unpacker</a></li>
+ <li><a href="MessagePack/Unpacker.html#method-i-feed_each">#feed_each &mdash; MessagePack::Unpacker</a></li>
+
<li><a href="MessagePack/Unpacker.html#method-i-fill">#fill &mdash; MessagePack::Unpacker</a></li>
<li><a href="MessagePack/Unpacker.html#method-i-finished%3F">#finished? &mdash; MessagePack::Unpacker</a></li>
@@ -90,23 +92,23 @@ <h2 id="methods">Methods</h2>
<li><a href="MessagePack/Unpacker.html#method-i-stream%3D">#stream= &mdash; MessagePack::Unpacker</a></li>
- <li><a href="Array.html#method-i-to_msgpack">#to_msgpack &mdash; Array</a></li>
+ <li><a href="String.html#method-i-to_msgpack">#to_msgpack &mdash; String</a></li>
<li><a href="Hash.html#method-i-to_msgpack">#to_msgpack &mdash; Hash</a></li>
<li><a href="Float.html#method-i-to_msgpack">#to_msgpack &mdash; Float</a></li>
<li><a href="NilClass.html#method-i-to_msgpack">#to_msgpack &mdash; NilClass</a></li>
- <li><a href="String.html#method-i-to_msgpack">#to_msgpack &mdash; String</a></li>
+ <li><a href="Symbol.html#method-i-to_msgpack">#to_msgpack &mdash; Symbol</a></li>
<li><a href="Fixnum.html#method-i-to_msgpack">#to_msgpack &mdash; Fixnum</a></li>
<li><a href="TrueClass.html#method-i-to_msgpack">#to_msgpack &mdash; TrueClass</a></li>
- <li><a href="FalseClass.html#method-i-to_msgpack">#to_msgpack &mdash; FalseClass</a></li>
+ <li><a href="Array.html#method-i-to_msgpack">#to_msgpack &mdash; Array</a></li>
- <li><a href="Symbol.html#method-i-to_msgpack">#to_msgpack &mdash; Symbol</a></li>
+ <li><a href="FalseClass.html#method-i-to_msgpack">#to_msgpack &mdash; FalseClass</a></li>
<li><a href="Bignum.html#method-i-to_msgpack">#to_msgpack &mdash; Bignum</a></li>
@@ -24,7 +24,7 @@
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
- <dd class="modified-date">Sun May 23 21:59:50 +0900 2010</dd>
+ <dd class="modified-date">Tue Aug 31 08:07:21 +0900 2010</dd>
<dt class="requires">Requires</dt>
@@ -24,7 +24,7 @@
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
- <dd class="modified-date">Tue Jun 29 15:09:58 +0900 2010</dd>
+ <dd class="modified-date">Tue Aug 31 06:55:44 +0900 2010</dd>
<dt class="requires">Requires</dt>
@@ -24,7 +24,7 @@
<div id="metadata">
<dl>
<dt class="modified-date">Last Modified</dt>
- <dd class="modified-date">Tue Jun 29 14:54:39 +0900 2010</dd>
+ <dd class="modified-date">Sun Nov 28 23:09:40 +0900 2010</dd>
<dt class="requires">Requires</dt>

0 comments on commit 26aa0a0

Please sign in to comment.