Ruby
2.4.2p198(2017-09-14revision59899)
|
Go to the source code of this file.
Data Structures | |
union | FLOAT_SWAPPER |
union | DOUBLE_SWAPPER |
Macros | |
#define | NATINT_LEN_Q 8 |
#define | NATINT_PACK |
#define | BIGENDIAN_P() 0 |
#define | NATINT_LEN(type, len) (natint?(int)sizeof(type):(int)(len)) |
#define | swapf(x) swap32(x) |
#define | swapd(x) swap64(x) |
#define | rb_ntohf(x) (BIGENDIAN_P()?(x):swapf(x)) |
#define | rb_ntohd(x) (BIGENDIAN_P()?(x):swapd(x)) |
#define | rb_htonf(x) (BIGENDIAN_P()?(x):swapf(x)) |
#define | rb_htond(x) (BIGENDIAN_P()?(x):swapd(x)) |
#define | rb_htovf(x) (BIGENDIAN_P()?swapf(x):(x)) |
#define | rb_htovd(x) (BIGENDIAN_P()?swapd(x):(x)) |
#define | rb_vtohf(x) (BIGENDIAN_P()?swapf(x):(x)) |
#define | rb_vtohd(x) (BIGENDIAN_P()?swapd(x):(x)) |
#define | FLOAT_CONVWITH(x) FLOAT_SWAPPER x; |
#define | HTONF(x) ((x).u = rb_htonf((x).u)) |
#define | HTOVF(x) ((x).u = rb_htovf((x).u)) |
#define | NTOHF(x) ((x).u = rb_ntohf((x).u)) |
#define | VTOHF(x) ((x).u = rb_vtohf((x).u)) |
#define | DOUBLE_CONVWITH(x) DOUBLE_SWAPPER x; |
#define | HTOND(x) ((x).u = rb_htond((x).u)) |
#define | HTOVD(x) ((x).u = rb_htovd((x).u)) |
#define | NTOHD(x) ((x).u = rb_ntohd((x).u)) |
#define | VTOHD(x) ((x).u = rb_vtohd((x).u)) |
#define | MAX_INTEGER_PACK_SIZE 8 |
#define | TOO_FEW (rb_raise(rb_eArgError, toofew), 0) |
#define | MORE_ITEM (idx < RARRAY_LEN(ary)) |
#define | THISFROM (MORE_ITEM ? RARRAY_AREF(ary, idx) : TOO_FEW) |
#define | NEXTFROM (MORE_ITEM ? RARRAY_AREF(ary, idx++) : TOO_FEW) |
#define | castchar(from) (char)((from) & 0xff) |
#define | PACK_LENGTH_ADJUST_SIZE(sz) |
#define | PACK_ITEM_ADJUST() |
#define | AVOID_CC_BUG |
#define | UNPACK_ARRAY 0 |
#define | UNPACK_BLOCK 1 |
#define | UNPACK_1 2 |
#define | hexdigits ruby_hexdigits |
#define | UNPACK_PUSH(item) |
Functions | |
static void | encodes (VALUE, const char *, long, int, int) |
static void | qpencode (VALUE, VALUE, long) |
static unsigned long | utf8_to_uv (const char *, long *) |
static void | str_associate (VALUE str, VALUE add) |
static VALUE | str_associated (VALUE str) |
void | rb_str_associate (VALUE str, VALUE add) |
VALUE | rb_str_associated (VALUE str) |
static VALUE | pack_pack (int argc, VALUE *argv, VALUE ary) |
static int | hex2num (char c) |
static VALUE | infected_str_new (const char *ptr, long len, VALUE str) |
static VALUE | pack_unpack_internal (VALUE str, VALUE fmt, int mode) |
static VALUE | pack_unpack (VALUE str, VALUE fmt) |
static VALUE | pack_unpack1 (VALUE str, VALUE fmt) |
int | rb_uv_to_utf8 (char buf[6], unsigned long uv) |
void | Init_pack (void) |
Variables | |
static const char | natstr [] = "sSiIlLjJ" |
static const char | endstr [] = "sSiIlLqQjJ" |
static const char | toofew [] = "too few arguments" |
static ID | id_associated |
static const char | uu_table [] |
static const char | b64_table [] |
static const char | hex_table [] = "0123456789ABCDEF" |
static const unsigned long | utf8_limits [] |
#define AVOID_CC_BUG |
Definition at line 1032 of file pack.c.
Referenced by pack_unpack_internal().
#define BIGENDIAN_P | ( | ) | 0 |
Definition at line 62 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
#define castchar | ( | from | ) | (char)((from) & 0xff) |
Referenced by pack_pack(), pack_unpack_internal(), and rb_uv_to_utf8().
#define DOUBLE_CONVWITH | ( | x | ) | DOUBLE_SWAPPER x; |
Definition at line 99 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
#define FLOAT_CONVWITH | ( | x | ) | FLOAT_SWAPPER x; |
Definition at line 93 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
#define hexdigits ruby_hexdigits |
Referenced by pack_unpack_internal().
#define HTOND | ( | x | ) | ((x).u = rb_htond((x).u)) |
Definition at line 100 of file pack.c.
Referenced by pack_pack().
#define HTONF | ( | x | ) | ((x).u = rb_htonf((x).u)) |
Definition at line 94 of file pack.c.
Referenced by pack_pack().
#define HTOVD | ( | x | ) | ((x).u = rb_htovd((x).u)) |
Definition at line 101 of file pack.c.
Referenced by pack_pack().
#define HTOVF | ( | x | ) | ((x).u = rb_htovf((x).u)) |
Definition at line 95 of file pack.c.
Referenced by pack_pack().
#define MAX_INTEGER_PACK_SIZE 8 |
Definition at line 105 of file pack.c.
Referenced by pack_pack().
#define MORE_ITEM (idx < RARRAY_LEN(ary)) |
Definition at line 66 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
#define NATINT_LEN_Q 8 |
Definition at line 36 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
#define NEXTFROM (MORE_ITEM ? RARRAY_AREF(ary, idx++) : TOO_FEW) |
Referenced by pack_pack().
#define NTOHD | ( | x | ) | ((x).u = rb_ntohd((x).u)) |
Definition at line 102 of file pack.c.
Referenced by pack_unpack_internal().
#define NTOHF | ( | x | ) | ((x).u = rb_ntohf((x).u)) |
Definition at line 96 of file pack.c.
Referenced by pack_unpack_internal().
#define PACK_ITEM_ADJUST | ( | ) |
Definition at line 1021 of file pack.c.
Referenced by pack_unpack_internal().
#define PACK_LENGTH_ADJUST_SIZE | ( | sz | ) |
Definition at line 1011 of file pack.c.
Referenced by pack_unpack_internal().
#define rb_htond | ( | x | ) | (BIGENDIAN_P()?(x):swapd(x)) |
#define rb_htonf | ( | x | ) | (BIGENDIAN_P()?(x):swapf(x)) |
#define rb_htovd | ( | x | ) | (BIGENDIAN_P()?swapd(x):(x)) |
#define rb_htovf | ( | x | ) | (BIGENDIAN_P()?swapf(x):(x)) |
#define rb_ntohd | ( | x | ) | (BIGENDIAN_P()?(x):swapd(x)) |
#define rb_ntohf | ( | x | ) | (BIGENDIAN_P()?(x):swapf(x)) |
#define rb_vtohd | ( | x | ) | (BIGENDIAN_P()?swapd(x):(x)) |
#define rb_vtohf | ( | x | ) | (BIGENDIAN_P()?swapf(x):(x)) |
#define THISFROM (MORE_ITEM ? RARRAY_AREF(ary, idx) : TOO_FEW) |
Referenced by pack_pack().
#define TOO_FEW (rb_raise(rb_eArgError, toofew), 0) |
#define UNPACK_1 2 |
Definition at line 1047 of file pack.c.
Referenced by pack_unpack1().
#define UNPACK_ARRAY 0 |
Definition at line 1045 of file pack.c.
Referenced by pack_unpack(), and pack_unpack_internal().
#define UNPACK_BLOCK 1 |
Definition at line 1046 of file pack.c.
Referenced by pack_unpack().
#define UNPACK_PUSH | ( | item | ) |
Referenced by pack_unpack_internal().
#define VTOHD | ( | x | ) | ((x).u = rb_vtohd((x).u)) |
Definition at line 103 of file pack.c.
Referenced by pack_unpack_internal().
#define VTOHF | ( | x | ) | ((x).u = rb_vtohf((x).u)) |
Definition at line 97 of file pack.c.
Referenced by pack_unpack_internal().
Definition at line 898 of file pack.c.
References b64_table, rb_bug(), rb_str_buf_cat(), and uu_table.
Referenced by pack_pack().
|
inlinestatic |
Definition at line 1002 of file pack.c.
References ruby_digit36_to_number_table.
Referenced by pack_unpack_internal().
Definition at line 1036 of file pack.c.
References OBJ_INFECT, and rb_str_new().
Referenced by pack_unpack_internal().
void Init_pack | ( | void | ) |
Definition at line 2010 of file pack.c.
References id_associated, pack_pack(), pack_unpack(), pack_unpack1(), rb_cArray, rb_cString, rb_define_method(), and rb_make_internal_id().
Definition at line 271 of file pack.c.
References BIGENDIAN_P, buf, castchar, CONST_ID, DOUBLE_CONVWITH, ENC_CODERANGE_7BIT, encodes(), ENCODING_CODERANGE_SET, endstr, errno, f, FLOAT_CONVWITH, HTOND, HTONF, HTOVD, HTOVF, INTEGER_PACK_2COMP, INTEGER_PACK_BIG_ENDIAN, INTEGER_PACK_LITTLE_ENDIAN, ISALPHA, ISDIGIT, ISPRINT, ISSPACE, le, len, MAX_INTEGER_PACK_SIZE, NATINT_LEN, NATINT_LEN_Q, natstr, NEXTFROM, NIL_P, NULL, NUM2LONG, OBJ_INFECT, PRIsVALUE, Qnil, qpencode(), Qundef, RARRAY_LEN, rb_absint_numwords(), rb_ary_new(), rb_ary_push(), rb_bug(), rb_eArgError, rb_enc_set_index(), rb_eRangeError, rb_eRuntimeError, rb_eTypeError, rb_get_kwargs(), rb_integer_pack(), rb_obj_as_string(), rb_obj_classname(), rb_obj_taint(), rb_raise(), rb_scan_args(), rb_str_buf_cat(), rb_str_buf_new(), rb_str_new(), rb_str_set_len(), rb_to_float(), rb_to_int(), RB_TYPE_P, rb_usascii_encindex(), rb_utf8_encindex(), rb_uv_to_utf8(), rb_warning(), RFLOAT_VALUE, RSTRING_LEN, RSTRING_PTR, SIGNED_VALUE, snprintf, str_associate(), strchr(), StringValue, StringValuePtr, STRTOUL, T_STRING, and THISFROM.
Referenced by Init_pack().
Definition at line 1881 of file pack.c.
References pack_unpack_internal(), rb_block_given_p(), UNPACK_ARRAY, and UNPACK_BLOCK.
Referenced by Init_pack().
Definition at line 1897 of file pack.c.
References pack_unpack_internal(), and UNPACK_1.
Referenced by Init_pack().
Definition at line 1050 of file pack.c.
References AVOID_CC_BUG, b64_table, BIGENDIAN_P, buf, castchar, DBL2NUM, DOUBLE_CONVWITH, ENC_CODERANGE_VALID, ENCODING_CODERANGE_SET, endstr, errno, FLOAT_CONVWITH, hex2num(), hexdigits, infected_str_new(), INTEGER_PACK_2COMP, INTEGER_PACK_BIG_ENDIAN, INTEGER_PACK_LITTLE_ENDIAN, ISDIGIT, ISSPACE, len, memcpy, NATINT_LEN, NATINT_LEN_Q, natstr, NTOHD, NTOHF, PACK_ITEM_ADJUST, PACK_LENGTH_ADJUST_SIZE, Qnil, RARRAY_CONST_PTR, RARRAY_LEN, rb_ary_new(), rb_ascii8bit_encindex(), rb_eArgError, rb_eRangeError, rb_integer_unpack(), rb_raise(), rb_str_buf_cat(), rb_str_set_len(), rb_tainted_str_new(), RB_TYPE_P, rb_usascii_str_new(), rb_warning(), RSTRING_LEN, RSTRING_PTR, str_associate(), str_associated(), strchr(), StringValue, STRTOUL, T_STRING, ULONG2NUM, UNPACK_ARRAY, UNPACK_PUSH, utf8_to_uv(), val, VTOHD, and VTOHF.
Referenced by pack_unpack(), and pack_unpack1().
Definition at line 949 of file pack.c.
References EOF, hex_table, rb_str_buf_cat(), RSTRING_LEN, and RSTRING_PTR.
Referenced by pack_pack().
Definition at line 130 of file pack.c.
References ONLY_FOR_INTERNAL_USE.
Definition at line 136 of file pack.c.
References ONLY_FOR_INTERNAL_USE.
int rb_uv_to_utf8 | ( | char | buf[6], |
unsigned long | uv | ||
) |
Definition at line 1903 of file pack.c.
References castchar, rb_eRangeError, rb_raise(), and UNREACHABLE.
Referenced by append_utf8(), and pack_pack().
Definition at line 117 of file pack.c.
References id_associated, and rb_ivar_set().
Referenced by pack_pack(), and pack_unpack_internal().
Definition at line 124 of file pack.c.
References id_associated, Qfalse, and rb_ivar_lookup().
Referenced by pack_unpack_internal().
|
static |
Definition at line 1960 of file pack.c.
References rb_eArgError, rb_raise(), and utf8_limits.
Referenced by pack_unpack_internal().
|
static |
Definition at line 894 of file pack.c.
Referenced by encodes(), and pack_unpack_internal().
|
static |
Definition at line 30 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
|
static |
Definition at line 946 of file pack.c.
Referenced by qpencode().
|
static |
Definition at line 114 of file pack.c.
Referenced by Init_pack(), str_associate(), and str_associated().
|
static |
Definition at line 28 of file pack.c.
Referenced by pack_pack(), and pack_unpack_internal().
|
static |
Definition at line 1949 of file pack.c.
Referenced by utf8_to_uv().