1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

update doc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-06-28 13:05:07 +00:00
parent d9d650ecfd
commit 82f7a98236

254
pack.c
View file

@ -305,7 +305,8 @@ static unsigned long utf8_to_uv(const char*,long*);
* elements to convert. If the count is an asterisk * elements to convert. If the count is an asterisk
* (``<code>*</code>''), all remaining array elements will be * (``<code>*</code>''), all remaining array elements will be
* converted. Any of the directives ``<code>sSiIlL</code>'' may be * converted. Any of the directives ``<code>sSiIlL</code>'' may be
* followed by an underscore (``<code>_</code>'') to use the underlying * followed by an underscore (``<code>_</code>'') or
* exclamation mark (``<code>!</code>'') to use the underlying
* platform's native size for the specified type; otherwise, they use a * platform's native size for the specified type; otherwise, they use a
* platform-independent size. Spaces are ignored in the template * platform-independent size. Spaces are ignored in the template
* string. See also <code>String#unpack</code>. * string. See also <code>String#unpack</code>.
@ -318,68 +319,68 @@ static unsigned long utf8_to_uv(const char*,long*);
* *
* Directives for +pack+. * Directives for +pack+.
* *
* Integer | Array | * Integer | Array |
* Directive | Element | Meaning * Directive | Element | Meaning
* ------------------------------------------------------------------------ * ---------------------------------------------------------------------------
* C | Integer | 8-bit unsigned integer (unsigned char) * C | Integer | 8-bit unsigned integer (unsigned char)
* S | Integer | 16-bit unsigned integer, native endian (uint16_t) * S | Integer | 16-bit unsigned integer, native endian (uint16_t)
* L | Integer | 32-bit unsigned integer, native endian (uint32_t) * L | Integer | 32-bit unsigned integer, native endian (uint32_t)
* Q | Integer | 64-bit unsigned integer, native endian (uint64_t) * Q | Integer | 64-bit unsigned integer, native endian (uint64_t)
* | | * | |
* c | Integer | 8-bit signed integer (char) * c | Integer | 8-bit signed integer (char)
* s | Integer | 16-bit signed integer, native endian (int16_t) * s | Integer | 16-bit signed integer, native endian (int16_t)
* l | Integer | 32-bit signed integer, native endian (int32_t) * l | Integer | 32-bit signed integer, native endian (int32_t)
* q | Integer | 64-bit signed integer, native endian (int64_t) * q | Integer | 64-bit signed integer, native endian (int64_t)
* | | * | |
* S_ | Integer | unsigned short, native endian * S_, S! | Integer | unsigned short, native endian
* I, I_ | Integer | unsigned int, native endian * I, I_, I! | Integer | unsigned int, native endian
* L_ | Integer | unsigned long, native endian * L_, L! | Integer | unsigned long, native endian
* | | * | |
* s_ | Integer | signed short, native endian * s_, s! | Integer | signed short, native endian
* i, i_ | Integer | signed int, native endian * i, i_, i! | Integer | signed int, native endian
* l_ | Integer | signed long, native endian * l_, l! | Integer | signed long, native endian
* | | * | |
* n | Integer | 16-bit unsigned integer, network (big-endian) byte order * n | Integer | 16-bit unsigned integer, network (big-endian) byte order
* N | Integer | 32-bit unsigned integer, network (big-endian) byte order * N | Integer | 32-bit unsigned integer, network (big-endian) byte order
* v | Integer | 16-bit unsigned integer, VAX (little-endian) byte order * v | Integer | 16-bit unsigned integer, VAX (little-endian) byte order
* V | Integer | 32-bit unsigned integer, VAX (little-endian) byte order * V | Integer | 32-bit unsigned integer, VAX (little-endian) byte order
* | | * | |
* U | Integer | UTF-8 character * U | Integer | UTF-8 character
* w | Integer | BER-compressed integer * w | Integer | BER-compressed integer
* *
* Float | | * Float | |
* Directive | | Meaning * Directive | | Meaning
* ------------------------------------------------------------------------ * ---------------------------------------------------------------------------
* D, d | Float | double-precision float, native format * D, d | Float | double-precision float, native format
* F, f | Float | single-precision float, native format * F, f | Float | single-precision float, native format
* E | Float | double-precision float, little-endian byte order * E | Float | double-precision float, little-endian byte order
* e | Float | single-precision float, little-endian byte order * e | Float | single-precision float, little-endian byte order
* G | Float | double-precision float, network (big-endian) byte order * G | Float | double-precision float, network (big-endian) byte order
* g | Float | single-precision float, network (big-endian) byte order * g | Float | single-precision float, network (big-endian) byte order
* *
* String | | * String | |
* Directive | | Meaning * Directive | | Meaning
* ------------------------------------------------------------------------ * ---------------------------------------------------------------------------
* A | String | arbitrary binary string (space padded, count is width) * A | String | arbitrary binary string (space padded, count is width)
* a | String | arbitrary binary string (null padded, count is width) * a | String | arbitrary binary string (null padded, count is width)
* Z | String | same as ``a'', except that null is added with * * Z | String | same as ``a'', except that null is added with *
* B | String | bit string (MSB first) * B | String | bit string (MSB first)
* b | String | bit string (LSB first) * b | String | bit string (LSB first)
* H | String | hex string (high nibble first) * H | String | hex string (high nibble first)
* h | String | hex string (low nibble first) * h | String | hex string (low nibble first)
* u | String | UU-encoded string * u | String | UU-encoded string
* M | String | quoted printable, MIME encoding (see RFC2045) * M | String | quoted printable, MIME encoding (see RFC2045)
* m | String | base64 encoded string (see RFC 2045, count is width) * m | String | base64 encoded string (see RFC 2045, count is width)
* | | (if count is 0, no line feed are added, see RFC 4648) * | | (if count is 0, no line feed are added, see RFC 4648)
* P | String | pointer to a structure (fixed-length string) * P | String | pointer to a structure (fixed-length string)
* p | String | pointer to a null-terminated string * p | String | pointer to a null-terminated string
* *
* Misc. | | * Misc. | |
* Directive | | Meaning * Directive | | Meaning
* ------------------------------------------------------------------------ * ---------------------------------------------------------------------------
* @ | --- | moves to absolute position * @ | --- | moves to absolute position
* X | --- | back up a byte * X | --- | back up a byte
* x | --- | null byte * x | --- | null byte
*/ */
static VALUE static VALUE
@ -1213,7 +1214,8 @@ infected_str_new(const char *ptr, long len, VALUE str)
* by a number, indicating the number of times to repeat with this * by a number, indicating the number of times to repeat with this
* directive. An asterisk (``<code>*</code>'') will use up all * directive. An asterisk (``<code>*</code>'') will use up all
* remaining elements. The directives <code>sSiIlL</code> may each be * remaining elements. The directives <code>sSiIlL</code> may each be
* followed by an underscore (``<code>_</code>'') to use the underlying * followed by an underscore (``<code>_</code>'') or
* exclamation mark (``<code>!</code>'') to use the underlying
* platform's native size for the specified type; otherwise, it uses a * platform's native size for the specified type; otherwise, it uses a
* platform-independent consistent size. Spaces are ignored in the * platform-independent consistent size. Spaces are ignored in the
* format string. See also <code>Array#pack</code>. * format string. See also <code>Array#pack</code>.
@ -1230,68 +1232,68 @@ infected_str_new(const char *ptr, long len, VALUE str)
* This table summarizes the various formats and the Ruby classes * This table summarizes the various formats and the Ruby classes
* returned by each. * returned by each.
* *
* Integer | | * Integer | |
* Directive | Returns | Meaning * Directive | Returns | Meaning
* -------------------------------------------------------------- * -----------------------------------------------------------------
* C | Integer | 8-bit unsigned integer (unsigned char) * C | Integer | 8-bit unsigned integer (unsigned char)
* S | Integer | 16-bit unsigned integer, native endian (uint16_t) * S | Integer | 16-bit unsigned integer, native endian (uint16_t)
* L | Integer | 32-bit unsigned integer, native endian (uint32_t) * L | Integer | 32-bit unsigned integer, native endian (uint32_t)
* Q | Integer | 64-bit unsigned integer, native endian (uint64_t) * Q | Integer | 64-bit unsigned integer, native endian (uint64_t)
* | | * | |
* c | Integer | 8-bit signed integer (signed char) * c | Integer | 8-bit signed integer (signed char)
* s | Integer | 16-bit signed integer, native endian (int16_t) * s | Integer | 16-bit signed integer, native endian (int16_t)
* l | Integer | 32-bit signed integer, native endian (int32_t) * l | Integer | 32-bit signed integer, native endian (int32_t)
* q | Integer | 64-bit signed integer, native endian (int64_t) * q | Integer | 64-bit signed integer, native endian (int64_t)
* | | * | |
* S_ | Integer | unsigned short, native endian * S_, S! | Integer | unsigned short, native endian
* I, I_ | Integer | unsigned int, native endian * I, I_, I! | Integer | unsigned int, native endian
* L_ | Integer | unsigned long, native endian * L_, L! | Integer | unsigned long, native endian
* | | * | |
* s_ | Integer | signed short, native endian * s_, s! | Integer | signed short, native endian
* i, i_ | Integer | signed int, native endian * i, i_, i! | Integer | signed int, native endian
* l_ | Integer | signed long, native endian * l_, l! | Integer | signed long, native endian
* | | * | |
* n | Integer | 16-bit unsigned integer, network (big-endian) byte order * n | Integer | 16-bit unsigned integer, network (big-endian) byte order
* N | Integer | 32-bit unsigned integer, network (big-endian) byte order * N | Integer | 32-bit unsigned integer, network (big-endian) byte order
* v | Integer | 16-bit unsigned integer, VAX (little-endian) byte order * v | Integer | 16-bit unsigned integer, VAX (little-endian) byte order
* V | Integer | 32-bit unsigned integer, VAX (little-endian) byte order * V | Integer | 32-bit unsigned integer, VAX (little-endian) byte order
* | | * | |
* U | Integer | UTF-8 character * U | Integer | UTF-8 character
* w | Integer | BER-compressed integer (see Array.pack) * w | Integer | BER-compressed integer (see Array.pack)
* *
* Float | | * Float | |
* Directive | Returns | Meaning * Directive | Returns | Meaning
* -------------------------------------------------------------- * -----------------------------------------------------------------
* D, d | Float | double-precision float, native format * D, d | Float | double-precision float, native format
* F, f | Float | single-precision float, native format * F, f | Float | single-precision float, native format
* E | Float | double-precision float, little-endian byte order * E | Float | double-precision float, little-endian byte order
* e | Float | single-precision float, little-endian byte order * e | Float | single-precision float, little-endian byte order
* G | Float | double-precision float, network (big-endian) byte order * G | Float | double-precision float, network (big-endian) byte order
* g | Float | single-precision float, network (big-endian) byte order * g | Float | single-precision float, network (big-endian) byte order
* *
* String | | * String | |
* Directive | Returns | Meaning * Directive | Returns | Meaning
* -------------------------------------------------------------- * -----------------------------------------------------------------
* A | String | arbitrary binary string (remove trailing nulls and ASCII spaces) * A | String | arbitrary binary string (remove trailing nulls and ASCII spaces)
* a | String | arbitrary binary string * a | String | arbitrary binary string
* Z | String | null-terminated string * Z | String | null-terminated string
* B | String | bit string (MSB first) * B | String | bit string (MSB first)
* b | String | bit string (LSB first) * b | String | bit string (LSB first)
* H | String | hex string (high nibble first) * H | String | hex string (high nibble first)
* h | String | hex string (low nibble first) * h | String | hex string (low nibble first)
* u | String | UU-encoded string * u | String | UU-encoded string
* M | String | quoted-printable, MIME encoding (see RFC2045) * M | String | quoted-printable, MIME encoding (see RFC2045)
* m | String | base64 encoded string (RFC 2045) (default) * m | String | base64 encoded string (RFC 2045) (default)
* | | base64 encoded string (RFC 4648) if followed by 0 * | | base64 encoded string (RFC 4648) if followed by 0
* P | String | pointer to a structure (fixed-length string) * P | String | pointer to a structure (fixed-length string)
* p | String | pointer to a null-terminated string * p | String | pointer to a null-terminated string
* *
* Misc. | | * Misc. | |
* Directive | Returns | Meaning * Directive | Returns | Meaning
* -------------------------------------------------------------- * -----------------------------------------------------------------
* @ | --- | skip to the offset given by the length argument * @ | --- | skip to the offset given by the length argument
* X | --- | skip backward one byte * X | --- | skip backward one byte
* x | --- | skip forward one byte * x | --- | skip forward one byte
*/ */
static VALUE static VALUE