Ejemplo n.º 1
0
/**
 * Document-module: MessagePack
 *
 * MessagePack is a binary-based efficient object serialization library.
 * It enables to exchange structured objects between many languages like JSON.
 * But unlike JSON, it is very fast and small.
 *
 * You can install MessagePack with rubygems.
 *
 *   gem install msgpack
 *
 * Simple usage is as follows:
 *
 *   require 'msgpack'
 *   msg = [1,2,3].to_msgpack  #=> "\x93\x01\x02\x03"
 *   MessagePack.unpack(msg)   #=> [1,2,3]
 *
 * Use Unpacker class for streaming deserialization.
 *
 */
void Init_msgpack(void)
{
	mMessagePack = rb_define_module("MessagePack");

	rb_define_const(mMessagePack, "VERSION", rb_str_new2(MESSAGEPACK_VERSION));

#ifdef COMPAT_HAVE_ENCODING
	s_enc_ascii8bit = rb_ascii8bit_encindex();
	s_enc_utf8 = rb_utf8_encindex();
	s_enc_usascii = rb_usascii_encindex();
	s_enc_utf8_value = rb_enc_from_encoding(rb_utf8_encoding());
#endif

	Init_msgpack_unpack(mMessagePack);
	Init_msgpack_pack(mMessagePack);
}
Ejemplo n.º 2
0
void Init_msgpack(void)
{
	mMessagePack = rb_define_module("MessagePack");
	Init_msgpack_unpack(mMessagePack);
	Init_msgpack_pack(mMessagePack);
}