anchor.diff:  % erl> c(msgpack).
   % erl> S = <some term>.
   % erl> {S, <<>>} = msgpack:unpack( msgpack:pack(S) ).
  --type reason() ::  enomem | badarg | no_code_matches.
  +-type reason() ::  enomem | badarg | no_code_matches | undefined.
   -type msgpack_term() :: [msgpack_term()]
   		      | {[{msgpack_term(),msgpack_term()}]}
   		      | integer() | float() | binary().
   
   % ===== external APIs ===== %
  --spec pack(Term::msgpack_term()) -> binary().
  -pack(I) when is_integer(I) andalso I < 0 ->
  -    pack_int_(I);
  -pack(I) when is_integer(I) ->
  -    pack_uint_(I);
  -pack(F) when is_float(F) ->
  -    pack_double(F);
  -pack(nil) ->
  -    << 16#C0:8 >>;
  -pack(true) ->
  -    << 16#C3:8 >>;
  -pack(false) ->
  -    << 16#C2:8 >>;
  -pack(Bin) when is_binary(Bin) ->
  -    pack_raw(Bin);
  -pack(List)  when is_list(List) ->
  -    pack_array(List);
  -pack({Map}) when is_list(Map) ->
  -    pack_map(Map);
  -pack(Map) when is_tuple(Map), element(1,Map)=:=dict ->
  -    pack_map(dict:to_list(Map));
  -pack(_Other) ->
  -    {error, undefined}.
  +-spec pack(Term::msgpack_term()) -> binary() | {error, reason()}.
  +pack(Term)->
  +    try
  +	pack_(Term)
  +    catch
  +	error:Error when is_tuple(Error), element(1, Error) =:= error ->
  +	    Error;
  +	throw:Exception ->
  +	    erlang:display(Exception),
  +	    {error, Exception}
  +    end.
   
   % unpacking.
   % if failed in decoding and not end, get more data
   % and feed more Bin into this function.
   % TODO: error case for imcomplete format when short for any type formats.
  --spec unpack( Bin::binary() )-> {msgpack_term(), binary()} |
  -				{more, non_neg_integer()} | {more, undefined} |
  -				{error, reason()}.
  -unpack(Bin) when not is_binary(Bin)->
  -    {error, badarg};
  -unpack(Bin) when bit_size(Bin) >= 8 ->
  -    unpack_(Bin);
  -unpack(<<>>)->
  -    {more, 1};
  -unpack(_) ->
  -    {more, undefined}.
  +-spec unpack( Bin::binary() )-> {msgpack_term(), binary()} | {error, reason()}.
  +unpack(Bin)->
  +    try
  +	unpack_(Bin)
  +    catch
  +	error:Error when is_tuple(Error), element(1, Error) =:= error ->
  +	    Error;
  +	throw:Exception ->
  +	    {error, Exception}
  +    end.
   
   -spec unpack_all( binary() ) -> [msgpack_term()].
   unpack_all(Data)->
  
positive.code: 	     42
  	    ],
      Port = open_port({spawn, "ruby testcase_generator.rb"}, [binary]),
      receive
  	{Port, {data, Data}}->
  	    compare_all(Tests, msgpack:unpack_all(Data))
      after 1024-> ?assert(false)   end,
      port_close(Port).
  
  test_([]) -> 0;
  test_([Before|Rest])->
      Pack = msgpack:pack(Before),
      {After, <<>>} = msgpack:unpack( Pack ),
      ?assertEqual(Before, After),
      1+test_(Rest).
  
  other_test()->
      {more,1}=msgpack:unpack(<<>>).
  
  benchmark_test()->
      Data=[test_data() || _ <- lists:seq(0, 10000)],
  
negative.code:     {Term, <<>>}=msgpack:unpack(OrigBin);
  test_p(I,_,OrigBin,Len) when I < Len->
      <<Bin:I/binary, _/binary>> = OrigBin,
      ?assertEqual({error,short}, msgpack:unpack(Bin)).
  
  partial_test()-> % error handling test.
      Term = lists:seq(0, 45),
  