Compare commits

...

1276 Commits

Author SHA1 Message Date
Nobuyuki Kubota 2a349cf418 Merge pull request #337 from redboltz/fix_55
Fixed #55
2015-08-10 11:44:46 -07:00
Takatoshi Kondo 1bac5a2c00 Fixed #55 2015-08-08 09:54:46 +09:00
Nobuyuki Kubota bf4a57da34 Merge branch 'object-with-zone-copy' 2014-10-06 14:07:06 -07:00
Nobuyuki Kubota 2fcbe6116d Replace C-style casts with C++-style ones 2014-10-06 14:06:21 -07:00
Takatoshi Kondo 0176dd760a Merge pull request #131 from shafik/master
Fixing undefined behavior introduced by the incorrect use of comma
2014-09-20 17:39:44 +09:00
Jakob Petsovits d30548af3f Add support for copying an object to an object::with_zone.
With test.
2014-09-20 00:13:40 -04:00
Jakob Petsovits ab12b2b2b9 Specialize operator<<(packer, T) also for object::with_zone.
It already existed for T = object, but if trying to pass an
object::with_zone it would match the generic operator<<() instead.
That operator calls o.msgpack_pack(), which doesn't exist and
causes a compile error.

(Re-)Using the overload for object is a better way to handle this.
2014-09-19 22:48:24 -04:00
Takatoshi Kondo 7ce69a362f Merge pull request #130 from jpetso/master
Support std::unordered_map/set even if using libstdc++ from GCC.
2014-09-20 00:06:51 +09:00
Takatoshi Kondo cc08146b1c Merge pull request #132 from redboltz/support_travis_ci
Added travis-ci support.
2014-09-19 23:57:40 +09:00
Takatoshi Kondo 6896cc602f Added travis-ci support. 2014-09-19 23:42:07 +09:00
Shafik Yaghmour d8f366daf2 Fixing undefined behavior introduced by the incorrect use of comma operator with the conditional operator. The middle expression in a conditional operator between the ? and : is implicitly parenthesized but the end expression is not. Since the comma operator as he lowest precendence( http://en.cppreference.com/w/cpp/language/operator_precedence) this means the conditional operator will be evaluated first and then the expression on the right hand side of the comma operator will be evaluated. This leads to undefined behavior because the last member of the union being updated will not be the member that will be used next which is strictly undefined in C++ although gcc and clang aloow this type punning as an extension but is clearly not portable behavior nor was this the intended behavior. instead of parenthesising the end expression I choose to use an if/else which is not subject to such easy to miss precdence issues. This Coliru live code demonstrates the bug with simple example: http://coliru.stacked-crooked.com/a/1041aaa8380feeaa the code also demonstrates the using the right warning flags gcc will generate a warning for this code. 2014-09-18 14:29:11 -04:00
Jakob Petsovits ef649009e4 Support std::unordered_map/set even if using libstdc++ from GCC.
When passing the appropriate compiler flags, libstdc++ has
supported std::unordered_map and std::unordered_set for a
long time, even without the tr1 namespace. There's no reason to
limit support of non-tr1 containers to libc++ (clang) and MSVC.
2014-09-17 16:52:33 -04:00
Takatoshi Kondo 847a7852e5 Merge branch 'jpetso-master' 2014-09-10 10:59:49 +09:00
Jakob Petsovits e265beef91 Install version.h even if doing an out-of-source build. 2014-09-09 16:21:38 -04:00
Takatoshi Kondo dc679a2572 Merge pull request #119 from davidchappelle/master
Amendment to cmake changes for out of source builds
2014-09-09 06:21:38 +09:00
David Chappelle b6bc7f7ecb Merge remote-tracking branch 'upstream/master'
Conflicts:
	CMakeLists.txt
2014-09-08 15:57:43 -04:00
Jason Newton 501260eb54 correct paths for x86_64/generic installations 2014-09-08 22:27:38 +09:00
David Chappelle 8615358515 Fixed out of source cmake builds to work correctly.
The out of source cmake build was not working correctly. In particular,
the main CMakeLists.txt was not installing from the correct location.
In the case of msgpack.pc, it was trying to install from the top repo
directory instead of from the cmake build directory. So you can now
build as follows:

    $ cd msgpack-c
    $ mkdir build
    $ cd build
    $ cmake ../
    $ make
    $ make install
2014-09-05 19:22:04 +00:00
Nobuyuki Kubota dd083ca933 Merge pull request #95 from ueno/int-float-test
Fix test failure regarding int->float conversion
2014-07-30 21:25:42 -07:00
Daiki Ueno c203928fae Fix test failure regarding int->float conversion
Supply only small integers (< 1^23) to int->float conversion tests,
so they can roundtrip without error.
2014-07-17 18:51:59 +09:00
Nobuyuki Kubota 197ed8c983 Merge pull request #92 from nobu-k/version0.5.9
version 0.5.9
2014-07-03 11:45:20 +09:00
Nobuyuki Kubota 990860fe65 Change CMAKE_MINIMUM_REQUIRED to 2.8.6 for SET_PROPERTY APPEND_STRING 2014-07-03 11:39:43 +09:00
Nobuyuki Kubota dbeb6e61c6 version 0.5.9 2014-07-02 18:44:07 +09:00
Nobuyuki Kubota 2b3f37f9e0 Add fbuffer.h and fbuffer.hpp to CMakeLists.txt and msgpack_vc.postbuild.bat 2014-07-02 18:07:07 +09:00
Nobuyuki Kubota f50148a9cc Merge branch 'fbuffer' 2014-07-02 17:53:18 +09:00
Takatoshi Kondo 9fc8ec5b61 Merge branch 'tbeu-fix-bool-and-inline-for-C-compilation-with-MSVC' 2014-07-02 17:44:18 +09:00
Takatoshi Kondo 751a6f98fe Moved bool and inline definition from msgpack.h to sysdep.h.
Set compile settiong on MSVC. ".c" files are compliled as C, not C++. (msgpack_vc8.vcproj, CMakeLists.txt)
Fixed msgpack root object initialization problem on MSVC. {} initialization is not supported on MSVC.
2014-07-02 17:43:07 +09:00
Nobuyuki Kubota 9d8e6b92fc Add fclose to fbuffer's tests 2014-07-02 17:35:15 +09:00
Nobuyuki Kubota c868da2879 Fix Makefile.am to install fbuffer.h and fbuffer.hpp 2014-07-02 17:32:41 +09:00
tbeu e0c40c1c59 fix type bool and inline specifier
For a pure C compilation with MSVC type bool is not available. Not tested with other targets (Mingw, cygwin). Thats why only active of ```_MSC_VER``` is defined. So not sure if the bool fix should be also applied to other targets.

For MSVC the inline specifier is not valid and must be named __inline (or _inline).
2014-07-02 17:13:31 +09:00
Nobuyuki Kubota f185284776 Merge branch 'mpapierski-cmake' 2014-07-02 16:22:33 +09:00
Takatoshi Kondo 1656ef0111 Merge pull request #90 from tbeu/fix-c-compilation
Fix pure C compilation
2014-06-23 21:43:56 +09:00
tbeu 3cb2e4f7c6 Fix pure C compilation 2014-06-23 13:55:25 +02:00
Takatoshi Kondo 3104f7e451 Added -O3 -g option for gcc and clang. Improved compiler checking method. 2014-06-21 19:00:59 +09:00
Takatoshi Kondo ab8e7ea822 Added -DPIC option on shared library. 2014-06-21 11:27:33 +09:00
Takatoshi Kondo 6daef66ea7 Added warning flags. 2014-06-21 11:11:32 +09:00
Takatoshi Kondo 04286eb9dc Modified the way to install msgpack headers. 2014-06-12 11:18:06 +09:00
Takatoshi Kondo d15e30bf4a Fixed major_version and minor_version.
Fixed relase_version.
Added msgpack.pc creating proccess.
2014-06-08 15:25:24 +00:00
Takatoshi Kondo fb1d480faf Added the SOVERSION same as autotools.
Set CMAKE_MINIMUM_REQUIRED to 2.6.4.
2014-06-08 14:05:33 +00:00
Takatoshi Kondo c8fa0be345 Supported make install.
Removed vc2008 files from make dist.
2014-06-07 14:39:59 +00:00
Takatoshi Kondo 643b0c9523 Supported shared library on cmake.
Updated the documentation.
2014-06-07 00:13:23 +09:00
Takatoshi Kondo 06930616b2 Added cmake files.
https://github.com/msgpack/msgpack-c/pull/20
Removed 'preprocess' from original CMakeLists.txt.
Removed file copy from original CMakeLists.txt.

Removed 'preprocess' from bootstrap.
Removed file copy from bootstrap.

Added erb generated files. Ruby is no longer required.
Moved cases.mpac, cases_compact.mpa, pack_define.h,
pack_template.h, unpack_define.h, unpack_template.h,
and sysdep.h to apropriate location.

If you want to re-generate zone.hpp, define.hpp, and tuple.hpp,
then you execute preprocess.
2014-06-05 20:49:15 +00:00
Nobuyuki Kubota 6e5fc6d396 Merge pull request #83 from redboltz/fixed_readme
Fixed https://github.com/msgpack/msgpack-c/issues/82
2014-06-01 19:16:10 +09:00
Takatoshi Kondo 17b0753023 Fixed linking order. 2014-06-01 19:03:51 +00:00
Nobuyuki Kubota 7491348d40 Merge branch 'philix-Wconversion' 2014-06-01 19:09:02 +09:00
Nobuyuki Kubota eef2036c36 Remove implicit type conversions from (un)pack_template.h 2014-06-01 19:06:40 +09:00
Nobuyuki Kubota fbec8f4470 Merge pull request #80 from redboltz/fix_enum_member_test
Fixed dereferencing type-punned pointer will break strict-aliasing rules warning
2014-06-01 18:22:46 +09:00
Felipe Oliveira Carvalho 8e0137e1d2 Fix to allow projects to compile with -Wconversion
Projects that use -Wconversion don't compile due to errors in msgpack header
files. This commit fixes all the errors in msgpack-c for when -Wconversion is
enabled.

Now I can even compile msgpack-c itself with -Wconversion and all my projects:

    CFLAGS=-Wconversion ./configure
		make
2014-05-19 15:30:14 -03:00
Takatoshi Kondo 1dac3f890a Fixed https://github.com/msgpack/msgpack-c/issues/82 2014-04-24 22:39:01 +00:00
Nobuyuki Kubota 9f33266f23 Merge pull request #81 from watsonsong/master
fix compile error on Linux by gcc 4.7
2014-04-07 10:37:54 +09:00
Frank Watson Song d8c7fd5161 fix compile error on Linux by gcc 4.7 2014-04-01 17:34:28 +08:00
Nobuyuki Kubota 731bc643d0 Merge pull request #79 from redboltz/add_inline
Fixed https://github.com/msgpack/msgpack-c/issues/77
2014-03-31 17:36:06 +09:00
Takatoshi Kondo 12e8615ac5 Fixed dereferencing type-punned pointer will break strict-aliasing rules warning. 2014-03-31 16:37:29 +09:00
Takatoshi Kondo 22703d2cdb Fixed https://github.com/msgpack/msgpack-c/issues/77 2014-03-30 18:42:15 +00:00
Takatoshi Kondo cb518f472a Merge pull request #73 from ovz/master
Fixed failing test zone_allocate_constructor.
2014-03-30 18:46:15 +09:00
Takatoshi Kondo 271f1fa319 Merge pull request #75 from mogemimi/fix/typo
Fix typo in QUICKSTART-CPP
2014-03-30 18:21:34 +09:00
mogemimi 9ecc4f0a1e Fix typo in QUICKSTART-CPP 2014-03-24 23:07:10 +09:00
ovz 977eab7c4a Fixed failing test zone_allocate_constructor.
Corrected a typo in definition of myclass constructor with parameters.
2014-03-18 14:25:55 -07:00
Vladimir Volodko c9f342f4b2 Make fbuffer's constructor explicit. 2014-03-03 10:21:03 +07:00
Nobuyuki Kubota 126e4d8414 Merge pull request #70 from redboltz/remove_cxx11_features
Removed C++11 features
2014-03-02 16:58:16 +09:00
Takatoshi Kondo 14ee1e5827 Removed C++11 features 2014-03-02 14:14:04 +00:00
Nobuyuki Kubota ecbb9055a2 Merge branch 'vvolodko/improve-define' 2014-02-28 16:15:20 +09:00
Nobuyuki Kubota 862f04104d Changed the format a little 2014-02-28 16:14:49 +09:00
Vladimir Volodko d47f72be0c Refactor define::msgpack_unpack() to use 'switch' instead of several if's.
convert.benchmark test show some improvement.
2014-02-28 16:14:33 +09:00
Nobuyuki Kubota 98c5767372 Merge branch 'redboltz/add_integer_to_float_conv' 2014-02-28 15:53:11 +09:00
Nobuyuki Kubota 97a7b7545a Refactored test cases with type parameterized test 2014-02-28 15:52:36 +09:00
Nobuyuki Kubota caf5616573 Merge pull request #69 from redboltz/support_libcpp_and_vcxx_unordered
Support libcpp and vcxx unordered
2014-02-28 15:22:27 +09:00
Takatoshi Kondo b8076fa71f Supported VC++. Fixed testing macro for tr1 containers. 2014-02-27 23:54:48 +00:00
Takatoshi Kondo 2360466aa9 Added unordered containers support for libc++. 2014-02-22 20:43:18 +00:00
Nobuyuki Kubota 28370b36aa Replaced deprecated functions in example/stream.cc 2014-02-07 20:16:51 +09:00
Nobuyuki Kubota 9d82356ea9 Merge pull request #62 from redboltz/remove_redundant_null_check
Removed a redundant null check.
2014-02-07 20:05:49 +09:00
Nobuyuki Kubota ca24e040c4 Merge pull request #61 from redboltz/fix_delete_free_mismatch
Fixed the free and delete mismatch problem.
2014-02-07 20:04:57 +09:00
Takatoshi Kondo 0fd629857d Removed a redundant null check. 2014-02-03 09:34:48 +00:00
Takatoshi Kondo 8eff14db11 Removed redundant null check. 2014-02-02 16:22:07 +00:00
Takatoshi Kondo 81e26fe9b9 Fixed the free and delete mismatch problem.
https://github.com/msgpack/msgpack-c/issues/52
2014-02-02 00:07:45 +00:00
Takatoshi Kondo 9eb4583dd5 Merge pull request #59 from redboltz/add_null_check
Added null pointer check.
2014-01-27 17:53:19 -08:00
Takatoshi Kondo 5a23c86dc1 Added null pointer check. 2014-01-28 10:54:57 +09:00
Takatoshi Kondo ffd0525607 Replaced types of length from unsigned int to size_t. 2014-01-26 11:29:19 +00:00
Drew Crawford 3dc636bf3e This patch fixes a type conversion warning in clang 5 when compiling for arm64 targets.
```
$ clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

In file included from /Users/drew/Dropbox/Code/caffeine-ios/ext/msgpack/src/msgpack/pack.h:120:
/Users/drew/Dropbox/Code/caffeine-ios/ext/msgpack/src/msgpack/pack_template.h:773:57: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'unsigned int' [-Wshorten-64-to-32]
        msgpack_pack_append_buffer(x, (const unsigned char*)b, l);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /Users/drew/Dropbox/Code/caffeine-ios/ext/msgpack/src/objectc.c:19:
/Users/drew/Dropbox/Code/caffeine-ios/ext/msgpack/src/msgpack/pack.h:118:61: note: expanded from macro 'msgpack_pack_append_buffer'
        return (*(user)->callback)((user)->data, (const char*)buf, len)
                                                                   ^
1 warning generated.
```

This patch is provided under the Apache License version 2.
2014-01-24 12:41:13 -06:00
Takatoshi Kondo 260ce4aa1d Added object that has integer to float and double converter. 2014-01-21 21:12:13 +00:00
Takatoshi Kondo 8bc827ebf5 Merge pull request #51 from xunzhang/master
update type.hpp
2014-01-13 18:10:49 -08:00
xunzhang a97f764088 update type.hpp, support std::tr1::unordered_map and std::tr1::unordered_set 2014-01-13 14:12:17 +08:00
Nobuyuki Kubota 143b90af3e Merge branch 'claws/readme_overhaul' 2013-12-22 21:12:04 -08:00
Nobuyuki Kubota 4e0a6ae624 Fixed some URL syntaxes 2013-12-22 21:04:53 -08:00
Nobuyuki Kubota 0c60cfc5c0 Merge pull request #47 from nobu-k/version-0.5.8
version 0.5.8
2013-12-22 20:35:16 -08:00
Nobuyuki Kubota deb6b0e334 version 0.5.8 2013-12-22 20:24:49 -08:00
Nobuyuki Kubota 27777dcd31 Merge pull request #46 from redboltz/fixed_size_type
Fixed size types based on snej's pull request.
2013-12-22 11:55:05 -08:00
Nobuyuki Kubota bdb397e043 Merge pull request #36 from redboltz/support_plain_char
Supported 'plain' char.
2013-12-22 11:19:19 -08:00
Takatoshi Kondo cb4d851761 Fixed size types based on snej's pull request.
https://github.com/snej/msgpack-c/commit/1784e7a3f3d012e1149adc9b8a3abb3646eb616f
2013-12-22 15:13:48 +00:00
Chris Laws 17aa517e41 Fix up README, include accurate instructions 2013-12-17 08:53:15 +10:30
Takatoshi Kondo 7ac16f4834 Replaced const [un]signed long long int& with [un]signed long long int in sevral function's arguments to unify the interface. No performance issue is observed. 2013-12-16 13:39:12 +09:00
Takatoshi Kondo bf7fece440 Merge pull request #43 from redboltz/add_test_and_example_for_37
Added a test and speed test examples for #37.
2013-12-15 20:25:46 -08:00
Takatoshi Kondo c04ef9efe5 Merge pull request #38 from redboltz/copy_msgpack_object_by_memcpy
Fixed issue #37.
2013-12-15 20:25:15 -08:00
Takatoshi Kondo b774c07d19 When the compiler is gcc, use memcpy, otherwise use an assignment operator.
The memcpy approach is a workaround for gcc's bug. The speed performance on gcc is the same between both approach. But on clang, the memcpy approach is 10% slower than an assignment approach. Hence I added the switching approach code using compiler checked macro.

Note: __GNUC__ is defined both gcc and clang. So I use __GNUC__ && !__clang__
2013-12-16 13:25:09 +09:00
Takatoshi Kondo 229467cb29 Added a test and speed test examples for #37. 2013-12-08 10:39:13 +00:00
Takatoshi Kondo 949b472f7e Merge pull request #41 from redboltz/old_compiler_bus_error_workaround
Fixed an unused function warning.
2013-11-26 17:31:02 -08:00
Takatoshi Kondo be67d3e362 Fixed an unused function warning.
This fix is a part of issue #33.
https://github.com/snej/msgpack-c/commit/35ba41c24503ec934b1cb181a979459644242a01
2013-11-27 10:33:52 +09:00
Vladimir Volodko 2c1a1fd4f8 Add C/C++ FILE* buffer adaptor.
* add function msgpack_fbuffer_write();
* add class msgpack::fbuffer;
* add tests buffer.fbuffer and buffer.fbuffer_c .
2013-11-22 12:57:30 +07:00
Takatoshi Kondo 3e2ae7cc78 Fixed issue #37.
It seems to be gcc's bug.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58416
2013-11-11 09:51:04 +00:00
Nobuyuki Kubota 505660e1fa Merge pull request #35 from redboltz/add_libgtest
Added libgtest.a for make check
2013-10-30 21:44:57 -07:00
Takatoshi Kondo 09d90e1231 Supported 'plain' char.
Note: char, signed char, and unsigned char are three different types.
2013-10-31 13:19:22 +09:00
Takatoshi Kondo 5a9f89ae1f Added libgtest.a for make check 2013-10-29 13:35:26 +09:00
Jens Alfke 6f56345dd8 Fixed unused-function warnings
The function bodies in header files should be declared static inline.
2013-10-22 21:52:13 +00:00
Takatoshi Kondo edef040688 Merge pull request #34 from redboltz/fix_freed_mem_access
Fixed freed memory accessing bug.
2013-10-22 05:11:42 -07:00
Takatoshi Kondo 9fc196e750 Fixed freed memory accessing bug.
(Issue #32)
2013-10-22 12:46:06 +00:00
Takatoshi Kondo dc1698eaf4 Merge pull request #31 from redboltz/fix_buffer_leak
Fixed buffer leak bug.

In the case of the function next() returns true:
Whichever the argument result is holding the zone or not, the ownership of the zone always should be delegated from 'unpacker' to 'unpacked'.

In the case of the function next() returns false:
Whichever the argument result is holding the zone or not, the members of 'unpacked' should be reset.
2013-10-14 23:59:04 -07:00
Takatoshi Kondo 53ded063a0 Fixed buffer leak bug. 2013-10-15 11:03:47 +09:00
Takatoshi Kondo 8a2c50c374 Merge pull request #28 from redboltz/solve_narrow_conversion
Added the casts for the byte data.
2013-08-29 21:10:03 -07:00
Takatoshi Kondo f71148f3a6 Merge pull request #29 from redboltz/add_copyright
Added copyright.
2013-08-29 21:09:08 -07:00
Takatoshi Kondo 172105828c Added copyright. 2013-08-30 13:07:42 +09:00
Takatoshi Kondo 6cca6cb20d Added the casts for the byte data. 2013-08-30 12:57:20 +09:00
Takatoshi Kondo b7336f817c Merge pull request #27 from redboltz/malloc_free_match
Fixed malloc delete unmatch bug.
2013-08-26 18:56:26 -07:00
Takatoshi Kondo 88356b79be Fixed malloc delete unmatch bug. 2013-08-27 09:37:42 +09:00
Takatoshi Kondo ce9e543882 Merge pull request #26 from redboltz/add_throw
added return value checking.
2013-08-23 00:34:21 -07:00
Takatoshi Kondo 3ff3ba83f4 added return value checking. 2013-08-23 16:28:02 +09:00
Takatoshi Kondo edb525a030 Merge pull request #25 from redboltz/typo_fix
fixed a typo in a comment
2013-08-20 17:42:54 -07:00
Takatoshi Kondo ea5314f076 fixed a typo in a comment 2013-08-21 09:32:51 +09:00
Nobuyuki Kubota be8e53163b Updated wiki links and removed old message 2013-08-17 19:00:16 +09:00
Nobuyuki Kubota 79151f517f Imported quickstarts from wiki 2013-08-17 18:51:56 +09:00
Nobuyuki Kubota e8ffe7ef96 Merge pull request #23 from ulikoehler/master
Add README syntax highlighting
2013-08-17 02:32:36 -07:00
Nobuyuki Kubota b5a7b5e277 Fixed a compile error caused by MSGPACK_ADD_ENUM with msgpack::packer 2013-08-17 18:20:32 +09:00
Nobuyuki Kubota 85b5e1088f str 8 and bin 8/16/32 support in deserializer 2013-08-17 17:24:50 +09:00
Uli Köhler 680ddb1557 Add README syntax highlighting 2013-08-17 03:11:15 +02:00
Nobuyuki Kubota 44fff522bd Merge pull request #17 from grynko/patch-1
Update README.md
2013-07-29 03:33:29 -07:00
grynko 90815f0d27 Update README.md
fix typos
2013-07-02 12:06:14 +03:00
Nobuyuki Kubota f07950c60a add the same test as commit:764bfdcb9f for __gnu_cxx::__exchange_and_add
refs #8
2013-04-09 18:14:23 -07:00
Nobuyuki Kubota f8c4125892 Merge branch '__sync_check' of github.com:nori0428/msgpack-c into nori0428-__sync_check 2013-04-09 17:50:08 -07:00
Nobuyuki Kubota 1f30cc203a Temporary fix for a compilation error on OS X
fixes #3
fixes #15
2013-04-09 17:38:49 -07:00
nori0428 764bfdcb9f check whether exists __sync_{sub, add}_and_fetch 2013-03-01 11:08:37 +09:00
Vasily Titskiy f290814f64 Fix implementation of atomic functions for GCC 3.x
__gnu_cxx::__exchange_and_add returns OLD, not NEW value
2013-01-03 19:28:00 -08:00
Hans Duedal 3a2508545d Fix for mismatched free() / delete / delete[]
When doing streaming deserialization, valgrind complains about mismatched free()...
It's caused by calls to auto_ptr::free for zones that are null pointers.
2013-01-03 19:27:17 -08:00
Nicolas Despres 79a06a338a Remove unused variables. 2013-01-03 19:26:06 -08:00
Nicolas Despres 509f27eee1 cpp: Fix convert.enum_member test (issue #50).
The patch add serialization operator for the given enum to avoid the use
of a cast which leads to strict-aliasing warnings and the test to fail.

Solution suggested by qehgt.
2013-01-03 19:20:07 -08:00
Nobuyuki Kubota e511c32a36 Imported .gitignore from the original MessagePack git repository
This commit includes a pull request from polrop(ignore-cpp-bootstrapped-files branch).
2013-01-03 19:17:36 -08:00
FURUHASHI Sadayuki b463d9b687 reorganized tree 2013-01-03 19:13:28 -08:00
FURUHASHI Sadayuki e96e20ccfd make C/C++ implementation independent from other language implementations 2013-01-03 19:08:11 -08:00
FURUHASHI Sadayuki 06ebdbfd37 updated README.md 2013-01-03 19:04:51 -08:00
FURUHASHI Sadayuki df9fd047b4 fixed previous commit 2013-01-03 19:00:20 -08:00
FURUHASHI Sadayuki 85d65c59d2 MessagePack for Ruby moved to https://github.com/msgpack/msgpack 2012-12-20 10:39:47 -08:00
FURUHASHI Sadayuki 754126644f ruby: v0.4.8 2012-12-16 17:17:11 -08:00
FURUHASHI Sadayuki 220436f4f9 Merge pull request #123 from brixen/patch-1
Update ruby/compat.h
2012-12-16 16:39:58 -08:00
Brian Ford b62a6ae1d0 Update ruby/compat.h
The exceptions for Rubinius are unnecessary now and are actually
causing msgpack not to install due to the incorrect function prototypes
that are in this file. In MRI, this is the prototype

  VALUE rb_gc_enable();

Anyway, these are unnecessary for Rubinius.
2012-12-16 16:27:05 -08:00
INADA Naoki eae0532b8c Split msgpack-php repository. 2012-08-20 22:04:44 +09:00
UENISHI Kota d642487f99 MessagePack for Erlang moved to https://github.com/msgpack/msgpack-erlang 2012-07-17 22:39:31 +09:00
FURUHASHI Sadayuki 320510506b MessagePack for OCaml moved to https://github.com/msgpack/msgpack-ocaml 2012-07-04 17:40:11 -07:00
FURUHASHI Sadayuki b2839ac78b MessagePack for Haskell moved to https://github.com/msgpack/msgpack-haskell 2012-07-03 19:14:45 -07:00
FURUHASHI Sadayuki 834d5a0e72 MessagePack for Scala moved to https://github.com/msgpack/msgpack/tree/master/scala 2012-07-03 19:10:28 -07:00
FURUHASHI Sadayuki 13ce808c47 MessagePack for C# was moved to https://github.com/msgpack/msgpack-cli 2012-06-25 18:23:24 -07:00
FURUHASHI Sadayuki 980a6529c1 ruby 0.4.7 2012-05-05 19:40:48 -07:00
FURUHASHI Sadayuki c92384fe68 ruby: fix ruby/st.h on ruby 1.8 2012-05-05 19:39:50 -07:00
FURUHASHI Sadayuki 9f563f87b9 ruby: fix ruby/st.h on ruby 1.8 2012-05-05 19:26:26 -07:00
INADA Naoki 44f37b8d1b Merge branch 'master' of github.com:msgpack/msgpack 2012-05-01 03:03:21 +09:00
INADA Naoki 5f41c1cf3f Split msgpack-go repository 2012-05-01 03:02:49 +09:00
INADA Naoki 2a664b9ae6 Merge pull request #89 from ngmoco/master
Go string support
2012-04-30 10:05:16 -07:00
INADA Naoki 5456814199 Merge branch 'master' of https://github.com/dgryski/msgpack into go
Conflicts:
	go/pack.go
2012-05-01 01:44:27 +09:00
INADA Naoki 33ceaeb208 Merge pull request #104 from ericliang/master
For go1 release compatiblity with some trivial code refactorations.
2012-04-30 09:37:52 -07:00
FURUHASHI Sadayuki b33e60b3ae Merge pull request #108 from kou/support-pkg-config
c: supports pkg-config
2012-04-20 19:40:42 -07:00
advect 9dd0a6eb86 php: supported 5.4.x version 2012-04-20 15:29:20 +09:00
Kouhei Sutou ed6faf4e65 c: supports pkg-config
About pkg-config:

  From http://www.freedesktop.org/wiki/Software/pkg-config

  pkg-config is a helper tool used when compiling applications and
  libraries. It helps you insert the correct compiler options on the
  command line so an application can use gcc -o test test.c
  `pkg-config --libs --cflags glib-2.0` for instance, rather than
  hard-coding values on where to find glib (or other libraries). It is
  language-agnostic, so it can be used for defining the location of
  documentation tools, for instance.

pkg-config is a widely used build helper tool. Major build tools such
as GNU Autoconf, CMake and so on support pkg-config.

MessagePack users can build their software more easily.
2012-04-15 19:21:55 +09:00
Eric Liang df2ee5de49 fix ENOENT from os to syscall, ditto. 2012-03-31 00:36:47 +08:00
Eric Liang 36fef91a67 fix error for go1 compatiblity 2012-03-31 00:34:23 +08:00
FURUHASHI Sadayuki 3399148d75 Merge pull request #99 from kou/support-mingw
c: supports DLL generation by MinGW
2012-03-21 00:10:49 -07:00
FURUHASHI Sadayuki 0eea92de66 cpp: fixed template generation logic for 0-length classes #101 2012-03-21 00:10:26 -07:00
Masahiro Nakagawa 92975bb21d Merge pull request #103 from dbussink/rubinius_support
Improve Rubinius support for msgpack Ruby gem
2012-03-19 08:12:08 -07:00
Dirkjan Bussink bf18e04134 Detect whether st.h is present and don't use RUBY_VM as the condition 2012-03-17 12:43:26 +01:00
Dirkjan Bussink 4a0d7f18fd Explicitly state msgpack doesn't modify char* buffers from RSTRING_PTR
From what I could investigate, msgpack doesn't modify char* buffers
obtained from RSTRING_PTR. This means that on Rubinius we don't have to
copy back and forth the buffer to make sure it's also updated on the
Ruby side.

This copying of buffers is a similar problem as the RARRAY_PTR problem,
because it is not safe to expose GC'ed memory on Rubinius to extensions
since it can move due to Rubinius having a moving GC.
2012-03-17 12:40:29 +01:00
Dirkjan Bussink 65c360a2ca Don't use MRI internals in the Ruby extension
Using internals of MRI by using RARRAY_PTR makes it necessary for other
implementations such as Rubinius to continuously copy the structure
returned by RARRAY_PTR back and forth since in Rubinius objects are
layed out differently internally.

Extensions should not depend and use these internal MRI structures if
this is not necessary and when there are API methods that can provide
the same functionality. This makes sure other implementations can also
use the extension without any big problems.

For this reason I also removed the FIXME comment, since that change
would also heavily depend on the internal memory layout of objects on
MRI.
2012-03-17 11:28:19 +01:00
Damian Gryski 71919f7523 go: update unit tests for fixbytes packing bug 2012-02-29 10:36:58 +01:00
Damian Gryski 31a49db68b go: Fix length mask error in []byte packing. 2012-02-28 22:54:54 +01:00
Kouhei Sutou 0d615442ba c: supports DLL generation by MinGW
libtool requires -no-undefined link option to generate a DLL
by MinGW. A DLL should not have any unresolved symbols and
-no-undefined link option declares that the library doesn't
depends on any libraries other than the ones listed on the
command line.

See also: description about -no-undefined option at
http://www.gnu.org/software/libtool/manual/libtool.html#Link-mode
2012-02-27 14:31:37 +09:00
Damian Gryski 8f35dbc306 go: README with installation instructions 2012-02-25 03:11:37 +01:00
Damian Gryski 154bcbc4f7 go: Makefiles not needed any more. 2012-02-25 03:10:06 +01:00
Damian Gryski c96a39d315 go: Fix unit test for non-deterministic map ordering 2012-02-24 22:52:37 +01:00
Damian Gryski 06ba74c366 go: Updated for weekly.2012-02-22 2012-02-24 22:51:39 +01:00
Muga Nishizawa 8786a8e6e0 deleted .settings directory and .gitignore file 2012-02-09 02:23:25 +09:00
Muga Nishizawa 748236fef0 MessagePack for Java was moved to https://github.com/msgpack/msgpack-java. 2012-02-09 02:21:43 +09:00
INADA Naoki ae1b06f20b Fix bug on unpacking empty array. 2012-01-28 02:20:39 +09:00
Hideyuki Tanaka b8aa93ce30 fix decode on bigendian systems 2012-01-26 16:38:27 +09:00
Hideyuki Tanaka 49d40a42f1 fix bug 2011-11-18 17:49:22 +09:00
Hideyuki Tanaka 1845f34b81 change auto-derive behaviour 2011-11-18 16:49:12 +09:00
Hideyuki Tanaka 43903d446a version bump 2011-11-17 18:29:01 +09:00
Hideyuki Tanaka 256da2124b support auto-derive parameterized type 2011-11-17 18:27:37 +09:00
Hideyuki Tanaka 7869e96bac change behaviour of auto-deriver 2011-11-17 17:40:10 +09:00
Hideyuki Tanaka 79b51a6e4b improve and change user data auto-deriver 2011-11-17 17:15:05 +09:00
Hideyuki Tanaka cad9f6d46e fix dependencies 2011-11-16 14:49:01 +09:00
Scott White da2960880a adding support for encoding string types and fixed the Pack test. 2011-10-17 13:29:50 -07:00
Fuji Goro 0eacc58e29 Merge branch 'master' of git://github.com/msgpack/msgpack 2011-10-10 16:02:19 -07:00
Fuji Goro 3bec736aee Fix pack/unpack for double on arm-oabi 2011-10-10 10:38:49 -07:00
Hideyuki Tanaka 3241ffd1b4 version bump 2011-08-30 13:58:16 -07:00
INADA Naoki d0d7b266bc Split msgpack-python to separated repository. 2011-08-21 18:55:16 +09:00
advect c24948258b php: 0.5.1
Merge pull request #81
Fixed include path for version check. (Contributed by duedal)
2011-08-20 16:40:48 +09:00
Fuji Goro d36666bd98 Move perl/ to https://github.com/msgpack/msgpack-perl 2011-08-19 12:37:03 +09:00
Fuji Goro 2794b1d310 perl: tiny tweaks 2011-08-19 11:33:46 +09:00
Fuji Goro f456fa03da perl: encourage to inlining 2011-08-19 11:15:09 +09:00
Fuji Goro 356b7b43f8 perl: add JSON.pm-like interface: Data::MessagePack->new->encode(...) 2011-08-19 10:54:30 +09:00
Fuji Goro 92718e2140 perl: Refactor config vars 2011-08-19 10:49:59 +09:00
Fuji Goro 4021160a64 perl: Performance tweaks for $Canonical 2011-08-19 10:22:28 +09:00
Fuji, Goro 6f043e3326 Merge pull request #82 from cho45/canonical
perl: Implemented canonical mode.
2011-08-18 18:06:54 -07:00
cho45 74b0b1da21 perl: Implemented canonical mode. 2011-08-17 18:32:43 +09:00
Muga Nishizawa 3a5f676687 fixed bug, which is cause of CannotCompileException during compiling primitive-type fields annotated by Nullable 2011-08-09 18:35:42 +09:00
FURUHASHI Sadayuki 4fa7cffc37 fixed sysdep.h 2011-08-09 03:30:56 +09:00
FURUHASHI Sadayuki 79b83e78a5 cpp: version 0.5.7 2011-08-08 23:52:09 +09:00
FURUHASHI Sadayuki 048a3835e7 cpp: -O3 -> -O4 2011-08-08 23:51:12 +09:00
FURUHASHI Sadayuki 4a4891036a ruby: 0.4.6 2011-08-08 23:50:25 +09:00
FURUHASHI Sadayuki ff00c83f15 ruby: -O4 -> -O3 2011-08-08 23:49:19 +09:00
FURUHASHI Sadayuki 79d31b7452 Merge pull request #76 from bketelsen/master
Update Go support to latest release version (R58)
2011-08-07 12:57:09 -07:00
Fuji, Goro 20cc6f7463 Revert "Changelogging"
This reverts commit ba7183a5b4.
2011-08-07 18:51:34 +09:00
Fuji, Goro 8acabaa135 Revert "SVs with POK and IOK/NOK should be packed as numbers, not strings"
This reverts commit 28f4338a6c.
2011-08-07 18:51:16 +09:00
Fuji, Goro ba7183a5b4 Changelogging 2011-08-07 18:40:52 +09:00
Fuji, Goro 28f4338a6c SVs with POK and IOK/NOK should be packed as numbers, not strings 2011-08-07 18:36:50 +09:00
Fuji, Goro 800a93a859 Update .gitignore and MANIFEST.SKIP 2011-08-07 18:36:34 +09:00
advect 2e969e3a0a php: 0.5.0
Fix ZEND_DECLARE_MODULE_GLOBALS
Add unpack of template converter (Merge pull request #57 #58 from enfinity/msgpackr)
2011-07-28 08:15:38 +09:00
Muga Nishizawa 3fb31f651d scala: fixed bug within reflection-based beans template builder 2011-07-22 20:36:31 +09:00
Brian Ketelsen 682d25b551 fixed author and updated to r58 or higher 2011-07-21 12:33:44 -04:00
Muga Nishizawa bcad8d4c4c MSGPACK-27: appended \'synchronized\' to modifiers of TemplateRegistry#unregister ( ) 2011-06-30 10:36:01 +09:00
Muga Nishizawa 96bab8e02e java: Added utilities for unit testing 2011-06-27 11:49:17 +09:00
Muga Nishizawa fa4a615d0f java: Updated versions of dependencies, which are junit, slf4j-api and slf4j-log4j12 2011-06-27 11:37:48 +09:00
Muga Nishizawa f1265c4fed java: Merged file in .settings manually 2011-06-27 10:54:32 +09:00
Muga Nishizawa df01cd9a09 java: changed setting files for Eclipse IDE 2011-06-27 10:51:33 +09:00
FURUHASHI Sadayuki 255bac642d Merge branch 'master' of github.com:msgpack/msgpack 2011-06-26 22:52:06 +09:00
FURUHASHI Sadayuki 6d8c3bd13d use larger buffer size on MessagePack.pack 2011-06-26 22:48:42 +09:00
INADA Naoki 75b8272710 Merge remote-tracking branch 'origin/master' 2011-06-24 00:05:04 +09:00
INADA Naoki 2f80e154f2 (python) Fix typo in ChangeLog 2011-06-24 00:04:43 +09:00
FURUHASHI Sadayuki cc0114c482 cpp: fixed configure.in for gcc 3.x support 2011-06-12 15:16:13 +09:00
FURUHASHI Sadayuki e5e2b9095c updated README.md 2011-06-12 14:47:29 +09:00
FURUHASHI Sadayuki 6977edc032 Merge branch 'master' of github.com:msgpack/msgpack 2011-06-12 14:46:39 +09:00
Kazuki Ohta 177cc55ee5 s/msgpack.sourceforge.net/msgpack.org/ 2011-06-12 14:44:57 +09:00
FURUHASHI Sadayuki feb7ec03ba Merge branch 'master' of github.com:msgpack/msgpack 2011-06-12 14:37:51 +09:00
FURUHASHI Sadayuki 6630a643d3 Merge pull request #51 from polrop/fix-cpp-check-when-builddir-diff-srcdir
Fix make check when builddir != srcdir.
2011-06-11 22:36:25 -07:00
Muga Nishizawa d70e64a434 Merge branch 'master' of git@github.com:msgpack/msgpack 2011-06-12 02:48:42 +09:00
Muga Nishizawa 896ad51102 java: add missing dependencies for Ant/Ivy builds 2011-06-12 02:48:14 +09:00
inada-n be6d6560a7 (python) make test pass with Python 2.5 2011-06-01 18:30:43 +09:00
INADA Naoki 709d0cc33e Revert "(python) Change error message for unicode is passed but no encoding is"
This reverts commit bd73742552.
2011-05-31 15:40:11 +09:00
INADA Naoki bd73742552 (python) Change error message for unicode is passed but no encoding is
specified.
2011-05-31 14:10:46 +09:00
INADA Naoki ed4518e09a Merge branch 'pyunicode' of https://github.com/tailhook/msgpack 2011-05-31 13:03:41 +09:00
Vasily Titskiy 6c8301eae8 Merge branch 'gcc-3.x-support' 2011-05-26 13:31:59 -04:00
Vasily Titskiy 6e30d504e3 Merge branch 'fix-unaligned-access' 2011-05-26 13:31:37 -04:00
Vasily Titskiy cee09a0261 Add support for GCC 3.x (no _sync* atomic builtins)
Use atomic routines from libstdc++ instead.
2011-05-26 13:27:25 -04:00
Vasily Titskiy 76a72558b3 Fix all unaligned writes on ARM platform 2011-05-26 13:03:57 -04:00
FURUHASHI Sadayuki 22124a33ce java: DefaultTemplate: uses lookupType.toString() instead of lookupType.getClass().getName() 2011-05-18 02:09:29 +09:00
FURUHASHI Sadayuki 3731373de1 ruby: 0.4.5 2011-05-09 22:35:35 +09:00
FURUHASHI Sadayuki bbaf8c2f67 ruby: FIXNUM_P(self) may be false in Fixnum on JRuby 2011-05-09 22:06:12 +09:00
FURUHASHI Sadayuki f50694cc96 ruby: improves compatibility with JRuby 2011-05-09 21:59:55 +09:00
Nicolas Despres 4930ea7dab Fix make check when builddir != srcdir.
make check was not able to compile test programs when the builddir is not
the same than the srcdir, because relative path were used.
2011-04-28 16:11:24 +02:00
takeshita 96bb4cf49d pom.xmlを修正 2011-04-27 12:24:47 +09:00
takeshita 5e7563ac5b Merge branch 'master' of git://github.com/msgpack/msgpack
Conflicts:
	java/pom.xml
2011-04-27 01:07:17 +09:00
takeshita f199b80453 Fix big bug.
I had gotten order of MessagePackObject field from order of reflection methods.But it changes depends on order of calling in some environment(Scala's optimization or Java's specification?).
So I change to get it from order of reflection fields.
2011-04-27 01:04:49 +09:00
Kazuki Oikawa 5de8eec206 Merge branch 'master' of git://github.com/kazuki/msgpack 2011-04-24 02:02:35 +09:00
frsyuki 076bd07f39 cpp: version 0.5.6 2011-04-24 00:23:08 +09:00
FURUHASHI Sadayuki 00e897503b java: fixes typo on CHANGES.txt 2011-04-24 00:11:34 +09:00
FURUHASHI Sadayuki 2f3c47f385 java: version 0.5.2-devel 2011-04-23 23:57:27 +09:00
Muga Nishizawa 2b28211701 MSGPACK-6 added new TemplatePrecompiler function 2011-04-23 22:47:44 +09:00
Muga Nishizawa 46c794fc2e java: added test program for TemplatePrecompiler 2011-04-23 22:37:08 +09:00
Muga Nishizawa 0408738b48 java: write test program for TemplatePrecompiler 2011-04-23 19:19:05 +09:00
Kazuki Oikawa 6cfea98501 csharp: add license, rename filename/namespace. 2011-04-23 14:44:22 +09:00
Kazuki Oikawa 33498d3673 csharp: Refactoring IL code generator & add two compiled packer implementation (dynamic-method, method-builder) 2011-04-23 14:14:12 +09:00
takeshita ed3ead06fe Implement array message pack 2011-04-20 20:35:23 +09:00
frsyuki eb8a338a0e cpp: unpacker::release_zone() calls msgpack_unpacker_release_zone() #42 2011-04-17 08:25:55 +09:00
frsyuki 23480bfe8a cpp: fixed missing ctx.user.z = z and release_zone uses pointer swapp instead of copying #42 2011-04-17 08:24:33 +09:00
frsyuki 3384dbc92d cpp: fixes test/streaming_c.cc #42 2011-04-17 08:21:52 +09:00
frsyuki 8446549ed8 Merge branch 'master' of github.com:msgpack/msgpack 2011-04-17 06:49:36 +09:00
frsyuki 6a9f3ae71d c: fixed a double-free problem on msgpack_unpacker_release_zone #42 (aikar++) 2011-04-17 06:48:36 +09:00
Kazuki Oikawa 94e5b0d78f csharp: fix char pack/unpack problem on Mono 2011-04-17 00:33:37 +09:00
Kazuki Oikawa 0812eb1c04 add System.Reflection.Emit based CompiledPacker implementation 2011-04-16 21:12:04 +09:00
tailhook 8cb5ccad99 Implemented encoding for strings
* Packer by default uses `utf-8` encoding by default
* Unpacker uses `None` by default, so no decoding is done
* Both pack and unpack has `encoding` and `unicode_errors` arguments,
  if `encoding` is `None` no encoding/decoding is done, otherwise
  it is python codec. `unicode_errors` is supplied as `errors`
  parameter to codec
2011-04-15 18:39:17 +03:00
takeshita 743d69ec0b Change property ordering based on getter methods to setter methods.
Add test to confirm field order.
2011-04-14 16:34:52 +09:00
takeshita f6de4c9479 Merge branch 'master' of git://github.com/msgpack/msgpack 2011-04-14 15:44:46 +09:00
takeshita fb59927d32 scala:Fix bug when companion class does not have apply() method, scala message pack throws exception. 2011-04-14 15:44:22 +09:00
FURUHASHI Sadayuki c58ce1a975 MSGPACK-7 added -source 1.5 -target 1.5 options to javac 2011-04-12 18:41:08 +09:00
FURUHASHI Sadayuki c6d9bbd7b0 MSGPACK-7 fixed test cases; iteration order of HashMap is not defined by JDK 5/6 specification 2011-04-12 18:39:54 +09:00
Kazuki Oikawa 08974f00ed Merge branch 'master' of github.com:kazuki/msgpack 2011-04-10 14:24:26 +09:00
Kazuki Oikawa 60643f023f csharp: add ObjectPacker 2011-04-10 12:52:14 +09:00
Muga Nishizawa 65ddd1a455 java: add test program for TemplatePrecompiler 2011-04-10 02:33:46 +09:00
Kazuki Oikawa 68a98d3dd0 csharp: remove reference Microsoft.VisualStudio.QualityTools.UnitTestFramework 2011-04-10 02:03:40 +09:00
Kazuki Oikawa ca9015452e csharp: add Makefile 2011-04-10 01:38:03 +09:00
Kazuki Oikawa 05ac2603e6 csharp: add BoxingPacker tests 2011-04-10 01:06:26 +09:00
Kazuki Oikawa 8e923777b8 csharp: fix fixraw prefix 2011-04-09 22:16:24 +09:00
Kazuki Oikawa 8949551c2e Add MsgPackReader/MsgPackWriter unit tests 2011-04-09 22:12:44 +09:00
Kazuki Oikawa 0b45e9442b csharp: add type check helper 2011-04-09 21:22:15 +09:00
Kazuki Oikawa 1d1a9d7933 import C# implementation 2011-04-09 21:17:05 +09:00
Muga Nishizawa 58c0fe0f91 java: Refactored template builders again 2011-04-09 21:10:15 +09:00
Muga Nishizawa b96b62f2ac scala: deleted the AUTHORS file 2011-04-08 16:20:28 +09:00
Muga Nishizawa 43fc0a52a6 scala: added a new AUTHORS file and edited pom.xml 2011-04-08 16:17:25 +09:00
Muga Nishizawa 4f3d9a1ded Refactored programs related to TemplateBuilder.java 2011-04-08 16:13:29 +09:00
FURUHASHI Sadayuki b50ff920f0 MSGPACK-5 added test cases for Unpacker.unpackXxx() methods 2011-04-07 23:21:56 +09:00
FURUHASHI Sadayuki 983ae0c5a2 MSGPACK-4 BufferedUnapckerImpl.unpackInt: more(4)+advance(4) -> more(5)+advance(5) 2011-04-07 23:21:30 +09:00
FURUHASHI Sadayuki 9d4db84987 MSGPACK-4 BufferedUnpackerImpl.unpackLong: more(4)+advance(4) -> more(5)+advance(5) 2011-04-07 22:32:59 +09:00
takeshita 1f372cf0cc Merge branch 'master' of github.com:geishatokyo/msgpack
Conflicts:
	java/src/main/java/org/msgpack/template/TemplateClassWriter.java
2011-04-07 01:07:10 +09:00
takeshita c43d597aa9 pom.xmlファイルを修正。 2011-04-07 01:04:29 +09:00
Muga Nishizawa dfaa281476 java: Fixed TemplateClassWriter.java but, it doesn't work. 2011-04-07 00:38:21 +09:00
takeshita df14629a25 Fix compile error.
This is a workaround.Please fix correctly in the future.
2011-04-07 00:07:49 +09:00
Muga Nishizawa c1c25c455c scala: Modified pom.xml. I changed version of 'MessagePack for Java' from 0.5.1-devel to 0.5.2-SNAPSHOT 2011-04-06 08:52:14 +09:00
Muga Nishizawa e65197f386 Merge branch 'master' of https://github.com/watabiki/msgpack 2011-04-06 01:18:12 +09:00
Muga Nishizawa ecbb8f8711 java: Merged takezoux2's branch for 'MessagePack for Scala' 2011-04-06 00:50:58 +09:00
Watabiki Naoya 03aa736199 java: update BigDecimalTemplate, TestPackConvert and TestPackUnpack 2011-04-05 23:26:53 +09:00
Muga Nishizawa 821b1f0384 Merge branch 'master' of git@github.com:msgpack/msgpack 2011-04-05 03:35:08 +09:00
Muga Nishizawa 233ad3aaff java: Updated several property files in .settings 2011-04-05 03:34:11 +09:00
Muga Nishizawa 9c4812f4d4 java: Fixed RawType's bug that hash values of same byte arrays (raw data) are different 2011-04-05 03:30:43 +09:00
Muga Nishizawa 337cc9fa78 java: Fixed a bug that NullPointerException occurs within DefaultTemplate.java 2011-04-05 01:27:51 +09:00
Muga Nishizawa dfe29a0329 Merge branch 'master' of git@github.com:msgpack/msgpack 2011-04-05 00:52:30 +09:00
Muga Nishizawa 85e90aa81e java: Improved DefaultTemplate.java. It allows displaying details of exception messages 2011-04-05 00:51:53 +09:00
Hideyuki Tanaka 86d30fe571 haskell: reduce dependency of template-haskell 2011-04-04 23:33:02 +09:00
mzp 173302267f ocaml: upadte build file 2011-04-04 18:28:37 +09:00
Muga Nishizawa 8e3ea8d26c java: edit TemplateRegistry.java 2011-04-04 02:28:24 +09:00
Muga Nishizawa cb065563c2 Merge branch 'master' of git@github.com:msgpack/msgpack 2011-04-04 01:59:34 +09:00
Muga Nishizawa 27b89b237b java: prototyped TemplateClassWriter, which is program for writing class file of generated tmplate class 2011-04-04 01:59:13 +09:00
takeshita 21f0d0bfc4 Delete moved class.
(TemplateBuilder.java is moved to org.msgpack.template.builder)
2011-04-04 01:46:29 +09:00
takeshita d5e583b09e Implement Scala MessagePack.
Change Java MessagePack to fit Scala's.
Minor version up for Java's MessagePack.
2011-04-04 01:37:24 +09:00
UENISHI Kota 15fb9bbcb2 Merge branch 'master' of https://github.com/moriyoshi/msgpack 2011-04-03 19:52:34 +09:00
Muga Nishizawa a03418ab12 java: edit BuiltInTemplateLoader.java 2011-04-03 19:42:43 +09:00
Muga Nishizawa 035513844d Merge branch 'master' of git@github.com:msgpack/msgpack 2011-04-03 19:11:56 +09:00
Muga Nishizawa 193906b8ce java: insert codes for initializing BigDecimalTemplate and DateTemplate instances to Templates.java 2011-04-03 19:10:34 +09:00
Moriyoshi Koizumi d354f2e8c2 Documentation. 2011-04-03 19:09:14 +09:00
Watabiki Naoya 24a8ee436f add DateTemplate and BigDecimalTemplate 2011-04-03 18:39:41 +09:00
mzp 6e5f9404b7 ocaml: initial commit 2011-04-03 17:11:53 +09:00
Moriyoshi Koizumi 64fe90aabb Add TestUnpackFloat(). 2011-04-03 15:34:37 +09:00
Moriyoshi Koizumi 7e31d487e0 float type was gone from go language at some time I don't know. 2011-04-03 14:06:08 +09:00
moriyoshi ee16e2eb30 Handle unsupported typecode 2011-04-03 11:14:49 +09:00
moriyoshi 003fb3392f Byte arrays in Go should not be serialized as arrays. 2011-04-03 11:14:49 +09:00
moriyoshi 0e82278cd5 Fix: InterfaceValue wasnt' correctly unwrapped when passed to PackValue() 2011-04-03 11:14:49 +09:00
moriyoshi 5b544248bc Add new API function UnpackReflected() that returns multiple reflect.Value for unpacked elements of arrays or maps. 2011-04-03 11:14:49 +09:00
moriyoshi d4d7495c0a Forgot to support map16 / map32 2011-04-03 11:14:48 +09:00
moriyoshi 8325cce44c Adapt to new reflection API (notified by mattn. thanks) 2011-04-03 11:14:48 +09:00
moriyoshi ee0debc5b3 Add .gitignore 2011-04-03 11:14:48 +09:00
moriyoshi 8f1bd12a17 Improve testsuite. 2011-04-03 11:14:10 +09:00
moriyoshi fccf1016e4 Fix bugs in unpacker. 2011-04-03 11:14:10 +09:00
moriyoshi 1b010a082b Add go binding. 2011-04-03 11:14:10 +09:00
Hideyuki Tanaka 324f215316 haskell: version bump 2011-03-29 16:17:46 +09:00
Hideyuki Tanaka ace4f1e7f0 fix encoding unicode strings, and Text support 2011-03-29 16:15:29 +09:00
Hideyuki Tanaka 5c5f16f148 haskell: version bump 2011-03-18 00:46:43 +09:00
Hideyuki Tanaka f50855d5c0 fix for packing and unpacking Object 2011-03-18 00:44:15 +09:00
Muga Nishizawa 86917b0ba7 improved constructor in JavassistTemplateBuilder class. This improvement is based on https://github.com/msgpack/msgpack-rpc/issues#issue/13. 2011-03-11 12:24:09 +09:00
Hideyuki Tanaka 7201fcbe0f remove Iteratee dependency 2011-03-10 22:17:15 +09:00
Hideyuki Tanaka 83f1735fbb fix description 2011-03-09 18:06:57 +09:00
Hideyuki Tanaka 80fd8e70f0 update library version. 2011-03-09 17:02:01 +09:00
Hideyuki Tanaka 698c1c2b7a Merge git://github.com/xanxys/msgpack into pull-master 2011-03-09 16:19:19 +09:00
Yuto Hayamizu 5d3287f5aa gtest requires pthread 2011-03-03 06:42:14 +09:00
Yuto Hayamizu 6990fe6f51 remove duplicated code 2011-03-03 06:38:09 +09:00
Yuto Hayamizu 0b81068368 /cpp/preprocess: fix string comp. operator 2011-03-03 06:27:31 +09:00
FURUHASHI Sadayuki 5b1851ae22 cpp: version 0.5.5 2011-02-24 00:35:00 +09:00
FURUHASHI Sadayuki 0d5708a01d cpp: fixes problem that InterlockedIncrement/Decrement are not found on _WIN32 platform 2011-02-24 00:21:54 +09:00
FURUHASHI Sadayuki 67ab510b5d cpp: fixes some implicit cast warnings 2011-02-23 23:48:26 +09:00
FURUHASHI Sadayuki d1264a1289 cpp: fixes msgpack_vc.postbuild.bat 2011-02-23 23:47:33 +09:00
FURUHASHI Sadayuki 3b973021a1 sysdep.h: eliminated #include <winsock2.h> 2011-02-23 23:46:39 +09:00
INADA Naoki 182624895f python: Remove UnpackIterator. Unpacker is iterator of itself. 2011-01-30 10:45:39 +09:00
INADA Naoki 548de3739c python: Disable gc while deserializing. 2011-01-29 23:23:56 +09:00
INADA Naoki 718a3efd64 python: Fix segmentation fault when default returns it's argument. 2011-01-29 23:22:41 +09:00
INADA Naoki 76b8c3250b Merge branch 'master' of github.com:msgpack/msgpack 2011-01-29 07:31:59 +09:00
INADA Naoki dafaa8bd8c python: 0.1.9 2011-01-29 07:31:06 +09:00
INADA Naoki 9c9b2c25ea python: refactoring. 2011-01-29 07:27:10 +09:00
INADA Naoki e89cd81022 Add use_list option to unpack and unpackb 2011-01-28 18:59:05 +09:00
advect 5debbd2be8 php: added unpack of class object converter 2011-01-16 17:35:10 +09:00
INADA Naoki fe26df5355 python: Add memory error check. 2011-01-10 20:47:23 +09:00
INADA Naoki 85778494e4 python: Check if (m|re)alloc's return value is NULL. (Thanks to Mateusz) 2011-01-10 05:07:07 +09:00
INADA Naoki a94ce3c715 python: Fix typo in docstring. (thanks to Mateusz.) 2011-01-10 05:05:14 +09:00
INADA Naoki a440ff1117 python: Change URL in setup.py from sf.net to msgpack.org 2011-01-10 00:10:29 +09:00
INADA Naoki 8195137bc5 python: msgpack-python-0.1.8 2011-01-09 23:58:26 +09:00
INADA Naoki 3e2bd25e4e python: Fix another segv. 2011-01-09 23:54:06 +09:00
INADA Naoki ffd0c2f624 python: Fix segv on unpacking from stream. 2011-01-09 23:40:09 +09:00
INADA Naoki 23333c98d7 python: Add test for issue29. 2011-01-09 23:29:18 +09:00
INADA Naoki 5a12ab98c4 python: Make aliases for API compatibility to pickle.
``dumps`` is alias of ``packb`` and ``loads`` is alias of ``unpacks``.
2011-01-09 23:17:20 +09:00
INADA Naoki 0b327a63fc python: Don't use `from __future__ import unicode_literals`.
Python 2.5 or older doesn't support it.
2011-01-09 23:13:35 +09:00
INADA Naoki 15b28a245c python: Update ChangeLog. 2011-01-09 23:06:56 +09:00
INADA Naoki 6ef5684797 Merge branch 'master' of github.com:msgpack/msgpack 2011-01-08 17:45:13 +09:00
xanxys d439b1495b haskell: add ObjectFloat to send floats, and Assoc to make map (un)packing explicit 2010-12-28 19:22:37 +09:00
advect 9e096a3f0e php: version 0.3.4: supported Windows building 2010-12-28 16:09:13 +09:00
advect 0acf6ec150 php: version 0.3.3 2010-12-27 11:09:14 +09:00
Muga Nishizawa 4b36340474 java: refactor JavassistTemplateBuilder.java 2010-12-23 15:51:04 +09:00
FURUHASHI Sadayuki 910e642a8b java: version 0.5.1 2010-12-14 18:21:53 +09:00
FURUHASHI Sadayuki 9f571146fb java: fixes cast error on GenericArrayType 2010-12-14 17:47:45 +09:00
FURUHASHI Sadayuki 339725f73d java: throws MessagePackException if target==null on *ArrayTemplate 2010-12-13 18:52:25 +09:00
Muga Nishizawa aff964c58b java: fixed a bug within CollectionTemplate.java 2010-12-12 00:48:31 +09:00
Muga Nishizawa 0c07e745f8 java: change spec. of pack methods in ListTemplate and MapTemplate as follow: If user passes null object to the pack method, MessageTypeException is thrown. 2010-12-12 00:47:20 +09:00
Muga Nishizawa 419d2e9564 java: change spec. of pack methods in several template classes as follow: If user passes null object to the pack method, MessageTypeException is thrown. 2010-12-12 00:46:05 +09:00
Muga Nishizawa f936a307c6 java: add test methods for CollectionTemplate and change spec. of several test methods 2010-12-12 00:38:13 +09:00
Muga Nishizawa 4e4678edfa java: add packByteBuffer method in Packer.java because I needed non-nullcheck pack(ByteBuffer) for refining ByteBufferTemplate.java 2010-12-12 00:35:43 +09:00
FURUHASHI Sadayuki cb7a4b3116 java: version 0.5.0 2010-12-09 23:36:27 +09:00
FURUHASHI Sadayuki 5ca4c42a74 Merge branch 'master' of github.com:msgpack/msgpack 2010-12-09 23:28:23 +09:00
FURUHASHI Sadayuki 1238a7ca07 java: adds AUTHORS file 2010-12-09 23:28:16 +09:00
Muga Nishizawa a9db60a73d java: replace reflective method calls with base-level method calls in JavassistTemplateBuilder.java 2010-12-09 23:25:11 +09:00
FURUHASHI Sadayuki bd32ac19d4 java: removes old benchmark codes 2010-12-09 23:01:04 +09:00
FURUHASHI Sadayuki eaf9944e43 java: added ElementType.PARAMETER to the target of @Ignore, @Index, @Nulable, @Optional and @Required annotations for RPC 2010-12-09 17:31:29 +09:00
FURUHASHI Sadayuki 703fdbc01d java: array type support 2010-12-08 19:38:12 +09:00
FURUHASHI Sadayuki 2daa08b0e7 java: disabled ObjectArrayTempalte - it doesn't work 2010-12-06 00:13:05 +09:00
FURUHASHI Sadayuki 05d9d22d9e java: fixes native zero-copy unpacking routines of ByteBuffer 2010-12-03 22:56:04 +09:00
FURUHASHI Sadayuki 8b7894f9bd java: fixes comments in TemplateBuffer.java 2010-12-03 22:54:20 +09:00
Muga Nishizawa a71439607f java: performance improvement for ByteBufferTemplate 2010-12-03 21:53:29 +09:00
Muga Nishizawa aca0d7f969 java: refactor ByteBufferTemplate.java 2010-12-02 01:11:55 +09:00
Muga Nishizawa 310a8e4342 Merge branch 'master' of git@github.com:msgpack/msgpack
Conflicts:
	java/src/main/java/org/msgpack/MessagePack.java
2010-12-02 00:54:28 +09:00
FURUHASHI Sadayuki 24fbe1ef5b java: uses ReflectionTemplateBuilder instead of JavassistTempalteBuilder where System.getProperty("java.vm.name") == "Dalvik" 2010-12-01 23:27:36 +09:00
FURUHASHI Sadayuki 33d8faa35d java: JavassistTemplateBuilder: fixes comments 2010-12-01 23:15:55 +09:00
FURUHASHI Sadayuki 44be714f65 java: adds JavassistTemplateBuilder.addClassLoader method 2010-12-01 22:59:33 +09:00
FURUHASHI Sadayuki 0df3da6b10 java: adds TemplateRegistry.setTemplateBuilder method 2010-12-01 22:59:20 +09:00
FURUHASHI Sadayuki 79197b6ec7 java: more test cases of TemplateBuilder 2010-12-01 22:44:38 +09:00
FURUHASHI Sadayuki 353b6b51cb java: adds TemplateBuildException 2010-12-01 22:44:24 +09:00
FURUHASHI Sadayuki bd9a2c0d3a java: migrates from util.codegen to TemplateBuilder 2010-12-01 22:42:55 +09:00
Muga Nishizawa 53b0ee6536 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-12-01 21:20:10 +09:00
FURUHASHI Sadayuki 78daac0f1b java: adds type.RawTemplate 2010-12-01 20:49:41 +09:00
FURUHASHI Sadayuki b970b9b9a8 java: adds JavassistTemplateBuilder 2010-12-01 20:39:11 +09:00
FURUHASHI Sadayuki 0339db57f1 java: adds TemplateBuilder and ReflectionTemplateBUilder 2010-12-01 20:38:58 +09:00
FURUHASHI Sadayuki 461b147897 java: uses TemplateRepostry as default 2010-12-01 20:37:32 +09:00
FURUHASHI Sadayuki a3cd13b399 java: adds actual generic templates 2010-12-01 20:36:52 +09:00
FURUHASHI Sadayuki eb5d326a1e java: adds GenericTemplates 2010-12-01 20:34:33 +09:00
FURUHASHI Sadayuki cce6eb94e2 java: adds DefaultTemplate 2010-12-01 20:34:23 +09:00
FURUHASHI Sadayuki 8311c72c69 java: adds BultInTemplateLoader 2010-12-01 20:33:38 +09:00
FURUHASHI Sadayuki 9a059285d9 java: registers buit-in templates to TemplateRegistry 2010-12-01 20:32:22 +09:00
FURUHASHI Sadayuki 469ac7891d java adds TemplateRegistry that replaces CustomMessage 2010-12-01 20:25:06 +09:00
FURUHASHI Sadayuki 16264a5693 java: adds array templates 2010-12-01 20:24:36 +09:00
FURUHASHI Sadayuki 6eedb50f56 java: adds TemplateBuilder and ReflectionTemplateBuilder 2010-11-30 21:59:07 +09:00
FURUHASHI Sadayuki 5f07215662 java: adds @Requred, @Ignore and @Index annotations 2010-11-30 21:58:24 +09:00
FURUHASHI Sadayuki d3a02fb2ca java: @MessagePackMessage(default field option) 2010-11-30 21:57:12 +09:00
FURUHASHI Sadayuki 2c823f1aaa java: uses bit shift operations instead of ByteBuffer.putXxx 2010-11-30 21:55:45 +09:00
FURUHASHI Sadayuki 706293aadc java: adds type.Raw 2010-11-30 15:34:32 +09:00
FURUHASHI Sadayuki dfdceb4258 java: updates VectoredByteBuffer 2010-11-29 18:37:47 +09:00
FURUHASHI Sadayuki 0014b7fdb9 java: adds VectoredByteBuffer 2010-11-29 18:01:39 +09:00
FURUHASHI Sadayuki 3b28f1f8af ruby: buffer size limit (disabled at present) 2010-11-28 23:13:53 +09:00
FURUHASHI Sadayuki c689d476ca Merge remote branch 'egtra/master' 2010-11-24 18:05:50 +09:00
FURUHASHI Sadayuki cc534fd21f ruby: adds Unpacker#feed_each 2010-11-24 17:24:55 +09:00
egtra 124efcf247 improve msvc support 2010-11-23 23:32:55 +09:00
Muga Nishizawa dd452b05e3 java: rollback MessagePack.java 2010-11-19 02:57:42 +09:00
Muga Nishizawa b5617f7df9 java: refactor register method in MessagePack.java for TemplateProvider 2010-11-19 01:58:30 +09:00
Muga Nishizawa b73ca1ba3a java: edit MessagePack.java for TemplateProvider 2010-11-19 01:46:31 +09:00
Muga Nishizawa 39ad071c4f java: fixed a bug that javassist cannot find class files that were loaded by custom class loader 2010-11-18 22:26:58 +09:00
Muga Nishizawa fa0b576a45 java: Fixed a bug that ClassTemplate cannot pack a ByteBuffer object but, it is a temporary impl. 2010-11-11 13:38:15 +09:00
frsyuki c2c7591987 java: version 0.4.3-devel 2010-11-10 00:54:49 +09:00
frsyuki 3e939e3775 java: fixes MessagePackObject.convert(Template, T) 2010-11-10 00:53:15 +09:00
frsyuki f6384e10bc java: adds test for DynamicOrdinalEnumTemplate 2010-11-10 00:32:25 +09:00
frsyuki c283842563 java: MessagePackOptional -> Optional, MessagePackNullable -> Nullable 2010-11-10 00:16:23 +09:00
frsyuki 1135976225 java: adds MessagePack.unpack(Class<?>, FieldList) 2010-11-09 23:51:58 +09:00
frsyuki 76679d33df java: changes Template interface: unpack(Unpacker, Object to = null), convert(MessagePackObject from, Object to = null) 2010-11-09 23:43:16 +09:00
frsyuki e9d44b90bc java: adds FieldList class 2010-11-09 22:11:47 +09:00
Muga Nishizawa 8a7a391166 java: delete ByteBufferTemplate.java in org.msgpack.util.codegen package 2010-11-09 10:13:55 +09:00
Muga Nishizawa d6c5a9eece delete a dead code within DynamicCodeGen.java 2010-11-09 09:57:23 +09:00
Muga Nishizawa 56ad6915d0 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-11-09 09:28:38 +09:00
frsyuki 466c260782 java: version 0.4.2-devel 2010-11-09 03:16:00 +09:00
frsyuki d8e2d1725a java: MessagePack.unpack(InputStream) throws IOException 2010-11-09 02:57:49 +09:00
frsyuki 33b43d03ac java: adds MessagePackNullable annotation 2010-11-09 02:46:23 +09:00
frsyuki 517509db6e java: adds NullableTemplate 2 2010-11-09 02:07:53 +09:00
frsyuki 95f01a5976 java: adds MessagePackObject.unpack(Class<T> klass) 2010-11-09 02:07:50 +09:00
frsyuki d08d3bf56d java: adds NullableTemplate 2010-11-09 01:07:25 +09:00
frsyuki 587fd669e8 java: adds ByteBufferTemplate 2010-11-08 23:20:27 +09:00
Muga Nishizawa e3553b87fe java: move ByteBufferTemplate.java to org.msgpack.util.codegen package 2010-11-06 11:31:40 +09:00
Muga Nishizawa a078d2360c java: add temporal implementation of ByteBufferTemplate.java 2010-11-06 00:59:32 +09:00
frsyuki 2d3abf8e6e java: version 0.4.1-devel 2010-11-05 19:21:27 +09:00
Muga Nishizawa cacae0fb7d java: refactor DynamicCodeGen.java and Constants.java. Thanks frsyuki for fixing a bug in DynamicCodeGen.java 2010-11-04 02:00:34 +09:00
INADA Naoki d7fc215c16 python: 0.1.7 2010-11-03 03:43:49 +09:00
INADA Naoki bb69aa18f2 python: Add ws2_32 library if platform is win32. 2010-11-03 03:35:52 +09:00
INADA Naoki e4f515166a python: Add ChangeLog.rst 2010-11-03 03:26:33 +09:00
INADA Naoki f325acb0ea Merge branch 'master' of github.com:msgpack/msgpack 2010-11-03 03:19:28 +09:00
INADA Naoki d1b6e65dd8 python: Port some tests from 2 to 3. 2010-11-03 03:15:12 +09:00
INADA Naoki 4688252bd4 python: Support old buffer protocol when unpack. (experimental) 2010-11-03 03:11:00 +09:00
INADA Naoki b1df5d3ad7 python: Add test for unpacking buffer object. 2010-11-02 14:09:50 +09:00
INADA Naoki 09bad2938e python: Add msgpack/_msgpack.c to .gitignore 2010-11-02 14:02:10 +09:00
advect bad69fd397 php: fiexed unpacker 2010-10-30 16:06:50 +09:00
Fuji, Goro b4ae6bf82c perl: disable warnings 2010-10-30 13:04:30 +09:00
Fuji, Goro eac0f83864 perl: check data strictly; which is slow, but required 2010-10-30 12:38:32 +09:00
Fuji, Goro 3f16f080ac perl: add failing tests for PP 2010-10-30 01:09:12 +09:00
Fuji, Goro 5de2b974fb perl: ord(substr(...)) *is* faster than unpack() 2010-10-30 00:42:00 +09:00
Fuji, Goro 6a9cb51828 perl: modify internal names for the next refactoring 2010-10-30 00:31:41 +09:00
Fuji, Goro f1c294ca50 perl: make error messages compatible with XS 2010-10-30 00:28:53 +09:00
Fuji, Goro c320e44a23 perl: update Unpacker.pod 2010-10-28 17:26:04 +09:00
Fuji, Goro ea36ef3107 perl: tests 2010-10-28 17:05:41 +09:00
Fuji, Goro fedc37d079 Revert "perl: cleanup"
This reverts commit bc8d8ab65a.
2010-10-28 16:31:19 +09:00
Fuji, Goro 86ccfcc03c perl: changelogging 2010-10-28 16:25:19 +09:00
Fuji, Goro bc8d8ab65a Revert "Revert "perl: cleanup""
This reverts commit a7a23d3bc8.
2010-10-28 16:17:53 +09:00
Fuji, Goro a7a23d3bc8 Revert "perl: cleanup"
This reverts commit 82d33944e6.
2010-10-28 16:16:12 +09:00
Fuji, Goro 82d33944e6 perl: cleanup 2010-10-28 16:08:20 +09:00
Fuji, Goro 8a629ad6fb Fix streaming unpacking for splitted packed data 2010-10-28 15:49:22 +09:00
INADA Naoki e1711ffcf2 Add list_hook option to unpacker. 2010-10-26 02:09:52 +09:00
INADA Naoki 063d51c662 Add check for recursion limit and default hook result. 2010-10-26 01:49:00 +09:00
INADA Naoki d8e3575a46 Remove unnecessary refcount manipulation. 2010-10-26 01:32:08 +09:00
INADA Naoki 6fa609be3f Add test for Python3. 2010-10-26 01:31:27 +09:00
INADA Naoki 70982e204c Add object_hook option to unpack and default option to pack.
(see simplejson for how to use).
2010-10-26 01:26:06 +09:00
frsyuki 2af7df5865 java: fixes MessagePack.unpack method 2010-10-25 14:49:14 +09:00
frsyuki 59610e81de java: DynamicCodeGen::insertCodeOfUnpackMethodBody unpacks last optional field of classes correctly 2010-10-25 14:18:41 +09:00
Muga Nishizawa cdfac703ef java: merge CustomMessage.java and DynamicCodeGenBase.java that can be not merged automatically 2010-10-24 23:24:27 +09:00
Muga Nishizawa ad5ebd007e java: refactor org.msgpack.util.codegen.*.java 2010-10-24 23:10:07 +09:00
frsyuki 1bd347d997 java: fixes CustomMessage class 2010-10-24 21:17:19 +09:00
frsyuki 147056073d java: improves test case of the MessagePack class 2010-10-24 21:04:31 +09:00
frsyuki 1b3231e617 java: improves test case of the MessagePack class 2010-10-24 20:59:19 +09:00
frsyuki 7ac4ad3e38 java: adds MessagePack.register methods 2010-10-24 20:46:22 +09:00
frsyuki 0a345cb12b java: fixes CollectionTemplate 2010-10-24 20:16:37 +09:00
frsyuki 19ff0dd17f java: fixes ListTemplate and MapTemplate 2010-10-24 20:11:39 +09:00
frsyuki e3bf8a404b java: adds MessagePack class 2010-10-24 19:32:45 +09:00
frsyuki dbb28d9a8f java: Template extends MessagePacker 2010-10-24 18:46:48 +09:00
frsyuki 19fd4e755c java: removes ReflectionPacker and ReflectionTemplate (replaced by DynamicCodeGen) 2010-10-24 18:45:58 +09:00
Muga Nishizawa 77698cd924 java: change modifiers specified by several methods 2010-10-24 00:59:14 +09:00
Muga Nishizawa 945d279f28 java: fix a bug within a code of DynamicCodeGenBase.java 2010-10-24 00:40:58 +09:00
Muga Nishizawa 645d296841 java: add test programs for org.msgpack.util.codegen.FieldOption.java 2010-10-23 23:13:54 +09:00
Muga Nishizawa 57446de875 java: refactor org.msgpack.util.codegen.*.java 2010-10-23 23:13:17 +09:00
Muga Nishizawa 3473800ab6 java: not use a putIfAbsent method in ConcurrentHashMap class 2010-10-23 23:11:52 +09:00
Muga Nishizawa 7e5c5153a8 java: edit copyright notions in org.msgpack.annotation.*.java and org.msgpack.util.codegen.*.java 2010-10-23 14:50:32 +09:00
Muga Nishizawa 1b8979f285 java: refactor org.msgpack.util.codegen.*.java 2010-10-23 14:39:01 +09:00
Muga Nishizawa 2aac51dd20 java: append getter methods for element templates in org.msgpack.template.ListTemplate.java, MapTemplate.java and OptionalTemplate.java 2010-10-23 14:37:24 +09:00
Muga Nishizawa 69e32d264c java: write test programs for OptionalTemplate.java 2010-10-22 23:23:53 +09:00
frsyuki 71ae75a5bf java: adds OptionalPacker 2010-10-22 16:18:07 +09:00
frsyuki 86043fd87e java: adds OptionalTemplate 2010-10-22 08:31:03 +09:00
Fuji, Goro d8aaef4f04 perl: tests 2010-10-21 23:35:07 +09:00
Fuji, Goro 7fc34b6369 perl: tweaks 2010-10-21 23:27:26 +09:00
Fuji, Goro 92b346efa7 perl: clean up 2010-10-21 23:26:03 +09:00
Muga Nishizawa c790735b9f java: add test programs for org.msgpack.util.codegen.*.java 2010-10-21 02:02:23 +09:00
Muga Nishizawa 64711e615e java: write test programs for org.msgpack.util.codegen.*.java 2010-10-20 21:04:37 +09:00
frsyuki 2065affd45 java: adds CollectionTemplate 2010-10-20 16:40:25 +09:00
frsyuki 4067c56b5d java: supports Collection<T> to pack 2010-10-20 16:32:01 +09:00
tokuhirom 65515638aa perl: oops! added settings for shipit 2010-10-19 13:45:44 +09:00
tokuhirom 371ba3ffe3 Checking in changes prior to tagging of version 0.34.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 50177f4..486f1c3 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,6 @@
+0.34
+
+    - do not use the corrupt my_snprintf(%ll[du]) on win32(kazuho)

 0.33
2010-10-18 19:30:08 +09:00
Kazuho Oku 5395b62f2f shorter code, fix comment 2010-10-18 19:26:24 +09:00
Kazuho Oku 3e164eab26 do not use the corrupt my_snprintf(%ll[du]) on win32 2010-10-18 19:22:28 +09:00
Muga Nishizawa ad85533975 java: add a log4j.properties file for unit testing 2010-10-17 19:23:42 +09:00
Muga Nishizawa d6c2a97931 java: write test programs for org.msgpack.packer.*.java 2010-10-17 18:57:00 +09:00
Muga Nishizawa 17def94ba4 java: describe test programs for org.msgpack.template.*.java 2010-10-17 18:24:08 +09:00
Muga Nishizawa cf254ea240 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-10-17 14:37:35 +09:00
Muga Nishizawa 2d05110239 java: refactor DynamicCodeGenBase.java 2010-10-17 14:37:13 +09:00
Fuji, Goro 0017f4fce8 Checking in changes prior to tagging of version 0.33.
Changelog diff is:
2010-10-13 12:46:41 +09:00
Fuji, Goro 02f3dd947a perl: optimize PP 2010-10-13 12:46:11 +09:00
Fuji, Goro ef0874feba perl: tweaks for PreferInteger 2010-10-13 11:02:57 +09:00
Fuji, Goro 14aa1420f0 perl: comments 2010-10-13 10:54:37 +09:00
Fuji, Goro c506cd97e0 perl: tests 2010-10-13 10:43:56 +09:00
Fuji, Goro 3761aacb1d perl: cleanup PP 2010-10-13 10:14:31 +09:00
Fuji, Goro 233f13aac5 perl: add tests for unpacking 'float' 2010-10-13 10:03:56 +09:00
Fuji, Goro 0ced3ec2d2 perl: fix tests 2010-10-13 09:38:40 +09:00
Fuji, Goro 5b786f65a4 Checking in changes prior to tagging of version 0.32.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 6e07966..4657079 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,4 +1,8 @@

+0.32
+
+    - add tests to detect Alpha problems reported via CPAN testers (gfx)
+
 0.31

     - update Module::Install::XSUtil for ccache support (gfx)
2010-10-12 23:12:34 +09:00
Fuji, Goro 770542c8c7 perl: add tests 2010-10-12 23:10:59 +09:00
Fuji, Goro 4f1207a38c perl: add a strong assertion 2010-10-12 23:05:58 +09:00
Fuji, Goro 2b65f81e23 Add tests 2010-10-12 22:58:53 +09:00
Muga Nishizawa c10eb2c17b java: add the code for checking a null pointer to DynamicCodeGen.java 2010-10-11 01:30:42 +09:00
Muga Nishizawa 3f5ac54bf5 java: refactor the programs in a org.msgpack.util.codegen package 2010-10-09 21:53:49 +09:00
Muga Nishizawa 790f9409b1 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-10-07 23:53:22 +09:00
Muga Nishizawa a3d831b723 java: refactor DynamicCodeGen.java 2010-10-07 23:53:01 +09:00
Fuji, Goro b9483deea3 Checking in changes prior to tagging of version 0.31.
Changelog diff is:
2010-10-07 17:06:45 +09:00
Fuji, Goro c211d2ac45 Merge commit 'perl-0.30' 2010-10-07 17:05:37 +09:00
Fuji, Goro 119a03dd5f perl: changelogging 2010-10-07 16:56:36 +09:00
Fuji, Goro f3fbb7e1f6 perl: Update Makefile.PL using M::I::XSUtil 0.36 (support for ccache) 2010-10-07 16:54:49 +09:00
Fuji, Goro 2be98e8467 perl: changelogging 2010-10-07 16:18:47 +09:00
Fuji, Goro 91b1806e9d perl: add XS_VERSION_BOOTCHECK for safety 2010-10-07 16:16:59 +09:00
Fuji, Goro 8548b3645a perl: cleanup 2010-10-07 16:13:56 +09:00
Muga Nishizawa 4bbfb3f9a3 java: refactor DynamicCodeGen.java 2010-10-07 15:27:11 +09:00
Muga Nishizawa 98eec72522 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-10-07 13:01:33 +09:00
Muga Nishizawa 562d50df4d java: refactor several programs in a org.msgpack.util.codegen package 2010-10-07 13:01:06 +09:00
frsyuki f3ee5ab372 cpp: fixes ./bootstrap to surely run ./preprocess 2010-10-07 06:28:12 +09:00
INADA Naoki aa2a3e5b07 Add unicode testcase for Python2. 2010-10-07 03:07:52 +09:00
INADA Naoki 8467307239 Fix testcase for unicode. 2010-10-07 03:04:00 +09:00
INADA Naoki 90da951a6f Use PyUnicode_AsUTF8String() instead of o.encode('utf-8'). 2010-10-07 03:02:02 +09:00
tokuhirom 59f81b331c Checking in changes prior to tagging of version 0.30.
Changelog diff is:
2010-10-06 18:00:00 +09:00
Fuji, Goro 77a7d3d26a perl: Fix utf8 mode not to be reseted by $unpacker->reset method 2010-10-06 17:52:32 +09:00
tokuhirom 4321b80999 Checking in changes prior to tagging of version 0.29.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index b506234..333a824 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.29
+
+    - add $unpacker->utf8 mode, decoding strings as UTF-8.
+
 0.28

     - added more tests(gfx)
2010-10-06 12:29:31 +09:00
tokuhirom 4b93b06323 perl: regenerated README file 2010-10-06 12:27:41 +09:00
tokuhirom 96fb2e4b7c Merge branch 'perl-utf8-mode' of github.com:msgpack/msgpack 2010-10-06 12:24:36 +09:00
Muga Nishizawa 3dc1048dfb Merge branch 'master' of git@github.com:msgpack/msgpack 2010-10-05 20:47:41 +09:00
Muga Nishizawa 28f4bd5a67 java: edit test programs for org.msgpack.util.codegen.* 2010-10-05 20:47:03 +09:00
Muga Nishizawa b01c270889 java: refactor the programs in a org.msgpack.util.codegen package 2010-10-05 20:45:51 +09:00
Fuji, Goro 7c92f8a90b perl: improve docs 2010-10-05 17:47:27 +09:00
Fuji, Goro a4a04872a3 perl: add $unpacker->utf8 mode, decoding strings as UTF-8. 2010-10-05 17:10:10 +09:00
Fuji, Goro f2d13cd647 perl: make test code more simple 2010-10-05 15:58:49 +09:00
Fuji, Goro 9346908485 perl: remove tricky hacks 2010-10-05 15:55:38 +09:00
Fuji, Goro b3a7ba14f7 Merge branch 'master' of github.com:msgpack/msgpack 2010-10-05 15:53:57 +09:00
frsyuki 524ef9553c Merge branch 'master' of http://github.com/advect/msgpack into advect-master 2010-10-03 16:55:59 +09:00
Muga Nishizawa a85f6e72fe java: edit DynamicCodeGen.java 2010-10-03 02:09:01 +09:00
Muga Nishizawa 1ae6a41336 java: edit BasicConstants.java in org.msgpack.util.codegen 2010-10-02 23:37:08 +09:00
Muga Nishizawa 3ec55791c6 java: refactor DynamicCodeGen.java 2010-10-02 22:12:40 +09:00
Muga Nishizawa a3accd28ea java: insert logging codes into CustomConverter.java, CustomPacker.java, CustomUnpacker.java and util.codegen programs 2010-10-02 21:28:21 +09:00
Muga Nishizawa fc5bc84207 java: add a log4j.properties file in src/main/java/resources 2010-10-02 21:25:30 +09:00
Muga Nishizawa d8b4051d6d java: edit pom.xml to enable to using slf4j logger 2010-10-02 21:24:22 +09:00
Muga Nishizawa 804a1cc22d Merge branch 'master' of git@github.com:msgpack/msgpack 2010-10-02 17:44:00 +09:00
Muga Nishizawa cdd60e5f9c add a packer and unpacker for Enum types 2010-10-02 17:43:31 +09:00
frsyuki 7c76f07384 java: adds standard packer classes 2010-10-01 13:12:31 +09:00
frsyuki a3b1ef9527 java: Packer: supports Set 2010-10-01 12:51:09 +09:00
Muga Nishizawa 0bd4150a80 java: changes several methods declared in a DynamicCodeGen class 2010-09-30 01:17:44 +09:00
Muga Nishizawa 7f7f5253f2 java: adds a test program of the DynamicCodeGen class for packing and unpacking an object that has a field anntated by @MessagePackMessage 2010-09-30 00:55:56 +09:00
advect 2a0a847634 php: update 0.3.0 2010-09-29 08:47:06 +09:00
Muga Nishizawa 92ddb37ed3 java: add test programs for DynamicCodeGenPacker, Unpacker, Converter classes 2010-09-28 22:51:38 +09:00
Fuji, Goro 01f944e6bd perl: tiny tweaks 2010-09-28 20:35:05 +09:00
Muga Nishizawa 732c8d7350 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-09-28 19:12:17 +09:00
Muga Nishizawa 21678aeef5 java: moves a TestDynamicCodeGenPackerTemplate.java file to org.msgpack.util.codegen 2010-09-28 19:11:54 +09:00
tokuhirom cda1ca35a4 Merge branch 'master' of github.com:msgpack/msgpack 2010-09-28 16:02:29 +09:00
Muga Nishizawa 923580d2cd write a simple test program for a DynamicCodeGenPacker class 2010-09-28 15:31:55 +09:00
Muga Nishizawa 190af1d32b delete old programs: org.msgpack.util.codegen.MessagePackOptional, MessagePackRequired, MessagePackUnpackable, and PackUnpackUtil classes 2010-09-28 15:24:47 +09:00
Muga Nishizawa bffe0443f9 edit DynamicCodeGenPacker and DynamicCodeGenUnpacker class 2010-09-28 12:17:32 +09:00
Muga Nishizawa 29e99e229b Merge branch 'master' of git@github.com:msgpack/msgpack 2010-09-27 17:56:19 +09:00
Muga Nishizawa 2736b88dd5 edit Packer and Unpacker classes, and move org.msgpack.util.annotation.*.java to org.msgpack.util.codegen.*.java 2010-09-27 17:55:48 +09:00
frsyuki e739c60e9f java: pom.xml: v0.4 2010-09-27 17:42:22 +09:00
frsyuki 1c0afbc5c5 java: loads template classes when Unpacker, MessagePackObject or ClassTemplate is loaded 2010-09-27 17:42:00 +09:00
Muga Nishizawa ee1ba5c0f2 java: fixed a bug within a Packer class 2010-09-27 10:16:32 +09:00
Muga Nishizawa 02342ba540 java: refactor a Packer class 2010-09-27 10:10:10 +09:00
Muga Nishizawa 12a130e9bc Merge branch 'master' of git@github.com:msgpack/msgpack 2010-09-27 10:02:03 +09:00
Muga Nishizawa dfb97e7961 java: adds several annotations in an org.msgpack.annotation package and edits Packer.java and its test program 2010-09-27 10:00:47 +09:00
tokuhirom 54e03a62bd Checking in changes prior to tagging of version 0.28.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 82174fe..b506234 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,8 @@
+0.28
+
+    - added more tests(gfx)
+    - refactor the PP code(gfx)
+
 0.27

     - * 6d9a629 perl: modified trivial codes in PP::Unpacker(makamaka)
2010-09-27 08:35:26 +09:00
tokuhirom ec9659ff25 Merge branch 'master' of github.com:msgpack/msgpack 2010-09-27 08:32:10 +09:00
frsyuki 0a41b253f3 java: adds templates for primitive types 2010-09-27 04:27:44 +09:00
frsyuki 002b86198c java: adds ReflectionPacker and ReflectionTemplate 2010-09-27 04:17:20 +09:00
frsyuki 7161a235f1 java: uses CustomMessage class on Packer, Unpacker and ClassTemplate 2010-09-27 03:33:21 +09:00
frsyuki 391034a785 java: adds type-conversion mechanisms 2010-09-27 03:06:06 +09:00
frsyuki 446a7fbd67 java: adds CustomMessage class (currently not implemented on Packer, Unpacker and ClassTemplate) 2010-09-27 03:05:32 +09:00
advect 2ccb09434f Merge branch 'master' of http://github.com/msgpack/msgpack 2010-09-26 12:44:05 +09:00
frsyuki 7974060a40 cpp: zone: adds msgpack_zone_swap and msgpack::zone::swap 2010-09-26 11:37:37 +09:00
frsyuki e8abcc1765 cpp: sbuffer: check initial buffer size != 0 2010-09-26 11:36:57 +09:00
frsyuki 1be1927a1f Merge branch 'master' of github.com:msgpack/msgpack 2010-09-24 16:10:07 +09:00
tanakh 894ff71664 haskell: fix for empty constructor 2010-09-24 03:49:31 +09:00
tanakh 93bed9c5df haskell: finish template-haskell deriving implement 2010-09-24 01:24:13 +09:00
Muga Nishizawa 34c008adce java: refactor annotation-utilities 2010-09-23 20:40:50 +09:00
Muga Nishizawa 22ddd91b1f java: add several API to annotation-utilities 2010-09-23 20:38:54 +09:00
Muga Nishizawa e121f34407 java: refactor annotation-utilities and edit those test programs 2010-09-23 17:26:31 +09:00
Muga Nishizawa df8a3e870a java: refactor annotation-utilities 2010-09-23 16:18:23 +09:00
Muga Nishizawa 13b6708a09 java: append a code for generating a messageConvert method to annotation-utilities 2010-09-23 15:24:12 +09:00
tanakh 6aa196cf55 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-09-23 00:06:26 +09:00
tanakh 142493076a haskell: TH support and refactoring 2010-09-23 00:04:34 +09:00
gfx 3d905a7a4f perl: add tests for 'extra bytes' exceptions 2010-09-22 16:14:55 +09:00
gfx 0a8a6ed168 perl: cleanup PP 2010-09-22 15:59:21 +09:00
gfx 68b6fa46e6 perl: add tests for boolean values 2010-09-22 15:28:14 +09:00
gfx 80f7c54e4d perl: make scopes 2010-09-22 15:25:08 +09:00
tokuhirom c0e2041006 Checking in changes prior to tagging of version 0.27.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index b717a82..82174fe 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,8 @@
+0.27
+
+    - * 6d9a629 perl: modified trivial codes in PP::Unpacker(makamaka)
+    - * ead8edc modified be unpack_(u)int64 in PP(makamaka)
+
 0.26

     - fixed a serious code typo in PP(makamaka)
2010-09-22 15:12:51 +09:00
tokuhirom f6d2cd7704 Merge branch 'master' of github.com:msgpack/msgpack 2010-09-22 15:09:03 +09:00
makamaka 6d9a629b15 perl: modified trivial codes in PP::Unpacker 2010-09-22 14:19:09 +09:00
makamaka ead8edc7cd modified be unpack_(u)int64 in PP 2010-09-22 14:12:19 +09:00
tokuhirom 664eefdddb Checking in changes prior to tagging of version 0.26.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 3d455cb..b717a82 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.26
+
+    - fixed a serious code typo in PP(makamaka)
+
 0.25

     (NO FEATURE CHANGES)
2010-09-20 23:40:12 +09:00
tokuhirom 220d76c974 Merge branch 'master' of github.com:msgpack/msgpack 2010-09-20 23:36:50 +09:00
makamaka d973192b5e perl: modified a serious code typo in PP 2010-09-20 11:49:52 +09:00
tokuhirom 978bb5059f Checking in changes prior to tagging of version 0.25.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index d338cf8..3d455cb 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.25
+
+    (NO FEATURE CHANGES)
+    - oops. I failed releng.

 0.24
     - Fixed a lot of streaming unpacking issues (tokuhirom, gfx)
2010-09-20 09:54:25 +09:00
tokuhirom f59178bc33 Checking in changes prior to tagging of version 0.24.
Changelog diff is:
2010-09-20 09:30:26 +09:00
gfx 53899cc492 perl: tweaks for Makefile.PL 2010-09-19 22:12:28 +09:00
gfx 6379d0fe0f perl: more tests for nil/true/false entities 2010-09-19 15:53:54 +09:00
gfx a1c4d8696a Merge branch 'master' of github.com:msgpack/msgpack 2010-09-19 15:49:32 +09:00
gfx 7f42ed86f2 More tests 2010-09-19 15:47:32 +09:00
frsyuki 6bb8b4c994 Merge branch 'master' of github.com:msgpack/msgpack 2010-09-19 15:41:46 +09:00
gfx afefbe4e56 perl: update .gitignore and MANIFEST.SKIP 2010-09-19 15:21:25 +09:00
gfx 5cd37e5505 perl: always unpacking 64 bit ints as a string on 32 bit perls 2010-09-19 15:20:03 +09:00
gfx d6a825981d perl: fix unpacking int64_t in PP (based on makamaka's patch) 2010-09-19 15:16:08 +09:00
gfx a1c01c6722 perl: regen README 2010-09-19 15:15:31 +09:00
gfx 8d182f1d79 perl: Changelogging 2010-09-18 16:30:07 +09:00
gfx 29707bd2ea perl: fix bootstrap 2010-09-18 16:19:16 +09:00
gfx c2bf2a8174 perl: make pp benchmarks available 2010-09-18 16:16:51 +09:00
gfx b402849557 perl: docs 2010-09-18 15:54:22 +09:00
gfx cb85dcfcb8 perl: tweaks for benchmarks 2010-09-18 15:49:25 +09:00
gfx 49379140c7 perl: PERL_ONLY=1 disables XS 2010-09-18 15:14:29 +09:00
gfx 63f6c86b46 perl: add a note about 64 bit integers 2010-09-18 15:05:22 +09:00
gfx 1865898cd4 perl: Fix Makefile.PL 2010-09-18 14:58:32 +09:00
gfx 8935ecfdb8 perl: requires the latest version of Math::BigInt for PP 2010-09-18 14:56:33 +09:00
gfx 4902bed409 perl: more kind testing messages 2010-09-18 14:51:17 +09:00
gfx e6f6aba207 perl: add portability stuff 2010-09-18 14:50:52 +09:00
gfx bab622de25 perl: fix max depth checks in PP 2010-09-18 14:46:10 +09:00
gfx a86c1624a7 perl: More kind error messages in PP 2010-09-18 14:38:35 +09:00
gfx c707392a5a perl: fix int64_t unpacking in both XS and PP 2010-09-18 14:30:08 +09:00
gfx 1f07721ec4 perl: Scalar::Util is no longer used 2010-09-18 13:33:27 +09:00
gfx 4767e45035 perl: fix a test name 2010-09-18 13:18:25 +09:00
Muga Nishizawa f2a64ed685 Merge branch 'master' of http://github.com/msgpack/msgpack 2010-09-18 10:02:46 +09:00
tokuhirom 2c9966a0a3 perl: fixed stream deserializer in pp. 2010-09-18 09:44:32 +09:00
tokuhirom 953aa95c64 perl: added failing test case for streaming unpacker with PP. 2010-09-18 06:16:26 +09:00
tokuhirom 446266776e perl: regenerate README file 2010-09-18 06:16:17 +09:00
tokuhirom 845af014dc perl: gfx is a author. 2010-09-18 06:15:51 +09:00
gfx 7c8f8703a1 Add TODOs 2010-09-17 18:26:16 +09:00
gfx a0c18e4380 Docs 2010-09-17 18:16:33 +09:00
gfx e8d8099563 Fix a macro redefinition 2010-09-17 18:08:34 +09:00
gfx 2c9d90d463 perl: regen README 2010-09-17 18:08:15 +09:00
tokuhirom 130d2064d5 perl: updated benchmark result! gfx++ # performance tuning 2010-09-17 15:28:24 +09:00
gfx a10eb2a0d7 Changelogging 2010-09-17 14:02:12 +09:00
gfx b71cc5d7ee chmod -x 2010-09-17 13:59:52 +09:00
gfx 8512f9eda1 Add .gitignore 2010-09-17 13:49:55 +09:00
gfx 80058083b8 Tweaks 2010-09-17 13:49:08 +09:00
gfx d5a17a3c25 Fix stddata.t 2010-09-17 13:43:42 +09:00
gfx eab7c87781 Tidy PP 2010-09-17 13:37:17 +09:00
gfx d2962d8676 Split the boolean class into an outer module 2010-09-17 13:25:23 +09:00
gfx 5e602fb575 Fix tests 2010-09-17 13:10:54 +09:00
gfx 599964ea5f Comments 2010-09-16 21:45:06 +09:00
gfx 562de7926b More tests; some fails now :( 2010-09-16 21:38:17 +09:00
gfx 8eaed95e02 Fix an use of execute() 2010-09-16 20:44:51 +09:00
gfx 3cffd46008 Fix a comment 2010-09-16 20:41:52 +09:00
gfx e239bfda8a Make leaktrace.t as a regular test 2010-09-16 20:36:07 +09:00
gfx bd887b660d Preallocate hv keys 2010-09-16 20:31:34 +09:00
gfx 7c1e0ea95d Add binmode() for stream unpacking 2010-09-16 20:27:25 +09:00
gfx afbddbfcda Fix the stream unpacker 2010-09-16 20:24:01 +09:00
Muga Nishizawa 9eeb702ca5 change an annotation-utility in Java. it allows users to pack and unpack a List object. 2010-09-15 22:28:46 +09:00
gfx 4cb6d6995f Make the code clearer 2010-09-15 15:27:26 +09:00
gfx fe7e7a8d07 Add leaktrace tests 2010-09-15 15:26:02 +09:00
gfx f8ee79ab72 Add failing tests 2010-09-15 15:25:48 +09:00
gfx a11165830b More useful error messages 2010-09-15 15:06:03 +09:00
gfx 11cde61eab No debug output 2010-09-15 14:38:26 +09:00
gfx cd862409cc Clean up 2010-09-15 14:25:50 +09:00
gfx 7644555d6b Use sv_mortalcopy() 2010-09-15 14:21:44 +09:00
gfx 07e68aa694 Fix an usage message 2010-09-15 14:20:32 +09:00
gfx 0ae206b1bb Revert "The object root can be NULL"
This reverts commit 5bdac96375.
2010-09-15 14:19:22 +09:00
gfx 5bdac96375 The object root can be NULL 2010-09-15 14:18:38 +09:00
gfx f0e044ecd8 Cleanup 2010-09-15 14:09:03 +09:00
gfx f32234291e Remove an useless local variable 2010-09-15 14:07:33 +09:00
gfx 83acd6529f Remove an unused user data: source (sv) 2010-09-15 14:06:10 +09:00
gfx 6a60cb4dc0 Add const 2010-09-15 13:54:18 +09:00
gfx 1de03fbe18 Tweaks for unpacker 2010-09-15 13:41:10 +09:00
gfx 0e0a2aa981 Add various integers to benchmarks 2010-09-15 13:34:18 +09:00
gfx af73b9d11b Shortcut av_push() 2010-09-15 13:22:39 +09:00
gfx 859969241a Tweaks 2010-09-15 13:20:20 +09:00
gfx 6852a8ca9d Remove an unused function: xs_unpack_limit 2010-09-15 13:16:55 +09:00
gfx c694f1a4a9 Tweaks 2010-09-15 13:16:13 +09:00
gfx d36543b204 Micro optimizations 2010-09-15 13:12:17 +09:00
gfx 6981234736 Fix a possible mis-unpack on int64 2010-09-15 13:09:14 +09:00
gfx 10bf3ee9de Avoid compiler's warnings 2010-09-15 13:07:44 +09:00
gfx 9953218de1 Tidy 2010-09-15 13:03:47 +09:00
gfx 50c74103aa Avoid compiler's warnings 2010-09-15 12:56:13 +09:00
gfx c5e15123fd Add an assertion 2010-09-15 12:52:07 +09:00
gfx 4adcdb5ba8 Remove a duplicated depth check 2010-09-15 12:51:33 +09:00
gfx 60b36ffaa3 Micro optimizations 2010-09-15 12:50:11 +09:00
gfx d86104ed5d Tweaks 2010-09-15 12:48:23 +09:00
gfx 0f02ef20a9 Improve benchmarks 2010-09-15 12:46:11 +09:00
gfx 0768cf17b6 Taking NULL is a bug 2010-09-15 12:36:43 +09:00
gfx 197205853f Use newSV(). NEWSV() is deprecated. 2010-09-15 12:35:10 +09:00
gfx bebcc24ab8 Depends on XSUtil 0.32 2010-09-15 12:32:01 +09:00
gfx 987248ccbb Use xshelper.h in all the C files 2010-09-15 12:31:01 +09:00
Muga Nishizawa 56ece4db0f fixed a bug the program for packing and unpacking byte[] in annotation-utility 2010-09-14 23:23:09 +09:00
Muga Nishizawa c7f8b94ccd fixed several bugs of a verify error within annotation-utilities 2010-09-14 22:26:04 +09:00
Muga Nishizawa 95b820305a add a new test program for annotation-utilities 2010-09-14 13:34:11 +09:00
Muga Nishizawa 599b200ca5 change the version of javassist 3.12.1.GA 2010-09-12 23:04:23 +09:00
Muga Nishizawa a9566b31be add annotation utilities for Java 2010-09-12 22:21:33 +09:00
Muga Nishizawa f30837d726 Merge branch 'master' of http://github.com/msgpack/msgpack 2010-09-12 09:02:40 +09:00
tokuhirom 1242ffa4c6 Checking in changes prior to tagging of version 0.23.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index dd47b98..4120376 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,10 +1,15 @@
+0.23
+
+    (NO FEATURE CHANGES)
+    - fixed english docs(hanekomu++)
+
 0.22

     - fixed issue on ithreads(broken from 0.21)

 0.21

-    - doc enhancment
+    - doc enhancments
     - micro performance tuning.

 0.20
2010-09-12 05:38:15 +09:00
Muga Nishizawa 37c0347c47 Merge branch 'master' of http://github.com/msgpack/msgpack 2010-09-12 00:50:26 +09:00
tokuhirom 65befb84a0 Checking in changes prior to tagging of version 0.22.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 5d5a5e2..dd47b98 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.22
+
+    - fixed issue on ithreads(broken from 0.21)
+
 0.21

     - doc enhancment
2010-09-12 00:11:31 +09:00
tokuhirom a41f7ce3bd oops. 0.21 breakes ithreads support! 2010-09-12 00:09:44 +09:00
Muga Nishizawa 81ced6bf2a Merge branch 'master' of git@github.com:muga/msgpack 2010-09-11 12:13:24 +09:00
Muga Nishizawa fa8033f998 Merge branch 'master' of http://github.com/msgpack/msgpack 2010-09-11 12:12:16 +09:00
Muga Nishizawa 19e3178d0c Merge branch 'master' of http://github.com/msgpack/msgpack 2010-09-10 22:17:06 +09:00
tokuhirom 1e6262f24f Checking in changes prior to tagging of version 0.21.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index dc3dd5c..5d5a5e2 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,8 @@
+0.21
+
+    - doc enhancment
+    - micro performance tuning.
+
 0.20

     - first production ready release with PP driver.
2010-09-10 21:27:38 +09:00
tokuhirom beb2284440 perl: added docs for circular reference and blessed object. 2010-09-10 21:25:46 +09:00
tokuhirom 0c4f0de13d perl: inlining the small functions 2010-09-10 21:18:45 +09:00
tokuhirom 0cd31a4b96 perl: inlining utility functions 2010-09-10 21:00:27 +09:00
tokuhirom ef0a86e7cc perl: more inline 2010-09-10 20:45:17 +09:00
tokuhirom b79c1345b9 use gfx's standard header. 2010-09-10 20:42:40 +09:00
tokuhirom 5bb8b6f16c perl: ugpraded benchmarking script. and added result to docs. 2010-09-10 20:38:37 +09:00
tokuhirom f6f675d1e1 updated benchmark script 2010-09-10 20:27:11 +09:00
tokuhirom 9f684e7670 Checking in changes prior to tagging of version 0.20.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 7910882..dc3dd5c 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.20
+
+    - first production ready release with PP driver.
+
 0.16_04

     - no feature changes
2010-09-10 09:35:39 +09:00
tanakh a998706452 haskell: update cabal file 2010-09-08 13:36:45 +09:00
tanakh 5e19bc6f84 haskell: Object is Eq, Ord, Typeable. 2010-09-07 17:35:24 +09:00
tanakh 169f287970 haskell: Now, Object is an instance of NFData. 2010-09-07 16:14:29 +09:00
tanakh c56926428c haskell: add packToHandle' 2010-09-07 16:14:00 +09:00
tanakh 43eab5c4e5 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-09-06 23:29:10 +09:00
tanakh c6424c2ce7 haskell: nonblocking enumerator 2010-09-06 23:27:50 +09:00
tanakh dfe19d308c haskell: add overlapping instances 2010-09-06 18:14:47 +09:00
tanakh b75db110dc haskell: add Iteratee interface 2010-09-06 17:00:22 +09:00
tanakh 9e50ba6ec6 haskell: instance tupples and String and lazy ByteString 2010-09-06 16:33:36 +09:00
tanakh aca2ba13c2 haskell: refactoring 2010-09-06 15:37:55 +09:00
tokuhirom c5afe7a573 Checking in changes prior to tagging of version 0.16_04.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index a4a3e36..7910882 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,4 +1,4 @@
-0.16_03
+0.16_04

     - no feature changes
2010-09-06 14:35:41 +09:00
tokuhirom 8b90968cb1 Checking in changes prior to tagging of version 0.16_03.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 68b58ba..a4a3e36 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.16_03
+
+    - no feature changes
+
 0.16_02

     - document enhancement(tokuhirom)
2010-09-06 14:34:48 +09:00
tokuhirom 9281dba896 Checking in changes prior to tagging of version 0.16_02.
Changelog diff is:

diff --git a/perl/Changes b/perl/Changes
index 9b061cf..68b58ba 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,8 @@
+0.16_02
+
+    - document enhancement(tokuhirom)
+    - M::I::XSUtil 0.26 is broken. use 0.27.
+
 0.16_01

     - added PP version (used in cases PERL_DATA_MESSAGEPACK=pp or fail to load XS).
2010-09-06 14:34:04 +09:00
tokuhirom c7555f1c3c Perl: added link to git repository. 2010-09-06 14:31:53 +09:00
tokuhirom e781831032 upgraded docs 2010-09-06 14:20:54 +09:00
tokuhirom 8025895168 Checking in changes prior to tagging of version 0.16_01.
Changelog diff is:
2010-09-06 14:20:54 +09:00
tanakh 799935e44c haskel: incr version and update infos. 2010-09-06 14:03:47 +09:00
tanakh 209d8d058c forgot to remove file 2010-09-06 13:57:47 +09:00
tanakh 0368a70dd7 forgot to add file 2010-09-06 13:55:34 +09:00
Hideyuki Tanaka c3603426de Merge branch 'master' of github.com:msgpack/msgpack 2010-09-06 01:51:18 +09:00
Hideyuki Tanaka 80db9971b5 pure haskell implementation. 2010-09-06 01:50:22 +09:00
tokuhirom e3e771708e Merge branch 'master' of git://github.com/makamaka/msgpack
Conflicts:
	perl/Changes
2010-09-05 16:18:57 +09:00
tokuhirom b9bca2a19f bump to 0.16 2010-09-05 16:17:19 +09:00
Muga Nishizawa ffae70a99a Merge branch 'master' of git@github.com:muga/msgpack 2010-09-05 15:49:42 +09:00
makamaka 10ec1e48b0 modified begin process about byte order 2010-09-05 01:54:44 +09:00
makamaka 84123f5445 fallback PP configuration with c99 unspport compiler 2010-09-04 20:02:46 +09:00
makamaka 25531d8393 modified t/05_preferred_int.t for Win32 2010-09-04 19:54:12 +09:00
makamaka adfadc542a enable PP to pack/unpack int64 in less than Perl 5.10 2010-09-04 14:35:24 +09:00
makamaka 7682e1cb57 Merge branch 'master' of git://github.com/msgpack/msgpack
Conflicts:
	perl/t/05_preferred_int.t
2010-09-03 15:09:49 +09:00
tokuhirom 1fe4109a42 fixed tests on 64bit machines with -Duselongdouble #60625 2010-09-03 14:50:01 +09:00
makamaka b97baf4d47 added some comments in Data::MessagePack::PP 2010-09-03 12:53:56 +09:00
makamaka f91728561f ouch, modified pod 2010-09-02 23:58:40 +09:00
makamaka 2b75d54ce1 modified pod 2010-09-02 23:56:55 +09:00
makamaka cdc09a7d30 Changes 2010-09-02 23:52:36 +09:00
makamaka 4cc6c3e535 modified t/05_preferred_int.t for Win32 2010-09-02 23:48:57 +09:00
makamaka 8f43e033a4 removed dependency on Data::Float 2010-09-02 23:45:05 +09:00
makamaka 918dbd1926 made Makefile.PL XS/PP configurable 2010-09-02 14:37:22 +09:00
makamaka 8fc86ce7fa removed commented out codes 2010-09-02 14:33:59 +09:00
INADA Naoki bf0cb40586 python: Add python3 category. 2010-09-02 10:13:49 +09:00
INADA Naoki a62aefe74b python: Release 0.1.6 - Fix wrong version string. 2010-09-02 10:10:34 +09:00
INADA Naoki 138d232149 python: vesion 0.1.5 2010-09-02 09:58:50 +09:00
INADA Naoki 8fa64e3ab2 Add msgpack.version as version tuple. 2010-09-02 09:54:38 +09:00
INADA Naoki 8d0d2bd3fc python: Add test for python3 and fix found problems. 2010-09-02 02:16:28 +09:00
INADA Naoki 2146f5f623 python: Fix Unpacker.feed doesn't accept bytes on Python3. 2010-09-02 02:02:47 +09:00
INADA Naoki 623df23570 Merge branch 'master' of github.com:msgpack/msgpack 2010-09-02 01:30:32 +09:00
INADA Naoki 4a15d8b6d2 python: Support Python3. 2010-09-02 01:29:57 +09:00
makamaka af83a62474 modified some codes for test warnings 2010-09-01 16:04:25 +09:00
makamaka a0705a6c67 added PP backend switch into Data::MessagePack 2010-09-01 11:59:01 +09:00
makamaka 712b8eec3d added pp version 2010-09-01 11:22:43 +09:00
tokuhirom 558e9c21ed Perl: 0.15 2010-09-01 08:19:05 +09:00
tokuhirom 23a7137e6a Perl: better argument validation(patch from dankogai) 2010-08-31 23:42:32 +09:00
frsyuki 71a1cb0184 fixes compatibility with Rubinius 2010-08-31 09:29:01 +09:00
frsyuki 09b47cc536 ruby: fixes compatibility with ruby-1.8.5 2010-08-31 07:00:19 +09:00
frsyuki b5c78de2dd ruby: converts encodings into UTF-8 on Ruby 1.9 2010-08-31 06:30:16 +09:00
frsyuki a1bd14e516 template: casts integer types explicitly 2010-08-31 06:27:15 +09:00
frsyuki 9684c8664f cpp: version 0.5.4 2010-08-29 18:27:10 +09:00
frsyuki 3c75361e5a cpp: updates README.md 2010-08-29 18:24:32 +09:00
frsyuki c44c9ab74d cpp: adds msgpack_vc2008.vcproj file in source package 2010-08-29 18:23:16 +09:00
frsyuki 8cc9c871b7 Merge branch 'master' of github.com:msgpack/msgpack 2010-08-28 11:40:45 +09:00
UENISHI Kota 31d211cded Merge branch 'master' of ssh://github.com/msgpack/msgpack 2010-08-28 00:36:54 +09:00
UENISHI Kota c42cba1d54 erlang: fixed bug around error case when serializing atom. 2010-08-27 23:02:16 +09:00
frsyuki c87f7cb9ac cpp: fixes fix_int; updates test/fixint.cc 2010-08-27 20:52:40 +09:00
frsyuki 421bee3871 cpp: version 0.5.3 2010-08-27 17:53:19 +09:00
frsyuki 2c7573a032 cpp: updates msgpack_vc8.postbuild.bat 2010-08-27 17:53:02 +09:00
frsyuki fe2a0f5089 cpp: adds fixed length serialization for integers 2010-08-27 17:42:05 +09:00
frsyuki 59ba8dec4e cpp: fixes include paths 2010-08-27 16:45:48 +09:00
Muga Nishizawa ff0e1bbbc0 change the part for creating a new constructor within DynamicCodeGenerator 2010-08-26 17:53:29 +09:00
Muga Nishizawa 18c712cd99 object serialization with reflection and with dynamic code generation 2010-08-25 21:35:52 +09:00
tokuhirom 8de1f764fd Perl: bump up version to 0.14 2010-08-21 16:09:30 +09:00
tokuhirom a91c1ec6d9 fixed segv on cyclic reference(patch by dankogai) 2010-08-21 16:02:23 +09:00
frsyuki c8e351b31e java: adds TestMessageUnpackable test 2010-08-21 03:36:44 +09:00
frsyuki b4c98584db java: adds Unpacker.unpackBigInteger() 2010-08-19 01:19:34 +09:00
frsyuki 1d17836b7d java: NilType::create() returns NilType's one and only instance 2010-08-19 00:54:23 +09:00
frsyuki 193a739749 java: updates TestDirectConversion 2010-08-19 00:05:48 +09:00
frsyuki 48da2b8353 java: adds Packer.pack(<primitive types>) 2010-08-18 23:47:31 +09:00
frsyuki 40dc9de6c9 java: supports packing/unpacking of BigInteger less than 0xffffffffffffffff 2010-08-18 23:37:47 +09:00
frsyuki d7469e4694 java: fixes cross-language test case 2010-08-18 22:55:50 +09:00
frsyuki fdfabc9f88 java: adds cross-language test case 2010-08-18 22:51:23 +09:00
frsyuki 5658ca5b90 java: adds ObjectEquals test 2010-08-18 22:24:51 +09:00
frsyuki 8b79e6d3c7 java: uses MessagePackObject instead of Object for type of deserialized objects 2010-08-18 18:10:30 +09:00
frsyuki 8c67087a15 java: adds MessagePackObject.bigIntegerValue(), asBigInteger() and equals() 2010-08-18 16:32:42 +09:00
frsyuki 057f73a73e java: implements MessagePackObject::hashCode() 2010-08-10 14:11:44 +09:00
frsyuki d3bb37d113 java: fixes MapSchema 2010-08-10 14:11:25 +09:00
frsyuki 6c91b862c9 java: MessagePackObject implements Cloneable and MessagePackable interfaces 2010-07-28 01:17:20 +09:00
frsyuki cba47b635a java: changed deploy path to ./target/website/maven2 directory. 2010-07-27 09:50:57 +09:00
Kazuki Ohta cd83388f8b java: fixed repository location. msgpack.sourceforge.net => msgpack.org 2010-07-27 08:59:09 +09:00
frsyuki 02ae247536 java: adds MessagePackObject class 2 2010-07-24 18:20:00 +09:00
frsyuki 1621a68191 Merge branch 'master' of github.com:msgpack/msgpack 2010-07-24 18:08:19 +09:00
frsyuki 2aef495d62 java: adds MessagePackObject class 2010-07-24 18:08:00 +09:00
frsyuki 227c168b65 java: fixes fatal offset calculation bugs on BufferedUnpackerIMPL.unpackInt() 2010-07-24 18:07:22 +09:00
UENISHI Kota dcbcf5842f erlang: msgpack:unpack_all/1 doc. 2010-07-18 23:55:07 +09:00
UENISHI Kota 8a3ac6d9bd erlang: omake menus added. 2010-07-18 23:50:29 +09:00
UENISHI Kota 6cabad19d5 erlang: unpack_all/1 improve, error handling added. 2010-07-18 23:48:20 +09:00
UENISHI Kota dad7a03d19 erlang: stopped support for dict() type. 2010-07-18 23:42:23 +09:00
UENISHI Kota 7b152640d9 erlang: 'edoc' document generation 2010-07-18 23:40:25 +09:00
UENISHI Kota 78fddff34e erlang: merged vincent's contribution 2010-07-18 23:01:43 +09:00
advect 78f542f6c0 Update PHP Extension 2010-07-17 18:46:28 +09:00
frsyuki f8a016edb5 Merge branch 'master' of github.com:msgpack/msgpack 2010-07-14 17:09:34 +09:00
frsyuki f5453d38ec cpp: version 0.5.2 2010-07-14 17:06:16 +09:00
frsyuki 331bf0af21 cpp: type::raw_ref::str(), operator==, operator!=, operator< and operator> are now const 2010-07-14 17:04:41 +09:00
tokuhirom 9ac69337e8 perl: bump up version to 0.13! 2010-07-14 09:58:41 +09:00
tokuhirom ca0c844f32 clearly specified this distribution requires requires C99. 2010-07-14 09:58:05 +09:00
Vincent de Phily e629e8784f erlang: Improve documentation
The doc is in edoc format, generated from the source as an html file.
The makefile's default action now also generates the documentation.

I ignored unpack_all/1 and pack(dict()) for now because their future is still uncertain.
2010-07-12 14:08:22 +02:00
Vincent de Phily e944c1ee93 erlang: Only handle throw() in pack/1 and unpack/1
Rationale: We only use throw/1 for error handling, never erlang:error/1.
           Caller bugs will get a nice {error,...} return while library bugs will
           bubble up in all their uglyness; that's the proper way to do things
           in erlang.
2010-07-09 20:37:06 +02:00
Vincent de Phily 02c882bda3 erlang: Make pack_map/1 api private 2010-07-09 20:34:38 +02:00
Vincent de Phily 2c29377abf erlang: s/short/incomplete/ and s/badarg/{badarg,Term}/
Nicer error returns.
2010-07-09 20:30:17 +02:00
Vincent de Phily 21992f1b9e erlang: fix receiving from port_command in unit tests
Ports can send data bit by bit; make sure we read all the port has to offer in one go.
This should fix the "broken pipe" error we sometime got during testing.
We did not previously check the return of compare_all/2, which is why the bug was not noticed.
Incidentally, this change fixes dialyzer warnings too.
2010-07-09 18:53:24 +02:00
Vincent de Phily 8a3f090684 erlang: Fix some existing specs and add a few other.
dialyzer still complains about dict() and ?assert(false), but I don't think they're real issues.
2010-07-09 17:36:36 +02:00
UENISHI Kota a4258505a9 erlang: modified wrong testcase. 2010-07-09 23:23:00 +09:00
Vincent de Phily ba4a971bfa erlang: Remove unecessary 'throw(short)' clause for unpack_{array,map}_/1
Unecessary because unpack_/1 will throw it anyway.
This does mean that we go a tiny bit deeper to find that we don't have enough data,
but that should be a rare code path. Keep the main code path fast and the code clean.

While at it, rename vars to match its sibling function and to avoid thinking that
RestLen is a byte count (it's an item count).
2010-07-09 13:44:02 +02:00
Vincent de Phily 6abc120279 erlang: Fix incomplete/invalid cases of unpack_/1
* fix list of invalid bytes was missing 3 possibilities (see type chart section of msgpack format spec)
* fix matching of invalid bytes to look at 1 byte instead of 2
* simplify 'incomplete' case : anything that's not complete or invalid is by definition incomplete
2010-07-09 13:29:47 +02:00
Vincent de Phily 64c36b7a8f Remove a couple of superfluous 'when' clauses.
The when clause for unpack_/1 has been moved to unpack/1 so that it is performed only once.
2010-07-09 13:06:57 +02:00
Vincent de Phily 64b9f0762c Merge branch 'master' of git://github.com/msgpack/msgpack
Reseting msgpack.erl to upstream version.
2010-07-09 12:35:22 +02:00
UENISHI Kota e799082e5c erlang: better test cases, except 'Broken pipe' 2010-07-09 01:21:35 +09:00
UENISHI Kota eab66a022e erlang: added try-catch clause for easy error handling 2010-07-09 01:04:09 +09:00
UENISHI Kota 485915c27a erlang: added simple performance test description. 2010-07-08 23:39:47 +09:00
UENISHI Kota 45fb482ab4 erlang: added simple performance test. 2010-07-08 23:36:18 +09:00
frsyuki 167e2475d8 cpp: generate version.h using AC_OUTPUT macro in ./configure 2010-07-06 23:30:15 +09:00
frsyuki fe77251242 cpp: fixes missing dependency to generate version.h 2010-07-06 19:16:49 +09:00
frsyuki 0c331d2887 cpp: updates vcproj 2010-07-06 18:18:28 +09:00
frsyuki 39facd5dc6 cpp: version 0.5.1 2010-07-06 17:59:07 +09:00
frsyuki a2bd5ae638 cpp: ./configure supports --disable-cxx option not to build/install C++ API 2010-07-06 17:45:15 +09:00
frsyuki c57f616141 cpp: adds MSGPACK_VERSION{,_MAJOR,_MINOR} macros and msgpack{,_major,_minor} functions 2010-07-06 17:10:25 +09:00
frsyuki 3af10a1d00 cpp: adds MSGPACK_VERSION{,_MAJOR,_MINOR} macros and msgpack{,_major,_minor} functions 2010-07-06 17:00:58 +09:00
frsyuki b3987e2402 Merge branch 'master' of github.com:msgpack/msgpack 2010-07-06 12:26:30 +09:00
frsyuki 71dd44f430 cpp: adds operator<<(std::ostream&, const tuple<Type...>&) (experimental) 2010-07-06 12:26:21 +09:00
UENISHI Kota 584462f9b9 erlang: improved spec. 2010-07-01 01:16:25 +09:00
UENISHI Kota ff5d5d7cbc erlang: updated the comments 2010-07-01 01:14:38 +09:00
UENISHI Kota 370e92b1a6 erlang: just a golf. 2010-07-01 01:14:20 +09:00
UENISHI Kota 2469768a85 erlang: reducing unnecessary binary matching in unpack_/2
* more efficient unpack_/1 by Vincent de Phille's code. thanks.
2010-07-01 01:07:56 +09:00
UENISHI Kota acb8fa613e erlang: adding shorthand fix for {more, undefined} problem 2010-07-01 01:02:19 +09:00
UENISHI Kota 83b4b7d83d erlang: more suitable variable name and removing unnecessary guards. 2010-07-01 00:58:48 +09:00
Vincent de Phily 33a7d56042 * Return {more,undefined} instead of {more,integer()}, as we can only know the "minimum bytes needed to continue" instead of the actually usefull "total packet size".
* Merge all {more,...} clauses of unpack_/1 into one.
* Reformat unpack_/1 for readability.
* Fix some specs, error values, and documentation.
2010-06-29 11:59:56 +02:00
frsyuki 20de730541 ruby: 0.4.3 2010-06-29 15:39:47 +09:00
frsyuki 134c27c900 Merge branch 'master' of github.com:msgpack/msgpack 2010-06-29 15:13:21 +09:00
frsyuki 123ae024c6 ruby: MessagePack::VERSION constant 2010-06-29 15:12:52 +09:00
frsyuki 34a29cd0a5 ruby: fixes SEGV problem caused by GC bug at MessagePack_Unpacker_mark. 2010-06-29 14:56:23 +09:00
frsyuki 9fffa9800a ruby: fixes RDoc of Unpacker#execute and Unpacker#execute_impl 2010-06-29 14:54:09 +09:00
Vincent de Phily 8f7f23a0e5 Rewrite unpack_/1 using pattern matching to get a 30-40% speedup.
Simplify pack_* and unpack_{array,map} function clauses to get more readability and a minor speedup.
2010-06-28 18:11:52 +02:00
UENISHI Kota 358457f49d erlang: bad wrong export.. 2010-06-29 00:25:58 +09:00
UENISHI Kota 90e305d789 erlang: explicit API for serializing proplists,
so as not to make wrong call of pack({proplists()}).
2010-06-29 00:23:49 +09:00
UENISHI Kota b471e52e28 erlang: explicit API for serializing proplists,
so as not to make wrong call of pack({proplists()}).
2010-06-29 00:21:47 +09:00
UENISHI Kota 9b5fc37399 Merge branch 'master' of http://github.com/vincentdephily/msgpack 2010-06-29 00:10:10 +09:00
Vincent de Phily 537322e3b5 Big speedup (around 40%) of maps and arrays encoding by using proper tail recursion. 2010-06-28 14:17:44 +02:00
Vincent de Phily 279121f87f erlang: Use a simple proplist instead of a dict.
A dict is overkill (code, cpu, memory) in most cases, and proplist<->dict conversion can easily be done by the libray user if desired.
        This is in line with other erlang libraries I've seen for various encoding schemes.
        The map encoder had a bug until I looked at it (see previous commit), so I guess it wasn't used much yet and a change is ok at this stage.
        The chosen representation for maps is a tuple containing the proplist as the only element.
2010-06-28 11:56:12 +02:00
UENISHI Kota a1b2b41cdc erlang: bugfix(serialization of -234 goes <<208,22>> while it should go int16 <<0xD1, ...>>) 2010-06-26 08:40:36 +09:00
Vincent de Phily 0cca90c21d Fix encoding of fixmap type.
The tag value was wrong, and a missing /binary flag caused an error.
2010-06-25 17:32:11 +02:00
UENISHI Kota ad052cb510 updated readme 2010-06-25 01:26:57 +09:00
UENISHI Kota 57f0598373 erlang: code refined and tests added 2010-06-25 00:44:14 +09:00
UENISHI Kota 92d192277e erlang: unpack_map's silly bug fixed. use dict:store/3.... 2010-06-25 00:22:53 +09:00
UENISHI Kota 2cdfbd8970 erlang: testing pack_map/unpack_map with a silly bug 2010-06-24 07:26:34 +09:00
UENISHI Kota bc0c5f0cdc erlang: (un)pack_map improved, incremental unpacking 2010-06-23 09:02:53 +09:00
UENISHI Kota 230ee3a03b erlang: too short binary to decode causes error {more, Int}. 2010-06-23 01:26:10 +09:00
UENISHI Kota ab0bf37d30 Merge branch 'master' of ssh://github.com/msgpack/msgpack 2010-06-22 11:44:25 +09:00
UENISHI Kota b1e66256ce erlang: external APIs' type/specs. 2010-06-22 11:28:36 +09:00
UENISHI Kota fd80693420 erlang: tests improved and code refined. 2010-06-22 11:15:18 +09:00
Naoki INADA f222f5ed9b Python: 0.1.4 2010-06-15 18:06:58 +09:00
INADA Naoki 59603b902a Python: add "load(s)/dump(s)" alias for compatibility to simplejson/marshal/pickle. 2010-06-15 17:51:24 +09:00
frsyuki 82a5dd6cf9 java: update 2010-06-10 14:02:58 -07:00
frsyuki a97f9081a3 Merge branch 'master' of github.com:msgpack/msgpack 2010-06-03 22:04:36 +09:00
frsyuki b3e0ad1303 ruby: 0.4.2 2010-06-03 22:00:15 +09:00
frsyuki 251090406a ruby: adds a test case for buffering 2010-06-03 21:52:01 +09:00
frsyuki 9c3ed173b1 ruby: fixes buffering routine 2010-06-03 21:51:40 +09:00
UENISHI Kota 7cd41aeb72 erlang: tracing crosslang.rb moving to ../test 2010-06-03 00:17:17 +09:00
UENISHI Kota 8ecaf7ad4c Merge branch 'master' of ssh://github.com/msgpack/msgpack 2010-06-03 00:14:19 +09:00
frsyuki d4049fe593 ruby: add test/test_cases.rb 2010-06-01 16:35:21 +09:00
frsyuki 989b14b519 update test/README.md 2010-06-01 15:58:44 +09:00
frsyuki fb3e11408c add test/cases.json 2010-06-01 15:56:29 +09:00
frsyuki 3d3af3284e cpp: adds Doxyfile 2010-06-01 08:43:30 +09:00
frsyuki eabcf15790 cpp: update tests 2010-06-01 07:16:25 +09:00
frsyuki 684bca203a cpp: adds msgpack_unpacker_next and msgpack_unpack_next 2010-06-01 07:15:58 +09:00
frsyuki d42ecccf6f cpp: msgpack::unpack returns void 2010-06-01 07:13:47 +09:00
frsyuki 5a92c861e3 cpp: adds msgpack_vrefbuffer_new and msgpack_vrefbuffer_free 2010-06-01 07:11:01 +09:00
frsyuki 103b14ea3c cpp: adds msgpack_zbuffer_new and msgpack_zbuffer_free 2010-06-01 07:10:39 +09:00
frsyuki e49f091b4e cpp: adds msgpack_sbuffer_new and msgpack_sbuffer_free 2010-06-01 07:10:17 +09:00
frsyuki 6056f93910 cpp: add cases.mpac test 2010-06-01 05:15:36 +09:00
frsyuki 18fa2d1af4 Merge branch 'master' of github.com:msgpack/msgpack 2010-06-01 04:47:37 +09:00
frsyuki 062ed8a4c4 add test/cases.mpac and test/cases_compact.mpac 2010-06-01 04:47:28 +09:00
UENISHI Kota 49f3872d04 erlang: temporary documentation and .gitignore 2010-06-01 00:31:12 +09:00
UENISHI Kota d9b467098a erlang: added more cross-language tests. better type specification. 2010-05-31 23:56:06 +09:00
UENISHI Kota 7d1e51437e erlang: added usage of cross-language test. 2010-05-31 23:13:32 +09:00
frsyuki f5a7d444e2 Merge branch 'master' of github.com:msgpack/msgpack 2010-05-31 17:32:51 +09:00
frsyuki a0071c2f9f add crosslang.rb 2010-05-31 17:27:51 +09:00
frsyuki 98a5e43883 add crosslang.cc 2010-05-31 17:16:40 +09:00
UENISHI Kota f40ebe5b43 Merge branch 'master' of ssh://github.com/msgpack/msgpack 2010-05-31 00:26:49 +09:00
UENISHI Kota d7d78d9a2b added more tests,
and OMake continuous building.
2010-05-31 00:25:53 +09:00
Hideyuki Tanaka 5a12d36a0a incr version 2010-05-30 19:45:00 +09:00
Hideyuki Tanaka e61dc76ae1 fix peek object 2010-05-30 19:11:04 +09:00
Hideyuki Tanaka 0da22193bd fix typo 2010-05-30 17:20:49 +09:00
Hideyuki Tanaka d43921823e fix initialize pointer 2010-05-30 17:19:43 +09:00
UENISHI Kota 6b5b76b0c9 initial import from http://bitbucket.org/kuenishi/messagepack-for-erlang 2010-05-30 15:01:10 +09:00
frsyuki 602971408b cpp: move source files into src/ directory 2010-05-30 03:02:40 +09:00
frsyuki 2f5d83f07d cpp: type::tuple& operator>>: fix conversion type 2010-05-30 01:45:07 +09:00
frsyuki 81b0c316cd java: Unpacker: rewind internal buffer on filled <= offset 2010-05-30 01:39:48 +09:00
frsyuki 6df86384ca java: update javadoc 2010-05-29 07:54:49 +09:00
frsyuki 3fbcde4bd7 ruby: don't use rb_enc_set/get on ruby 1.8 2010-05-26 18:11:09 +09:00
frsyuki 293293c23c ruby: set mp->user.source = Qnil before tempalte_execute_do on Unpacker#each 2010-05-26 18:01:27 +09:00
frsyuki 47185d757e ruby: version 0.4.0 2010-05-26 07:55:02 +09:00
frsyuki 94c3998507 ruby: update gemspec 2010-05-26 07:43:05 +09:00
frsyuki 5fa589691c ruby: use malloc/realloc for stream buffer 2010-05-26 07:01:28 +09:00
frsyuki 26bc835c7e ruby: buffer rewinding 2010-05-26 04:30:49 +09:00
frsyuki fc7da17fa2 cpp: add sbuffer::clear() and vrefbuffer::clear() 2010-05-25 02:57:37 +09:00
frsyuki dbebe9771b ruby: update rdoc 2010-05-25 02:55:58 +09:00
frsyuki d0af8aa9f1 ruby: rdoc 2010-05-23 21:10:49 +09:00
Kazuki Ohta f8173e93f5 java: version 0.3 (added CHANGES.txt and LICENSE.txt) 2010-05-23 01:48:20 +09:00
frsyuki fa6ea6848f java: fixed problem that empty array and empty map don't check Schema 2010-05-23 01:38:01 +09:00
frsyuki 5982970e21 java: fixed problem that empty array and empty map don't check Schema 2010-05-23 01:34:45 +09:00
Kazuki Ohta c43e5e0c95 java: added testcases for empty array and empty map 2010-05-23 01:31:15 +09:00
frsyuki b4fc79c38e java: fixes compile error 2010-05-22 17:05:17 +09:00
frsyuki b9cb270b8f java: add Unpacker.unpack(MessageUnpackable) and Unpacker.tryUnpackNil() 2010-05-22 03:34:43 +09:00
frsyuki 1fe35d7efe java: fix Packer.packByte 2010-05-22 03:34:17 +09:00
frsyuki ec8c19b1f0 java: javadoc 2010-05-20 17:32:15 +09:00
frsyuki c2525bcc05 java: add Unpacker.wrap method 2010-05-20 06:19:26 +09:00
frsyuki 985c31b378 java: add Unpacker.wrap method 2010-05-20 06:18:32 +09:00
frsyuki 135a9f5586 java: fix direct conversion API 2010-05-20 05:44:44 +09:00
frsyuki 979ff80982 java: redesign 2010-05-20 03:49:26 +09:00
frsyuki 6cde9f3a9d Merge branch 'master' of github.com:msgpack/msgpack 2010-05-19 16:31:16 +09:00
frsyuki 5cad81bf4c cpp: fix return type mismatch in zone.c 2010-05-18 14:48:36 +09:00
frsyuki 18967162cf cpp: fix return type mismatch in unpack.c 2010-05-18 14:48:23 +09:00
tokuhirom 6ea75f3a9f Perl: do not use done_testing 2010-05-17 05:52:32 +09:00
tokuhirom f51123d009 oops 2010-05-17 05:49:39 +09:00
tokuhirom be6376ee2d Perl: build_requires and requires are duped. 2010-05-08 12:02:31 +09:00
tokuhirom 120a85a3e5 Perl: releng for 0.12 2010-05-05 17:28:38 +09:00
tokuhirom 262fe96c29 Perl: PERL_NO_GET_CONTEXT makes horrible dTHXs. remove it. 2010-05-05 17:25:45 +09:00
tokuhirom 1864df5ed0 Perl: cleanup Makefile.PL 2010-05-05 17:25:25 +09:00
tokuhirom 09bae0a9e8 Perl: Test::Requires is not needed for this test. 2010-05-05 17:25:08 +09:00
tokuhirom ebe41a24f1 perl: releng for data-messagepack 0.11 2010-05-05 16:59:31 +09:00
tokuhirom f0f574a15b Perl: releng for 0.10 2010-05-05 16:55:06 +09:00
tokuhirom 9420436c09 Perl: added test case 2010-05-05 16:22:40 +09:00
tokuhirom 2b8f853b96 Perl: fixed some issues. thanks to gfx++
http://gist.github.com/387743
2010-05-05 16:17:57 +09:00
tokuhirom 2c2bf60d0c Perl: added README file. 2010-05-05 15:50:07 +09:00
Hideyuki Tanaka 62b82448d5 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-05-05 04:33:11 +09:00
Hideyuki Tanaka 2f12e6c3d0 remove compiler warnings 2010-05-05 04:28:04 +09:00
Kazuki Ohta 8ce23f8e3e java: fixed pom.xml to work "mvn deploy" command 2010-05-04 18:33:29 +09:00
Hideyuki Tanaka dbe760d6e2 make () to OBJECT instance (Nil) 2010-05-04 16:24:45 +09:00
Hideyuki Tanaka 674c26d9c7 fix feed function from Handle 2010-05-04 16:22:04 +09:00
tokuhirom 7b68b04efd Perl: change for release Data-MessagePack-0.09_01 2010-05-03 01:36:48 +09:00
tokuhirom e0b65bf196 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-05-03 01:20:00 +09:00
tokuhirom 77f5cb1f1f Perl: updated docs. 2010-05-03 01:09:21 +09:00
tokuhirom 2a222737f8 Merge branch 'master' of git@github.com:msgpack/msgpack 2010-05-03 01:04:50 +09:00
tokuhirom 77d48f9cee Perl: fixed memory leak issue 2010-05-03 00:46:15 +09:00
tokuhirom c77eac325e Perl: added failing test case for memory leaks 2010-05-03 00:22:16 +09:00
tokuhirom 517ced2a54 Perl: added more test case for streaming unpacker 2010-05-03 00:08:02 +09:00
tokuhirom 70d2c47367 perl: added more test case for streaming deserializer. 2010-05-02 22:09:18 +09:00
frsyuki e57084f6df cpp: update ChangeLog 2010-04-29 23:45:48 +09:00
frsyuki 8783cf8ec3 cpp: fixes unpacker::next 2010-04-29 22:32:43 +09:00
frsyuki 2af7a7c6ac Merge branch 'master' of github.com:msgpack/msgpack 2010-04-29 22:15:17 +09:00
frsyuki 91a1f8d9e1 cpp: new streaming deserialier API. 2010-04-29 22:15:03 +09:00
Kazuki Ohta fc5e8ddca1 java: add Unpacker.feed() function for java.nio.ByteBuffer 2010-04-29 21:27:41 +09:00
frsyuki 6352472c5f python: sourceforge.jp -> sourceforge.net 2010-04-29 09:06:46 +09:00
Naoki INADA 833ee6484c Release msgpack-python 0.1.3 2010-04-29 07:52:32 +09:00
Naoki INADA dda3d24bca Add download url. 2010-04-29 07:08:41 +09:00
Naoki INADA f77d76a320 Add COPYING file to python package. 2010-04-29 07:01:16 +09:00
frsyuki c51fabf6ed msgpack/pack_template.h: don't evaluate undefined macro 2010-04-29 02:39:53 +09:00
frsyuki b10cb658ca pack_template.h: template_unsigned_long:
wrong size checking on !defined(SIZEOF_SHORT) && !defined(SHRT_MAX)"
2010-04-29 00:39:45 +09:00
frsyuki 68f60568ac cpp: build libmsgpackc.so for backward compatibility. 2010-04-26 21:52:19 +09:00
frsyuki 9fbca83ac0 cpp: add test/{zone,pack_unpack,streaming,object,convert,buffer}.cc 2010-04-25 18:08:14 +09:00
frsyuki d19bfaa2cb cpp: fixes msgpack_vc8.vcproj 2010-04-25 09:09:06 +09:00
frsyuki 53d5ddb345 cpp: fixes operator<<(packer<Stream>&, const object&) 2010-04-25 08:26:42 +09:00
frsyuki 0a5c2e7ab9 c,cpp: MSGPACK_OBJECT_NIL = 0x00 2010-04-25 08:16:12 +09:00
frsyuki 35802ba949 cpp: msgpack_object_equal 2010-04-25 08:00:04 +09:00
frsyuki 72160aac9a cpp: combines libmsgpackc and libmsgpack into libmsgpack 2010-04-25 07:56:19 +09:00
frsyuki 9df6916029 cpp: object::object(const T& v, zone* z) 2 2010-04-25 06:39:12 +09:00
frsyuki 9bfa2354ff cpp: fixes serialization of object::type == DOUBLE 2010-04-25 02:37:04 +09:00
frsyuki 7d945d3c8e cpp: explicit object(const T& v) 2010-04-25 02:30:53 +09:00
frsyuki 05e28752f1 cpp: MSGPACK_DEFINE defines T::msgpack_object(object*, zone*) 2010-04-25 01:57:05 +09:00
frsyuki 01b6673528 cpp: bool operator==(object& x, const T& y) 2010-04-25 01:24:24 +09:00
frsyuki 4e85ebbf98 cpp: object::object(const T& v, zone* z) 2010-04-25 01:12:25 +09:00
frsyuki 120e8bffd7 cpp: object::object(const T& v) and object::operator=(const T& v) 2010-04-25 00:03:09 +09:00
frsyuki 8335823748 ruby-0.3.9 2010-04-23 20:24:36 +09:00
frsyuki c9fcf4020f ruby: streaming deserializer test 2010-04-23 20:18:48 +09:00
frsyuki b10a736744 ruby: fixese backward compatibility of streaming deserializer 2010-04-23 18:13:36 +09:00
frsyuki 60fbaf7612 ruby: 0.3.8 2010-04-22 14:56:25 +09:00
frsyuki d24193630e reverts variable-length stack: avoids memory leak 2010-04-22 14:46:54 +09:00
frsyuki 354af69f62 ruby: fixes SEGV on MessagePack_Unpacker_each 2010-04-22 14:38:10 +09:00
Taro L. Saito bccac610a4 changed the src/test folder 2010-04-20 00:05:26 +09:00
Taro L. Saito 5aa6209664 add README 2010-04-19 23:52:40 +09:00
Taro L. Saito d693d92702 removed unnecessary settings 2010-04-19 23:34:18 +09:00
Taro L. Saito f2622e54e3 moved src and test codes to src/{main,test}/java 2010-04-19 23:05:00 +09:00
Taro L. Saito 20fe9b6dde added pom.xml 2010-04-19 22:39:53 +09:00
Kazuki Ohta 11f7aa4212 cpp: fixed small typo in configure.in 2010-04-18 15:11:50 +09:00
Hideyuki Tanaka f53c351fd2 haskell binding 2010-04-18 02:17:49 +09:00
Kazuki Ohta fb96617377 java: add javadoc,javadoc-jar,pom,dist,mvn-install,mvn-deploy ANT tasks.
Now maven2 repository for msgpack is created at the following URL.
  - http://msgpack.sourceforge.net/maven2/
2010-04-18 01:18:40 +09:00
frsyuki 05b8c00ee7 cpp: fixes windows compatibility 2010-04-18 00:39:45 +09:00
frsyuki 58854fdae9 cpp: add cpp/README.md 2010-04-18 00:39:23 +09:00
frsyuki fd31ff772f Merge branch 'master' of github.com:msgpack/msgpack 2010-04-18 00:08:17 +09:00
frsyuki ab8e0c9e31 c,cpp: reforms source tree 2010-04-18 00:08:03 +09:00
Kazuki Ohta abeed3be84 java: add tests for array and map 2010-04-17 23:25:42 +09:00
Kazuki Ohta a65438c6fe java: skip building jar file for the faster testing 2010-04-17 22:53:56 +09:00
frsyuki c3f43fb0cf template_execute: fixes embed stack 2010-04-17 22:43:11 +09:00
Kazuki Ohta 2807504a81 java: add tests for float, double, nil, boolean, string 2010-04-17 22:10:41 +09:00
Kazuki Ohta 08b716c96d java: add TestPackUnpack for int 2010-04-17 21:16:32 +09:00
Kazuki Ohta b4b1f0a2c9 introduce JUnit framework for testing. 2010-04-17 20:17:43 +09:00
frsyuki 228f742b2f ruby: set encoding to 'ASCII-8BIT' before deserializing on ruby-1.9 2010-04-17 20:02:47 +09:00
frsyuki a55affe4d5 ruby: add Symbol#to_msgpack 2010-04-17 16:16:56 +09:00
frsyuki a6ec726ed7 malloc/realloc the stack when its length becomes > MSGPACK_EMBED_STACK_SIZE 2010-04-14 21:11:31 +09:00
frsyuki 87835a4e60 ruby: remove init_stack, adopt rb_gc_mark_maybe 2010-04-14 21:08:06 +09:00
Masahiro Nakagawa 1f18af4395 c: fixes comment in pack_template.h 2010-04-08 23:01:19 +09:00
frsyuki e79747a600 cpp: msgpack/pack.hpp: fixes header 2010-04-07 20:02:00 +09:00
Masahiro Nakagawa bd36ac2c0c cpp: fixes argument type of pack_int* methods 2010-04-07 19:54:14 +09:00
frsyuki c6186f2c01 ruby: version 0.3.7 2010-04-06 17:59:34 +09:00
frsyuki d639f57470 ruby: fixes Segmentation fault on MessagePack.unpack(nil) 2010-04-06 17:46:38 +09:00
Hideyuki TAKEI 99a2d28592 import MessagePack for PHP 2010-04-05 00:10:28 +09:00
frsyuki 254ee80c16 c: fixes msgpack_zbuffer_write: error checking 2010-04-04 22:11:16 +09:00
frsyuki e43f57fe1a c: fixes msgpack_zbuffer_flush: error checking 2010-04-04 22:06:27 +09:00
Masahiro Nakagawa f88c029a4c c: fixes msgpack_zbuffer_flush 2010-04-04 21:55:00 +09:00
frsyuki 93c3cbeaef ruby fixes gemspec: require_paths = ["lib"] 2010-04-04 21:45:56 +09:00
frsyuki 88c77b793f Merge branch 'master' of github.com:msgpack/msgpack 2010-04-04 21:40:19 +09:00
frsyuki 11286524a5 ruby: fixes 'File not found: lib' message on gem installation 2010-04-02 03:22:29 +09:00
frsyuki 7c863c341e ruby: use gem-compile gem instead of some scripts to create binary gems 2010-04-02 02:19:41 +09:00
moaikids 3416cf984e fix: org.msgpack.impl.UnpackerImpl.java CS_MAP_16 deserialize bug(line.388) 2010-04-01 23:15:36 +09:00
moaikids 1784746e7e fix: CS_MAP_16 deserialize bug(line.388) 2010-04-01 23:13:56 +09:00
Keiji Muraishi 6c6df1adaf should raise TypeError on find unsupported value 2010-03-31 17:29:07 +09:00
Keiji Muraishi f91e1c17c0 fix typo in Makefile 2010-03-31 17:09:00 +09:00
frsyuki 58201b95f2 ruby: version 0.3.4 2010-03-31 13:46:28 +09:00
frsyuki fcce8f6d51 ruby: use 'readpartial' instead of 'sysread' if !io.respond_to?(:sysread) 2010-03-31 12:00:26 +09:00
frsyuki f7bdda8828 cpp: fixes pack_short(int) -> pack_short(short) 2010-03-29 21:18:01 +09:00
frsyuki df5a60fd5b ruby: append_buffer calls "<<" method if the buffer object.class != String 2010-03-26 15:16:13 +09:00
frsyuki 5782ab7ccc c,cpp: add msgpack_zbuffer and msgpack::zbuffer 2010-03-26 14:33:49 +09:00
frsyuki 72e3f98213 cpp: alias pack(Stream* s, const T& v) -> pack(Stream& const T& v) 2010-03-26 14:30:50 +09:00
frsyuki 1b1433a664 ruby: copy the deserialized string if length <= RSTRING_EMBED_LEN_MAX 2010-03-26 14:29:49 +09:00
frsyuki 568704ed22 fixes Visual C++ compatibility 2010-03-19 13:34:53 +09:00
frsyuki 05a7e4eb64 ruby: add msgpack.mingw.{gemspec,sh} 2010-03-02 17:09:59 +09:00
frsyuki 7a0acf2838 Merge branch 'master' of frsyuki@git.sourceforge.jp:/gitroot/msgpack/msgpack 2010-03-01 18:00:16 +09:00
frsyuki 27787505e0 strict-aliasing rule 2 2010-02-27 02:37:01 +09:00
frsyuki 2c8048115d Merge branch 'master' of frsyuki@git.sourceforge.jp:/gitroot/msgpack/msgpack 2010-02-18 14:31:41 +09:00
frsyuki 7df1780853 ruby: makegem.sh 2010-02-06 21:31:16 +09:00
frsyuki d5609f3207 ruby: makegem.sh 2010-02-06 21:28:27 +09:00
frsyuki cd10fbc1fe removed symbolic links 2010-02-06 20:09:41 +09:00
firewood ca0b085d15 add a blanc after Japanese comment 2010-02-05 22:50:05 +09:00
firewood 9a034234d8 add vc2005 project file. 2010-02-05 22:49:28 +09:00
firewood 66ef6c9e4c undef after including winsock2.h. 2010-02-05 22:49:00 +09:00
frsyuki 7df60b259b MSVC2005 compatibility (@hotpepsi++) 2010-02-02 10:52:42 +09:00
frsyuki 34b3bbc883 ruby: add Unpacker#each 2010-01-29 17:23:48 +09:00
Naoki INADA e02d20dd74 replace setup by setup_dev. 2010-01-25 20:52:48 +09:00
Naoki INADA 1a11608f1f cythoning *.pyx when sdist. 2010-01-25 20:51:55 +09:00
Naoki INADA 9e2c9d7812 Tiny fix in README 2010-01-25 12:21:46 +09:00
Kazuki Ohta 404a393315 c, cpp: fix test problem
- using LDADD instead of LDFLAGS
- fix include path in test.cpp
2010-01-21 21:55:06 +09:00
frsyuki c69092e110 configure.in: fix message 2010-01-21 17:25:32 +09:00
frsyuki ebc0eeac79 c,cpp: 0.4.1 2010-01-20 15:17:33 +09:00
frsyuki 2b72f35c32 configure.in: show error message if __sync_* atomic operations are not supported 2010-01-20 14:49:51 +09:00
frsyuki d8212ad620 strict-aliasing rule 2010-01-20 14:46:54 +09:00
Kazuki Ohta 1066bb38a8 add tests for multi[map, set] and tr1::unordered_[multi][map, set] 2010-01-16 02:03:11 +09:00
frsyuki 2bf3f1856f c,cpp: configure.in: version 0.4.0 2010-01-15 14:45:52 +09:00
frsyuki f145129f6e c,cpp: optimize msgpack_vrefbuffer 2010-01-15 05:29:41 +09:00
frsyuki 8d365458d5 c,cpp: optimize msgpack_zone: variable-length array of chunk -> list of chunk 2010-01-15 05:27:44 +09:00
frsyuki 55cfbf378e cpp: add msgpack/type/tr1/unordered_{map,set}.hpp 2010-01-14 21:20:32 +09:00
frsyuki d76093b148 import MessagePack for Java 2010-01-08 17:34:14 +09:00
tokuhirom 7873e41e00 Perl: change for release Data-MessagePack-0.09 2010-01-04 12:10:46 +09:00
tokuhirom 9817e9b18d Perl: support NVTYPE=="long double" or IVTYPE="long long" environment. 2010-01-04 11:59:52 +09:00
tokuhirom 519716bbe4 Merge branch 'master' of git://git.sourceforge.jp/gitroot/msgpack/msgpack 2010-01-04 11:23:40 +09:00
frsyuki c2dd22ec10 c,cpp: add msgpack_vrefbuffer_migrate, msgpack::vrefbuffer::migrate 2009-12-19 22:09:29 +09:00
Naoki INADA 232aced926 Update gitignore. 2009-12-17 18:03:33 +09:00
Naoki INADA 63b9a876b0 Fix tests. 2009-12-17 17:58:41 +09:00
inada-n 5cf85a82d3 Add .gitignore for Python. 2009-12-17 15:20:20 +09:00
inada-n b9f78821d4 Make tuple default. 2009-12-17 15:19:18 +09:00
Naoki INADA f4c5b15cc6 Add use_tuple option that returns tuple for array object to Unpacker. 2009-12-17 11:13:47 +09:00
Naoki INADA 4d33bd456c Update new headers. 2009-12-17 10:43:22 +09:00
Naoki INADA 3a5f7f53ff Start 0.2.0 2009-12-17 10:43:01 +09:00
inada-n 1ed4236bcf Make new Python release. 2009-12-16 22:18:17 +09:00
inada-n 5ff2c6be74 Fix bug come from previous commit 2009-12-16 22:14:13 +09:00
inada-n dd18402737 Fix stream unpacker broken. 2009-12-16 22:05:31 +09:00
frsyuki 686e8ca0f0 c,cpp: fix unpacker 2009-12-16 04:08:36 +09:00
frsyuki 5aa47d6677 cpp: zone::push_finalizer supports std::auto_ptr<T> 2009-12-16 03:52:14 +09:00
frsyuki 0d44348c7d ruby: version 0.3.2 2009-12-11 04:13:24 +09:00
frsyuki 35929b46ae add msgpack/sysdep.h 2009-12-10 07:22:39 +09:00
frsyuki ba3ba0367c msgpack template: macros for compilers that doesn't not support Case Ranges 2009-12-10 06:40:29 +09:00
frsyuki 7ce866ad7c msgpack template: architecture specific endian conversion 2009-12-10 06:19:53 +09:00
frsyuki 0ae1965f6b ruby: fixes MessagePack_Unpacker_mark marks uninitialized map_key 2009-12-10 04:32:33 +09:00
frsyuki eb9e892491 import MessagePack for Java implementation plan 3 2009-11-26 11:22:08 +09:00
frsyuki e39e1d4f60 import MessagePack for Java implementation plan 2 2009-11-12 01:10:36 +09:00
Naoki INADA 93a95725fc Fix Makefile 2009-11-05 14:26:12 +09:00
Naoki INADA 4758d9f04b Fix to use MANIEFST.in. 2009-11-05 14:24:47 +09:00
frsyuki d39c016e1d java: fix streaming de/serializer 2009-10-25 02:41:55 +09:00
frsyuki 5393a0df16 import MessagePack for Java implementation plan 1 2009-10-25 01:27:09 +09:00
Tokuhiro Matsuno 68176e10f5 added some pattern to MANIFEST.SKIP 2009-10-22 14:34:53 +09:00
Tokuhiro Matsuno c6a2569af8 - generate README automatically
- added LICENSE term
2009-10-22 14:32:39 +09:00
frsyuki 3424dc916c cpp: add missing type::tuple::tuple(object o) 2009-10-09 17:49:30 +09:00
frsyuki c8ad32a39e cpp: preprocess.sh: more verbose 2009-10-05 23:31:08 +09:00
Kazuki Ohta d0b76814b0 cpp: add tests for stream unpacker api 2009-09-12 03:12:53 +09:00
frsyuki bf3cb63d46 cpp: version 0.3.8 2009-09-10 13:53:12 +09:00
frsyuki 8da7b692f6 cpp: define, type::tuple: GENERATION_LIMIT = 31 2009-09-10 13:50:19 +09:00
Kazuki Ohta 320c79db49 c++: add vrefbuffer test 2009-09-04 16:20:29 +09:00
frsyuki ebf64d9892 cpp: test.cpp: fixes EXPECT_EQ rule 2009-08-26 12:28:08 +09:00
frsyuki c12d5b8461 c: test.cpp: add msgpack_sbuffer_destroy and msgpack_zone_destroy 2009-08-26 12:27:28 +09:00
Kazuki Ohta 7186edc45e C: more strict tests for float, double
C++: more strict tests for float, double & enum, union member
2009-08-26 11:52:12 +09:00
Kazuki Ohta c94772104d C: add test for map
C++: add tests for primitive types, stl types, user-defined type
2009-08-26 11:28:54 +09:00
Kazuki Ohta 9374571056 C: add more tests (float, double, nil, true, false, array, raw) 2009-08-26 09:24:07 +09:00
Kazuki Ohta c232e91f83 c: fix bugs in c/test.cpp and add more tests 2009-08-25 19:26:54 +09:00
Kazuki Ohta 5b8777026a c: add sometests for serialization 2009-08-25 19:04:21 +09:00
Kazuki Ohta 51e435d46c fix build 2009-08-25 18:40:06 +09:00
frsyuki d3f9ab7dec add c/test.cpp cpp/test.cpp 2009-08-25 18:35:26 +09:00
frsyuki 1ba330c473 fix cpp/preprocess.sh 2009-08-25 18:25:58 +09:00
frsyuki dba7f480ed cpp: add missing preprocess.sh file 2009-08-19 17:50:15 +09:00
frsyuki 3a39accb0b cpp: preprocess eruby templates on ./bootstrap; released package doesn't require erb 2009-08-19 17:47:22 +09:00
frsyuki 387eca6fbf cpp-0.3.7 2009-08-19 17:36:05 +09:00
frsyuki b2381d0513 cpp: fix overflow check for minimum number of signed integer type 2009-08-19 15:10:10 +09:00
frsyuki 92952f6566 c++: fix object >> std::string 2009-08-10 22:16:44 +09:00
frsyuki a62a5d6c69 c++: fix type.hpp 2009-08-10 18:33:35 +09:00
frsyuki 0627324da6 c++: rebuild type/*.hpp 2009-08-10 18:26:01 +09:00
frsyuki 394331cd4e c++: add std::pair and std::set serializer 2009-08-10 17:34:21 +09:00
frsyuki 0491768fb2 c++: fix Makefile.am 2009-08-10 15:58:43 +09:00
frsyuki a5705183d6 0.3.5 2009-08-07 13:32:32 +09:00
frsyuki 95a6316cc7 cpp: fix msgpack::type::make_define() 2009-08-07 13:32:07 +09:00
frsyuki be32e3b1fb cpp: add missing msgpack::type::make_tuple() 2009-08-07 13:31:42 +09:00
frsyuki b4cb5e23c0 fix Makefile.am 2009-08-07 11:28:23 +09:00
frsyuki 1375732c80 add 2009-08-07 11:15:33 +09:00
frsyuki 7fbe845434 cpp: msgpack::define is obsolete 2009-08-06 13:59:48 +09:00
frsyuki 3afa9f265e cpp: add msgpack::type::define 2009-08-06 13:51:49 +09:00
frsyuki ec8932d6a1 fix missing tuple<>::value_type 2009-08-06 13:28:41 +09:00
frsyuki f7a9805f7b operator>> (object, std::vector<T>): return reference; don't copy 2009-08-06 13:26:34 +09:00
frsyuki aaef612a05 Makefile.am: don't package perl and ruby files 2009-08-06 13:20:43 +09:00
Tokuhiro Matsuno da9b75f553 Checking in changes prior to tagging of version 0.08. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index 4e7f1d7..c6e370c 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.08
+
+    - fixed PVNV issue...
+
 0.07

     - do not use switch (SvTYPE(val)).
2009-07-30 16:52:13 +09:00
Tokuhiro Matsuno d3906bd1ab Perl: use M::I::XSUtil 2009-07-30 16:38:03 +09:00
Tokuhiro Matsuno 4db90d23ac - fixed SVt_PVNV issue. 2009-07-30 16:22:00 +09:00
Tokuhiro Matsuno bb455c1f71 perl: display module version 2009-07-30 13:29:24 +09:00
Tokuhiro Matsuno 3275eee281 Perl: display original data 2009-07-30 13:24:38 +09:00
Tokuhiro Matsuno 0fe79a7752 Perl: added benchmark script for memroy-usage 2009-07-30 13:19:49 +09:00
Tokuhiro Matsuno 794adf9469 Checking in changes prior to tagging of version 0.07. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index 1a51ddf..4e7f1d7 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.07
+
+    - do not use switch (SvTYPE(val)).
+
 0.06

     - use SvNOK.
2009-07-22 16:42:12 +09:00
Tokuhiro Matsuno 718227bc2c Perl: do not use switch (SvTYPE) 2009-07-22 16:40:15 +09:00
Tokuhiro Matsuno 390c5ad8a0 added test case. 2009-07-22 13:41:31 +09:00
Tokuhiro Matsuno 2da4b17d0b Merge branch 'master' of tokuhirom@git.sourceforge.jp:/gitroot/msgpack/msgpack 2009-07-22 13:28:27 +09:00
inada-n d19c488929 version: python-0.1.1 2009-07-13 15:52:25 +09:00
inada-n 0db5e0439d Fix: Unpacker.unpack() may raise StopIteration before unpacking large object when deserializing from file. 2009-07-13 15:49:38 +09:00
inada-n 6083bad5ff Fix wrong MANIFEST. 2009-07-13 14:46:53 +09:00
inada-n 63a507a123 merge python binding from bzr. 2009-07-13 14:40:02 +09:00
Naoki INADA 294e3fe7ab Add setup script for distribution. 2009-07-13 14:27:57 +09:00
Naoki INADA e5c49dae13 Release 0.1.0 2009-07-12 20:02:21 +09:00
Naoki INADA 900785e1aa Clean up 2009-07-12 09:29:11 +09:00
Naoki INADA 979efbb950 Support MinGW. 2009-07-09 13:41:04 +09:00
Tokuhiro Matsuno 7da1a9b3cf Checking in changes prior to tagging of version 0.06. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index 15603ea..1a51ddf 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.06
+
+    - use SvNOK.
+
 0.05

     - change type detection for old perl
2009-07-03 18:19:29 +09:00
Tokuhiro Matsuno 661f273481 Perl: use SvNOK. 2009-07-03 18:18:40 +09:00
Tokuhiro Matsuno cb5c878b77 Checking in changes prior to tagging of version 0.05. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index 33fb36c..15603ea 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,7 @@
+0.05
+
+    - change type detection for old perl
+
 0.04

     - check SvROK first(reported by yappo++)
2009-07-03 18:15:45 +09:00
Tokuhiro Matsuno 34ed3bc9e3 Perl: check IV by SvIOK 2009-07-03 18:09:38 +09:00
Tokuhiro Matsuno ad7cf12128 perl: added test case for "the flag is working?" 2009-07-03 17:27:44 +09:00
Tokuhiro Matsuno 6fb6283463 Checking in changes prior to tagging of version 0.04. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index 0c170a3..33fb36c 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,11 @@
+0.04
+
+    - check SvROK first(reported by yappo++)
+    - PreferInteger: faster string to integer conversion; support negative value
+      (frsyuki++)
+    - make PreferInteger variable magical and remove get_sv from _msgpack_pack_sv
+      (frsyuki++)
+
 0.03

     - performance tuning for too long string
2009-07-03 15:23:50 +09:00
Tokuhiro Matsuno b45dc8db61 check SvROK first 2009-07-03 15:14:31 +09:00
Tokuhiro Matsuno 3397d261d8 Merge branch 'master' of tokuhirom@git.sourceforge.jp:/gitroot/msgpack/msgpack
Conflicts:
	perl/lib/Data/MessagePack.pm
2009-07-03 11:39:34 +09:00
frsyuki eaa8be8ddd perl: PreferInteger: faster string to integer conversion; support negative value 2009-07-03 02:08:22 +09:00
frsyuki 0f9dcb8610 perl: make PreferInteger variable magical and remove get_sv from _msgpack_pack_sv 2009-07-03 01:49:37 +09:00
Tokuhiro Matsuno 3446c475d7 Checking in changes prior to tagging of version 0.03. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index fb31a69..0c170a3 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,8 @@
+0.03
+
+    - performance tuning for too long string
+    - fixed memory leaks in stream unpacker
+
 0.02

     - added $Data::MessagePack::PreferInteger
2009-07-02 17:43:58 +09:00
Tokuhiro Matsuno ffef0a0b6f oops. fixed memory leaks in stream unpacker. 2009-07-02 17:42:28 +09:00
Tokuhiro Matsuno 580fbe77e9 do not check the string longer than 10. 2009-07-02 16:40:41 +09:00
Tokuhiro Matsuno e92e99c4d1 Perl: I don't need CCFLAGS 2009-07-02 14:43:22 +09:00
Tokuhiro Matsuno c3f793aa09 Checking in changes prior to tagging of version 0.02. Changelog diff is:
diff --git a/perl/Changes b/perl/Changes
index 18041d4..fb31a69 100644
--- a/perl/Changes
+++ b/perl/Changes
@@ -1,3 +1,8 @@
+0.02
+
+    - added $Data::MessagePack::PreferInteger
+      (requested by yappo++)
+
 0.01

     - initial release to CPAN
2009-07-02 14:37:54 +09:00
Tokuhiro Matsuno 3d9908c8e5 Merge branch 'master' of git://git.sourceforge.jp/gitroot/msgpack/msgpack
Conflicts:
	perl/pack.c
2009-07-02 14:31:52 +09:00
Tokuhiro Matsuno 7b198d5966 s/Preferred/Prefer/g suggested by kazuho++ 2009-07-02 14:29:49 +09:00
Tokuhiro Matsuno 601209c83c support $Data::MessagePack::PreferredInteger for Data::Model 2009-07-02 14:25:48 +09:00
Naoki INADA 78db826a75 Fix memory leak. Remove stream packing feature. Add errorcheck in packing. 2009-07-01 20:55:24 +09:00
Tokuhiro Matsuno c2a63b2c54 Checking in changes prior to tagging of version 0.01. Changelog diff is: 2009-07-01 18:40:14 +09:00
Tokuhiro Matsuno 7c27624161 added .shipit file 2009-07-01 18:34:27 +09:00
Tokuhiro Matsuno d86b90e663 added Changes file 2009-07-01 18:34:11 +09:00
Tokuhiro Matsuno d72bef9f9a added MANIFEST.SKIP files 2009-07-01 18:33:56 +09:00
Tokuhiro Matsuno 37972dfe3e copy files into this dir. 2009-07-01 18:20:14 +09:00
Tokuhiro Matsuno c6496ddf13 added .gitignore file 2009-07-01 18:08:39 +09:00
Tokuhiro Matsuno a95e8c790c this module requires perl 5.8 2009-07-01 17:45:18 +09:00
Naoki INADA 03942a1b90 Major speedup on packing. 2009-07-01 00:57:46 +09:00
Naoki INADA d4317fdc85 Some optimization on packing. 2009-06-30 23:03:33 +09:00
Naoki INADA b5010c71a9 Fix tests. 2009-06-29 11:21:28 +09:00
Naoki INADA 9015bd4ecf Fix error on packing unsigned long long. 2009-06-29 10:09:04 +09:00
Naoki INADA fe2421275d Add some test cases. 2009-06-29 09:31:43 +09:00
Naoki INADA 257270c1eb Refactor packing code. 2009-06-29 08:23:49 +09:00
Naoki INADA 0b33a634a6 Update test_format. 2009-06-29 08:23:27 +09:00
Naoki INADA 3e396ef146 Don't use C++. 2009-06-28 21:24:16 +09:00
Naoki INADA 1b07b61c04 Ues more suitable type when packing. 2009-06-28 21:24:02 +09:00
Naoki INADA fa2efcdb5b Rename test files. 2009-06-27 12:04:11 +09:00
Naoki INADA a345131aaa Add: README 2009-06-27 12:03:00 +09:00
Naoki INADA ffc16736ba merge to git master 2009-06-27 10:35:07 +09:00
Naoki INADA 3c3df3133c Implement streaming deserializer. 2009-06-26 14:10:20 +09:00
Naoki INADA 16a208243b merge 2009-06-26 14:09:15 +09:00
frsyuki 8f52ed26c7 version 0.3.3 2009-06-24 16:01:13 +09:00
Naoki INADA 479263989b Stop unnecessary caching. 2009-06-24 14:58:02 +09:00
Tokuhiro Matsuno 8e166de1d1 works correctly under Perl5.8.x. Perl5.8.x makes "a" as PVIV in {"a", 0}. 2009-06-24 14:46:28 +09:00
Tokuhiro Matsuno 3aef3edbad works correctly under Perl5.8.x.
Perl5.8.x makes "a" as PVIV in {"a", 0}.
2009-06-24 14:36:37 +09:00
Tokuhiro Matsuno 9a342ab7f8 update ppport.h 2009-06-24 14:11:06 +09:00
frsyuki 8596d36d02 perl package 2009-06-24 13:53:12 +09:00
Naoki INADA 423e5132a1 merge 2009-06-24 08:49:48 +09:00
Naoki INADA 1581acfd14 Make setup.py executable. 2009-06-24 14:33:36 +09:00
Naoki INADA 5d4189306a Check return value of c-api. 2009-06-24 04:25:05 +09:00
Naoki INADA f61b282886 Reduce memory footprint. 2009-06-24 01:54:47 +09:00
Naoki INADA 3fd28d0792 Remove duplicated values. 2009-06-24 01:38:48 +09:00
Naoki INADA dd53b141ef Remove unneccessary value. 2009-06-24 01:13:39 +09:00
Naoki INADA 99d0a41ec6 Fix setup script bug. 2009-06-24 01:13:22 +09:00
Naoki INADA b8e5b918a3 Update manifest. 2009-06-22 22:50:05 +09:00
Naoki INADA 71af62c1df merge to master. 2009-06-22 20:08:17 +09:00
Naoki INADA 7d5f04917e Update manifest. 2009-06-22 19:55:46 +09:00
Naoki INADA 46d7c65621 Fix compile error. 2009-06-22 19:49:02 +09:00
Naoki INADA 87f5df1503 Use std::stack. 2009-06-22 15:59:02 +09:00
Naoki INADA 9a77ab57f6 merge document fix. 2009-06-22 14:55:46 +09:00
Naoki INADA 20a7ff0be8 Make msgpack package instead of module. and using Cython in setup script. 2009-06-22 14:38:36 +09:00
Naoki INADA 075081a521 Fix manifest. 2009-06-22 14:28:04 +09:00
Naoki INADA f4387e9746 merge changing include path 2009-06-22 13:26:41 +09:00
Naoki INADA 0d14239c21 Optimize to parsing data that has a number of same short raw field. 2009-06-22 09:51:24 +09:00
Naoki INADA 2475187c7d Fix refcount leak and optimize list initialization. 2009-06-17 13:45:08 +09:00
Naoki INADA 4d6e9ffaa2 Fix can't pack float values. 2009-06-16 01:58:07 +09:00
Naoki INADA 6184e17a42 Increase stack size. 2009-06-16 01:56:04 +09:00
Naoki INADA e814986b4e Fix document miss. 2009-06-10 13:33:42 +09:00
Naoki INADA 3a9f74e79c Make msgpack package instead of module. 2009-06-10 10:58:09 +09:00
Naoki INADA a1fb1507d4 Refactor include path. 2009-06-10 10:45:07 +09:00
Naoki INADA 85ca594118 free buffer when packer deleted. 2009-06-09 13:12:29 +09:00
Naoki INADA 9c9393bff9 Fix setup script doesn't work. 2009-06-08 13:21:38 +09:00
Naoki INADA 560bd901f8 Fix double INCREF-ing when unpacking. 2009-06-08 12:46:02 +09:00
Naoki INADA 114ef92d42 Merge branch 'master' of git://git.sourceforge.jp/gitroot/msgpack/msgpack 2009-06-08 04:43:25 +09:00
Naoki INADA 1840ef70ae merge to trunk 2009-06-08 04:38:20 +09:00
Naoki INADA 935db853f0 add test. 2009-06-08 04:33:58 +09:00
Naoki INADA 17d2ca2d63 Fix unpacking True, False and True. 2009-06-08 04:33:47 +09:00
Naoki INADA c930f5367b add cythoned source and setup script. 2009-06-08 01:43:50 +09:00
Naoki INADA d8a3bc920c refactoring 2009-06-08 01:30:43 +09:00
Naoki INADA 711e4817a5 support packing long and tuple. add missing files. 2009-06-08 00:23:38 +09:00
frsyuki 7cd359c1fd add msgpack_vrefbuffer, msgpack::vrefbuffer 2009-06-07 14:59:50 +09:00
frsyuki 2598d98922 Merge branch 'master' of frsyuki@git.sourceforge.jp:/gitroot/msgpack/msgpack 2009-06-07 13:33:22 +09:00
frsyuki 8617213149 cpp: fix map<K, V> converter 2009-06-03 22:01:27 +09:00
Naoki INADA 3628ea22d4 add pyx 2009-05-22 14:31:20 +09:00
frsyuki 6a0729ea91 cpp: const 2009-05-13 17:53:27 +09:00
Tokuhiro Matsuno b0062a7f6f perl: oops. this doens't needed. 2009-04-15 23:14:56 +09:00
Tokuhiro Matsuno b140b27b9a perl: added argument check 2009-04-15 23:11:26 +09:00
Tokuhiro Matsuno e0bd2a2911 perl: added benchmark script for deserialization 2009-04-15 23:06:47 +09:00
Tokuhiro Matsuno ea41db4cc7 perl: renamed benchmark script 2009-04-15 23:02:27 +09:00
Tokuhiro Matsuno 5a201be844 perl: use more efficent strategy for memory allocation.this code taken from JSON::XS. thanks to mlehmann++ 2009-04-15 22:43:59 +09:00
Tokuhiro Matsuno 28e113fd00 oops. remove debugging code. 2009-04-15 22:43:16 +09:00
Tokuhiro Matsuno 5710b87b06 perl: enhancement portability 2009-04-15 13:09:05 +09:00
Tokuhiro Matsuno 8c62d93bca added perl support 2009-04-15 12:55:41 +09:00
frsyuki b8cc8b72bd version 0.3.1 2009-03-04 01:54:07 +09:00
frsyuki cc7379d532 more test caces 2009-03-04 01:36:56 +09:00
frsyuki 163fc6f589 fix serialization bug on BigEndian environment 3 2009-03-04 01:15:22 +09:00
frsyuki c7f193e441 fix serialization bug on BigEndian environment 2009-03-04 01:04:43 +09:00
frsyuki 09978e500a update ruby/msgpack.gemspec 2009-03-01 18:32:50 +09:00
frsyuki 2fad10ca3f zone::base 2009-03-01 16:40:02 +09:00
frsyuki e707b7a600 zone::push_finalizer reverts memory allocation on exception 2009-03-01 15:49:24 +09:00
frsyuki e7403013e5 msgpack_zone: sizeof(int) bytes alignment 2009-03-01 14:59:13 +09:00
frsyuki c3f9696268 fix packaging problem 2009-03-01 13:46:20 +09:00
frsyuki cb24a0c24f fix msgpack_unpacker_expand_buffer 2009-03-01 03:39:34 +09:00
frsyuki 0efb8160b9 msgpack_zone_clear, msgpack::zone::clear 2009-03-01 02:55:45 +09:00
frsyuki bf13ba72b5 fix unpacker 2009-03-01 02:27:04 +09:00
frsyuki 6fc38d1669 msgpack::pack is not obsolete 2009-03-01 01:31:12 +09:00
frsyuki 879c70f93a fix msgpack_sbuffer_release 2009-03-01 01:13:31 +09:00
frsyuki 6fda01111e msgpack::sbuffer::data() const 2009-03-01 01:06:16 +09:00
frsyuki 4f4fa39cd5 c: msgpack_sbuffer; cpp: msgpack::sbuffer 2009-03-01 00:59:15 +09:00
frsyuki (none) c60b6be548 add NOTICE file 2009-02-26 18:37:13 +09:00
frsyuki (none) 9b4b49a6a8 example: limit message size 2009-02-26 01:33:34 +09:00
frsyuki (none) c0baf9b873 add msgpack_unpacker_message_size 2009-02-26 01:27:00 +09:00
frsyuki (none) 65ef9cab66 remove msgpack_unpacker_buffered_size, add msgpack_unpacker_parsed_size 2009-02-26 01:15:14 +09:00
frsyuki (none) 6ffee9e54a c: msgpack_unpacker_buffered_size; c++: unpacker::buffered_size 2009-02-25 23:31:53 +09:00
frsyuki (none) 43360e3786 fix msgpack::unpack_return 2009-02-25 18:55:56 +09:00
frsyuki (none) 4d708aa4da c: msgpack_pack_object 2009-02-24 16:37:47 +09:00
frsyuki (none) 5d51129e65 add example/simple.c 2009-02-24 16:37:01 +09:00
frsyuki (none) a0b82e39e1 AC_CONFIG_AUX_DIR(ac) 2009-02-22 15:47:06 +09:00
frsyuki (none) 9642368835 type conversion operator msgpack_object <-> msgpack::object 2009-02-22 15:36:02 +09:00
frsyuki (none) cbf7afc1cc c and c++: rewritten and integrated 2009-02-22 15:14:21 +09:00
148 changed files with 28283 additions and 11302 deletions
+48
View File
@@ -0,0 +1,48 @@
# Files generated by the bootstrap script.
/INSTALL
/NEWS
/README
/ac/
/aclocal.m4
/autom4te.cache/
/config.h.in
/configure
/msgpack_vc2008.sln
/msgpack_vc2008.vcproj
Makefile.in
# Files generated by the configure script.
/config.h
/config.log
/config.status
/libtool
/msgpack.pc
/src/msgpack/version.h
/stamp-h1
Makefile
.deps
.libs
# Files generated by make.
*.o
*.so
*.lo
*.la
# Files generated by make check.
# TODO: Replace these with something like /test/*_test
/test/buffer
/test/cases
/test/convert
/test/fixint
/test/fixint_c
/test/msgpack_test
/test/msgpackc_test
/test/object
/test/pack_unpack
/test/pack_unpack_c
/test/streaming
/test/streaming_c
/test/version
/test/zone
+25
View File
@@ -0,0 +1,25 @@
language: cpp
cache:
- apt
compiler:
- clang
- gcc
before_install:
# We need this line to have g++4.8 available in apt
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get update
- sudo apt-get install valgrind
- sudo apt-get install libgtest-dev
- "cd /usr/src/gtest && sudo cmake . && sudo cmake --build . && sudo mv libg* /usr/local/lib/ ; cd -"
install:
- sudo apt-get install -qq gcc-4.8 g++-4.8
# We want to compile with g++ 4.8 when rather than the default g++
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90
env:
- ACTION="ci/build_autotools.sh" PARAM="cpp03"
- ACTION="ci/build_cmake.sh" PARAM="cpp03"
script:
- git clean -xdf && ${ACTION} ${PARAM}
+193
View File
@@ -0,0 +1,193 @@
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.6)
PROJECT (msgpack)
SET (VERSION 0.5.9)
SET (VERSION_MAJOR 0)
SET (VERSION_MINOR 5)
SET (prefix ${CMAKE_INSTALL_PREFIX})
SET (exec_prefix "\${prefix}")
SET (libdir "\${exec_prefix}/lib")
SET (includedir "\${prefix}/include")
FIND_PACKAGE (GTest)
FIND_PACKAGE (ZLIB)
FIND_PACKAGE (Threads)
IF (GTEST_FOUND AND ZLIB_FOUND AND THREADS_FOUND)
OPTION (MSGPACK_BUILD_TESTS "Build msgpack tests." ON)
ENDIF ()
OPTION (MSGPACK_ENABLE_CXX "Enable C++ interface." ON)
INCLUDE (CheckCXXSourceCompiles)
CHECK_CXX_SOURCE_COMPILES ("
#include <bits/atomicity.h>
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
int main(int argc, char * argv[])
{
atomic_sub(1);
atomic_add(1);
}
" MSGPACK_ENABLE_GCC_CXX_ATOMIC)
IF (MSGPACK_ENABLE_CXX)
LIST (APPEND msgpack_SOURCES
src/object.cpp
)
ENDIF ()
IF (MSGPACK_ENABLE_GCC_CXX_ATOMIC)
LIST (APPEND msgpack_SOURCES
src/gcc_atomic.cpp
)
ENDIF ()
LIST (APPEND msgpack_SOURCES
src/unpack.c
src/objectc.c
src/version.c
src/vrefbuffer.c
src/zone.c
)
LIST (APPEND msgpack_HEADERS
src/msgpack/pack_define.h
src/msgpack/pack_template.h
src/msgpack/unpack_define.h
src/msgpack/unpack_template.h
src/msgpack/sysdep.h
src/msgpack/sbuffer.h
src/msgpack/version.h
src/msgpack/vrefbuffer.h
src/msgpack/zbuffer.h
src/msgpack/fbuffer.h
src/msgpack/pack.h
src/msgpack/unpack.h
src/msgpack/object.h
src/msgpack/zone.h
)
IF (MSGPACK_ENABLE_CXX)
LIST (APPEND msgpack_HEADERS
src/msgpack.hpp
src/msgpack/sbuffer.hpp
src/msgpack/vrefbuffer.hpp
src/msgpack/zbuffer.hpp
src/msgpack/fbuffer.hpp
src/msgpack/pack.hpp
src/msgpack/unpack.hpp
src/msgpack/object.hpp
src/msgpack/zone.hpp
src/msgpack/type.hpp
src/msgpack/type/bool.hpp
src/msgpack/type/deque.hpp
src/msgpack/type/float.hpp
src/msgpack/type/fixint.hpp
src/msgpack/type/int.hpp
src/msgpack/type/list.hpp
src/msgpack/type/map.hpp
src/msgpack/type/nil.hpp
src/msgpack/type/pair.hpp
src/msgpack/type/raw.hpp
src/msgpack/type/set.hpp
src/msgpack/type/string.hpp
src/msgpack/type/vector.hpp
src/msgpack/type/tuple.hpp
src/msgpack/type/define.hpp
src/msgpack/type/tr1/unordered_map.hpp
src/msgpack/type/tr1/unordered_set.hpp
)
ENDIF ()
EXECUTE_PROCESS (
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/src/msgpack
)
CONFIGURE_FILE (
src/msgpack/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/src/msgpack/version.h
)
CONFIGURE_FILE (
msgpack.pc.in
msgpack.pc
@ONLY
)
INCLUDE_DIRECTORIES (
./
src/
src/msgpack/
${CMAKE_CURRENT_BINARY_DIR}/src/
${CMAKE_CURRENT_BINARY_DIR}/src/msgpack/
)
ADD_LIBRARY (msgpack SHARED
${msgpack_SOURCES}
${msgpack_HEADERS}
)
ADD_LIBRARY (msgpack-static STATIC
${msgpack_SOURCES}
${msgpack_HEADERS}
)
SET_TARGET_PROPERTIES (msgpack-static PROPERTIES OUTPUT_NAME "msgpack")
SET_TARGET_PROPERTIES (msgpack PROPERTIES IMPORT_SUFFIX "_import.lib")
SET_TARGET_PROPERTIES (msgpack PROPERTIES SOVERSION 3 VERSION 3.0.0)
IF (MSGPACK_BUILD_TESTS)
ENABLE_TESTING ()
ADD_SUBDIRECTORY (test)
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
SET_PROPERTY (TARGET msgpack APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3 -DPIC")
SET_PROPERTY (TARGET msgpack-static APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -g -O3" )
ENDIF ()
IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
IF (CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ELSE ()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
ENDIF ()
ENDIF ()
IF (NOT DEFINED CMAKE_INSTALL_LIBDIR)
SET(CMAKE_INSTALL_LIBDIR lib)
ENDIF ()
INSTALL (TARGETS msgpack msgpack-static DESTINATION ${CMAKE_INSTALL_LIBDIR})
INSTALL (DIRECTORY src/msgpack DESTINATION include)
INSTALL (DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src/msgpack DESTINATION include)
INSTALL (FILES src/msgpack.h src/msgpack.hpp DESTINATION include)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
# Doxygen
FIND_PACKAGE (Doxygen)
IF (DOXYGEN_FOUND)
ADD_CUSTOM_TARGET (
doxygen_c
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${CMAKE_COMMAND} -E echo "FILE_PATTERNS = *.h" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY = doc_c" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME = \"MessagePack for C\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_c
VERBATIM
)
ADD_CUSTOM_TARGET (
doxygen_cpp
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${CMAKE_COMMAND} -E echo "FILE_PATTERNS = *.hpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${CMAKE_COMMAND} -E echo "OUTPUT_DIRECTORY = doc_cpp" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${CMAKE_COMMAND} -E echo "PROJECT_NAME = \"MessagePack for C++\"" >> ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_cpp
VERBATIM
)
ADD_CUSTOM_TARGET (
doxygen
DEPENDS doxygen_c doxygen_cpp
)
ENDIF ()
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (C) 2008-2009 FURUHASHI Sadayuki
Copyright (C) 2008-2010 FURUHASHI Sadayuki
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
+72
View File
@@ -0,0 +1,72 @@
2014-07-02 version 0.5.9:
* Support std::tr1 unordered containers by default (#51, #63, #68, #69)
* Remove some warnings (#56)
* Fix segmentation fault after malloc failures (#58, #59)
* Fix alloc/dealloc mismatch (#52, #61)
* Fix sample codes (#60, #64)
* Support implicit conversion from integer to float/double (#54)
* Improve documents (#45, #75, #82, #83)
* Support CMake (#20, #87)
* Remove Ruby dependencies in bootstrap (#86, #87)
* Add FILE* buffer (#40)
* Other bug fixes and refactoring: #39, #73, #77, #79, #80, #81, #84, #90
2013-12-23 version 0.5.8:
* Move to the new github repository msgpack/msgpack-c
* Support the new deserialization specification
* fixes the problem of unpack helpers for array and map with 32bit compilers (#37, #38)
* Other bug fixes and refactoring: #46, #41, #36, #35, #33, #32, #30, #29, #28, #27, #26, #25, #8, #3
* Update of documents: #23, #18, #17
2011-08-08 version 0.5.7:
* fixes compile error problem with llvm-gcc and Mac OS X Lion
2011-04-24 version 0.5.6:
* #42 fixes double-free problem on msgpack_unpacker_release_zone
2011-02-24 version 0.5.5:
* eliminates dependency of winsock2.h header
* fixes msgpack_vc.postbuild.bat file
* fixes some implicit cast warnings
2010-08-29 version 0.5.4:
* includes msgpack_vc2008.vcproj file in source package
* fixes type::fix_int types
2010-08-27 version 0.5.3:
* adds type::fix_{u,}int{8,16,32,64} types
* adds msgpack_pack_fix_{u,}int{8,16,32,64} functions
* adds packer<Stream>::pack_fix_{u,}int{8,16,32,64} functions
* fixes include paths
2010-07-14 version 0.5.2:
* type::raw::str(), operator==, operator!=, operator< and operator> are now const
* generates version.h using AC_OUTPUT macro in ./configure
2010-07-06 version 0.5.1:
* Add msgpack_vrefbuffer_new and msgpack_vrefbuffer_free
* Add msgpack_sbuffer_new and msgpack_sbuffer_free
* Add msgpack_unpacker_next and msgpack_unpack_next
* msgpack::unpack returns void
* Add MSGPACK_VERSION{,_MAJOR,_MINOR} macros to check header version
* Add msgpack_version{,_major,_minor} functions to check library version
* ./configure supports --disable-cxx option not to build C++ API
2010-04-29 version 0.5.0:
* msgpack_object_type is changed. MSGPACK_OBJECT_NIL is now 0x00.
* New safe streaming deserializer API.
* Add object::object(const T&) and object::operator=(const T&)
* Add operator==(object, const T&)
* MSGPACK_DEFINE macro defines msgpack_object(object* obj, zone* z)
* C++ programs doesn't need to link "msgpackc" library.
+1552
View File
File diff suppressed because it is too large Load Diff
+17 -44
View File
@@ -1,48 +1,21 @@
if ENABLE_CXX
export ERB
SUBDIRS = c cpp
else
SUBDIRS = c
endif
SUBDIRS = src test
nobase_include_HEADERS = \
msgpack/pack_define.h \
msgpack/pack_template.h \
msgpack/unpack_define.h \
msgpack/unpack_template.h
DOC_FILES = \
README.md \
LICENSE \
NOTICE \
msgpack_vc8.vcproj \
msgpack_vc8.sln \
msgpack_vc.postbuild.bat
EXTRA_DIST = \
ruby/bench.rb \
ruby/extconf.rb \
ruby/gem/README \
ruby/gem/Rakefile \
ruby/gem/test/test_helper.rb \
ruby/gengem.sh \
ruby/msgpack.gemspec \
ruby/pack.c \
ruby/pack.h \
ruby/rbinit.c \
ruby/test_case.rb \
ruby/test_format.rb \
ruby/test_pack.rb \
ruby/unpack.c \
ruby/unpack.h \
perl/Makefile.PL \
perl/MessagePack.c \
perl/benchmark/deserialize.pl \
perl/benchmark/serialize.pl \
perl/lib/Data/MessagePack.pm \
perl/lib/Data/MessagePack \
perl/lib/Data/MessagePack/Unpacker.pod \
perl/pack.c \
perl/ppport.h \
perl/t/00_compile.t \
perl/t/01_pack.t \
perl/t/02_unpack.t \
perl/t/03_stream_unpack.t \
perl/t/04_invert.t \
perl/t/Util.pm \
perl/t/data.pl \
perl/unpack.c \
perl/xt/99_pod.t
$(DOC_FILES) CMakeLists.txt test/CMakeLists.txt
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = msgpack.pc
doxygen:
./preprocess clean
cd src && $(MAKE) doxygen
./preprocess
View File
+194
View File
@@ -0,0 +1,194 @@
# Implementation Status
The serialization library is production-ready.
Currently, no RPC implementation is not available.
# Install
## Mac OS X with MacPorts
On Mac OS X, you can install MessagePack for C using MacPorts.
```
$ sudo port install msgpack
```
You might need to run `sudo port selfupdate` before installing to update the package repository.
You can also install via Homebrew.
```
$ sudo brew install msgpack
```
## FreeBSD with Ports Collection
On FreeBSD, you can use Ports Collection. Install [net/msgpack|http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/] package.
## Gentoo Linux with Portage
On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack|http://gentoo-portage.com/dev-libs/msgpack] package.
## Other UNIX-like platform with ./configure
On the other UNIX-like platforms, download source package from [Releases|http://msgpack.org/releases/cpp/] and run `./configure && make && make install`.
```
$ wget http://msgpack.org/releases/cpp/msgpack-0.5.5.tar.gz
$ tar zxvf msgpack-0.5.5.tar.gz
$ cd msgpack-0.5.5
$ ./configure
$ make
$ sudo make install
```
## Windows
On Windows, download source package from [here|https://sourceforge.net/projects/msgpack/files/] and extract it.
Then open `msgpack_vc8.vcproj` file and build it using batch build. It builds libraries on `lib/` folder and header files on `include/` folder.
You can build using command line as follows:
```
> vcbuild msgpack_vc2008.vcproj
> dir lib % DLL files are here
> dir include % header files are here
```
## Install from git repository
You need to install gcc (4.1.0 or higher), autotools.
```
$ git clone git@github.com:msgpack/msgpack.git
$ cd msgpack/cpp
$ ./bootstrap
$ ./configure
$ make
$ sudo make install
```
# Serialization QuickStart for C
## First program
Include `msgpack.h` header and link `msgpack` library to use MessagePack on your program.
```c
#include <msgpack.h>
#include <stdio.h>
int main(void) {
/* creates buffer and serializer instance. */
msgpack_sbuffer* buffer = msgpack_sbuffer_new();
msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write);
/* serializes ["Hello", "MessagePack"]. */
msgpack_pack_array(pk, 2);
msgpack_pack_raw(pk, 5);
msgpack_pack_raw_body(pk, "Hello", 5);
msgpack_pack_raw(pk, 11);
msgpack_pack_raw_body(pk, "MessagePack", 11);
/* deserializes it. */
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
bool success = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL);
/* prints the deserialized object. */
msgpack_object obj = msg.data;
msgpack_object_print(stdout, obj); /*=> ["Hello", "MessagePack"] */
/* cleaning */
msgpack_sbuffer_free(buffer);
msgpack_packer_free(pk);
}
```
## Simple program with a loop
```c
#include <msgpack.h>
#include <stdio.h>
int main(void) {
/* creates buffer and serializer instance. */
msgpack_sbuffer* buffer = msgpack_sbuffer_new();
msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write);
int j;
for(j = 0; j<23; j++) {
/* NB: the buffer needs to be cleared on each iteration */
msgpack_sbuffer_clear(buffer);
/* serializes ["Hello", "MessagePack"]. */
msgpack_pack_array(pk, 3);
msgpack_pack_raw(pk, 5);
msgpack_pack_raw_body(pk, "Hello", 5);
msgpack_pack_raw(pk, 11);
msgpack_pack_raw_body(pk, "MessagePack", 11);
msgpack_pack_int(pk, j);
/* deserializes it. */
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
bool success = msgpack_unpack_next(&msg, buffer->data, buffer->size, NULL);
/* prints the deserialized object. */
msgpack_object obj = msg.data;
msgpack_object_print(stdout, obj); /*=> ["Hello", "MessagePack"] */
puts("");
}
/* cleaning */
msgpack_sbuffer_free(buffer);
msgpack_packer_free(pk);
}
```
## Streaming feature
```c
#include <msgpack.h>
#include <stdio.h>
int main(void) {
/* serializes multiple objects using msgpack_packer. */
msgpack_sbuffer* buffer = msgpack_sbuffer_new();
msgpack_packer* pk = msgpack_packer_new(buffer, msgpack_sbuffer_write);
msgpack_pack_int(pk, 1);
msgpack_pack_int(pk, 2);
msgpack_pack_int(pk, 3);
/* deserializes these objects using msgpack_unpacker. */
msgpack_unpacker pac;
msgpack_unpacker_init(&pac, MSGPACK_UNPACKER_INIT_BUFFER_SIZE);
/* feeds the buffer. */
msgpack_unpacker_reserve_buffer(&pac, buffer->size);
memcpy(msgpack_unpacker_buffer(&pac), buffer->data, buffer->size);
msgpack_unpacker_buffer_consumed(&pac, buffer->size);
/* now starts streaming deserialization. */
msgpack_unpacked result;
msgpack_unpacked_init(&result);
while(msgpack_unpacker_next(&pac, &result)) {
msgpack_object_print(stdout, result.data);
puts("");
}
/* results:
* $ gcc stream.cc -lmsgpack -o stream
* $ ./stream
* 1
* 2
* 3
*/
}
```
+159
View File
@@ -0,0 +1,159 @@
# Implementation Status
The serialization library is production-ready.
Currently, RPC implementation is testing phase. Requires newer kernel, not running on RHEL5/CentOS5.
# Install
Same as QuickStart for C Language.
# Serialization QuickStart for C+\+
## First program
Include `msgpack.hpp` header and link `msgpack` library to use MessagePack on your program.
```cpp
#include <msgpack.hpp>
#include <vector>
#include <string>
#include <iostream>
int main(void) {
// serializes this object.
std::vector<std::string> vec;
vec.push_back("Hello");
vec.push_back("MessagePack");
// serialize it into simple buffer.
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, vec);
// deserialize it.
msgpack::unpacked msg;
msgpack::unpack(&msg, sbuf.data(), sbuf.size());
// print the deserialized object.
msgpack::object obj = msg.get();
std::cout << obj << std::endl; //=> ["Hello", "MessagePack"]
// convert it into statically typed object.
std::vector<std::string> rvec;
obj.convert(&rvec);
}
```
Compile it as follows:
```
$ g++ hello.cc -lmsgpack -o hello
$ ./hello
["Hello", "MessagePack"]
```
## Streaming feature
```cpp
#include <msgpack.hpp>
#include <iostream>
#include <string>
int main(void) {
// serializes multiple objects using msgpack::packer.
msgpack::sbuffer buffer;
msgpack::packer<msgpack::sbuffer> pk(&buffer);
pk.pack(std::string("Log message ... 1"));
pk.pack(std::string("Log message ... 2"));
pk.pack(std::string("Log message ... 3"));
// deserializes these objects using msgpack::unpacker.
msgpack::unpacker pac;
// feeds the buffer.
pac.reserve_buffer(buffer.size());
memcpy(pac.buffer(), buffer.data(), buffer.size());
pac.buffer_consumed(buffer.size());
// now starts streaming deserialization.
msgpack::unpacked result;
while(pac.next(&result)) {
std::cout << result.get() << std::endl;
}
// results:
// $ g++ stream.cc -lmsgpack -o stream
// $ ./stream
// "Log message ... 1"
// "Log message ... 2"
// "Log message ... 3"
}
```
### Streaming into an array or map
```cpp
#include <msgpack.hpp>
#include <iostream>
#include <string>
int main(void) {
// serializes multiple objects into one message containing an array using msgpack::packer.
msgpack::sbuffer buffer;
msgpack::packer<msgpack::sbuffer> pk(&buffer);
pk.pack_array(3);
pk.pack(std::string("Log message ... 1"));
pk.pack(std::string("Log message ... 2"));
pk.pack(std::string("Log message ... 3"));
// serializes multiple objects into one message containing a map using msgpack::packer.
msgpack::sbuffer buffer2;
msgpack::packer<msgpack::sbuffer> pk2(&buffer2);
pk2.pack_map(2);
pk2.pack(std::string("x"));
pk2.pack(3);
pk2.pack(std::string("y"));
pk2.pack(3.4321);
}
```
## User-defined classes
You can use serialize/deserializes user-defined classes using `MSGPACK_DEFINE` macro.
```cpp
#include <msgpack.hpp>
#include <vector>
#include <string>
class myclass {
private:
std::string m_str;
std::vector<int> m_vec;
public:
MSGPACK_DEFINE(m_str, m_vec);
};
int main(void) {
std::vector<myclass> vec;
// add some elements into vec...
// you can serialize myclass directly
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, vec);
msgpack::unpacked msg;
msgpack::unpack(&msg, sbuf.data(), sbuf.size());
msgpack::object obj = msg.get();
// you can convert object to myclass directly
std::vector<myclass> rvec;
obj.convert(&rvec);
}
```
-72
View File
@@ -1,72 +0,0 @@
MessagePack
-----------
Binary-based efficient data interchange format.
*Requirements
MessagePack is only tested on Linux and Mac OS X, but it may run on other
UNIX-like platforms.
Following programs are required to build:
- gcc >= 4.1 with C++ support
- ruby >= 1.8 (ruby is used as a preprocessor)
*Installation
Simply run ./configure && make && make install to install C and C++ binding.
$ ./configure
$ make
$ sudo make install
To install Ruby binding, run ./gengem.sh script on ruby/ directory and install
generated gem package.
$ cd ruby
$ ./gengem.sh
$ gem install gem/pkg/msgpack-*.gem
*Usage
C++:
include msgpack.hpp header and link libmsgpack library.
see example/simple.cc for example.
g++ simple.cc -lmsgpack
g++ stream.cc -lmsgpack -lpthread
C:
include msgpack.h header and link libmsgpackc library.
see example/simple.c for example.
gcc simple.c -lmsgpackc
Ruby:
require msgpack library.
see example/simple.rb for example.
ruby -rubygems simple.rb
API Document is available at http://msgpack.sourceforge.jp/.
Copyright (C) 2008-2009 FURUHASHI Sadayuki
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+161
View File
@@ -0,0 +1,161 @@
# Msgpack for C/C++
It's like JSON but small and fast.
## Overview
MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.
## License
Msgpack is Copyright (C) 2008-2010 FURUHASHI Sadayuki and licensed under the Apache License, Version 2.0 (the "License"). For details see the `COPYING` file in this directory.
## Contributing
The source for msgpack-c is held at [msgpack-c](https://github.com/msgpack/msgpack-c) github.com site.
To report an issue, use the [msgpack-c issue tracker](https://github.com/msgpack/msgpack-c/issues) at github.com.
## Version
0.5.9 [![Build Status](https://travis-ci.org/msgpack/msgpack-c.svg?branch=master)](https://travis-ci.org/msgpack/msgpack-c)
## Using Msgpack
### Building and Installing
#### Install from git repository
##### Using autotools
You will need gcc (4.1.0 or higher), autotools.
```
$ git clone https://github.com/msgpack/msgpack-c.git
$ cd msgpack-c
$ ./bootstrap
$ ./configure
$ make
$ sudo make install
```
##### Using cmake
You will need gcc (4.1.0 or higher), cmake.
```
$ git clone https://github.com/msgpack/msgpack-c.git
$ cd msgpack-c
$ cmake .
$ make
```
#### Install from package
##### UNIX-like platform with ./configure
On typical UNIX-like platforms, download source package from [Releases](https://github.com/msgpack/msgpack-c/releases) and run `./configure && make && make install`. Example:
```
$ wget https://github.com/msgpack/msgpack-c/releases/download/cpp-0.5.9/msgpack-0.5.9.tar.gz
$ tar zxvf msgpack-0.5.9.tar.gz
$ cd msgpack-0.5.9
$ ./configure
$ make
$ sudo make install
```
##### FreeBSD with Ports Collection
On FreeBSD, you can use Ports Collection. Install [net/msgpack](http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/msgpack/) package.
##### Gentoo Linux with Portage
On Gentoo Linux, you can use emerge. Install [dev-libs/msgpack](http://gentoo-portage.com/dev-libs/msgpack) package.
##### Mac OS X with MacPorts
On Mac OS X, you can install MessagePack for C using MacPorts.
```
$ sudo port install msgpack
```
You might need to run `sudo port selfupdate` before installing to update the package repository.
You can also install via Homebrew.
```
$ sudo brew install msgpack
```
##### Windows
Clone msgpack-c git repository.
```
$ git clone https://github.com/msgpack/msgpack-c.git
```
or using GUI git client.
e.g.) tortoise git https://code.google.com/p/tortoisegit/
Launch cmake GUI client. http://www.cmake.org/cmake/resources/software.html
Set 'Where is the source code:' text box and 'Where to build the binaries:' text box.
Click 'Configure' button.
Choose your Visual Studio version.
Click 'Generate' button.
Open the created msgpack.sln on Visual Studio.
Build all.
### Linking with an Application
Include `msgpack.hpp` (or `msgpack.h` for C) in your application and link with libmsgpack. Here is a typical gcc link command:
g++ myapp.cpp -lmsgpack -o myapp
### Code Example
```CPP
#include <msgpack.hpp>
#include <vector>
#include <string>
#include <iostream>
int main() {
// This is target object.
std::vector<std::string> target;
target.push_back("Hello,");
target.push_back("World!");
// Serialize it.
msgpack::sbuffer sbuf; // simple buffer
msgpack::pack(&sbuf, target);
// Deserialize the serialized data.
msgpack::unpacked msg; // includes memory pool and deserialized object
msgpack::unpack(&msg, sbuf.data(), sbuf.size());
msgpack::object obj = msg.get();
// Print the deserialized object to stdout.
std::cout << obj << std::endl; // ["Hello," "World!"]
// Convert the deserialized object to staticaly typed object.
std::vector<std::string> result;
obj.convert(&result);
// If the type is mismatched, it throws msgpack::type_error.
obj.as<int>(); // type is mismatched, msgpack::type_error is thrown
}
```
### Quickstart Guides
For more detailed examples see [QuickStart for C](QUICKSTART-C.md) and [QuickStart for C++](QUICKSTART-CPP.md).
+38
View File
@@ -0,0 +1,38 @@
MessagePack cross-language test cases
=====================================
## cases
Valid serialized data are stored in "cases.mpac" and "cases_compact.mpac".
These files describe same objects. And "cases.json" describes an array of the described objects.
Thus you can verify your implementations as comparing the objects.
## crosslang
The *crosslang* tool reads serialized data from stdin and writes re-serialize data to stdout.
There are C++ and Ruby implementation of crosslang tool. You can verify your implementation
as comparing that implementations.
### C++ version
$ cd ../cpp && ./configure && make && make install
or
$ port install msgpack # MacPorts
$ g++ -Wall crosslang.cc -lmsgpack -o crosslang
$ ./crosslang
Usage: ./crosslang [in-file] [out-file]
### Ruby version
$ gem install msgpack
or
$ port install rb_msgpack # MacPorts
$ ruby crosslang.rb
Usage: crosslang.rb [in-file] [out-file]
+5 -5
View File
@@ -31,12 +31,12 @@ if test x"$1" = x"--help"; then
fi
#if [ -z "$NO_NEST" ];then
# cd c && ./bootstrap $@; cd ..
# cd cpp && ./bootstrap $@; cd ..
#fi
mkdir -p ac
test -f AUTHORS || touch AUTHORS
test -f COPYING || touch COPYING
test -f ChangeLog || touch ChangeLog
test -f NEWS || touch NEWS
test -f README || cp -f README.md README
ACLOCAL="aclocal"
ACLOCAL_FILES="aclocal.m4"
-20
View File
@@ -1,20 +0,0 @@
lib_LTLIBRARIES = libmsgpackc.la
libmsgpackc_la_SOURCES = \
unpack.c \
object.c \
vrefbuffer.c \
zone.c
nobase_include_HEADERS = \
msgpack.h \
msgpack/sbuffer.h \
msgpack/vrefbuffer.h \
msgpack/pack.h \
msgpack/unpack.h \
msgpack/object.h \
msgpack/zone.h
# -version-info CURRENT:REVISION:AGE
libmsgpackc_la_LDFLAGS = -version-info 1:0:0
-323
View File
@@ -1,323 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <msgpack/pack.h>
#include <msgpack/unpack.h>
#include <yajl/yajl_parse.h>
#include <yajl/yajl_gen.h>
static struct timeval g_timer;
void reset_timer()
{
gettimeofday(&g_timer, NULL);
}
void show_timer(size_t bufsz)
{
struct timeval endtime;
gettimeofday(&endtime, NULL);
double sec = (endtime.tv_sec - g_timer.tv_sec)
+ (double)(endtime.tv_usec - g_timer.tv_usec) / 1000 / 1000;
printf("%f sec\n", sec);
printf("%f MB\n", ((double)bufsz)/1024/1024);
printf("%f Mbps\n", ((double)bufsz)*8/sec/1000/1000);
}
static int reformat_null(void * ctx) { return 1; }
static int reformat_boolean(void * ctx, int boolean) { return 1; }
static int reformat_number(void * ctx, const char * s, unsigned int l) { return 1; }
static int reformat_string(void * ctx, const unsigned char * stringVal, unsigned int stringLen) { return 1; }
static int reformat_map_key(void * ctx, const unsigned char * stringVal, unsigned int stringLen) { return 1; }
static int reformat_start_map(void * ctx) { return 1; }
static int reformat_end_map(void * ctx) { return 1; }
static int reformat_start_array(void * ctx) { return 1; }
static int reformat_end_array(void * ctx) { return 1; }
static void* unpack_uint8(void* data, uint8_t d) { return NULL; }
static void* unpack_uint16(void* data, uint16_t d) { return NULL; }
static void* unpack_uint32(void* data, uint32_t d) { return NULL; }
static void* unpack_uint64(void* data, uint64_t d) { return NULL; }
static void* unpack_int8(void* data, int8_t d) { return NULL; }
static void* unpack_int16(void* data, int16_t d) { return NULL; }
static void* unpack_int32(void* data, int32_t d) { return NULL; }
static void* unpack_int64(void* data, int64_t d) { return NULL; }
static void* unpack_float(void* data, float d) { return NULL; }
static void* unpack_double(void* data, double d) { return NULL; }
static void* unpack_nil(void* data) { return NULL; }
static void* unpack_true(void* data) { return NULL; }
static void* unpack_false(void* data) { return NULL; }
static void* unpack_array(void* data, unsigned int n) { return NULL; }
static void unpack_array_item(void* data, void* c, void* o) { }
static void* unpack_map(void* data, unsigned int n) { return NULL; }
static void unpack_map_item(void* data, void* c, void* k, void* v) { }
static void* unpack_raw(void* data, const char* b, const char* p, unsigned int l) { /*printf("unpack raw %p %lu\n",p,l);*/ return NULL; }
typedef struct {
size_t allocated;
size_t length;
char* buffer;
} pack_buffer;
static const size_t PACK_INITIAL_BUFFER_SIZE = 32*1024;
static void pack_buffer_init(pack_buffer* data)
{
data->buffer = malloc(PACK_INITIAL_BUFFER_SIZE);
data->length = 0;
data->allocated = PACK_INITIAL_BUFFER_SIZE;
}
static void pack_buffer_reset(pack_buffer* data)
{
data->buffer = realloc(data->buffer, PACK_INITIAL_BUFFER_SIZE);
data->allocated = PACK_INITIAL_BUFFER_SIZE;
data->length = 0;
}
static void pack_buffer_free(pack_buffer* data)
{
free(data->buffer);
}
static void pack_append_buffer(void* user, const char* b, unsigned int l)
{
pack_buffer* data = (pack_buffer*)user;
if(data->allocated - data->length < l) {
data->buffer = realloc(data->buffer, data->allocated*2);
data->allocated *= 2;
}
memcpy(data->buffer + data->length, b, l);
data->length += l;
}
static const unsigned int TASK_INT_NUM = 1<<24;
static const unsigned int TASK_STR_LEN = 1<<15;
//static const unsigned int TASK_INT_NUM = 1<<20;
//static const unsigned int TASK_STR_LEN = 1<<12;
static const char* TASK_STR_PTR;
void bench_json(void)
{
puts("== JSON ==");
yajl_gen_config gcfg = {0, NULL};
yajl_gen g = yajl_gen_alloc(&gcfg);
yajl_parser_config hcfg = { 0, 0 };
yajl_callbacks callbacks = {
reformat_null,
reformat_boolean,
NULL,
NULL,
reformat_number,
reformat_string,
reformat_start_map,
reformat_map_key,
reformat_end_map,
reformat_start_array,
reformat_end_array
};
yajl_handle h = yajl_alloc(&callbacks, &hcfg, NULL);
const unsigned char * buf;
unsigned int len;
puts("generate integer");
reset_timer();
{
unsigned int i;
yajl_gen_array_open(g);
for(i=0; i < TASK_INT_NUM; ++i) {
yajl_gen_integer(g, i);
}
yajl_gen_array_close(g);
}
show_timer(len);
yajl_gen_get_buf(g, &buf, &len);
puts("----");
puts("parse integer");
reset_timer();
{
yajl_status stat = yajl_parse(h, buf, len);
if (stat != yajl_status_ok && stat != yajl_status_insufficient_data) {
unsigned char * str = yajl_get_error(h, 1, buf, len);
fprintf(stderr, (const char *) str);
}
}
show_timer(len);
//yajl_gen_clear(g);
yajl_gen_free(g);
g = yajl_gen_alloc(&gcfg);
yajl_free(h);
h = yajl_alloc(&callbacks, &hcfg, NULL);
puts("----");
puts("generate string");
reset_timer();
{
unsigned int i;
yajl_gen_array_open(g);
for(i=0; i < TASK_STR_LEN; ++i) {
yajl_gen_string(g, (const unsigned char*)TASK_STR_PTR, i);
}
yajl_gen_array_close(g);
}
show_timer(len);
yajl_gen_get_buf(g, &buf, &len);
puts("----");
puts("parse string");
reset_timer();
{
yajl_status stat = yajl_parse(h, buf, len);
if (stat != yajl_status_ok && stat != yajl_status_insufficient_data) {
unsigned char * str = yajl_get_error(h, 1, buf, len);
fprintf(stderr, (const char *) str);
}
}
show_timer(len);
yajl_gen_free(g);
yajl_free(h);
}
void bench_msgpack(void)
{
puts("== MessagePack ==");
pack_buffer mpkbuf;
pack_buffer_init(&mpkbuf);
msgpack_pack_t* mpk = msgpack_pack_new(
&mpkbuf, pack_append_buffer);
msgpack_unpack_callback cb = {
unpack_uint8,
unpack_uint16,
unpack_uint32,
unpack_uint64,
unpack_int8,
unpack_int16,
unpack_int32,
unpack_int64,
unpack_float,
unpack_double,
unpack_nil,
unpack_true,
unpack_false,
unpack_array,
unpack_array_item,
unpack_map,
unpack_map_item,
unpack_raw,
};
msgpack_unpack_t* mupk = msgpack_unpack_new(NULL, &cb);
size_t len;
const char* buf;
puts("pack integer");
reset_timer();
{
unsigned int i;
msgpack_pack_array(mpk, TASK_INT_NUM);
for(i=0; i < TASK_INT_NUM; ++i) {
msgpack_pack_unsigned_int(mpk, i);
}
}
show_timer(mpkbuf.length);
len = mpkbuf.length;
buf = mpkbuf.buffer;
puts("----");
puts("unpack integer");
reset_timer();
{
size_t off = 0;
int ret = msgpack_unpack_execute(mupk, buf, len, &off);
if(ret < 0) {
fprintf(stderr, "Parse error.\n");
} else if(ret == 0) {
fprintf(stderr, "Not finished.\n");
}
}
show_timer(mpkbuf.length);
pack_buffer_reset(&mpkbuf);
msgpack_unpack_reset(mupk);
puts("----");
puts("pack string");
reset_timer();
{
unsigned int i;
msgpack_pack_array(mpk, TASK_STR_LEN);
for(i=0; i < TASK_STR_LEN; ++i) {
msgpack_pack_raw(mpk, i);
msgpack_pack_raw_body(mpk, TASK_STR_PTR, i);
}
}
show_timer(mpkbuf.length);
len = mpkbuf.length;
buf = mpkbuf.buffer;
puts("----");
puts("unpack string");
reset_timer();
{
size_t off = 0;
int ret = msgpack_unpack_execute(mupk, buf, len, &off);
if(ret < 0) {
fprintf(stderr, "Parse error.\n");
} else if(ret == 0) {
fprintf(stderr, "Not finished.\n");
}
}
show_timer(mpkbuf.length);
msgpack_unpack_free(mupk);
msgpack_pack_free(mpk);
pack_buffer_free(&mpkbuf);
}
int main(int argc, char* argv[])
{
char* str = malloc(TASK_STR_LEN);
memset(str, 'a', TASK_STR_LEN);
TASK_STR_PTR = str;
bench_msgpack();
bench_json();
return 0;
}
-9
View File
@@ -1,9 +0,0 @@
CFLAGS += -Wall -g -I. -I.. -O4
LDFLAGS += -lyajl
all: bench
bench: bench.o pack.o unpack.o pack.h unpack.h
$(CC) bench.o pack.o unpack.o $(CFLAGS) $(LDFLAGS) -o $@
-1
View File
@@ -1 +0,0 @@
.
-125
View File
@@ -1,125 +0,0 @@
/*
* MessagePack for C unpacking routine
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef msgpack_unpacker_H__
#define msgpack_unpacker_H__
#include "msgpack/zone.h"
#include "msgpack/object.h"
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct msgpack_unpacker {
char* buffer;
size_t used;
size_t free;
size_t off;
size_t parsed;
msgpack_zone* z;
size_t initial_buffer_size;
void* ctx;
} msgpack_unpacker;
bool msgpack_unpacker_init(msgpack_unpacker* mpac, size_t initial_buffer_size);
void msgpack_unpacker_destroy(msgpack_unpacker* mpac);
msgpack_unpacker* msgpack_unpacker_new(size_t initial_buffer_size);
void msgpack_unpacker_free(msgpack_unpacker* mpac);
static inline bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size);
static inline char* msgpack_unpacker_buffer(msgpack_unpacker* mpac);
static inline size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac);
static inline void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size);
int msgpack_unpacker_execute(msgpack_unpacker* mpac);
msgpack_object msgpack_unpacker_data(msgpack_unpacker* mpac);
msgpack_zone* msgpack_unpacker_release_zone(msgpack_unpacker* mpac);
void msgpack_unpacker_reset_zone(msgpack_unpacker* mpac);
void msgpack_unpacker_reset(msgpack_unpacker* mpac);
static inline size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac);
typedef enum {
MSGPACK_UNPACK_SUCCESS = 2,
MSGPACK_UNPACK_EXTRA_BYTES = 1,
MSGPACK_UNPACK_CONTINUE = 0,
MSGPACK_UNPACK_PARSE_ERROR = -1,
} msgpack_unpack_return;
msgpack_unpack_return
msgpack_unpack(const char* data, size_t len, size_t* off,
msgpack_zone* z, msgpack_object* result);
static inline size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac);
bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac);
bool msgpack_unpacker_expand_buffer(msgpack_unpacker* mpac, size_t size);
bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size)
{
if(mpac->free >= size) { return true; }
return msgpack_unpacker_expand_buffer(mpac, size);
}
char* msgpack_unpacker_buffer(msgpack_unpacker* mpac)
{
return mpac->buffer + mpac->used;
}
size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac)
{
return mpac->free;
}
void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size)
{
mpac->used += size;
mpac->free -= size;
}
size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
{
return mpac->parsed - mpac->off + mpac->used;
}
size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac)
{
return mpac->parsed;
}
#ifdef __cplusplus
}
#endif
#endif /* msgpack/unpack.h */
-135
View File
@@ -1,135 +0,0 @@
/*
* MessagePack for C zero-copy buffer implementation
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "msgpack/vrefbuffer.h"
#include <stdlib.h>
#include <string.h>
bool msgpack_vrefbuffer_init(msgpack_vrefbuffer* vbuf,
size_t ref_size, size_t chunk_size)
{
if(chunk_size < sizeof(msgpack_vrefbuffer_chunk)+72) {
chunk_size = 72;
} else {
chunk_size -= sizeof(msgpack_vrefbuffer_chunk);
}
vbuf->chunk_size = chunk_size;
vbuf->ref_size = ref_size;
// glibcは72バイト以下のmallocが高速
size_t nfirst = (sizeof(struct iovec) < 72/2) ?
72 / sizeof(struct iovec) : 8;
struct iovec* array = (struct iovec*)malloc(
sizeof(struct iovec) * nfirst);
if(array == NULL) {
return false;
}
vbuf->tail = array;
vbuf->end = array + nfirst;
vbuf->array = array;
vbuf->chunk = (msgpack_vrefbuffer_chunk*)malloc(
chunk_size + sizeof(msgpack_vrefbuffer_chunk));
if(vbuf->chunk == NULL) {
free(array);
return false;
}
vbuf->chunk->next = NULL;
vbuf->chunk->free = chunk_size;
return true;
}
void msgpack_vrefbuffer_destroy(msgpack_vrefbuffer* vbuf)
{
msgpack_vrefbuffer_chunk* c = vbuf->chunk;
while(true) {
msgpack_vrefbuffer_chunk* n = c->next;
free(c);
if(n) {
c = n;
} else {
break;
}
}
free(vbuf->array);
}
int msgpack_vrefbuffer_append_ref(msgpack_vrefbuffer* vbuf,
const char* buf, unsigned int len)
{
if(vbuf->tail == vbuf->end) {
const size_t nused = vbuf->end - vbuf->array;
const size_t nnext = nused * 2;
struct iovec* nvec = (struct iovec*)realloc(
vbuf->array, sizeof(struct iovec)*nnext);
if(nvec == NULL) {
return -1;
}
vbuf->array = nvec;
vbuf->end = nvec + nnext;
vbuf->tail = nvec + nused;
}
vbuf->tail->iov_base = (char*)buf;
vbuf->tail->iov_len = len;
++vbuf->tail;
return 0;
}
int msgpack_vrefbuffer_append_copy(msgpack_vrefbuffer* vbuf,
const char* buf, unsigned int len)
{
msgpack_vrefbuffer_chunk* chunk = vbuf->chunk;
size_t cur_size = vbuf->chunk_size;
if(chunk->free < len) {
cur_size = (cur_size > len) ? cur_size : len;
chunk = (msgpack_vrefbuffer_chunk*)malloc(
cur_size + sizeof(msgpack_vrefbuffer_chunk));
if(chunk == NULL) {
return -1;
}
chunk->free = cur_size;
chunk->next = vbuf->chunk;
vbuf->chunk = chunk;
}
char* m = ((char*)chunk) + sizeof(msgpack_vrefbuffer_chunk)
+ (cur_size - chunk->free);
memcpy(m, buf, len);
chunk->free -= len;
if(vbuf->tail != vbuf->array && m ==
(const char*)((vbuf->tail-1)->iov_base) + (vbuf->tail-1)->iov_len) {
(vbuf->tail-1)->iov_len += len;
return 0;
} else {
return msgpack_vrefbuffer_append_ref(vbuf, m, len);
}
}
+1
View File
@@ -0,0 +1 @@
[false,true,null,0,0,0,0,0,0,0,0,0,-1,-1,-1,-1,-1,127,127,255,65535,4294967295,-32,-32,-128,-32768,-2147483648,0.0,-0.0,1.0,-1.0,"a","a","a","","","",[0],[0],[0],[],[],[],{},{},{},{"a":97},{"a":97},{"a":97},[[]],[["a"]]]
+99
View File
@@ -0,0 +1,99 @@
#
# MessagePack format test case
#
begin
require 'rubygems'
rescue LoadError
end
require 'msgpack'
require 'json'
source = <<EOF
c2 # false
c3 # true
c0 # nil
00 # 0 Positive FixNum
cc 00 # 0 uint8
cd 00 00 # 0 uint16
ce 00 00 00 00 # 0 uint32
cf 00 00 00 00 00 00 00 00 # 0 uint64
d0 00 # 0 int8
d1 00 00 # 0 int16
d2 00 00 00 00 # 0 int32
d3 00 00 00 00 00 00 00 00 # 0 int64
ff # -1 Negative FixNum
d0 ff # -1 int8
d1 ff ff # -1 int16
d2 ff ff ff ff # -1 int32
d3 ff ff ff ff ff ff ff ff # -1 int64
7f # 127 Positive FixNum
cc 7f # 127 uint8
cd 00 ff # 255 uint16
ce 00 00 ff ff # 65535 uint32
cf 00 00 00 00 ff ff ff ff # 4294967295 uint64
e0 # -32 Negative FixNum
d0 e0 # -32 int8
d1 ff 80 # -128 int16
d2 ff ff 80 00 # -32768 int32
d3 ff ff ff ff 80 00 00 00 # -2147483648 int64
#ca 00 00 00 00 # 0.0 float
cb 00 00 00 00 00 00 00 00 # 0.0 double
#ca 80 00 00 00 # -0.0 float
cb 80 00 00 00 00 00 00 00 # -0.0 double
cb 3f f0 00 00 00 00 00 00 # 1.0 double
cb bf f0 00 00 00 00 00 00 # -1.0 double
a1 61 # "a" FixRaw
da 00 01 61 # "a" raw 16
db 00 00 00 01 61 # "a" raw 32
a0 # "" FixRaw
da 00 00 # "" raw 16
db 00 00 00 00 # "" raw 32
91 00 # [0] FixArray
dc 00 01 00 # [0] array 16
dd 00 00 00 01 00 # [0] array 32
90 # [] FixArray
dc 00 00 # [] array 16
dd 00 00 00 00 # [] array 32
80 # {} FixMap
de 00 00 # {} map 16
df 00 00 00 00 # {} map 32
81 a1 61 61 # {"a"=>97} FixMap
de 00 01 a1 61 61 # {"a"=>97} map 16
df 00 00 00 01 a1 61 61 # {"a"=>97} map 32
91 90 # [[]]
91 91 a1 61 # [["a"]]
EOF
source.gsub!(/\#.+$/,'')
bytes = source.strip.split(/\s+/).map {|x| x.to_i(16) }.pack('C*')
objs = []
compact_bytes = ""
pac = MessagePack::Unpacker.new
pac.feed(bytes)
pac.each {|obj|
p obj
objs << obj
compact_bytes << obj.to_msgpack
}
json = objs.to_json
# self check
cpac = MessagePack::Unpacker.new
cpac.feed(compact_bytes)
cpac.each {|cobj|
obj = objs.shift
if obj != cobj
puts "** SELF CHECK FAILED **"
puts "expected: #{obj.inspect}"
puts "actual: #{cobj.inspect}"
exit 1
end
}
File.open("cases.mpac","w") {|f| f.write(bytes) }
File.open("cases_compact.mpac","w") {|f| f.write(compact_bytes) }
File.open("cases.json","w") {|f| f.write(json) }
+47
View File
@@ -0,0 +1,47 @@
#!/bin/sh
./bootstrap
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
if [ $1 = "cpp11" ]
then
./configure CXXFLAGS="-std=c++11"
else
./configure
fi
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make check
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make install DESTDIR=`pwd`/install
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
exit 0
+56
View File
@@ -0,0 +1,56 @@
#!/bin/sh
mkdir build
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
cd build
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
if [ $1 = "cpp11" ]
then
cmake -DMSGPACK_CXX11=ON ..
else
cmake ..
fi
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make test
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
make install DESTDIR=`pwd`/install
ret=$?
if [ $ret -ne 0 ]
then
exit $ret
fi
exit 0
+80 -24
View File
@@ -1,44 +1,100 @@
AC_INIT(msgpack/unpack_template.h)
AC_INIT(src/object.cpp)
AC_CONFIG_AUX_DIR(ac)
AM_INIT_AUTOMAKE(msgpack, 0.3.3)
AM_INIT_AUTOMAKE(msgpack, 0.5.9)
AC_CONFIG_HEADER(config.h)
AC_SUBST(CFLAGS)
if test "" = "$CFLAGS"; then
CFLAGS="-g -O4"
fi
CFLAGS="-O3 -Wall $CFLAGS"
AC_SUBST(CXXFLAGS)
CXXFLAGS="-O3 -Wall $CXXFLAGS"
AC_PROG_CC
CFLAGS="-O4 -Wall $CFLAGS -I.."
AC_MSG_CHECKING([if c++ api is enabled])
AC_MSG_CHECKING([if C++ API is enabled])
AC_ARG_ENABLE(cxx,
AS_HELP_STRING([--disable-cxx],
[don't build c++ api.]) )
AC_MSG_RESULT($enable_cxx)
[don't build C++ API]) ) #'
AC_MSG_RESULT([$enable_cxx])
if test "$enable_cxx" != "no"; then
AC_SUBST(CXXFLAGS)
if test "" = "$CXXFLAGS"; then
CXXFLAGS="-g -O4"
AC_PROG_CXX
AM_PROG_CC_C_O
fi
AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no")
AC_PROG_LIBTOOL
AM_PROG_AS
AC_MSG_CHECKING([if debug option is enabled])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--disable-debug],
[disable assert macros and omit -g option]) )
AC_MSG_RESULT([$enable_debug])
if test "$enable_debug" != "no"; then
CXXFLAGS="$CXXFLAGS -g"
CFLAGS="$CFLAGS -g"
else
CXXFLAGS="$CXXFLAGS -DNDEBUG"
CFLAGS="$CFLAGS -DNDEBUG"
fi
AC_CACHE_CHECK([for __sync_* atomic operations], msgpack_cv_atomic_ops, [
AC_TRY_LINK([
int atomic_sub(int i) { return __sync_sub_and_fetch(&i, 1); }
int atomic_add(int i) { return __sync_add_and_fetch(&i, 1); }
], [atomic_sub(1); atomic_add(1);], msgpack_cv_atomic_ops="yes")
])
if test "$msgpack_cv_atomic_ops" != "yes"; then
if test "$enable_cxx" = "no"; then
AC_MSG_ERROR([__sync_* atomic operations are not found. Try to enable C++ support.
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
])
fi
AC_CHECK_PROG(ERB, erb, erb)
if test "x$ERB" = x; then
AC_MSG_ERROR([cannot find erb. Ruby is needed to build.])
AC_LANG_PUSH([C++])
AC_CACHE_CHECK([for __gnu_cxx::__exchange_and_add], msgpack_cv_gcc_cxx_atomic_ops, [
AC_TRY_LINK([
#include <bits/atomicity.h>
int atomic_sub(int i) { return __gnu_cxx::__exchange_and_add(&i, -1) - 1; }
int atomic_add(int i) { return __gnu_cxx::__exchange_and_add(&i, 1) + 1; }
], [atomic_sub(1); atomic_add(1);], msgpack_cv_gcc_cxx_atomic_ops="yes")
])
AC_LANG_POP([C++])
if test "$msgpack_cv_gcc_cxx_atomic_ops" != "yes"; then
AC_MSG_ERROR([__sync_* atomic operations nor __gnu_cxx::__exchange_and_add are not found.
If you are using gcc >= 4.1 and the default target CPU architecture is "i386", try to
add CFLAGS="-march=i686" and CXXFLAGS="-march=i686" options to ./configure as follows:
$ ./configure CFLAGS="-march=i686" CXXFLAGS="-march=i686"
])
else
enable_gcc_cxx_atomic=yes
fi
fi
# FIXME
AC_PROG_CXX
CXXFLAGS="-O4 -Wall $CXXFLAGS -I.. -I../c"
AM_CONDITIONAL(ENABLE_GCC_CXX_ATOMIC, test "$enable_gcc_cxx_atomic" = "yes")
AM_CONDITIONAL(ENABLE_CXX, test "$enable_cxx" != "no")
major=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $VERSION | sed 's/\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
AC_SUBST(VERSION_MAJOR, $major)
AC_SUBST(VERSION_MINOR, $minor)
AC_PROG_LIBTOOL
AC_OUTPUT([Makefile c/Makefile cpp/Makefile])
AC_OUTPUT([Makefile
msgpack.pc
src/Makefile
src/msgpack/version.h
test/Makefile])
-47
View File
@@ -1,47 +0,0 @@
lib_LTLIBRARIES = libmsgpack.la
libmsgpack_la_SOURCES = \
object.cpp
nobase_include_HEADERS = \
msgpack.hpp \
msgpack/sbuffer.hpp \
msgpack/vrefbuffer.hpp \
msgpack/pack.hpp \
msgpack/unpack.hpp \
msgpack/object.hpp \
msgpack/zone.hpp \
msgpack/type.hpp \
msgpack/type/array.hpp \
msgpack/type/boolean.hpp \
msgpack/type/float.hpp \
msgpack/type/integer.hpp \
msgpack/type/map.hpp \
msgpack/type/nil.hpp \
msgpack/type/raw.hpp \
msgpack/type/tuple.hpp
# FIXME
object.lo: msgpack/type/tuple.hpp msgpack/zone.hpp
msgpack/type/tuple.hpp: msgpack/type/tuple.hpp.erb
$(ERB) $< > $@.tmp
mv $@.tmp $@
msgpack/zone.hpp: msgpack/zone.hpp.erb
$(ERB) $< > $@.tmp
mv $@.tmp $@
MOSTLYCLEANFILES = \
msgpack/type/tuple.hpp \
msgpack/zone.hpp
EXTRA_DIST = \
msgpack/type/tuple.hpp.erb \
msgpack/zone.hpp.erb
libmsgpack_la_LIBADD = -L../c -lmsgpackc
# -version-info CURRENT:REVISION:AGE
libmsgpack_la_LDFLAGS = -version-info 1:0:0
-188
View File
@@ -1,188 +0,0 @@
#include <msgpack/unpack.hpp>
#include <msgpack/pack.hpp>
#include <string.h>
#include <sys/time.h>
#include <iostream>
#include <stdexcept>
#include <string>
static const unsigned int TASK_INT_NUM = 1<<24;
static const unsigned int TASK_STR_LEN = 1<<15;
//static const unsigned int TASK_INT_NUM = 1<<22;
//static const unsigned int TASK_STR_LEN = 1<<13;
static const char* TASK_STR_PTR;
class simple_timer {
public:
void reset() { gettimeofday(&m_timeval, NULL); }
void show_stat(size_t bufsz)
{
struct timeval endtime;
gettimeofday(&endtime, NULL);
double sec = (endtime.tv_sec - m_timeval.tv_sec)
+ (double)(endtime.tv_usec - m_timeval.tv_usec) / 1000 / 1000;
std::cout << sec << " sec" << std::endl;
std::cout << (double(bufsz)/1024/1024) << " MB" << std::endl;
std::cout << (bufsz/sec/1000/1000*8) << " Mbps" << std::endl;
}
private:
timeval m_timeval;
};
class simple_buffer {
public:
static const size_t DEFAULT_INITIAL_SIZE = 32*1024;//512*1024*1024*2;
simple_buffer(size_t initial_size = DEFAULT_INITIAL_SIZE) :
m_storage((char*)malloc(initial_size)),
m_allocated(initial_size),
m_used(0)
{
if(!m_storage) { throw std::bad_alloc(); }
}
~simple_buffer()
{
free(m_storage);
}
public:
inline void write(const char* buf, size_t len)
{
if(m_allocated - m_used < len) {
expand_buffer(len);
}
memcpy(m_storage + m_used, buf, len);
m_used += len;
}
void clear()
{
m_used = 0;
}
private:
void expand_buffer(size_t req)
{
size_t nsize = m_allocated * 2;
size_t at_least = m_used + req;
while(nsize < at_least) { nsize *= 2; }
char* tmp = (char*)realloc(m_storage, nsize);
if(!tmp) { throw std::bad_alloc(); }
m_storage = tmp;
m_allocated = nsize;
}
public:
size_t size() const { return m_used; }
const char* data() const { return m_storage; }
private:
char* m_storage;
size_t m_allocated;
size_t m_used;
};
void bench_msgpack_int()
{
simple_buffer buf;
simple_timer timer;
std::cout << "----" << std::endl;
std::cout << "pack integer" << std::endl;
timer.reset();
{
msgpack::packer<simple_buffer> pk(buf);
pk.pack_array(TASK_INT_NUM);
for(unsigned int i=0; i < TASK_INT_NUM; ++i) {
pk.pack_unsigned_int(i);
}
}
timer.show_stat(buf.size());
std::cout << "----" << std::endl;
std::cout << "unpack integer" << std::endl;
msgpack::zone z;
msgpack::object obj;
timer.reset();
{
obj = msgpack::unpack(buf.data(), buf.size(), z);
}
timer.show_stat(buf.size());
/*
std::cout << "----" << std::endl;
std::cout << "dynamic pack integer" << std::endl;
buf.clear();
timer.reset();
msgpack::pack(buf, obj);
timer.show_stat(buf.size());
*/
}
void bench_msgpack_str()
{
simple_buffer buf;
simple_timer timer;
std::cout << "----" << std::endl;
std::cout << "pack string" << std::endl;
timer.reset();
{
msgpack::packer<simple_buffer> pk(buf);
pk.pack_array(TASK_STR_LEN);
for(unsigned int i=0; i < TASK_STR_LEN; ++i) {
pk.pack_raw(i);
pk.pack_raw_body(TASK_STR_PTR, i);
}
}
timer.show_stat(buf.size());
std::cout << "----" << std::endl;
std::cout << "unpack string" << std::endl;
msgpack::zone z;
msgpack::object obj;
timer.reset();
{
obj = msgpack::unpack(buf.data(), buf.size(), z);
}
timer.show_stat(buf.size());
/*
std::cout << "----" << std::endl;
std::cout << "dynamic pack string" << std::endl;
buf.clear();
timer.reset();
msgpack::pack(buf, obj);
timer.show_stat(buf.size());
*/
}
int main(void)
{
char* str = (char*)malloc(TASK_STR_LEN);
memset(str, 'a', TASK_STR_LEN);
TASK_STR_PTR = str;
bench_msgpack_int();
bench_msgpack_str();
return 0;
}
-9
View File
@@ -1,9 +0,0 @@
CXXFLAGS += -Wall -g -I. -I.. -O4
LDFLAGS +=
all: bench
bench: bench.o unpack.o zone.o object.o pack.hpp unpack.hpp zone.hpp object.hpp
$(CXX) bench.o unpack.o zone.o object.o $(CXXFLAGS) $(LDFLAGS) -o $@
-1
View File
@@ -1 +0,0 @@
.
-201
View File
@@ -1,201 +0,0 @@
#include <iostream>
#include <string>
#include <msgpack.hpp>
#include <sstream>
#include <memory>
using namespace msgpack;
class checker {
public:
template <typename T>
void check(const char* d, size_t len, T should) {
try {
std::cout << "----" << std::endl;
object o;
try {
o = unpack(d, len, m_zone);
} catch (std::runtime_error& e) {
std::cout << o << std::endl;
std::cout << "**" << e.what() << "**" << std::endl;
return;
}
std::cout << o << std::endl;
try {
std::stringstream s;
pack(s, should);
std::string str(s.str());
object ro = unpack(str.data(), str.size(), m_zone);
std::cout << ro << std::endl;
if(ro != o) { throw std::runtime_error("NOT MATCH"); }
} catch (std::runtime_error& e) {
std::cout << "** REUNPACK FAILED **" << std::endl;
std::cout << e.what() << std::endl;
} catch (...) {
std::cout << "** REUNPACK FAILED **" << std::endl;
std::cout << "unknown error" << std::endl;
}
} catch (...) { m_zone.clear(); throw; }
m_zone.clear();
}
private:
zone m_zone;
};
int main(void)
{
checker c;
#if 0
{ // SimpleValue
const char d[] = {
0x93, 0xc0, 0xc2, 0xc3,
};
c.check(d, sizeof(d),
type::make_tuple(
type::nil(), false, true
)
);
}
{ // Fixnum
const char d[] = {
0x92,
0x93, 0x00, 0x40, 0x7f,
0x93, 0xe0, 0xf0, 0xff,
};
c.check(d, sizeof(d),
type::make_tuple(
type::make_tuple(
0, 64, 127
),
type::make_tuple(
-32, -16, -1
)
)
);
}
{ // FixArray
const char d[] = {
0x92,
0x90,
0x91,
0x91, 0xc0,
};
std::vector<int> empty;
c.check(d, sizeof(d),
type::make_tuple(
empty,
type::make_tuple(
type::make_tuple(
type::nil()
)
)
)
);
}
{ // FixRaw
const char d[] = {
0x94,
0xa0,
0xa1, 'a',
0xa2, 'b', 'c',
0xa3, 'd', 'e', 'f',
};
c.check(d, sizeof(d),
type::make_tuple(
std::string(""),
std::string("a"),
std::string("bc"),
type::raw_ref("def", 3)
)
);
}
#endif
static const unsigned TASK_ARRAY = 1000;
static const unsigned TASK_REPEAT = 10;
std::vector<std::string> task;
// create task
{
static char traw[64];
memset(traw, 'a', sizeof(traw));
task.resize(TASK_ARRAY);
for(unsigned i=0; i < TASK_ARRAY; ++i) {
task[i] = std::string(traw, sizeof(traw));
}
}
std::stringstream stream;
// send message
{
for(unsigned i=0; i < TASK_REPEAT; ++i) {
pack(stream, task);
}
std::cout << "send " << stream.str().size() << " bytes" << std::endl;
}
ssize_t total_bytes = stream.str().size();
stream.seekg(0);
// reserive message
{
unsigned num_msg = 0;
static const size_t RESERVE_SIZE = 32;//*1024;
unpacker pac;
while(stream.good() && total_bytes > 0) {
// 1. reserve buffer
pac.reserve_buffer(RESERVE_SIZE);
// 2. read data to buffer() up to buffer_capacity() bytes
size_t sz = stream.readsome(
pac.buffer(),
pac.buffer_capacity());
total_bytes -= sz;
std::cout << "read " << sz << " bytes to capacity "
<< pac.buffer_capacity() << " bytes"
<< std::endl;
// 3. specify the number of bytes actually copied
pac.buffer_consumed(sz);
// 4. repeat execute() until it returns false
while( pac.execute() ) {
// 5.1. take out the parsed object
object o = pac.data();
// 5.2 release the zone
std::auto_ptr<zone> olife( pac.release_zone() );
// 5.3 re-initialize the unpacker */
pac.reset();
// do some with the o and olife
std::cout << "message parsed: " << o << std::endl;
++num_msg;
}
}
std::cout << "stream finished" << std::endl;
std::cout << num_msg << " messages reached" << std::endl;
}
return 0;
}
-9
View File
@@ -1,9 +0,0 @@
CXXFLAGS += -Wall -g -I. -I.. -O4
LDFLAGS +=
all: test
test: test.o unpack.o zone.o object.o pack.hpp unpack.hpp zone.hpp object.hpp
$(CXX) test.o unpack.o zone.o object.o $(CXXFLAGS) $(LDFLAGS) -o $@
-9
View File
@@ -1,9 +0,0 @@
#include "msgpack/type/array.hpp"
#include "msgpack/type/boolean.hpp"
#include "msgpack/type/float.hpp"
#include "msgpack/type/integer.hpp"
#include "msgpack/type/map.hpp"
#include "msgpack/type/nil.hpp"
#include "msgpack/type/raw.hpp"
#include "msgpack/type/tuple.hpp"
-147
View File
@@ -1,147 +0,0 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_TYPE_INTEGER_HPP__
#define MSGPACK_TYPE_INTEGER_HPP__
#include "msgpack/object.hpp"
#include <limits>
namespace msgpack {
namespace type {
namespace detail {
template <typename T, bool Signed>
struct convert_integer_sign;
template <typename T>
struct convert_integer_sign<T, true> {
static inline T convert(object o) {
if(o.type == type::POSITIVE_INTEGER) {
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
{ throw type_error(); }
return o.via.u64;
} else if(o.type == type::NEGATIVE_INTEGER) {
if(o.via.i64 < (int64_t)-std::numeric_limits<T>::max())
{ throw type_error(); }
return o.via.i64;
}
throw type_error();
}
};
template <typename T>
struct convert_integer_sign<T, false> {
static inline T convert(object o) {
if(o.type == type::POSITIVE_INTEGER) {
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
{ throw type_error(); }
return o.via.u64;
}
throw type_error();
}
};
template <typename T>
static inline T convert_integer(object o)
{
return detail::convert_integer_sign<T, std::numeric_limits<T>::is_signed>::convert(o);
}
} // namespace detail
} // namespace type
inline signed char& operator>> (object o, signed char& v)
{ v = type::detail::convert_integer<signed char>(o); return v; }
inline signed short& operator>> (object o, signed short& v)
{ v = type::detail::convert_integer<signed short>(o); return v; }
inline signed int& operator>> (object o, signed int& v)
{ v = type::detail::convert_integer<signed int>(o); return v; }
inline signed long& operator>> (object o, signed long& v)
{ v = type::detail::convert_integer<signed long>(o); return v; }
inline signed long long& operator>> (object o, signed long long& v)
{ v = type::detail::convert_integer<signed long long>(o); return v; }
inline unsigned char& operator>> (object o, unsigned char& v)
{ v = type::detail::convert_integer<unsigned char>(o); return v; }
inline unsigned short& operator>> (object o, unsigned short& v)
{ v = type::detail::convert_integer<unsigned short>(o); return v; }
inline unsigned int& operator>> (object o, unsigned int& v)
{ v = type::detail::convert_integer<unsigned int>(o); return v; }
inline unsigned long& operator>> (object o, unsigned long& v)
{ v = type::detail::convert_integer<unsigned long>(o); return v; }
inline unsigned long long& operator>> (object o, unsigned long long& v)
{ v = type::detail::convert_integer<unsigned long long>(o); return v; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const signed char& v)
{ o.pack_int8(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const signed short& v)
{ o.pack_short(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const signed int& v)
{ o.pack_int(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const signed long& v)
{ o.pack_long(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const signed long long& v)
{ o.pack_long_long(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const unsigned char& v)
{ o.pack_uint8(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const unsigned short& v)
{ o.pack_unsigned_short(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const unsigned int& v)
{ o.pack_unsigned_int(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const unsigned long& v)
{ o.pack_unsigned_long(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const unsigned long long& v)
{ o.pack_unsigned_long_long(v); return o; }
} // namespace msgpack
#endif /* msgpack/type/integer.hpp */
+133
View File
@@ -0,0 +1,133 @@
//
// MessagePack cross-language test tool
//
// $ cd ../cpp && ./configure && make && make install
// or
// $ port install msgpack # MacPorts
//
// $ g++ -Wall crosslang.cc -lmsgpack
//
#include <msgpack.hpp>
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
static int run(int infd, int outfd)
try {
msgpack::unpacker pac;
while(true) {
pac.reserve_buffer(32*1024);
ssize_t count =
read(infd, pac.buffer(), pac.buffer_capacity());
if(count <= 0) {
if(count == 0) {
return 0;
}
if(errno == EAGAIN || errno == EINTR) {
continue;
}
return 1;
}
pac.buffer_consumed(count);
msgpack::unpacked result;
while(pac.next(&result)) {
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, result.get());
const char* p = sbuf.data();
const char* const pend = p + sbuf.size();
while(p < pend) {
ssize_t bytes = write(outfd, p, pend-p);
if(bytes <= 0) {
if(count == 0) {
return 0;
}
if(errno == EAGAIN || errno == EINTR) {
continue;
}
return 1;
}
p += bytes;
}
}
}
return 0;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
return 1;
}
static void usage(const char* prog)
{
printf(
"Usage: %s [in-file] [out-file]\n"
"\n"
"This tool is for testing of MessagePack implementation.\n"
"This does following behavior:\n"
"\n"
" 1. Reads objects serialized by MessagePack from <in-file> (default: stdin)\n"
" 2. Re-serializes the objects using C++ implementation of MessagePack (Note that C++ implementation is considered valid)\n"
" 3. Writes the re-serialized objects into <out-file> (default: stdout)\n"
"\n"
, prog);
exit(1);
}
int main(int argc, char* argv[])
{
int infd = 0;
int outfd = 1;
if(argc < 1 || argc > 3) {
usage(argv[0]);
}
for(int i=1; i < argc; ++i) {
if(strlen(argv[i]) > 1 && argv[i][0] == '-') {
usage(argv[0]);
}
}
if(argc >= 2) {
const char* fname = argv[1];
if(strcmp(fname, "-") != 0) {
infd = open(fname, O_RDONLY);
if(infd < 0) {
perror("can't open input file");
exit(1);
}
}
}
if(argc >= 3) {
const char* fname = argv[2];
if(strcmp(fname, "-") != 0) {
outfd = open(fname, O_WRONLY | O_CREAT| O_TRUNC, 0666);
if(outfd < 0) {
perror("can't open output file");
exit(1);
}
}
}
int code = run(infd, outfd);
close(infd);
close(outfd);
return code;
}
+88
View File
@@ -0,0 +1,88 @@
#
# MessagePack cross-language test tool
#
# $ gem install msgpack
# or
# $ port install rb_msgpack # MacPorts
#
begin
require 'rubygems'
rescue LoadError
end
require 'msgpack'
def run(inio, outio)
pac = MessagePack::Unpacker.new(inio)
begin
pac.each {|obj|
outio.write MessagePack.pack(obj)
outio.flush
}
rescue EOFError
return 0
rescue
$stderr.puts $!
return 1
end
return 0
end
def usage
puts <<EOF
Usage: #{$0} [in-file] [out-file]
This tool is for testing of MessagePack implementation.
This does following behavior:
1. Reads objects serialized by MessagePack from <in-file> (default: stdin)
2. Re-serializes the objects using Ruby implementation of MessagePack (Note that Ruby implementation is considered valid)
3. Writes the re-serialized objects into <out-file> (default: stdout)
EOF
exit 1
end
inio = $stdin
outio = $stdout
if ARGV.length > 2
usage
end
ARGV.each {|str|
if str.size > 1 && str[0] == ?-
usage
end
}
if fname = ARGV[0]
unless fname == "-"
begin
inio = File.open(fname)
rescue
puts "can't open output file: #{$!}"
exit 1
end
end
end
if fname = ARGV[1]
unless fname == "-"
begin
outio = File.open(fname, "w")
rescue
puts "can't open output file: #{$!}"
exit 1
end
end
end
code = run(inio, outio)
inio.close
outio.close
exit code
+58
View File
@@ -0,0 +1,58 @@
#include <msgpack.hpp>
#include <string>
#include <iostream>
class old_class {
public:
old_class() : value("default") { }
std::string value;
MSGPACK_DEFINE(value);
};
class new_class {
public:
new_class() : value("default"), flag(-1) { }
std::string value;
int flag;
MSGPACK_DEFINE(value, flag);
};
int main(void)
{
{
old_class oc;
new_class nc;
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, oc);
msgpack::zone zone;
msgpack::object obj;
msgpack::unpack(sbuf.data(), sbuf.size(), NULL, &zone, &obj);
obj.convert(&nc);
std::cout << obj << " value=" << nc.value << " flag=" << nc.flag << std::endl;
}
{
new_class nc;
old_class oc;
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, nc);
msgpack::zone zone;
msgpack::object obj;
msgpack::unpack(sbuf.data(), sbuf.size(), NULL, &zone, &obj);
obj.convert(&oc);
std::cout << obj << " value=" << oc.value << std::endl;
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ namespace myprotocol {
struct Put : define< tuple<uint32_t, std::string, raw_ref> > {
Put() { }
Put(uint32_t f, const std::string& k, const char* valref, size_t vallen) :
Put(uint32_t f, const std::string& k, const char* valref, uint32_t vallen) :
define_type(msgpack_type( f, k, raw_ref(valref,vallen) )) { }
uint32_t& flags() { return get<0>(); }
std::string& key() { return get<1>(); }
-5
View File
@@ -1,5 +0,0 @@
require 'msgpack'
serialized = [1, -1, true, false, nil, {"key" => "value"}].to_msgpack
p MessagePack.unpack(serialized)
+36
View File
@@ -0,0 +1,36 @@
#include <msgpack.h>
#include <assert.h>
void test()
{
size_t size = 10000000;
msgpack_sbuffer buf;
msgpack_sbuffer_init(&buf);
msgpack_packer * pk = msgpack_packer_new(&buf, msgpack_sbuffer_write);
msgpack_pack_array(pk, size);
{
int idx = 0;
for (; idx < size; ++idx)
msgpack_pack_uint32(pk, 1);
}
msgpack_packer_free(pk);
size_t upk_pos = 0;
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos)) {
}
msgpack_sbuffer_destroy(&buf);
}
int main(int argc, char **argv)
{
int i = 0;
for (; i < 10; ++i) test();
return 0;
}
+37
View File
@@ -0,0 +1,37 @@
#include <msgpack.h>
#include <assert.h>
void test()
{
uint64_t test_u64 = 0xFFF0000000000001LL;
size_t size = 10000000;
msgpack_sbuffer buf;
msgpack_sbuffer_init(&buf);
msgpack_packer * pk = msgpack_packer_new(&buf, msgpack_sbuffer_write);
msgpack_pack_array(pk, size);
{
int idx = 0;
for (; idx < size; ++idx)
msgpack_pack_uint64(pk, test_u64);
}
msgpack_packer_free(pk);
size_t upk_pos = 0;
msgpack_unpacked msg;
msgpack_unpacked_init(&msg);
while (msgpack_unpack_next(&msg, buf.data, buf.size, &upk_pos)) {
}
msgpack_sbuffer_destroy(&buf);
}
int main(int argc, char **argv)
{
int i = 0;
for (; i < 10; ++i) test();
return 0;
}
+9 -12
View File
@@ -22,25 +22,22 @@ public:
ssize_t count =
read(m_sock, m_pac.buffer(), m_pac.buffer_capacity());
if(count < 0) {
if(count <= 0) {
if(count == 0) {
throw std::runtime_error("connection closed");
}
if(errno == EAGAIN || errno == EINTR) {
return;
} else {
throw std::runtime_error(strerror(errno));
}
} else if(count == 0) {
throw std::runtime_error("connection closed");
throw std::runtime_error(strerror(errno));
}
m_pac.buffer_consumed(count);
while(m_pac.execute()) {
msgpack::object msg = m_pac.data();
auto_zone life( m_pac.release_zone() );
m_pac.reset();
msgpack::unpacked result;
while (m_pac.next(&result)) {
msgpack::object msg = result.get();
auto_zone& life = result.zone();
process_message(msg, life);
}
-72
View File
@@ -1,72 +0,0 @@
require 'msgpack'
class Server
def initialize(sock)
@sock = sock
@pk = MessagePack::Unpacker.new
@buffer = ''
@nread = 0
end
def run
while true
begin
data = @sock.sysread(1024)
rescue
puts "connection closed (#{$!})"
return
end
receive_data(data)
end
end
private
def receive_data(data)
@buffer << data
while true
@nread = @pk.execute(@buffer, @nread)
if @pk.finished?
msg = @pk.data
process_message(msg)
@pk.reset
@buffer.slice!(0, @nread)
@nread = 0
next unless @buffer.empty?
end
break
end
if @buffer.length > 10*1024*1024
raise "message is too large"
end
rescue
puts "error while processing client packet: #{$!}"
end
def process_message(msg)
puts "message reached: #{msg.inspect}"
end
end
rpipe, wpipe = IO.pipe
# run server thread
thread = Thread.new(Server.new(rpipe)) {|srv|
srv.run
}
# client thread:
wpipe.write ["put", "apple", "red"].to_msgpack
wpipe.write ["put", "lemon", "yellow"].to_msgpack
wpipe.write ["get", "apple"].to_msgpack
wpipe.close
thread.join
+10
View File
@@ -0,0 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: MessagePack
Description: Binary-based efficient object serialization library
Version: @VERSION@
Libs: -L${libdir} -lmsgpack
Cflags: -I${includedir}
+47
View File
@@ -0,0 +1,47 @@
IF NOT EXIST include MKDIR include
IF NOT EXIST include\msgpack MKDIR include\msgpack
IF NOT EXIST include\msgpack\type MKDIR include\msgpack\type
IF NOT EXIST include\msgpack\type\tr1 MKDIR include\msgpack\type\tr1
copy src\msgpack\pack_define.h include\msgpack\
copy src\msgpack\pack_template.h include\msgpack\
copy src\msgpack\unpack_define.h include\msgpack\
copy src\msgpack\unpack_template.h include\msgpack\
copy src\msgpack\sysdep.h include\msgpack\
copy src\msgpack.h include\
copy src\msgpack\sbuffer.h include\msgpack\
copy src\msgpack\version.h include\msgpack\
copy src\msgpack\vrefbuffer.h include\msgpack\
copy src\msgpack\zbuffer.h include\msgpack\
copy src\msgpack\fbuffer.h include\msgpack\
copy src\msgpack\pack.h include\msgpack\
copy src\msgpack\unpack.h include\msgpack\
copy src\msgpack\object.h include\msgpack\
copy src\msgpack\zone.h include\msgpack\
copy src\msgpack.hpp include\
copy src\msgpack\sbuffer.hpp include\msgpack\
copy src\msgpack\vrefbuffer.hpp include\msgpack\
copy src\msgpack\zbuffer.hpp include\msgpack\
copy src\msgpack\fbuffer.hpp include\msgpack\
copy src\msgpack\pack.hpp include\msgpack\
copy src\msgpack\unpack.hpp include\msgpack\
copy src\msgpack\object.hpp include\msgpack\
copy src\msgpack\zone.hpp include\msgpack\
copy src\msgpack\type.hpp include\msgpack\
copy src\msgpack\type\bool.hpp include\msgpack\type\
copy src\msgpack\type\deque.hpp include\msgpack\type\
copy src\msgpack\type\fixint.hpp include\msgpack\type\
copy src\msgpack\type\float.hpp include\msgpack\type\
copy src\msgpack\type\int.hpp include\msgpack\type\
copy src\msgpack\type\list.hpp include\msgpack\type\
copy src\msgpack\type\map.hpp include\msgpack\type\
copy src\msgpack\type\nil.hpp include\msgpack\type\
copy src\msgpack\type\pair.hpp include\msgpack\type\
copy src\msgpack\type\raw.hpp include\msgpack\type\
copy src\msgpack\type\set.hpp include\msgpack\type\
copy src\msgpack\type\string.hpp include\msgpack\type\
copy src\msgpack\type\vector.hpp include\msgpack\type\
copy src\msgpack\type\tuple.hpp include\msgpack\type\
copy src\msgpack\type\define.hpp include\msgpack\type\
copy src\msgpack\type\tr1\unordered_map.hpp include\msgpack\type\tr1\
copy src\msgpack\type\tr1\unordered_set.hpp include\msgpack\type\tr1\
+20
View File
@@ -0,0 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MessagePack", "msgpack_vc8.vcproj", "{122A2EA4-B283-4241-9655-786DE78283B2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{122A2EA4-B283-4241-9655-786DE78283B2}.Debug|Win32.ActiveCfg = Debug|Win32
{122A2EA4-B283-4241-9655-786DE78283B2}.Debug|Win32.Build.0 = Debug|Win32
{122A2EA4-B283-4241-9655-786DE78283B2}.Release|Win32.ActiveCfg = Release|Win32
{122A2EA4-B283-4241-9655-786DE78283B2}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
+219
View File
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="MessagePack"
ProjectGUID="{122A2EA4-B283-4241-9655-786DE78283B2}"
RootNamespace="MessagePack"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
Description="Gathering header files"
CommandLine="msgpack_vc.postbuild.bat"
Outputs="include"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="1"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="lib\msgpackd.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
Description="Gathering header files"
CommandLine="msgpack_vc.postbuild.bat"
Outputs="include"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="."
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="lib\msgpack.lib"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\src\objectc.c"
>
</File>
<File
RelativePath=".\src\unpack.c"
>
</File>
<File
RelativePath=".\src\version.c"
>
</File>
<File
RelativePath=".\src\vrefbuffer.c"
>
</File>
<File
RelativePath=".\src\zone.c"
>
</File>
<File
RelativePath=".\src\object.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\src\msgpack\pack_define.h"
>
</File>
<File
RelativePath=".\src\msgpack\pack_template.h"
>
</File>
<File
RelativePath=".\src\msgpack\sysdep.h"
>
</File>
<File
RelativePath=".\src\msgpack\unpack_define.h"
>
</File>
<File
RelativePath=".\src\msgpack\unpack_template.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
-34
View File
@@ -1,34 +0,0 @@
use inc::Module::Install;
name 'Data-MessagePack';
all_from 'lib/Data/MessagePack.pm';
perl_version '5.008005';
license 'perl';
can_cc or die "This module requires a C compiler";
my $ccflags = '-I../ ';
makemaker_args(
OBJECT => '$(O_FILES)',
LIBS => [''],
CCFLAGS => $ccflags,
clean => {
FILES => q{
*.stackdump
*.gcov *.gcda *.gcno
*.out
nytprof
cover_db
},
},
);
tests 't/*.t';
author_tests('xt');
auto_set_repository;
build_requires 'Test::More';
use_test_base;
auto_include;
WriteAll;
-40
View File
@@ -1,40 +0,0 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#define NEED_newCONSTSUB
#include "ppport.h"
#ifdef __cplusplus
};
#endif
XS(xs_pack);
XS(xs_unpack);
XS(xs_unpacker_new);
XS(xs_unpacker_execute);
XS(xs_unpacker_execute_limit);
XS(xs_unpacker_is_finished);
XS(xs_unpacker_data);
XS(xs_unpacker_reset);
XS(boot_Data__MessagePack) {
dXSARGS;
HV * stash;
newXS("Data::MessagePack::pack", xs_pack, __FILE__);
newXS("Data::MessagePack::unpack", xs_unpack, __FILE__);
stash = gv_stashpvn("Data::MessagePack", strlen("Data::MessagePack"), TRUE);
newCONSTSUB(stash, "true", &PL_sv_yes);
newCONSTSUB(stash, "false", &PL_sv_no);
newXS("Data::MessagePack::Unpacker::new", xs_unpacker_new, __FILE__);
newXS("Data::MessagePack::Unpacker::execute", xs_unpacker_execute, __FILE__);
newXS("Data::MessagePack::Unpacker::execute_limit", xs_unpacker_execute_limit, __FILE__);
newXS("Data::MessagePack::Unpacker::is_finished", xs_unpacker_is_finished, __FILE__);
newXS("Data::MessagePack::Unpacker::data", xs_unpacker_data, __FILE__);
newXS("Data::MessagePack::Unpacker::reset", xs_unpacker_reset, __FILE__);
}
-20
View File
@@ -1,20 +0,0 @@
use strict;
use warnings;
use Data::MessagePack;
use JSON::XS;
use Benchmark ':all';
my $a = [0..2**24];
my $j = JSON::XS::encode_json($a);
my $m = Data::MessagePack->pack($a);
print "-- deserialize\n";
print "JSON::XS: $JSON::XS::VERSION\n";
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
cmpthese(
-1 => {
json => sub { JSON::XS::decode_json($j) },
mp => sub { Data::MessagePack->unpack($m) },
}
);
-18
View File
@@ -1,18 +0,0 @@
use strict;
use warnings;
use Data::MessagePack;
use JSON::XS;
use Benchmark ':all';
my $a = [0..2**24];
print "-- serialize\n";
print "JSON::XS: $JSON::XS::VERSION\n";
print "Data::MessagePack: $Data::MessagePack::VERSION\n";
cmpthese(
-1 => {
json => sub { JSON::XS::encode_json($a) },
mp => sub { Data::MessagePack->pack($a) },
}
);
-33
View File
@@ -1,33 +0,0 @@
package Data::MessagePack;
use strict;
use warnings;
use XSLoader;
our $VERSION = 0.01;
XSLoader::load(__PACKAGE__, $VERSION);
1;
__END__
=head1 NAME
Data::MessagePack - messagepack
=head1 SYNOPSIS
my $packed = Data::MessagePack->pack($dat);
my $unpacked = Data::MessagePack->unpack($dat);
=head1 DESCRIPTION
Data::MessagePack is a binary packer for perl.
=head1 AUTHORS
Tokuhiro Matsuno
=head1 SEE ALSO
L<http://msgpack.sourceforge.jp/>
-52
View File
@@ -1,52 +0,0 @@
=head1 NAME
Data::MessagePack::Unpacker - messagepack streaming deserializer
=head1 SYNOPSIS
use Data::Dumper;
my $up = Data::MessagePack::Unpacker->new;
my $ret = $up->execute($v, 0);
if ($ret != length($v)) {
fail "extra bytes";
}
return Dumper($up->data);
=head1 DESCRIPTION
This is an streaming deserializer for messagepack.
=head1 METHODS
=over 4
=item my $up = Data::MessagePack::Unpacker->new()
create new stream deserializer
=item $up->execute()
=item $up->execute_limit()
=item $up->is_finished()
is this deserializer finished?
=item $up->data()
returns deserialized object.
=item $up->reset()
reset the stream deserializer, without memory zone.
=back
=head1 AUTHORS
Tokuhiro Matsuno
=head1 SEE ALSO
L<Data::MessagePack>
-155
View File
@@ -1,155 +0,0 @@
/*
* code is written by tokuhirom.
* buffer alocation technique is taken from JSON::XS. thanks to mlehmann.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#ifdef __cplusplus
};
#endif
#include "msgpack/pack_define.h"
#define msgpack_pack_inline_func(name) \
static inline void msgpack_pack ## name
#define msgpack_pack_inline_func_cint(name) \
static inline void msgpack_pack ## name
typedef struct {
char *cur; /* SvPVX (sv) + current output position */
char *end; /* SvEND (sv) */
SV *sv; /* result scalar */
} enc_t;
void need(enc_t *enc, STRLEN len);
#define msgpack_pack_user enc_t*
#define msgpack_pack_append_buffer(enc, buf, len) \
need(enc, len); \
memcpy(enc->cur, buf, len); \
enc->cur += len;
#include "msgpack/pack_template.h"
#define _PACK_WRAPPER(t) msgpack_pack_##t
#define PACK_WRAPPER(t) _PACK_WRAPPER(t)
#define INIT_SIZE 32 /* initial scalar size to be allocated */
void need(enc_t *enc, STRLEN len)
{
if (enc->cur + len >= enc->end) {
STRLEN cur = enc->cur - (char *)SvPVX (enc->sv);
SvGROW (enc->sv, cur + (len < (cur >> 2) ? cur >> 2 : len) + 1);
enc->cur = SvPVX (enc->sv) + cur;
enc->end = SvPVX (enc->sv) + SvLEN (enc->sv) - 1;
}
}
static void _msgpack_pack_sv(enc_t *enc, SV* val) {
if (val==NULL) {
msgpack_pack_nil(enc);
return;
}
switch (SvTYPE(val)) {
case SVt_NULL:
msgpack_pack_nil(enc);
break;
case SVt_IV:
if (SvIOK_UV(val)) {
msgpack_pack_uint32(enc, SvUV(val));
} else {
PACK_WRAPPER(IVTYPE)(enc, SvIV(val));
}
break;
case SVt_PVNV:
{
STRLEN len = 0;
char *pv = SvPV(val, len);
if (len == 1 && *pv == '1') {
msgpack_pack_true(enc);
} else if (len == 0 && *pv==0) {
msgpack_pack_false(enc);
} else {
msgpack_pack_nil(enc);
}
}
break;
case SVt_NV:
PACK_WRAPPER(NVTYPE)(enc, SvNV(val));
break;
case SVt_PVAV:
{
AV* ary = (AV*)val;
int len = av_len(ary) + 1;
int i;
msgpack_pack_array(enc, len);
for (i=0; i<len; i++) {
SV** svp = av_fetch(ary, i, 0);
if (svp) {
_msgpack_pack_sv(enc, *svp);
} else {
msgpack_pack_nil(enc);
}
}
}
break;
case SVt_PVHV:
{
HV* hval = (HV*)val;
int count = hv_iterinit(hval);
HE* he;
msgpack_pack_map(enc, count);
while (he = hv_iternext(hval)) {
_msgpack_pack_sv(enc, hv_iterkeysv(he));
_msgpack_pack_sv(enc, HeVAL(he));
}
}
break;
case SVt_RV:
_msgpack_pack_sv(enc, SvRV(val));
break;
default:
if (SvPOKp(val)) {
STRLEN len;
char * cval = SvPV(val, len);
msgpack_pack_raw(enc, len);
msgpack_pack_raw_body(enc, cval, len);
return;
} else {
sv_dump(val);
Perl_croak(aTHX_ "msgpack for perl doesn't supported this type: %d\n", SvTYPE(val));
}
}
}
XS(xs_pack) {
dXSARGS;
if (items != 2) {
Perl_croak(aTHX_ "Usage: Data::MessagePack->pack($dat)");
}
SV* val = ST(1);
enc_t enc;
enc.sv = sv_2mortal(NEWSV(0, INIT_SIZE));
enc.cur = SvPVX(enc.sv);
enc.end = SvEND(enc.sv);
SvPOK_only(enc.sv);
_msgpack_pack_sv(&enc, val);
SvCUR_set(enc.sv, enc.cur - SvPVX (enc.sv));
*SvEND (enc.sv) = 0; /* many xs functions expect a trailing 0 for text strings */
ST(0) = enc.sv;
XSRETURN(1);
}
-7063
View File
File diff suppressed because it is too large Load Diff
-6
View File
@@ -1,6 +0,0 @@
use strict;
use warnings;
use Test::More tests => 1;
use_ok 'Data::MessagePack';
-60
View File
@@ -1,60 +0,0 @@
use t::Util;
use Test::More;
use Data::MessagePack;
sub packit {
local $_ = unpack("H*", Data::MessagePack->pack($_[0]));
s/(..)/$1 /g;
s/ $//;
$_;
}
sub pis ($$) {
is packit($_[0]), $_[1], 'dump ' . $_[1];
}
my @dat = (
0, '00',
1, '01',
127, '7f',
128, 'cc 80',
255, 'cc ff',
256, 'cd 01 00',
65535, 'cd ff ff',
65536, 'ce 00 01 00 00',
-1, 'ff',
-32, 'e0',
-33, 'd0 df',
-128, 'd0 80',
-129, 'd1 ff 7f',
-32768, 'd1 80 00',
-32769, 'd2 ff ff 7f ff',
1.0, 'cb 3f f0 00 00 00 00 00 00',
"", 'a0',
"a", 'a1 61',
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 'bf 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61',
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 'da 00 20 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61',
undef, 'c0',
Data::MessagePack::true(), 'c3',
Data::MessagePack::false(), 'c2',
[], '90',
[+[]], '91 90',
[[], undef], '92 90 c0',
{'a', 0}, '81 a1 61 00',
8388608, 'ce 00 80 00 00',
[undef, false, true], '93 c0 c2 c3',
["", "a", "bc", "def"], '94 a0 a1 61 a2 62 63 a3 64 65 66',
[[], [[undef]]], '92 90 91 91 c0',
[undef, false, true], '93 c0 c2 c3',
[[0, 64, 127], [-32, -16, -1]], '92 93 00 40 7f 93 e0 f0 ff',
[0, -128, -1, 0, -32768, -1, 0, -2147483648, -1], '99 00 d0 80 ff 00 d1 80 00 ff 00 d2 80 00 00 00 ff',
2147483648, 'ce 80 00 00 00',
-2147483648, 'd2 80 00 00 00',
);
plan tests => 1*(scalar(@dat)/2);
for (my $i=0; $i<scalar(@dat); ) {
pis $dat[$i++], $dat[$i++];
}
-24
View File
@@ -1,24 +0,0 @@
use Test::More;
use Data::MessagePack;
use t::Util;
no warnings 'uninitialized'; # i need this. i need this.
sub unpackit {
my $v = $_[0];
$v =~ s/ //g;
$v = pack 'H*', $v;
return Data::MessagePack->unpack($v);
}
sub pis ($$) {
is_deeply unpackit($_[0]), $_[1], 'dump ' . $_[0];
}
my @dat = do 't/data.pl';
plan tests => 1*(scalar(@dat)/2);
for (my $i=0; $i<scalar(@dat); ) {
pis $dat[$i++], $dat[$i++];
}
-32
View File
@@ -1,32 +0,0 @@
use t::Util;
use Test::More;
use Data::MessagePack;
no warnings 'uninitialized'; # i need this. i need this.
my $up = Data::MessagePack::Unpacker->new;
sub unpackit {
my $v = $_[0];
$v =~ s/ //g;
$v = pack 'H*', $v;
$up->reset;
my $ret = $up->execute($v, 0);
if ($ret != length($v)) {
fail "extra bytes";
}
return $up->data;
}
sub pis ($$) {
is_deeply unpackit($_[0]), $_[1], 'dump ' . $_[0];
}
my @dat = do 't/data.pl';
plan tests => 1*(scalar(@dat)/2) + 1;
isa_ok $up, 'Data::MessagePack::Unpacker';
for (my $i=0; $i<scalar(@dat); ) {
pis $dat[$i++], $dat[$i++];
}
-24
View File
@@ -1,24 +0,0 @@
use Test::More;
use Data::MessagePack;
use t::Util;
no warnings 'uninitialized'; # i need this. i need this.
sub invert {
return Data::MessagePack->unpack(
Data::MessagePack->pack($_[0]),
);
}
sub pis ($) {
is_deeply invert($_[0]), $_[0], 'dump ' . $_[0];
}
my @dat = do 't/data.pl';
plan tests => 1*(scalar(@dat)/2);
for (my $i=0; $i<scalar(@dat); ) {
$i++;
pis $dat[$i++];
}
-20
View File
@@ -1,20 +0,0 @@
package t::Util;
use strict;
use warnings;
sub import {
my $pkg = caller(0);
strict->import;
warnings->import;
no strict 'refs';
*{"$pkg\::true"} = sub () {
Data::MessagePack::true()
};
*{"$pkg\::false"} = sub () {
Data::MessagePack::false()
};
}
1;
-15
View File
@@ -1,15 +0,0 @@
no warnings 'uninitialized'; # i need this. i need this.
(
'93 c0 c2 c3' => [undef, false, true],
'94 a0 a1 61 a2 62 63 a3 64 65 66', ["", "a", "bc", "def"],
'92 90 91 91 c0', [[], [[undef]]],
'93 c0 c2 c3', [undef, false, true],
'ce 80 00 00 00', 2147483648,
'99 cc 00 cc 80 cc ff cd 00 00 cd 80 00 cd ff ff ce 00 00 00 00 ce 80 00 00 00 ce ff ff ff ff', [0, 128, 255, 0, 32768, 65535, 0, 2147483648, 4294967295],
'92 93 00 40 7f 93 e0 f0 ff', [[0, 64, 127], [-32, -16, -1]],
'96 dc 00 00 dc 00 01 c0 dc 00 02 c2 c3 dd 00 00 00 00 dd 00 00 00 01 c0 dd 00 00 00 02 c2 c3', [[], [undef], [false, true], [], [undef], [false, true]],
'96 da 00 00 da 00 01 61 da 00 02 61 62 db 00 00 00 00 db 00 00 00 01 61 db 00 00 00 02 61 62', ["", "a", "ab", "", "a", "ab"],
'99 d0 00 d0 80 d0 ff d1 00 00 d1 80 00 d1 ff ff d2 00 00 00 00 d2 80 00 00 00 d2 ff ff ff ff', [0, -128, -1, 0, -32768, -1, 0, -2147483648, -1],
'82 c2 81 c0 c0 c3 81 c0 80', {false,{undef,undef}, true,{undef,{}}},
'96 de 00 00 de 00 01 c0 c2 de 00 02 c0 c2 c3 c2 df 00 00 00 00 df 00 00 00 01 c0 c2 df 00 00 00 02 c0 c2 c3 c2', [{}, {undef,false}, {true,false, undef,false}, {}, {undef,false}, {true,false, undef,false}],
)
-290
View File
@@ -1,290 +0,0 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#define NEED_newRV_noinc
#define NEED_sv_2pv_flags
#include "ppport.h"
#ifdef __cplusplus
};
#endif
typedef struct {
int finished;
SV* source;
} unpack_user;
#include "msgpack/unpack_define.h"
#define msgpack_unpack_struct(name) \
struct template ## name
#define msgpack_unpack_func(ret, name) \
ret template ## name
#define msgpack_unpack_callback(name) \
template_callback ## name
#define msgpack_unpack_object SV*
#define msgpack_unpack_user unpack_user
struct template_context;
typedef struct template_context msgpack_unpack_t;
static void template_init(msgpack_unpack_t* u);
static SV* template_data(msgpack_unpack_t* u);
static int template_execute(msgpack_unpack_t* u,
const char* data, size_t len, size_t* off);
static inline SV* template_callback_root(unpack_user* u)
{ return &PL_sv_undef; }
static inline int template_callback_uint8(unpack_user* u, uint8_t d, SV** o)
{ *o = newSVuv(d); return 0; }
static inline int template_callback_uint16(unpack_user* u, uint16_t d, SV** o)
{ *o = newSVuv(d); return 0; }
static inline int template_callback_uint32(unpack_user* u, uint32_t d, SV** o)
{ *o = newSVuv(d); return 0; }
static inline int template_callback_uint64(unpack_user* u, uint64_t d, SV** o)
{ *o = newSVuv(d); return 0; }
static inline int template_callback_int8(unpack_user* u, int8_t d, SV** o)
{ *o = newSViv((long)d); return 0; }
static inline int template_callback_int16(unpack_user* u, int16_t d, SV** o)
{ *o = newSViv((long)d); return 0; }
static inline int template_callback_int32(unpack_user* u, int32_t d, SV** o)
{ *o = newSViv((long)d); return 0; }
static inline int template_callback_int64(unpack_user* u, int64_t d, SV** o)
{ *o = newSViv(d); return 0; }
static inline int template_callback_float(unpack_user* u, float d, SV** o)
{ *o = newSVnv(d); return 0; }
static inline int template_callback_double(unpack_user* u, double d, SV** o)
{ *o = newSVnv(d); return 0; }
static inline int template_callback_nil(unpack_user* u, SV** o)
{ *o = &PL_sv_undef; return 0; }
static inline int template_callback_true(unpack_user* u, SV** o)
{ *o = &PL_sv_yes; return 0; }
static inline int template_callback_false(unpack_user* u, SV** o)
{ *o = &PL_sv_no; return 0;}
static inline int template_callback_array(unpack_user* u, unsigned int n, SV** o)
{ AV* a = newAV(); *o = (SV*)newRV_noinc((SV*)a); av_extend(a, n); return 0; }
static inline int template_callback_array_item(unpack_user* u, SV** c, SV* o)
{ av_push((AV*)SvRV(*c), o); SvREFCNT_inc(o); return 0; } /* FIXME set value directry RARRAY_PTR(obj)[RARRAY_LEN(obj)++] */
static inline int template_callback_map(unpack_user* u, unsigned int n, SV** o)
{ HV * h = newHV(); *o = newRV_noinc((SV*)h); return 0; }
static inline int template_callback_map_item(unpack_user* u, SV** c, SV* k, SV* v)
{ hv_store_ent((HV*)SvRV(*c), k, v, 0); SvREFCNT_inc(v); return 0; }
static inline int template_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l, SV** o)
{ *o = (l == 0) ? newSVpv("", 0) : newSVpv(p, l); return 0; }
#define UNPACKER(from, name) \
msgpack_unpack_t *name; \
name = INT2PTR(msgpack_unpack_t*, SvROK((from)) ? SvIV(SvRV((from))) : SvIV((from))); \
if(name == NULL) { \
Perl_croak(aTHX_ "NULL found for " # name " when shouldn't be."); \
}
#include "msgpack/unpack_template.h"
SV* _msgpack_unpack(SV* data, int limit) {
msgpack_unpack_t mp;
unpack_user u = {0, &PL_sv_undef};
int ret;
size_t from = 0;
STRLEN dlen;
const char * dptr = SvPV_const(data, dlen);
template_init(&mp);
mp.user = u;
mp.user.source = data;
ret = template_execute(&mp, dptr, (size_t)dlen, &from);
mp.user.source = &PL_sv_undef;
if(ret < 0) {
Perl_croak(aTHX_ "parse error.");
} else if(ret == 0) {
Perl_croak(aTHX_ "insufficient bytes.");
} else {
if(from < dlen) {
Perl_croak(aTHX_ "extra bytes.");
}
return template_data(&mp);
}
}
XS(xs_unpack_limit) {
dXSARGS;
if (items != 3) {
Perl_croak(aTHX_ "Usage: Data::MessagePack->unpack('datadata', $limit)");
}
{
int limit = SvIV(ST(2));
ST(0) = _msgpack_unpack(ST(1), limit);
}
XSRETURN(1);
}
XS(xs_unpack) {
dXSARGS;
msgpack_unpack_t mp;
if (items != 2) {
Perl_croak(aTHX_ "Usage: Data::MessagePack->unpack('datadata')");
}
{
ST(0) = _msgpack_unpack(ST(1), sv_len(ST(1)));
}
XSRETURN(1);
}
/* ------------------------------ stream -- */
static void _reset(SV* self) {
UNPACKER(self, mp);
template_init(mp);
unpack_user u = {0, &PL_sv_undef};
mp->user = u;
}
XS(xs_unpacker_new) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: Data::MessagePack::Unpacker->new()");
}
SV* self = sv_newmortal();
msgpack_unpack_t *mp;
Newx(mp, 1, msgpack_unpack_t);
sv_setref_pv(self, "Data::MessagePack::Unpacker", mp);
_reset(self);
ST(0) = self;
XSRETURN(1);
}
static SV* _execute_impl(SV* self, SV* data, UV off, I32 limit) {
UNPACKER(self, mp);
size_t from = off;
const char* dptr = SvPV_nolen_const(data);
long dlen = limit;
int ret;
if(from >= dlen) {
Perl_croak(aTHX_ "offset is bigger than data buffer size.");
}
mp->user.source = data;
ret = template_execute(mp, dptr, (size_t)dlen, &from);
mp->user.source = &PL_sv_undef;
if(ret < 0) {
Perl_croak(aTHX_ "parse error.");
} else if(ret > 0) {
mp->user.finished = 1;
return newSVuv(from);
} else {
mp->user.finished = 0;
return newSVuv(from);
}
}
XS(xs_unpacker_execute) {
dXSARGS;
if (items != 3) {
Perl_croak(aTHX_ "Usage: $unpacker->execute_limit(data, off)");
}
{
SV* self = ST(0);
SV* data = ST(1);
IV off = SvIV(ST(2));
ST(0) = _execute_impl(self, data, off, sv_len(data));
}
XSRETURN(1);
}
XS(xs_unpacker_execute_limit) {
dXSARGS;
if (items != 4) {
Perl_croak(aTHX_ "Usage: $unpacker->execute_limit(data, off, limit)");
}
SV* self = ST(0);
SV* data = ST(1);
IV off = SvIV(ST(2));
IV limit = SvIV(ST(3));
ST(0) = _execute_impl(self, data, off, limit);
XSRETURN(1);
}
XS(xs_unpacker_is_finished) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: $unpacker->is_finished()");
}
UNPACKER(ST(0), mp);
ST(0) = (mp->user.finished) ? &PL_sv_yes : &PL_sv_no;
XSRETURN(1);
}
XS(xs_unpacker_data) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: $unpacker->data()");
}
UNPACKER(ST(0), mp);
ST(0) = template_data(mp);
XSRETURN(1);
}
XS(xs_unpacker_reset) {
dXSARGS;
if (items != 1) {
Perl_croak(aTHX_ "Usage: $unpacker->reset()");
}
_reset(ST(0));
XSRETURN(0);
}
-4
View File
@@ -1,4 +0,0 @@
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
preprocess() {
ruby -r erb -e 'puts ERB.new(ARGF.read).result' $1.erb > $1.tmp
if [ "$?" != 0 ]; then
echo ""
echo "** preprocess failed **"
echo ""
exit 1
else
mv $1.tmp $1
fi
}
preprocess src/msgpack/type/tuple.hpp
preprocess src/msgpack/type/define.hpp
preprocess src/msgpack/zone.hpp
-70
View File
@@ -1,70 +0,0 @@
require 'rubygems'
require 'json'
require 'msgpack'
def show10(str)
puts "#{str.length/1024} KB"
puts str[0, 10].unpack('C*').map{|x|"%02x"%x}.join(' ') + " ..."
end
ary = []
i = 0
while i < (1<<24)
#ary << (1<<24)
ary << i
i += 1
end
GC.start
puts "----"
puts "MessagePack"
a = Time.now
packed = MessagePack::pack(ary)
b = Time.now
show10(packed)
sec = b - a
puts "#{sec} sec."
puts "#{packed.length.to_f / sec / 1024 / 1024 * 8} Mbps"
GC.start
=begin
puts "----"
puts "JSON"
a = Time.now
json = ary.to_json
b = Time.now
show10(json)
puts "#{b-a} sec."
ary = nil
GC.start
=end
puts "----"
puts "MessagePack"
a = Time.now
ary = MessagePack::unpack(packed)
b = Time.now
sec = b - a
puts "#{sec} sec."
puts "#{packed.length.to_f / sec / 1024 / 1024 * 8} Mbps"
p ary.size
p (1<<24)
ary = nil
GC.start
=begin
puts "----"
puts "JSON"
a = Time.now
ary = JSON::load(json)
b = Time.now
puts "#{b-a} sec."
=end
-4
View File
@@ -1,4 +0,0 @@
require 'mkmf'
$CFLAGS << " -I.. -Wall -O4"
create_makefile('msgpack')
-29
View File
@@ -1,29 +0,0 @@
= MessagePack
== Description
== Installation
=== Archive Installation
rake install
=== Gem Installation
gem install msgpack
== Features/Problems
== Synopsis
== Copyright
Author:: frsyuki <frsyuki@users.sourceforge.jp>
Copyright:: Copyright (c) 2008-2009 frsyuki
License:: Apache License, Version 2.0
-133
View File
@@ -1,133 +0,0 @@
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/contrib/rubyforgepublisher'
require 'rake/contrib/sshpublisher'
require 'fileutils'
include FileUtils
NAME = "msgpack"
AUTHOR = "FURUHASHI Sadayuki"
EMAIL = "frsyuki _at_ users.sourceforge.jp"
DESCRIPTION = "Binary-based efficient data interchange format."
RUBYFORGE_PROJECT = "msgpack"
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
BIN_FILES = %w( )
VERS = "0.3.1"
#REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
REV = nil
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
RDOC_OPTS = [
'--title', "#{NAME} documentation",
"--charset", "utf-8",
"--opname", "index.html",
"--line-numbers",
"--main", "README",
"--inline-source",
]
task :default => [:test]
task :package => [:clean]
Rake::TestTask.new("test") do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
t.verbose = true
end
spec = Gem::Specification.new do |s|
s.name = NAME
s.version = VERS
s.platform = Gem::Platform::RUBY
s.has_rdoc = true
s.extra_rdoc_files = ["README", "ChangeLog", "AUTHORS"]
s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
s.summary = DESCRIPTION
s.description = DESCRIPTION
s.author = AUTHOR
s.email = EMAIL
s.homepage = HOMEPATH
s.executables = BIN_FILES
s.rubyforge_project = RUBYFORGE_PROJECT
s.bindir = "bin"
s.require_path = "ext"
s.autorequire = ""
s.test_files = Dir["test/test_*.rb"]
#s.add_dependency('activesupport', '>=1.3.1')
#s.required_ruby_version = '>= 1.8.2'
s.files = %w(README ChangeLog Rakefile) +
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
Dir.glob("ext/**/*.{h,c,rb}") +
Dir.glob("examples/**/*.rb") +
Dir.glob("tools/*.rb") +
Dir.glob("msgpack/*.h")
s.extensions = FileList["ext/**/extconf.rb"].to_a
end
Rake::GemPackageTask.new(spec) do |p|
p.need_tar = true
p.gem_spec = spec
end
task :install do
name = "#{NAME}-#{VERS}.gem"
sh %{rake package}
sh %{sudo gem install pkg/#{name}}
end
task :uninstall => [:clean] do
sh %{sudo gem uninstall #{NAME}}
end
#Rake::RDocTask.new do |rdoc|
# rdoc.rdoc_dir = 'html'
# rdoc.options += RDOC_OPTS
# rdoc.template = "resh"
# #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
# if ENV['DOC_FILES']
# rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
# else
# rdoc.rdoc_files.include('README', 'ChangeLog')
# rdoc.rdoc_files.include('lib/**/*.rb')
# rdoc.rdoc_files.include('ext/**/*.c')
# end
#end
desc "Publish to RubyForge"
task :rubyforge => [:rdoc, :package] do
require 'rubyforge'
Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'frsyuki').upload
end
desc 'Package and upload the release to rubyforge.'
task :release => [:clean, :package] do |t|
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
pkg = "pkg/#{NAME}-#{VERS}"
rf = RubyForge.new
puts "Logging in"
rf.login
c = rf.userconfig
# c["release_notes"] = description if description
# c["release_changes"] = changes if changes
c["preformatted"] = true
files = [
"#{pkg}.tgz",
"#{pkg}.gem"
].compact
puts "Releasing #{NAME} v. #{VERS}"
rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
end
-3
View File
@@ -1,3 +0,0 @@
require 'test/unit'
require File.dirname(__FILE__) + '/../ext/msgpack'
-20
View File
@@ -1,20 +0,0 @@
#!/bin/sh
mkdir -p gem/ext
mkdir -p gem/msgpack
cp extconf.rb gem/ext/
cp pack.c gem/ext/
cp pack.h gem/ext/
cp rbinit.c gem/ext/
cp unpack.c gem/ext/
cp unpack.h gem/ext/
cat test_case.rb | sed "s/require ['\"]msgpack['\"]/require File.dirname(__FILE__) + '\/test_helper.rb'/" > gem/test/msgpack_test.rb
cp ../AUTHORS gem/AUTHORS
cp ../ChangeLog gem/ChangeLog
cp ../msgpack/pack_define.h gem/msgpack/
cp ../msgpack/pack_template.h gem/msgpack/
cp ../msgpack/unpack_define.h gem/msgpack/
cp ../msgpack/unpack_template.h gem/msgpack/
cd gem && rake --trace package
-12
View File
@@ -1,12 +0,0 @@
Gem::Specification.new do |s|
s.platform = Gem::Platform::CURRENT
s.name = "msgpack"
s.version = "0.3.1"
s.summary = "MessagePack"
s.author = "FURUHASHI Sadayuki"
s.email = "frsyuki@users.sourceforge.jp"
s.homepage = "http://msgpack.sourceforge.jp/"
s.rubyforge_project = "msgpack"
s.require_paths = ["lib", "ext"]
s.files = ["lib/**/*", "ext/**/*"].map {|g| Dir.glob(g) }.flatten
end
-165
View File
@@ -1,165 +0,0 @@
/*
* MessagePack for Ruby packing routine
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ruby.h"
#include "msgpack/pack_define.h"
#define msgpack_pack_inline_func(name) \
static inline void msgpack_pack ## name
#define msgpack_pack_inline_func_cint(name) \
static inline void msgpack_pack ## name
#define msgpack_pack_user VALUE
#define msgpack_pack_append_buffer(user, buf, len) \
rb_str_buf_cat(user, (const void*)buf, len)
#include "msgpack/pack_template.h"
#ifndef RUBY_VM
#include "st.h" // ruby hash
#endif
static ID s_to_msgpack;
#define ARG_BUFFER(name, argc, argv) \
VALUE name; \
if(argc == 1) { \
name = argv[0]; \
} else if(argc == 0) { \
name = rb_str_buf_new(0); \
} else { \
rb_raise(rb_eArgError, "wrong number of arguments (%d for 0)", argc); \
}
static VALUE MessagePack_NilClass_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_nil(out);
return out;
}
static VALUE MessagePack_TrueClass_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_true(out);
return out;
}
static VALUE MessagePack_FalseClass_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_false(out);
return out;
}
static VALUE MessagePack_Fixnum_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_long(out, FIX2LONG(self));
return out;
}
#ifndef RBIGNUM_SIGN // Ruby 1.8
#define RBIGNUM_SIGN(b) (RBIGNUM(b)->sign)
#endif
static VALUE MessagePack_Bignum_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
// FIXME bignum
if(RBIGNUM_SIGN(self)) { // positive
msgpack_pack_uint64(out, rb_big2ull(self));
} else { // negative
msgpack_pack_int64(out, rb_big2ll(self));
}
return out;
}
static VALUE MessagePack_Float_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_double(out, rb_num2dbl(self));
return out;
}
static VALUE MessagePack_String_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_raw(out, RSTRING_LEN(self));
msgpack_pack_raw_body(out, RSTRING_PTR(self), RSTRING_LEN(self));
return out;
}
static VALUE MessagePack_Array_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_array(out, RARRAY_LEN(self));
VALUE* p = RARRAY_PTR(self);
VALUE* const pend = p + RARRAY_LEN(self);
for(;p != pend; ++p) {
rb_funcall(*p, s_to_msgpack, 1, out);
}
return out;
}
#ifndef RHASH_SIZE // Ruby 1.8
#define RHASH_SIZE(h) (RHASH(h)->tbl ? RHASH(h)->tbl->num_entries : 0)
#endif
static int MessagePack_Hash_to_msgpack_foreach(VALUE key, VALUE value, VALUE out)
{
if (key == Qundef) { return ST_CONTINUE; }
rb_funcall(key, s_to_msgpack, 1, out);
rb_funcall(value, s_to_msgpack, 1, out);
return ST_CONTINUE;
}
static VALUE MessagePack_Hash_to_msgpack(int argc, VALUE *argv, VALUE self)
{
ARG_BUFFER(out, argc, argv);
msgpack_pack_map(out, RHASH_SIZE(self));
rb_hash_foreach(self, MessagePack_Hash_to_msgpack_foreach, out);
return out;
}
static VALUE MessagePack_pack(VALUE self, VALUE data)
{
return rb_funcall(data, s_to_msgpack, 0);
}
void Init_msgpack_pack(VALUE mMessagePack)
{
s_to_msgpack = rb_intern("to_msgpack");
rb_define_method_id(rb_cNilClass, s_to_msgpack, MessagePack_NilClass_to_msgpack, -1);
rb_define_method_id(rb_cTrueClass, s_to_msgpack, MessagePack_TrueClass_to_msgpack, -1);
rb_define_method_id(rb_cFalseClass, s_to_msgpack, MessagePack_FalseClass_to_msgpack, -1);
rb_define_method_id(rb_cFixnum, s_to_msgpack, MessagePack_Fixnum_to_msgpack, -1);
rb_define_method_id(rb_cBignum, s_to_msgpack, MessagePack_Bignum_to_msgpack, -1);
rb_define_method_id(rb_cFloat, s_to_msgpack, MessagePack_Float_to_msgpack, -1);
rb_define_method_id(rb_cString, s_to_msgpack, MessagePack_String_to_msgpack, -1);
rb_define_method_id(rb_cArray, s_to_msgpack, MessagePack_Array_to_msgpack, -1);
rb_define_method_id(rb_cHash, s_to_msgpack, MessagePack_Hash_to_msgpack, -1);
rb_define_module_function(mMessagePack, "pack", MessagePack_pack, 1);
}
-225
View File
@@ -1,225 +0,0 @@
#!/usr/bin/env ruby
require 'msgpack'
require 'test/unit'
class MessagePackTestFormat < Test::Unit::TestCase
def self.it(name, &block)
define_method("test_#{name}", &block)
end
it "nil" do
check 1, nil
end
it "true" do
check 1, true
end
it "false" do
check 1, false
end
it "zero" do
check 1, 0
end
it "positive fixnum" do
check 1, 1
check 1, (1<<6)
check 1, (1<<7)-1
end
it "positive int 8" do
check 1, -1
check 2, (1<<7)
check 2, (1<<8)-1
end
it "positive int 16" do
check 3, (1<<8)
check 3, (1<<16)-1
end
it "positive int 32" do
check 5, (1<<16)
check 5, (1<<32)-1
end
it "positive int 64" do
check 9, (1<<32)
check 9, (1<<64)-1
end
it "negative fixnum" do
check 1, -1
check 1, -((1<<5)-1)
check 1, -(1<<5)
end
it "negative int 8" do
check 2, -((1<<5)+1)
check 2, -(1<<7)
end
it "negative int 16" do
check 3, -((1<<7)+1)
check 3, -(1<<15)
end
it "negative int 32" do
check 5, -((1<<15)+1)
check 5, -(1<<31)
end
it "negative int 64" do
check 9, -((1<<31)+1)
check 9, -(1<<63)
end
it "double" do
check 9, 1.0
check 9, 0.1
check 9, -0.1
check 9, -1.0
end
it "fixraw" do
check_raw 1, 0
check_raw 1, (1<<5)-1
end
it "raw 16" do
check_raw 3, (1<<5)
check_raw 3, (1<<16)-1
end
it "raw 32" do
check_raw 5, (1<<16)
#check_raw 5, (1<<32)-1 # memory error
end
it "fixarray" do
check_array 1, 0
check_array 1, (1<<4)-1
end
it "array 16" do
check_array 3, (1<<4)
check_array 3, (1<<16)-1
end
it "array 32" do
check_array 5, (1<<16)
#check_array 5, (1<<32)-1 # memory error
end
it "nil" do
match nil, "\xc0"
end
it "false" do
match false, "\xc2"
end
it "true" do
match true, "\xc3"
end
it "0" do
match 0, "\x00"
end
it "127" do
match 127, "\x7f"
end
it "128" do
match 128, "\xcc\x80"
end
it "256" do
match 256, "\xcd\x01\x00"
end
it "-1" do
match -1, "\xff"
end
it "-33" do
match -33, "\xd0\xdf"
end
it "-129" do
match -129, "\xd1\xff\x7f"
end
it "{1=>1}" do
match ({1=>1}), "\x81\x01\x01"
end
it "1.0" do
match 1.0, "\xcb\x3f\xf0\x00\x00\x00\x00\x00\x00"
end
it "[]" do
match [], "\x90"
end
it "[0, 1, ..., 14]" do
match (0..14).to_a, "\x9f\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"
end
it "[0, 1, ..., 15]" do
match (0..15).to_a, "\xdc\x00\x10\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"
end
it "{}" do
match ({}), "\x80"
end
it "{0=>0, 1=>1, ..., 14=>14}" do
a = (0..14).to_a;
match Hash[*a.zip(a).flatten], "\x8f\x05\x05\x0b\x0b\x00\x00\x06\x06\x0c\x0c\x01\x01\x07\x07\x0d\x0d\x02\x02\x08\x08\x0e\x0e\x03\x03\x09\x09\x04\x04\x0a\x0a"
end
it "{0=>0, 1=>1, ..., 15=>15}" do
a = (0..15).to_a;
match Hash[*a.zip(a).flatten], "\xde\x00\x10\x05\x05\x0b\x0b\x00\x00\x06\x06\x0c\x0c\x01\x01\x07\x07\x0d\x0d\x02\x02\x08\x08\x0e\x0e\x03\x03\x09\x09\x0f\x0f\x04\x04\x0a\x0a"
end
# it "fixmap" do
# check_map 1, 0
# check_map 1, (1<<4)-1
# end
#
# it "map 16" do
# check_map 3, (1<<4)
# check_map 3, (1<<16)-1
# end
#
# it "map 32" do
# check_map 5, (1<<16)
# #check_map 5, (1<<32)-1 # memory error
# end
private
def check(len, obj)
v = obj.to_msgpack
assert_equal(v.length, len)
assert_equal(MessagePack.unpack(v), obj)
end
def check_raw(overhead, num)
check num+overhead, " "*num
end
def check_array(overhead, num)
check num+overhead, Array.new(num)
end
def match(obj, buf)
assert_equal(obj.to_msgpack, buf)
assert_equal(MessagePack::unpack(buf), obj)
end
end
-122
View File
@@ -1,122 +0,0 @@
require 'msgpack'
@up = MessagePack::Unpacker.new
def check(bytes, should)
puts "----"
@up.reset
src = bytes.pack('C*')
ret = @up.execute(src, 0)
if ret != src.length
puts "** EXTRA BYTES **"
end
puts bytes.map{|x|"%x"%x}.join(' ')
data = @up.data
p data
if data != should
puts "** TEST FAILED **"
p should
end
end
# SimpleValue
check([
0x93, 0xc0, 0xc2, 0xc3,
], [nil,false,true])
# Fixnum
check([
0x92,
0x93, 0x00, 0x40, 0x7f,
0x93, 0xe0, 0xf0, 0xff,
], [[0,64,127], [-32,-16,-1]])
# FixArray
check([
0x92,
0x90,
0x91,
0x91, 0xc0,
], [[],[[nil]]])
# FixRaw
check([
0x94,
0xa0,
0xa1, ?a,
0xa2, ?b, ?c,
0xa3, ?d, ?e, ?f,
], ["","a","bc","def"])
# FixMap
check([
0x82,
0xc2, 0x81,
0xc0, 0xc0,
0xc3, 0x81,
0xc0, 0x80,
], {false=>{nil=>nil}, true=>{nil=>{}}})
# unsigned int
check([
0x99,
0xcc, 0,
0xcc, 128,
0xcc, 255,
0xcd, 0x00, 0x00,
0xcd, 0x80, 0x00,
0xcd, 0xff, 0xff,
0xce, 0x00, 0x00, 0x00, 0x00,
0xce, 0x80, 0x00, 0x00, 0x00,
0xce, 0xff, 0xff, 0xff, 0xff,
], [0, 128, 255, 0, 32768, 65535, 0, 2147483648, 4294967295])
# signed int
check([
0x99,
0xd0, 0,
0xd0, 128,
0xd0, 255,
0xd1, 0x00, 0x00,
0xd1, 0x80, 0x00,
0xd1, 0xff, 0xff,
0xd2, 0x00, 0x00, 0x00, 0x00,
0xd2, 0x80, 0x00, 0x00, 0x00,
0xd2, 0xff, 0xff, 0xff, 0xff,
], [0, -128, -1, 0, -32768, -1, 0, -2147483648, -1])
# raw
check([
0x96,
0xda, 0x00, 0x00,
0xda, 0x00, 0x01, ?a,
0xda, 0x00, 0x02, ?a, ?b,
0xdb, 0x00, 0x00, 0x00, 0x00,
0xdb, 0x00, 0x00, 0x00, 0x01, ?a,
0xdb, 0x00, 0x00, 0x00, 0x02, ?a, ?b,
], ["", "a", "ab", "", "a", "ab"])
# array
check([
0x96,
0xdc, 0x00, 0x00,
0xdc, 0x00, 0x01, 0xc0,
0xdc, 0x00, 0x02, 0xc2, 0xc3,
0xdd, 0x00, 0x00, 0x00, 0x00,
0xdd, 0x00, 0x00, 0x00, 0x01, 0xc0,
0xdd, 0x00, 0x00, 0x00, 0x02, 0xc2, 0xc3
], [[], [nil], [false,true], [], [nil], [false,true]])
# map
check([
0x96,
0xde, 0x00, 0x00,
0xde, 0x00, 0x01, 0xc0, 0xc2,
0xde, 0x00, 0x02, 0xc0, 0xc2, 0xc3, 0xc2,
0xdf, 0x00, 0x00, 0x00, 0x00,
0xdf, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xc2,
0xdf, 0x00, 0x00, 0x00, 0x02, 0xc0, 0xc2, 0xc3, 0xc2,
], [{}, {nil=>false}, {true=>false, nil=>false}, {}, {nil=>false}, {true=>false, nil=>false}])
-58
View File
@@ -1,58 +0,0 @@
require 'msgpack'
def check(data)
puts "---"
pack = data.to_msgpack
p data
puts pack.unpack('C*').map{|x|"%02x"%x}.join(' ')
re = MessagePack::unpack(pack)
if re != data
p re
puts "** TEST FAILED **"
end
end
check 0
check 1
check 127
check 128
check 255
check 256
check 65535
check 65536
check -1
check -32
check -33
check -128
check -129
check -32768
check -32769
check 1.0
check ""
check "a"
check "a"*31
check "a"*32
check nil
check true
check false
check []
check [[]]
check [[], nil]
check( {nil=>0} )
check (1<<23)
__END__
ary = []
i = 0
while i < (1<<16)
ary << i
i += 1
end
check ary
-318
View File
@@ -1,318 +0,0 @@
/*
* MessagePack for Ruby unpacking routine
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ruby.h"
#include "msgpack/unpack_define.h"
typedef struct {
int finished;
VALUE source;
} unpack_user;
#define msgpack_unpack_struct(name) \
struct template ## name
#define msgpack_unpack_func(ret, name) \
ret template ## name
#define msgpack_unpack_callback(name) \
template_callback ## name
#define msgpack_unpack_object VALUE
#define msgpack_unpack_user unpack_user
struct template_context;
typedef struct template_context msgpack_unpack_t;
static void template_init(msgpack_unpack_t* u);
static VALUE template_data(msgpack_unpack_t* u);
static int template_execute(msgpack_unpack_t* u,
const char* data, size_t len, size_t* off);
static inline VALUE template_callback_root(unpack_user* u)
{ return Qnil; }
static inline int template_callback_uint8(unpack_user* u, uint8_t d, VALUE* o)
{ *o = INT2FIX(d); return 0; }
static inline int template_callback_uint16(unpack_user* u, uint16_t d, VALUE* o)
{ *o = INT2FIX(d); return 0; }
static inline int template_callback_uint32(unpack_user* u, uint32_t d, VALUE* o)
{ *o = UINT2NUM(d); return 0; }
static inline int template_callback_uint64(unpack_user* u, uint64_t d, VALUE* o)
{ *o = rb_ull2inum(d); return 0; }
static inline int template_callback_int8(unpack_user* u, int8_t d, VALUE* o)
{ *o = INT2FIX((long)d); return 0; }
static inline int template_callback_int16(unpack_user* u, int16_t d, VALUE* o)
{ *o = INT2FIX((long)d); return 0; }
static inline int template_callback_int32(unpack_user* u, int32_t d, VALUE* o)
{ *o = INT2NUM((long)d); return 0; }
static inline int template_callback_int64(unpack_user* u, int64_t d, VALUE* o)
{ *o = rb_ll2inum(d); return 0; }
static inline int template_callback_float(unpack_user* u, float d, VALUE* o)
{ *o = rb_float_new(d); return 0; }
static inline int template_callback_double(unpack_user* u, double d, VALUE* o)
{ *o = rb_float_new(d); return 0; }
static inline int template_callback_nil(unpack_user* u, VALUE* o)
{ *o = Qnil; return 0; }
static inline int template_callback_true(unpack_user* u, VALUE* o)
{ *o = Qtrue; return 0; }
static inline int template_callback_false(unpack_user* u, VALUE* o)
{ *o = Qfalse; return 0;}
static inline int template_callback_array(unpack_user* u, unsigned int n, VALUE* o)
{ *o = rb_ary_new2(n); return 0; }
static inline int template_callback_array_item(unpack_user* u, VALUE* c, VALUE o)
{ rb_ary_push(*c, o); return 0; } // FIXME set value directry RARRAY_PTR(obj)[RARRAY_LEN(obj)++]
static inline int template_callback_map(unpack_user* u, unsigned int n, VALUE* o)
{ *o = rb_hash_new(); return 0; }
static inline int template_callback_map_item(unpack_user* u, VALUE* c, VALUE k, VALUE v)
{ rb_hash_aset(*c, k, v); return 0; }
static inline int template_callback_raw(unpack_user* u, const char* b, const char* p, unsigned int l, VALUE* o)
{ *o = (l == 0) ? rb_str_new(0,0) : rb_str_substr(u->source, p - b, l); return 0; }
#include "msgpack/unpack_template.h"
#define UNPACKER(from, name) \
msgpack_unpack_t *name = NULL; \
Data_Get_Struct(from, msgpack_unpack_t, name); \
if(name == NULL) { \
rb_raise(rb_eArgError, "NULL found for " # name " when shouldn't be."); \
}
#define CHECK_STRING_TYPE(value) \
value = rb_check_string_type(value); \
if( NIL_P(value) ) { \
rb_raise(rb_eTypeError, "instance of String needed"); \
}
static VALUE cUnpacker;
static VALUE eUnpackError;
static void MessagePack_Unpacker_free(void* data)
{
if(data) { free(data); }
}
static void MessagePack_Unpacker_mark(msgpack_unpack_t *mp)
{
unsigned int i;
for(i=0; i < mp->top; ++i) {
rb_gc_mark(mp->stack[i].obj);
rb_gc_mark(mp->stack[i].map_key);
}
}
static VALUE MessagePack_Unpacker_alloc(VALUE klass)
{
VALUE obj;
msgpack_unpack_t* mp = ALLOC_N(msgpack_unpack_t, 1);
obj = Data_Wrap_Struct(klass, MessagePack_Unpacker_mark,
MessagePack_Unpacker_free, mp);
return obj;
}
static VALUE MessagePack_Unpacker_reset(VALUE self)
{
UNPACKER(self, mp);
template_init(mp);
unpack_user u = {0, Qnil};
mp->user = u;
return self;
}
static VALUE MessagePack_Unpacker_initialize(VALUE self)
{
return MessagePack_Unpacker_reset(self);
}
static VALUE MessagePack_Unpacker_execute_impl(VALUE args)
{
VALUE self = ((VALUE*)args)[0];
VALUE data = ((VALUE*)args)[1];
UNPACKER(self, mp);
size_t from = NUM2UINT(((VALUE*)args)[2]);
char* dptr = RSTRING_PTR(data);
long dlen = FIX2LONG(((VALUE*)args)[3]);
int ret;
if(from >= dlen) {
rb_raise(eUnpackError, "offset is bigger than data buffer size.");
}
mp->user.source = data;
ret = template_execute(mp, dptr, (size_t)dlen, &from);
mp->user.source = Qnil;
if(ret < 0) {
rb_raise(eUnpackError, "parse error.");
} else if(ret > 0) {
mp->user.finished = 1;
return ULONG2NUM(from);
} else {
mp->user.finished = 0;
return ULONG2NUM(from);
}
}
static VALUE MessagePack_Unpacker_execute_rescue(VALUE nouse)
{
rb_gc_enable();
#ifdef RUBY_VM
rb_exc_raise(rb_errinfo());
#else
rb_exc_raise(ruby_errinfo);
#endif
}
static VALUE MessagePack_Unpacker_execute_limit(VALUE self, VALUE data,
VALUE off, VALUE limit)
{
// FIXME execute実行中はmp->topが更新されないのでGC markが機能しない
rb_gc_disable();
VALUE args[4] = {self, data, off, limit};
VALUE ret = rb_rescue(MessagePack_Unpacker_execute_impl, (VALUE)args,
MessagePack_Unpacker_execute_rescue, Qnil);
rb_gc_enable();
return ret;
}
static VALUE MessagePack_Unpacker_execute(VALUE self, VALUE data, VALUE off)
{
return MessagePack_Unpacker_execute_limit(self, data, off,
LONG2FIX(RSTRING_LEN(data)));
}
static VALUE MessagePack_Unpacker_finished_p(VALUE self)
{
UNPACKER(self, mp);
if(mp->user.finished) {
return Qtrue;
}
return Qfalse;
}
static VALUE MessagePack_Unpacker_data(VALUE self)
{
UNPACKER(self, mp);
return template_data(mp);
}
static VALUE MessagePack_unpack_impl(VALUE args)
{
msgpack_unpack_t* mp = (msgpack_unpack_t*)((VALUE*)args)[0];
VALUE data = ((VALUE*)args)[1];
size_t from = 0;
char* dptr = RSTRING_PTR(data);
long dlen = FIX2LONG(((VALUE*)args)[2]);
int ret;
mp->user.source = data;
ret = template_execute(mp, dptr, (size_t)dlen, &from);
mp->user.source = Qnil;
if(ret < 0) {
rb_raise(eUnpackError, "parse error.");
} else if(ret == 0) {
rb_raise(eUnpackError, "insufficient bytes.");
} else {
if(from < dlen) {
rb_raise(eUnpackError, "extra bytes.");
}
return template_data(mp);
}
}
static VALUE MessagePack_unpack_rescue(VALUE args)
{
rb_gc_enable();
#ifdef RUBY_VM
rb_exc_raise(rb_errinfo());
#else
rb_exc_raise(ruby_errinfo);
#endif
}
static VALUE MessagePack_unpack_limit(VALUE self, VALUE data, VALUE limit)
{
CHECK_STRING_TYPE(data);
msgpack_unpack_t mp;
template_init(&mp);
unpack_user u = {0, Qnil};
mp.user = u;
rb_gc_disable();
VALUE args[3] = {(VALUE)&mp, data, limit};
VALUE ret = rb_rescue(MessagePack_unpack_impl, (VALUE)args,
MessagePack_unpack_rescue, Qnil);
rb_gc_enable();
return ret;
}
static VALUE MessagePack_unpack(VALUE self, VALUE data)
{
return MessagePack_unpack_limit(self, data,
LONG2FIX(RSTRING_LEN(data)));
}
void Init_msgpack_unpack(VALUE mMessagePack)
{
eUnpackError = rb_define_class_under(mMessagePack, "UnpackError", rb_eStandardError);
cUnpacker = rb_define_class_under(mMessagePack, "Unpacker", rb_cObject);
rb_define_alloc_func(cUnpacker, MessagePack_Unpacker_alloc);
rb_define_method(cUnpacker, "initialize", MessagePack_Unpacker_initialize, 0);
rb_define_method(cUnpacker, "execute", MessagePack_Unpacker_execute, 2);
rb_define_method(cUnpacker, "execute_limit", MessagePack_Unpacker_execute_limit, 3);
rb_define_method(cUnpacker, "finished?", MessagePack_Unpacker_finished_p, 0);
rb_define_method(cUnpacker, "data", MessagePack_Unpacker_data, 0);
rb_define_method(cUnpacker, "reset", MessagePack_Unpacker_reset, 0);
rb_define_module_function(mMessagePack, "unpack", MessagePack_unpack, 1);
rb_define_module_function(mMessagePack, "unpack_limit", MessagePack_unpack_limit, 2);
}
+108
View File
@@ -0,0 +1,108 @@
lib_LTLIBRARIES = libmsgpack.la
libmsgpack_la_SOURCES = \
unpack.c \
objectc.c \
version.c \
vrefbuffer.c \
zone.c
if ENABLE_CXX
libmsgpack_la_SOURCES += \
object.cpp
endif
if ENABLE_GCC_CXX_ATOMIC
libmsgpack_la_SOURCES += \
gcc_atomic.cpp
endif
# -version-info CURRENT:REVISION:AGE
libmsgpack_la_LDFLAGS = -version-info 3:0:0 -no-undefined
# backward compatibility
lib_LTLIBRARIES += libmsgpackc.la
libmsgpackc_la_SOURCES = \
unpack.c \
objectc.c \
version.c \
vrefbuffer.c \
zone.c
libmsgpackc_la_LDFLAGS = -version-info 2:0:0 -no-undefined
nobase_include_HEADERS = \
msgpack/pack_define.h \
msgpack/pack_template.h \
msgpack/unpack_define.h \
msgpack/unpack_template.h \
msgpack/sysdep.h \
gcc_atomic.h \
msgpack.h \
msgpack/sbuffer.h \
msgpack/version.h \
msgpack/vrefbuffer.h \
msgpack/zbuffer.h \
msgpack/fbuffer.h \
msgpack/pack.h \
msgpack/unpack.h \
msgpack/object.h \
msgpack/zone.h
if ENABLE_CXX
nobase_include_HEADERS += \
msgpack.hpp \
msgpack/sbuffer.hpp \
msgpack/vrefbuffer.hpp \
msgpack/zbuffer.hpp \
msgpack/fbuffer.hpp \
msgpack/pack.hpp \
msgpack/unpack.hpp \
msgpack/object.hpp \
msgpack/zone.hpp \
msgpack/type.hpp \
msgpack/type/bool.hpp \
msgpack/type/deque.hpp \
msgpack/type/float.hpp \
msgpack/type/fixint.hpp \
msgpack/type/int.hpp \
msgpack/type/list.hpp \
msgpack/type/map.hpp \
msgpack/type/nil.hpp \
msgpack/type/pair.hpp \
msgpack/type/raw.hpp \
msgpack/type/set.hpp \
msgpack/type/string.hpp \
msgpack/type/vector.hpp \
msgpack/type/tuple.hpp \
msgpack/type/define.hpp \
msgpack/type/tr1/unordered_map.hpp \
msgpack/type/tr1/unordered_set.hpp
endif
EXTRA_DIST = \
msgpack/version.h.in \
msgpack/zone.hpp.erb \
msgpack/type/define.hpp.erb \
msgpack/type/tuple.hpp.erb
doxygen_c:
cat ../Doxyfile > Doxyfile_c
echo "FILE_PATTERNS = *.h" >> Doxyfile_c
echo "OUTPUT_DIRECTORY = doc_c" >> Doxyfile_c
echo "PROJECT_NAME = \"MessagePack for C\"" >> Doxyfile_c
doxygen Doxyfile_c
doxygen_cpp:
cat ../Doxyfile > Doxyfile_cpp
echo "FILE_PATTERNS = *.hpp" >> Doxyfile_cpp
echo "OUTPUT_DIRECTORY = doc_cpp" >> Doxyfile_cpp
echo "PROJECT_NAME = \"MessagePack for C++\"" >> Doxyfile_cpp
doxygen Doxyfile_cpp
doxygen: doxygen_c doxygen_cpp
+35
View File
@@ -0,0 +1,35 @@
//
// MessagePack for C++ atomic operations
//
// Copyright (C) 2008-2013 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#if defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
#include "gcc_atomic.h"
#include <bits/atomicity.h>
int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr)
{
return __gnu_cxx::__exchange_and_add(ptr, -1) - 1;
}
int _msgpack_sync_incr_and_fetch(volatile _msgpack_atomic_counter_t* ptr)
{
return __gnu_cxx::__exchange_and_add(ptr, 1) + 1;
}
#endif // old gcc workaround
+16 -12
View File
@@ -1,8 +1,4 @@
/*
* MessagePack for Ruby
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -15,15 +11,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "pack.h"
#include "unpack.h"
static VALUE mMessagePack;
#ifndef MSGPACK_GCC_ATOMIC_H__
#define MSGPACK_GCC_ATOMIC_H__
void Init_msgpack(void)
{
mMessagePack = rb_define_module("MessagePack");
Init_msgpack_unpack(mMessagePack);
Init_msgpack_pack(mMessagePack);
#if defined(__cplusplus)
extern "C" {
#endif
typedef int _msgpack_atomic_counter_t;
int _msgpack_sync_decr_and_fetch(volatile _msgpack_atomic_counter_t* ptr);
int _msgpack_sync_incr_and_fetch(volatile _msgpack_atomic_counter_t* ptr);
#if defined(__cplusplus)
}
#endif
#endif // MSGPACK_GCC_ATOMIC_H__
+8
View File
@@ -15,9 +15,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @defgroup msgpack MessagePack C
* @{
* @}
*/
#include "msgpack/object.h"
#include "msgpack/zone.h"
#include "msgpack/pack.h"
#include "msgpack/unpack.h"
#include "msgpack/sbuffer.h"
#include "msgpack/vrefbuffer.h"
#include "msgpack/version.h"
View File
+28 -7
View File
@@ -1,7 +1,7 @@
/*
* MessagePack for Ruby unpacking routine
* MessagePack for C FILE* buffer adaptor
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
* Copyright (C) 2013 Vladimir Volodko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,12 +15,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef UNPACK_H__
#define UNPACK_H__
#ifndef MSGPACK_FBUFFER_H__
#define MSGPACK_FBUFFER_H__
#include "ruby.h"
#include <stdio.h>
void Init_msgpack_unpack(VALUE mMessagePack);
#ifdef __cplusplus
extern "C" {
#endif
#endif /* unpack.h */
/**
* @defgroup msgpack_fbuffer FILE* buffer
* @ingroup msgpack_buffer
* @{
*/
static inline int msgpack_fbuffer_write(void* data, const char* buf, unsigned int len)
{
return (1 == fwrite(buf, len, 1, (FILE *)data)) ? 0 : -1;
}
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* msgpack/fbuffer.h */
+56
View File
@@ -0,0 +1,56 @@
//
// MessagePack for C++ FILE* buffer adaptor
//
// Copyright (C) 2013 Vladimir Volodko
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_FBUFFER_HPP__
#define MSGPACK_FBUFFER_HPP__
#include <cstdio>
#include <stdexcept>
namespace msgpack {
class fbuffer {
public:
explicit fbuffer(FILE* file) : m_file(file) { }
public:
void write(const char* buf, unsigned int len)
{
if (1 != fwrite(buf, len, 1, m_file)) {
throw std::runtime_error("fwrite() failed");
}
}
FILE* file() const
{
return m_file;
}
private:
fbuffer(const fbuffer&);
fbuffer& operator= (const fbuffer&);
private:
FILE* m_file;
};
} // namespace msgpack
#endif /* msgpack/fbuffer.hpp */
+19 -12
View File
@@ -18,10 +18,7 @@
#ifndef MSGPACK_OBJECT_H__
#define MSGPACK_OBJECT_H__
#include "msgpack/zone.h"
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "zone.h"
#include <stdio.h>
#ifdef __cplusplus
@@ -29,15 +26,21 @@ extern "C" {
#endif
/**
* @defgroup msgpack_object Dynamically typed object
* @ingroup msgpack
* @{
*/
typedef enum {
MSGPACK_OBJECT_NIL = 0x01,
MSGPACK_OBJECT_BOOLEAN = 0x02,
MSGPACK_OBJECT_POSITIVE_INTEGER = 0x03,
MSGPACK_OBJECT_NEGATIVE_INTEGER = 0x04,
MSGPACK_OBJECT_DOUBLE = 0x05,
MSGPACK_OBJECT_RAW = 0x06,
MSGPACK_OBJECT_ARRAY = 0x07,
MSGPACK_OBJECT_MAP = 0x08,
MSGPACK_OBJECT_NIL = 0x00,
MSGPACK_OBJECT_BOOLEAN = 0x01,
MSGPACK_OBJECT_POSITIVE_INTEGER = 0x02,
MSGPACK_OBJECT_NEGATIVE_INTEGER = 0x03,
MSGPACK_OBJECT_DOUBLE = 0x04,
MSGPACK_OBJECT_RAW = 0x05,
MSGPACK_OBJECT_ARRAY = 0x06,
MSGPACK_OBJECT_MAP = 0x07,
} msgpack_object_type;
@@ -82,6 +85,10 @@ typedef struct msgpack_object_kv {
void msgpack_object_print(FILE* out, msgpack_object o);
bool msgpack_object_equal(const msgpack_object x, const msgpack_object y);
/** @} */
#ifdef __cplusplus
}
+207 -56
View File
@@ -1,7 +1,7 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
// Copyright (C) 2008-2010 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,9 +18,9 @@
#ifndef MSGPACK_OBJECT_HPP__
#define MSGPACK_OBJECT_HPP__
#include "msgpack/object.h"
#include "msgpack/pack.hpp"
#include <stdint.h>
#include "object.h"
#include "pack.hpp"
#include "zone.hpp"
#include <string.h>
#include <stdexcept>
#include <typeinfo>
@@ -35,14 +35,14 @@ class type_error : public std::bad_cast { };
namespace type {
enum object_type {
NIL = 0x01,
BOOLEAN = 0x02,
POSITIVE_INTEGER = 0x03,
NEGATIVE_INTEGER = 0x04,
DOUBLE = 0x05,
RAW = 0x06,
ARRAY = 0x07,
MAP = 0x08,
NIL = MSGPACK_OBJECT_NIL,
BOOLEAN = MSGPACK_OBJECT_BOOLEAN,
POSITIVE_INTEGER = MSGPACK_OBJECT_POSITIVE_INTEGER,
NEGATIVE_INTEGER = MSGPACK_OBJECT_NEGATIVE_INTEGER,
DOUBLE = MSGPACK_OBJECT_DOUBLE,
RAW = MSGPACK_OBJECT_RAW,
ARRAY = MSGPACK_OBJECT_ARRAY,
MAP = MSGPACK_OBJECT_MAP,
};
}
@@ -89,8 +89,21 @@ struct object {
void convert(T* v) const;
object();
object(msgpack_object obj);
operator msgpack_object();
object(msgpack_object o);
template <typename T>
explicit object(const T& v);
template <typename T>
object(const T& v, zone* z);
template <typename T>
object& operator=(const T& v);
operator msgpack_object() const;
struct with_zone;
private:
struct implicit_type;
@@ -104,18 +117,44 @@ struct object_kv {
object val;
};
struct object::with_zone : object {
with_zone(msgpack::zone* zone) : zone(zone) { }
msgpack::zone* zone;
private:
with_zone();
};
bool operator==(const object x, const object y);
bool operator!=(const object x, const object y);
template <typename T>
bool operator==(const object x, const T& y);
template <typename T>
bool operator==(const T& y, const object x);
template <typename T>
bool operator!=(const object x, const T& y);
template <typename T>
bool operator!=(const T& y, const object x);
std::ostream& operator<< (std::ostream& s, const object o);
// serialize operator
template <typename Stream, typename T>
packer<Stream>& operator<< (packer<Stream>& o, const T& v);
// convert operator
template <typename T>
T& operator>> (object o, T& v);
// deconvert operator
template <typename T>
void operator<< (object::with_zone& o, const T& v);
struct object::implicit_type {
implicit_type(object o) : obj(o) { }
@@ -129,6 +168,7 @@ private:
};
// obsolete
template <typename Type>
class define : public Type {
public:
@@ -172,33 +212,109 @@ inline T& operator>> (object o, T& v)
return v;
}
namespace detail {
template <typename Stream, typename T>
struct packer_serializer {
static packer<Stream>& pack(packer<Stream>& o, const T& v) {
v.msgpack_pack(o);
return o;
}
};
}
template <typename Stream, typename T>
inline packer<Stream>& operator<< (packer<Stream>& o, const T& v)
{
v.msgpack_pack(o);
return o;
return detail::packer_serializer<Stream, T>::pack(o, v);
}
template <typename T>
void operator<< (object::with_zone& o, const T& v)
{
v.msgpack_object(static_cast<object*>(&o), o.zone);
}
template <>
inline void operator<< (object::with_zone& o, const object& v)
{
o.type = v.type;
switch(v.type) {
case type::NIL:
case type::BOOLEAN:
case type::POSITIVE_INTEGER:
case type::NEGATIVE_INTEGER:
case type::DOUBLE:
::memcpy(&o.via, &v.via, sizeof(v.via));
return;
case type::RAW:
o.via.raw.ptr = static_cast<const char*>(o.zone->malloc(v.via.raw.size));
o.via.raw.size = v.via.raw.size;
::memcpy(const_cast<char*>(o.via.raw.ptr), v.via.raw.ptr, v.via.raw.size);
return;
case type::ARRAY:
o.via.array.ptr = static_cast<object*>(o.zone->malloc(sizeof(object) * v.via.array.size));
o.via.array.size = v.via.array.size;
for(object* po(o.via.array.ptr), * pv(v.via.array.ptr),
* const pvend(v.via.array.ptr + v.via.array.size);
pv < pvend; ++po, ++pv) {
new (po) object(*pv, o.zone);
}
return;
case type::MAP:
o.via.map.ptr = static_cast<object_kv*>(o.zone->malloc(sizeof(object_kv) * v.via.map.size));
o.via.map.size = v.via.map.size;
for(object_kv* po(o.via.map.ptr), * pv(v.via.map.ptr),
* const pvend(v.via.map.ptr + v.via.map.size);
pv < pvend; ++po, ++pv) {
object_kv* kv = new (po) object_kv;
new (&kv->key) object(pv->key, o.zone);
new (&kv->val) object(pv->val, o.zone);
}
return;
default:
throw type_error();
}
}
template <>
inline void operator<< (object::with_zone& o, const object::with_zone& v)
{
return o << static_cast<object>(v);
}
inline bool operator==(const object x, const object y)
{
return msgpack_object_equal(x, y);
}
template <typename T>
inline bool operator==(const object x, const T& y)
try {
return x == object(y);
} catch (msgpack::type_error&) {
return false;
}
inline bool operator!=(const object x, const object y)
{ return !(x == y); }
template <typename T>
inline bool operator==(const T& y, const object x)
{ return x == y; }
inline object::object() { }
template <typename T>
inline bool operator!=(const object x, const T& y)
{ return !(x == y); }
inline object::object(msgpack_object obj)
{
// FIXME beter way?
::memcpy(this, &obj, sizeof(obj));
}
inline object::operator msgpack_object()
{
// FIXME beter way?
msgpack_object obj;
::memcpy(&obj, this, sizeof(obj));
return obj;
}
template <typename T>
inline bool operator!=(const T& y, const object x)
{ return x != y; }
inline object::implicit_type object::convert() const
@@ -221,6 +337,55 @@ inline T object::as() const
}
inline object::object()
{
type = type::NIL;
}
template <typename T>
inline object::object(const T& v)
{
*this << v;
}
template <typename T>
inline object& object::operator=(const T& v)
{
*this = object(v);
return *this;
}
template <typename T>
object::object(const T& v, zone* z)
{
with_zone oz(z);
oz << v;
type = oz.type;
via = oz.via;
}
inline object::object(msgpack_object o)
{
// FIXME beter way?
::memcpy(this, &o, sizeof(o));
}
inline void operator<< (object& o, msgpack_object v)
{
// FIXME beter way?
::memcpy(&o, &v, sizeof(v));
}
inline object::operator msgpack_object() const
{
// FIXME beter way?
msgpack_object obj;
::memcpy(&obj, this, sizeof(obj));
return obj;
}
// obsolete
template <typename T>
inline void convert(T& v, object o)
@@ -260,35 +425,15 @@ packer<Stream>& operator<< (packer<Stream>& o, const object& v)
return o;
case type::POSITIVE_INTEGER:
if(v.via.u64 <= (uint64_t)std::numeric_limits<uint16_t>::max()) {
if(v.via.u64 <= (uint16_t)std::numeric_limits<uint8_t>::max()) {
o.pack_uint8(v.via.u64);
} else {
o.pack_uint16(v.via.u64);
}
} else {
if(v.via.u64 <= (uint64_t)std::numeric_limits<uint32_t>::max()) {
o.pack_uint32(v.via.u64);
} else {
o.pack_uint64(v.via.u64);
}
}
o.pack_uint64(v.via.u64);
return o;
case type::NEGATIVE_INTEGER:
if(v.via.i64 >= (int64_t)std::numeric_limits<int16_t>::min()) {
if(v.via.i64 >= (int64_t)std::numeric_limits<int8_t>::min()) {
o.pack_int8(v.via.i64);
} else {
o.pack_int16(v.via.i64);
}
} else {
if(v.via.i64 >= (int64_t)std::numeric_limits<int32_t>::min()) {
o.pack_int64(v.via.i64);
} else {
o.pack_int64(v.via.i64);
}
}
o.pack_int64(v.via.i64);
return o;
case type::DOUBLE:
o.pack_double(v.via.dec);
return o;
case type::RAW:
@@ -320,6 +465,12 @@ packer<Stream>& operator<< (packer<Stream>& o, const object& v)
}
}
template <typename Stream>
packer<Stream>& operator<< (packer<Stream>& o, const object::with_zone& v)
{
return o << static_cast<object>(v);
}
} // namespace msgpack
+37 -8
View File
@@ -18,18 +18,29 @@
#ifndef MSGPACK_PACK_H__
#define MSGPACK_PACK_H__
#include <stddef.h>
#include <stdint.h>
#include "pack_define.h"
#include "object.h"
#include <stdlib.h>
#include "msgpack/pack_define.h"
#include "msgpack/object.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int (*msgpack_packer_write)(void* data, const char* buf, unsigned int len);
/**
* @defgroup msgpack_buffer Buffers
* @ingroup msgpack
* @{
* @}
*/
/**
* @defgroup msgpack_pack Serializer
* @ingroup msgpack
* @{
*/
typedef int (*msgpack_packer_write)(void* data, const char* buf, size_t len);
typedef struct msgpack_packer {
void* data;
@@ -41,10 +52,14 @@ static void msgpack_packer_init(msgpack_packer* pk, void* data, msgpack_packer_w
static msgpack_packer* msgpack_packer_new(void* data, msgpack_packer_write callback);
static void msgpack_packer_free(msgpack_packer* pk);
static int msgpack_pack_char(msgpack_packer* pk, char d);
static int msgpack_pack_signed_char(msgpack_packer* pk, signed char d);
static int msgpack_pack_short(msgpack_packer* pk, short d);
static int msgpack_pack_int(msgpack_packer* pk, int d);
static int msgpack_pack_long(msgpack_packer* pk, long d);
static int msgpack_pack_long_long(msgpack_packer* pk, long long d);
static int msgpack_pack_unsigned_char(msgpack_packer* pk, unsigned char d);
static int msgpack_pack_unsigned_short(msgpack_packer* pk, unsigned short d);
static int msgpack_pack_unsigned_int(msgpack_packer* pk, unsigned int d);
static int msgpack_pack_unsigned_long(msgpack_packer* pk, unsigned long d);
@@ -59,6 +74,15 @@ static int msgpack_pack_int16(msgpack_packer* pk, int16_t d);
static int msgpack_pack_int32(msgpack_packer* pk, int32_t d);
static int msgpack_pack_int64(msgpack_packer* pk, int64_t d);
static int msgpack_pack_fix_uint8(msgpack_packer* pk, uint8_t d);
static int msgpack_pack_fix_uint16(msgpack_packer* pk, uint16_t d);
static int msgpack_pack_fix_uint32(msgpack_packer* pk, uint32_t d);
static int msgpack_pack_fix_uint64(msgpack_packer* pk, uint64_t d);
static int msgpack_pack_fix_int8(msgpack_packer* pk, int8_t d);
static int msgpack_pack_fix_int16(msgpack_packer* pk, int16_t d);
static int msgpack_pack_fix_int32(msgpack_packer* pk, int32_t d);
static int msgpack_pack_fix_int64(msgpack_packer* pk, int64_t d);
static int msgpack_pack_float(msgpack_packer* pk, float d);
static int msgpack_pack_double(msgpack_packer* pk, double d);
@@ -66,9 +90,9 @@ static int msgpack_pack_nil(msgpack_packer* pk);
static int msgpack_pack_true(msgpack_packer* pk);
static int msgpack_pack_false(msgpack_packer* pk);
static int msgpack_pack_array(msgpack_packer* pk, unsigned int n);
static int msgpack_pack_array(msgpack_packer* pk, size_t n);
static int msgpack_pack_map(msgpack_packer* pk, unsigned int n);
static int msgpack_pack_map(msgpack_packer* pk, size_t n);
static int msgpack_pack_raw(msgpack_packer* pk, size_t l);
static int msgpack_pack_raw_body(msgpack_packer* pk, const void* b, size_t l);
@@ -76,6 +100,8 @@ static int msgpack_pack_raw_body(msgpack_packer* pk, const void* b, size_t l);
int msgpack_pack_object(msgpack_packer* pk, msgpack_object d);
/** @} */
#define msgpack_pack_inline_func(name) \
inline int msgpack_pack ## name
@@ -83,12 +109,15 @@ int msgpack_pack_object(msgpack_packer* pk, msgpack_object d);
#define msgpack_pack_inline_func_cint(name) \
inline int msgpack_pack ## name
#define msgpack_pack_inline_func_fixint(name) \
inline int msgpack_pack_fix ## name
#define msgpack_pack_user msgpack_packer*
#define msgpack_pack_append_buffer(user, buf, len) \
return (*(user)->callback)((user)->data, (const char*)buf, len)
#include "msgpack/pack_template.h"
#include "pack_template.h"
inline void msgpack_packer_init(msgpack_packer* pk, void* data, msgpack_packer_write callback)
{
+105 -21
View File
@@ -1,7 +1,7 @@
//
// MessagePack for C++ serializing routine
//
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
// Copyright (C) 2008-2010 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -18,10 +18,9 @@
#ifndef MSGPACK_PACK_HPP__
#define MSGPACK_PACK_HPP__
#include <arpa/inet.h> // __BYTE_ORDER
#include "pack_define.h"
#include <stdexcept>
#include <limits.h>
#include "msgpack/pack_define.h"
namespace msgpack {
@@ -29,6 +28,7 @@ namespace msgpack {
template <typename Stream>
class packer {
public:
packer(Stream* s);
packer(Stream& s);
~packer();
@@ -40,15 +40,27 @@ public:
packer<Stream>& pack_uint16(uint16_t d);
packer<Stream>& pack_uint32(uint32_t d);
packer<Stream>& pack_uint64(uint64_t d);
packer<Stream>& pack_int8(uint8_t d);
packer<Stream>& pack_int16(uint16_t d);
packer<Stream>& pack_int32(uint32_t d);
packer<Stream>& pack_int64(uint64_t d);
packer<Stream>& pack_int8(int8_t d);
packer<Stream>& pack_int16(int16_t d);
packer<Stream>& pack_int32(int32_t d);
packer<Stream>& pack_int64(int64_t d);
packer<Stream>& pack_short(int d);
packer<Stream>& pack_fix_uint8(uint8_t d);
packer<Stream>& pack_fix_uint16(uint16_t d);
packer<Stream>& pack_fix_uint32(uint32_t d);
packer<Stream>& pack_fix_uint64(uint64_t d);
packer<Stream>& pack_fix_int8(int8_t d);
packer<Stream>& pack_fix_int16(int16_t d);
packer<Stream>& pack_fix_int32(int32_t d);
packer<Stream>& pack_fix_int64(int64_t d);
packer<Stream>& pack_char(char d);
packer<Stream>& pack_signed_char(signed char d);
packer<Stream>& pack_short(short d);
packer<Stream>& pack_int(int d);
packer<Stream>& pack_long(long d);
packer<Stream>& pack_long_long(long long d);
packer<Stream>& pack_unsigned_char(unsigned char d);
packer<Stream>& pack_unsigned_short(unsigned short d);
packer<Stream>& pack_unsigned_int(unsigned int d);
packer<Stream>& pack_unsigned_long(unsigned long d);
@@ -61,9 +73,9 @@ public:
packer<Stream>& pack_true();
packer<Stream>& pack_false();
packer<Stream>& pack_array(unsigned int n);
packer<Stream>& pack_array(size_t n);
packer<Stream>& pack_map(unsigned int n);
packer<Stream>& pack_map(size_t n);
packer<Stream>& pack_raw(size_t l);
packer<Stream>& pack_raw_body(const char* b, size_t l);
@@ -78,10 +90,23 @@ private:
static void _pack_int32(Stream& x, int32_t d);
static void _pack_int64(Stream& x, int64_t d);
static void _pack_fix_uint8(Stream& x, uint8_t d);
static void _pack_fix_uint16(Stream& x, uint16_t d);
static void _pack_fix_uint32(Stream& x, uint32_t d);
static void _pack_fix_uint64(Stream& x, uint64_t d);
static void _pack_fix_int8(Stream& x, int8_t d);
static void _pack_fix_int16(Stream& x, int16_t d);
static void _pack_fix_int32(Stream& x, int32_t d);
static void _pack_fix_int64(Stream& x, int64_t d);
static void _pack_char(Stream& x, char d);
static void _pack_signed_char(Stream& x, signed char d);
static void _pack_short(Stream& x, short d);
static void _pack_int(Stream& x, int d);
static void _pack_long(Stream& x, long d);
static void _pack_long_long(Stream& x, long long d);
static void _pack_unsigned_char(Stream& x, unsigned char d);
static void _pack_unsigned_short(Stream& x, unsigned short d);
static void _pack_unsigned_int(Stream& x, unsigned int d);
static void _pack_unsigned_long(Stream& x, unsigned long d);
@@ -94,14 +119,14 @@ private:
static void _pack_true(Stream& x);
static void _pack_false(Stream& x);
static void _pack_array(Stream& x, unsigned int n);
static void _pack_array(Stream& x, size_t n);
static void _pack_map(Stream& x, unsigned int n);
static void _pack_map(Stream& x, size_t n);
static void _pack_raw(Stream& x, size_t l);
static void _pack_raw_body(Stream& x, const void* b, size_t l);
static void append_buffer(Stream& x, const unsigned char* buf, unsigned int len)
static void append_buffer(Stream& x, const unsigned char* buf, size_t len)
{ x.write((const char*)buf, len); }
private:
@@ -112,6 +137,12 @@ private:
};
template <typename Stream, typename T>
inline void pack(Stream* s, const T& v)
{
packer<Stream>(s).pack(v);
}
template <typename Stream, typename T>
inline void pack(Stream& s, const T& v)
{
@@ -127,19 +158,27 @@ inline void pack(Stream& s, const T& v)
template <typename Stream> \
inline void packer<Stream>::_pack ## name
#define msgpack_pack_inline_func_fixint(name) \
template <typename Stream> \
inline void packer<Stream>::_pack_fix ## name
#define msgpack_pack_user Stream&
#define msgpack_pack_append_buffer append_buffer
#include "msgpack/pack_template.h"
#include "pack_template.h"
template <typename Stream>
packer<Stream>::packer(Stream* s) : m_stream(*s) { }
template <typename Stream>
packer<Stream>::packer(Stream& s) : m_stream(s) { }
template <typename Stream>
packer<Stream>::~packer() { }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_uint8(uint8_t d)
{ _pack_uint8(m_stream, d); return *this; }
@@ -157,24 +196,65 @@ inline packer<Stream>& packer<Stream>::pack_uint64(uint64_t d)
{ _pack_uint64(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_int8(uint8_t d)
inline packer<Stream>& packer<Stream>::pack_int8(int8_t d)
{ _pack_int8(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_int16(uint16_t d)
inline packer<Stream>& packer<Stream>::pack_int16(int16_t d)
{ _pack_int16(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_int32(uint32_t d)
inline packer<Stream>& packer<Stream>::pack_int32(int32_t d)
{ _pack_int32(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_int64(uint64_t d)
inline packer<Stream>& packer<Stream>::pack_int64(int64_t d)
{ _pack_int64(m_stream, d); return *this;}
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_short(int d)
inline packer<Stream>& packer<Stream>::pack_fix_uint8(uint8_t d)
{ _pack_fix_uint8(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_uint16(uint16_t d)
{ _pack_fix_uint16(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_uint32(uint32_t d)
{ _pack_fix_uint32(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_uint64(uint64_t d)
{ _pack_fix_uint64(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_int8(int8_t d)
{ _pack_fix_int8(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_int16(int16_t d)
{ _pack_fix_int16(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_int32(int32_t d)
{ _pack_fix_int32(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_fix_int64(int64_t d)
{ _pack_fix_int64(m_stream, d); return *this;}
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_char(char d)
{ _pack_char(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_signed_char(signed char d)
{ _pack_signed_char(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_short(short d)
{ _pack_short(m_stream, d); return *this; }
template <typename Stream>
@@ -189,6 +269,10 @@ template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_long_long(long long d)
{ _pack_long_long(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_unsigned_char(unsigned char d)
{ _pack_unsigned_char(m_stream, d); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_unsigned_short(unsigned short d)
{ _pack_unsigned_short(m_stream, d); return *this; }
@@ -229,12 +313,12 @@ inline packer<Stream>& packer<Stream>::pack_false()
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_array(unsigned int n)
inline packer<Stream>& packer<Stream>::pack_array(size_t n)
{ _pack_array(m_stream, n); return *this; }
template <typename Stream>
inline packer<Stream>& packer<Stream>::pack_map(unsigned int n)
inline packer<Stream>& packer<Stream>::pack_map(size_t n)
{ _pack_map(m_stream, n); return *this; }
@@ -1,7 +1,7 @@
/*
* MessagePack unpacking routine template
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
* Copyright (C) 2008-2010 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,9 @@
#ifndef MSGPACK_PACK_DEFINE_H__
#define MSGPACK_PACK_DEFINE_H__
#include <stddef.h>
#include <stdint.h>
#include "msgpack/sysdep.h"
#include <limits.h>
#include <string.h>
#endif /* msgpack/pack_define.h */
@@ -1,7 +1,7 @@
/*
* MessagePack packing routine template
*
* Copyright (C) 2008-2009 FURUHASHI Sadayuki
* Copyright (C) 2008-2010 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,88 +16,16 @@
* limitations under the License.
*/
#if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define __LITTLE_ENDIAN__
#elif __BYTE_ORDER == __BIG_ENDIAN
#define __BIG_ENDIAN__
#endif
#endif
#ifdef __LITTLE_ENDIAN__
#define STORE8_BE8(d) \
((uint8_t*)&d)[0]
#define STORE16_BE8(d) \
((uint8_t*)&d)[0]
#define STORE16_BE16(d) \
((uint8_t*)&d)[1], ((uint8_t*)&d)[0]
#define STORE32_BE8(d) \
((uint8_t*)&d)[0]
#define STORE32_BE16(d) \
((uint8_t*)&d)[1], ((uint8_t*)&d)[0]
#define STORE32_BE32(d) \
((uint8_t*)&d)[3], ((uint8_t*)&d)[2], ((uint8_t*)&d)[1], ((uint8_t*)&d)[0]
#define STORE64_BE8(d) \
((uint8_t*)&d)[0]
#define STORE64_BE16(d) \
((uint8_t*)&d)[1], ((uint8_t*)&d)[0]
#define STORE64_BE32(d) \
((uint8_t*)&d)[3], ((uint8_t*)&d)[2], ((uint8_t*)&d)[1], ((uint8_t*)&d)[0]
#define STORE64_BE64(d) \
((uint8_t*)&d)[7], ((uint8_t*)&d)[6], ((uint8_t*)&d)[5], ((uint8_t*)&d)[4], \
((uint8_t*)&d)[3], ((uint8_t*)&d)[2], ((uint8_t*)&d)[1], ((uint8_t*)&d)[0]
#elif __BIG_ENDIAN__
#define STORE8_BE8(d) \
((uint8_t*)&d)[0]
#define STORE16_BE8(d) \
((uint8_t*)&d)[1]
#define STORE16_BE16(d) \
((uint8_t*)&d)[0], ((uint8_t*)&d)[1]
#define STORE32_BE8(d) \
((uint8_t*)&d)[3]
#define STORE32_BE16(d) \
((uint8_t*)&d)[2], ((uint8_t*)&d)[3]
#define STORE32_BE32(d) \
((uint8_t*)&d)[0], ((uint8_t*)&d)[1], ((uint8_t*)&d)[2], ((uint8_t*)&d)[3]
#define STORE64_BE8(d) \
((uint8_t*)&d)[7]
#define STORE64_BE16(d) \
((uint8_t*)&d)[6], ((uint8_t*)&d)[7]
#define STORE64_BE32(d) \
((uint8_t*)&d)[4], ((uint8_t*)&d)[5], ((uint8_t*)&d)[6], ((uint8_t*)&d)[7]
#define STORE64_BE64(d) \
((uint8_t*)&d)[0], ((uint8_t*)&d)[1], ((uint8_t*)&d)[2], ((uint8_t*)&d)[3], \
((uint8_t*)&d)[4], ((uint8_t*)&d)[5], ((uint8_t*)&d)[6], ((uint8_t*)&d)[7]
#if defined(__LITTLE_ENDIAN__)
#define TAKE8_8(d) ((uint8_t*)&d)[0]
#define TAKE8_16(d) ((uint8_t*)&d)[0]
#define TAKE8_32(d) ((uint8_t*)&d)[0]
#define TAKE8_64(d) ((uint8_t*)&d)[0]
#elif defined(__BIG_ENDIAN__)
#define TAKE8_8(d) ((uint8_t*)&d)[0]
#define TAKE8_16(d) ((uint8_t*)&d)[1]
#define TAKE8_32(d) ((uint8_t*)&d)[3]
#define TAKE8_64(d) ((uint8_t*)&d)[7]
#endif
#ifndef msgpack_pack_inline_func
@@ -121,10 +49,10 @@
do { \
if(d < (1<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE8_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1); \
} else { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE8_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_8(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} \
} while(0)
@@ -133,14 +61,15 @@ do { \
do { \
if(d < (1<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE16_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_16(d), 1); \
} else if(d < (1<<8)) { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE16_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_16(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} else { \
/* unsigned 16 */ \
const unsigned char buf[3] = {0xcd, STORE16_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xcd; _msgpack_store16(&buf[1], (uint16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} \
} while(0)
@@ -150,20 +79,22 @@ do { \
if(d < (1<<8)) { \
if(d < (1<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE32_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_32(d), 1); \
} else { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE32_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_32(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} \
} else { \
if(d < (1<<16)) { \
/* unsigned 16 */ \
const unsigned char buf[3] = {0xcd, STORE32_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xcd; _msgpack_store16(&buf[1], (uint16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} else { \
/* unsigned 32 */ \
const unsigned char buf[5] = {0xce, STORE32_BE32(d)}; \
unsigned char buf[5]; \
buf[0] = 0xce; _msgpack_store32(&buf[1], (uint32_t)d); \
msgpack_pack_append_buffer(x, buf, 5); \
} \
} \
@@ -172,26 +103,29 @@ do { \
#define msgpack_pack_real_uint64(x, d) \
do { \
if(d < (1ULL<<8)) { \
if(d < (1<<7)) { \
if(d < (1ULL<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE64_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_64(d), 1); \
} else { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE64_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_64(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} \
} else { \
if(d < (1ULL<<16)) { \
/* signed 16 */ \
const unsigned char buf[3] = {0xcd, STORE64_BE16(d)}; \
/* unsigned 16 */ \
unsigned char buf[3]; \
buf[0] = 0xcd; _msgpack_store16(&buf[1], (uint16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} else if(d < (1ULL<<32)) { \
/* signed 32 */ \
const unsigned char buf[5] = {0xce, STORE64_BE32(d)}; \
/* unsigned 32 */ \
unsigned char buf[5]; \
buf[0] = 0xce; _msgpack_store32(&buf[1], (uint32_t)d); \
msgpack_pack_append_buffer(x, buf, 5); \
} else { \
/* signed 64 */ \
const unsigned char buf[9] = {0xcf, STORE64_BE64(d)}; \
/* unsigned 64 */ \
unsigned char buf[9]; \
buf[0] = 0xcf; _msgpack_store64(&buf[1], d); \
msgpack_pack_append_buffer(x, buf, 9); \
} \
} \
@@ -201,11 +135,11 @@ do { \
do { \
if(d < -(1<<5)) { \
/* signed 8 */ \
const unsigned char buf[2] = {0xd0, STORE8_BE8(d)}; \
unsigned char buf[2] = {0xd0, TAKE8_8(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} else { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE8_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1); \
} \
} while(0)
@@ -214,24 +148,26 @@ do { \
if(d < -(1<<5)) { \
if(d < -(1<<7)) { \
/* signed 16 */ \
const unsigned char buf[3] = {0xd1, STORE16_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xd1; _msgpack_store16(&buf[1], (int16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} else { \
/* signed 8 */ \
const unsigned char buf[2] = {0xd0, STORE16_BE8(d)}; \
unsigned char buf[2] = {0xd0, TAKE8_16(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} \
} else if(d < (1<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE16_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_16(d), 1); \
} else { \
if(d < (1<<8)) { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE16_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_16(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} else { \
/* unsigned 16 */ \
const unsigned char buf[3] = {0xcd, STORE16_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xcd; _msgpack_store16(&buf[1], (uint16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} \
} \
@@ -242,32 +178,36 @@ do { \
if(d < -(1<<5)) { \
if(d < -(1<<15)) { \
/* signed 32 */ \
const unsigned char buf[5] = {0xd2, STORE32_BE32(d)}; \
unsigned char buf[5]; \
buf[0] = 0xd2; _msgpack_store32(&buf[1], (int32_t)d); \
msgpack_pack_append_buffer(x, buf, 5); \
} else if(d < -(1<<7)) { \
/* signed 16 */ \
const unsigned char buf[3] = {0xd1, STORE32_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xd1; _msgpack_store16(&buf[1], (int16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} else { \
/* signed 8 */ \
const unsigned char buf[2] = {0xd0, STORE32_BE8(d)}; \
unsigned char buf[2] = {0xd0, TAKE8_32(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} \
} else if(d < (1<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE32_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_32(d), 1); \
} else { \
if(d < (1<<8)) { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE32_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_32(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} else if(d < (1<<16)) { \
/* unsigned 16 */ \
const unsigned char buf[3] = {0xcd, STORE32_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xcd; _msgpack_store16(&buf[1], (uint16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} else { \
/* unsigned 32 */ \
const unsigned char buf[5] = {0xce, STORE32_BE32(d)}; \
unsigned char buf[5]; \
buf[0] = 0xce; _msgpack_store32(&buf[1], (uint32_t)d); \
msgpack_pack_append_buffer(x, buf, 5); \
} \
} \
@@ -279,46 +219,52 @@ do { \
if(d < -(1LL<<15)) { \
if(d < -(1LL<<31)) { \
/* signed 64 */ \
const unsigned char buf[9] = {0xd3, STORE64_BE64(d)}; \
unsigned char buf[9]; \
buf[0] = 0xd3; _msgpack_store64(&buf[1], d); \
msgpack_pack_append_buffer(x, buf, 9); \
} else { \
/* signed 32 */ \
const unsigned char buf[5] = {0xd2, STORE64_BE32(d)}; \
unsigned char buf[5]; \
buf[0] = 0xd2; _msgpack_store32(&buf[1], (int32_t)d); \
msgpack_pack_append_buffer(x, buf, 5); \
} \
} else { \
if(d < -(1<<7)) { \
/* signed 16 */ \
const unsigned char buf[3] = {0xd1, STORE64_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xd1; _msgpack_store16(&buf[1], (int16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} else { \
/* signed 8 */ \
const unsigned char buf[2] = {0xd0, STORE64_BE8(d)}; \
unsigned char buf[2] = {0xd0, TAKE8_64(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} \
} \
} else if(d < (1<<7)) { \
/* fixnum */ \
msgpack_pack_append_buffer(x, &STORE64_BE8(d), 1); \
msgpack_pack_append_buffer(x, &TAKE8_64(d), 1); \
} else { \
if(d < (1LL<<16)) { \
if(d < (1<<8)) { \
/* unsigned 8 */ \
const unsigned char buf[2] = {0xcc, STORE64_BE8(d)}; \
unsigned char buf[2] = {0xcc, TAKE8_64(d)}; \
msgpack_pack_append_buffer(x, buf, 2); \
} else { \
/* unsigned 16 */ \
const unsigned char buf[3] = {0xcd, STORE64_BE16(d)}; \
unsigned char buf[3]; \
buf[0] = 0xcd; _msgpack_store16(&buf[1], (uint16_t)d); \
msgpack_pack_append_buffer(x, buf, 3); \
} \
} else { \
if(d < (1LL<<32)) { \
/* unsigned 32 */ \
const unsigned char buf[5] = {0xce, STORE64_BE32(d)}; \
unsigned char buf[5]; \
buf[0] = 0xce; _msgpack_store32(&buf[1], (uint32_t)d); \
msgpack_pack_append_buffer(x, buf, 5); \
} else { \
/* unsigned 64 */ \
const unsigned char buf[9] = {0xcf, STORE64_BE64(d)}; \
unsigned char buf[9]; \
buf[0] = 0xcf; _msgpack_store64(&buf[1], d); \
msgpack_pack_append_buffer(x, buf, 9); \
} \
} \
@@ -326,57 +272,63 @@ do { \
} while(0)
#ifdef msgpack_pack_inline_func_fastint
#ifdef msgpack_pack_inline_func_fixint
msgpack_pack_inline_func_fastint(_uint8)(msgpack_pack_user x, uint8_t d)
msgpack_pack_inline_func_fixint(_uint8)(msgpack_pack_user x, uint8_t d)
{
const unsigned char buf[2] = {0xcc, STORE8_BE8(d)};
unsigned char buf[2] = {0xcc, TAKE8_8(d)};
msgpack_pack_append_buffer(x, buf, 2);
}
msgpack_pack_inline_func_fastint(_uint16)(msgpack_pack_user x, uint16_t d)
msgpack_pack_inline_func_fixint(_uint16)(msgpack_pack_user x, uint16_t d)
{
const unsigned char buf[3] = {0xcd, STORE16_BE16(d)};
unsigned char buf[3];
buf[0] = 0xcd; _msgpack_store16(&buf[1], d);
msgpack_pack_append_buffer(x, buf, 3);
}
msgpack_pack_inline_func_fastint(_uint32)(msgpack_pack_user x, uint32_t d)
msgpack_pack_inline_func_fixint(_uint32)(msgpack_pack_user x, uint32_t d)
{
const unsigned char buf[5] = {0xce, STORE32_BE32(d)};
unsigned char buf[5];
buf[0] = 0xce; _msgpack_store32(&buf[1], d);
msgpack_pack_append_buffer(x, buf, 5);
}
msgpack_pack_inline_func_fastint(_uint64)(msgpack_pack_user x, uint64_t d)
msgpack_pack_inline_func_fixint(_uint64)(msgpack_pack_user x, uint64_t d)
{
const unsigned char buf[9] = {0xcf, STORE64_BE64(d)};
unsigned char buf[9];
buf[0] = 0xcf; _msgpack_store64(&buf[1], d);
msgpack_pack_append_buffer(x, buf, 9);
}
msgpack_pack_inline_func_fastint(_int8)(msgpack_pack_user x, int8_t d)
msgpack_pack_inline_func_fixint(_int8)(msgpack_pack_user x, int8_t d)
{
const unsigned char buf[2] = {0xd0, STORE8_BE8(d)};
unsigned char buf[2] = {0xd0, TAKE8_8(d)};
msgpack_pack_append_buffer(x, buf, 2);
}
msgpack_pack_inline_func_fastint(_int16)(msgpack_pack_user x, int16_t d)
msgpack_pack_inline_func_fixint(_int16)(msgpack_pack_user x, int16_t d)
{
const unsigned char buf[3] = {0xd1, STORE16_BE16(d)};
unsigned char buf[3];
buf[0] = 0xd1; _msgpack_store16(&buf[1], d);
msgpack_pack_append_buffer(x, buf, 3);
}
msgpack_pack_inline_func_fastint(_int32)(msgpack_pack_user x, int32_t d)
msgpack_pack_inline_func_fixint(_int32)(msgpack_pack_user x, int32_t d)
{
const unsigned char buf[5] = {0xd2, STORE32_BE32(d)};
unsigned char buf[5];
buf[0] = 0xd2; _msgpack_store32(&buf[1], d);
msgpack_pack_append_buffer(x, buf, 5);
}
msgpack_pack_inline_func_fastint(_int64)(msgpack_pack_user x, int64_t d)
msgpack_pack_inline_func_fixint(_int64)(msgpack_pack_user x, int64_t d)
{
const unsigned char buf[9] = {0xd3, STORE64_BE64(d)};
unsigned char buf[9];
buf[0] = 0xd3; _msgpack_store64(&buf[1], d);
msgpack_pack_append_buffer(x, buf, 9);
}
#undef msgpack_pack_inline_func_fastint
#undef msgpack_pack_inline_func_fixint
#endif
@@ -420,19 +372,51 @@ msgpack_pack_inline_func(_int64)(msgpack_pack_user x, int64_t d)
msgpack_pack_real_int64(x, d);
}
msgpack_pack_inline_func(_char)(msgpack_pack_user x, char d)
{
#if defined(CHAR_MIN)
#if CHAR_MIN < 0
msgpack_pack_real_int8(x, d);
#else
msgpack_pack_real_uint8(x, d);
#endif
#else
#error CHAR_MIN is not defined
#endif
}
msgpack_pack_inline_func(_signed_char)(msgpack_pack_user x, signed char d)
{
msgpack_pack_real_int8(x, d);
}
msgpack_pack_inline_func(_unsigned_char)(msgpack_pack_user x, unsigned char d)
{
msgpack_pack_real_uint8(x, d);
}
#ifdef msgpack_pack_inline_func_cint
msgpack_pack_inline_func_cint(_short)(msgpack_pack_user x, short d)
{
#if defined(SIZEOF_SHORT) || defined(SHRT_MAX)
#if SIZEOF_SHORT == 2 || SHRT_MAX == 0x7fff
#if defined(SIZEOF_SHORT)
#if SIZEOF_SHORT == 2
msgpack_pack_real_int16(x, d);
#elif SIZEOF_SHORT == 4 || SHRT_MAX == 0x7fffffff
#elif SIZEOF_SHORT == 4
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#elif defined(SHRT_MAX)
#if SHRT_MAX == 0x7fff
msgpack_pack_real_int16(x, d);
#elif SHRT_MAX == 0x7fffffff
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#else
if(sizeof(short) == 2) {
msgpack_pack_real_int16(x, d);
@@ -446,14 +430,24 @@ if(sizeof(short) == 2) {
msgpack_pack_inline_func_cint(_int)(msgpack_pack_user x, int d)
{
#if defined(SIZEOF_INT) || defined(INT_MAX)
#if SIZEOF_INT == 2 || INT_MAX == 0x7fff
#if defined(SIZEOF_INT)
#if SIZEOF_INT == 2
msgpack_pack_real_int16(x, d);
#elif SIZEOF_INT == 4 || INT_MAX == 0x7fffffff
#elif SIZEOF_INT == 4
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#elif defined(INT_MAX)
#if INT_MAX == 0x7fff
msgpack_pack_real_int16(x, d);
#elif INT_MAX == 0x7fffffff
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#else
if(sizeof(int) == 2) {
msgpack_pack_real_int16(x, d);
@@ -467,14 +461,24 @@ if(sizeof(int) == 2) {
msgpack_pack_inline_func_cint(_long)(msgpack_pack_user x, long d)
{
#if defined(SIZEOF_LONG) || defined(LONG_MAX)
#if SIZEOF_LONG == 2 || LONG_MAX == 0x7fffL
#if defined(SIZEOF_LONG)
#if SIZEOF_LONG == 2
msgpack_pack_real_int16(x, d);
#elif SIZEOF_LONG == 4 || LONG_MAX == 0x7fffffffL
#elif SIZEOF_LONG == 4
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#elif defined(LONG_MAX)
#if LONG_MAX == 0x7fffL
msgpack_pack_real_int16(x, d);
#elif LONG_MAX == 0x7fffffffL
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#else
if(sizeof(long) == 2) {
msgpack_pack_real_int16(x, d);
@@ -488,14 +492,24 @@ if(sizeof(long) == 2) {
msgpack_pack_inline_func_cint(_long_long)(msgpack_pack_user x, long long d)
{
#if defined(SIZEOF_LONG_LONG) || defined(LLONG_MAX)
#if SIZEOF_LONG_LONG == 2 || LLONG_MAX == 0x7fffL
#if defined(SIZEOF_LONG_LONG)
#if SIZEOF_LONG_LONG == 2
msgpack_pack_real_int16(x, d);
#elif SIZEOF_LONG_LONG == 4 || LLONG_MAX == 0x7fffffffL
#elif SIZEOF_LONG_LONG == 4
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#elif defined(LLONG_MAX)
#if LLONG_MAX == 0x7fffL
msgpack_pack_real_int16(x, d);
#elif LLONG_MAX == 0x7fffffffL
msgpack_pack_real_int32(x, d);
#else
msgpack_pack_real_int64(x, d);
#endif
#else
if(sizeof(long long) == 2) {
msgpack_pack_real_int16(x, d);
@@ -509,14 +523,24 @@ if(sizeof(long long) == 2) {
msgpack_pack_inline_func_cint(_unsigned_short)(msgpack_pack_user x, unsigned short d)
{
#if defined(SIZEOF_SHORT) || defined(USHRT_MAX)
#if SIZEOF_SHORT == 2 || USHRT_MAX == 0xffffU
#if defined(SIZEOF_SHORT)
#if SIZEOF_SHORT == 2
msgpack_pack_real_uint16(x, d);
#elif SIZEOF_SHORT == 4 || USHRT_MAX == 0xffffffffU
#elif SIZEOF_SHORT == 4
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#elif defined(USHRT_MAX)
#if USHRT_MAX == 0xffffU
msgpack_pack_real_uint16(x, d);
#elif USHRT_MAX == 0xffffffffU
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#else
if(sizeof(unsigned short) == 2) {
msgpack_pack_real_uint16(x, d);
@@ -530,14 +554,24 @@ if(sizeof(unsigned short) == 2) {
msgpack_pack_inline_func_cint(_unsigned_int)(msgpack_pack_user x, unsigned int d)
{
#if defined(SIZEOF_INT) || defined(UINT_MAX)
#if SIZEOF_INT == 2 || UINT_MAX == 0xffffU
#if defined(SIZEOF_INT)
#if SIZEOF_INT == 2
msgpack_pack_real_uint16(x, d);
#elif SIZEOF_INT == 4 || UINT_MAX == 0xffffffffU
#elif SIZEOF_INT == 4
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#elif defined(UINT_MAX)
#if UINT_MAX == 0xffffU
msgpack_pack_real_uint16(x, d);
#elif UINT_MAX == 0xffffffffU
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#else
if(sizeof(unsigned int) == 2) {
msgpack_pack_real_uint16(x, d);
@@ -551,18 +585,28 @@ if(sizeof(unsigned int) == 2) {
msgpack_pack_inline_func_cint(_unsigned_long)(msgpack_pack_user x, unsigned long d)
{
#if defined(SIZEOF_LONG) || defined(ULONG_MAX)
#if SIZEOF_LONG == 2 || ULONG_MAX == 0xffffUL
#if defined(SIZEOF_LONG)
#if SIZEOF_LONG == 2
msgpack_pack_real_uint16(x, d);
#elif SIZEOF_LONG == 4 || ULONG_MAX == 0xffffffffUL
#elif SIZEOF_LONG == 4
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#else
if(sizeof(unsigned int) == 2) {
#elif defined(ULONG_MAX)
#if ULONG_MAX == 0xffffUL
msgpack_pack_real_uint16(x, d);
} else if(sizeof(unsigned int) == 4) {
#elif ULONG_MAX == 0xffffffffUL
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#else
if(sizeof(unsigned long) == 2) {
msgpack_pack_real_uint16(x, d);
} else if(sizeof(unsigned long) == 4) {
msgpack_pack_real_uint32(x, d);
} else {
msgpack_pack_real_uint64(x, d);
@@ -572,14 +616,24 @@ if(sizeof(unsigned int) == 2) {
msgpack_pack_inline_func_cint(_unsigned_long_long)(msgpack_pack_user x, unsigned long long d)
{
#if defined(SIZEOF_LONG_LONG) || defined(ULLONG_MAX)
#if SIZEOF_LONG_LONG == 2 || ULLONG_MAX == 0xffffUL
#if defined(SIZEOF_LONG_LONG)
#if SIZEOF_LONG_LONG == 2
msgpack_pack_real_uint16(x, d);
#elif SIZEOF_LONG_LONG == 4 || ULLONG_MAX == 0xffffffffUL
#elif SIZEOF_LONG_LONG == 4
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#elif defined(ULLONG_MAX)
#if ULLONG_MAX == 0xffffUL
msgpack_pack_real_uint16(x, d);
#elif ULLONG_MAX == 0xffffffffUL
msgpack_pack_real_uint32(x, d);
#else
msgpack_pack_real_uint64(x, d);
#endif
#else
if(sizeof(unsigned long long) == 2) {
msgpack_pack_real_uint16(x, d);
@@ -602,17 +656,24 @@ if(sizeof(unsigned long long) == 2) {
msgpack_pack_inline_func(_float)(msgpack_pack_user x, float d)
{
union { char buf[4]; uint32_t num; } f;
*((float*)&f.buf) = d; // FIXME
const unsigned char buf[5] = {0xca, STORE32_BE32(f.num)};
unsigned char buf[5];
union { float f; uint32_t i; } mem;
mem.f = d;
buf[0] = 0xca; _msgpack_store32(&buf[1], mem.i);
msgpack_pack_append_buffer(x, buf, 5);
}
msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d)
{
union { char buf[8]; uint64_t num; } f;
*((double*)&f.buf) = d; // FIXME
const unsigned char buf[9] = {0xcb, STORE64_BE64(f.num)};
unsigned char buf[9];
union { double f; uint64_t i; } mem;
mem.f = d;
buf[0] = 0xcb;
#if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
// https://github.com/msgpack/msgpack-perl/pull/1
mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
#endif
_msgpack_store64(&buf[1], mem.i);
msgpack_pack_append_buffer(x, buf, 9);
}
@@ -649,18 +710,18 @@ msgpack_pack_inline_func(_false)(msgpack_pack_user x)
* Array
*/
msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
msgpack_pack_inline_func(_array)(msgpack_pack_user x, size_t n)
{
if(n < 16) {
unsigned char d = 0x90 | n;
unsigned char d = 0x90 | (uint8_t)n;
msgpack_pack_append_buffer(x, &d, 1);
} else if(n < 65536) {
uint16_t d = (uint16_t)n;
unsigned char buf[3] = {0xdc, STORE16_BE16(d)};
unsigned char buf[3];
buf[0] = 0xdc; _msgpack_store16(&buf[1], (uint16_t)n);
msgpack_pack_append_buffer(x, buf, 3);
} else {
uint32_t d = (uint32_t)n;
unsigned char buf[5] = {0xdd, STORE32_BE32(d)};
unsigned char buf[5];
buf[0] = 0xdd; _msgpack_store32(&buf[1], (uint32_t)n);
msgpack_pack_append_buffer(x, buf, 5);
}
}
@@ -670,18 +731,18 @@ msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
* Map
*/
msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
msgpack_pack_inline_func(_map)(msgpack_pack_user x, size_t n)
{
if(n < 16) {
unsigned char d = 0x80 | n;
msgpack_pack_append_buffer(x, &STORE8_BE8(d), 1);
unsigned char d = 0x80 | (uint8_t)n;
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
} else if(n < 65536) {
uint16_t d = (uint16_t)n;
unsigned char buf[3] = {0xde, STORE16_BE16(d)};
unsigned char buf[3];
buf[0] = 0xde; _msgpack_store16(&buf[1], (uint16_t)n);
msgpack_pack_append_buffer(x, buf, 3);
} else {
uint32_t d = (uint32_t)n;
unsigned char buf[5] = {0xdf, STORE32_BE32(d)};
unsigned char buf[5];
buf[0] = 0xdf; _msgpack_store32(&buf[1], (uint32_t)n);
msgpack_pack_append_buffer(x, buf, 5);
}
}
@@ -694,15 +755,15 @@ msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
msgpack_pack_inline_func(_raw)(msgpack_pack_user x, size_t l)
{
if(l < 32) {
unsigned char d = 0xa0 | l;
msgpack_pack_append_buffer(x, &STORE8_BE8(d), 1);
unsigned char d = 0xa0 | (uint8_t)l;
msgpack_pack_append_buffer(x, &TAKE8_8(d), 1);
} else if(l < 65536) {
uint16_t d = (uint16_t)l;
unsigned char buf[3] = {0xda, STORE16_BE16(d)};
unsigned char buf[3];
buf[0] = 0xda; _msgpack_store16(&buf[1], (uint16_t)l);
msgpack_pack_append_buffer(x, buf, 3);
} else {
uint32_t d = (uint32_t)l;
unsigned char buf[5] = {0xdb, STORE32_BE32(d)};
unsigned char buf[5];
buf[0] = 0xdb; _msgpack_store32(&buf[1], (uint32_t)l);
msgpack_pack_append_buffer(x, buf, 5);
}
}
@@ -716,19 +777,10 @@ msgpack_pack_inline_func(_raw_body)(msgpack_pack_user x, const void* b, size_t l
#undef msgpack_pack_user
#undef msgpack_pack_append_buffer
#undef STORE8_BE8
#undef STORE16_BE8
#undef STORE16_BE16
#undef STORE32_BE8
#undef STORE32_BE16
#undef STORE32_BE32
#undef STORE64_BE8
#undef STORE64_BE16
#undef STORE64_BE32
#undef STORE64_BE64
#undef TAKE8_8
#undef TAKE8_16
#undef TAKE8_32
#undef TAKE8_64
#undef msgpack_pack_real_uint8
#undef msgpack_pack_real_uint16
+33 -6
View File
@@ -21,14 +21,17 @@
#include <stdlib.h>
#include <string.h>
#ifndef MSGPACK_SBUFFER_INIT_SIZE
#define MSGPACK_SBUFFER_INIT_SIZE 2048
#endif
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup msgpack_sbuffer Simple buffer
* @ingroup msgpack_buffer
* @{
*/
typedef struct msgpack_sbuffer {
size_t size;
char* data;
@@ -45,17 +48,34 @@ static inline void msgpack_sbuffer_destroy(msgpack_sbuffer* sbuf)
free(sbuf->data);
}
static inline int msgpack_sbuffer_write(void* data, const char* buf, unsigned int len)
static inline msgpack_sbuffer* msgpack_sbuffer_new(void)
{
return (msgpack_sbuffer*)calloc(1, sizeof(msgpack_sbuffer));
}
static inline void msgpack_sbuffer_free(msgpack_sbuffer* sbuf)
{
if(sbuf == NULL) { return; }
msgpack_sbuffer_destroy(sbuf);
free(sbuf);
}
#ifndef MSGPACK_SBUFFER_INIT_SIZE
#define MSGPACK_SBUFFER_INIT_SIZE 8192
#endif
static inline int msgpack_sbuffer_write(void* data, const char* buf, size_t len)
{
msgpack_sbuffer* sbuf = (msgpack_sbuffer*)data;
if(sbuf->alloc - sbuf->size < len) {
void* tmp;
size_t nsize = (sbuf->alloc) ?
sbuf->alloc * 2 : MSGPACK_SBUFFER_INIT_SIZE;
while(nsize < sbuf->size + len) { nsize *= 2; }
void* tmp = realloc(sbuf->data, nsize);
tmp = realloc(sbuf->data, nsize);
if(!tmp) { return -1; }
sbuf->data = (char*)tmp;
@@ -76,6 +96,13 @@ static inline char* msgpack_sbuffer_release(msgpack_sbuffer* sbuf)
return tmp;
}
static inline void msgpack_sbuffer_clear(msgpack_sbuffer* sbuf)
{
sbuf->size = 0;
}
/** @} */
#ifdef __cplusplus
}
+15 -6
View File
@@ -18,7 +18,7 @@
#ifndef MSGPACK_SBUFFER_HPP__
#define MSGPACK_SBUFFER_HPP__
#include "msgpack/sbuffer.h"
#include "sbuffer.h"
#include <stdexcept>
namespace msgpack {
@@ -28,9 +28,13 @@ class sbuffer : public msgpack_sbuffer {
public:
sbuffer(size_t initsz = MSGPACK_SBUFFER_INIT_SIZE)
{
base::data = (char*)::malloc(initsz);
if(!base::data) {
throw std::bad_alloc();
if(initsz == 0) {
base::data = NULL;
} else {
base::data = (char*)::malloc(initsz);
if(!base::data) {
throw std::bad_alloc();
}
}
base::size = 0;
@@ -43,7 +47,7 @@ public:
}
public:
void write(const char* buf, unsigned int len)
void write(const char* buf, size_t len)
{
if(base::alloc - base::size < len) {
expand_buffer(len);
@@ -72,10 +76,15 @@ public:
return msgpack_sbuffer_release(this);
}
void clear()
{
msgpack_sbuffer_clear(this);
}
private:
void expand_buffer(size_t len)
{
size_t nsize = (base::alloc) ?
size_t nsize = (base::alloc > 0) ?
base::alloc * 2 : MSGPACK_SBUFFER_INIT_SIZE;
while(nsize < base::size + len) { nsize *= 2; }
+208
View File
@@ -0,0 +1,208 @@
/*
* MessagePack system dependencies
*
* Copyright (C) 2008-2010 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MSGPACK_SYSDEP_H__
#define MSGPACK_SYSDEP_H__
#include <stdlib.h>
#include <stddef.h>
#if defined(_MSC_VER) && _MSC_VER < 1600
typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#elif defined(_MSC_VER) // && _MSC_VER >= 1600
#include <stdint.h>
#else
#include <stdint.h>
#include <stdbool.h>
#endif
#ifdef _WIN32
#define _msgpack_atomic_counter_header <windows.h>
typedef long _msgpack_atomic_counter_t;
#define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
#define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)
#elif defined(__GNUC__) && ((__GNUC__*10 + __GNUC_MINOR__) < 41)
#define _msgpack_atomic_counter_header "gcc_atomic.h"
#else
typedef unsigned int _msgpack_atomic_counter_t;
#define _msgpack_sync_decr_and_fetch(ptr) __sync_sub_and_fetch(ptr, 1)
#define _msgpack_sync_incr_and_fetch(ptr) __sync_add_and_fetch(ptr, 1)
#endif
#ifdef _WIN32
#ifdef __cplusplus
/* numeric_limits<T>::min,max */
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
#endif
#else
#include <arpa/inet.h> /* __BYTE_ORDER */
#endif
#if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define __LITTLE_ENDIAN__
#elif __BYTE_ORDER == __BIG_ENDIAN
#define __BIG_ENDIAN__
#elif _WIN32
#define __LITTLE_ENDIAN__
#endif
#endif
#ifdef __LITTLE_ENDIAN__
#ifdef _WIN32
# if defined(ntohs)
# define _msgpack_be16(x) ntohs(x)
# elif defined(_byteswap_ushort) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be16(x) ((uint16_t)_byteswap_ushort((unsigned short)x))
# else
# define _msgpack_be16(x) ( \
((((uint16_t)x) << 8) ) | \
((((uint16_t)x) >> 8) ) )
# endif
#else
# define _msgpack_be16(x) ntohs(x)
#endif
#ifdef _WIN32
# if defined(ntohl)
# define _msgpack_be32(x) ntohl(x)
# elif defined(_byteswap_ulong) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be32(x) ((uint32_t)_byteswap_ulong((unsigned long)x))
# else
# define _msgpack_be32(x) \
( ((((uint32_t)x) << 24) ) | \
((((uint32_t)x) << 8) & 0x00ff0000U ) | \
((((uint32_t)x) >> 8) & 0x0000ff00U ) | \
((((uint32_t)x) >> 24) ) )
# endif
#else
# define _msgpack_be32(x) ntohl(x)
#endif
#if defined(_byteswap_uint64) || (defined(_MSC_VER) && _MSC_VER >= 1400)
# define _msgpack_be64(x) (_byteswap_uint64(x))
#elif defined(bswap_64)
# define _msgpack_be64(x) bswap_64(x)
#elif defined(__DARWIN_OSSwapInt64)
# define _msgpack_be64(x) __DARWIN_OSSwapInt64(x)
#else
#define _msgpack_be64(x) \
( ((((uint64_t)x) << 56) ) | \
((((uint64_t)x) << 40) & 0x00ff000000000000ULL ) | \
((((uint64_t)x) << 24) & 0x0000ff0000000000ULL ) | \
((((uint64_t)x) << 8) & 0x000000ff00000000ULL ) | \
((((uint64_t)x) >> 8) & 0x00000000ff000000ULL ) | \
((((uint64_t)x) >> 24) & 0x0000000000ff0000ULL ) | \
((((uint64_t)x) >> 40) & 0x000000000000ff00ULL ) | \
((((uint64_t)x) >> 56) ) )
#endif
#define _msgpack_load16(cast, from) ((cast)( \
(((uint16_t)((uint8_t*)(from))[0]) << 8) | \
(((uint16_t)((uint8_t*)(from))[1]) ) ))
#define _msgpack_load32(cast, from) ((cast)( \
(((uint32_t)((uint8_t*)(from))[0]) << 24) | \
(((uint32_t)((uint8_t*)(from))[1]) << 16) | \
(((uint32_t)((uint8_t*)(from))[2]) << 8) | \
(((uint32_t)((uint8_t*)(from))[3]) ) ))
#define _msgpack_load64(cast, from) ((cast)( \
(((uint64_t)((uint8_t*)(from))[0]) << 56) | \
(((uint64_t)((uint8_t*)(from))[1]) << 48) | \
(((uint64_t)((uint8_t*)(from))[2]) << 40) | \
(((uint64_t)((uint8_t*)(from))[3]) << 32) | \
(((uint64_t)((uint8_t*)(from))[4]) << 24) | \
(((uint64_t)((uint8_t*)(from))[5]) << 16) | \
(((uint64_t)((uint8_t*)(from))[6]) << 8) | \
(((uint64_t)((uint8_t*)(from))[7]) ) ))
#else
#define _msgpack_be16(x) (x)
#define _msgpack_be32(x) (x)
#define _msgpack_be64(x) (x)
#define _msgpack_load16(cast, from) ((cast)( \
(((uint16_t)((uint8_t*)from)[0]) << 8) | \
(((uint16_t)((uint8_t*)from)[1]) ) ))
#define _msgpack_load32(cast, from) ((cast)( \
(((uint32_t)((uint8_t*)from)[0]) << 24) | \
(((uint32_t)((uint8_t*)from)[1]) << 16) | \
(((uint32_t)((uint8_t*)from)[2]) << 8) | \
(((uint32_t)((uint8_t*)from)[3]) ) ))
#define _msgpack_load64(cast, from) ((cast)( \
(((uint64_t)((uint8_t*)from)[0]) << 56) | \
(((uint64_t)((uint8_t*)from)[1]) << 48) | \
(((uint64_t)((uint8_t*)from)[2]) << 40) | \
(((uint64_t)((uint8_t*)from)[3]) << 32) | \
(((uint64_t)((uint8_t*)from)[4]) << 24) | \
(((uint64_t)((uint8_t*)from)[5]) << 16) | \
(((uint64_t)((uint8_t*)from)[6]) << 8) | \
(((uint64_t)((uint8_t*)from)[7]) ) ))
#endif
#define _msgpack_store16(to, num) \
do { uint16_t val = _msgpack_be16(num); memcpy(to, &val, 2); } while(0)
#define _msgpack_store32(to, num) \
do { uint32_t val = _msgpack_be32(num); memcpy(to, &val, 4); } while(0)
#define _msgpack_store64(to, num) \
do { uint64_t val = _msgpack_be64(num); memcpy(to, &val, 8); } while(0)
/*
#define _msgpack_load16(cast, from) \
({ cast val; memcpy(&val, (char*)from, 2); _msgpack_be16(val); })
#define _msgpack_load32(cast, from) \
({ cast val; memcpy(&val, (char*)from, 4); _msgpack_be32(val); })
#define _msgpack_load64(cast, from) \
({ cast val; memcpy(&val, (char*)from, 8); _msgpack_be64(val); })
*/
#if !defined(__cplusplus) && defined(_MSC_VER)
#if !defined(FALSE)
#define FALSE (0)
#endif
#if !defined(TRUE)
#define TRUE (!FALSE)
#endif
#define bool int
#define true TRUE
#define false FALSE
#define inline __inline
#endif
#endif /* msgpack/sysdep.h */
+17
View File
@@ -0,0 +1,17 @@
#include "type/bool.hpp"
#include "type/deque.hpp"
#include "type/fixint.hpp"
#include "type/float.hpp"
#include "type/int.hpp"
#include "type/list.hpp"
#include "type/map.hpp"
#include "type/nil.hpp"
#include "type/pair.hpp"
#include "type/raw.hpp"
#include "type/set.hpp"
#include "type/string.hpp"
#include "type/vector.hpp"
#include "type/tuple.hpp"
#include "type/define.hpp"
#include "type/tr1/unordered_map.hpp"
#include "type/tr1/unordered_set.hpp"
@@ -15,8 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_TYPE_BOOLEAN_HPP__
#define MSGPACK_TYPE_BOOLEAN_HPP__
#ifndef MSGPACK_TYPE_BOOL_HPP__
#define MSGPACK_TYPE_BOOL_HPP__
#include "msgpack/object.hpp"
#include <vector>
@@ -31,7 +31,6 @@ inline bool& operator>> (object o, bool& v)
return v;
}
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const bool& v)
{
@@ -40,6 +39,15 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const bool& v)
return o;
}
inline void operator<< (object& o, bool v)
{
o.type = type::BOOLEAN;
o.via.boolean = v;
}
inline void operator<< (object::with_zone& o, bool v)
{ static_cast<object&>(o) << v; }
} // namespace msgpack
File diff suppressed because it is too large Load Diff
+148
View File
@@ -0,0 +1,148 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_TYPE_DEFINE_HPP__
#define MSGPACK_TYPE_DEFINE_HPP__
#define MSGPACK_DEFINE(...) \
template <typename Packer> \
void msgpack_pack(Packer& pk) const \
{ \
msgpack::type::make_define(__VA_ARGS__).msgpack_pack(pk); \
} \
void msgpack_unpack(msgpack::object o) \
{ \
msgpack::type::make_define(__VA_ARGS__).msgpack_unpack(o); \
}\
template <typename MSGPACK_OBJECT> \
void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone* z) const \
{ \
msgpack::type::make_define(__VA_ARGS__).msgpack_object(o, z); \
}
// MSGPACK_ADD_ENUM must be used in the global namespace.
#define MSGPACK_ADD_ENUM(enum) \
namespace msgpack { \
template <> \
inline enum& operator>> (object o, enum& v) \
{ \
int tmp; \
o >> tmp; \
v = static_cast<enum>(tmp); \
return v; \
} \
template <> \
inline void operator<< (object::with_zone& o, const enum& v) \
{ \
o << static_cast<int>(v); \
} \
namespace detail { \
template <typename Stream> \
struct packer_serializer<Stream, enum> { \
static packer<Stream>& pack(packer<Stream>& o, const enum& v) { \
return o << static_cast<int>(v); \
} \
}; \
} \
}
namespace msgpack {
namespace type {
<% GENERATION_LIMIT = 31 %>
template <typename A0 = void<%1.upto(GENERATION_LIMIT+1) {|i|%>, typename A<%=i%> = void<%}%>>
struct define;
template <>
struct define<> {
typedef define<> value_type;
typedef tuple<> tuple_type;
template <typename Packer>
void msgpack_pack(Packer& pk) const
{
pk.pack_array(0);
}
void msgpack_unpack(msgpack::object o)
{
if(o.type != type::ARRAY) { throw type_error(); }
}
void msgpack_object(msgpack::object* o, msgpack::zone* z) const
{
o->type = type::ARRAY;
o->via.array.ptr = NULL;
o->via.array.size = 0;
}
};
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
struct define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> {
typedef define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> value_type;
typedef tuple<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> tuple_type;
define(A0& _a0<%1.upto(i) {|j|%>, A<%=j%>& _a<%=j%><%}%>) :
a0(_a0)<%1.upto(i) {|j|%>, a<%=j%>(_a<%=j%>)<%}%> {}
template <typename Packer>
void msgpack_pack(Packer& pk) const
{
pk.pack_array(<%=i+1%>);
<%0.upto(i) {|j|%>
pk.pack(a<%=j%>);<%}%>
}
void msgpack_unpack(msgpack::object o)
{
if(o.type != type::ARRAY) { throw type_error(); }
const size_t size = o.via.array.size;
if(size > 0) {
msgpack::object *ptr = o.via.array.ptr;
switch(size) {
default:<%(i).downto(0) {|j|%>
case <%=j+1%>: ptr[<%=j%>].convert(&a<%=j%>);<%}%>
}
}
}
void msgpack_object(msgpack::object* o, msgpack::zone* z) const
{
o->type = type::ARRAY;
o->via.array.ptr = (object*)z->malloc(sizeof(object)*<%=i+1%>);
o->via.array.size = <%=i+1%>;
<%0.upto(i) {|j|%>
o->via.array.ptr[<%=j%>] = object(a<%=j%>, z);<%}%>
}
<%0.upto(i) {|j|%>
A<%=j%>& a<%=j%>;<%}%>
};
<%}%>
inline define<> make_define()
{
return define<>();
}
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename A0<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>> make_define(A0& a0<%1.upto(i) {|j|%>, A<%=j%>& a<%=j%><%}%>)
{
return define<A0<%1.upto(i) {|j|%>, A<%=j%><%}%>>(a0<%1.upto(i) {|j|%>, a<%=j%><%}%>);
}
<%}%>
} // namespace type
} // namespace msgpack
#endif /* msgpack/type/define.hpp */
+77
View File
@@ -0,0 +1,77 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_TYPE_DEQUE_HPP__
#define MSGPACK_TYPE_DEQUE_HPP__
#include "msgpack/object.hpp"
#include <deque>
namespace msgpack {
template <typename T>
inline std::deque<T>& operator>> (object o, std::deque<T>& v)
{
if(o.type != type::ARRAY) { throw type_error(); }
v.resize(o.via.array.size);
object* p = o.via.array.ptr;
object* const pend = o.via.array.ptr + o.via.array.size;
typename std::deque<T>::iterator it = v.begin();
for(; p < pend; ++p, ++it) {
p->convert(&*it);
}
return v;
}
template <typename Stream, typename T>
inline packer<Stream>& operator<< (packer<Stream>& o, const std::deque<T>& v)
{
o.pack_array(v.size());
for(typename std::deque<T>::const_iterator it(v.begin()), it_end(v.end());
it != it_end; ++it) {
o.pack(*it);
}
return o;
}
template <typename T>
inline void operator<< (object::with_zone& o, const std::deque<T>& v)
{
o.type = type::ARRAY;
if(v.empty()) {
o.via.array.ptr = NULL;
o.via.array.size = 0;
} else {
object* p = (object*)o.zone->malloc(sizeof(object)*v.size());
object* const pend = p + v.size();
o.via.array.ptr = p;
o.via.array.size = v.size();
typename std::deque<T>::const_iterator it(v.begin());
do {
*p = object(*it, o.zone);
++p;
++it;
} while(p < pend);
}
}
} // namespace msgpack
#endif /* msgpack/type/deque.hpp */
+217
View File
@@ -0,0 +1,217 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2020 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_TYPE_FIXINT_HPP__
#define MSGPACK_TYPE_FIXINT_HPP__
#include "msgpack/object.hpp"
#include "msgpack/type/int.hpp"
namespace msgpack {
namespace type {
template <typename T>
struct fix_int {
fix_int() : value(0) { }
fix_int(T value) : value(value) { }
operator T() const { return value; }
T get() const { return value; }
private:
T value;
};
typedef fix_int<uint8_t> fix_uint8;
typedef fix_int<uint16_t> fix_uint16;
typedef fix_int<uint32_t> fix_uint32;
typedef fix_int<uint64_t> fix_uint64;
typedef fix_int<int8_t> fix_int8;
typedef fix_int<int16_t> fix_int16;
typedef fix_int<int32_t> fix_int32;
typedef fix_int<int64_t> fix_int64;
} // namespace type
inline type::fix_int8& operator>> (object o, type::fix_int8& v)
{ v = type::detail::convert_integer<int8_t>(o); return v; }
inline type::fix_int16& operator>> (object o, type::fix_int16& v)
{ v = type::detail::convert_integer<int16_t>(o); return v; }
inline type::fix_int32& operator>> (object o, type::fix_int32& v)
{ v = type::detail::convert_integer<int32_t>(o); return v; }
inline type::fix_int64& operator>> (object o, type::fix_int64& v)
{ v = type::detail::convert_integer<int64_t>(o); return v; }
inline type::fix_uint8& operator>> (object o, type::fix_uint8& v)
{ v = type::detail::convert_integer<uint8_t>(o); return v; }
inline type::fix_uint16& operator>> (object o, type::fix_uint16& v)
{ v = type::detail::convert_integer<uint16_t>(o); return v; }
inline type::fix_uint32& operator>> (object o, type::fix_uint32& v)
{ v = type::detail::convert_integer<uint32_t>(o); return v; }
inline type::fix_uint64& operator>> (object o, type::fix_uint64& v)
{ v = type::detail::convert_integer<uint64_t>(o); return v; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_int8& v)
{ o.pack_fix_int8(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_int16& v)
{ o.pack_fix_int16(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_int32& v)
{ o.pack_fix_int32(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_int64& v)
{ o.pack_fix_int64(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_uint8& v)
{ o.pack_fix_uint8(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_uint16& v)
{ o.pack_fix_uint16(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_uint32& v)
{ o.pack_fix_uint32(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const type::fix_uint64& v)
{ o.pack_fix_uint64(v); return o; }
inline void operator<< (object& o, type::fix_int8 v)
{
if ( v.get() < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v.get() ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v.get() ;
}
}
inline void operator<< (object& o, type::fix_int16 v)
{
if ( v.get() < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v.get() ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v.get() ;
}
}
inline void operator<< (object& o, type::fix_int32 v)
{
if ( v.get() < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v.get() ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v.get() ;
}
}
inline void operator<< (object& o, type::fix_int64 v)
{
if( v.get() < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v.get() ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v.get() ;
}
}
inline void operator<< (object& o, type::fix_uint8 v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
inline void operator<< (object& o, type::fix_uint16 v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
inline void operator<< (object& o, type::fix_uint32 v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
inline void operator<< (object& o, type::fix_uint64 v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v.get(); }
inline void operator<< (object::with_zone& o, type::fix_int8 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_int16 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_int32 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_int64 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_uint8 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_uint16 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_uint32 v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, type::fix_uint64 v)
{ static_cast<object&>(o) << v; }
} // namespace msgpack
#endif /* msgpack/type/fixint.hpp */
@@ -29,12 +29,21 @@ namespace msgpack {
inline float& operator>> (object o, float& v)
{
if(o.type != type::DOUBLE) { throw type_error(); }
v = o.via.dec;
if(o.type == type::DOUBLE) {
v = (float)o.via.dec;
}
else if (o.type == type::POSITIVE_INTEGER) {
v = (float)o.via.u64;
}
else if (o.type == type::NEGATIVE_INTEGER) {
v = (float)o.via.i64;
}
else {
throw type_error();
}
return v;
}
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const float& v)
{
@@ -45,12 +54,21 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const float& v)
inline double& operator>> (object o, double& v)
{
if(o.type != type::DOUBLE) { throw type_error(); }
v = o.via.dec;
if(o.type == type::DOUBLE) {
v = o.via.dec;
}
else if (o.type == type::POSITIVE_INTEGER) {
v = (double)o.via.u64;
}
else if (o.type == type::NEGATIVE_INTEGER) {
v = (double)o.via.i64;
}
else {
throw type_error();
}
return v;
}
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, const double& v)
{
@@ -59,6 +77,25 @@ inline packer<Stream>& operator<< (packer<Stream>& o, const double& v)
}
inline void operator<< (object& o, float v)
{
o.type = type::DOUBLE;
o.via.dec = (double)v;
}
inline void operator<< (object& o, double v)
{
o.type = type::DOUBLE;
o.via.dec = v;
}
inline void operator<< (object::with_zone& o, float v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, double v)
{ static_cast<object&>(o) << v; }
} // namespace msgpack
#endif /* msgpack/type/float.hpp */
+339
View File
@@ -0,0 +1,339 @@
//
// MessagePack for C++ static resolution routine
//
// Copyright (C) 2008-2009 FURUHASHI Sadayuki
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#ifndef MSGPACK_TYPE_INT_HPP__
#define MSGPACK_TYPE_INT_HPP__
#include "msgpack/object.hpp"
#include <limits>
namespace msgpack {
namespace type {
namespace detail {
template <typename T, bool Signed>
struct convert_integer_sign;
template <typename T>
struct convert_integer_sign<T, true> {
static inline T convert(object o) {
if(o.type == type::POSITIVE_INTEGER) {
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
{ throw type_error(); }
return (T)o.via.u64;
} else if(o.type == type::NEGATIVE_INTEGER) {
if(o.via.i64 < (int64_t)std::numeric_limits<T>::min())
{ throw type_error(); }
return (T)o.via.i64;
}
throw type_error();
}
};
template <typename T>
struct convert_integer_sign<T, false> {
static inline T convert(object o) {
if(o.type == type::POSITIVE_INTEGER) {
if(o.via.u64 > (uint64_t)std::numeric_limits<T>::max())
{ throw type_error(); }
return (T)o.via.u64;
}
throw type_error();
}
};
template <typename T>
struct is_signed {
static const bool value = std::numeric_limits<T>::is_signed;
};
template <typename T>
static inline T convert_integer(object o)
{
return detail::convert_integer_sign<T, is_signed<T>::value>::convert(o);
}
template <bool Signed>
struct pack_char_sign;
template <>
struct pack_char_sign<true> {
template <typename Stream>
static inline packer<Stream>& pack(packer<Stream>& o, char v) {
o.pack_int8(v); return o;
}
};
template <>
struct pack_char_sign<false> {
template <typename Stream>
static inline packer<Stream>& pack(packer<Stream>& o, char v) {
o.pack_uint8(v); return o;
}
};
template <typename Stream>
static inline packer<Stream>& pack_char(packer<Stream>& o, char v) {
return pack_char_sign<is_signed<char>::value>::pack(o, v);
}
template <bool Signed>
struct object_char_sign;
template <>
struct object_char_sign<true> {
static inline void make(object& o, char v) {
if( v < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v ;
}
}
};
template <>
struct object_char_sign<false> {
static inline void make(object& o, char v) {
o.type = type::POSITIVE_INTEGER, o.via.u64 = v;
}
};
static inline void object_char(object& o, char v) {
return object_char_sign<is_signed<char>::value>::make(o, v);
}
} // namespace detail
} // namespace type
inline char& operator>> (object const& o, char& v)
{ v = type::detail::convert_integer<char>(o); return v; }
inline signed char& operator>> (object o, signed char& v)
{ v = type::detail::convert_integer<signed char>(o); return v; }
inline signed short& operator>> (object o, signed short& v)
{ v = type::detail::convert_integer<signed short>(o); return v; }
inline signed int& operator>> (object o, signed int& v)
{ v = type::detail::convert_integer<signed int>(o); return v; }
inline signed long& operator>> (object o, signed long& v)
{ v = type::detail::convert_integer<signed long>(o); return v; }
inline signed long long& operator>> (object o, signed long long& v)
{ v = type::detail::convert_integer<signed long long>(o); return v; }
inline unsigned char& operator>> (object o, unsigned char& v)
{ v = type::detail::convert_integer<unsigned char>(o); return v; }
inline unsigned short& operator>> (object o, unsigned short& v)
{ v = type::detail::convert_integer<unsigned short>(o); return v; }
inline unsigned int& operator>> (object o, unsigned int& v)
{ v = type::detail::convert_integer<unsigned int>(o); return v; }
inline unsigned long& operator>> (object o, unsigned long& v)
{ v = type::detail::convert_integer<unsigned long>(o); return v; }
inline unsigned long long& operator>> (object o, unsigned long long& v)
{ v = type::detail::convert_integer<unsigned long long>(o); return v; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, char v)
{ return type::detail::pack_char(o, v); }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, signed char v)
{ o.pack_int8(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, signed short v)
{ o.pack_short(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, signed int v)
{ o.pack_int(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, signed long v)
{ o.pack_long(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, signed long long v)
{ o.pack_long_long(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, unsigned char v)
{ o.pack_uint8(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, unsigned short v)
{ o.pack_unsigned_short(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, unsigned int v)
{ o.pack_unsigned_int(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, unsigned long v)
{ o.pack_unsigned_long(v); return o; }
template <typename Stream>
inline packer<Stream>& operator<< (packer<Stream>& o, unsigned long long v)
{ o.pack_unsigned_long_long(v); return o; }
inline void operator<< (object& o, char v)
{ type::detail::object_char(o, v); }
inline void operator<< (object& o, signed char v)
{
if( v < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v ;
}
}
inline void operator<< (object& o, signed short v)
{
if(v < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v;
}
}
inline void operator<< (object& o, signed int v)
{
if( v < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v ;
}
}
inline void operator<< (object& o, signed long v)
{
if( v < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v ;
}
}
inline void operator<< (object& o, signed long long v)
{
if( v < 0 )
{
o.type = type::NEGATIVE_INTEGER ;
o.via.i64 = v ;
}
else
{
o.type = type::POSITIVE_INTEGER ;
o.via.u64 = v ;
}
}
inline void operator<< (object& o, unsigned char v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v; }
inline void operator<< (object& o, unsigned short v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v; }
inline void operator<< (object& o, unsigned int v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v; }
inline void operator<< (object& o, unsigned long v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v; }
inline void operator<< (object& o, unsigned long long v)
{ o.type = type::POSITIVE_INTEGER, o.via.u64 = v; }
inline void operator<< (object::with_zone& o, char v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, signed char v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, signed short v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, signed int v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, signed long v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, const signed long long& v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, unsigned char v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, unsigned short v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, unsigned int v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, unsigned long v)
{ static_cast<object&>(o) << v; }
inline void operator<< (object::with_zone& o, const unsigned long long& v)
{ static_cast<object&>(o) << v; }
} // namespace msgpack
#endif /* msgpack/type/int.hpp */

Some files were not shown because too many files have changed in this diff Show More