You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/07/29 00:42:26 UTC

[01/54] jiffy commit: updated refs/heads/master to ef77de4

Repository: couchdb-jiffy
Updated Branches:
  refs/heads/master dc451c9f5 -> ef77de4aa


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_10_short_double_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_10_short_double_tests.erl b/test/jiffy_10_short_double_tests.erl
new file mode 100644
index 0000000..1c1d069
--- /dev/null
+++ b/test/jiffy_10_short_double_tests.erl
@@ -0,0 +1,34 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_10_short_double_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+filename() -> "../test/cases/short-doubles.txt".
+
+
+short_double_test() ->
+    {ok, Fd} = file:open(filename(), [read, binary, raw]),
+    {"all doubles round trip", ?assertEqual(0, run(Fd, 0))}.
+
+
+run(Fd, Acc) ->
+    case file:read_line(Fd) of
+        {ok, Data} ->
+            V1 = re:replace(iolist_to_binary(Data), <<"\.\n">>, <<"">>),
+            V2 = iolist_to_binary(V1),
+            V3 = <<34, V2/binary, 34>>,
+            R = jiffy:encode(jiffy:decode(V3)),
+            case R == V3 of
+                true -> run(Fd, Acc);
+                false -> run(Fd, Acc + 1)
+            end;
+        eof ->
+            Acc
+    end.
+

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_11_proper_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_11_proper_tests.erl b/test/jiffy_11_proper_tests.erl
new file mode 100644
index 0000000..aca542e
--- /dev/null
+++ b/test/jiffy_11_proper_tests.erl
@@ -0,0 +1,164 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_11_proper_tests).
+
+-ifdef(JIFFY_DEV).
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+opts() ->
+    [
+        {max_size, 15},
+        {numtests, 1000}
+    ].
+
+run(Name) ->
+    {msg("~s", [Name]), [
+        {timeout, 3600, ?_assert(proper:quickcheck(?MODULE:Name(), opts()))}
+    ]}.
+
+proper_encode_decode_test_() ->
+    {timeout, 3600, [
+        run(prop_enc_dec),
+        run(prop_enc_dec_pretty),
+        run(prop_enc_no_crash),
+        run(prop_dec_no_crash_bin),
+        run(prop_dec_no_crash_any)
+    ]}.
+
+prop_enc_dec() ->
+    ?FORALL(Data, json(),
+        begin
+            %io:format(standard_error, "Data: ~p~n", [Data]),
+            Data == jiffy:decode(jiffy:encode(Data))
+        end
+    ).
+
+-ifndef(JIFFY_NO_MAPS).
+to_map_ejson({Props}) ->
+    NewProps = [{K, to_map_ejson(V)} || {K, V} <- Props],
+    maps:from_list(NewProps);
+to_map_ejson(Vals) when is_list(Vals) ->
+    [to_map_ejson(V) || V <- Vals];
+to_map_ejson(Val) ->
+    Val.
+
+prop_map_enc_dec() ->
+    ?FORALL(Data, json(),
+        begin
+            MapData = to_map_ejson(Data),
+            MapData == jiffy:decode(jiffy:encode(MapData), [return_maps])
+        end
+    ).
+-endif.
+
+prop_enc_dec_pretty() ->
+    ?FORALL(Data, json(),
+        begin
+            Data == jiffy:decode(jiffy:encode(Data, [pretty]))
+        end
+    ).
+
+prop_enc_no_crash() ->
+    ?FORALL(Data, any(), begin catch jiffy:encode(Data), true end).
+
+prop_dec_no_crash_bin() ->
+    ?FORALL(Data, binary(), begin catch jiffy:decode(Data), true end).
+
+prop_dec_no_crash_any() ->
+    ?FORALL(Data, any(), begin catch jiffy:decode(Data), true end).
+
+
+% JSON Generation
+
+
+json_null() ->
+    null.
+
+
+json_boolean() ->
+    oneof([true, false]).
+
+
+json_number() ->
+    oneof([integer(), float()]).
+
+
+json_string() ->
+    escaped_utf8_bin().
+
+
+json_list(S) when S =< 0 ->
+    [];
+json_list(S) ->
+    ?LETSHRINK(
+        [ListSize],
+        [integer(0, S)],
+        vector(ListSize, json_text(S - ListSize))
+    ).
+
+
+json_object(S) when S =< 0 ->
+    {[]};
+json_object(S) ->
+    ?LETSHRINK(
+        [ObjectSize],
+        [integer(0, S)],
+        {vector(ObjectSize, {json_string(), json_text(S - ObjectSize)})}
+    ).
+
+
+json_value() ->
+    oneof([
+        json_null(),
+        json_boolean(),
+        json_string(),
+        json_number()
+    ]).
+
+
+json_text(S) when S > 0 ->
+    ?LAZY(oneof([
+        json_list(S),
+        json_object(S)
+    ]));
+json_text(_) ->
+    json_value().
+
+
+json() ->
+    ?SIZED(S, json_text(S)).
+
+
+%% XXX: Add generators
+%
+% We should add generators that generate JSON binaries directly
+% so we can test things that aren't produced by the encoder.
+%
+% We should also have a version of the JSON generator that inserts
+% errors into the JSON that we can test for.
+
+
+escaped_utf8_bin() ->
+    ?SUCHTHAT(Bin,
+        ?LET(S, ?SUCHTHAT(L, list(escaped_char()), L /= []),
+        unicode:characters_to_binary(S, unicode, utf8)),
+        is_binary(Bin)
+    ).
+
+
+escaped_char() ->
+    ?LET(C, char(),
+        case C of
+            $" -> "\\\"";
+            C when C == 65534 -> 65533;
+            C when C == 65535 -> 65533;
+            C when C > 1114111 -> 1114111;
+            C -> C
+        end
+    ).
+
+-endif.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_tests.erl b/test/jiffy_tests.erl
deleted file mode 100644
index 9ecea32..0000000
--- a/test/jiffy_tests.erl
+++ /dev/null
@@ -1,153 +0,0 @@
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
--module(jiffy_tests).
-
--ifdef(JIFFY_DEV).
-
--include_lib("proper/include/proper.hrl").
--include_lib("eunit/include/eunit.hrl").
-
-
-proper_test_() ->
-    PropErOpts = [
-        {to_file, user},
-        {max_size, 15},
-        {numtests, 1000}
-    ],
-    {timeout, 3600, ?_assertEqual([], proper:module(jiffy_tests, PropErOpts))}.
-
-
-prop_encode_decode() ->
-    ?FORALL(Data, json(),
-        begin
-            %io:format(standard_error, "Data: ~p~n", [Data]),
-            Data == jiffy:decode(jiffy:encode(Data))
-        end
-    ).
-
--ifndef(JIFFY_NO_MAPS).
-to_map_ejson({Props}) ->
-    NewProps = [{K, to_map_ejson(V)} || {K, V} <- Props],
-    maps:from_list(NewProps);
-to_map_ejson(Vals) when is_list(Vals) ->
-    [to_map_ejson(V) || V <- Vals];
-to_map_ejson(Val) ->
-    Val.
-
-prop_map_encode_decode() ->
-    ?FORALL(Data, json(),
-        begin
-            MapData = to_map_ejson(Data),
-            MapData == jiffy:decode(jiffy:encode(MapData), [return_maps])
-        end
-    ).
--endif.
-
-prop_encode_decode_pretty() ->
-    ?FORALL(Data, json(),
-        begin
-            Data == jiffy:decode(jiffy:encode(Data, [pretty]))
-        end
-    ).
-
-prop_encode_not_crash() ->
-    ?FORALL(Data, any(), begin catch jiffy:encode(Data), true end).
-
-prop_decode_not_crash_bin() ->
-    ?FORALL(Data, binary(), begin catch jiffy:decode(Data), true end).
-
-prop_decode_not_crash_any() ->
-    ?FORALL(Data, any(), begin catch jiffy:decode(Data), true end).
-
-
-% JSON Generation
-
-
-json_null() ->
-    null.
-
-
-json_boolean() ->
-    oneof([true, false]).
-
-
-json_number() ->
-    oneof([integer(), float()]).
-
-
-json_string() ->
-    escaped_utf8_bin().
-
-
-json_list(S) when S =< 0 ->
-    [];
-json_list(S) ->
-    ?LETSHRINK(
-        [ListSize],
-        [integer(0, S)],
-        vector(ListSize, json_text(S - ListSize))
-    ).
-
-
-json_object(S) when S =< 0 ->
-    {[]};
-json_object(S) ->
-    ?LETSHRINK(
-        [ObjectSize],
-        [integer(0, S)],
-        {vector(ObjectSize, {json_string(), json_text(S - ObjectSize)})}
-    ).
-
-
-json_value() ->
-    oneof([
-        json_null(),
-        json_boolean(),
-        json_string(),
-        json_number()
-    ]).
-
-
-json_text(S) when S > 0 ->
-    ?LAZY(oneof([
-        json_list(S),
-        json_object(S)
-    ]));
-json_text(_) ->
-    json_value().
-
-
-json() ->
-    ?SIZED(S, json_text(S)).
-
-
-%% XXX: Add generators
-%
-% We should add generators that generate JSON binaries directly
-% so we can test things that aren't produced by the encoder.
-%
-% We should also have a version of the JSON generator that inserts
-% errors into the JSON that we can test for.
-
-
-escaped_utf8_bin() ->
-    ?SUCHTHAT(Bin,
-        ?LET(S, ?SUCHTHAT(L, list(escaped_char()), L /= []),
-        unicode:characters_to_binary(S, unicode, utf8)),
-        is_binary(Bin)
-    ).
-
-
-escaped_char() ->
-    ?LET(C, char(),
-        case C of
-            $" -> "\\\"";
-            C when C == 65534 -> 65533;
-            C when C == 65535 -> 65533;
-            C when C > 1114111 -> 1114111;
-            C -> C
-        end
-    ).
-
--endif.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_util.hrl
----------------------------------------------------------------------
diff --git a/test/jiffy_util.hrl b/test/jiffy_util.hrl
new file mode 100644
index 0000000..b8210e2
--- /dev/null
+++ b/test/jiffy_util.hrl
@@ -0,0 +1,25 @@
+
+msg(Fmt, Args) ->
+    M1 = io_lib:format(Fmt, Args),
+    M2 = re:replace(M1, <<"\r">>, <<"\\\\r">>, [global]),
+    M3 = re:replace(M2, <<"\n">>, <<"\\\\n">>, [global]),
+    M4 = re:replace(M3, <<"\t">>, <<"\\\\t">>, [global]),
+    iolist_to_binary(M4).
+
+
+hex(Bin) when is_binary(Bin) ->
+    H1 = [io_lib:format("16#~2.16.0B",[X]) || <<X:8>> <= Bin],
+    H2 = string:join(H1, ", "),
+    lists:flatten(io_lib:format("<<~s>>", [lists:flatten(H2)])).
+
+
+dec(V) ->
+    jiffy:decode(V).
+
+
+enc(V) ->
+    iolist_to_binary(jiffy:encode(V)).
+
+
+enc(V, Opts) ->
+    iolist_to_binary(jiffy:encode(V, Opts)).

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/util.erl
----------------------------------------------------------------------
diff --git a/test/util.erl b/test/util.erl
deleted file mode 100644
index ceaef89..0000000
--- a/test/util.erl
+++ /dev/null
@@ -1,44 +0,0 @@
--module(util).
--export([test_good/1, test_good/2, test_errors/1]).
-
-test_good(Cases) ->
-    test_good(Cases, []).
-
-test_good(Cases, Options) ->
-    lists:foreach(fun(Case) -> check_good(Case, Options) end, Cases).
-
-test_errors(Cases) ->
-    lists:foreach(fun(Case) -> check_error(Case) end, Cases).
-
-ok_dec(J, _E) ->
-    lists:flatten(io_lib:format("Decoded ~p.", [J])).
-
-ok_enc(E, _J) ->
-    lists:flatten(io_lib:format("Encoded ~p", [E])).
-
-do_encode(E, Options) ->
-    iolist_to_binary(jiffy:encode(E, Options)).
-
-error_mesg(J) ->
-    lists:flatten(io_lib:format("Decoding ~p returns an error.", [J])).
-
-check_good({J, E}, Options) ->
-    etap:is(jiffy:decode(J), E, ok_dec(J, E)),
-    etap:is(do_encode(E, Options), J, ok_enc(E, J));
-check_good({J, E, J2}, Options) ->
-    etap:is(jiffy:decode(J), E, ok_dec(J, E)),
-    etap:is(do_encode(E, Options), J2, ok_enc(E, J2)).
-
-check_error({J, E}) ->
-    etap:fun_is(
-        fun({error, E1}) when E1 == E -> true; (E1) -> E1 end,
-        (catch jiffy:decode(J)),
-        error_mesg(J)
-    );
-check_error(J) ->
-    etap:fun_is(
-        fun({error, _}) -> true; (Else) -> Else end,
-        (catch jiffy:decode(J)),
-        error_mesg(J)
-    ).
-


[03/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/010-short-doubles.t
----------------------------------------------------------------------
diff --git a/test/010-short-doubles.t b/test/010-short-doubles.t
deleted file mode 100755
index 4aac375..0000000
--- a/test/010-short-doubles.t
+++ /dev/null
@@ -1,29 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-filename() -> "test/cases/short-doubles.txt".
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(100000),
-
-    etap:diag("Loading test cases..."),
-    {ok, Cases} = file:consult(filename()),
-
-    etap:diag("Running tests..."),
-    ok = run_tests(Cases),
-
-    etap:end_tests().
-
-
-run_tests([]) ->
-    ok;
-run_tests([Double | Rest]) ->
-    RoundTrip = jiffy:decode(jiffy:encode(Double)),
-    Desc = lists:flatten(io_lib:format("~e", [Double])),
-    etap:is(RoundTrip, Double, "Roundtrip: " ++ Desc),
-    run_tests(Rest).
-

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/etap.erl
----------------------------------------------------------------------
diff --git a/test/etap.erl b/test/etap.erl
deleted file mode 100644
index 6924d09..0000000
--- a/test/etap.erl
+++ /dev/null
@@ -1,612 +0,0 @@
-%% Copyright (c) 2008-2009 Nick Gerakines <ni...@gerakines.net>
-%%
-%% Permission is hereby granted, free of charge, to any person
-%% obtaining a copy of this software and associated documentation
-%% files (the "Software"), to deal in the Software without
-%% restriction, including without limitation the rights to use,
-%% copy, modify, merge, publish, distribute, sublicense, and/or sell
-%% copies of the Software, and to permit persons to whom the
-%% Software is furnished to do so, subject to the following
-%% conditions:
-%%
-%% The above copyright notice and this permission notice shall be
-%% included in all copies or substantial portions of the Software.
-%%
-%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-%% EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-%% OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-%% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-%% HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-%% WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-%% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-%% OTHER DEALINGS IN THE SOFTWARE.
-%%
-%% @author Nick Gerakines <ni...@gerakines.net> [http://socklabs.com/]
-%% @author Jeremy Wall <je...@marzhillstudios.com>
-%% @version 0.3.4
-%% @copyright 2007-2008 Jeremy Wall, 2008-2009 Nick Gerakines
-%% @reference http://testanything.org/wiki/index.php/Main_Page
-%% @reference http://en.wikipedia.org/wiki/Test_Anything_Protocol
-%% @todo Finish implementing the skip directive.
-%% @todo Document the messages handled by this receive loop.
-%% @todo Explain in documentation why we use a process to handle test input.
-%% @doc etap is a TAP testing module for Erlang components and applications.
-%% This module allows developers to test their software using the TAP method.
-%%
-%% <blockquote cite="http://en.wikipedia.org/wiki/Test_Anything_Protocol"><p>
-%% TAP, the Test Anything Protocol, is a simple text-based interface between
-%% testing modules in a test harness. TAP started life as part of the test
-%% harness for Perl but now has implementations in C/C++, Python, PHP, Perl
-%% and probably others by the time you read this.
-%% </p></blockquote>
-%%
-%% The testing process begins by defining a plan using etap:plan/1, running
-%% a number of etap tests and then calling eta:end_tests/0. Please refer to
-%% the Erlang modules in the t directory of this project for example tests.
--module(etap).
--vsn("0.3.4").
-
--export([
-    ensure_test_server/0,
-    start_etap_server/0,
-    test_server/1,
-    msg/1, msg/2,
-    diag/1, diag/2,
-    expectation_mismatch_message/3,
-    plan/1,
-    end_tests/0,
-    not_ok/2, ok/2, is_ok/2, is/3, isnt/3, any/3, none/3,
-    fun_is/3, expect_fun/3, expect_fun/4,
-    is_greater/3,
-    skip/1, skip/2,
-    datetime/1,
-    skip/3,
-    bail/0, bail/1,
-    test_state/0, failure_count/0
-]).
-
--export([
-    contains_ok/3,
-    is_before/4
-]).
-
--export([
-    is_pid/2,
-    is_alive/2,
-    is_mfa/3
-]).
-
--export([
-    loaded_ok/2,
-    can_ok/2, can_ok/3,
-    has_attrib/2, is_attrib/3,
-    is_behaviour/2
-]).
-
--export([
-    dies_ok/2,
-    lives_ok/2,
-    throws_ok/3
-]).
-
-
--record(test_state, {
-    planned = 0,
-    count = 0,
-    pass = 0,
-    fail = 0,
-    skip = 0,
-    skip_reason = ""
-}).
-
-%% @spec plan(N) -> Result
-%%       N = unknown | skip | {skip, string()} | integer()
-%%       Result = ok
-%% @doc Create a test plan and boot strap the test server.
-plan(unknown) ->
-    ensure_test_server(),
-    etap_server ! {self(), plan, unknown},
-    ok;
-plan(skip) ->
-    io:format("1..0 # skip~n");
-plan({skip, Reason}) ->
-    io:format("1..0 # skip ~s~n", [Reason]);
-plan(N) when is_integer(N), N > 0 ->
-    ensure_test_server(),
-    etap_server ! {self(), plan, N},
-    ok.
-
-%% @spec end_tests() -> ok
-%% @doc End the current test plan and output test results.
-%% @todo This should probably be done in the test_server process.
-end_tests() ->
-    case whereis(etap_server) of
-        undefined -> self() ! true;
-        _ -> etap_server ! {self(), state}
-    end,
-    State = receive X -> X end,
-    if
-        State#test_state.planned == -1 ->
-            io:format("1..~p~n", [State#test_state.count]);
-        true ->
-            ok
-    end,
-    case whereis(etap_server) of
-        undefined -> ok;
-        _ -> etap_server ! done, ok
-    end.
-
-bail() ->
-    bail("").
-
-bail(Reason) ->
-    etap_server ! {self(), diag, "Bail out! " ++ Reason},
-    etap_server ! done, ok,
-    ok.
-
-%% @spec test_state() -> Return
-%%       Return = test_state_record() | {error, string()}
-%% @doc Return the current test state
-test_state() ->
-    etap_server ! {self(), state},
-    receive
-	X when is_record(X, test_state) -> X
-    after
-	1000 -> {error, "Timed out waiting for etap server reply.~n"}
-    end.
-
-%% @spec failure_count() -> Return
-%%       Return = integer() | {error, string()}
-%% @doc Return the current failure count
-failure_count() ->
-    case test_state() of
-        #test_state{fail=FailureCount} -> FailureCount;
-        X -> X
-    end.
-
-%% @spec msg(S) -> ok
-%%       S = string()
-%% @doc Print a message in the test output.
-msg(S) -> etap_server ! {self(), diag, S}, ok.
-
-%% @spec msg(Format, Data) -> ok
-%%      Format = atom() | string() | binary()
-%%      Data = [term()]
-%%      UnicodeList = [Unicode]
-%%      Unicode = int()
-%% @doc Print a message in the test output.
-%% Function arguments are passed through io_lib:format/2.
-msg(Format, Data) -> msg(io_lib:format(Format, Data)).
-
-%% @spec diag(S) -> ok
-%%       S = string()
-%% @doc Print a debug/status message related to the test suite.
-diag(S) -> msg("# " ++ S).
-
-%% @spec diag(Format, Data) -> ok
-%%      Format = atom() | string() | binary()
-%%      Data = [term()]
-%%      UnicodeList = [Unicode]
-%%      Unicode = int()
-%% @doc Print a debug/status message related to the test suite.
-%% Function arguments are passed through io_lib:format/2.
-diag(Format, Data) -> diag(io_lib:format(Format, Data)).
-
-%% @spec expectation_mismatch_message(Got, Expected, Desc) -> ok
-%%       Got = any()
-%%       Expected = any()
-%%       Desc = string()
-%% @doc Print an expectation mismatch message in the test output.
-expectation_mismatch_message(Got, Expected, Desc) ->
-    msg("    ---"),
-    msg("    description: ~p", [Desc]),
-    msg("    found:       ~p", [Got]),
-    msg("    wanted:      ~p", [Expected]),
-    msg("    ..."),
-    ok.
-
-% @spec evaluate(Pass, Got, Expected, Desc) -> Result
-%%       Pass = true | false
-%%       Got = any()
-%%       Expected = any()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Evaluate a test statement, printing an expectation mismatch message
-%%       if the test failed.
-evaluate(Pass, Got, Expected, Desc) ->
-    case mk_tap(Pass, Desc) of
-        false ->
-            expectation_mismatch_message(Got, Expected, Desc),
-            false;
-        true ->
-            true
-    end.
-
-%% @spec ok(Expr, Desc) -> Result
-%%       Expr = true | false
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that a statement is true.
-ok(Expr, Desc) -> evaluate(Expr == true, Expr, true, Desc).
-
-%% @spec not_ok(Expr, Desc) -> Result
-%%       Expr = true | false
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that a statement is false.
-not_ok(Expr, Desc) -> evaluate(Expr == false, Expr, false, Desc).
-
-%% @spec is_ok(Expr, Desc) -> Result
-%%       Expr = any()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that two values are the same.
-is_ok(Expr, Desc) -> evaluate(Expr == ok, Expr, ok, Desc).
-
-%% @spec is(Got, Expected, Desc) -> Result
-%%       Got = any()
-%%       Expected = any()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that two values are the same.
-is(Got, Expected, Desc) -> evaluate(Got == Expected, Got, Expected, Desc).
-
-%% @spec isnt(Got, Expected, Desc) -> Result
-%%       Got = any()
-%%       Expected = any()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that two values are not the same.
-isnt(Got, Expected, Desc) -> evaluate(Got /= Expected, Got, Expected, Desc).
-
-%% @spec is_greater(ValueA, ValueB, Desc) -> Result
-%%       ValueA = number()
-%%       ValueB = number()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that an integer is greater than another.
-is_greater(ValueA, ValueB, Desc) when is_integer(ValueA), is_integer(ValueB) ->
-    mk_tap(ValueA > ValueB, Desc).
-
-%% @spec any(Got, Items, Desc) -> Result
-%%       Got = any()
-%%       Items = [any()]
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that an item is in a list.
-any(Got, Items, Desc) when is_function(Got) ->
-    is(lists:any(Got, Items), true, Desc);
-any(Got, Items, Desc) ->
-    is(lists:member(Got, Items), true, Desc).
-
-%% @spec none(Got, Items, Desc) -> Result
-%%       Got = any()
-%%       Items = [any()]
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Assert that an item is not in a list.
-none(Got, Items, Desc) when is_function(Got) ->
-    is(lists:any(Got, Items), false, Desc);
-none(Got, Items, Desc) ->
-    is(lists:member(Got, Items), false, Desc).
-
-%% @spec fun_is(Fun, Expected, Desc) -> Result
-%%       Fun = function()
-%%       Expected = any()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Use an anonymous function to assert a pattern match.
-fun_is(Fun, Expected, Desc) when is_function(Fun) ->
-    is(Fun(Expected), true, Desc).
-
-%% @spec expect_fun(ExpectFun, Got, Desc) -> Result
-%%       ExpectFun = function()
-%%       Got = any()
-%%       Desc = string()
-%%       Result = true | false
-%% @doc Use an anonymous function to assert a pattern match, using actual
-%%       value as the argument to the function.
-expect_fun(ExpectFun, Got, Desc) ->
-    evaluate(ExpectFun(Got), Got, ExpectFun, Desc).
-
-%% @spec expect_fun(ExpectFun, Got, Desc, ExpectStr) -> Result
-%%       ExpectFun = function()
-%%       Got = any()
-%%       Desc = string()
-%%       ExpectStr = string()
-%%       Result = true | false
-%% @doc Use an anonymous function to assert a pattern match, using actual
-%%       value as the argument to the function.
-expect_fun(ExpectFun, Got, Desc, ExpectStr) ->
-    evaluate(ExpectFun(Got), Got, ExpectStr, Desc).
-
-%% @equiv skip(TestFun, "")
-skip(TestFun) when is_function(TestFun) ->
-    skip(TestFun, "").
-
-%% @spec skip(TestFun, Reason) -> ok
-%%       TestFun = function()
-%%       Reason = string()
-%% @doc Skip a test.
-skip(TestFun, Reason) when is_function(TestFun), is_list(Reason) ->
-    begin_skip(Reason),
-    catch TestFun(),
-    end_skip(),
-    ok.
-
-%% @spec skip(Q, TestFun, Reason) -> ok
-%%       Q = true | false | function()
-%%       TestFun = function()
-%%       Reason = string()
-%% @doc Skips a test conditionally. The first argument to this function can
-%% either be the 'true' or 'false' atoms or a function that returns 'true' or
-%% 'false'.
-skip(QFun, TestFun, Reason) when is_function(QFun), is_function(TestFun), is_list(Reason) ->
-    case QFun() of
-        true -> begin_skip(Reason), TestFun(), end_skip();
-        _ -> TestFun()
-    end,
-    ok;
-
-skip(Q, TestFun, Reason) when is_function(TestFun), is_list(Reason), Q == true ->
-    begin_skip(Reason),
-    TestFun(),
-    end_skip(),
-    ok;
-
-skip(_, TestFun, Reason) when is_function(TestFun), is_list(Reason) ->
-    TestFun(),
-    ok.
-
-%% @private
-begin_skip(Reason) ->
-    etap_server ! {self(), begin_skip, Reason}.
-
-%% @private
-end_skip() ->
-    etap_server ! {self(), end_skip}.
-
-%% @spec contains_ok(string(), string(), string()) -> true | false
-%% @doc Assert that a string is contained in another string.
-contains_ok(Source, String, Desc) ->
-    etap:isnt(
-        string:str(Source, String),
-        0,
-        Desc
-    ).
-
-%% @spec is_before(string(), string(), string(), string()) -> true | false
-%% @doc Assert that a string comes before another string within a larger body.
-is_before(Source, StringA, StringB, Desc) ->
-    etap:is_greater(
-        string:str(Source, StringB),
-        string:str(Source, StringA),
-        Desc
-    ).
-
-%% @doc Assert that a given variable is a pid.
-is_pid(Pid, Desc) when is_pid(Pid) -> etap:ok(true, Desc);
-is_pid(_, Desc) -> etap:ok(false, Desc).
-
-%% @doc Assert that a given process/pid is alive.
-is_alive(Pid, Desc) ->
-    etap:ok(erlang:is_process_alive(Pid), Desc).
-
-%% @doc Assert that the current function of a pid is a given {M, F, A} tuple.
-is_mfa(Pid, MFA, Desc) ->
-    etap:is({current_function, MFA}, erlang:process_info(Pid, current_function), Desc).
-
-%% @spec loaded_ok(atom(), string()) -> true | false
-%% @doc Assert that a module has been loaded successfully.
-loaded_ok(M, Desc) when is_atom(M) ->
-    etap:fun_is(fun({module, _}) -> true; (_) -> false end, code:load_file(M), Desc).
-
-%% @spec can_ok(atom(), atom()) -> true | false
-%% @doc Assert that a module exports a given function.
-can_ok(M, F) when is_atom(M), is_atom(F) ->
-    Matches = [X || {X, _} <- M:module_info(exports), X == F],
-    etap:ok(Matches > 0, lists:concat([M, " can ", F])).
-
-%% @spec can_ok(atom(), atom(), integer()) -> true | false
-%% @doc Assert that a module exports a given function with a given arity.
-can_ok(M, F, A) when is_atom(M); is_atom(F), is_number(A) ->
-    Matches = [X || X <- M:module_info(exports), X == {F, A}],
-    etap:ok(Matches > 0, lists:concat([M, " can ", F, "/", A])).
-
-%% @spec has_attrib(M, A) -> true | false
-%%       M = atom()
-%%       A = atom()
-%% @doc Asserts that a module has a given attribute.
-has_attrib(M, A) when is_atom(M), is_atom(A) ->
-    etap:isnt(
-        proplists:get_value(A, M:module_info(attributes), 'asdlkjasdlkads'),
-        'asdlkjasdlkads',
-        lists:concat([M, " has attribute ", A])
-    ).
-
-%% @spec has_attrib(M, A. V) -> true | false
-%%       M = atom()
-%%       A = atom()
-%%       V = any()
-%% @doc Asserts that a module has a given attribute with a given value.
-is_attrib(M, A, V) when is_atom(M) andalso is_atom(A) ->
-    etap:is(
-        proplists:get_value(A, M:module_info(attributes)),
-        [V],
-        lists:concat([M, "'s ", A, " is ", V])
-    ).
-
-%% @spec is_behavior(M, B) -> true | false
-%%       M = atom()
-%%       B = atom()
-%% @doc Asserts that a given module has a specific behavior.
-is_behaviour(M, B) when is_atom(M) andalso is_atom(B) ->
-    is_attrib(M, behaviour, B).
-
-%% @doc Assert that an exception is raised when running a given function.
-dies_ok(F, Desc) ->
-    case (catch F()) of
-        {'EXIT', _} -> etap:ok(true, Desc);
-        _ -> etap:ok(false, Desc)
-    end.
-
-%% @doc Assert that an exception is not raised when running a given function.
-lives_ok(F, Desc) ->
-    etap:is(try_this(F), success, Desc).
-
-%% @doc Assert that the exception thrown by a function matches the given exception.
-throws_ok(F, Exception, Desc) ->
-    try F() of
-        _ -> etap:ok(nok, Desc)
-    catch
-        _:E ->
-            etap:is(E, Exception, Desc)
-    end.
-
-%% @private
-%% @doc Run a function and catch any exceptions.
-try_this(F) when is_function(F, 0) ->
-    try F() of
-        _ -> success
-    catch
-        throw:E -> {throw, E};
-        error:E -> {error, E};
-        exit:E -> {exit, E}
-    end.
-
-%% @private
-%% @doc Start the etap_server process if it is not running already.
-ensure_test_server() ->
-    case whereis(etap_server) of
-        undefined ->
-            proc_lib:start(?MODULE, start_etap_server,[]);
-        _ ->
-            diag("The test server is already running.")
-    end.
-
-%% @private
-%% @doc Start the etap_server loop and register itself as the etap_server
-%% process.
-start_etap_server() ->
-    catch register(etap_server, self()),
-    proc_lib:init_ack(ok),
-    etap:test_server(#test_state{
-        planned = 0,
-        count = 0,
-        pass = 0,
-        fail = 0,
-        skip = 0,
-        skip_reason = ""
-    }).
-
-
-%% @private
-%% @doc The main etap_server receive/run loop. The etap_server receive loop
-%% responds to seven messages apperatining to failure or passing of tests.
-%% It is also used to initiate the testing process with the {_, plan, _}
-%% message that clears the current test state.
-test_server(State) ->
-    NewState = receive
-        {_From, plan, unknown} ->
-            io:format("# Current time local ~s~n", [datetime(erlang:localtime())]),
-            io:format("# Using etap version ~p~n", [ proplists:get_value(vsn, proplists:get_value(attributes, etap:module_info())) ]),
-            State#test_state{
-                planned = -1,
-                count = 0,
-                pass = 0,
-                fail = 0,
-                skip = 0,
-                skip_reason = ""
-            };
-        {_From, plan, N} ->
-            io:format("# Current time local ~s~n", [datetime(erlang:localtime())]),
-            io:format("# Using etap version ~p~n", [ proplists:get_value(vsn, proplists:get_value(attributes, etap:module_info())) ]),
-            io:format("1..~p~n", [N]),
-            State#test_state{
-                planned = N,
-                count = 0,
-                pass = 0,
-                fail = 0,
-                skip = 0,
-                skip_reason = ""
-            };
-        {_From, begin_skip, Reason} ->
-            State#test_state{
-                skip = 1,
-                skip_reason = Reason
-            };
-        {_From, end_skip} ->
-            State#test_state{
-                skip = 0,
-                skip_reason = ""
-            };
-        {_From, pass, Desc} ->
-            FullMessage = skip_diag(
-                " - " ++ Desc,
-                State#test_state.skip,
-                State#test_state.skip_reason
-            ),
-            io:format("ok ~p ~s~n", [State#test_state.count + 1, FullMessage]),
-            State#test_state{
-                count = State#test_state.count + 1,
-                pass = State#test_state.pass + 1
-            };
-
-        {_From, fail, Desc} ->
-            FullMessage = skip_diag(
-                " - " ++ Desc,
-                State#test_state.skip,
-                State#test_state.skip_reason
-            ),
-            io:format("not ok ~p ~s~n", [State#test_state.count + 1, FullMessage]),
-            State#test_state{
-                count = State#test_state.count + 1,
-                fail = State#test_state.fail + 1
-            };
-        {From, state} ->
-            From ! State,
-            State;
-        {_From, diag, Message} ->
-            io:format("~s~n", [Message]),
-            State;
-        {From, count} ->
-            From ! State#test_state.count,
-            State;
-        {From, is_skip} ->
-            From ! State#test_state.skip,
-            State;
-        done ->
-            exit(normal)
-    end,
-    test_server(NewState).
-
-%% @private
-%% @doc Process the result of a test and send it to the etap_server process.
-mk_tap(Result, Desc) ->
-    IsSkip = lib:sendw(etap_server, is_skip),
-    case [IsSkip, Result] of
-        [_, true] ->
-            etap_server ! {self(), pass, Desc},
-            true;
-        [1, _] ->
-            etap_server ! {self(), pass, Desc},
-            true;
-        _ ->
-            etap_server ! {self(), fail, Desc},
-            false
-    end.
-
-%% @private
-%% @doc Format a date/time string.
-datetime(DateTime) ->
-    {{Year, Month, Day}, {Hour, Min, Sec}} = DateTime,
-    io_lib:format("~4.10.0B-~2.10.0B-~2.10.0B ~2.10.0B:~2.10.0B:~2.10.0B", [Year, Month, Day, Hour, Min, Sec]).
-
-%% @private
-%% @doc Craft an output message taking skip/todo into consideration.
-skip_diag(Message, 0, _) ->
-    Message;
-skip_diag(_Message, 1, "") ->
-    " # SKIP";
-skip_diag(_Message, 1, Reason) ->
-    " # SKIP : " ++ Reason.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_01_yajl_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_01_yajl_tests.erl b/test/jiffy_01_yajl_tests.erl
new file mode 100644
index 0000000..b3ac13a
--- /dev/null
+++ b/test/jiffy_01_yajl_tests.erl
@@ -0,0 +1,33 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_01_yajl_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+
+
+yajl_test_() ->
+    Cases = read_cases(),
+    [gen(Case) || Case <- Cases].
+
+
+gen({Name, Json, {error, _}=Erl}) ->
+    {Name, ?_assertThrow(Erl, jiffy:decode(Json))};
+gen({Name, Json, Erl}) ->
+    {Name, ?_assertEqual(Erl, jiffy:decode(Json))}.
+
+
+read_cases() ->
+    CasesPath = filename:join(["..", "test", "cases", "*.json"]),
+    FileNames = lists:sort(filelib:wildcard(CasesPath)),
+    lists:map(fun(F) -> make_pair(F) end, FileNames).
+
+
+make_pair(FileName) ->
+    {ok, Json} = file:read_file(FileName),
+    BaseName = filename:rootname(FileName),
+    ErlFname = BaseName ++ ".eterm",
+    {ok, [Term]} = file:consult(ErlFname),
+    {filename:basename(BaseName), Json, Term}.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_02_literal_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_02_literal_tests.erl b/test/jiffy_02_literal_tests.erl
new file mode 100644
index 0000000..4c50a34
--- /dev/null
+++ b/test/jiffy_02_literal_tests.erl
@@ -0,0 +1,28 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_02_literal_tests).
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+
+
+true_test_() ->
+    {"true", [
+        {"Decode", ?_assertEqual(true, jiffy:decode(<<"true">>))},
+        {"Encode", ?_assertEqual(<<"true">>, jiffy:encode(true))}
+    ]}.
+
+
+false_test_() ->
+    {"false", [
+        {"Decode", ?_assertEqual(false, jiffy:decode(<<"false">>))},
+        {"Encode", ?_assertEqual(<<"false">>, jiffy:encode(false))}
+    ]}.
+
+
+null_test_() ->
+    {"null", [
+        {"Decode", ?_assertEqual(null, jiffy:decode(<<"null">>))},
+        {"Encode", ?_assertEqual(<<"null">>, jiffy:encode(null))}
+    ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_03_number_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_03_number_tests.erl b/test/jiffy_03_number_tests.erl
new file mode 100644
index 0000000..da69049
--- /dev/null
+++ b/test/jiffy_03_number_tests.erl
@@ -0,0 +1,134 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_03_number_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+number_success_test_() ->
+    [gen(ok, Case) || Case <- cases(ok)].
+
+
+number_failure_test_() ->
+    [gen(error, Case) || Case <- cases(error)].
+
+
+number_double_test_() ->
+    [gen(floats, Case) || Case <- cases(floats)].
+
+
+gen(ok, {J, E}) ->
+    gen(ok, {J, E, J});
+gen(ok, {J1, E, J2}) ->
+    {msg("~s", [J1]), [
+        {"Decode", ?_assertEqual(E, dec(J1))},
+        {"Encode", ?_assertEqual(J2, enc(E))}
+    ]};
+
+gen(error, J) ->
+    {msg("Error: ~s", [J]), [
+        ?_assertThrow({error, _}, dec(J))
+    ]};
+
+gen(floats, F) ->
+    NegF = -1.0 * F,
+    {msg("float round trip - ~p", [F]), [
+        {"Pos", ?_assertEqual(F, dec(enc(F)))},
+        {"Neg", ?_assertEqual(NegF, dec(enc(NegF)))}
+    ]}.
+
+
+cases(ok) ->
+    [
+        {<<"0">>, 0},
+        {<<"-0">>, 0, <<"0">>},
+        {<<"1">>, 1},
+        {<<"12">>, 12},
+        {<<"-3">>, -3},
+        {<<"1234567890123456789012345">>, 1234567890123456789012345},
+        {<<"1310050760199">>, 1310050760199},
+        {
+            <<"1234567890123456789012345.0">>,
+            1.23456789012345678e24,
+            <<"1.2345678901234568e+24">>
+        },
+        {
+            <<"1234567890123456789012345.0E3">>,
+            1.2345678901234569e27,
+            <<"1.2345678901234569e+27">>
+        },
+        {
+            <<"1234567890123456789012345012">>,
+            1234567890123456789012345012,
+            <<"1234567890123456789012345012">>
+        },
+        {<<"1.0">>, 1.0},
+        {
+            <<"0.000000000000000000000000000000000001">>,
+            1.0E-36,
+            <<"1e-36">>
+        },
+        {<<"0.75">>, 0.75},
+        {<<"2.0123456789">>, 2.0123456789, <<"2.0123456789">>},
+        {<<"2.4234324E24">>, 2.4234324E24, <<"2.4234324e+24">>},
+        {<<"-3.1416">>, -3.1416, <<"-3.1416">>},
+        {<<"1E4">>, 10000.0, <<"10000.0">>},
+        {<<"1.0E+01">>, 10.0, <<"10.0">>},
+        {<<"1e1">>, 10.0, <<"10.0">>},
+        {<<"3.0E2">>, 300.0, <<"300.0">>},
+        {<<"0E3">>, 0.0, <<"0.0">>},
+        {<<"1.5E3">>, 1500.0, <<"1500.0">>},
+        {<<"2.5E-1">>, 0.25, <<"0.25">>},
+        {<<"-0.325E+2">>, -32.5, <<"-32.5">>}
+    ];
+
+cases(error) ->
+    [
+        <<"02">>,
+        <<"-01">>,
+        <<"+12">>,
+        <<"-">>,
+        <<"1.">>,
+        <<".1">>,
+        <<"1.-1">>,
+        <<"1E">>,
+        <<"1-E2">>,
+        <<"2E +3">>,
+        <<"1EA">>
+    ];
+
+cases(floats) ->
+    [
+        0.0,
+        0.00000001,
+        0.000000012,
+        0.0000000123,
+        0.0000001,
+        0.00000012,
+        0.000000123,
+        0.000001,
+        0.00001,
+        0.01,
+        0.0123,
+        0.1,
+        0.3,
+        1.0,
+        1.0e20,
+        1.0e21,
+        9.0,
+        10.0,
+        90.0,
+        90.12,
+        10000.0,
+        12345.0,
+        12345.0e23,
+        100000.0,
+        100000000000000000000.0,
+        111111111111111111111.0,
+        1111111111111111111111.0,
+        11111111111111111111111.0
+    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_04_string_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_04_string_tests.erl b/test/jiffy_04_string_tests.erl
new file mode 100644
index 0000000..46f15ff
--- /dev/null
+++ b/test/jiffy_04_string_tests.erl
@@ -0,0 +1,147 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_04_string_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+string_success_test_() ->
+    [gen(ok, Case) || Case <- cases(ok)].
+
+
+string_uescaped_test_() ->
+    [gen(uescaped, Case) || Case <- cases(uescaped)].
+
+
+string_error_test_() ->
+    [gen(error, Case) || Case <- cases(error)].
+
+
+string_utf8_test_() ->
+    [gen(utf8, Case) || Case <- cases(utf8)].
+
+
+gen(ok, {J, E}) ->
+    gen(ok, {J, E, J});
+gen(ok, {J1, E, J2}) ->
+    {msg("ok - ~s", [J1]), [
+        {"Decode", ?_assertEqual(E, dec(J1))},
+        {"Encode", ?_assertEqual(J2, enc(E))}
+    ]};
+
+gen(uescaped, {J, E}) ->
+    {msg("uescape - ~s", [J]), [
+        {"Decode", ?_assertEqual(E, dec(J))},
+        {"Encode", ?_assertEqual(J, enc(E, [uescape]))}
+    ]};
+
+gen(error, J) ->
+    {msg("error - ~s", [J]), [
+        ?_assertThrow({error, _}, dec(J))
+    ]};
+
+gen(utf8, {Case, Fixed}) ->
+    Case2 = <<34, Case/binary, 34>>,
+    Fixed2 = <<34, Fixed/binary, 34>>,
+    {msg("UTF-8: ~s", [hex(Case)]), [
+        ?_assertThrow({error, invalid_string}, jiffy:encode(Case)),
+        ?_assertEqual(Fixed2, jiffy:encode(Case, [force_utf8])),
+        ?_assertThrow({error, {_, invalid_string}}, jiffy:decode(Case2))
+    ]}.
+
+
+cases(ok) ->
+    [
+        {<<"\"\"">>, <<"">>},
+        {<<"\"/\"">>, <<"/">>},
+        {<<"\"0\"">>, <<"0">>},
+        {<<"\"foo\"">>, <<"foo">>},
+        {<<"\"\\\"foobar\\\"\"">>, <<"\"foobar\"">>},
+        {<<"\"\\n\\n\\n\"">>, <<"\n\n\n">>},
+        {<<"\"\\\" \\b\\f\\r\\n\\t\\\"\"">>, <<"\" \b\f\r\n\t\"">>},
+        {<<"\"foo\\u0005bar\"">>, <<"foo", 5, "bar">>},
+        {
+            <<"\"\\uD834\\uDD1E\"">>,
+            <<240, 157, 132, 158>>,
+            <<34, 240, 157, 132, 158, 34>>
+        },
+        {<<"\"\\uFFFF\"">>, <<239,191,191>>, <<34,239,191,191,34>>},
+        {<<"\"\\uFFFE\"">>, <<239,191,190>>, <<34,239,191,190,34>>}
+    ];
+
+cases(uescaped) ->
+    [
+        {
+            <<"\"\\u8CA8\\u5481\\u3002\\u0091\\u0091\"">>,
+            <<232,178,168,229,146,129,227,128,130,194,145,194,145>>
+        },
+        {
+            <<"\"\\uD834\\uDD1E\"">>,
+            <<240, 157, 132, 158>>
+        },
+        {
+            <<"\"\\uD83D\\uDE0A\"">>,
+            <<240, 159, 152, 138>>
+        }
+    ];
+
+cases(error) ->
+    [
+        "\"",
+        <<"\"foo">>,
+        <<"\"", 0, "\"">>,
+        <<"\"\\g\"">>,
+        <<"\"\\uD834foo\\uDD1E\"">>,
+        % CouchDB-345
+        <<34,78,69,73,77,69,78,32,70,216,82,82,32,70,65,69,78,33,34>>
+    ];
+
+cases(utf8) ->
+    [
+        % Stray continuation byte
+        {<<16#C2, 16#81, 16#80>>, <<16#C2, 16#81, 16#EF, 16#BF, 16#BD>>},
+        {<<"foo", 16#80, "bar">>, <<"foo", 16#EF, 16#BF, 16#BD, "bar">>},
+
+        % Not enough extension bytes
+        {<<16#C0>>, <<16#EF, 16#BF, 16#BD>>},
+
+        {<<16#E0>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#E0, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+
+        {<<16#F0>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#F0, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#F0, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+
+        {<<16#F8>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#F8, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#F8, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#F8, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+
+        {<<16#FC>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#FC, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#FC, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#FC, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#FC, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+
+        % No data in high bits.
+        {<<16#C0, 16#80>>, <<"\\u0000">>},
+        {<<16#C1, 16#80>>, <<"@">>},
+
+        {<<16#E0, 16#80, 16#80>>, <<"\\u0000">>},
+        {<<16#E0, 16#90, 16#80>>, <<16#D0, 16#80>>},
+
+        {<<16#F0, 16#80, 16#80, 16#80>>, <<"\\u0000">>},
+        {<<16#F0, 16#88, 16#80, 16#80>>, <<16#E8, 16#80, 16#80>>},
+
+        % UTF-8-like sequenecs of greater than 4 bytes
+        % aren't valid and are replaced with a single
+        % replacement 0xFFFD character.
+        {<<16#F8, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#F8, 16#84, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#FC, 16#80, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
+        {<<16#FC, 16#82, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>}
+    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_05_array_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_05_array_tests.erl b/test/jiffy_05_array_tests.erl
new file mode 100644
index 0000000..6e9b717
--- /dev/null
+++ b/test/jiffy_05_array_tests.erl
@@ -0,0 +1,56 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_05_array_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+array_success_test_() ->
+    [gen(ok, Case) || Case <- cases(ok)].
+
+
+array_failure_test_() ->
+    [gen(error, Case) || Case <- cases(error)].
+
+
+gen(ok, {J, E}) ->
+    gen(ok, {J, E, J});
+gen(ok, {J1, E, J2}) ->
+    {msg("~s", [J1]), [
+        {"Decode", ?_assertEqual(E, dec(J1))},
+        {"Encode", ?_assertEqual(J2, enc(E))}
+    ]};
+
+gen(error, J) ->
+    {msg("Error: ~s", [J]), [
+        ?_assertThrow({error, _}, dec(J))
+    ]}.
+
+
+cases(ok) ->
+    [
+        {<<"[]">>, []},
+        {<<"[\t[\n]\r]">>, [[]], <<"[[]]">>},
+        {<<"[\t123, \r true\n]">>, [123, true], <<"[123,true]">>},
+        {<<"[1,\"foo\"]">>, [1, <<"foo">>]},
+        {<<"[11993444355.0,1]">>, [11993444355.0,1]},
+        {
+            <<"[\"\\u00A1\",\"\\u00FC\"]">>,
+            [<<194, 161>>, <<195, 188>>],
+            <<"[\"", 194, 161, "\",\"", 195, 188, "\"]">>
+        }
+    ];
+
+cases(error) ->
+    [
+        <<"[">>,
+        <<"]">>,
+        <<"[,]">>,
+        <<"[123">>,
+        <<"[123,]">>,
+        <<"[32 true]">>
+    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_06_object_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_06_object_tests.erl b/test/jiffy_06_object_tests.erl
new file mode 100644
index 0000000..7aec347
--- /dev/null
+++ b/test/jiffy_06_object_tests.erl
@@ -0,0 +1,56 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_06_object_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+object_success_test_() ->
+    [gen(ok, Case) || Case <- cases(ok)].
+
+
+object_failure_test_() ->
+    [gen(error, Case) || Case <- cases(error)].
+
+
+gen(ok, {J, E}) ->
+    gen(ok, {J, E, J});
+gen(ok, {J1, E, J2}) ->
+    {msg("~s", [J1]), [
+        {"Decode", ?_assertEqual(E, dec(J1))},
+        {"Encode", ?_assertEqual(J2, enc(E))}
+    ]};
+
+gen(error, J) ->
+    {msg("Error: ~s", [J]), [
+        ?_assertThrow({error, _}, dec(J))
+    ]}.
+
+
+cases(ok) ->
+    [
+        {<<"{}">>, {[]}},
+        {<<"{\"foo\": \"bar\"}">>,
+            {[{<<"foo">>, <<"bar">>}]},
+            <<"{\"foo\":\"bar\"}">>},
+        {<<"\n\n{\"foo\":\r \"bar\",\n \"baz\"\t: 123 }">>,
+            {[{<<"foo">>, <<"bar">>}, {<<"baz">>, 123}]},
+            <<"{\"foo\":\"bar\",\"baz\":123}">>}
+    ];
+
+cases(error) ->
+    [
+        <<"{">>,
+        <<"{,}">>,
+        <<"{123:true}">>,
+        <<"{false:123}">>,
+        <<"{:\"stuff\"}">>,
+        <<"{\"key\":}">>,
+        <<"{\"key\": 123">>,
+        <<"{\"key\": 123 true">>,
+        <<"{\"key\": 123,}">>
+    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_07_compound_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_07_compound_tests.erl b/test/jiffy_07_compound_tests.erl
new file mode 100644
index 0000000..7a968ab
--- /dev/null
+++ b/test/jiffy_07_compound_tests.erl
@@ -0,0 +1,61 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_07_compound_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+compound_success_test_() ->
+    [gen(ok, Case) || Case <- cases(ok)].
+
+
+compound_failure_test_() ->
+    [gen(error, Case) || Case <- cases(error)].
+
+
+gen(ok, {J, E}) ->
+    gen(ok, {J, E, J});
+gen(ok, {J1, E, J2}) ->
+    {msg("~s", [J1]), [
+        {"Decode", ?_assertEqual(E, dec(J1))},
+        {"Encode", ?_assertEqual(J2, enc(E))}
+    ]};
+
+gen(error, J) ->
+    {msg("Error: ~s", [J]), [
+        ?_assertThrow({error, _}, dec(J))
+    ]}.
+
+
+cases(ok) ->
+    [
+        {<<"[{}]">>, [{[]}]},
+        {<<"{\"foo\":[123]}">>, {[{<<"foo">>, [123]}]}},
+        {<<"{\"foo\":{\"bar\":true}}">>,
+            {[{<<"foo">>, {[{<<"bar">>, true}]} }]} },
+        {<<"{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}">>,
+            {[
+                {<<"foo">>, []},
+                {<<"bar">>, {[{<<"baz">>, true}]}},
+                {<<"alice">>, <<"bob">>}
+            ]}
+        },
+        {<<"[-123,\"foo\",{\"bar\":[]},null]">>,
+            [
+                -123,
+                <<"foo">>,
+                {[{<<"bar">>, []}]},
+                null
+            ]
+        }
+    ];
+
+cases(error) ->
+    [
+        <<"[{}">>,
+        <<"}]">>
+    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_08_halfword_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_08_halfword_tests.erl b/test/jiffy_08_halfword_tests.erl
new file mode 100644
index 0000000..e18cd93
--- /dev/null
+++ b/test/jiffy_08_halfword_tests.erl
@@ -0,0 +1,16 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_08_halfword_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+numerical_identity_test_() ->
+    [
+        {"1 == 1", ?_assert(jiffy:decode(<<"1">>) == 1)},
+        {"1 =:= 1", ?_assert(jiffy:decode(<<"1">>) =:= 1)}
+    ].


[32/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge pull request #92 from emfa/master

Changed pos to unsigned int to prevent warning from happening.

Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/446e284b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/446e284b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/446e284b

Branch: refs/heads/master
Commit: 446e284bd51013fe2899803b9dcbd162d8b8efb3
Parents: 5d5cfe4 587f143
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri May 29 14:35:26 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri May 29 14:35:26 2015 -0500

----------------------------------------------------------------------
 c_src/double-conversion/bignum.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[28/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge pull request #78 from tuncer/rebar.config-windows

rebar.config: fix Windows support (CFLAGS, CXXFLAGS)

Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/801f9e72
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/801f9e72
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/801f9e72

Branch: refs/heads/master
Commit: 801f9e72995eb72b303018885137ad8afbf1fb2b
Parents: 137d3d9 f92793a
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Feb 3 14:00:12 2015 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Feb 3 14:00:12 2015 -0600

----------------------------------------------------------------------
 rebar.config | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[34/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add an option to escape forward slashes

This brings back escaping forward slashes as an option during encoding.
Default is still not to escape.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/1784ca2a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/1784ca2a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/1784ca2a

Branch: refs/heads/master
Commit: 1784ca2ab567a3b52b8916565bb41db716c2b9ca
Parents: cd1b263
Author: Jeremie Lasalle Ratelle <je...@gmail.com>
Authored: Wed May 20 18:20:17 2015 -0400
Committer: Jeremie Lasalle Ratelle <je...@gmail.com>
Committed: Wed Jul 15 13:56:51 2015 -0400

----------------------------------------------------------------------
 c_src/encoder.c                | 17 +++++++++++++++++
 c_src/jiffy.c                  |  1 +
 c_src/jiffy.h                  |  1 +
 test/jiffy_04_string_tests.erl | 14 +++++++++++++-
 4 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/1784ca2a/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index 471cfcc..59b1b52 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -34,6 +34,7 @@ typedef struct {
     int             uescape;
     int             pretty;
     int             use_nil;
+    int             escape_forward_slashes;
 
     int             shiftcnt;
     int             count;
@@ -77,6 +78,7 @@ enc_new(ErlNifEnv* env)
     e->uescape = 0;
     e->pretty = 0;
     e->use_nil = 0;
+    e->escape_forward_slashes = 0;
     e->shiftcnt = 0;
     e->count = 0;
 
@@ -281,6 +283,12 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
                 esc_extra += 1;
                 i++;
                 continue;
+            case '/':
+                if(e->escape_forward_slashes) {
+                    esc_extra += 1;
+                    i++;
+                    continue;
+                }
             default:
                 if(data[i] < 0x20) {
                     esc_extra += 5;
@@ -348,6 +356,13 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
                 e->p[e->i++] = 't';
                 i++;
                 continue;
+            case '/':
+                if(e->escape_forward_slashes) {
+                    e->p[e->i++] = '\\';
+                    e->u[e->i++] = data[i];
+                    i++;
+                    continue;
+                }
             default:
                 if(data[i] < 0x20) {
                     ulen = unicode_uescape(data[i], &(e->p[e->i]));
@@ -591,6 +606,8 @@ encode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             e->uescape = 1;
         } else if(enif_compare(val, e->atoms->atom_pretty) == 0) {
             e->pretty = 1;
+        } else if(enif_compare(val, e->atoms->atom_escape_forward_slashes) == 0) {
+            e->escape_forward_slashes = 1;
         } else if(enif_compare(val, e->atoms->atom_use_nil) == 0) {
             e->use_nil = 1;
         } else if(enif_compare(val, e->atoms->atom_force_utf8) == 0) {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/1784ca2a/c_src/jiffy.c
----------------------------------------------------------------------
diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index c18a111..9048f5e 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -29,6 +29,7 @@ load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
     st->atom_nil = make_atom(env, "nil");
     st->atom_use_nil = make_atom(env, "use_nil");
     st->atom_null_term = make_atom(env, "null_term");
+    st->atom_escape_forward_slashes = make_atom(env, "escape_forward_slashes");
 
     // Markers used in encoding
     st->ref_object = make_atom(env, "$object_ref$");

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/1784ca2a/c_src/jiffy.h
----------------------------------------------------------------------
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index ecad9da..7a2b7d5 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -31,6 +31,7 @@ typedef struct {
     ERL_NIF_TERM    atom_nil;
     ERL_NIF_TERM    atom_use_nil;
     ERL_NIF_TERM    atom_null_term;
+    ERL_NIF_TERM    atom_escape_forward_slashes;
 
     ERL_NIF_TERM    ref_object;
     ERL_NIF_TERM    ref_array;

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/1784ca2a/test/jiffy_04_string_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_04_string_tests.erl b/test/jiffy_04_string_tests.erl
index f2136d8..0d642d5 100644
--- a/test/jiffy_04_string_tests.erl
+++ b/test/jiffy_04_string_tests.erl
@@ -23,6 +23,8 @@ string_error_test_() ->
 string_utf8_test_() ->
     [gen(utf8, Case) || Case <- cases(utf8)].
 
+string_escaped_slashes_test_() ->
+    [gen(escaped_slashes, Case) || Case <- cases(escaped_slashes)].
 
 gen(ok, {J, E}) ->
     gen(ok, {J, E, J});
@@ -50,8 +52,13 @@ gen(utf8, {Case, Fixed}) ->
         ?_assertThrow({error, {invalid_string, _}}, jiffy:encode(Case)),
         ?_assertEqual(Fixed2, jiffy:encode(Case, [force_utf8])),
         ?_assertThrow({error, {_, invalid_string}}, jiffy:decode(Case2))
-    ]}.
+    ]};
 
+gen(escaped_slashes, {J, E}) ->
+    {msg("escaped_slashes - ~s", [J]), [
+        {"Decode", ?_assertEqual(E, dec(J))},
+        {"Encode", ?_assertEqual(J, enc(E, [escape_forward_slashes]))}
+    ]}.
 
 cases(ok) ->
     [
@@ -143,4 +150,9 @@ cases(utf8) ->
         {<<16#F8, 16#84, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
         {<<16#FC, 16#80, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
         {<<16#FC, 16#82, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>}
+    ];
+
+cases(escaped_slashes) ->
+    [
+        {<<"\"\\/\"">>, <<"/">>}
     ].


[39/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Squash to new double-conversion


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/43d9516b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/43d9516b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/43d9516b

Branch: refs/heads/master
Commit: 43d9516bfcb54919cfd3eb89360448bdcc1c583f
Parents: 3458b79
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:44:18 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:44:18 2015 -0500

----------------------------------------------------------------------
 rebar.config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/43d9516b/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
index 3d725b6..76c5806 100644
--- a/rebar.config
+++ b/rebar.config
@@ -8,9 +8,9 @@
 
 {port_env, [
     {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
-        "CFLAGS", "$CFLAGS -g -Wall -Werror -O3 -fno-strict-aliasing"},
+        "CFLAGS", "$CFLAGS -Ic_src/ -g -Wall -Werror -O3 -fno-strict-aliasing"},
     {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
-        "CXXFLAGS", "$CXXFLAGS -g -Wall -Werror -O3"},
+        "CXXFLAGS", "$CXXFLAGS -Ic_src/ -g -Wall -Werror -O3"},
 
     {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
         "LDFLAGS", "$LDFLAGS -lstdc++"},


[54/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge branch 'upstream-merge'


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/ef77de4a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/ef77de4a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/ef77de4a

Branch: refs/heads/master
Commit: ef77de4aa93a1c334113e3583a5594539a002524
Parents: dc451c9 0f7708a
Author: Alexander Shorin <kx...@apache.org>
Authored: Wed Jul 29 01:41:56 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Wed Jul 29 01:41:56 2015 +0300

----------------------------------------------------------------------
 .gitignore                                   |    2 +
 .travis.yml                                  |   17 +
 Makefile                                     |   10 +-
 README.md                                    |   68 +-
 c_src/decoder.c                              |  214 +-
 c_src/double-conversion/AUTHORS              |    2 +
 c_src/double-conversion/DOWNLOADED           |    3 -
 c_src/double-conversion/README               |   45 +-
 c_src/double-conversion/VERSION              |    2 +
 c_src/double-conversion/bignum-dtoa.cc       |   11 +-
 c_src/double-conversion/bignum-dtoa.h        |    2 +-
 c_src/double-conversion/bignum.cc            |   28 +-
 c_src/double-conversion/bignum.h             |    3 +-
 c_src/double-conversion/cached-powers.cc     |    3 +-
 c_src/double-conversion/diy-fp.cc            |    4 +-
 c_src/double-conversion/diy-fp.h             |   24 +-
 c_src/double-conversion/double-conversion.cc |  221 +-
 c_src/double-conversion/double-conversion.h  |   35 +-
 c_src/double-conversion/fast-dtoa.cc         |   21 +-
 c_src/double-conversion/fast-dtoa.h          |    2 +-
 c_src/double-conversion/fixed-dtoa.cc        |   12 +-
 c_src/double-conversion/fixed-dtoa.h         |    2 +-
 c_src/double-conversion/ieee.h               |    4 +
 c_src/double-conversion/strtod.cc            |    5 +-
 c_src/double-conversion/strtod.h             |    2 +-
 c_src/double-conversion/utils.h              |   43 +-
 c_src/encoder.c                              |  276 +-
 c_src/jiffy.c                                |   33 +-
 c_src/jiffy.h                                |   34 +-
 c_src/utf8.c                                 |   34 +-
 c_src/util.c                                 |  115 +
 plugins/rebar_gdb_plugin.erl                 |   13 +
 rebar.config                                 |   13 +-
 rebar.config.script                          |   16 +-
 src/jiffy.app.src                            |    2 +-
 src/jiffy.erl                                |  129 +-
 src/jiffy_utf8.erl                           |   12 +
 test/001-yajl-tests.t                        |   30 -
 test/002-literals.t                          |   21 -
 test/003-numbers.t                           |  118 -
 test/004-strings.t                           |  127 -
 test/005-arrays.t                            |   36 -
 test/006-maps.t                              |   36 -
 test/007-compound.t                          |   41 -
 test/008-halfword.t                          |   15 -
 test/009-reg-issue-24.t                      | 3459 --------------------
 test/010-short-doubles.t                     |   29 -
 test/cases/doubles.eterm                     |    2 +-
 test/etap.erl                                |  612 ----
 test/jiffy_01_yajl_tests.erl                 |   32 +
 test/jiffy_02_literal_tests.erl              |   44 +
 test/jiffy_03_number_tests.erl               |  133 +
 test/jiffy_04_string_tests.erl               |  158 +
 test/jiffy_05_array_tests.erl                |   55 +
 test/jiffy_06_object_tests.erl               |   55 +
 test/jiffy_07_compound_tests.erl             |   60 +
 test/jiffy_08_halfword_tests.erl             |   15 +
 test/jiffy_09_reg_issue_24_tests.erl         | 3461 +++++++++++++++++++++
 test/jiffy_10_short_double_tests.erl         |   33 +
 test/jiffy_11_proper_tests.erl               |  185 ++
 test/jiffy_12_error_tests.erl                |   87 +
 test/jiffy_13_whitespace_tests.erl           |   16 +
 test/jiffy_15_return_trailer_tests.erl       |   19 +
 test/jiffy_tests.erl                         |  135 -
 test/jiffy_util.hrl                          |   27 +
 test/util.erl                                |   44 -
 66 files changed, 5552 insertions(+), 4995 deletions(-)
----------------------------------------------------------------------



[31/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Changed pos to unsigned int to prevent warning from happening.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/587f143e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/587f143e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/587f143e

Branch: refs/heads/master
Commit: 587f143e279ff586d90df31ea5e1c934cdde2e99
Parents: 5d5cfe4
Author: Emil Falk <em...@textalk.se>
Authored: Fri May 29 16:03:31 2015 +0200
Committer: Emil Falk <em...@textalk.se>
Committed: Fri May 29 16:03:31 2015 +0200

----------------------------------------------------------------------
 c_src/double-conversion/bignum.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/587f143e/c_src/double-conversion/bignum.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/bignum.cc b/c_src/double-conversion/bignum.cc
index 747491a..3c88303 100644
--- a/c_src/double-conversion/bignum.cc
+++ b/c_src/double-conversion/bignum.cc
@@ -103,7 +103,7 @@ void Bignum::AssignDecimalString(Vector<const char> value) {
   const int kMaxUint64DecimalDigits = 19;
   Zero();
   int length = value.length();
-  int pos = 0;
+  unsigned int pos = 0;
   // Let's just say that each digit needs 4 bits.
   while (length >= kMaxUint64DecimalDigits) {
     uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);


[18/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add compile option no_native


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/79f1dd17
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/79f1dd17
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/79f1dd17

Branch: refs/heads/master
Commit: 79f1dd17259b71e3af2263d602099d8b1be2eba1
Parents: 99867af
Author: Louis-Philippe Gauthier <lp...@gmail.com>
Authored: Tue Jul 15 20:43:33 2014 -0400
Committer: Louis-Philippe Gauthier <lp...@gmail.com>
Committed: Tue Jul 15 20:43:33 2014 -0400

----------------------------------------------------------------------
 src/jiffy.erl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/79f1dd17/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 8903831..6f63982 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -5,6 +5,8 @@
 -export([decode/1, decode/2, encode/1, encode/2]).
 -define(NOT_LOADED, not_loaded(?LINE)).
 
+-compile([no_native]).
+
 -on_load(init/0).
 
 


[13/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Include documentation on the maps feature


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/c45f312b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/c45f312b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/c45f312b

Branch: refs/heads/master
Commit: c45f312b501961eb2167973f0e74ce9faad8b656
Parents: eb70deb
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:52:32 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:52:32 2014 -0500

----------------------------------------------------------------------
 README.md | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/c45f312b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 15b2ee3..a609b77 100644
--- a/README.md
+++ b/README.md
@@ -39,6 +39,9 @@ The options for decode are:
 * `{bytes_per_iter, N}` where N &gt;= 0 - This controls the number of
   bytes that Jiffy will process before yielding back to the VM. The
   mechanics of this yield are completely hidden from the end user.
+* `return_maps` - Tell Jiffy to return objects using the maps data type
+  on VMs that support it. This raises an error on VMs that don't support
+  maps.
 
 `jiffy:encode/1,2`
 ------------------
@@ -79,6 +82,11 @@ Data Format
     {[]}                       -> {}             -> {[]}
     {[{foo, bar}]}             -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]}
     {[{<<"foo">>, <<"bar">>}]} -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]}
+    #{<<"foo">> => <<"bar">>}  -> {"foo": "bar"} -> #{<<"foo">> -> <<"bar">>}
+
+N.B. The last entry in this table is only valid for VM's that support
+the `maps` data type (i.e., 17.0 and newer) and client code must pass
+the `return_maps` option to `jiffy:decode/2`.
 
 Improvements over EEP0018
 -------------------------


[23/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Remove unnecessary inclusion of proper.hrl


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/b6afb141
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/b6afb141
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/b6afb141

Branch: refs/heads/master
Commit: b6afb1414e10edd5c579bf4affbde0e5b7d85737
Parents: 5cd89c1
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Sep 19 14:28:55 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Sep 19 14:28:55 2014 -0500

----------------------------------------------------------------------
 test/jiffy_01_yajl_tests.erl         | 1 -
 test/jiffy_02_literal_tests.erl      | 1 -
 test/jiffy_03_number_tests.erl       | 1 -
 test/jiffy_04_string_tests.erl       | 1 -
 test/jiffy_05_array_tests.erl        | 1 -
 test/jiffy_06_object_tests.erl       | 1 -
 test/jiffy_07_compound_tests.erl     | 1 -
 test/jiffy_08_halfword_tests.erl     | 1 -
 test/jiffy_09_reg_issue_24_tests.erl | 1 -
 test/jiffy_10_short_double_tests.erl | 1 -
 10 files changed, 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_01_yajl_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_01_yajl_tests.erl b/test/jiffy_01_yajl_tests.erl
index b3ac13a..aedaf71 100644
--- a/test/jiffy_01_yajl_tests.erl
+++ b/test/jiffy_01_yajl_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_01_yajl_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_02_literal_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_02_literal_tests.erl b/test/jiffy_02_literal_tests.erl
index a5ff576..98b163c 100644
--- a/test/jiffy_02_literal_tests.erl
+++ b/test/jiffy_02_literal_tests.erl
@@ -3,7 +3,6 @@
 
 -module(jiffy_02_literal_tests).
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_03_number_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_03_number_tests.erl b/test/jiffy_03_number_tests.erl
index da69049..ac7b95f 100644
--- a/test/jiffy_03_number_tests.erl
+++ b/test/jiffy_03_number_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_03_number_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_04_string_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_04_string_tests.erl b/test/jiffy_04_string_tests.erl
index 7238f7c..f2136d8 100644
--- a/test/jiffy_04_string_tests.erl
+++ b/test/jiffy_04_string_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_04_string_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_05_array_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_05_array_tests.erl b/test/jiffy_05_array_tests.erl
index 6e9b717..dcad7ec 100644
--- a/test/jiffy_05_array_tests.erl
+++ b/test/jiffy_05_array_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_05_array_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_06_object_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_06_object_tests.erl b/test/jiffy_06_object_tests.erl
index 7aec347..6e8834e 100644
--- a/test/jiffy_06_object_tests.erl
+++ b/test/jiffy_06_object_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_06_object_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_07_compound_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_07_compound_tests.erl b/test/jiffy_07_compound_tests.erl
index 7a968ab..7a811db 100644
--- a/test/jiffy_07_compound_tests.erl
+++ b/test/jiffy_07_compound_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_07_compound_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_08_halfword_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_08_halfword_tests.erl b/test/jiffy_08_halfword_tests.erl
index e18cd93..c30739e 100644
--- a/test/jiffy_08_halfword_tests.erl
+++ b/test/jiffy_08_halfword_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_08_halfword_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_09_reg_issue_24_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_09_reg_issue_24_tests.erl b/test/jiffy_09_reg_issue_24_tests.erl
index ca72d1b..2f3482f 100644
--- a/test/jiffy_09_reg_issue_24_tests.erl
+++ b/test/jiffy_09_reg_issue_24_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_09_reg_issue_24_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b6afb141/test/jiffy_10_short_double_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_10_short_double_tests.erl b/test/jiffy_10_short_double_tests.erl
index 56272fe..d66e1ea 100644
--- a/test/jiffy_10_short_double_tests.erl
+++ b/test/jiffy_10_short_double_tests.erl
@@ -4,7 +4,6 @@
 -module(jiffy_10_short_double_tests).
 
 
--include_lib("proper/include/proper.hrl").
 -include_lib("eunit/include/eunit.hrl").
 -include("jiffy_util.hrl").
 


[52/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Remove related path to rebar


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/1e291d04
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/1e291d04
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/1e291d04

Branch: refs/heads/master
Commit: 1e291d04a50c3b19bf92b2ac3788f234d31cb885
Parents: 011893b
Author: Alexander Shorin <kx...@apache.org>
Authored: Sat Jul 25 15:50:47 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Sat Jul 25 15:50:47 2015 +0300

----------------------------------------------------------------------
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/1e291d04/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 025486e..1b9e6e1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-REBAR?=./rebar
+REBAR?=rebar
 
 
 all: build


[43/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Revamp yields back to Erlang

In the original PR for `return_trailer` @vlm pointed out that I wasn't
using enif_consume_timeslice correctly. This fixes that by changing out
its called.

Previously we attempted to define the total number of bytes to decode or
encode in a single NIF call and then would consume as much of the
timeslice as we processed. This is wrong because we may start the NIF
call with less than an entire timeslice left.

The new approach is to define the number of bytes to encode or decode
per reduction and then iteratively call enif_consume_timeslice until it
indicates that we should return.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/454928ff
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/454928ff
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/454928ff

Branch: refs/heads/master
Commit: 454928ff3435721a5e4bbda5e80df9f3931cb6ff
Parents: 6d2278e
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 17:00:42 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 18:40:27 2015 -0500

----------------------------------------------------------------------
 README.md       | 14 +++++++-----
 c_src/decoder.c | 19 +++++++++-------
 c_src/encoder.c | 22 +++++++++----------
 c_src/jiffy.h   |  7 +++---
 c_src/util.c    | 62 ++++++++++++++++++++++++++++++++++------------------
 src/jiffy.erl   |  6 +++--
 6 files changed, 79 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/454928ff/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index f354ecf..2fe68ed 100644
--- a/README.md
+++ b/README.md
@@ -36,9 +36,6 @@ Errors are raised as exceptions.
 
 The options for decode are:
 
-* `{bytes_per_iter, N}` where N &gt;= 0 - This controls the number of
-  bytes that Jiffy will process before yielding back to the VM. The
-  mechanics of this yield are completely hidden from the end user.
 * `return_maps` - Tell Jiffy to return objects using the maps data type
   on VMs that support it. This raises an error on VMs that don't support
   maps.
@@ -51,6 +48,12 @@ The options for decode are:
   JSON term is decoded the return value of decode/2 becomes
   `{has_trailer, FirstTerm, RestData::iodata()}`. This is useful to
   decode multiple terms in a single binary.
+* `{bytes_per_red, N}` where N &gt;= 0 - This controls the number of
+  bytes that Jiffy will process as an equivalent to a reduction. Each
+  20 reductions we consume 1% of our allocated time slice for the current
+  process. When the Erlang VM indicates we need to return from the NIF.
+* `{bytes_per_iter, N}` where N &gt;= 0 - Backwards compatible option
+  that is converted into the `bytes_per_red` value.
 
 `jiffy:encode/1,2`
 ------------------
@@ -68,11 +71,10 @@ The options for encode are:
 * `force_utf8` - Force strings to encode as UTF-8 by fixing broken
   surrogate pairs and/or using the replacement character to remove
   broken UTF-8 sequences in data.
-* `{bytes_per_iter, N}` where N &gt;= 0 - This controls the number of
-  bytes that Jiffy will generate before yielding back to the VM. The
-  mechanics of this yield are completely hidden from the end user.
 * `escape_forward_slashes` - Escapes the `/` character which can be
   useful when encoding URLs in some cases.
+* `{bytes_per_red, N}` - Refer to the decode options
+* `{bytes_per_iter, N}` - Refer to the decode options
 
 Data Format
 -----------

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/454928ff/c_src/decoder.c
----------------------------------------------------------------------
diff --git a/c_src/decoder.c b/c_src/decoder.c
index 60b3257..12debb6 100644
--- a/c_src/decoder.c
+++ b/c_src/decoder.c
@@ -49,7 +49,7 @@ typedef struct {
     ERL_NIF_TERM    arg;
     ErlNifBinary    bin;
 
-    size_t          bytes_per_iter;
+    size_t          bytes_per_red;
     int             is_partial;
     int             return_maps;
     int             return_trailer;
@@ -78,7 +78,7 @@ dec_new(ErlNifEnv* env)
 
     d->atoms = st;
 
-    d->bytes_per_iter = DEFAULT_BYTES_PER_ITER;
+    d->bytes_per_red = DEFAULT_BYTES_PER_REDUCTION;
     d->is_partial = 0;
     d->return_maps = 0;
     d->return_trailer = 0;
@@ -704,7 +704,9 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
     }
 
     while(enif_get_list_cell(env, opts, &val, &opts)) {
-        if(get_bytes_per_iter(env, val, &(d->bytes_per_iter))) {
+        if(get_bytes_per_iter(env, val, &(d->bytes_per_red))) {
+            continue;
+        } else if(get_bytes_per_red(env, val, &(d->bytes_per_red))) {
             continue;
         } else if(enif_compare(val, d->atoms->atom_return_maps) == 0) {
 #if MAP_TYPE_PRESENT
@@ -739,7 +741,7 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
     ERL_NIF_TERM val = argv[2];
     ERL_NIF_TERM trailer;
     ERL_NIF_TERM ret;
-    size_t start;
+    size_t bytes_read = 0;
 
     if(argc != 5) {
         return enif_make_badarg(env);
@@ -758,11 +760,10 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
     curr = argv[4];
 
     //fprintf(stderr, "Parsing:\r\n");
-    start = d->i;
     while(d->i < bin.size) {
         //fprintf(stderr, "state: %d\r\n", dec_curr(d));
-        if(should_yield(d->i - start, d->bytes_per_iter)) {
-            consume_timeslice(env, d->i - start, d->bytes_per_iter);
+
+        if(should_yield(env, &bytes_read, d->bytes_per_red)) {
             return enif_make_tuple5(
                     env,
                     st->atom_iter,
@@ -772,6 +773,9 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                     curr
                 );
         }
+
+        bytes_read += 1;
+
         switch(dec_curr(d)) {
             case st_value:
                 switch(d->p[d->i]) {
@@ -1064,6 +1068,5 @@ decode_done:
     }
 
 done:
-    consume_timeslice(env, d->i - start, d->bytes_per_iter);
     return ret;
 }

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/454928ff/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index 59b1b52..4a96048 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -29,7 +29,7 @@ typedef struct {
     ErlNifEnv*      env;
     jiffy_st*       atoms;
 
-    size_t          bytes_per_iter;
+    size_t          bytes_per_red;
 
     int             uescape;
     int             pretty;
@@ -74,7 +74,7 @@ enc_new(ErlNifEnv* env)
     Encoder* e = enif_alloc_resource(st->res_enc, sizeof(Encoder));
 
     e->atoms = st;
-    e->bytes_per_iter = DEFAULT_BYTES_PER_ITER;
+    e->bytes_per_red = DEFAULT_BYTES_PER_REDUCTION;
     e->uescape = 0;
     e->pretty = 0;
     e->use_nil = 0;
@@ -200,7 +200,7 @@ enc_unknown(Encoder* e, ERL_NIF_TERM value)
 
     e->iolist = enif_make_list_cell(e->env, value, e->iolist);
     e->iolen++;
-    
+
     // Track the total number of bytes produced before
     // splitting our IO buffer. We add 16 to this value
     // as a rough estimate of the number of bytes that
@@ -221,7 +221,7 @@ enc_unknown(Encoder* e, ERL_NIF_TERM value)
 
         e->p = (char*) e->curr->data;
         e->u = (unsigned char*) e->curr->data;
-        e->i = 0;        
+        e->i = 0;
     }
 
     return 1;
@@ -612,7 +612,9 @@ encode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             e->use_nil = 1;
         } else if(enif_compare(val, e->atoms->atom_force_utf8) == 0) {
             // Ignore, handled in Erlang
-        } else if(get_bytes_per_iter(env, val, &(e->bytes_per_iter))) {
+        } else if(get_bytes_per_iter(env, val, &(e->bytes_per_red))) {
+            continue;
+        } else if(get_bytes_per_red(env, val, &(e->bytes_per_red))) {
             continue;
         } else {
             return enif_make_badarg(env);
@@ -639,7 +641,7 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
     double dval;
 
     size_t start;
-    size_t processed;
+    size_t bytes_written = 0;
 
     if(argc != 3) {
         return enif_make_badarg(env);
@@ -662,9 +664,9 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 
     while(!enif_is_empty_list(env, stack)) {
 
-        processed = (e->iosize + e->i) - start;
-        if(should_yield(processed, e->bytes_per_iter)) {
-            consume_timeslice(env, processed, e->bytes_per_iter);
+        bytes_written += (e->iosize + e->i) - start;
+
+        if(should_yield(env, &bytes_written, e->bytes_per_red)) {
             return enif_make_tuple4(
                     env,
                     st->atom_iter,
@@ -870,8 +872,6 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
     }
 
 done:
-    processed = (e->iosize + e->i) - start;
-    consume_timeslice(env, processed, e->bytes_per_iter);
 
     return ret;
 }

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/454928ff/c_src/jiffy.h
----------------------------------------------------------------------
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index 61c7b70..abe5154 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -6,7 +6,8 @@
 
 #include "erl_nif.h"
 
-#define DEFAULT_BYTES_PER_ITER 2048
+#define DEFAULT_BYTES_PER_REDUCTION 20
+#define DEFAULT_ERLANG_REDUCTION_COUNT 2000
 
 #define MAP_TYPE_PRESENT \
     ((ERL_NIF_MAJOR_VERSION == 2 && ERL_NIF_MINOR_VERSION >= 6) \
@@ -48,9 +49,9 @@ ERL_NIF_TERM make_error(jiffy_st* st, ErlNifEnv* env, const char* error);
 ERL_NIF_TERM make_obj_error(jiffy_st* st, ErlNifEnv* env, const char* error,
         ERL_NIF_TERM obj);
 int get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi);
+int get_bytes_per_red(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpr);
 int get_null_term(ErlNifEnv* env, ERL_NIF_TERM val, ERL_NIF_TERM *null_term);
-int should_yield(size_t used, size_t limit);
-int consume_timeslice(ErlNifEnv* env, size_t used, size_t limit);
+int should_yield(ErlNifEnv* env, size_t* used, size_t bytes_per_red);
 
 ERL_NIF_TERM decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
 ERL_NIF_TERM decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/454928ff/c_src/util.c
----------------------------------------------------------------------
diff --git a/c_src/util.c b/c_src/util.c
index f05e1e8..7d8ac74 100644
--- a/c_src/util.c
+++ b/c_src/util.c
@@ -2,6 +2,7 @@
 // See the LICENSE file for more information.
 
 #include "jiffy.h"
+#include <stdio.h>
 
 ERL_NIF_TERM
 make_atom(ErlNifEnv* env, const char* name)
@@ -57,6 +58,36 @@ get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
         return 0;
     }
 
+    // Calculate the number of bytes per reduction
+    *bpi = (size_t) (bytes / DEFAULT_ERLANG_REDUCTION_COUNT);
+
+    return 1;
+}
+
+int
+get_bytes_per_red(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
+{
+    jiffy_st* st = (jiffy_st*) enif_priv_data(env);
+    const ERL_NIF_TERM* tuple;
+    int arity;
+    unsigned int bytes;
+
+    if(!enif_get_tuple(env, val, &arity, &tuple)) {
+        return 0;
+    }
+
+    if(arity != 2) {
+        return 0;
+    }
+
+    if(enif_compare(tuple[0], st->atom_bytes_per_iter) != 0) {
+        return 0;
+    }
+
+    if(!enif_get_uint(env, tuple[1], &bytes)) {
+        return 0;
+    }
+
     *bpi = (size_t) bytes;
 
     return 1;
@@ -91,31 +122,20 @@ get_null_term(ErlNifEnv* env, ERL_NIF_TERM val, ERL_NIF_TERM *null_term)
 }
 
 int
-should_yield(size_t used, size_t limit)
-{
-    if(limit == 0 || used < limit) {
-        return 0;
-    }
-
-    return 1;
-}
-
-int
-consume_timeslice(ErlNifEnv* env, size_t used, size_t limit)
+should_yield(ErlNifEnv* env, size_t* used, size_t bytes_per_red)
 {
 #if(ERL_NIF_MAJOR_VERSION >= 2 && ERL_NIF_MINOR_VERSION >= 4)
-    double u = (double) used;
-    double l = (double) limit;
-    int perc = (int) (100.0 * (u / l));
-
-    if(perc < 1) {
-        perc = 1;
-    } else if(perc > 100) {
-        perc = 100;
+
+    if(((*used) / bytes_per_red) >= 20) {
+        *used = 0;
+        return enif_consume_timeslice(env, 1);
     }
 
-    return enif_consume_timeslice(env, perc);
-#else
     return 0;
+
+#else
+
+    return ((*used) / bytes_per_red) >= DEFAULT_ERLANG_REDUCTION_COUNT;
+
 #endif
 }

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/454928ff/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 4517acb..9edaa3a 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -30,13 +30,15 @@
                         | use_nil
                         | return_trailer
                         | {null_term, any()}
-                        | {bytes_per_iter, non_neg_integer()}.
+                        | {bytes_per_iter, non_neg_integer()}
+                        | {bytes_per_red, non_neg_integer()}.
 
 -type encode_option() :: uescape
                         | pretty
                         | force_utf8
                         | escape_forward_slashes
-                        | {bytes_per_iter, non_neg_integer()}.
+                        | {bytes_per_iter, non_neg_integer()},
+                        | {bytes_per_red, non_neg_integer()}.
 
 -type decode_options() :: [decode_option()].
 -type encode_options() :: [encode_option()].


[27/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
rebar.config: fix Windows support (CFLAGS, CXXFLAGS)


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/f92793a8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/f92793a8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/f92793a8

Branch: refs/heads/master
Commit: f92793a81765182c936e9dc5c9321c73ad7a84c7
Parents: 137d3d9
Author: Tuncer Ayaz <tu...@gmail.com>
Authored: Wed Jan 14 15:50:56 2015 +0100
Committer: Tuncer Ayaz <tu...@gmail.com>
Committed: Wed Jan 14 15:50:56 2015 +0100

----------------------------------------------------------------------
 rebar.config | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f92793a8/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
index e805dba..3d725b6 100644
--- a/rebar.config
+++ b/rebar.config
@@ -7,8 +7,10 @@
 ]}.
 
 {port_env, [
-    {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -O3 -fno-strict-aliasing"},
-    {".*", "CXXFLAGS", "$CXXFLAGS -g -Wall -Werror -O3"},
+    {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
+        "CFLAGS", "$CFLAGS -g -Wall -Werror -O3 -fno-strict-aliasing"},
+    {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
+        "CXXFLAGS", "$CXXFLAGS -g -Wall -Werror -O3"},
 
     {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",
         "LDFLAGS", "$LDFLAGS -lstdc++"},


[24/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Fix memory leak when encoding bare bignums

This fixes a leak when encoding a bare bignum. Technically it would be
possible to hit this memory leak randomly with bignums in objects but
the chances are highly unlikely.

Thanks to @miriampena for the issue.

Fixes #69


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/6318efa7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/6318efa7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/6318efa7

Branch: refs/heads/master
Commit: 6318efa7987b4f0531a9401614b0c717e81b75b9
Parents: b6afb14
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Sep 30 17:03:37 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Sep 30 17:05:37 2014 -0500

----------------------------------------------------------------------
 c_src/encoder.c                      | 23 ++++++++++++++---------
 test/jiffy_14_bignum_memory_leak.erl | 29 +++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6318efa7/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index ac4935d..471cfcc 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -205,17 +205,22 @@ enc_unknown(Encoder* e, ERL_NIF_TERM value)
     // a bignum might produce when encoded.
     e->iosize += e->i + 16;
 
-    // Reinitialize our binary for the next buffer.
-    e->curr = bin;
-    if(!enif_alloc_binary(BIN_INC_SIZE, e->curr)) {
-        return 0;
-    }
+    // Reinitialize our binary for the next buffer if we
+    // used any data in the buffer. If we haven't used any
+    // bytes in the buffer then we can safely reuse it
+    // for anything following the unknown value.
+    if(e->i > 0) {
+        e->curr = bin;
+        if(!enif_alloc_binary(BIN_INC_SIZE, e->curr)) {
+            return 0;
+        }
 
-    memset(e->curr->data, 0, e->curr->size);
+        memset(e->curr->data, 0, e->curr->size);
 
-    e->p = (char*) e->curr->data;
-    e->u = (unsigned char*) e->curr->data;
-    e->i = 0;
+        e->p = (char*) e->curr->data;
+        e->u = (unsigned char*) e->curr->data;
+        e->i = 0;        
+    }
 
     return 1;
 }

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6318efa7/test/jiffy_14_bignum_memory_leak.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_14_bignum_memory_leak.erl b/test/jiffy_14_bignum_memory_leak.erl
new file mode 100644
index 0000000..df3f4df
--- /dev/null
+++ b/test/jiffy_14_bignum_memory_leak.erl
@@ -0,0 +1,29 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_14_bignum_memory_leak).
+
+-include_lib("eunit/include/eunit.hrl").
+
+
+bignum_encoding_leak_test_() ->
+    run_gc(),
+    Before = erlang:memory(binary),
+    encode_bignums(1000000),
+    run_gc(),
+    After = erlang:memory(binary),
+    ?_assert(After - Before < 100000).
+
+
+run_gc() ->
+    [erlang:garbage_collect(Pid) || Pid <- erlang:processes()].
+
+
+encode_bignums(N) ->
+    {_, Ref} = spawn_monitor(fun() ->
+        [jiffy:encode(1072502107250210725021072502) || _ <- lists:seq(1, N)]
+    end),
+    receive
+        {'DOWN', Ref, process, _, _} ->
+            ok
+    end.


[12/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Fix timeouts for short doubles

Timeouts apparently don't actually work unless you use a test generator.
Which makes sense in hindsight.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/eb70deb8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/eb70deb8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/eb70deb8

Branch: refs/heads/master
Commit: eb70deb8317cb04d09eed5a298123e6f6d00d6e3
Parents: a232221
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:39:49 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:40:26 2014 -0500

----------------------------------------------------------------------
 test/jiffy_10_short_double_tests.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/eb70deb8/test/jiffy_10_short_double_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_10_short_double_tests.erl b/test/jiffy_10_short_double_tests.erl
index bb2f1b8..56272fe 100644
--- a/test/jiffy_10_short_double_tests.erl
+++ b/test/jiffy_10_short_double_tests.erl
@@ -12,9 +12,9 @@
 filename() -> "../test/cases/short-doubles.txt".
 
 
-short_double_test() ->
+short_double_test_() ->
     {ok, Fd} = file:open(filename(), [read, binary, raw]),
-    {"all doubles round trip", {timeout, 300, ?assertEqual(0, run(Fd, 0))}}.
+    {timeout, 300, ?_assertEqual(0, run(Fd, 0))}.
 
 
 run(Fd, Acc) ->


[14/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Update optimization flags


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/03f2b306
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/03f2b306
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/03f2b306

Branch: refs/heads/master
Commit: 03f2b306bc320230b9ecdc47a6961131059a0523
Parents: c45f312
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Jun 17 02:57:50 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Jun 17 02:57:50 2014 -0500

----------------------------------------------------------------------
 rebar.config | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/03f2b306/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
index 831ca38..910433c 100644
--- a/rebar.config
+++ b/rebar.config
@@ -7,6 +7,7 @@
 ]}.
 
 {port_env, [
+    {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -O3"},
     {".*", "CXXFLAGS", "$CXXFLAGS -g -Wall -Werror -O3"},
 
     {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",


[36/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Fix typo in README.md

Thanks to @dvliman and @kxepal for noticing.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/a1418434
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/a1418434
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/a1418434

Branch: refs/heads/master
Commit: a1418434b275183aae3bb4e853c44c8e91b7b0a6
Parents: b403e4a
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:19:29 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:20:53 2015 -0500

----------------------------------------------------------------------
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/a1418434/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 13bc42e..1e95bc0 100644
--- a/README.md
+++ b/README.md
@@ -91,7 +91,7 @@ the `return_maps` option to `jiffy:decode/2`.
 Improvements over EEP0018
 -------------------------
 
-Jiffy should be in all ways an improvemnt over EEP0018. It no longer
+Jiffy should be in all ways an improvement over EEP0018. It no longer
 imposes limits on the nesting depth. It is capable of encoding and
 decoding large numbers and it does quite a bit more validation of UTF-8 in strings.
 


[10/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Include the Travis-CI status badge in the README


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/4b3e4fb5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/4b3e4fb5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/4b3e4fb5

Branch: refs/heads/master
Commit: 4b3e4fb583f6ab95d3d3ce58d2816c6ef1ba64d1
Parents: fb1b7e7
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:19:23 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:19:23 2014 -0500

----------------------------------------------------------------------
 README.md | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/4b3e4fb5/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 0681404..15b2ee3 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,8 @@ in EEP0018 that was based on Yajl. This new version is a hand crafted
 state machine that does its best to be as quick and efficient as
 possible while not placing any constraints on the parsed JSON.
 
+[![Build Status](https://travis-ci.org/davisp/jiffy.svg?branch=master)](https://travis-ci.org/davisp/jiffy)
+
 Usage
 -----
 


[46/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Strings can be atoms or binaries


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/f284a1b2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/f284a1b2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/f284a1b2

Branch: refs/heads/master
Commit: f284a1b2b0799441665209a86ce14c1f0921d6ca
Parents: a32a12f
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Jul 17 11:59:39 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jul 17 11:59:39 2015 -0500

----------------------------------------------------------------------
 src/jiffy.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f284a1b2/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 6fc0fa3..c987997 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -19,7 +19,7 @@
                     | json_array().
 
 -type json_array()  :: [json_value()].
--type json_string() :: binary().
+-type json_string() :: atom() | binary().
 -type json_number() :: integer() | float().
 -type json_object() :: {[{json_string(),json_value()}]}.
 


[11/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Silence unused function compiler warnings


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/a232221c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/a232221c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/a232221c

Branch: refs/heads/master
Commit: a232221c4249d31ea09dae730d556401392a98a6
Parents: 4b3e4fb
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:23:39 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:23:39 2014 -0500

----------------------------------------------------------------------
 test/jiffy_util.hrl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/a232221c/test/jiffy_util.hrl
----------------------------------------------------------------------
diff --git a/test/jiffy_util.hrl b/test/jiffy_util.hrl
index b8210e2..51bd86a 100644
--- a/test/jiffy_util.hrl
+++ b/test/jiffy_util.hrl
@@ -1,4 +1,6 @@
 
+-compile(export_all).
+
 msg(Fmt, Args) ->
     M1 = io_lib:format(Fmt, Args),
     M2 = re:replace(M1, <<"\r">>, <<"\\\\r">>, [global]),


[44/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add new return_trailer option

Previously Jiffy would throw an error about trailing data if there is
any non-whitespace character encounter after the first term had been
decoded.

This patch adds a decoder option `return_trailer` that will instead
return a sub-binary starting at the first non-whitespace character. This
allows users to be able to decode multiple terms from a single iodata()
term.

Thanks to @vlm for the original patch.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/6d2278e9
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/6d2278e9
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/6d2278e9

Branch: refs/heads/master
Commit: 6d2278e90694bb484845ad149d484d0a3cae10ec
Parents: 238c653
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 16:18:13 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 18:40:27 2015 -0500

----------------------------------------------------------------------
 README.md                              |  4 ++++
 c_src/decoder.c                        | 18 ++++++++++++++++--
 c_src/jiffy.c                          |  2 ++
 c_src/jiffy.h                          |  2 ++
 src/jiffy.erl                          |  8 ++++++--
 test/jiffy_11_proper_tests.erl         | 21 +++++++++++++++++++++
 test/jiffy_15_return_trailer_tests.erl | 19 +++++++++++++++++++
 7 files changed, 70 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 7f51ce1..f354ecf 100644
--- a/README.md
+++ b/README.md
@@ -47,6 +47,10 @@ The options for decode are:
   instead of `null`.
 * `use_nil` - Returns the atom `nil` instead of `null` when decoding
   JSON. This is a short hand for `{null_term, nil}`.
+* `return_trailer` - If any non-whitespace is found after the first
+  JSON term is decoded the return value of decode/2 becomes
+  `{has_trailer, FirstTerm, RestData::iodata()}`. This is useful to
+  decode multiple terms in a single binary.
 
 `jiffy:encode/1,2`
 ------------------

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/c_src/decoder.c
----------------------------------------------------------------------
diff --git a/c_src/decoder.c b/c_src/decoder.c
index f39575a..60b3257 100644
--- a/c_src/decoder.c
+++ b/c_src/decoder.c
@@ -52,6 +52,7 @@ typedef struct {
     size_t          bytes_per_iter;
     int             is_partial;
     int             return_maps;
+    int             return_trailer;
     ERL_NIF_TERM    null_term;
 
     char*           p;
@@ -80,6 +81,7 @@ dec_new(ErlNifEnv* env)
     d->bytes_per_iter = DEFAULT_BYTES_PER_ITER;
     d->is_partial = 0;
     d->return_maps = 0;
+    d->return_trailer = 0;
     d->null_term = d->atoms->atom_null;
 
     d->p = NULL;
@@ -710,6 +712,8 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 #else
             return enif_make_badarg(env);
 #endif
+        } else if(enif_compare(val, d->atoms->atom_return_trailer) == 0) {
+            d->return_trailer = 1;
         } else if(enif_compare(val, d->atoms->atom_use_nil) == 0) {
             d->null_term = d->atoms->atom_nil;
         } else if(get_null_term(env, val, &(d->null_term))) {
@@ -733,6 +737,7 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
     ERL_NIF_TERM objs;
     ERL_NIF_TERM curr;
     ERL_NIF_TERM val = argv[2];
+    ERL_NIF_TERM trailer;
     ERL_NIF_TERM ret;
     size_t start;
 
@@ -1030,8 +1035,7 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                         d->i++;
                         break;
                     default:
-                        ret = dec_error(d, "invalid_trailing_data");
-                        goto done;
+                        goto decode_done;
                 }
                 break;
 
@@ -1041,6 +1045,16 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
         }
     }
 
+decode_done:
+
+    if(d->i < bin.size && d->return_trailer) {
+        trailer = enif_make_sub_binary(env, argv[0], d->i, bin.size - d->i);
+        val = enif_make_tuple3(env, d->atoms->atom_has_trailer, val, trailer);
+    } else if(d->i < bin.size) {
+        ret = dec_error(d, "invalid_trailing_data");
+        goto done;
+    }
+
     if(dec_curr(d) != st_done) {
         ret = dec_error(d, "truncated_json");
     } else if(d->is_partial) {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/c_src/jiffy.c
----------------------------------------------------------------------
diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index 9048f5e..1ea60a3 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -26,6 +26,8 @@ load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
     st->atom_iter = make_atom(env, "iter");
     st->atom_bytes_per_iter = make_atom(env, "bytes_per_iter");
     st->atom_return_maps = make_atom(env, "return_maps");
+    st->atom_return_trailer = make_atom(env, "return_trailer");
+    st->atom_has_trailer = make_atom(env, "has_trailer");
     st->atom_nil = make_atom(env, "nil");
     st->atom_use_nil = make_atom(env, "use_nil");
     st->atom_null_term = make_atom(env, "null_term");

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/c_src/jiffy.h
----------------------------------------------------------------------
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index 7a2b7d5..61c7b70 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -28,6 +28,8 @@ typedef struct {
     ERL_NIF_TERM    atom_iter;
     ERL_NIF_TERM    atom_bytes_per_iter;
     ERL_NIF_TERM    atom_return_maps;
+    ERL_NIF_TERM    atom_return_trailer;
+    ERL_NIF_TERM    atom_has_trailer;
     ERL_NIF_TERM    atom_nil;
     ERL_NIF_TERM    atom_use_nil;
     ERL_NIF_TERM    atom_null_term;

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index a272cf9..4517acb 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -23,8 +23,12 @@
 -type json_number() :: integer() | float().
 -type json_object() :: {[{json_string(),json_value()}]}.
 
+-type decode_result() :: json_value()
+                        | {has_trailer, json_value(), binary()}.
+
 -type decode_option() :: return_maps
                         | use_nil
+                        | return_trailer
                         | {null_term, any()}
                         | {bytes_per_iter, non_neg_integer()}.
 
@@ -37,10 +41,10 @@
 -type decode_options() :: [decode_option()].
 -type encode_options() :: [encode_option()].
 
--export_type([json_value/0]).
+-export_type([json_value/0, jiffy_decode_result/0]).
 
 
--spec decode(iolist() | binary()) -> json_value().
+-spec decode(iolist() | binary()) -> jiffy_decode_result().
 decode(Data) ->
     decode(Data, []).
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/test/jiffy_11_proper_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_11_proper_tests.erl b/test/jiffy_11_proper_tests.erl
index 2c254bf..23aa38d 100644
--- a/test/jiffy_11_proper_tests.erl
+++ b/test/jiffy_11_proper_tests.erl
@@ -24,6 +24,7 @@ proper_encode_decode_test_() ->
     [
         run(prop_enc_dec),
         run(prop_enc_dec_pretty),
+        run(prop_dec_trailer),
         run(prop_enc_no_crash),
         run(prop_dec_no_crash_bin),
         run(prop_dec_no_crash_any)
@@ -37,6 +38,26 @@ prop_enc_dec() ->
         end
     ).
 
+prop_dec_trailer() ->
+    ?FORALL({T1, T2}, {json(), json()},
+        begin
+            B1 = jiffy:encode(T1),
+            B2 = jiffy:encode(T2),
+            Combiners = [
+                <<" ">>,
+                <<"\r\t">>,
+                <<"\n   \t">>,
+                <<"                     ">>
+            ],
+            lists:foreach(fun(Comb) ->
+                Bin = <<B1/binary, Comb/binary, B2/binary>>,
+                {has_trailer, T1, Rest} = jiffy:decode(Bin, [return_trailer]),
+                T2 = jiffy:decode(Rest)
+            end, Combiners),
+            true
+        end
+    ).
+
 -ifndef(JIFFY_NO_MAPS).
 to_map_ejson({Props}) ->
     NewProps = [{K, to_map_ejson(V)} || {K, V} <- Props],

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/6d2278e9/test/jiffy_15_return_trailer_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_15_return_trailer_tests.erl b/test/jiffy_15_return_trailer_tests.erl
new file mode 100644
index 0000000..af80a46
--- /dev/null
+++ b/test/jiffy_15_return_trailer_tests.erl
@@ -0,0 +1,19 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_15_return_trailer_tests).
+
+-include_lib("eunit/include/eunit.hrl").
+
+trailer_test_() ->
+    Opts = [return_trailer],
+    Cases = [
+        {<<"true">>, true},
+        {<<"true;">>, {has_trailer, true, <<";">>}},
+        {<<"true[]">>, {has_trailer, true, <<"[]">>}},
+        {<<"[]{}">>, {has_trailer, [], <<"{}">>}},
+        {<<"1 2 3">>, {has_trailer, 1, <<"2 3">>}}
+    ],
+    {"Test return_trailer", lists:map(fun({Data, Result}) ->
+        ?_assertEqual(Result, jiffy:decode(Data, Opts))
+    end, Cases)}.
\ No newline at end of file


[50/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add latest Erlang VMs to the test matrix


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/f661ee9f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/f661ee9f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/f661ee9f

Branch: refs/heads/master
Commit: f661ee9fd80e5b6b03e9dfbb17d1c72fb6cfdba9
Parents: d95c07c
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Jul 17 12:31:11 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jul 17 12:31:11 2015 -0500

----------------------------------------------------------------------
 .travis.yml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f661ee9f/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index bab69d6..2865a8a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,9 @@ language: erlang
 notifications:
   email: paul.joseph.davis@gmail.com
 otp_release:
+   - 17.5
+   - 17.4
+   - 17.3
    - 17.1
    - 17.0
    - R16B03-1


[42/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Ignore test XML files


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/238c653d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/238c653d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/238c653d

Branch: refs/heads/master
Commit: 238c653ded399076a7f65ee3414996cd6ca66986
Parents: 2c39402
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 17:53:57 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 17:57:56 2015 -0500

----------------------------------------------------------------------
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/238c653d/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 6666f22..b7aeb08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@
 .eunit
 deps
 erln8.config
+TEST-*.xml


[40/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add Dialyzer types and specs

Thanks to @joedevivo for the contribution.

Fixes #85


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/e371ec10
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/e371ec10
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/e371ec10

Branch: refs/heads/master
Commit: e371ec1075266240ec88a744cda036e8fddefd1c
Parents: 43d9516
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:45:23 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:45:23 2015 -0500

----------------------------------------------------------------------
 src/jiffy.erl | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/e371ec10/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 23a0c9d..39c3aeb 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -8,10 +8,42 @@
 -on_load(init/0).
 
 
+-type json_value() :: null
+                    | true
+                    | false
+                    | json_string()
+                    | json_number()
+                    | json_object()
+                    | json_array().
+
+-type json_array()  :: [json_value()].
+-type json_string() :: binary().
+-type json_number() :: integer() | float().
+-type json_object() :: {[{json_string(),json_value()}]}.
+
+-type decode_option() :: return_maps
+                        | use_nil
+                        | {null_term, any()}
+                        | {bytes_per_iter, non_neg_integer()}.
+
+-type encode_option() :: uescape
+                        | pretty
+                        | force_utf8
+                        | escape_forward_slashes
+                        | {bytes_per_iter, non_neg_integer()}.
+
+-type decode_options() :: [decode_option()].
+-type encode_options() :: [encode_option()].
+
+-export_type([json_value/0]).
+
+
+-spec decode(iolist() | binary()) -> json_value().
 decode(Data) ->
     decode(Data, []).
 
 
+-spec decode(iolist() | binary(), decode_options()) -> json_value().
 decode(Data, Opts) when is_binary(Data), is_list(Opts) ->
     case nif_decode_init(Data, Opts) of
         {error, _} = Error ->
@@ -27,10 +59,12 @@ decode(Data, Opts) when is_list(Data) ->
     decode(iolist_to_binary(Data), Opts).
 
 
+-spec encode(json_value()) -> iolist().
 encode(Data) ->
     encode(Data, []).
 
 
+-spec encode(json_value(), encode_options()) -> iolist().
 encode(Data, Options) ->
     ForceUTF8 = lists:member(force_utf8, Options),
     case nif_encode_init(Data, Options) of


[33/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add an option to control null value decoding atom

This is pretty much a generalisation of the use_nil option to support an
arbitrary atom.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/cd1b2632
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/cd1b2632
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/cd1b2632

Branch: refs/heads/master
Commit: cd1b2632083c3724b246c8e8107845d9903bc578
Parents: 801f9e7
Author: Jeremie Lasalle Ratelle <je...@gmail.com>
Authored: Fri Apr 24 12:35:32 2015 -0400
Committer: Jeremie Lasalle Ratelle <je...@gmail.com>
Committed: Wed Jul 15 13:38:19 2015 -0400

----------------------------------------------------------------------
 c_src/decoder.c                 | 10 ++++++----
 c_src/jiffy.c                   |  1 +
 c_src/jiffy.h                   |  2 ++
 c_src/util.c                    | 28 ++++++++++++++++++++++++++++
 test/jiffy_02_literal_tests.erl | 11 +++++++++++
 5 files changed, 48 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/cd1b2632/c_src/decoder.c
----------------------------------------------------------------------
diff --git a/c_src/decoder.c b/c_src/decoder.c
index ad3e8d3..f39575a 100644
--- a/c_src/decoder.c
+++ b/c_src/decoder.c
@@ -52,7 +52,7 @@ typedef struct {
     size_t          bytes_per_iter;
     int             is_partial;
     int             return_maps;
-    int             use_nil;
+    ERL_NIF_TERM    null_term;
 
     char*           p;
     unsigned char*  u;
@@ -80,7 +80,7 @@ dec_new(ErlNifEnv* env)
     d->bytes_per_iter = DEFAULT_BYTES_PER_ITER;
     d->is_partial = 0;
     d->return_maps = 0;
-    d->use_nil = 0;
+    d->null_term = d->atoms->atom_null;
 
     d->p = NULL;
     d->u = NULL;
@@ -711,7 +711,9 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             return enif_make_badarg(env);
 #endif
         } else if(enif_compare(val, d->atoms->atom_use_nil) == 0) {
-            d->use_nil = 1;
+            d->null_term = d->atoms->atom_nil;
+        } else if(get_null_term(env, val, &(d->null_term))) {
+            continue;
         } else {
             return enif_make_badarg(env);
         }
@@ -783,7 +785,7 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                             ret = dec_error(d, "invalid_literal");
                             goto done;
                         }
-                        val = d->use_nil ? d->atoms->atom_nil : d->atoms->atom_null;
+                        val = d->null_term;
                         dec_pop(d, st_value);
                         d->i += 4;
                         break;

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/cd1b2632/c_src/jiffy.c
----------------------------------------------------------------------
diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index 31aa854..c18a111 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -28,6 +28,7 @@ load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
     st->atom_return_maps = make_atom(env, "return_maps");
     st->atom_nil = make_atom(env, "nil");
     st->atom_use_nil = make_atom(env, "use_nil");
+    st->atom_null_term = make_atom(env, "null_term");
 
     // Markers used in encoding
     st->ref_object = make_atom(env, "$object_ref$");

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/cd1b2632/c_src/jiffy.h
----------------------------------------------------------------------
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index 6d869a5..ecad9da 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -30,6 +30,7 @@ typedef struct {
     ERL_NIF_TERM    atom_return_maps;
     ERL_NIF_TERM    atom_nil;
     ERL_NIF_TERM    atom_use_nil;
+    ERL_NIF_TERM    atom_null_term;
 
     ERL_NIF_TERM    ref_object;
     ERL_NIF_TERM    ref_array;
@@ -44,6 +45,7 @@ ERL_NIF_TERM make_error(jiffy_st* st, ErlNifEnv* env, const char* error);
 ERL_NIF_TERM make_obj_error(jiffy_st* st, ErlNifEnv* env, const char* error,
         ERL_NIF_TERM obj);
 int get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi);
+int get_null_term(ErlNifEnv* env, ERL_NIF_TERM val, ERL_NIF_TERM *null_term);
 int should_yield(size_t used, size_t limit);
 int consume_timeslice(ErlNifEnv* env, size_t used, size_t limit);
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/cd1b2632/c_src/util.c
----------------------------------------------------------------------
diff --git a/c_src/util.c b/c_src/util.c
index c30a6d7..f05e1e8 100644
--- a/c_src/util.c
+++ b/c_src/util.c
@@ -63,6 +63,34 @@ get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
 }
 
 int
+get_null_term(ErlNifEnv* env, ERL_NIF_TERM val, ERL_NIF_TERM *null_term)
+{
+    jiffy_st* st = (jiffy_st*) enif_priv_data(env);
+    const ERL_NIF_TERM* tuple;
+    int arity;
+
+    if(!enif_get_tuple(env, val, &arity, &tuple)) {
+      return 0;
+    }
+
+    if(arity != 2) {
+      return 0;
+    }
+
+    if(enif_compare(tuple[0], st->atom_null_term) != 0) {
+      return 0;
+    }
+
+    if(!enif_is_atom(env, tuple[1])) {
+      return 0;
+    }
+
+    *null_term = tuple[1];
+
+    return 1;
+}
+
+int
 should_yield(size_t used, size_t limit)
 {
     if(limit == 0 || used < limit) {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/cd1b2632/test/jiffy_02_literal_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_02_literal_tests.erl b/test/jiffy_02_literal_tests.erl
index 98b163c..2699199 100644
--- a/test/jiffy_02_literal_tests.erl
+++ b/test/jiffy_02_literal_tests.erl
@@ -31,3 +31,14 @@ nil_test_() ->
         {"Decode", ?_assertEqual(nil, jiffy:decode(<<"null">>, [use_nil]))},
         {"Encode", ?_assertEqual(<<"null">>, jiffy:encode(nil, [use_nil]))}
     ]}.
+
+null_term_test_() ->
+    T = [
+        {undefined, [{null_term, undefined}]},
+        {whatever, [{null_term, whatever}]},
+        {undefined, [use_nil, {null_term, undefined}]},
+        {nil, [{null_term, undefined}, use_nil]},
+        {whatever, [{null_term, undefined}, {null_term, whatever}]}
+    ],
+    {"null_term",
+        [?_assertEqual(R, jiffy:decode(<<"null">>, O)) || {R, O} <- T]}.


[07/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Make sure to update the config for Travis-CI


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/46b31521
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/46b31521
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/46b31521

Branch: refs/heads/master
Commit: 46b315217d55c9b604add4e918c07f6feb6cb69b
Parents: 4774f72
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:09:49 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:09:49 2014 -0500

----------------------------------------------------------------------
 rebar.config.script | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/46b31521/rebar.config.script
----------------------------------------------------------------------
diff --git a/rebar.config.script b/rebar.config.script
index 8a0049d..e5f561d 100644
--- a/rebar.config.script
+++ b/rebar.config.script
@@ -16,7 +16,7 @@ Proper = [
 ConfigPath = filename:dirname(SCRIPT),
 DevMarker = filename:join([ConfigPath, ".jiffy.dev"]),
 
-case filelib:is_file(DevMarker) of
+case filelib:is_file(DevMarker) orelse os:getenv("TRAVIS") == "true" of
     true ->
         % Don't override existing dependencies
         Config0 = case lists:keyfind(deps, 1, CONFIG) of


[48/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Fix map type spec

I was being lazy and relying on Travis. This fixes up the map spec for
newer VMs.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/32b89393
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/32b89393
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/32b89393

Branch: refs/heads/master
Commit: 32b89393d3d5cde1f9e34828671d8a2fe43a12a2
Parents: e132b63
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Jul 17 12:16:48 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jul 17 12:16:48 2015 -0500

----------------------------------------------------------------------
 src/jiffy.erl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/32b89393/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 4ee2a9e..4c9577f 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -21,10 +21,16 @@
 -type json_array()  :: [json_value()].
 -type json_string() :: atom() | binary().
 -type json_number() :: integer() | float().
+
+-ifdef(JIFFY_NO_MAPS).
+
 -type json_object() :: {[{json_string(),json_value()}]}.
 
--ifndef(JIFFY_NO_MAPS).
--type #{json_string() => json_value()}.
+-else.
+
+-type json_object() :: {[{json_string(),json_value()}]}
+                        | #{json_string() => json_value()}.
+
 -endif.
 
 -type jiffy_decode_result() :: json_value()


[21/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Improved encoder errors

This updates encoder errors to report the actual Erlang value that
caused the error. This should make it easier to debug errors when
generating JSON.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/f9095c52
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/f9095c52
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/f9095c52

Branch: refs/heads/master
Commit: f9095c52581867938e1ea1eb695235994f585e89
Parents: 5eb499d
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sat Aug 23 05:47:59 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sat Aug 23 06:41:25 2014 -0500

----------------------------------------------------------------------
 c_src/encoder.c                | 30 ++++++++-----
 c_src/jiffy.h                  |  2 +
 c_src/util.c                   |  8 ++++
 src/jiffy.erl                  |  6 ++-
 test/jiffy_04_string_tests.erl |  2 +-
 test/jiffy_12_error_tests.erl  | 87 +++++++++++++++++++++++++++++++++++++
 6 files changed, 120 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f9095c52/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index 992b5d5..ac4935d 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -122,6 +122,12 @@ enc_error(Encoder* e, const char* msg)
     return make_error(e->atoms, e->env, msg);
 }
 
+ERL_NIF_TERM
+enc_obj_error(Encoder* e, const char* msg, ERL_NIF_TERM obj)
+{
+    return make_obj_error(e->atoms, e->env, msg, obj);
+}
+
 static inline int
 enc_ensure(Encoder* e, size_t req)
 {
@@ -667,11 +673,11 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                 goto done;
             }
             if(!enif_get_tuple(env, item, &arity, &tuple)) {
-                ret = enc_error(e, "invalid_object_pair");
+                ret = enc_obj_error(e, "invalid_object_member", item);
                 goto done;
             }
             if(arity != 2) {
-                ret = enc_error(e, "invalid_object_pair");
+                ret = enc_obj_error(e, "invalid_object_member_arity", item);
                 goto done;
             }
             if(!enc_comma(e)) {
@@ -679,7 +685,7 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                 goto done;
             }
             if(!enc_string(e, tuple[0])) {
-                ret = enc_error(e, "invalid_object_key");
+                ret = enc_obj_error(e, "invalid_object_member_key", tuple[0]);
                 goto done;
             }
             if(!enc_colon(e)) {
@@ -712,12 +718,12 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             stack = enif_make_list_cell(env, curr, stack);
             stack = enif_make_list_cell(env, e->atoms->ref_array, stack);
             stack = enif_make_list_cell(env, item, stack);
-        } else if(enif_compare(curr, e->atoms->atom_null) == 0 
+        } else if(enif_compare(curr, e->atoms->atom_null) == 0) {
             if(!enc_literal(e, "null", 4)) {
                 ret = enc_error(e, "null");
                 goto done;
             }
-        } else if(e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0)) {
+        } else if(e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0) {
             if(!enc_literal(e, "null", 4)) {
                 ret = enc_error(e, "null");
                 goto done;
@@ -734,12 +740,12 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             }
         } else if(enif_is_binary(env, curr)) {
             if(!enc_string(e, curr)) {
-                ret = enc_error(e, "invalid_string");
+                ret = enc_obj_error(e, "invalid_string", curr);
                 goto done;
             }
         } else if(enif_is_atom(env, curr)) {
             if(!enc_string(e, curr)) {
-                ret = enc_error(e, "invalid_string");
+                ret = enc_obj_error(e, "invalid_string", curr);
                 goto done;
             }
         } else if(enif_get_int64(env, curr, &lval)) {
@@ -754,11 +760,11 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             }
         } else if(enif_get_tuple(env, curr, &arity, &tuple)) {
             if(arity != 1) {
-                ret = enc_error(e, "invalid_ejson");
+                ret = enc_obj_error(e, "invalid_ejson", curr);
                 goto done;
             }
             if(!enif_is_list(env, tuple[0])) {
-                ret = enc_error(e, "invalid_object");
+                ret = enc_obj_error(e, "invalid_object", curr);
                 goto done;
             }
             if(!enc_start_object(e)) {
@@ -777,15 +783,15 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                 goto done;
             }
             if(!enif_get_tuple(env, item, &arity, &tuple)) {
-                ret = enc_error(e, "invalid_object_member");
+                ret = enc_obj_error(e, "invalid_object_member", item);
                 goto done;
             }
             if(arity != 2) {
-                ret = enc_error(e, "invalid_object_member_arity");
+                ret = enc_obj_error(e, "invalid_object_member_arity", item);
                 goto done;
             }
             if(!enc_string(e, tuple[0])) {
-                ret = enc_error(e, "invalid_object_member_key");
+                ret = enc_obj_error(e, "invalid_object_member_key", tuple[0]);
                 goto done;
             }
             if(!enc_colon(e)) {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f9095c52/c_src/jiffy.h
----------------------------------------------------------------------
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index 34dff75..6d869a5 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -41,6 +41,8 @@ typedef struct {
 ERL_NIF_TERM make_atom(ErlNifEnv* env, const char* name);
 ERL_NIF_TERM make_ok(jiffy_st* st, ErlNifEnv* env, ERL_NIF_TERM data);
 ERL_NIF_TERM make_error(jiffy_st* st, ErlNifEnv* env, const char* error);
+ERL_NIF_TERM make_obj_error(jiffy_st* st, ErlNifEnv* env, const char* error,
+        ERL_NIF_TERM obj);
 int get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi);
 int should_yield(size_t used, size_t limit);
 int consume_timeslice(ErlNifEnv* env, size_t used, size_t limit);

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f9095c52/c_src/util.c
----------------------------------------------------------------------
diff --git a/c_src/util.c b/c_src/util.c
index 7436add..c30a6d7 100644
--- a/c_src/util.c
+++ b/c_src/util.c
@@ -25,6 +25,14 @@ make_error(jiffy_st* st, ErlNifEnv* env, const char* error)
     return enif_make_tuple2(env, st->atom_error, make_atom(env, error));
 }
 
+ERL_NIF_TERM
+make_obj_error(jiffy_st* st, ErlNifEnv* env,
+        const char* error, ERL_NIF_TERM obj)
+{
+    ERL_NIF_TERM reason = enif_make_tuple2(env, make_atom(env, error), obj);
+    return enif_make_tuple2(env, st->atom_error, reason);
+}
+
 int
 get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
 {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f9095c52/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 8903831..9642b25 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -34,7 +34,7 @@ encode(Data) ->
 encode(Data, Options) ->
     ForceUTF8 = lists:member(force_utf8, Options),
     case nif_encode_init(Data, Options) of
-        {error, invalid_string} when ForceUTF8 == true ->
+        {error, {invalid_string, _}} when ForceUTF8 == true ->
             FixedData = jiffy_utf8:fix(Data),
             encode(FixedData, Options -- [force_utf8]);
         {error, _} = Error ->
@@ -102,6 +102,8 @@ finish_encode([<<_/binary>>=B | Rest], Acc) ->
 finish_encode([Val | Rest], Acc) when is_integer(Val) ->
     Bin = list_to_binary(integer_to_list(Val)),
     finish_encode(Rest, [Bin | Acc]);
+finish_encode([InvalidEjson | _], _) ->
+    throw({error, {invalid_ejson, InvalidEjson}});
 finish_encode(_, _) ->
     throw({error, invalid_ejson}).
 
@@ -134,7 +136,7 @@ decode_loop(Data, Decoder, Objs, Curr) ->
 encode_loop(Data, Options, Encoder, Stack, IOBuf) ->
     ForceUTF8 = lists:member(force_utf8, Options),
     case nif_encode_iter(Encoder, Stack, IOBuf) of
-        {error, invalid_string} when ForceUTF8 == true ->
+        {error, {invalid_string, _}} when ForceUTF8 == true ->
             FixedData = jiffy_utf8:fix(Data),
             encode(FixedData, Options -- [force_utf8]);
         {error, _} = Error ->

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f9095c52/test/jiffy_04_string_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_04_string_tests.erl b/test/jiffy_04_string_tests.erl
index 46f15ff..7238f7c 100644
--- a/test/jiffy_04_string_tests.erl
+++ b/test/jiffy_04_string_tests.erl
@@ -48,7 +48,7 @@ gen(utf8, {Case, Fixed}) ->
     Case2 = <<34, Case/binary, 34>>,
     Fixed2 = <<34, Fixed/binary, 34>>,
     {msg("UTF-8: ~s", [hex(Case)]), [
-        ?_assertThrow({error, invalid_string}, jiffy:encode(Case)),
+        ?_assertThrow({error, {invalid_string, _}}, jiffy:encode(Case)),
         ?_assertEqual(Fixed2, jiffy:encode(Case, [force_utf8])),
         ?_assertThrow({error, {_, invalid_string}}, jiffy:decode(Case2))
     ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/f9095c52/test/jiffy_12_error_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_12_error_tests.erl b/test/jiffy_12_error_tests.erl
new file mode 100644
index 0000000..a7d4ed6
--- /dev/null
+++ b/test/jiffy_12_error_tests.erl
@@ -0,0 +1,87 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_12_error_tests).
+
+-include_lib("eunit/include/eunit.hrl").
+
+
+enc_invalid_ejson_test_() ->
+    Type = invalid_ejson,
+    Ref = make_ref(),
+    {"invalid_ejson", [
+        {"Basic", enc_error(Type, Ref, Ref)},
+        {"Nested", enc_error(Type, {Ref, Ref}, {Ref, Ref})}
+    ]}.
+
+
+enc_invalid_string_test_() ->
+    Type = invalid_string,
+    {"invalid_string", [
+        {"Bare strign", enc_error(Type, <<143>>, <<143>>)},
+        {"List element", enc_error(Type, <<143>>, [<<143>>])},
+        {"Bad obj value", enc_error(Type, <<143>>, {[{foo, <<143>>}]})}
+    ]}.
+
+enc_invalid_object_test_() ->
+    Type = invalid_object,
+    Ref = make_ref(),
+    {"invalid_object", [
+        {"Number", enc_error(Type, {1}, {1})},
+        {"Ref", enc_error(Type, {Ref}, {Ref})},
+        {"Tuple", enc_error(Type, {{[]}}, {{[]}})},
+        {"Atom", enc_error(Type, {foo}, {foo})}
+    ]}.
+
+
+enc_invalid_object_member_test_() ->
+    Type = invalid_object_member,
+    {"invalid_object_member", [
+        {"Basic", enc_error(Type, foo, {[foo]})},
+        {"Basic", enc_error(Type, foo, {[{bar, baz}, foo]})},
+        {"Nested", enc_error(Type, foo, {[{bar,{[foo]}}]})},
+        {"Nested", enc_error(Type, foo, {[{bar,{[{baz, 1}, foo]}}]})},
+        {"In List", enc_error(Type, foo, [{[foo]}])},
+        {"In List", enc_error(Type, foo, [{[{bang, true}, foo]}])}
+    ]}.
+
+
+enc_invalid_object_member_arity_test_() ->
+    Type = invalid_object_member_arity,
+    E1 = {foo},
+    E2 = {x, y, z},
+    {"invalid_object_member", [
+        {"Basic", enc_error(Type, E1, {[E1]})},
+        {"Basic", enc_error(Type, E2, {[E2]})},
+        {"Basic", enc_error(Type, E1, {[{bar, baz}, E1]})},
+        {"Basic", enc_error(Type, E2, {[{bar, baz}, E2]})},
+        {"Nested", enc_error(Type, E1, {[{bar,{[E1]}}]})},
+        {"Nested", enc_error(Type, E2, {[{bar,{[E2]}}]})},
+        {"Nested", enc_error(Type, E1, {[{bar,{[{baz, 1}, E1]}}]})},
+        {"Nested", enc_error(Type, E2, {[{bar,{[{baz, 1}, E2]}}]})},
+        {"In List", enc_error(Type, E1, [{[E1]}])},
+        {"In List", enc_error(Type, E2, [{[E2]}])},
+        {"In List", enc_error(Type, E1, [{[{bang, true}, E1]}])},
+        {"In List", enc_error(Type, E2, [{[{bang, true}, E2]}])}
+    ]}.
+
+
+enc_invalid_object_member_key_test_() ->
+    Type = invalid_object_member_key,
+    E1 = {1, true},
+    {"invalid_object_member_key", [
+        {"Bad string", enc_error(Type, <<143>>, {[{<<143>>, true}]})},
+        {"Basic", enc_error(Type, 1, {[{1, true}]})},
+        {"Basic", enc_error(Type, [1], {[{[1], true}]})},
+        {"Basic", enc_error(Type, {[{foo,bar}]}, {[{{[{foo,bar}]}, true}]})},
+        {"Second", enc_error(Type, 1, {[{bar, baz}, E1]})},
+        {"Nested", enc_error(Type, 1, {[{bar,{[E1]}}]})},
+        {"Nested", enc_error(Type, 1, {[{bar,{[{baz, 1}, E1]}}]})},
+        {"In List", enc_error(Type, 1, [{[E1]}])},
+        {"In List", enc_error(Type, 1, [{[{bang, true}, E1]}])}
+    ]}.
+
+
+
+enc_error(Type, Obj, Case) ->
+    ?_assertEqual({error, {Type, Obj}}, (catch jiffy:encode(Case))).


[05/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Replace etap with eunit for the test suite

Finally got off my butt and started using EUnit.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/11ab9738
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/11ab9738
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/11ab9738

Branch: refs/heads/master
Commit: 11ab9738102c84f7add66c281e4733949b909bf9
Parents: 25a3010
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 20:58:26 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 20:58:26 2014 -0500

----------------------------------------------------------------------
 test/001-yajl-tests.t                |   30 -
 test/002-literals.t                  |   21 -
 test/003-numbers.t                   |  118 -
 test/004-strings.t                   |  127 --
 test/005-arrays.t                    |   36 -
 test/006-maps.t                      |   36 -
 test/007-compound.t                  |   41 -
 test/008-halfword.t                  |   15 -
 test/009-reg-issue-24.t              | 3459 ----------------------------
 test/010-short-doubles.t             |   29 -
 test/etap.erl                        |  612 -----
 test/jiffy_01_yajl_tests.erl         |   33 +
 test/jiffy_02_literal_tests.erl      |   28 +
 test/jiffy_03_number_tests.erl       |  134 ++
 test/jiffy_04_string_tests.erl       |  147 ++
 test/jiffy_05_array_tests.erl        |   56 +
 test/jiffy_06_object_tests.erl       |   56 +
 test/jiffy_07_compound_tests.erl     |   61 +
 test/jiffy_08_halfword_tests.erl     |   16 +
 test/jiffy_09_reg_issue_24_tests.erl | 3462 +++++++++++++++++++++++++++++
 test/jiffy_10_short_double_tests.erl |   34 +
 test/jiffy_11_proper_tests.erl       |  164 ++
 test/jiffy_tests.erl                 |  153 --
 test/jiffy_util.hrl                  |   25 +
 test/util.erl                        |   44 -
 25 files changed, 4216 insertions(+), 4721 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/001-yajl-tests.t
----------------------------------------------------------------------
diff --git a/test/001-yajl-tests.t b/test/001-yajl-tests.t
deleted file mode 100755
index b89fbee..0000000
--- a/test/001-yajl-tests.t
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("test"),
-    code:add_pathz("ebin"),
-
-    Cases = read_cases(),
-
-    etap:plan(length(Cases)),
-    lists:foreach(fun(Case) -> test(Case) end, Cases),
-    etap:end_tests().
-
-test({Name, Json, {error, _}=Erl}) ->
-    etap:is((catch jiffy:decode(Json)), Erl, Name);
-test({Name, Json, Erl}) ->
-    etap:is(jiffy:decode(Json), Erl, Name).
-
-read_cases() ->
-    CasesPath = filename:join(["test", "cases", "*.json"]),
-    FileNames = lists:sort(filelib:wildcard(CasesPath)),
-    lists:map(fun(F) -> make_pair(F) end, FileNames).
-
-make_pair(FileName) ->
-    {ok, Json} = file:read_file(FileName),
-    {BaseName, _} = lists:splitwith(fun(C) -> C /= $. end, FileName),
-    ErlFname = BaseName ++ ".eterm",
-    {ok, [Term]} = file:consult(ErlFname),
-    {BaseName, Json, Term}.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/002-literals.t
----------------------------------------------------------------------
diff --git a/test/002-literals.t b/test/002-literals.t
deleted file mode 100755
index 8df7255..0000000
--- a/test/002-literals.t
+++ /dev/null
@@ -1,21 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(6),
-    etap:is(jiffy:decode(<<"true">>), true, "DEC: true -> true"),
-    etap:is(jiffy:encode(true), <<"true">>, "ENC: true -> true"),
-
-    etap:is(jiffy:decode(<<"false">>), false, "DEC: false -> false"),
-    etap:is(jiffy:encode(false), <<"false">>, "ENC: false -> false"),
-
-    etap:is(jiffy:decode(<<"null">>), null, "DEC: null -> null"),
-    etap:is(jiffy:encode(null), <<"null">>, "ENC: null -> null"),
-
-    etap:end_tests().
-
-

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/003-numbers.t
----------------------------------------------------------------------
diff --git a/test/003-numbers.t b/test/003-numbers.t
deleted file mode 100755
index 2ac2ab4..0000000
--- a/test/003-numbers.t
+++ /dev/null
@@ -1,118 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(59 + 2 * length(double_conversion_tests())),
-    util:test_good(good()),
-    util:test_errors(errors()),
-    run_double_conversion_tests(),
-    etap:end_tests().
-
-
-run_double_conversion_tests() ->
-    lists:foreach(fun(Double) ->
-        Descr = io_lib:format("~f", [Double]),
-        etap:is(jiffy:decode(jiffy:encode(Double)), Double, Descr),
-        NegDouble = -1.0 * Double,
-        NegDescr = io_lib:format("~f", [NegDouble]),
-        etap:is(jiffy:decode(jiffy:encode(NegDouble)), NegDouble, NegDescr)
-    end, double_conversion_tests()).
-
-good() ->
-    [
-        {<<"0">>, 0},
-        {<<"-0">>, 0, <<"0">>},
-        {<<"1">>, 1},
-        {<<"12">>, 12},
-        {<<"-3">>, -3},
-        {<<"1234567890123456789012345">>, 1234567890123456789012345},
-        {<<"1310050760199">>, 1310050760199},
-        {
-            <<"1234567890123456789012345.0">>,
-            1.23456789012345678e24,
-            <<"1.2345678901234568e+24">>
-        },
-        {
-            <<"1234567890123456789012345.0E3">>,
-            1.2345678901234569e27,
-            <<"1.2345678901234569e+27">>
-        },
-        {
-            <<"1234567890123456789012345012">>,
-            1234567890123456789012345012,
-            <<"1234567890123456789012345012">>
-        },
-        {<<"1.0">>, 1.0},
-        {
-            <<"0.000000000000000000000000000000000001">>,
-            1.0E-36,
-            <<"1e-36">>
-        },
-        {<<"0.75">>, 0.75},
-        {<<"2.0123456789">>, 2.0123456789, <<"2.0123456789">>},
-        {<<"2.4234324E24">>, 2.4234324E24, <<"2.4234324e+24">>},
-        {<<"-3.1416">>, -3.1416, <<"-3.1416">>},
-        {<<"1E4">>, 10000.0, <<"10000.0">>},
-        {<<"1.0E+01">>, 10.0, <<"10.0">>},
-        {<<"1e1">>, 10.0, <<"10.0">>},
-        {<<"3.0E2">>, 300.0, <<"300.0">>},
-        {<<"0E3">>, 0.0, <<"0.0">>},
-        {<<"1.5E3">>, 1500.0, <<"1500.0">>},
-        {<<"2.5E-1">>, 0.25, <<"0.25">>},
-        {<<"-0.325E+2">>, -32.5, <<"-32.5">>}
-    ].
-
-
-errors() ->
-    [
-        <<"02">>,
-        <<"-01">>,
-        <<"+12">>,
-        <<"-">>,
-        <<"1.">>,
-        <<".1">>,
-        <<"1.-1">>,
-        <<"1E">>,
-        <<"1-E2">>,
-        <<"2E +3">>,
-        <<"1EA">>
-    ].
-
-
-double_conversion_tests() ->
-    [
-        0.0,
-        0.00000001,
-        0.000000012,
-        0.0000000123,
-        0.0000001,
-        0.00000012,
-        0.000000123,
-        0.000001,
-        0.00001,
-        0.01,
-        0.0123,
-        0.1,
-        0.3,
-        1.0,
-        1.0e20,
-        1.0e21,
-        9.0,
-        10.0,
-        90.0,
-        90.12,
-        10000.0,
-        12345.0,
-        12345.0e23,
-        100000.0,
-        100000000000000000000.0,
-        111111111111111111111.0,
-        1111111111111111111111.0,
-        11111111111111111111111.0
-    ].
-
-

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/004-strings.t
----------------------------------------------------------------------
diff --git a/test/004-strings.t b/test/004-strings.t
deleted file mode 100755
index d0214d5..0000000
--- a/test/004-strings.t
+++ /dev/null
@@ -1,127 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(115),
-    util:test_good(good()),
-    util:test_good(uescaped(), [uescape]),
-    util:test_errors(errors()),
-
-    test_utf8(utf8_cases()),
-
-    etap:end_tests().
-
-good() ->
-    [
-        {<<"\"\"">>, <<"">>},
-        {<<"\"/\"">>, <<"/">>},
-        {<<"\"0\"">>, <<"0">>},
-        {<<"\"foo\"">>, <<"foo">>},
-        {<<"\"\\\"foobar\\\"\"">>, <<"\"foobar\"">>},
-        {<<"\"\\n\\n\\n\"">>, <<"\n\n\n">>},
-        {<<"\"\\\" \\b\\f\\r\\n\\t\\\"\"">>, <<"\" \b\f\r\n\t\"">>},
-        {<<"\"foo\\u0005bar\"">>, <<"foo", 5, "bar">>},
-        {
-            <<"\"\\uD834\\uDD1E\"">>,
-            <<240, 157, 132, 158>>,
-            <<34, 240, 157, 132, 158, 34>>
-        },
-        {<<"\"\\uFFFF\"">>, <<239,191,191>>, <<34,239,191,191,34>>},
-        {<<"\"\\uFFFE\"">>, <<239,191,190>>, <<34,239,191,190,34>>}
-    ].
-
-uescaped() ->
-    [
-        {
-            <<"\"\\u8CA8\\u5481\\u3002\\u0091\\u0091\"">>,
-            <<232,178,168,229,146,129,227,128,130,194,145,194,145>>
-        },
-        {
-            <<"\"\\uD834\\uDD1E\"">>,
-            <<240, 157, 132, 158>>
-        },
-        {
-            <<"\"\\uD83D\\uDE0A\"">>,
-            <<240, 159, 152, 138>>
-        }
-    ].
-
-errors() ->
-    [
-        "\"",
-        <<"\"foo">>,
-        <<"\"", 0, "\"">>,
-        <<"\"\\g\"">>,
-        <<"\"\\uD834foo\\uDD1E\"">>,
-        % CouchDB-345
-        <<34,78,69,73,77,69,78,32,70,216,82,82,32,70,65,69,78,33,34>>
-    ].
-
-test_utf8([]) ->
-    ok;
-test_utf8([{Case, Fixed} | Rest]) ->
-    etap:fun_is(
-        fun({error, invalid_string}) -> true; (Else) -> Else end,
-        (catch jiffy:encode(Case)),
-        lists:flatten(io_lib:format("Invalid utf-8: ~p", [Case]))
-    ),
-    etap:fun_is(
-        fun(Fixed) -> true; (Else) -> Else end,
-        jiffy:encode(Case, [force_utf8]),
-        lists:flatten(io_lib:format("Fixed correctly: ~p", [Fixed]))
-    ),
-    Case2 = <<34, Case/binary, 34>>,
-    etap:fun_is(
-        fun({error, {_, invalid_string}}) -> true; (Else) -> Else end,
-        (catch jiffy:decode(Case2)),
-        lists:flatten(io_lib:format("Invalid utf-8: ~p", [Case2]))
-    ),
-    test_utf8(Rest).
-
-utf8_cases() ->
-    [
-        % Stray continuation byte
-        {<<16#C2, 16#81, 16#80>>, <<16#C2, 16#81, 16#EF, 16#BF, 16#BD>>},
-        {<<"foo", 16#80, "bar">>, <<"foo", 16#EF, 16#BF, 16#BD, "bar">>},
-
-        % Not enough extension bytes
-        {<<16#C0>>, <<16#EF, 16#BF, 16#BD>>},
-
-        {<<16#E0>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#E0, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-
-        {<<16#F0>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#F0, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#F0, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-
-        {<<16#F8>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#F8, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#F8, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#F8, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-
-        {<<16#FC>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#FC, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#FC, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#FC, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-        {<<16#FC, 16#80, 16#80, 16#80, 16#80>>, <<16#EF, 16#BF, 16#BD>>},
-
-        % No data in high bits.
-        {<<16#C0, 16#80>>, <<"\"\\u0000\"">>},
-        {<<16#C1, 16#80>>, <<"\"\\u0000\"">>},
-
-        {<<16#E0, 16#80, 16#80>>, <<"\"\\u0000\"">>},
-        {<<16#E0, 16#90, 16#80>>, <<"\"\\u0000\"">>},
-
-        {<<16#F0, 16#80, 16#80, 16#80>>, <<"\"\\u0000\"">>},
-        {<<16#F0, 16#88, 16#80, 16#80>>, <<"\"\\u0000\"">>},
-
-        {<<16#F8, 16#80, 16#80, 16#80, 16#80>>, <<"\"\\u0000\"">>},
-        {<<16#F8, 16#84, 16#80, 16#80, 16#80>>, <<"\"\\u0000\"">>},
-
-        {<<16#FC, 16#80, 16#80, 16#80, 16#80, 16#80>>, <<"\"\\u0000\"">>},
-        {<<16#FC, 16#82, 16#80, 16#80, 16#80, 16#80>>, <<"\"\\u0000\"">>}
-    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/005-arrays.t
----------------------------------------------------------------------
diff --git a/test/005-arrays.t b/test/005-arrays.t
deleted file mode 100755
index 1c43c0e..0000000
--- a/test/005-arrays.t
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(18),
-    util:test_good(good()),
-    util:test_errors(errors()),
-    etap:end_tests().
-
-good() ->
-    [
-        {<<"[]">>, []},
-        {<<"[\t[\n]\r]">>, [[]], <<"[[]]">>},
-        {<<"[\t123, \r true\n]">>, [123, true], <<"[123,true]">>},
-        {<<"[1,\"foo\"]">>, [1, <<"foo">>]},
-        {<<"[11993444355.0,1]">>, [11993444355.0,1]},
-        {
-            <<"[\"\\u00A1\",\"\\u00FC\"]">>,
-            [<<194, 161>>, <<195, 188>>],
-            <<"[\"", 194, 161, "\",\"", 195, 188, "\"]">>
-        }
-    ].
-
-errors() ->
-    [
-        <<"[">>,
-        <<"]">>,
-        <<"[,]">>,
-        <<"[123">>,
-        <<"[123,]">>,
-        <<"[32 true]">>
-    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/006-maps.t
----------------------------------------------------------------------
diff --git a/test/006-maps.t b/test/006-maps.t
deleted file mode 100755
index 45e715c..0000000
--- a/test/006-maps.t
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(15),
-    util:test_good(good()),
-    util:test_errors(errors()),
-    etap:end_tests().
-
-good() ->
-    [
-        {<<"{}">>, {[]}},
-        {<<"{\"foo\": \"bar\"}">>,
-            {[{<<"foo">>, <<"bar">>}]},
-            <<"{\"foo\":\"bar\"}">>},
-        {<<"\n\n{\"foo\":\r \"bar\",\n \"baz\"\t: 123 }">>,
-            {[{<<"foo">>, <<"bar">>}, {<<"baz">>, 123}]},
-            <<"{\"foo\":\"bar\",\"baz\":123}">>}
-    ].
-
-errors() ->
-    [
-        <<"{">>,
-        <<"{,}">>,
-        <<"{123:true}">>,
-        <<"{false:123}">>,
-        <<"{:\"stuff\"}">>,
-        <<"{\"key\":}">>,
-        <<"{\"key\": 123">>,
-        <<"{\"key\": 123 true">>,
-        <<"{\"key\": 123,}">>
-    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/007-compound.t
----------------------------------------------------------------------
diff --git a/test/007-compound.t b/test/007-compound.t
deleted file mode 100755
index 2770971..0000000
--- a/test/007-compound.t
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(12),
-    util:test_good(good()),
-    util:test_errors(errors()),
-    etap:end_tests().
-
-good() ->
-    [
-        {<<"[{}]">>, [{[]}]},
-        {<<"{\"foo\":[123]}">>, {[{<<"foo">>, [123]}]}},
-        {<<"{\"foo\":{\"bar\":true}}">>,
-            {[{<<"foo">>, {[{<<"bar">>, true}]} }]} },
-        {<<"{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}">>,
-            {[
-                {<<"foo">>, []},
-                {<<"bar">>, {[{<<"baz">>, true}]}},
-                {<<"alice">>, <<"bob">>}
-            ]}
-        },
-        {<<"[-123,\"foo\",{\"bar\":[]},null]">>,
-            [
-                -123,
-                <<"foo">>,
-                {[{<<"bar">>, []}]},
-                null
-            ]
-        }
-    ].
-
-errors() ->
-    [
-        <<"[{}">>,
-        <<"}]">>
-    ].

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/008-halfword.t
----------------------------------------------------------------------
diff --git a/test/008-halfword.t b/test/008-halfword.t
deleted file mode 100755
index 56f0439..0000000
--- a/test/008-halfword.t
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(unknown),
-
-    etap:is(jiffy:decode(<<"1">>) =:= 1, true, "1 =:= 1"),
-    etap:is(jiffy:decode(<<"1">>) == 1, true, "1 == 1"),
-
-    etap:end_tests().
-


[51/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge branch 'upstream' into upstream-merge


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/011893b3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/011893b3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/011893b3

Branch: refs/heads/master
Commit: 011893b39e61cbb76d8a7b7ae581466a469360b2
Parents: dc451c9 f661ee9
Author: Alexander Shorin <kx...@apache.org>
Authored: Sat Jul 25 15:50:15 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Sat Jul 25 15:50:15 2015 +0300

----------------------------------------------------------------------
 .gitignore                                   |    2 +
 .travis.yml                                  |   18 +
 Makefile                                     |    8 +-
 README.md                                    |   68 +-
 c_src/decoder.c                              |  214 +-
 c_src/double-conversion/AUTHORS              |    2 +
 c_src/double-conversion/DOWNLOADED           |    3 -
 c_src/double-conversion/README               |   45 +-
 c_src/double-conversion/VERSION              |    2 +
 c_src/double-conversion/bignum-dtoa.cc       |   11 +-
 c_src/double-conversion/bignum-dtoa.h        |    2 +-
 c_src/double-conversion/bignum.cc            |   28 +-
 c_src/double-conversion/bignum.h             |    3 +-
 c_src/double-conversion/cached-powers.cc     |    3 +-
 c_src/double-conversion/diy-fp.cc            |    4 +-
 c_src/double-conversion/diy-fp.h             |   24 +-
 c_src/double-conversion/double-conversion.cc |  221 +-
 c_src/double-conversion/double-conversion.h  |   35 +-
 c_src/double-conversion/fast-dtoa.cc         |   21 +-
 c_src/double-conversion/fast-dtoa.h          |    2 +-
 c_src/double-conversion/fixed-dtoa.cc        |   12 +-
 c_src/double-conversion/fixed-dtoa.h         |    2 +-
 c_src/double-conversion/ieee.h               |    4 +
 c_src/double-conversion/strtod.cc            |    5 +-
 c_src/double-conversion/strtod.h             |    2 +-
 c_src/double-conversion/utils.h              |   43 +-
 c_src/encoder.c                              |  276 +-
 c_src/jiffy.c                                |   33 +-
 c_src/jiffy.h                                |   34 +-
 c_src/utf8.c                                 |   34 +-
 c_src/util.c                                 |  115 +
 plugins/rebar_gdb_plugin.erl                 |   13 +
 rebar.config                                 |   13 +-
 rebar.config.script                          |   16 +-
 src/jiffy.app.src                            |    2 +-
 src/jiffy.erl                                |  129 +-
 src/jiffy_utf8.erl                           |   12 +
 test/001-yajl-tests.t                        |   30 -
 test/002-literals.t                          |   21 -
 test/003-numbers.t                           |  118 -
 test/004-strings.t                           |  127 -
 test/005-arrays.t                            |   36 -
 test/006-maps.t                              |   36 -
 test/007-compound.t                          |   41 -
 test/008-halfword.t                          |   15 -
 test/009-reg-issue-24.t                      | 3459 --------------------
 test/010-short-doubles.t                     |   29 -
 test/cases/doubles.eterm                     |    2 +-
 test/etap.erl                                |  612 ----
 test/jiffy_01_yajl_tests.erl                 |   32 +
 test/jiffy_02_literal_tests.erl              |   44 +
 test/jiffy_03_number_tests.erl               |  133 +
 test/jiffy_04_string_tests.erl               |  158 +
 test/jiffy_05_array_tests.erl                |   55 +
 test/jiffy_06_object_tests.erl               |   55 +
 test/jiffy_07_compound_tests.erl             |   60 +
 test/jiffy_08_halfword_tests.erl             |   15 +
 test/jiffy_09_reg_issue_24_tests.erl         | 3461 +++++++++++++++++++++
 test/jiffy_10_short_double_tests.erl         |   33 +
 test/jiffy_11_proper_tests.erl               |  185 ++
 test/jiffy_12_error_tests.erl                |   87 +
 test/jiffy_13_whitespace_tests.erl           |   16 +
 test/jiffy_15_return_trailer_tests.erl       |   19 +
 test/jiffy_tests.erl                         |  135 -
 test/jiffy_util.hrl                          |   27 +
 test/util.erl                                |   44 -
 66 files changed, 5552 insertions(+), 4994 deletions(-)
----------------------------------------------------------------------



[30/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge pull request #86 from clonejo/patch-1

update README.md fixing typo in maps example

Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/5d5cfe4f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/5d5cfe4f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/5d5cfe4f

Branch: refs/heads/master
Commit: 5d5cfe4f9b6cfd4e6d0ea429bf8eb62110a21145
Parents: 801f9e7 5337135
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri May 22 15:18:54 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri May 22 15:18:54 2015 -0500

----------------------------------------------------------------------
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[49/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Remove flaky test case

This test has proved its point and now just exists to randomly fail some
builds depending on race conditions with the garbage collector.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/d95c07cf
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/d95c07cf
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/d95c07cf

Branch: refs/heads/master
Commit: d95c07cf53a45a05aceb7ef1d1a4972a2d98cd50
Parents: 32b8939
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Jul 17 12:18:21 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jul 17 12:18:21 2015 -0500

----------------------------------------------------------------------
 test/jiffy_14_bignum_memory_leak.erl | 29 -----------------------------
 1 file changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/d95c07cf/test/jiffy_14_bignum_memory_leak.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_14_bignum_memory_leak.erl b/test/jiffy_14_bignum_memory_leak.erl
deleted file mode 100644
index df3f4df..0000000
--- a/test/jiffy_14_bignum_memory_leak.erl
+++ /dev/null
@@ -1,29 +0,0 @@
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
--module(jiffy_14_bignum_memory_leak).
-
--include_lib("eunit/include/eunit.hrl").
-
-
-bignum_encoding_leak_test_() ->
-    run_gc(),
-    Before = erlang:memory(binary),
-    encode_bignums(1000000),
-    run_gc(),
-    After = erlang:memory(binary),
-    ?_assert(After - Before < 100000).
-
-
-run_gc() ->
-    [erlang:garbage_collect(Pid) || Pid <- erlang:processes()].
-
-
-encode_bignums(N) ->
-    {_, Ref} = spawn_monitor(fun() ->
-        [jiffy:encode(1072502107250210725021072502) || _ <- lists:seq(1, N)]
-    end),
-    receive
-        {'DOWN', Ref, process, _, _} ->
-            ok
-    end.


[17/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Avoid uint64 for 32bit compatibility

Rather than worry about truncation casting from a possibly 64bit value
down to a possibly 32bit size_t we just limit the total bytes per
invocation to 4G using an unsigned integer.

Thanks to @seriyps for the report.

Fixes #61


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/99867af6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/99867af6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/99867af6

Branch: refs/heads/master
Commit: 99867af6e9bfec6bb80b10524d4dc27e39150dee
Parents: 307c383
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Jun 20 15:30:17 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jun 20 15:30:17 2014 -0500

----------------------------------------------------------------------
 c_src/util.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/99867af6/c_src/util.c
----------------------------------------------------------------------
diff --git a/c_src/util.c b/c_src/util.c
index 5420f81..7436add 100644
--- a/c_src/util.c
+++ b/c_src/util.c
@@ -31,6 +31,7 @@ get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
     jiffy_st* st = (jiffy_st*) enif_priv_data(env);
     const ERL_NIF_TERM* tuple;
     int arity;
+    unsigned int bytes;
 
     if(!enif_get_tuple(env, val, &arity, &tuple)) {
         return 0;
@@ -44,10 +45,12 @@ get_bytes_per_iter(ErlNifEnv* env, ERL_NIF_TERM val, size_t* bpi)
         return 0;
     }
 
-    if(!enif_get_uint64(env, tuple[1], bpi)) {
+    if(!enif_get_uint(env, tuple[1], &bytes)) {
         return 0;
     }
 
+    *bpi = (size_t) bytes;
+
     return 1;
 }
 


[22/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Persist the `val` register across yield

The `val` variable is a register value that we need to be able to return
at any time from `decode_iter`. If it happened that a yield was
triggered while processing trailing whitespace the lack of persistance
caused decode to return a term intialized from a random integer value.
Obviously the Erlang VM did not enjoy this.

Thanks to @michalpalka for the report.

Fixes #66


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/5cd89c1e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/5cd89c1e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/5cd89c1e

Branch: refs/heads/master
Commit: 5cd89c1eda3801bdef790b1e7c0e09259332c0fc
Parents: f9095c5
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sat Aug 23 07:20:37 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sat Aug 23 07:20:37 2014 -0500

----------------------------------------------------------------------
 c_src/decoder.c                    | 22 ++++++++++++----------
 c_src/jiffy.c                      |  2 +-
 src/jiffy.erl                      | 14 +++++++-------
 test/jiffy_13_whitespace_tests.erl | 16 ++++++++++++++++
 4 files changed, 36 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5cd89c1e/c_src/decoder.c
----------------------------------------------------------------------
diff --git a/c_src/decoder.c b/c_src/decoder.c
index e7dc48b..ad3e8d3 100644
--- a/c_src/decoder.c
+++ b/c_src/decoder.c
@@ -675,7 +675,7 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 {
     Decoder* d;
     jiffy_st* st = (jiffy_st*) enif_priv_data(env);
-    ERL_NIF_TERM tmp_argv[4];
+    ERL_NIF_TERM tmp_argv[5];
     ERL_NIF_TERM opts;
     ERL_NIF_TERM val;
 
@@ -690,8 +690,9 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 
     tmp_argv[0] = argv[0];
     tmp_argv[1] = enif_make_resource(env, d);
-    tmp_argv[2] = enif_make_list(env, 0);
+    tmp_argv[2] = st->atom_error;
     tmp_argv[3] = enif_make_list(env, 0);
+    tmp_argv[4] = enif_make_list(env, 0);
 
     enif_release_resource(d);
 
@@ -716,7 +717,7 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
         }
     }
 
-    return decode_iter(env, 4, tmp_argv);
+    return decode_iter(env, 5, tmp_argv);
 }
 
 ERL_NIF_TERM
@@ -729,25 +730,25 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 
     ERL_NIF_TERM objs;
     ERL_NIF_TERM curr;
-    ERL_NIF_TERM val;
+    ERL_NIF_TERM val = argv[2];
     ERL_NIF_TERM ret;
     size_t start;
 
-    if(argc != 4) {
+    if(argc != 5) {
         return enif_make_badarg(env);
     } else if(!enif_inspect_binary(env, argv[0], &bin)) {
         return enif_make_badarg(env);
     } else if(!enif_get_resource(env, argv[1], st->res_dec, (void**) &d)) {
         return enif_make_badarg(env);
-    } else if(!enif_is_list(env, argv[2])) {
-        return enif_make_badarg(env);
     } else if(!enif_is_list(env, argv[3])) {
         return enif_make_badarg(env);
+    } else if(!enif_is_list(env, argv[4])) {
+        return enif_make_badarg(env);
     }
 
     dec_init(d, env, argv[0], &bin);
-    objs = argv[2];
-    curr = argv[3];
+    objs = argv[3];
+    curr = argv[4];
 
     //fprintf(stderr, "Parsing:\r\n");
     start = d->i;
@@ -755,10 +756,11 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
         //fprintf(stderr, "state: %d\r\n", dec_curr(d));
         if(should_yield(d->i - start, d->bytes_per_iter)) {
             consume_timeslice(env, d->i - start, d->bytes_per_iter);
-            return enif_make_tuple4(
+            return enif_make_tuple5(
                     env,
                     st->atom_iter,
                     argv[1],
+                    val,
                     objs,
                     curr
                 );

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5cd89c1e/c_src/jiffy.c
----------------------------------------------------------------------
diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index 205de91..31aa854 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -78,7 +78,7 @@ unload(ErlNifEnv* env, void* priv)
 static ErlNifFunc funcs[] =
 {
     {"nif_decode_init", 2, decode_init},
-    {"nif_decode_iter", 4, decode_iter},
+    {"nif_decode_iter", 5, decode_iter},
     {"nif_encode_init", 2, encode_init},
     {"nif_encode_iter", 3, encode_iter}
 };

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5cd89c1e/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 9642b25..23a0c9d 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -18,8 +18,8 @@ decode(Data, Opts) when is_binary(Data), is_list(Opts) ->
             throw(Error);
         {partial, EJson} ->
             finish_decode(EJson);
-        {iter, Decoder, Objs, Curr} ->
-            decode_loop(Data, Decoder, Objs, Curr);
+        {iter, Decoder, Val, Objs, Curr} ->
+            decode_loop(Data, Decoder, Val, Objs, Curr);
         EJson ->
             EJson
     end;
@@ -120,14 +120,14 @@ init() ->
     erlang:load_nif(filename:join(PrivDir, "jiffy"), 0).
 
 
-decode_loop(Data, Decoder, Objs, Curr) ->
-    case nif_decode_iter(Data, Decoder, Objs, Curr) of
+decode_loop(Data, Decoder, Val, Objs, Curr) ->
+    case nif_decode_iter(Data, Decoder, Val, Objs, Curr) of
         {error, _} = Error ->
             throw(Error);
         {partial, EJson} ->
             finish_decode(EJson);
-        {iter, NewDecoder, NewObjs, NewCurr} ->
-            decode_loop(Data, NewDecoder, NewObjs, NewCurr);
+        {iter, NewDecoder, NewVal, NewObjs, NewCurr} ->
+            decode_loop(Data, NewDecoder, NewVal, NewObjs, NewCurr);
         EJson ->
             EJson
     end.
@@ -156,7 +156,7 @@ not_loaded(Line) ->
 nif_decode_init(_Data, _Opts) ->
     ?NOT_LOADED.
 
-nif_decode_iter(_Data, _Decoder, _, _) ->
+nif_decode_iter(_Data, _Decoder, _, _, _) ->
     ?NOT_LOADED.
 
 nif_encode_init(_Data, _Options) ->

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5cd89c1e/test/jiffy_13_whitespace_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_13_whitespace_tests.erl b/test/jiffy_13_whitespace_tests.erl
new file mode 100644
index 0000000..9261b6e
--- /dev/null
+++ b/test/jiffy_13_whitespace_tests.erl
@@ -0,0 +1,16 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_13_whitespace_tests).
+
+-include_lib("eunit/include/eunit.hrl").
+
+
+trailing_whitespace_test_() ->
+    Str = [<<"{\"a\":\"b\"}">>, gen_ws(2040)],
+    Obj = {[{<<"a">>, <<"b">>}]},
+    ?_assertEqual(Obj, jiffy:decode(Str)).
+
+
+gen_ws(N) ->
+   [" " || _ <- lists:seq(1, N)]. 
\ No newline at end of file


[09/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Adjust timeouts to a sane cutoff


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/fb1b7e72
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/fb1b7e72
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/fb1b7e72

Branch: refs/heads/master
Commit: fb1b7e7201db1cb33dc1a03d50caab0ba55f3803
Parents: 5752dbc
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:14:57 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:14:57 2014 -0500

----------------------------------------------------------------------
 test/jiffy_10_short_double_tests.erl | 2 +-
 test/jiffy_11_proper_tests.erl       | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/fb1b7e72/test/jiffy_10_short_double_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_10_short_double_tests.erl b/test/jiffy_10_short_double_tests.erl
index 1c1d069..bb2f1b8 100644
--- a/test/jiffy_10_short_double_tests.erl
+++ b/test/jiffy_10_short_double_tests.erl
@@ -14,7 +14,7 @@ filename() -> "../test/cases/short-doubles.txt".
 
 short_double_test() ->
     {ok, Fd} = file:open(filename(), [read, binary, raw]),
-    {"all doubles round trip", ?assertEqual(0, run(Fd, 0))}.
+    {"all doubles round trip", {timeout, 300, ?assertEqual(0, run(Fd, 0))}}.
 
 
 run(Fd, Acc) ->

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/fb1b7e72/test/jiffy_11_proper_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_11_proper_tests.erl b/test/jiffy_11_proper_tests.erl
index aca542e..2c254bf 100644
--- a/test/jiffy_11_proper_tests.erl
+++ b/test/jiffy_11_proper_tests.erl
@@ -17,17 +17,17 @@ opts() ->
 
 run(Name) ->
     {msg("~s", [Name]), [
-        {timeout, 3600, ?_assert(proper:quickcheck(?MODULE:Name(), opts()))}
+        {timeout, 300, ?_assert(proper:quickcheck(?MODULE:Name(), opts()))}
     ]}.
 
 proper_encode_decode_test_() ->
-    {timeout, 3600, [
+    [
         run(prop_enc_dec),
         run(prop_enc_dec_pretty),
         run(prop_enc_no_crash),
         run(prop_dec_no_crash_bin),
         run(prop_dec_no_crash_any)
-    ]}.
+    ].
 
 prop_enc_dec() ->
     ?FORALL(Data, json(),


[08/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Remove etap target from the Makefile


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/5752dbc1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/5752dbc1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/5752dbc1

Branch: refs/heads/master
Commit: 5752dbc1fc2d9e5fd41c347b206295af8445764f
Parents: 46b3152
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:14:39 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:14:39 2014 -0500

----------------------------------------------------------------------
 Makefile | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5752dbc1/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index 95b4233..025486e 100644
--- a/Makefile
+++ b/Makefile
@@ -29,15 +29,11 @@ build: depends
 	$(REBAR) compile
 
 
-etap: test/etap.beam test/util.beam
-	prove test/*.t
-
-
 eunit:
 	$(REBAR) eunit skip_deps=true
 
 
-check: build etap eunit
+check: build eunit
 
 
 %.beam: %.erl


[02/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/jiffy_09_reg_issue_24_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_09_reg_issue_24_tests.erl b/test/jiffy_09_reg_issue_24_tests.erl
new file mode 100644
index 0000000..ca72d1b
--- /dev/null
+++ b/test/jiffy_09_reg_issue_24_tests.erl
@@ -0,0 +1,3462 @@
+% This file is part of Jiffy released under the MIT license.
+% See the LICENSE file for more information.
+
+-module(jiffy_09_reg_issue_24_tests).
+
+
+-include_lib("proper/include/proper.hrl").
+-include_lib("eunit/include/eunit.hrl").
+-include("jiffy_util.hrl").
+
+
+no_segfault_test_() ->
+    {"no segfault", [
+        ?_assert(begin jiffy:encode(big_doc(), [uescape]), true end)
+    ]}.
+
+
+big_doc() ->
+    {[{<<"_id">>,<<"_design/bookmarks">>},
+      {<<"_rev">>,<<"1-1794a8236590d2fc6c288115dc539a3d">>},
+      {<<"lib">>,
+       {[{<<"app">>,
+          <<"\nmodule.exports = {\n\n    views: require('./views'),\n    shows : require('./shows'),\n    rewrites: require('./rewrites'),\n    updates: require('./updates')\n};\n\n// Bind event handlers\n// require('./events')\n">>},
+         {<<"rewrites">>,
+          <<"/**\n * Rewrite settings to be exported from the design doc\n */\n\nmodule.exports = [\n    {from: '/static/*', to: 'static/*'},\n    {from: '/bootstrap/*', to: 'bootstrap/*'},\n    {from: '/modules.js', to: 'modules.js' },\n    {\"from\": \"/_db/*\", \"to\": \"../../*\" },\n    {\"from\": \"/_db\", \"to\": \"../..\" },\n    {\"from\": \"/bookmark_lite\", \"to\" : \"_show/bookmark_lite\"},\n    {\"from\": \"/bookmark\", \"to\" : \"_show/bookmark\"},\n    {\"from\": \"/save\", \"to\" : \"_update/bookmark\"},\n    {\"from\": \"/click/*\", \"to\" : \"_update/click/*\"},\n    {\"from\": \"/archive/*\", \"to\" : \"_update/archive/*\"},\n    {from: '/', to: 'index.html'}\n];">>},
+         {<<"shows">>,
+          <<"var templates = require('handlebars').templates;\n\nexports.bookmark_lite = function(doc, req) {\n\n    return {\n        code: 200,\n        headers: {'content-type' : 'text/html'},\n        body: templates['newBookmark.html']({\n            title : req.query.title,\n            url  : req.query.url\n        })\n    };\n\n}\n\nexports.bookmark = function(doc, req) {\n    return {\n        code: 200,\n        headers: {'content-type' : 'text/html'},\n        body: '<h2>Hellp</h2>'\n    };\n}\n\n">>},
+         {<<"updates">>,
+          <<"\nvar md5 = require('md5');\nvar querystring = require('querystring');\n\nexports.bookmark = function(doc, req) {\n\n    var details = {};\n    if (req.body && req.body.length > 0) {\n        details = querystring.parse(req.body);\n    }\n    if (req.query.title) details.title = req.query.title;\n    if (req.query.url)   details.url = req.query.url;\n\n    if (!doc) {\n        var id = md5.hex(details.url);\n        var doc = {\n            _id : id,\n            type: 'com.eckoit.bookmark',\n            title : decodeURIComponent(details.title),\n            url : decodeURIComponent(details.url),\n            timestamp: new Date().getTime()\n        };\n        if (details.short_text) doc.short_text = details.short_text;\n        log(doc);\n        return [doc, 'SUCCESS']\n\n    } else {\n\n    }\n}\n\nexports.click = function(doc, req) {\n    if (!doc.clicks) doc.clicks = 0;\n    doc.clicks++;\n    return [doc, 'SUCCESS'];\n}\n\nexports.archive = function(doc, req) {\
 n    doc.archive = true;\n    return [doc, 'SUCCESS'];\n}">>},
+         {<<"views">>,
+          <<"\n\nexports.by_date = {\n    map : function(doc) {\n\n        if (doc.archive) return;\n\n        if (doc.type && doc.type === 'com.eckoit.bookmark' ) {\n            var timestamp = doc.timestamp;\n            if (!timestamp) timestamp = new Date(0);\n            emit(timestamp, null);\n        }\n    }\n}\n\nexports.by_views = {\n    map : function(doc) {\n\n        if (doc.archive) return;\n\n        if (doc.type && doc.type === 'com.eckoit.bookmark' ) {\n            var clicks = doc.clicks;\n            if (!clicks) clicks = 0;\n\n            var timestamp = doc.timestamp;\n            if (!timestamp) timestamp = new Date(0);\n\n            emit([clicks, timestamp], null);\n        }\n    }\n}\n\nexports.all_tags = {\n    map : function(doc) {\n        if (doc.type && doc.type == 'garden.tag') {\n            emit(doc.hash, null);\n        }\n    }\n}\n">>}]}},
+      {<<"underscore">>,
+       <<"//     Underscore.js 1.3.1\n//     (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.\n//     Underscore is freely distributable under the MIT license.\n//     Portions of Underscore are inspired or borrowed from Prototype,\n//     Oliver Steele's Functional, and John Resig's Micro-Templating.\n//     For all details and documentation:\n//     http://documentcloud.github.com/underscore\n\n(function() {\n\n  // Baseline setup\n  // --------------\n\n  // Establish the root object, `window` in the browser, or `global` on the server.\n  var root = this;\n\n  // Save the previous value of the `_` variable.\n  var previousUnderscore = root._;\n\n  // Establish the object that gets returned to break out of a loop iteration.\n  var breaker = {};\n\n  // Save bytes in the minified (but not gzipped) version:\n  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;\n\n  // Create quick reference variables for speed access to core prototypes.\n
   var slice            = ArrayProto.slice,\n      unshift          = ArrayProto.unshift,\n      toString         = ObjProto.toString,\n      hasOwnProperty   = ObjProto.hasOwnProperty;\n\n  // All **ECMAScript 5** native function implementations that we hope to use\n  // are declared here.\n  var\n    nativeForEach      = ArrayProto.forEach,\n    nativeMap          = ArrayProto.map,\n    nativeReduce       = ArrayProto.reduce,\n    nativeReduceRight  = ArrayProto.reduceRight,\n    nativeFilter       = ArrayProto.filter,\n    nativeEvery        = ArrayProto.every,\n    nativeSome         = ArrayProto.some,\n    nativeIndexOf      = ArrayProto.indexOf,\n    nativeLastIndexOf  = ArrayProto.lastIndexOf,\n    nativeIsArray      = Array.isArray,\n    nativeKeys         = Object.keys,\n    nativeBind         = FuncProto.bind;\n\n  // Create a safe reference to the Underscore object for use below.\n  var _ = function(obj) { return new wrapper(obj); };\n\n  // Export the Underscore object fo
 r **Node.js**, with\n  // backwards-compatibility for the old `require()` API. If we're in\n  // the browser, add `_` as a global object via a string identifier,\n  // for Closure Compiler \"advanced\" mode.\n  if (typeof exports !== 'undefined') {\n    if (typeof module !== 'undefined' && module.exports) {\n      exports = module.exports = _;\n    }\n    exports._ = _;\n  } else {\n    root['_'] = _;\n  }\n\n  // Current version.\n  _.VERSION = '1.3.1';\n\n  // Collection Functions\n  // --------------------\n\n  // The cornerstone, an `each` implementation, aka `forEach`.\n  // Handles objects with the built-in `forEach`, arrays, and raw objects.\n  // Delegates to **ECMAScript 5**'s native `forEach` if available.\n  var each = _.each = _.forEach = function(obj, iterator, context) {\n    if (obj == null) return;\n    if (nativeForEach && obj.forEach === nativeForEach) {\n      obj.forEach(iterator, context);\n    } else if (obj.length === +obj.length) {\n      for (var i = 0, l = 
 obj.length; i < l; i++) {\n        if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;\n      }\n    } else {\n      for (var key in obj) {\n        if (_.has(obj, key)) {\n          if (iterator.call(context, obj[key], key, obj) === breaker) return;\n        }\n      }\n    }\n  };\n\n  // Return the results of applying the iterator to each element.\n  // Delegates to **ECMAScript 5**'s native `map` if available.\n  _.map = _.collect = function(obj, iterator, context) {\n    var results = [];\n    if (obj == null) return results;\n    if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n    each(obj, function(value, index, list) {\n      results[results.length] = iterator.call(context, value, index, list);\n    });\n    if (obj.length === +obj.length) results.length = obj.length;\n    return results;\n  };\n\n  // **Reduce** builds up a single result from a list of values, aka `inject`,\n  // or `foldl`. Delegates to **ECMAScript 5**'s
  native `reduce` if available.\n  _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {\n    var initial = arguments.length > 2;\n    if (obj == null) obj = [];\n    if (nativeReduce && obj.reduce === nativeReduce) {\n      if (context) iterator = _.bind(iterator, context);\n      return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);\n    }\n    each(obj, function(value, index, list) {\n      if (!initial) {\n        memo = value;\n        initial = true;\n      } else {\n        memo = iterator.call(context, memo, value, index, list);\n      }\n    });\n    if (!initial) throw new TypeError('Reduce of empty array with no initial value');\n    return memo;\n  };\n\n  // The right-associative version of reduce, also known as `foldr`.\n  // Delegates to **ECMAScript 5**'s native `reduceRight` if available.\n  _.reduceRight = _.foldr = function(obj, iterator, memo, context) {\n    var initial = arguments.length > 2;\n    if (obj == null) obj = [];\n    
 if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {\n      if (context) iterator = _.bind(iterator, context);\n      return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);\n    }\n    var reversed = _.toArray(obj).reverse();\n    if (context && !initial) iterator = _.bind(iterator, context);\n    return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);\n  };\n\n  // Return the first value which passes a truth test. Aliased as `detect`.\n  _.find = _.detect = function(obj, iterator, context) {\n    var result;\n    any(obj, function(value, index, list) {\n      if (iterator.call(context, value, index, list)) {\n        result = value;\n        return true;\n      }\n    });\n    return result;\n  };\n\n  // Return all the elements that pass a truth test.\n  // Delegates to **ECMAScript 5**'s native `filter` if available.\n  // Aliased as `select`.\n  _.filter = _.select = function(obj, iterator, context) {\n    
 var results = [];\n    if (obj == null) return results;\n    if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);\n    each(obj, function(value, index, list) {\n      if (iterator.call(context, value, index, list)) results[results.length] = value;\n    });\n    return results;\n  };\n\n  // Return all the elements for which a truth test fails.\n  _.reject = function(obj, iterator, context) {\n    var results = [];\n    if (obj == null) return results;\n    each(obj, function(value, index, list) {\n      if (!iterator.call(context, value, index, list)) results[results.length] = value;\n    });\n    return results;\n  };\n\n  // Determine whether all of the elements match a truth test.\n  // Delegates to **ECMAScript 5**'s native `every` if available.\n  // Aliased as `all`.\n  _.every = _.all = function(obj, iterator, context) {\n    var result = true;\n    if (obj == null) return result;\n    if (nativeEvery && obj.every === nativeEvery) return obj.
 every(iterator, context);\n    each(obj, function(value, index, list) {\n      if (!(result = result && iterator.call(context, value, index, list))) return breaker;\n    });\n    return result;\n  };\n\n  // Determine if at least one element in the object matches a truth test.\n  // Delegates to **ECMAScript 5**'s native `some` if available.\n  // Aliased as `any`.\n  var any = _.some = _.any = function(obj, iterator, context) {\n    iterator || (iterator = _.identity);\n    var result = false;\n    if (obj == null) return result;\n    if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);\n    each(obj, function(value, index, list) {\n      if (result || (result = iterator.call(context, value, index, list))) return breaker;\n    });\n    return !!result;\n  };\n\n  // Determine if a given value is included in the array or object using `===`.\n  // Aliased as `contains`.\n  _.include = _.contains = function(obj, target) {\n    var found = false;\n    if (obj 
 == null) return found;\n    if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;\n    found = any(obj, function(value) {\n      return value === target;\n    });\n    return found;\n  };\n\n  // Invoke a method (with arguments) on every item in a collection.\n  _.invoke = function(obj, method) {\n    var args = slice.call(arguments, 2);\n    return _.map(obj, function(value) {\n      return (_.isFunction(method) ? method || value : value[method]).apply(value, args);\n    });\n  };\n\n  // Convenience version of a common use case of `map`: fetching a property.\n  _.pluck = function(obj, key) {\n    return _.map(obj, function(value){ return value[key]; });\n  };\n\n  // Return the maximum element or (element-based computation).\n  _.max = function(obj, iterator, context) {\n    if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);\n    if (!iterator && _.isEmpty(obj)) return -Infinity;\n    var result = {computed : -Infinity};\n    each(ob
 j, function(value, index, list) {\n      var computed = iterator ? iterator.call(context, value, index, list) : value;\n      computed >= result.computed && (result = {value : value, computed : computed});\n    });\n    return result.value;\n  };\n\n  // Return the minimum element (or element-based computation).\n  _.min = function(obj, iterator, context) {\n    if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);\n    if (!iterator && _.isEmpty(obj)) return Infinity;\n    var result = {computed : Infinity};\n    each(obj, function(value, index, list) {\n      var computed = iterator ? iterator.call(context, value, index, list) : value;\n      computed < result.computed && (result = {value : value, computed : computed});\n    });\n    return result.value;\n  };\n\n  // Shuffle an array.\n  _.shuffle = function(obj) {\n    var shuffled = [], rand;\n    each(obj, function(value, index, list) {\n      if (index == 0) {\n        shuffled[0] = value;\n      } else {\n      
   rand = Math.floor(Math.random() * (index + 1));\n        shuffled[index] = shuffled[rand];\n        shuffled[rand] = value;\n      }\n    });\n    return shuffled;\n  };\n\n  // Sort the object's values by a criterion produced by an iterator.\n  _.sortBy = function(obj, iterator, context) {\n    return _.pluck(_.map(obj, function(value, index, list) {\n      return {\n        value : value,\n        criteria : iterator.call(context, value, index, list)\n      };\n    }).sort(function(left, right) {\n      var a = left.criteria, b = right.criteria;\n      return a < b ? -1 : a > b ? 1 : 0;\n    }), 'value');\n  };\n\n  // Groups the object's values by a criterion. Pass either a string attribute\n  // to group by, or a function that returns the criterion.\n  _.groupBy = function(obj, val) {\n    var result = {};\n    var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };\n    each(obj, function(value, index) {\n      var key = iterator(value, index);\n      (re
 sult[key] || (result[key] = [])).push(value);\n    });\n    return result;\n  };\n\n  // Use a comparator function to figure out at what index an object should\n  // be inserted so as to maintain order. Uses binary search.\n  _.sortedIndex = function(array, obj, iterator) {\n    iterator || (iterator = _.identity);\n    var low = 0, high = array.length;\n    while (low < high) {\n      var mid = (low + high) >> 1;\n      iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;\n    }\n    return low;\n  };\n\n  // Safely convert anything iterable into a real, live array.\n  _.toArray = function(iterable) {\n    if (!iterable)                return [];\n    if (iterable.toArray)         return iterable.toArray();\n    if (_.isArray(iterable))      return slice.call(iterable);\n    if (_.isArguments(iterable))  return slice.call(iterable);\n    return _.values(iterable);\n  };\n\n  // Return the number of elements in an object.\n  _.size = function(obj) {\n    return _.toArr
 ay(obj).length;\n  };\n\n  // Array Functions\n  // ---------------\n\n  // Get the first element of an array. Passing **n** will return the first N\n  // values in the array. Aliased as `head`. The **guard** check allows it to work\n  // with `_.map`.\n  _.first = _.head = function(array, n, guard) {\n    return (n != null) && !guard ? slice.call(array, 0, n) : array[0];\n  };\n\n  // Returns everything but the last entry of the array. Especcialy useful on\n  // the arguments object. Passing **n** will return all the values in\n  // the array, excluding the last N. The **guard** check allows it to work with\n  // `_.map`.\n  _.initial = function(array, n, guard) {\n    return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));\n  };\n\n  // Get the last element of an array. Passing **n** will return the last N\n  // values in the array. The **guard** check allows it to work with `_.map`.\n  _.last = function(array, n, guard) {\n    if ((n != null) && !guard) {\n   
    return slice.call(array, Math.max(array.length - n, 0));\n    } else {\n      return array[array.length - 1];\n    }\n  };\n\n  // Returns everything but the first entry of the array. Aliased as `tail`.\n  // Especially useful on the arguments object. Passing an **index** will return\n  // the rest of the values in the array from that index onward. The **guard**\n  // check allows it to work with `_.map`.\n  _.rest = _.tail = function(array, index, guard) {\n    return slice.call(array, (index == null) || guard ? 1 : index);\n  };\n\n  // Trim out all falsy values from an array.\n  _.compact = function(array) {\n    return _.filter(array, function(value){ return !!value; });\n  };\n\n  // Return a completely flattened version of an array.\n  _.flatten = function(array, shallow) {\n    return _.reduce(array, function(memo, value) {\n      if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));\n      memo[memo.length] = value;\n      return memo;\n    }, []);
 \n  };\n\n  // Return a version of the array that does not contain the specified value(s).\n  _.without = function(array) {\n    return _.difference(array, slice.call(arguments, 1));\n  };\n\n  // Produce a duplicate-free version of the array. If the array has already\n  // been sorted, you have the option of using a faster algorithm.\n  // Aliased as `unique`.\n  _.uniq = _.unique = function(array, isSorted, iterator) {\n    var initial = iterator ? _.map(array, iterator) : array;\n    var result = [];\n    _.reduce(initial, function(memo, el, i) {\n      if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {\n        memo[memo.length] = el;\n        result[result.length] = array[i];\n      }\n      return memo;\n    }, []);\n    return result;\n  };\n\n  // Produce an array that contains the union: each distinct element from all of\n  // the passed-in arrays.\n  _.union = function() {\n    return _.uniq(_.flatten(arguments, true));\n  };\n\n  // Produce a
 n array that contains every item shared between all the\n  // passed-in arrays. (Aliased as \"intersect\" for back-compat.)\n  _.intersection = _.intersect = function(array) {\n    var rest = slice.call(arguments, 1);\n    return _.filter(_.uniq(array), function(item) {\n      return _.every(rest, function(other) {\n        return _.indexOf(other, item) >= 0;\n      });\n    });\n  };\n\n  // Take the difference between one array and a number of other arrays.\n  // Only the elements present in just the first array will remain.\n  _.difference = function(array) {\n    var rest = _.flatten(slice.call(arguments, 1));\n    return _.filter(array, function(value){ return !_.include(rest, value); });\n  };\n\n  // Zip together multiple lists into a single array -- elements that share\n  // an index go together.\n  _.zip = function() {\n    var args = slice.call(arguments);\n    var length = _.max(_.pluck(args, 'length'));\n    var results = new Array(length);\n    for (var i = 0; i < lengt
 h; i++) results[i] = _.pluck(args, \"\" + i);\n    return results;\n  };\n\n  // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),\n  // we need this function. Return the position of the first occurrence of an\n  // item in an array, or -1 if the item is not included in the array.\n  // Delegates to **ECMAScript 5**'s native `indexOf` if available.\n  // If the array is large and already in sort order, pass `true`\n  // for **isSorted** to use binary search.\n  _.indexOf = function(array, item, isSorted) {\n    if (array == null) return -1;\n    var i, l;\n    if (isSorted) {\n      i = _.sortedIndex(array, item);\n      return array[i] === item ? i : -1;\n    }\n    if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);\n    for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;\n    return -1;\n  };\n\n  // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.\n  _.lastIndexOf = f
 unction(array, item) {\n    if (array == null) return -1;\n    if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);\n    var i = array.length;\n    while (i--) if (i in array && array[i] === item) return i;\n    return -1;\n  };\n\n  // Generate an integer Array containing an arithmetic progression. A port of\n  // the native Python `range()` function. See\n  // [the Python documentation](http://docs.python.org/library/functions.html#range).\n  _.range = function(start, stop, step) {\n    if (arguments.length <= 1) {\n      stop = start || 0;\n      start = 0;\n    }\n    step = arguments[2] || 1;\n\n    var len = Math.max(Math.ceil((stop - start) / step), 0);\n    var idx = 0;\n    var range = new Array(len);\n\n    while(idx < len) {\n      range[idx++] = start;\n      start += step;\n    }\n\n    return range;\n  };\n\n  // Function (ahem) Functions\n  // ------------------\n\n  // Reusable constructor function for prototype setting.\n
   var ctor = function(){};\n\n  // Create a function bound to a given object (assigning `this`, and arguments,\n  // optionally). Binding with arguments is also known as `curry`.\n  // Delegates to **ECMAScript 5**'s native `Function.bind` if available.\n  // We check for `func.bind` first, to fail fast when `func` is undefined.\n  _.bind = function bind(func, context) {\n    var bound, args;\n    if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));\n    if (!_.isFunction(func)) throw new TypeError;\n    args = slice.call(arguments, 2);\n    return bound = function() {\n      if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));\n      ctor.prototype = func.prototype;\n      var self = new ctor;\n      var result = func.apply(self, args.concat(slice.call(arguments)));\n      if (Object(result) === result) return result;\n      return self;\n    };\n  };\n\n  // Bind all of an object's methods to 
 that object. Useful for ensuring that\n  // all callbacks defined on an object belong to it.\n  _.bindAll = function(obj) {\n    var funcs = slice.call(arguments, 1);\n    if (funcs.length == 0) funcs = _.functions(obj);\n    each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });\n    return obj;\n  };\n\n  // Memoize an expensive function by storing its results.\n  _.memoize = function(func, hasher) {\n    var memo = {};\n    hasher || (hasher = _.identity);\n    return function() {\n      var key = hasher.apply(this, arguments);\n      return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));\n    };\n  };\n\n  // Delays a function for the given number of milliseconds, and then calls\n  // it with the arguments supplied.\n  _.delay = function(func, wait) {\n    var args = slice.call(arguments, 2);\n    return setTimeout(function(){ return func.apply(func, args); }, wait);\n  };\n\n  // Defers a function, scheduling it to run after the current call stack
  has\n  // cleared.\n  _.defer = function(func) {\n    return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));\n  };\n\n  // Returns a function, that, when invoked, will only be triggered at most once\n  // during a given window of time.\n  _.throttle = function(func, wait) {\n    var context, args, timeout, throttling, more;\n    var whenDone = _.debounce(function(){ more = throttling = false; }, wait);\n    return function() {\n      context = this; args = arguments;\n      var later = function() {\n        timeout = null;\n        if (more) func.apply(context, args);\n        whenDone();\n      };\n      if (!timeout) timeout = setTimeout(later, wait);\n      if (throttling) {\n        more = true;\n      } else {\n        func.apply(context, args);\n      }\n      whenDone();\n      throttling = true;\n    };\n  };\n\n  // Returns a function, that, as long as it continues to be invoked, will not\n  // be triggered. The function will be called after it stops being ca
 lled for\n  // N milliseconds.\n  _.debounce = function(func, wait) {\n    var timeout;\n    return function() {\n      var context = this, args = arguments;\n      var later = function() {\n        timeout = null;\n        func.apply(context, args);\n      };\n      clearTimeout(timeout);\n      timeout = setTimeout(later, wait);\n    };\n  };\n\n  // Returns a function that will be executed at most one time, no matter how\n  // often you call it. Useful for lazy initialization.\n  _.once = function(func) {\n    var ran = false, memo;\n    return function() {\n      if (ran) return memo;\n      ran = true;\n      return memo = func.apply(this, arguments);\n    };\n  };\n\n  // Returns the first function passed as an argument to the second,\n  // allowing you to adjust arguments, run code before and after, and\n  // conditionally execute the original function.\n  _.wrap = function(func, wrapper) {\n    return function() {\n      var args = [func].concat(slice.call(arguments, 0));\n 
      return wrapper.apply(this, args);\n    };\n  };\n\n  // Returns a function that is the composition of a list of functions, each\n  // consuming the return value of the function that follows.\n  _.compose = function() {\n    var funcs = arguments;\n    return function() {\n      var args = arguments;\n      for (var i = funcs.length - 1; i >= 0; i--) {\n        args = [funcs[i].apply(this, args)];\n      }\n      return args[0];\n    };\n  };\n\n  // Returns a function that will only be executed after being called N times.\n  _.after = function(times, func) {\n    if (times <= 0) return func();\n    return function() {\n      if (--times < 1) { return func.apply(this, arguments); }\n    };\n  };\n\n  // Object Functions\n  // ----------------\n\n  // Retrieve the names of an object's properties.\n  // Delegates to **ECMAScript 5**'s native `Object.keys`\n  _.keys = nativeKeys || function(obj) {\n    if (obj !== Object(obj)) throw new TypeError('Invalid object');\n    var keys = 
 [];\n    for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;\n    return keys;\n  };\n\n  // Retrieve the values of an object's properties.\n  _.values = function(obj) {\n    return _.map(obj, _.identity);\n  };\n\n  // Return a sorted list of the function names available on the object.\n  // Aliased as `methods`\n  _.functions = _.methods = function(obj) {\n    var names = [];\n    for (var key in obj) {\n      if (_.isFunction(obj[key])) names.push(key);\n    }\n    return names.sort();\n  };\n\n  // Extend a given object with all the properties in passed-in object(s).\n  _.extend = function(obj) {\n    each(slice.call(arguments, 1), function(source) {\n      for (var prop in source) {\n        obj[prop] = source[prop];\n      }\n    });\n    return obj;\n  };\n\n  // Fill in a given object with default properties.\n  _.defaults = function(obj) {\n    each(slice.call(arguments, 1), function(source) {\n      for (var prop in source) {\n        if (obj[prop] == null) 
 obj[prop] = source[prop];\n      }\n    });\n    return obj;\n  };\n\n  // Create a (shallow-cloned) duplicate of an object.\n  _.clone = function(obj) {\n    if (!_.isObject(obj)) return obj;\n    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);\n  };\n\n  // Invokes interceptor with the obj, and then returns obj.\n  // The primary purpose of this method is to \"tap into\" a method chain, in\n  // order to perform operations on intermediate results within the chain.\n  _.tap = function(obj, interceptor) {\n    interceptor(obj);\n    return obj;\n  };\n\n  // Internal recursive comparison function.\n  function eq(a, b, stack) {\n    // Identical objects are equal. `0 === -0`, but they aren't identical.\n    // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.\n    if (a === b) return a !== 0 || 1 / a == 1 / b;\n    // A strict comparison is necessary because `null == undefined`.\n    if (a == null || b == null) return a === b;\n    // Unwr
 ap any wrapped objects.\n    if (a._chain) a = a._wrapped;\n    if (b._chain) b = b._wrapped;\n    // Invoke a custom `isEqual` method if one is provided.\n    if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);\n    if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);\n    // Compare `[[Class]]` names.\n    var className = toString.call(a);\n    if (className != toString.call(b)) return false;\n    switch (className) {\n      // Strings, numbers, dates, and booleans are compared by value.\n      case '[object String]':\n        // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n        // equivalent to `new String(\"5\")`.\n        return a == String(b);\n      case '[object Number]':\n        // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for\n        // other numeric values.\n        return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);\n      case '[object Date]':\n      case '[ob
 ject Boolean]':\n        // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n        // millisecond representations. Note that invalid dates with millisecond representations\n        // of `NaN` are not equivalent.\n        return +a == +b;\n      // RegExps are compared by their source patterns and flags.\n      case '[object RegExp]':\n        return a.source == b.source &&\n               a.global == b.global &&\n               a.multiline == b.multiline &&\n               a.ignoreCase == b.ignoreCase;\n    }\n    if (typeof a != 'object' || typeof b != 'object') return false;\n    // Assume equality for cyclic structures. The algorithm for detecting cyclic\n    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n    var length = stack.length;\n    while (length--) {\n      // Linear search. Performance is inversely proportional to the number of\n      // unique nested structures.\n      if (stack[length] == a) return
  true;\n    }\n    // Add the first object to the stack of traversed objects.\n    stack.push(a);\n    var size = 0, result = true;\n    // Recursively compare objects and arrays.\n    if (className == '[object Array]') {\n      // Compare array lengths to determine if a deep comparison is necessary.\n      size = a.length;\n      result = size == b.length;\n      if (result) {\n        // Deep compare the contents, ignoring non-numeric properties.\n        while (size--) {\n          // Ensure commutative equality for sparse arrays.\n          if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;\n        }\n      }\n    } else {\n      // Objects with different constructors are not equivalent.\n      if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;\n      // Deep compare objects.\n      for (var key in a) {\n        if (_.has(a, key)) {\n          // Count the expected number of properties.\n          size++;\n  
         // Deep compare each member.\n          if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;\n        }\n      }\n      // Ensure that both objects contain the same number of properties.\n      if (result) {\n        for (key in b) {\n          if (_.has(b, key) && !(size--)) break;\n        }\n        result = !size;\n      }\n    }\n    // Remove the first object from the stack of traversed objects.\n    stack.pop();\n    return result;\n  }\n\n  // Perform a deep comparison to check if two objects are equal.\n  _.isEqual = function(a, b) {\n    return eq(a, b, []);\n  };\n\n  // Is a given array, string, or object empty?\n  // An \"empty\" object has no enumerable own-properties.\n  _.isEmpty = function(obj) {\n    if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;\n    for (var key in obj) if (_.has(obj, key)) return false;\n    return true;\n  };\n\n  // Is a given value a DOM element?\n  _.isElement = function(obj) {\n    return !!(obj && obj
 .nodeType == 1);\n  };\n\n  // Is a given value an array?\n  // Delegates to ECMA5's native Array.isArray\n  _.isArray = nativeIsArray || function(obj) {\n    return toString.call(obj) == '[object Array]';\n  };\n\n  // Is a given variable an object?\n  _.isObject = function(obj) {\n    return obj === Object(obj);\n  };\n\n  // Is a given variable an arguments object?\n  _.isArguments = function(obj) {\n    return toString.call(obj) == '[object Arguments]';\n  };\n  if (!_.isArguments(arguments)) {\n    _.isArguments = function(obj) {\n      return !!(obj && _.has(obj, 'callee'));\n    };\n  }\n\n  // Is a given value a function?\n  _.isFunction = function(obj) {\n    return toString.call(obj) == '[object Function]';\n  };\n\n  // Is a given value a string?\n  _.isString = function(obj) {\n    return toString.call(obj) == '[object String]';\n  };\n\n  // Is a given value a number?\n  _.isNumber = function(obj) {\n    return toString.call(obj) == '[object Number]';\n  };\n\n  // Is t
 he given value `NaN`?\n  _.isNaN = function(obj) {\n    // `NaN` is the only value for which `===` is not reflexive.\n    return obj !== obj;\n  };\n\n  // Is a given value a boolean?\n  _.isBoolean = function(obj) {\n    return obj === true || obj === false || toString.call(obj) == '[object Boolean]';\n  };\n\n  // Is a given value a date?\n  _.isDate = function(obj) {\n    return toString.call(obj) == '[object Date]';\n  };\n\n  // Is the given value a regular expression?\n  _.isRegExp = function(obj) {\n    return toString.call(obj) == '[object RegExp]';\n  };\n\n  // Is a given value equal to null?\n  _.isNull = function(obj) {\n    return obj === null;\n  };\n\n  // Is a given variable undefined?\n  _.isUndefined = function(obj) {\n    return obj === void 0;\n  };\n\n  // Has own property?\n  _.has = function(obj, key) {\n    return hasOwnProperty.call(obj, key);\n  };\n\n  // Utility Functions\n  // -----------------\n\n  // Run Underscore.js in *noConflict* mode, returning th
 e `_` variable to its\n  // previous owner. Returns a reference to the Underscore object.\n  _.noConflict = function() {\n    root._ = previousUnderscore;\n    return this;\n  };\n\n  // Keep the identity function around for default iterators.\n  _.identity = function(value) {\n    return value;\n  };\n\n  // Run a function **n** times.\n  _.times = function (n, iterator, context) {\n    for (var i = 0; i < n; i++) iterator.call(context, i);\n  };\n\n  // Escape a string for HTML interpolation.\n  _.escape = function(string) {\n    return (''+string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\\//g,'&#x2F;');\n  };\n\n  // Add your own custom functions to the Underscore object, ensuring that\n  // they're correctly added to the OOP wrapper as well.\n  _.mixin = function(obj) {\n    each(_.functions(obj), function(name){\n      addToWrapper(name, _[name] = obj[name]);\n    });\n  };\n\n  // Generate a u
 nique integer id (unique within the entire client session).\n  // Useful for temporary DOM ids.\n  var idCounter = 0;\n  _.uniqueId = function(prefix) {\n    var id = idCounter++;\n    return prefix ? prefix + id : id;\n  };\n\n  // By default, Underscore uses ERB-style template delimiters, change the\n  // following template settings to use alternative delimiters.\n  _.templateSettings = {\n    evaluate    : /<%([\\s\\S]+?)%>/g,\n    interpolate : /<%=([\\s\\S]+?)%>/g,\n    escape      : /<%-([\\s\\S]+?)%>/g\n  };\n\n  // When customizing `templateSettings`, if you don't want to define an\n  // interpolation, evaluation or escaping regex, we need one that is\n  // guaranteed not to match.\n  var noMatch = /.^/;\n\n  // Within an interpolation, evaluation, or escaping, remove HTML escaping\n  // that had been previously added.\n  var unescape = function(code) {\n    return code.replace(/\\\\\\\\/g, '\\\\').replace(/\\\\'/g, \"'\");\n  };\n\n  // JavaScript micro-templating, similar 
 to John Resig's implementation.\n  // Underscore templating handles arbitrary delimiters, preserves whitespace,\n  // and correctly escapes quotes within interpolated code.\n  _.template = function(str, data) {\n    var c  = _.templateSettings;\n    var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +\n      'with(obj||{}){__p.push(\\'' +\n      str.replace(/\\\\/g, '\\\\\\\\')\n         .replace(/'/g, \"\\\\'\")\n         .replace(c.escape || noMatch, function(match, code) {\n           return \"',_.escape(\" + unescape(code) + \"),'\";\n         })\n         .replace(c.interpolate || noMatch, function(match, code) {\n           return \"',\" + unescape(code) + \",'\";\n         })\n         .replace(c.evaluate || noMatch, function(match, code) {\n           return \"');\" + unescape(code).replace(/[\\r\\n\\t]/g, ' ') + \";__p.push('\";\n         })\n         .replace(/\\r/g, '\\\\r')\n         .replace(/\\n/g, '\\\\n')\n         .replace(/\\t/g, '\\\\t')\n  
        + \"');}return __p.join('');\";\n    var func = new Function('obj', '_', tmpl);\n    if (data) return func(data, _);\n    return function(data) {\n      return func.call(this, data, _);\n    };\n  };\n\n  // Add a \"chain\" function, which will delegate to the wrapper.\n  _.chain = function(obj) {\n    return _(obj).chain();\n  };\n\n  // The OOP Wrapper\n  // ---------------\n\n  // If Underscore is called as a function, it returns a wrapped object that\n  // can be used OO-style. This wrapper holds altered versions of all the\n  // underscore functions. Wrapped objects may be chained.\n  var wrapper = function(obj) { this._wrapped = obj; };\n\n  // Expose `wrapper.prototype` as `_.prototype`\n  _.prototype = wrapper.prototype;\n\n  // Helper function to continue chaining intermediate results.\n  var result = function(obj, chain) {\n    return chain ? _(obj).chain() : obj;\n  };\n\n  // A method to easily add functions to the OOP wrapper.\n  var addToWrapper = function(name,
  func) {\n    wrapper.prototype[name] = function() {\n      var args = slice.call(arguments);\n      unshift.call(args, this._wrapped);\n      return result(func.apply(_, args), this._chain);\n    };\n  };\n\n  // Add all of the Underscore functions to the wrapper object.\n  _.mixin(_);\n\n  // Add all mutator Array functions to the wrapper.\n  each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {\n    var method = ArrayProto[name];\n    wrapper.prototype[name] = function() {\n      var wrapped = this._wrapped;\n      method.apply(wrapped, arguments);\n      var length = wrapped.length;\n      if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];\n      return result(wrapped, this._chain);\n    };\n  });\n\n  // Add all accessor Array functions to the wrapper.\n  each(['concat', 'join', 'slice'], function(name) {\n    var method = ArrayProto[name];\n    wrapper.prototype[name] = function() {\n      return result(method.apply(
 this._wrapped, arguments), this._chain);\n    };\n  });\n\n  // Start chaining a wrapped Underscore object.\n  wrapper.prototype.chain = function() {\n    this._chain = true;\n    return this;\n  };\n\n  // Extracts the result from a wrapped and chained object.\n  wrapper.prototype.value = function() {\n    return this._wrapped;\n  };\n\n}).call(this);\n">>},
+      {<<"async">>,
+       <<"/*global setTimeout: false, console: false */\n(function () {\n\n    var async = {};\n\n    // global on the server, window in the browser\n    var root = this,\n        previous_async = root.async;\n\n    if (typeof module !== 'undefined' && module.exports) {\n        module.exports = async;\n    }\n    else {\n        root.async = async;\n    }\n\n    async.noConflict = function () {\n        root.async = previous_async;\n        return async;\n    };\n\n    //// cross-browser compatiblity functions ////\n\n    var _forEach = function (arr, iterator) {\n        if (arr.forEach) {\n            return arr.forEach(iterator);\n        }\n        for (var i = 0; i < arr.length; i += 1) {\n            iterator(arr[i], i, arr);\n        }\n    };\n\n    var _map = function (arr, iterator) {\n        if (arr.map) {\n            return arr.map(iterator);\n        }\n        var results = [];\n        _forEach(arr, function (x, i, a) {\n            results.push(iterator(x, i, a));
 \n        });\n        return results;\n    };\n\n    var _reduce = function (arr, iterator, memo) {\n        if (arr.reduce) {\n            return arr.reduce(iterator, memo);\n        }\n        _forEach(arr, function (x, i, a) {\n            memo = iterator(memo, x, i, a);\n        });\n        return memo;\n    };\n\n    var _keys = function (obj) {\n        if (Object.keys) {\n            return Object.keys(obj);\n        }\n        var keys = [];\n        for (var k in obj) {\n            if (obj.hasOwnProperty(k)) {\n                keys.push(k);\n            }\n        }\n        return keys;\n    };\n\n    var _indexOf = function (arr, item) {\n        if (arr.indexOf) {\n            return arr.indexOf(item);\n        }\n        for (var i = 0; i < arr.length; i += 1) {\n            if (arr[i] === item) {\n                return i;\n            }\n        }\n        return -1;\n    };\n\n    //// exported async module functions ////\n\n    //// nextTick implementation with b
 rowser-compatible fallback ////\n    if (typeof process === 'undefined' || !(process.nextTick)) {\n        async.nextTick = function (fn) {\n            setTimeout(fn, 0);\n        };\n    }\n    else {\n        async.nextTick = process.nextTick;\n    }\n\n    async.forEach = function (arr, iterator, callback) {\n        if (!arr.length) {\n            return callback();\n        }\n        var completed = 0;\n        _forEach(arr, function (x) {\n            iterator(x, function (err) {\n                if (err) {\n                    callback(err);\n                    callback = function () {};\n                }\n                else {\n                    completed += 1;\n                    if (completed === arr.length) {\n                        callback();\n                    }\n                }\n            });\n        });\n    };\n\n    async.forEachSeries = function (arr, iterator, callback) {\n        if (!arr.length) {\n            return callback();\n        }\n    
     var completed = 0;\n        var iterate = function () {\n            iterator(arr[completed], function (err) {\n                if (err) {\n                    callback(err);\n                    callback = function () {};\n                }\n                else {\n                    completed += 1;\n                    if (completed === arr.length) {\n                        callback();\n                    }\n                    else {\n                        iterate();\n                    }\n                }\n            });\n        };\n        iterate();\n    };\n    \n    async.forEachLimit = function (arr, limit, iterator, callback) {\n        if (!arr.length || limit <= 0) {\n            return callback(); \n        }\n        var completed = 0;\n        var started = 0;\n        var running = 0;\n        \n        (function replenish () {\n          if (completed === arr.length) {\n              return callback();\n          }\n          \n          while (running 
 < limit && started < arr.length) {\n            iterator(arr[started], function (err) {\n              if (err) {\n                  callback(err);\n                  callback = function () {};\n              }\n              else {\n                  completed += 1;\n                  running -= 1;\n                  if (completed === arr.length) {\n                      callback();\n                  }\n                  else {\n                      replenish();\n                  }\n              }\n            });\n            started += 1;\n            running += 1;\n          }\n        })();\n    };\n\n\n    var doParallel = function (fn) {\n        return function () {\n            var args = Array.prototype.slice.call(arguments);\n            return fn.apply(null, [async.forEach].concat(args));\n        };\n    };\n    var doSeries = function (fn) {\n        return function () {\n            var args = Array.prototype.slice.call(arguments);\n            return fn.apply(nul
 l, [async.forEachSeries].concat(args));\n        };\n    };\n\n\n    var _asyncMap = function (eachfn, arr, iterator, callback) {\n        var results = [];\n        arr = _map(arr, function (x, i) {\n            return {index: i, value: x};\n        });\n        eachfn(arr, function (x, callback) {\n            iterator(x.value, function (err, v) {\n                results[x.index] = v;\n                callback(err);\n            });\n        }, function (err) {\n            callback(err, results);\n        });\n    };\n    async.map = doParallel(_asyncMap);\n    async.mapSeries = doSeries(_asyncMap);\n\n\n    // reduce only has a series version, as doing reduce in parallel won't\n    // work in many situations.\n    async.reduce = function (arr, memo, iterator, callback) {\n        async.forEachSeries(arr, function (x, callback) {\n            iterator(memo, x, function (err, v) {\n                memo = v;\n                callback(err);\n            });\n        }, function (er
 r) {\n            callback(err, memo);\n        });\n    };\n    // inject alias\n    async.inject = async.reduce;\n    // foldl alias\n    async.foldl = async.reduce;\n\n    async.reduceRight = function (arr, memo, iterator, callback) {\n        var reversed = _map(arr, function (x) {\n            return x;\n        }).reverse();\n        async.reduce(reversed, memo, iterator, callback);\n    };\n    // foldr alias\n    async.foldr = async.reduceRight;\n\n    var _filter = function (eachfn, arr, iterator, callback) {\n        var results = [];\n        arr = _map(arr, function (x, i) {\n            return {index: i, value: x};\n        });\n        eachfn(arr, function (x, callback) {\n            iterator(x.value, function (v) {\n                if (v) {\n                    results.push(x);\n                }\n                callback();\n            });\n        }, function (err) {\n            callback(_map(results.sort(function (a, b) {\n                return a.index - b.inde
 x;\n            }), function (x) {\n                return x.value;\n            }));\n        });\n    };\n    async.filter = doParallel(_filter);\n    async.filterSeries = doSeries(_filter);\n    // select alias\n    async.select = async.filter;\n    async.selectSeries = async.filterSeries;\n\n    var _reject = function (eachfn, arr, iterator, callback) {\n        var results = [];\n        arr = _map(arr, function (x, i) {\n            return {index: i, value: x};\n        });\n        eachfn(arr, function (x, callback) {\n            iterator(x.value, function (v) {\n                if (!v) {\n                    results.push(x);\n                }\n                callback();\n            });\n        }, function (err) {\n            callback(_map(results.sort(function (a, b) {\n                return a.index - b.index;\n            }), function (x) {\n                return x.value;\n            }));\n        });\n    };\n    async.reject = doParallel(_reject);\n    async.reje
 ctSeries = doSeries(_reject);\n\n    var _detect = function (eachfn, arr, iterator, main_callback) {\n        eachfn(arr, function (x, callback) {\n            iterator(x, function (result) {\n                if (result) {\n                    main_callback(x);\n                    main_callback = function () {};\n                }\n                else {\n                    callback();\n                }\n            });\n        }, function (err) {\n            main_callback();\n        });\n    };\n    async.detect = doParallel(_detect);\n    async.detectSeries = doSeries(_detect);\n\n    async.some = function (arr, iterator, main_callback) {\n        async.forEach(arr, function (x, callback) {\n            iterator(x, function (v) {\n                if (v) {\n                    main_callback(true);\n                    main_callback = function () {};\n                }\n                callback();\n            });\n        }, function (err) {\n            main_callback(false);
 \n        });\n    };\n    // any alias\n    async.any = async.some;\n\n    async.every = function (arr, iterator, main_callback) {\n        async.forEach(arr, function (x, callback) {\n            iterator(x, function (v) {\n                if (!v) {\n                    main_callback(false);\n                    main_callback = function () {};\n                }\n                callback();\n            });\n        }, function (err) {\n            main_callback(true);\n        });\n    };\n    // all alias\n    async.all = async.every;\n\n    async.sortBy = function (arr, iterator, callback) {\n        async.map(arr, function (x, callback) {\n            iterator(x, function (err, criteria) {\n                if (err) {\n                    callback(err);\n                }\n                else {\n                    callback(null, {value: x, criteria: criteria});\n                }\n            });\n        }, function (err, results) {\n            if (err) {\n                r
 eturn callback(err);\n            }\n            else {\n                var fn = function (left, right) {\n                    var a = left.criteria, b = right.criteria;\n                    return a < b ? -1 : a > b ? 1 : 0;\n                };\n                callback(null, _map(results.sort(fn), function (x) {\n                    return x.value;\n                }));\n            }\n        });\n    };\n\n    async.auto = function (tasks, callback) {\n        callback = callback || function () {};\n        var keys = _keys(tasks);\n        if (!keys.length) {\n            return callback(null);\n        }\n\n        var results = {};\n\n        var listeners = [];\n        var addListener = function (fn) {\n            listeners.unshift(fn);\n        };\n        var removeListener = function (fn) {\n            for (var i = 0; i < listeners.length; i += 1) {\n                if (listeners[i] === fn) {\n                    listeners.splice(i, 1);\n                    return;\n 
                }\n            }\n        };\n        var taskComplete = function () {\n            _forEach(listeners, function (fn) {\n                fn();\n            });\n        };\n\n        addListener(function () {\n            if (_keys(results).length === keys.length) {\n                callback(null, results);\n            }\n        });\n\n        _forEach(keys, function (k) {\n            var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];\n            var taskCallback = function (err) {\n                if (err) {\n                    callback(err);\n                    // stop subsequent errors hitting callback multiple times\n                    callback = function () {};\n                }\n                else {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    if (args.length <= 1) {\n                        args = args[0];\n                    }\n                    results[k] = args;\n                  
   taskComplete();\n                }\n            };\n            var requires = task.slice(0, Math.abs(task.length - 1)) || [];\n            var ready = function () {\n                return _reduce(requires, function (a, x) {\n                    return (a && results.hasOwnProperty(x));\n                }, true);\n            };\n            if (ready()) {\n                task[task.length - 1](taskCallback, results);\n            }\n            else {\n                var listener = function () {\n                    if (ready()) {\n                        removeListener(listener);\n                        task[task.length - 1](taskCallback, results);\n                    }\n                };\n                addListener(listener);\n            }\n        });\n    };\n\n    async.waterfall = function (tasks, callback) {\n        if (!tasks.length) {\n            return callback();\n        }\n        callback = callback || function () {};\n        var wrapIterator = function (it
 erator) {\n            return function (err) {\n                if (err) {\n                    callback(err);\n                    callback = function () {};\n                }\n                else {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    var next = iterator.next();\n                    if (next) {\n                        args.push(wrapIterator(next));\n                    }\n                    else {\n                        args.push(callback);\n                    }\n                    async.nextTick(function () {\n                        iterator.apply(null, args);\n                    });\n                }\n            };\n        };\n        wrapIterator(async.iterator(tasks))();\n    };\n\n    async.parallel = function (tasks, callback) {\n        callback = callback || function () {};\n        if (tasks.constructor === Array) {\n            async.map(tasks, function (fn, callback) {\n                if (fn) {\n   
                  fn(function (err) {\n                        var args = Array.prototype.slice.call(arguments, 1);\n                        if (args.length <= 1) {\n                            args = args[0];\n                        }\n                        callback.call(null, err, args);\n                    });\n                }\n            }, callback);\n        }\n        else {\n            var results = {};\n            async.forEach(_keys(tasks), function (k, callback) {\n                tasks[k](function (err) {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    if (args.length <= 1) {\n                        args = args[0];\n                    }\n                    results[k] = args;\n                    callback(err);\n                });\n            }, function (err) {\n                callback(err, results);\n            });\n        }\n    };\n\n    async.series = function (tasks, callback) {\n        callback = callb
 ack || function () {};\n        if (tasks.constructor === Array) {\n            async.mapSeries(tasks, function (fn, callback) {\n                if (fn) {\n                    fn(function (err) {\n                        var args = Array.prototype.slice.call(arguments, 1);\n                        if (args.length <= 1) {\n                            args = args[0];\n                        }\n                        callback.call(null, err, args);\n                    });\n                }\n            }, callback);\n        }\n        else {\n            var results = {};\n            async.forEachSeries(_keys(tasks), function (k, callback) {\n                tasks[k](function (err) {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    if (args.length <= 1) {\n                        args = args[0];\n                    }\n                    results[k] = args;\n                    callback(err);\n                });\n            }, func
 tion (err) {\n                callback(err, results);\n            });\n        }\n    };\n\n    async.iterator = function (tasks) {\n        var makeCallback = function (index) {\n            var fn = function () {\n                if (tasks.length) {\n                    tasks[index].apply(null, arguments);\n                }\n                return fn.next();\n            };\n            fn.next = function () {\n                return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n            };\n            return fn;\n        };\n        return makeCallback(0);\n    };\n\n    async.apply = function (fn) {\n        var args = Array.prototype.slice.call(arguments, 1);\n        return function () {\n            return fn.apply(\n                null, args.concat(Array.prototype.slice.call(arguments))\n            );\n        };\n    };\n\n    var _concat = function (eachfn, arr, fn, callback) {\n        var r = [];\n        eachfn(arr, function (x, cb) {\n           
  fn(x, function (err, y) {\n                r = r.concat(y || []);\n                cb(err);\n            });\n        }, function (err) {\n            callback(err, r);\n        });\n    };\n    async.concat = doParallel(_concat);\n    async.concatSeries = doSeries(_concat);\n\n    async.whilst = function (test, iterator, callback) {\n        if (test()) {\n            iterator(function (err) {\n                if (err) {\n                    return callback(err);\n                }\n                async.whilst(test, iterator, callback);\n            });\n        }\n        else {\n            callback();\n        }\n    };\n\n    async.until = function (test, iterator, callback) {\n        if (!test()) {\n            iterator(function (err) {\n                if (err) {\n                    return callback(err);\n                }\n                async.until(test, iterator, callback);\n            });\n        }\n        else {\n            callback();\n        }\n    };\n\n    
 async.queue = function (worker, concurrency) {\n        var workers = 0;\n        var q = {\n            tasks: [],\n            concurrency: concurrency,\n            saturated: null,\n            empty: null,\n            drain: null,\n            push: function (data, callback) {\n                q.tasks.push({data: data, callback: callback});\n                if(q.saturated && q.tasks.length == concurrency) q.saturated();\n                async.nextTick(q.process);\n            },\n            process: function () {\n                if (workers < q.concurrency && q.tasks.length) {\n                    var task = q.tasks.shift();\n                    if(q.empty && q.tasks.length == 0) q.empty();\n                    workers += 1;\n                    worker(task.data, function () {\n                        workers -= 1;\n                        if (task.callback) {\n                            task.callback.apply(task, arguments);\n                        }\n                     
    if(q.drain && q.tasks.length + workers == 0) q.drain();\n                        q.process();\n                    });\n                }\n            },\n            length: function () {\n                return q.tasks.length;\n            },\n            running: function () {\n                return workers;\n            }\n        };\n        return q;\n    };\n\n    var _console_fn = function (name) {\n        return function (fn) {\n            var args = Array.prototype.slice.call(arguments, 1);\n            fn.apply(null, args.concat([function (err) {\n                var args = Array.prototype.slice.call(arguments, 1);\n                if (typeof console !== 'undefined') {\n                    if (err) {\n                        if (console.error) {\n                            console.error(err);\n                        }\n                    }\n                    else if (console[name]) {\n                        _forEach(args, function (x) {\n                      
       console[name](x);\n                        });\n                    }\n                }\n            }]));\n        };\n    };\n    async.log = _console_fn('log');\n    async.dir = _console_fn('dir');\n    /*async.info = _console_fn('info');\n    async.warn = _console_fn('warn');\n    async.error = _console_fn('error');*/\n\n    async.memoize = function (fn, hasher) {\n        var memo = {};\n        var queues = {};\n        hasher = hasher || function (x) {\n            return x;\n        };\n        var memoized = function () {\n            var args = Array.prototype.slice.call(arguments);\n            var callback = args.pop();\n            var key = hasher.apply(null, args);\n            if (key in memo) {\n                callback.apply(null, memo[key]);\n            }\n            else if (key in queues) {\n                queues[key].push(callback);\n            }\n            else {\n                queues[key] = [callback];\n                fn.apply(null, args.conca
 t([function () {\n                    memo[key] = arguments;\n                    var q = queues[key];\n                    delete queues[key];\n                    for (var i = 0, l = q.length; i < l; i++) {\n                      q[i].apply(null, arguments);\n                    }\n                }]));\n            }\n        };\n        memoized.unmemoized = fn;\n        return memoized;\n    };\n\n    async.unmemoize = function (fn) {\n      return function () {\n        return (fn.unmemoized || fn).apply(null, arguments);\n      }\n    };\n\n}());\n">>},
+      {<<"handlebars">>,
+       <<47,47,32,108,105,98,47,104,97,110,100,108,101,98,97,114,115,47,98,97,115,
+         101,46,106,115,10,118,97,114,32,72,97,110,100,108,101,98,97,114,115,32,
+         61,32,123,125,59,10,10,72,97,110,100,108,101,98,97,114,115,46,86,69,82,
+         83,73,79,78,32,61,32,34,49,46,48,46,98,101,116,97,46,50,34,59,10,10,72,
+         97,110,100,108,101,98,97,114,115,46,104,101,108,112,101,114,115,32,32,61,
+         32,123,125,59,10,72,97,110,100,108,101,98,97,114,115,46,112,97,114,116,
+         105,97,108,115,32,61,32,123,125,59,10,10,72,97,110,100,108,101,98,97,114,
+         115,46,114,101,103,105,115,116,101,114,72,101,108,112,101,114,32,61,32,
+         102,117,110,99,116,105,111,110,40,110,97,109,101,44,32,102,110,44,32,105,
+         110,118,101,114,115,101,41,32,123,10,32,32,105,102,40,105,110,118,101,
+         114,115,101,41,32,123,32,102,110,46,110,111,116,32,61,32,105,110,118,101,
+         114,115,101,59,32,125,10,32,32,116,104,105,115,46,104,101,108,112,101,
+         114,115,91,110,97,109,101,93,32,61,32,102,110,59,10,125,59,10,10,72,97,
+         110,100,108,101,98,97,114,115,46,114,101,103,105,115,116,101,114,80,97,
+         114,116,105,97,108,32,61,32,102,117,110,99,116,105,111,110,40,110,97,109,
+         101,44,32,115,116,114,41,32,123,10,32,32,116,104,105,115,46,112,97,114,
+         116,105,97,108,115,91,110,97,109,101,93,32,61,32,115,116,114,59,10,125,
+         59,10,10,72,97,110,100,108,101,98,97,114,115,46,114,101,103,105,115,116,
+         101,114,72,101,108,112,101,114,40,39,104,101,108,112,101,114,77,105,115,
+         115,105,110,103,39,44,32,102,117,110,99,116,105,111,110,40,97,114,103,41,
+         32,123,10,32,32,105,102,40,97,114,103,117,109,101,110,116,115,46,108,101,
+         110,103,116,104,32,61,61,61,32,50,41,32,123,10,32,32,32,32,114,101,116,
+         117,114,110,32,117,110,100,101,102,105,110,101,100,59,10,32,32,125,32,
+         101,108,115,101,32,123,10,32,32,32,32,116,104,114,111,119,32,110,101,119,
+         32,69,114,114,111,114,40,34,67,111,117,108,100,32,110,111,116,32,102,105,
+         110,100,32,112,114,111,112,101,114,116,121,32,39,34,32,43,32,97,114,103,
+         32,43,32,34,39,34,41,59,10,32,32,125,10,125,41,59,10,10,72,97,110,100,
+         108,101,98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,
+         101,114,40,39,98,108,111,99,107,72,101,108,112,101,114,77,105,115,115,
+         105,110,103,39,44,32,102,117,110,99,116,105,111,110,40,99,111,110,116,
+         101,120,116,44,32,111,112,116,105,111,110,115,41,32,123,10,32,32,118,97,
+         114,32,105,110,118,101,114,115,101,32,61,32,111,112,116,105,111,110,115,
+         46,105,110,118,101,114,115,101,32,124,124,32,102,117,110,99,116,105,111,
+         110,40,41,32,123,125,44,32,102,110,32,61,32,111,112,116,105,111,110,115,
+         46,102,110,59,10,10,10,32,32,118,97,114,32,114,101,116,32,61,32,34,34,59,
+         10,32,32,118,97,114,32,116,121,112,101,32,61,32,79,98,106,101,99,116,46,
+         112,114,111,116,111,116,121,112,101,46,116,111,83,116,114,105,110,103,46,
+         99,97,108,108,40,99,111,110,116,101,120,116,41,59,10,10,32,32,105,102,40,
+         116,121,112,101,32,61,61,61,32,34,91,111,98,106,101,99,116,32,70,117,110,
+         99,116,105,111,110,93,34,41,32,123,10,32,32,32,32,99,111,110,116,101,120,
+         116,32,61,32,99,111,110,116,101,120,116,40,41,59,10,32,32,125,10,10,32,
+         32,105,102,40,99,111,110,116,101,120,116,32,61,61,61,32,116,114,117,101,
+         41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,102,110,40,116,104,
+         105,115,41,59,10,32,32,125,32,101,108,115,101,32,105,102,40,99,111,110,
+         116,101,120,116,32,61,61,61,32,102,97,108,115,101,32,124,124,32,99,111,
+         110,116,101,120,116,32,61,61,32,110,117,108,108,41,32,123,10,32,32,32,32,
+         114,101,116,117,114,110,32,105,110,118,101,114,115,101,40,116,104,105,
+         115,41,59,10,32,32,125,32,101,108,115,101,32,105,102,40,116,121,112,101,
+         32,61,61,61,32,34,91,111,98,106,101,99,116,32,65,114,114,97,121,93,34,41,
+         32,123,10,32,32,32,32,105,102,40,99,111,110,116,101,120,116,46,108,101,
+         110,103,116,104,32,62,32,48,41,32,123,10,32,32,32,32,32,32,102,111,114,
+         40,118,97,114,32,105,61,48,44,32,106,61,99,111,110,116,101,120,116,46,
+         108,101,110,103,116,104,59,32,105,60,106,59,32,105,43,43,41,32,123,10,32,
+         32,32,32,32,32,32,32,114,101,116,32,61,32,114,101,116,32,43,32,102,110,
+         40,99,111,110,116,101,120,116,91,105,93,41,59,10,32,32,32,32,32,32,125,
+         10,32,32,32,32,125,32,101,108,115,101,32,123,10,32,32,32,32,32,32,114,
+         101,116,32,61,32,105,110,118,101,114,115,101,40,116,104,105,115,41,59,10,
+         32,32,32,32,125,10,32,32,32,32,114,101,116,117,114,110,32,114,101,116,59,
+         10,32,32,125,32,101,108,115,101,32,123,10,32,32,32,32,114,101,116,117,
+         114,110,32,102,110,40,99,111,110,116,101,120,116,41,59,10,32,32,125,10,
+         125,41,59,10,10,72,97,110,100,108,101,98,97,114,115,46,114,101,103,105,
+         115,116,101,114,72,101,108,112,101,114,40,39,101,97,99,104,39,44,32,102,
+         117,110,99,116,105,111,110,40,99,111,110,116,101,120,116,44,32,111,112,
+         116,105,111,110,115,41,32,123,10,32,32,118,97,114,32,102,110,32,61,32,
+         111,112,116,105,111,110,115,46,102,110,44,32,105,110,118,101,114,115,101,
+         32,61,32,111,112,116,105,111,110,115,46,105,110,118,101,114,115,101,59,
+         10,32,32,118,97,114,32,114,101,116,32,61,32,34,34,59,10,10,32,32,105,102,
+         40,99,111,110,116,101,120,116,32,38,38,32,99,111,110,116,101,120,116,46,
+         108,101,110,103,116,104,32,62,32,48,41,32,123,10,32,32,32,32,102,111,114,
+         40,118,97,114,32,105,61,48,44,32,106,61,99,111,110,116,101,120,116,46,
+         108,101,110,103,116,104,59,32,105,60,106,59,32,105,43,43,41,32,123,10,32,
+         32,32,32,32,32,114,101,116,32,61,32,114,101,116,32,43,32,102,110,40,99,
+         111,110,116,101,120,116,91,105,93,41,59,10,32,32,32,32,125,10,32,32,125,
+         32,101,108,115,101,32,123,10,32,32,32,32,114,101,116,32,61,32,105,110,
+         118,101,114,115,101,40,116,104,105,115,41,59,10,32,32,125,10,32,32,114,
+         101,116,117,114,110,32,114,101,116,59,10,125,41,59,10,10,72,97,110,100,
+         108,101,98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,
+         101,114,40,39,105,102,39,44,32,102,117,110,99,116,105,111,110,40,99,111,
+         110,116,101,120,116,44,32,111,112,116,105,111,110,115,41,32,123,10,32,32,
+         105,102,40,33,99,111,110,116,101,120,116,32,124,124,32,72,97,110,100,108,
+         101,98,97,114,115,46,85,116,105,108,115,46,105,115,69,109,112,116,121,40,
+         99,111,110,116,101,120,116,41,41,32,123,10,32,32,32,32,114,101,116,117,
+         114,110,32,111,112,116,105,111,110,115,46,105,110,118,101,114,115,101,40,
+         116,104,105,115,41,59,10,32,32,125,32,101,108,115,101,32,123,10,32,32,32,
+         32,114,101,116,117,114,110,32,111,112,116,105,111,110,115,46,102,110,40,
+         116,104,105,115,41,59,10,32,32,125,10,125,41,59,10,10,72,97,110,100,108,
+         101,98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,101,
+         114,40,39,117,110,108,101,115,115,39,44,32,102,117,110,99,116,105,111,
+         110,40,99,111,110,116,101,120,116,44,32,111,112,116,105,111,110,115,41,
+         32,123,10,32,32,118,97,114,32,102,110,32,61,32,111,112,116,105,111,110,
+         115,46,102,110,44,32,105,110,118,101,114,115,101,32,61,32,111,112,116,
+         105,111,110,115,46,105,110,118,101,114,115,101,59,10,32,32,111,112,116,
+         105,111,110,115,46,102,110,32,61,32,105,110,118,101,114,115,101,59,10,32,
+         32,111,112,116,105,111,110,115,46,105,110,118,101,114,115,101,32,61,32,
+         102,110,59,10,10,32,32,114,101,116,117,114,110,32,72,97,110,100,108,101,
+         98,97,114,115,46,104,101,108,112,101,114,115,91,39,105,102,39,93,46,99,
+         97,108,108,40,116,104,105,115,44,32,99,111,110,116,101,120,116,44,32,111,
+         112,116,105,111,110,115,41,59,10,125,41,59,10,10,72,97,110,100,108,101,
+         98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,101,114,
+         40,39,119,105,116,104,39,44,32,102,117,110,99,116,105,111,110,40,99,111,
+         110,116,101,120,116,44,32,111,112,116,105,111,110,115,41,32,123,10,32,32,
+         114,101,116,117,114,110,32,111,112,116,105,111,110,115,46,102,110,40,99,
+         111,110,116,101,120,116,41,59,10,125,41,59,10,59,10,47,47,32,108,105,98,
+         47,104,97,110,100,108,101,98,97,114,115,47,99,111,109,112,105,108,101,
+         114,47,112,97,114,115,101,114,46,106,115,10,47,42,32,74,105,115,111,110,
+         32,103,101,110,101,114,97,116,101,100,32,112,97,114,115,101,114,32,42,47,
+         10,118,97,114,32,104,97,110,100,108,101,98,97,114,115,32,61,32,40,102,
+         117,110,99,116,105,111,110,40,41,123,10,10,118,97,114,32,112,97,114,115,
+         101,114,32,61,32,123,116,114,97,99,101,58,32,102,117,110,99,116,105,111,
+         110,32,116,114,97,99,101,40,41,32,123,32,125,44,10,121,121,58,32,123,125,
+         44,10,115,121,109,98,111,108,115,95,58,32,123,34,101,114,114,111,114,34,
+         58,50,44,34,114,111,111,116,34,58,51,44,34,112,114,111,103,114,97,109,34,
+         58,52,44,34,69,79,70,34,58,53,44,34,115,116,97,116,101,109,101,110,116,
+         115,34,58,54,44,34,115,105,109,112,108,101,73,110,118,101,114,115,101,34,
+         58,55,44,34,115,116,97,116,101,109,101,110,116,34,58,56,44,34,111,112,
+         101,110,73,110,118,101,114,115,101,34,58,57,44,34,99,108,111,115,101,66,
+         108,111,99,107,34,58,49,48,44,34,111,112,101,110,66,108,111,99,107,34,58,
+         49,49,44,34,109,117,115,116,97,99,104,101,34,58,49,50,44,34,112,97,114,
+         116,105,97,108,34,58,49,51,44,34,67,79,78,84,69,78,84,34,58,49,52,44,34,
+         67,79,77,77,69,78,84,34,58,49,53,44,34,79,80,69,78,95,66,76,79,67,75,34,
+         58,49,54,44,34,105,110,77,117,115,116,97,99,104,101,34,58,49,55,44,34,67,
+         76,79,83,69,34,58,49,56,44,34,79,80,69,78,95,73,78,86,69,82,83,69,34,58,
+         49,57,44,34,79,80,69,78,95,69,78,68,66,76,79,67,75,34,58,50,48,44,34,112,
+         97,116,104,34,58,50,49,44,34,79,80,69,78,34,58,50,50,44,34,79,80,69,78,
+         95,85,78,69,83,67,65,80,69,68,34,58,50,51,44,34,79,80,69,78,95,80,65,82,
+         84,73,65,76,34,58,50,52,44,34,112,97,114,97,109,115,34,58,50,53,44,34,
+         104,97,115,104,34,58,50,54,44,34,112,97,114,97,109,34,58,50,55,44,34,83,
+         84,82,73,78,71,34,58,50,56,44,34,73,78,84,69,71,69,82,34,58,50,57,44,34,
+         66,79,79,76,69,65,78,34,58,51,48,44,34,104,97,115,104,83,101,103,109,101,
+         110,116,115,34,58,51,49,44,34,104,97,115,104,83,101,103,109,101,110,116,
+         34,58,51,50,44,34,73,68,34,58,51,51,44,34,69,81,85,65,76,83,34,58,51,52,
+         44,34,112,97,116,104,83,101,103,109,101,110,116,115,34,58,51,53,44,34,83,
+         69,80,34,58,51,54,44,34,36,97,99,99,101,112,116,34,58,48,44,34,36,101,
+         110,100,34,58,49,125,44,10,116,101,114,109,105,110,97,108,115,95,58,32,
+         123,50,58,34,101,114,114,111,114,34,44,53,58,34,69,79,70,34,44,49,52,58,
+         34,67,79,78,84,69,78,84,34,44,49,53,58,34,67,79,77,77,69,78,84,34,44,49,
+         54,58,34,79,80,69,78,95,66,76,79,67,75,34,44,49,56,58,34,67,76,79,83,69,
+         34,44,49,57,58,34,79,80,69,78,95,73,78,86,69,82,83,69,34,44,50,48,58,34,
+         79,80,69,78,95,69,78,68,66,76,79,67,75,34,44,50,50,58,34,79,80,69,78,34,
+         44,50,51,58,34,79,80,69,78,95,85,78,69,83,67,65,80,69,68,34,44,50,52,58,
+         34,79,80,69,78,95,80,65,82,84,73,65,76,34,44,50,56,58,34,83,84,82,73,78,
+         71,34,44,50,57,58,34,73,78,84,69,71,69,82,34,44,51,48,58,34,66,79,79,76,
+         69,65,78,34,44,51,51,58,34,73,68,34,44,51,52,58,34,69,81,85,65,76,83,34,
+         44,51,54,58,34,83,69,80,34,125,44,10,112,114,111,100,117,99,116,105,111,
+         110,115,95,58,32,91,48,44,91,51,44,50,93,44,91,52,44,51,93,44,91,52,44,
+         49,93,44,91,52,44,48,93,44,91,54,44,49,93,44,91,54,44,50,93,44,91,56,44,
+         51,93,44,91,56,44,51,93,44,91,56,44,49,93,44,91,56,44,49,93,44,91,56,44,
+         49,93,44,91,56,44,49,93,44,91,49,49,44,51,93,44,91,57,44,51,93,44,91,49,
+         48,44,51,93,44,91,49,50,44,51,93,44,91,49,50,44,51,93,44,91,49,51,44,51,
+         93,44,91,49,51,44,52,93,44,91,55,44,50,93,44,91,49,55,44,51,93,44,91,49,
+         55,44,50,93,44,91,49,55,44,50,93,44,91,49,55,44,49,93,44,91,50,53,44,50,
+         93,44,91,50,53,44,49,93,44,91,50,55,44,49,93,44,91,50,55,44,49,93,44,91,
+         50,55,44,49,93,44,91,50,55,44,49,93,44,91,50,54,44,49,93,44,91,51,49,44,
+         50,93,44,91,51,49,44,49,93,44,91,51,50,44,51,93,44,91,51,50,44,51,93,44,
+         91,51,50,44,51,93,44,91,51,50,44,51,93,44,91,50,49,44,49,93,44,91,51,53,
+         44,51,93,44,91,51,53,44,49,93,93,44,10,112,101,114,102,111,114,109,65,99,
+         116,105,111,110,58,32,102,117,110,99,116,105,111,110,32,97,110,111,110,
+         121,109,111,117,115,40,121,121,116,101,120,116,44,121,121,108,101,110,
+         103,44,121,121,108,105,110,101,110,111,44,121,121,44,121,121,115,116,97,
+         116,101,44,36,36,44,95,36,41,32,123,10,10,118,97,114,32,36,48,32,61,32,
+         36,36,46,108,101,110,103,116,104,32,45,32,49,59,10,115,119,105,116,99,
+         104,32,40,121,121,115,116,97,116,101,41,32,123,10,99,97,115,101,32,49,58,
+         32,114,101,116,117,114,110,32,36,36,91,36,48,45,49,93,32,10,98,114,101,
+         97,107,59,10,99,97,115,101,32,50,58,32,116,104,105,115,46,36,32,61,32,
+         110,101,119,32,121,121,46,80,114,111,103,114,97,109,78,111,100,101,40,36,
+         36,91,36,48,45,50,93,44,32,36,36,91,36,48,93,41,32,10,98,114,101,97,107,
+         59,10,99,97,115,101,32,51,58,32,116,104,105,115,46,36,32,61,32,110,101,
+         119,32,121,121,46,80,114,111,103,114,97,109,78,111,100,101,40,36,36,91,
+         36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,52,58,32,116,
+         104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,80,114,111,103,114,
+         97,109,78,111,100,101,40,91,93,41,32,10,98,114,101,97,107,59,10,99,97,
+         115,101,32,53,58,32,116,104,105,115,46,36,32,61,32,91,36,36,91,36,48,93,
+         93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,54,58,32,36,36,91,36,
+         48,45,49,93,46,112,117,115,104,40,36,36,91,36,48,93,41,59,32,116,104,105,
+         115,46,36,32,61,32,36,36,91,36,48,45,49,93,32,10,98,114,101,97,107,59,10,
+         99,97,115,101,32,55,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,
+         121,121,46,73,110,118,101,114,115,101,78,111,100,101,40,36,36,91,36,48,
+         45,50,93,44,32,36,36,91,36,48,45,49,93,44,32,36,36,91,36,48,93,41,32,10,
+         98,114,101,97,107,59,10,99,97,115,101,32,56,58,32,116,104,105,115,46,36,
+         32,61,32,110,101,119,32,121,121,46,66,108,111,99,107,78,111,100,101,40,
+         36,36,91,36,48,45,50,93,44,32,36,36,91,36,48,45,49,93,44,32,36,36,91,36,
+         48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,57,58,32,116,104,
+         105,115,46,36,32,61,32,36,36,91,36,48,93,32,10,98,114,101,97,107,59,10,
+         99,97,115,101,32,49,48,58,32,116,104,105,115,46,36,32,61,32,36,36,91,36,
+         48,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,49,49,58,32,116,104,
+         105,115,46,36,32,61,32,110,101,119,32,121,121,46,67,111,110,116,101,110,
+         116,78,111,100,101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,
+         99,97,115,101,32,49,50,58,32,116,104,105,115,46,36,32,61,32,110,101,119,
+         32,121,121,46,67,111,109,109,101,110,116,78,111,100,101,40,36,36,91,36,
+         48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,49,51,58,32,116,
+         104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,77,117,115,116,97,
+         99,104,101,78,111,100,101,40,36,36,91,36,48,45,49,93,91,48,93,44,32,36,
+         36,91,36,48,45,49,93,91,49,93,41,32,10,98,114,101,97,107,59,10,99,97,115,
+         101,32,49,52,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,
+         46,77,117,115,116,97,99,104,101,78,111,100,101,40,36,36,91,36,48,45,49,
+         93,91,48,93,44,32,36,36,91,36,48,45,49,93,91,49,93,41,32,10,98,114,101,
+         97,107,59,10,99,97,115,101,32,49,53,58,32,116,104,105,115,46,36,32,61,32,
+         36,36,91,36,48,45,49,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,
+         49,54,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,77,
+         117,115,116,97,99,104,101,78,111,100,101,40,36,36,91,36,48,45,49,93,91,
+         48,93,44,32,36,36,91,36,48,45,49,93,91,49,93,41,32,10,98,114,101,97,107,
+         59,10,99,97,115,101,32,49,55,58,32,116,104,105,115,46,36,32,61,32,110,
+         101,119,32,121,121,46,77,117,115,116,97,99,104,101,78,111,100,101,40,36,
+         36,91,36,48,45,49,93,91,48,93,44,32,36,36,91,36,48,45,49,93,91,49,93,44,
+         32,116,114,117,101,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,49,
+         56,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,80,97,
+         114,116,105,97,108,78,111,100,101,40,36,36,91,36,48,45,49,93,41,32,10,98,
+         114,101,97,107,59,10,99,97,115,101,32,49,57,58,32,116,104,105,115,46,36,
+         32,61,32,110,101,119,32,121,121,46,80,97,114,116,105,97,108,78,111,100,
+         101,40,36,36,91,36,48,45,50,93,44,32,36,36,91,36,48,45,49,93,41,32,10,98,
+         114,101,97,107,59,10,99,97,115,101,32,50,48,58,32,10,98,114,101,97,107,
+         59,10,99,97,115,101,32,50,49,58,32,116,104,105,115,46,36,32,61,32,91,91,
+         36,36,91,36,48,45,50,93,93,46,99,111,110,99,97,116,40,36,36,91,36,48,45,
+         49,93,41,44,32,36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,99,97,
+         115,101,32,50,50,58,32,116,104,105,115,46,36,32,61,32,91,91,36,36,91,36,
+         48,45,49,93,93,46,99,111,110,99,97,116,40,36,36,91,36,48,93,41,44,32,110,
+         117,108,108,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,50,51,58,
+         32,116,104,105,115,46,36,32,61,32,91,91,36,36,91,36,48,45,49,93,93,44,32,
+         36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,50,
+         52,58,32,116,104,105,115,46,36,32,61,32,91,91,36,36,91,36,48,93,93,44,32,
+         110,117,108,108,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,50,53,
+         58,32,36,36,91,36,48,45,49,93,46,112,117,115,104,40,36,36,91,36,48,93,41,
+         59,32,116,104,105,115,46,36,32,61,32,36,36,91,36,48,45,49,93,59,32,10,98,
+         114,101,97,107,59,10,99,97,115,101,32,50,54,58,32,116,104,105,115,46,36,
+         32,61,32,91,36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,99,97,115,
+         101,32,50,55,58,32,116,104,105,115,46,36,32,61,32,36,36,91,36,48,93,32,
+         10,98,114,101,97,107,59,10,99,97,115,101,32,50,56,58,32,116,104,105,115,
+         46,36,32,61,32,110,101,119,32,121,121,46,83,116,114,105,110,103,78,111,
+         100,101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,
+         101,32,50,57,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,
+         46,73,110,116,101,103,101,114,78,111,100,101,40,36,36,91,36,48,93,41,32,
+         10,98,114,101,97,107,59,10,99,97,115,101,32,51,48,58,32,116,104,105,115,
+         46,36,32,61,32,110,101,119,32,121,121,46,66,111,111,108,101,97,110,78,
+         111,100,101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,
+         115,101,32,51,49,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,
+         121,46,72,97,115,104,78,111,100,101,40,36,36,91,36,48,93,41,32,10,98,114,
+         101,97,107,59,10,99,97,115,101,32,51,50,58,32,36,36,91,36,48,45,49,93,46,
+         112,117,115,104,40,36,36,91,36,48,93,41,59,32,116,104,105,115,46,36,32,
+         61,32,36,36,91,36,48,45,49,93,32,10,98,114,101,97,107,59,10,99,97,115,
+         101,32,51,51,58,32,116,104,105,115,46,36,32,61,32,91,36,36,91,36,48,93,
+         93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,52,58,32,116,104,
+         105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,36,36,91,36,48,
+         93,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,53,58,32,116,104,
+         105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,110,101,119,32,
+         121,121,46,83,116,114,105,110,103,78,111,100,101,40,36,36,91,36,48,93,41,
+         93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,54,58,32,116,104,
+         105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,110,101,119,32,
+         121,121,46,73,110,116,101,103,101,114,78,111,100,101,40,36,36,91,36,48,
+         93,41,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,55,58,32,116,
+         104,105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,110,101,119,
+         32,121,121,46,66,111,111,108,101,97,110,78,111,100,101,40,36,36,91,36,48,
+         93,41,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,56,58,32,116,
+         104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,73,100,78,111,100,
+         101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,
+         32,51,57,58,32,36,36,91,36,48,45,50,93,46,112,117,115,104,40,36,36,91,36,
+         48,93,41,59,32,116,104,105,115,46,36,32,61,32,36,36,91,36,48,45,50,93,59,
+         32,10,98,114,101,97,107,59,10,99,97,115,101,32,52,48,58,32,116,104,105,
+         115,46,36,32,61,32,91,36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,
+         125,10,125,44,10,116,97,98,108,101,58,32,91,123,51,58,49,44,52,58,50,44,
+         53,58,91,50,44,52,93,44,54,58,51,44,56,58,52,44,57,58,53,44,49,49,58,54,
+         44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,44,57,93,44,49,53,58,91,
+         49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,44,49,57,58,91,49,44,49,49,
+         93,44,50,50,58,91,49,44,49,51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,
+         58,91,49,44,49,53,93,125,44,123,49,58,91,51,93,125,44,123,53,58,91,49,44,
+         49,54,93,125,44,123,53,58,91,50,44,51,93,44,55,58,49,55,44,56,58,49,56,
+         44,57,58,53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,
+         49,44,57,93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,
+         44,49,57,58,91,49,44,49,57,93,44,50,48,58,91,50,44,51,93,44,50,50,58,91,
+         49,44,49,51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,58,91,49,44,49,53,
+         93,125,44,123,53,58,91,50,44,53,93,44,49,52,58,91,50,44,53,93,44,49,53,
+         58,91,50,44,53,93,44,49,54,58,91,50,44,53,93,44,49,57,58,91,50,44,53,93,
+         44,50,48,58,91,50,44,53,93,44,50,50,58,91,50,44,53,93,44,50,51,58,91,50,
+         44,53,93,44,50,52,58,91,50,44,53,93,125,44,123,52,58,50,48,44,54,58,51,
+         44,56,58,52,44,57,58,53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,
+         49,52,58,91,49,44,57,93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,
+         44,49,50,93,44,49,57,58,91,49,44,49,49,93,44,50,48,58,91,50,44,52,93,44,
+         50,50,58,91,49,44,49,51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,58,91,
+         49,44,49,53,93,125,44,123,52,58,50,49,44,54,58,51,44,56,58,52,44,57,58,
+         53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,44,57,
+         93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,44,49,57,
+         58,91,49,44,49,49,93,44,50,48,58,91,50,44,52,93,44,50,50,58,91,49,44,49,
+         51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,58,91,49,44,49,53,93,125,44,
+         123,53,58,91,50,44,57,93,44,49,52,58,91,50,44,57,93,44,49,53,58,91,50,44,
+         57,93,44,49,54,58,91,50,44,57,93,44,49,57,58,91,50,44,57,93,44,50,48,58,
+         91,50,44,57,93,44,50,50,58,91,50,44,57,93,44,50,51,58,91,50,44,57,93,44,
+         50,52,58,91,50,44,57,93,125,44,123,53,58,91,50,44,49,48,93,44,49,52,58,
+         91,50,44,49,48,93,44,49,53,58,91,50,44,49,48,93,44,49,54,58,91,50,44,49,
+         48,93,44,49,57,58,91,50,44,49,48,93,44,50,48,58,91,50,44,49,48,93,44,50,
+         50,58,91,50,44,49,48,93,44,50,51,58,91,50,44,49,48,93,44,50,52,58,91,50,
+         44,49,48,93,125,44,123,53,58,91,50,44,49,49,93,44,49,52,58,91,50,44,49,
+         49,93,44,49,53,58,91,50,44,49,49,93,44,49,54,58,91,50,44,49,49,93,44,49,
+         57,58,91,50,44,49,49,93,44,50,48,58,91,50,44,49,49,93,44,50,50,58,91,50,
+         44,49,49,93,44,50,51,58,91,50,44,49,49,93,44,50,52,58,91,50,44,49,49,93,
+         125,44,123,53,58,91,50,44,49,50,93,44,49,52,58,91,50,44,49,50,93,44,49,
+         53,58,91,50,44,49,50,93,44,49,54,58,91,50,44,49,50,93,44,49,57,58,91,50,
+         44,49,50,93,44,50,48,58,91,50,44,49,50,93,44,50,50,58,91,50,44,49,50,93,
+         44,50,51,58,91,50,44,49,50,93,44,50,52,58,91,50,44,49,50,93,125,44,123,
+         49,55,58,50,50,44,50,49,58,50,51,44,51,51,58,91,49,44,50,53,93,44,51,53,
+         58,50,52,125,44,123,49,55,58,50,54,44,50,49,58,50,51,44,51,51,58,91,49,
+         44,50,53,93,44,51,53,58,50,52,125,44,123,49,55,58,50,55,44,50,49,58,50,
+         51,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,52,125,44,123,49,55,58,
+         50,56,44,50,49,58,50,51,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,52,
+         125,44,123,50,49,58,50,57,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,
+         52,125,44,123,49,58,91,50,44,49,93,125,44,123,54,58,51,48,44,56,58,52,44,
+         57,58,53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,
+         44,57,93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,44,
+         49,57,58,91,49,44,49,49,93,44,50,50,58,91,49,44,49,51,93,44,50,51,58,91,
+         49,44,49,52,93,44,50,52,58,91,49,44,49,53,93,125,44,123,53,58,91,50,44,
+         54,93,44,49,52,58,91,50,44,54,93,44,49,53,58,91,50,44,54,93,44,49,54,58,
+         91,50,44,54,93,44,49,57,58,91,50,44,54,93,44,50,48,58,91,50,44,54,93,44,
+         50,50,58,91,50,44,54,93,44,50,51,58,91,50,44,54,93,44,50,52,58,91,50,44,
+         54,93,125,44,123,49,55,58,50,50,44,49,56,58,91,49,44,51,49,93,44,50,49,
+         58,50,51,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,52,125,44,123,49,
+         48,58,51,50,44,50,48,58,91,49,44,51,51,93,125,44,123,49,48,58,51,52,44,
+         50,48,58,91,49,44,51,51,93,125,44,123,49,56,58,91,49,44,51,53,93,125,44,
+         123,49,56,58,91,50,44,50,52,93,44,50,49,58,52,48,44,50,53,58,51,54,44,50,
+         54,58,51,55,44,50,55,58,51,56,44,50,56,58,91,49,44,52,49,93,44,50,57,58,
+         91,49,44,52,50,93,44,51,48,58,91,49,44,52,51,93,44,51,49,58,51,57,44,51,
+         50,58,52,52,44,51,51,58,91,49,44,52,53,93,44,51,53,58,50,52,125,44,123,
+         49,56,58,91,50,44,51,56,93,44,50,56,58,91,50,44,51,56,93,44,50,57,58,91,
+         50,44,51,56,93,44,51,48,58,91,50,44,51,56,93,44,51,51,58,91,50,44,51,56,
+         93,44,51,54,58,91,49,44,52,54,93,125,44,123,49,56,58,91,50,44,52,48,93,
+         44,50,56,58,91,50,44,52,48,93,44,50,57,58,91,50,44,52,48,93,44,51,48,58,
+         91,50,44,52,48,93,44,51,51,58,91,50,44,52,48,93,44,51,54,58,91,50,44,52,
+         48,93,125,44,123,49,56,58,91,49,44,52,55,93,125,44,123,49,56,58,91,49,44,
+         52,56,93,125,44,123,49,56,58,91,49,44,52,57,93,125,44,123,49,56,58,91,49,
+         44,53,48,93,44,50,49,58,53,49,44,51,51,58,91,49,44,50,53,93,44,51,53,58,
+         50,52,125,44,123,53,58,91,50,44,50,93,44,56,58,49,56,44,57,58,53,44,49,
+         49,58,54,44,49,50,58,55,44,49,51,58,

<TRUNCATED>

[38/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Document new encoding and decoding options


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/3458b79c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/3458b79c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/3458b79c

Branch: refs/heads/master
Commit: 3458b79cac9fa612cd004bbcc4e46ca67463c08b
Parents: 5d6b265
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:35:51 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:35:51 2015 -0500

----------------------------------------------------------------------
 README.md | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/3458b79c/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 1e95bc0..7f51ce1 100644
--- a/README.md
+++ b/README.md
@@ -42,6 +42,11 @@ The options for decode are:
 * `return_maps` - Tell Jiffy to return objects using the maps data type
   on VMs that support it. This raises an error on VMs that don't support
   maps.
+* `{null_term, Term}` - Returns the specified `Term` instead of `null`
+  when decoding JSON. This is for people that wish to use `undefined`
+  instead of `null`.
+* `use_nil` - Returns the atom `nil` instead of `null` when decoding
+  JSON. This is a short hand for `{null_term, nil}`.
 
 `jiffy:encode/1,2`
 ------------------
@@ -62,6 +67,8 @@ The options for encode are:
 * `{bytes_per_iter, N}` where N &gt;= 0 - This controls the number of
   bytes that Jiffy will generate before yielding back to the VM. The
   mechanics of this yield are completely hidden from the end user.
+* `escape_forward_slashes` - Escapes the `/` character which can be
+  useful when encoding URLs in some cases.
 
 Data Format
 -----------


[25/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Travis.ci added support for Erlang 17.1


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/b0fc2991
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/b0fc2991
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/b0fc2991

Branch: refs/heads/master
Commit: b0fc299119f8cbd8553484e513bf605db3e774fc
Parents: 6318efa
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Oct 3 15:54:26 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Oct 3 15:54:26 2014 -0500

----------------------------------------------------------------------
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b0fc2991/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 2d661f6..bab69d6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@ language: erlang
 notifications:
   email: paul.joseph.davis@gmail.com
 otp_release:
+   - 17.1
    - 17.0
    - R16B03-1
    - R16B02


[37/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Update double-conversion to latest master


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/5d6b2651
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/5d6b2651
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/5d6b2651

Branch: refs/heads/master
Commit: 5d6b2651c9ebdccf04ab99083cbf24919ebf25b9
Parents: a141843
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:27:04 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:27:04 2015 -0500

----------------------------------------------------------------------
 c_src/double-conversion/AUTHORS              |   2 +
 c_src/double-conversion/DOWNLOADED           |   3 -
 c_src/double-conversion/README               |  45 ++++-
 c_src/double-conversion/VERSION              |   2 +
 c_src/double-conversion/bignum-dtoa.cc       |  11 +-
 c_src/double-conversion/bignum-dtoa.h        |   2 +-
 c_src/double-conversion/bignum.cc            |  30 +--
 c_src/double-conversion/bignum.h             |   3 +-
 c_src/double-conversion/cached-powers.cc     |   3 +-
 c_src/double-conversion/diy-fp.cc            |   4 +-
 c_src/double-conversion/diy-fp.h             |  24 +--
 c_src/double-conversion/double-conversion.cc | 221 +++++++++++++++-------
 c_src/double-conversion/double-conversion.h  |  35 ++--
 c_src/double-conversion/fast-dtoa.cc         |  21 +-
 c_src/double-conversion/fast-dtoa.h          |   2 +-
 c_src/double-conversion/fixed-dtoa.cc        |  12 +-
 c_src/double-conversion/fixed-dtoa.h         |   2 +-
 c_src/double-conversion/ieee.h               |   4 +
 c_src/double-conversion/strtod.cc            |   5 +-
 c_src/double-conversion/strtod.h             |   2 +-
 c_src/double-conversion/utils.h              |  43 +++--
 21 files changed, 315 insertions(+), 161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/AUTHORS
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/AUTHORS b/c_src/double-conversion/AUTHORS
index ff2a5f4..88b38ae 100644
--- a/c_src/double-conversion/AUTHORS
+++ b/c_src/double-conversion/AUTHORS
@@ -10,3 +10,5 @@ Mozilla Foundation
 Jeff Muizelaar <jm...@mozilla.com>
 Mike Hommey <mh...@mozilla.com>
 Martin Olsson <mn...@minimum.se>
+Kent Williams <ch...@gmail.com>
+Elan Ruusamäe <gl...@delfi.ee>

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/DOWNLOADED
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/DOWNLOADED b/c_src/double-conversion/DOWNLOADED
deleted file mode 100644
index 64724d8..0000000
--- a/c_src/double-conversion/DOWNLOADED
+++ /dev/null
@@ -1,3 +0,0 @@
-Downloaded: 2013-02-24
-
-https://double-conversion.googlecode.com/files/double-conversion-1.1.1.tar.gz

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/README
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/README b/c_src/double-conversion/README
index f186b42..fc54116 100644
--- a/c_src/double-conversion/README
+++ b/c_src/double-conversion/README
@@ -1,4 +1,4 @@
-http://code.google.com/p/double-conversion
+https://github.com/google/double-conversion/
 
 This project (double-conversion) provides binary-decimal and decimal-binary
 routines for IEEE doubles.
@@ -9,3 +9,46 @@ it can be used more easily in other projects.
 
 There is extensive documentation in src/double-conversion.h. Other examples can
 be found in test/cctest/test-conversions.cc.
+
+
+Building
+========
+
+This library can be built with scons [0] or cmake [1].
+The checked-in Makefile simply forwards to scons, and provides a
+shortcut to run all tests:
+
+    make
+    make test
+
+Scons
+-----
+
+The easiest way to install this library is to use `scons`. It builds
+the static and shared library, and is set up to install those at the
+correct locations:
+
+    scons install
+
+Use the `DESTDIR` option to change the target directory:
+
+    scons DESTDIR=alternative_directory install
+
+Cmake
+-----
+
+To use cmake run `cmake .` in the root directory. This overwrites the
+existing Makefile.
+
+Use `-DBUILD_SHARED_LIBS=ON` to enable the compilation of shared libraries.
+Note that this disables static libraries. There is currently no way to
+build both libraries at the same time with cmake.
+
+Use `-DBUILD_TESTING=ON` to build the test executable.
+
+    cmake . -DBUILD_TESTING=ON
+    make
+    test/cctest/cctest --list | tr -d '<' | xargs test/cctest/cctest
+
+[0]: http://www.scons.org
+[1]: http://www.cmake.org

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/VERSION
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/VERSION b/c_src/double-conversion/VERSION
new file mode 100644
index 0000000..2adab47
--- /dev/null
+++ b/c_src/double-conversion/VERSION
@@ -0,0 +1,2 @@
+Clone from: https://github.com/google/double-conversion
+Version: v2.0.1-23-gc3e0c97

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/bignum-dtoa.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/bignum-dtoa.cc b/c_src/double-conversion/bignum-dtoa.cc
index b6c2e85..f1ad7a5 100644
--- a/c_src/double-conversion/bignum-dtoa.cc
+++ b/c_src/double-conversion/bignum-dtoa.cc
@@ -192,13 +192,13 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
     delta_plus = delta_minus;
   }
   *length = 0;
-  while (true) {
+  for (;;) {
     uint16_t digit;
     digit = numerator->DivideModuloIntBignum(*denominator);
     ASSERT(digit <= 9);  // digit is a uint16_t and therefore always positive.
     // digit = numerator / denominator (integer division).
     // numerator = numerator % denominator.
-    buffer[(*length)++] = digit + '0';
+    buffer[(*length)++] = static_cast<char>(digit + '0');
 
     // Can we stop already?
     // If the remainder of the division is less than the distance to the lower
@@ -282,7 +282,7 @@ static void GenerateShortestDigits(Bignum* numerator, Bignum* denominator,
 // exponent (decimal_point), when rounding upwards.
 static void GenerateCountedDigits(int count, int* decimal_point,
                                   Bignum* numerator, Bignum* denominator,
-                                  Vector<char>(buffer), int* length) {
+                                  Vector<char> buffer, int* length) {
   ASSERT(count >= 0);
   for (int i = 0; i < count - 1; ++i) {
     uint16_t digit;
@@ -290,7 +290,7 @@ static void GenerateCountedDigits(int count, int* decimal_point,
     ASSERT(digit <= 9);  // digit is a uint16_t and therefore always positive.
     // digit = numerator / denominator (integer division).
     // numerator = numerator % denominator.
-    buffer[i] = digit + '0';
+    buffer[i] = static_cast<char>(digit + '0');
     // Prepare for next iteration.
     numerator->Times10();
   }
@@ -300,7 +300,8 @@ static void GenerateCountedDigits(int count, int* decimal_point,
   if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) {
     digit++;
   }
-  buffer[count - 1] = digit + '0';
+  ASSERT(digit <= 10);
+  buffer[count - 1] = static_cast<char>(digit + '0');
   // Correct bad digits (in case we had a sequence of '9's). Propagate the
   // carry until we hat a non-'9' or til we reach the first digit.
   for (int i = count - 1; i > 0; --i) {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/bignum-dtoa.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/bignum-dtoa.h b/c_src/double-conversion/bignum-dtoa.h
index 34b9619..92455ec 100644
--- a/c_src/double-conversion/bignum-dtoa.h
+++ b/c_src/double-conversion/bignum-dtoa.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_BIGNUM_DTOA_H_
 #define DOUBLE_CONVERSION_BIGNUM_DTOA_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/bignum.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/bignum.cc b/c_src/double-conversion/bignum.cc
index 3c88303..89c0ab2 100644
--- a/c_src/double-conversion/bignum.cc
+++ b/c_src/double-conversion/bignum.cc
@@ -25,8 +25,8 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-#include "bignum.h"
-#include "utils.h"
+#include "double-conversion/bignum.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 
@@ -40,6 +40,7 @@ Bignum::Bignum()
 
 template<typename S>
 static int BitSize(S value) {
+  (void) value;  // Mark variable as used.
   return 8 * sizeof(value);
 }
 
@@ -103,7 +104,7 @@ void Bignum::AssignDecimalString(Vector<const char> value) {
   const int kMaxUint64DecimalDigits = 19;
   Zero();
   int length = value.length();
-  unsigned int pos = 0;
+  int pos = 0;
   // Let's just say that each digit needs 4 bits.
   while (length >= kMaxUint64DecimalDigits) {
     uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
@@ -122,9 +123,8 @@ void Bignum::AssignDecimalString(Vector<const char> value) {
 static int HexCharValue(char c) {
   if ('0' <= c && c <= '9') return c - '0';
   if ('a' <= c && c <= 'f') return 10 + c - 'a';
-  if ('A' <= c && c <= 'F') return 10 + c - 'A';
-  UNREACHABLE();
-  return 0;  // To make compiler happy.
+  ASSERT('A' <= c && c <= 'F');
+  return 10 + c - 'A';
 }
 
 
@@ -501,13 +501,14 @@ uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
   // Start by removing multiples of 'other' until both numbers have the same
   // number of digits.
   while (BigitLength() > other.BigitLength()) {
-    // This naive approach is extremely inefficient if the this divided other
-    // might be big. This function is implemented for doubleToString where
+    // This naive approach is extremely inefficient if `this` divided by other
+    // is big. This function is implemented for doubleToString where
     // the result should be small (less than 10).
     ASSERT(other.bigits_[other.used_digits_ - 1] >= ((1 << kBigitSize) / 16));
+    ASSERT(bigits_[used_digits_ - 1] < 0x10000);
     // Remove the multiples of the first digit.
     // Example this = 23 and other equals 9. -> Remove 2 multiples.
-    result += bigits_[used_digits_ - 1];
+    result += static_cast<uint16_t>(bigits_[used_digits_ - 1]);
     SubtractTimes(other, bigits_[used_digits_ - 1]);
   }
 
@@ -523,13 +524,15 @@ uint16_t Bignum::DivideModuloIntBignum(const Bignum& other) {
     // Shortcut for easy (and common) case.
     int quotient = this_bigit / other_bigit;
     bigits_[used_digits_ - 1] = this_bigit - other_bigit * quotient;
-    result += quotient;
+    ASSERT(quotient < 0x10000);
+    result += static_cast<uint16_t>(quotient);
     Clamp();
     return result;
   }
 
   int division_estimate = this_bigit / (other_bigit + 1);
-  result += division_estimate;
+  ASSERT(division_estimate < 0x10000);
+  result += static_cast<uint16_t>(division_estimate);
   SubtractTimes(other, division_estimate);
 
   if (other_bigit * (division_estimate + 1) > this_bigit) {
@@ -560,8 +563,8 @@ static int SizeInHexChars(S number) {
 
 static char HexCharOfValue(int value) {
   ASSERT(0 <= value && value <= 16);
-  if (value < 10) return value + '0';
-  return value - 10 + 'A';
+  if (value < 10) return static_cast<char>(value + '0');
+  return static_cast<char>(value - 10 + 'A');
 }
 
 
@@ -755,7 +758,6 @@ void Bignum::SubtractTimes(const Bignum& other, int factor) {
     Chunk difference = bigits_[i] - borrow;
     bigits_[i] = difference & kBigitMask;
     borrow = difference >> (kChunkSize - 1);
-    ++i;
   }
   Clamp();
 }

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/bignum.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/bignum.h b/c_src/double-conversion/bignum.h
index 5ec3544..57e4230 100644
--- a/c_src/double-conversion/bignum.h
+++ b/c_src/double-conversion/bignum.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_BIGNUM_H_
 #define DOUBLE_CONVERSION_BIGNUM_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 
@@ -49,7 +49,6 @@ class Bignum {
 
   void AssignPowerUInt16(uint16_t base, int exponent);
 
-  void AddUInt16(uint16_t operand);
   void AddUInt64(uint64_t operand);
   void AddBignum(const Bignum& other);
   // Precondition: this >= other.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/cached-powers.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/cached-powers.cc b/c_src/double-conversion/cached-powers.cc
index c676429..6cbc09b 100644
--- a/c_src/double-conversion/cached-powers.cc
+++ b/c_src/double-conversion/cached-powers.cc
@@ -29,7 +29,7 @@
 #include <limits.h>
 #include <math.h>
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 #include "cached-powers.h"
 
@@ -152,6 +152,7 @@ void PowersOfTenCache::GetCachedPowerForBinaryExponentRange(
   ASSERT(0 <= index && index < kCachedPowersLength);
   CachedPower cached_power = kCachedPowers[index];
   ASSERT(min_exponent <= cached_power.binary_exponent);
+  (void) max_exponent;  // Mark variable as used.
   ASSERT(cached_power.binary_exponent <= max_exponent);
   *decimal_exponent = cached_power.decimal_exponent;
   *power = DiyFp(cached_power.significand, cached_power.binary_exponent);

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/diy-fp.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/diy-fp.cc b/c_src/double-conversion/diy-fp.cc
index ddd1891..60b805e 100644
--- a/c_src/double-conversion/diy-fp.cc
+++ b/c_src/double-conversion/diy-fp.cc
@@ -26,8 +26,8 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-#include "diy-fp.h"
-#include "utils.h"
+#include "double-conversion/diy-fp.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/diy-fp.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/diy-fp.h b/c_src/double-conversion/diy-fp.h
index 9dcf8fb..a0c0c15 100644
--- a/c_src/double-conversion/diy-fp.h
+++ b/c_src/double-conversion/diy-fp.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_DIY_FP_H_
 #define DOUBLE_CONVERSION_DIY_FP_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 
@@ -42,7 +42,7 @@ class DiyFp {
   static const int kSignificandSize = 64;
 
   DiyFp() : f_(0), e_(0) {}
-  DiyFp(uint64_t f, int e) : f_(f), e_(e) {}
+  DiyFp(uint64_t significand, int exponent) : f_(significand), e_(exponent) {}
 
   // this = this - other.
   // The exponents of both numbers must be the same and the significand of this
@@ -76,22 +76,22 @@ class DiyFp {
 
   void Normalize() {
     ASSERT(f_ != 0);
-    uint64_t f = f_;
-    int e = e_;
+    uint64_t significand = f_;
+    int exponent = e_;
 
     // This method is mainly called for normalizing boundaries. In general
     // boundaries need to be shifted by 10 bits. We thus optimize for this case.
     const uint64_t k10MSBits = UINT64_2PART_C(0xFFC00000, 00000000);
-    while ((f & k10MSBits) == 0) {
-      f <<= 10;
-      e -= 10;
+    while ((significand & k10MSBits) == 0) {
+      significand <<= 10;
+      exponent -= 10;
     }
-    while ((f & kUint64MSB) == 0) {
-      f <<= 1;
-      e--;
+    while ((significand & kUint64MSB) == 0) {
+      significand <<= 1;
+      exponent--;
     }
-    f_ = f;
-    e_ = e;
+    f_ = significand;
+    e_ = exponent;
   }
 
   static DiyFp Normalize(const DiyFp& a) {

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/double-conversion.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/double-conversion.cc b/c_src/double-conversion/double-conversion.cc
index a79fe92..a6fc0de 100644
--- a/c_src/double-conversion/double-conversion.cc
+++ b/c_src/double-conversion/double-conversion.cc
@@ -28,14 +28,14 @@
 #include <limits.h>
 #include <math.h>
 
-#include "double-conversion.h"
+#include "double-conversion/double-conversion.h"
 
-#include "bignum-dtoa.h"
-#include "fast-dtoa.h"
-#include "fixed-dtoa.h"
-#include "ieee.h"
-#include "strtod.h"
-#include "utils.h"
+#include "double-conversion/bignum-dtoa.h"
+#include "double-conversion/fast-dtoa.h"
+#include "double-conversion/fixed-dtoa.h"
+#include "double-conversion/ieee.h"
+#include "double-conversion/strtod.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 
@@ -348,7 +348,6 @@ static BignumDtoaMode DtoaToBignumDtoaMode(
     case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION;
     default:
       UNREACHABLE();
-      return BIGNUM_DTOA_SHORTEST;  // To silence compiler.
   }
 }
 
@@ -403,8 +402,8 @@ void DoubleToStringConverter::DoubleToAscii(double v,
                              vector, length, point);
       break;
     default:
-      UNREACHABLE();
       fast_worked = false;
+      UNREACHABLE();
   }
   if (fast_worked) return;
 
@@ -417,8 +416,9 @@ void DoubleToStringConverter::DoubleToAscii(double v,
 
 // Consumes the given substring from the iterator.
 // Returns false, if the substring does not match.
-static bool ConsumeSubString(const char** current,
-                             const char* end,
+template <class Iterator>
+static bool ConsumeSubString(Iterator* current,
+                             Iterator end,
                              const char* substring) {
   ASSERT(**current == *substring);
   for (substring++; *substring != '\0'; substring++) {
@@ -440,10 +440,36 @@ static bool ConsumeSubString(const char** current,
 const int kMaxSignificantDigits = 772;
 
 
+static const char kWhitespaceTable7[] = { 32, 13, 10, 9, 11, 12 };
+static const int kWhitespaceTable7Length = ARRAY_SIZE(kWhitespaceTable7);
+
+
+static const uc16 kWhitespaceTable16[] = {
+  160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195,
+  8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279
+};
+static const int kWhitespaceTable16Length = ARRAY_SIZE(kWhitespaceTable16);
+
+
+static bool isWhitespace(int x) {
+  if (x < 128) {
+    for (int i = 0; i < kWhitespaceTable7Length; i++) {
+      if (kWhitespaceTable7[i] == x) return true;
+    }
+  } else {
+    for (int i = 0; i < kWhitespaceTable16Length; i++) {
+      if (kWhitespaceTable16[i] == x) return true;
+    }
+  }
+  return false;
+}
+
+
 // Returns true if a nonspace found and false if the end has reached.
-static inline bool AdvanceToNonspace(const char** current, const char* end) {
+template <class Iterator>
+static inline bool AdvanceToNonspace(Iterator* current, Iterator end) {
   while (*current != end) {
-    if (**current != ' ') return true;
+    if (!isWhitespace(**current)) return true;
     ++*current;
   }
   return false;
@@ -462,26 +488,57 @@ static double SignedZero(bool sign) {
 }
 
 
+// Returns true if 'c' is a decimal digit that is valid for the given radix.
+//
+// The function is small and could be inlined, but VS2012 emitted a warning
+// because it constant-propagated the radix and concluded that the last
+// condition was always true. By moving it into a separate function the
+// compiler wouldn't warn anymore.
+#if _MSC_VER
+#pragma optimize("",off)
+static bool IsDecimalDigitForRadix(int c, int radix) {
+  return '0' <= c && c <= '9' && (c - '0') < radix;
+}
+#pragma optimize("",on)
+#else
+static bool inline IsDecimalDigitForRadix(int c, int radix) {
+	return '0' <= c && c <= '9' && (c - '0') < radix;
+}
+#endif
+// Returns true if 'c' is a character digit that is valid for the given radix.
+// The 'a_character' should be 'a' or 'A'.
+//
+// The function is small and could be inlined, but VS2012 emitted a warning
+// because it constant-propagated the radix and concluded that the first
+// condition was always false. By moving it into a separate function the
+// compiler wouldn't warn anymore.
+static bool IsCharacterDigitForRadix(int c, int radix, char a_character) {
+  return radix > 10 && c >= a_character && c < a_character + radix - 10;
+}
+
+
 // Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end.
-template <int radix_log_2>
-static double RadixStringToIeee(const char* current,
-                                const char* end,
+template <int radix_log_2, class Iterator>
+static double RadixStringToIeee(Iterator* current,
+                                Iterator end,
                                 bool sign,
                                 bool allow_trailing_junk,
                                 double junk_string_value,
                                 bool read_as_double,
-                                const char** trailing_pointer) {
-  ASSERT(current != end);
+                                bool* result_is_junk) {
+  ASSERT(*current != end);
 
   const int kDoubleSize = Double::kSignificandSize;
   const int kSingleSize = Single::kSignificandSize;
   const int kSignificandSize = read_as_double? kDoubleSize: kSingleSize;
 
+  *result_is_junk = true;
+
   // Skip leading 0s.
-  while (*current == '0') {
-    ++current;
-    if (current == end) {
-      *trailing_pointer = end;
+  while (**current == '0') {
+    ++(*current);
+    if (*current == end) {
+      *result_is_junk = false;
       return SignedZero(sign);
     }
   }
@@ -492,14 +549,14 @@ static double RadixStringToIeee(const char* current,
 
   do {
     int digit;
-    if (*current >= '0' && *current <= '9' && *current < '0' + radix) {
-      digit = static_cast<char>(*current) - '0';
-    } else if (radix > 10 && *current >= 'a' && *current < 'a' + radix - 10) {
-      digit = static_cast<char>(*current) - 'a' + 10;
-    } else if (radix > 10 && *current >= 'A' && *current < 'A' + radix - 10) {
-      digit = static_cast<char>(*current) - 'A' + 10;
+    if (IsDecimalDigitForRadix(**current, radix)) {
+      digit = static_cast<char>(**current) - '0';
+    } else if (IsCharacterDigitForRadix(**current, radix, 'a')) {
+      digit = static_cast<char>(**current) - 'a' + 10;
+    } else if (IsCharacterDigitForRadix(**current, radix, 'A')) {
+      digit = static_cast<char>(**current) - 'A' + 10;
     } else {
-      if (allow_trailing_junk || !AdvanceToNonspace(&current, end)) {
+      if (allow_trailing_junk || !AdvanceToNonspace(current, end)) {
         break;
       } else {
         return junk_string_value;
@@ -523,14 +580,14 @@ static double RadixStringToIeee(const char* current,
       exponent = overflow_bits_count;
 
       bool zero_tail = true;
-      while (true) {
-        ++current;
-        if (current == end || !isDigit(*current, radix)) break;
-        zero_tail = zero_tail && *current == '0';
+      for (;;) {
+        ++(*current);
+        if (*current == end || !isDigit(**current, radix)) break;
+        zero_tail = zero_tail && **current == '0';
         exponent += radix_log_2;
       }
 
-      if (!allow_trailing_junk && AdvanceToNonspace(&current, end)) {
+      if (!allow_trailing_junk && AdvanceToNonspace(current, end)) {
         return junk_string_value;
       }
 
@@ -552,13 +609,13 @@ static double RadixStringToIeee(const char* current,
       }
       break;
     }
-    ++current;
-  } while (current != end);
+    ++(*current);
+  } while (*current != end);
 
   ASSERT(number < ((int64_t)1 << kSignificandSize));
   ASSERT(static_cast<int64_t>(static_cast<double>(number)) == number);
 
-  *trailing_pointer = current;
+  *result_is_junk = false;
 
   if (exponent == 0) {
     if (sign) {
@@ -573,13 +630,14 @@ static double RadixStringToIeee(const char* current,
 }
 
 
+template <class Iterator>
 double StringToDoubleConverter::StringToIeee(
-    const char* input,
+    Iterator input,
     int length,
-    int* processed_characters_count,
-    bool read_as_double) {
-  const char* current = input;
-  const char* end = input + length;
+    bool read_as_double,
+    int* processed_characters_count) const {
+  Iterator current = input;
+  Iterator end = input + length;
 
   *processed_characters_count = 0;
 
@@ -600,7 +658,7 @@ double StringToDoubleConverter::StringToIeee(
 
   if (allow_leading_spaces || allow_trailing_spaces) {
     if (!AdvanceToNonspace(&current, end)) {
-      *processed_characters_count = current - input;
+      *processed_characters_count = static_cast<int>(current - input);
       return empty_string_value_;
     }
     if (!allow_leading_spaces && (input != current)) {
@@ -626,7 +684,7 @@ double StringToDoubleConverter::StringToIeee(
   if (*current == '+' || *current == '-') {
     sign = (*current == '-');
     ++current;
-    const char* next_non_space = current;
+    Iterator next_non_space = current;
     // Skip following spaces (if allowed).
     if (!AdvanceToNonspace(&next_non_space, end)) return junk_string_value_;
     if (!allow_spaces_after_sign && (current != next_non_space)) {
@@ -649,7 +707,7 @@ double StringToDoubleConverter::StringToIeee(
       }
 
       ASSERT(buffer_pos == 0);
-      *processed_characters_count = current - input;
+      *processed_characters_count = static_cast<int>(current - input);
       return sign ? -Double::Infinity() : Double::Infinity();
     }
   }
@@ -668,7 +726,7 @@ double StringToDoubleConverter::StringToIeee(
       }
 
       ASSERT(buffer_pos == 0);
-      *processed_characters_count = current - input;
+      *processed_characters_count = static_cast<int>(current - input);
       return sign ? -Double::NaN() : Double::NaN();
     }
   }
@@ -677,7 +735,7 @@ double StringToDoubleConverter::StringToIeee(
   if (*current == '0') {
     ++current;
     if (current == end) {
-      *processed_characters_count = current - input;
+      *processed_characters_count = static_cast<int>(current - input);
       return SignedZero(sign);
     }
 
@@ -690,17 +748,17 @@ double StringToDoubleConverter::StringToIeee(
         return junk_string_value_;  // "0x".
       }
 
-      const char* tail_pointer = NULL;
-      double result = RadixStringToIeee<4>(current,
+      bool result_is_junk;
+      double result = RadixStringToIeee<4>(&current,
                                            end,
                                            sign,
                                            allow_trailing_junk,
                                            junk_string_value_,
                                            read_as_double,
-                                           &tail_pointer);
-      if (tail_pointer != NULL) {
-        if (allow_trailing_spaces) AdvanceToNonspace(&tail_pointer, end);
-        *processed_characters_count = tail_pointer - input;
+                                           &result_is_junk);
+      if (!result_is_junk) {
+        if (allow_trailing_spaces) AdvanceToNonspace(&current, end);
+        *processed_characters_count = static_cast<int>(current - input);
       }
       return result;
     }
@@ -709,7 +767,7 @@ double StringToDoubleConverter::StringToIeee(
     while (*current == '0') {
       ++current;
       if (current == end) {
-        *processed_characters_count = current - input;
+        *processed_characters_count = static_cast<int>(current - input);
         return SignedZero(sign);
       }
     }
@@ -757,7 +815,7 @@ double StringToDoubleConverter::StringToIeee(
       while (*current == '0') {
         ++current;
         if (current == end) {
-          *processed_characters_count = current - input;
+          *processed_characters_count = static_cast<int>(current - input);
           return SignedZero(sign);
         }
         exponent--;  // Move this 0 into the exponent.
@@ -801,9 +859,9 @@ double StringToDoubleConverter::StringToIeee(
         return junk_string_value_;
       }
     }
-    char sign = '+';
+    char exponen_sign = '+';
     if (*current == '+' || *current == '-') {
-      sign = static_cast<char>(*current);
+      exponen_sign = static_cast<char>(*current);
       ++current;
       if (current == end) {
         if (allow_trailing_junk) {
@@ -837,7 +895,7 @@ double StringToDoubleConverter::StringToIeee(
       ++current;
     } while (current != end && *current >= '0' && *current <= '9');
 
-    exponent += (sign == '-' ? -num : num);
+    exponent += (exponen_sign == '-' ? -num : num);
   }
 
   if (!(allow_trailing_spaces || allow_trailing_junk) && (current != end)) {
@@ -855,16 +913,17 @@ double StringToDoubleConverter::StringToIeee(
 
   if (octal) {
     double result;
-    const char* tail_pointer = NULL;
-    result = RadixStringToIeee<3>(buffer,
+    bool result_is_junk;
+    char* start = buffer;
+    result = RadixStringToIeee<3>(&start,
                                   buffer + buffer_pos,
                                   sign,
                                   allow_trailing_junk,
                                   junk_string_value_,
                                   read_as_double,
-                                  &tail_pointer);
-    ASSERT(tail_pointer != NULL);
-    *processed_characters_count = current - input;
+                                  &result_is_junk);
+    ASSERT(!result_is_junk);
+    *processed_characters_count = static_cast<int>(current - input);
     return result;
   }
 
@@ -882,8 +941,42 @@ double StringToDoubleConverter::StringToIeee(
   } else {
     converted = Strtof(Vector<const char>(buffer, buffer_pos), exponent);
   }
-  *processed_characters_count = current - input;
+  *processed_characters_count = static_cast<int>(current - input);
   return sign? -converted: converted;
 }
 
+
+double StringToDoubleConverter::StringToDouble(
+    const char* buffer,
+    int length,
+    int* processed_characters_count) const {
+  return StringToIeee(buffer, length, true, processed_characters_count);
+}
+
+
+double StringToDoubleConverter::StringToDouble(
+    const uc16* buffer,
+    int length,
+    int* processed_characters_count) const {
+  return StringToIeee(buffer, length, true, processed_characters_count);
+}
+
+
+float StringToDoubleConverter::StringToFloat(
+    const char* buffer,
+    int length,
+    int* processed_characters_count) const {
+  return static_cast<float>(StringToIeee(buffer, length, false,
+                                         processed_characters_count));
+}
+
+
+float StringToDoubleConverter::StringToFloat(
+    const uc16* buffer,
+    int length,
+    int* processed_characters_count) const {
+  return static_cast<float>(StringToIeee(buffer, length, false,
+                                         processed_characters_count));
+}
+
 }  // namespace double_conversion

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/double-conversion.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/double-conversion.h b/c_src/double-conversion/double-conversion.h
index f98edae..11fbcb8 100644
--- a/c_src/double-conversion/double-conversion.h
+++ b/c_src/double-conversion/double-conversion.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
 #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 
@@ -415,9 +415,10 @@ class StringToDoubleConverter {
   //          junk, too.
   //  - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of
   //      a double literal.
-  //  - ALLOW_LEADING_SPACES: skip over leading spaces.
-  //  - ALLOW_TRAILING_SPACES: ignore trailing spaces.
-  //  - ALLOW_SPACES_AFTER_SIGN: ignore spaces after the sign.
+  //  - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces,
+  //                          new-lines, and tabs.
+  //  - ALLOW_TRAILING_SPACES: ignore trailing whitespace.
+  //  - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign.
   //       Ex: StringToDouble("-   123.2") -> -123.2.
   //           StringToDouble("+   123.2") -> 123.2
   //
@@ -502,19 +503,24 @@ class StringToDoubleConverter {
   // in the 'processed_characters_count'. Trailing junk is never included.
   double StringToDouble(const char* buffer,
                         int length,
-                        int* processed_characters_count) {
-    return StringToIeee(buffer, length, processed_characters_count, true);
-  }
+                        int* processed_characters_count) const;
+
+  // Same as StringToDouble above but for 16 bit characters.
+  double StringToDouble(const uc16* buffer,
+                        int length,
+                        int* processed_characters_count) const;
 
   // Same as StringToDouble but reads a float.
   // Note that this is not equivalent to static_cast<float>(StringToDouble(...))
   // due to potential double-rounding.
   float StringToFloat(const char* buffer,
                       int length,
-                      int* processed_characters_count) {
-    return static_cast<float>(StringToIeee(buffer, length,
-                                           processed_characters_count, false));
-  }
+                      int* processed_characters_count) const;
+
+  // Same as StringToFloat above but for 16 bit characters.
+  float StringToFloat(const uc16* buffer,
+                      int length,
+                      int* processed_characters_count) const;
 
  private:
   const int flags_;
@@ -523,10 +529,11 @@ class StringToDoubleConverter {
   const char* const infinity_symbol_;
   const char* const nan_symbol_;
 
-  double StringToIeee(const char* buffer,
+  template <class Iterator>
+  double StringToIeee(Iterator start_pointer,
                       int length,
-                      int* processed_characters_count,
-                      bool read_as_double);
+                      bool read_as_double,
+                      int* processed_characters_count) const;
 
   DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter);
 };

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/fast-dtoa.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/fast-dtoa.cc b/c_src/double-conversion/fast-dtoa.cc
index b2f7b8d..6135038 100644
--- a/c_src/double-conversion/fast-dtoa.cc
+++ b/c_src/double-conversion/fast-dtoa.cc
@@ -248,13 +248,8 @@ static void BiggestPowerTen(uint32_t number,
   // Note: kPowersOf10[i] == 10^(i-1).
   exponent_plus_one_guess++;
   // We don't have any guarantees that 2^number_bits <= number.
-  // TODO(floitsch): can we change the 'while' into an 'if'? We definitely see
-  // number < (2^number_bits - 1), but I haven't encountered
-  // number < (2^number_bits - 2) yet.
-  while (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
+  if (number < kSmallPowersOfTen[exponent_plus_one_guess]) {
     exponent_plus_one_guess--;
-    if (exponent_plus_one_guess <= 0)
-      break;
   }
   *power = kSmallPowersOfTen[exponent_plus_one_guess];
   *exponent_plus_one = exponent_plus_one_guess;
@@ -352,7 +347,8 @@ static bool DigitGen(DiyFp low,
   // that is smaller than integrals.
   while (*kappa > 0) {
     int digit = integrals / divisor;
-    buffer[*length] = '0' + digit;
+    ASSERT(digit <= 9);
+    buffer[*length] = static_cast<char>('0' + digit);
     (*length)++;
     integrals %= divisor;
     (*kappa)--;
@@ -381,13 +377,14 @@ static bool DigitGen(DiyFp low,
   ASSERT(one.e() >= -60);
   ASSERT(fractionals < one.f());
   ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f());
-  while (true) {
+  for (;;) {
     fractionals *= 10;
     unit *= 10;
     unsafe_interval.set_f(unsafe_interval.f() * 10);
     // Integer division by one.
     int digit = static_cast<int>(fractionals >> -one.e());
-    buffer[*length] = '0' + digit;
+    ASSERT(digit <= 9);
+    buffer[*length] = static_cast<char>('0' + digit);
     (*length)++;
     fractionals &= one.f() - 1;  // Modulo by one.
     (*kappa)--;
@@ -461,7 +458,8 @@ static bool DigitGenCounted(DiyFp w,
   // that is smaller than 'integrals'.
   while (*kappa > 0) {
     int digit = integrals / divisor;
-    buffer[*length] = '0' + digit;
+    ASSERT(digit <= 9);
+    buffer[*length] = static_cast<char>('0' + digit);
     (*length)++;
     requested_digits--;
     integrals %= divisor;
@@ -494,7 +492,8 @@ static bool DigitGenCounted(DiyFp w,
     w_error *= 10;
     // Integer division by one.
     int digit = static_cast<int>(fractionals >> -one.e());
-    buffer[*length] = '0' + digit;
+    ASSERT(digit <= 9);
+    buffer[*length] = static_cast<char>('0' + digit);
     (*length)++;
     requested_digits--;
     fractionals &= one.f() - 1;  // Modulo by one.

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/fast-dtoa.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/fast-dtoa.h b/c_src/double-conversion/fast-dtoa.h
index 5f1e8ee..259ee3a 100644
--- a/c_src/double-conversion/fast-dtoa.h
+++ b/c_src/double-conversion/fast-dtoa.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_FAST_DTOA_H_
 #define DOUBLE_CONVERSION_FAST_DTOA_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/fixed-dtoa.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/fixed-dtoa.cc b/c_src/double-conversion/fixed-dtoa.cc
index d56b144..aef65fd 100644
--- a/c_src/double-conversion/fixed-dtoa.cc
+++ b/c_src/double-conversion/fixed-dtoa.cc
@@ -133,7 +133,7 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
   while (number != 0) {
     int digit = number % 10;
     number /= 10;
-    buffer[(*length) + number_length] = '0' + digit;
+    buffer[(*length) + number_length] = static_cast<char>('0' + digit);
     number_length++;
   }
   // Exchange the digits.
@@ -150,7 +150,7 @@ static void FillDigits32(uint32_t number, Vector<char> buffer, int* length) {
 }
 
 
-static void FillDigits64FixedLength(uint64_t number, int requested_length,
+static void FillDigits64FixedLength(uint64_t number,
                                     Vector<char> buffer, int* length) {
   const uint32_t kTen7 = 10000000;
   // For efficiency cut the number into 3 uint32_t parts, and print those.
@@ -253,7 +253,8 @@ static void FillFractionals(uint64_t fractionals, int exponent,
       fractionals *= 5;
       point--;
       int digit = static_cast<int>(fractionals >> point);
-      buffer[*length] = '0' + digit;
+      ASSERT(digit <= 9);
+      buffer[*length] = static_cast<char>('0' + digit);
       (*length)++;
       fractionals -= static_cast<uint64_t>(digit) << point;
     }
@@ -274,7 +275,8 @@ static void FillFractionals(uint64_t fractionals, int exponent,
       fractionals128.Multiply(5);
       point--;
       int digit = fractionals128.DivModPowerOf2(point);
-      buffer[*length] = '0' + digit;
+      ASSERT(digit <= 9);
+      buffer[*length] = static_cast<char>('0' + digit);
       (*length)++;
     }
     if (fractionals128.BitAt(point - 1) == 1) {
@@ -358,7 +360,7 @@ bool FastFixedDtoa(double v,
       remainder = (dividend % divisor) << exponent;
     }
     FillDigits32(quotient, buffer, length);
-    FillDigits64FixedLength(remainder, divisor_power, buffer, length);
+    FillDigits64FixedLength(remainder, buffer, length);
     *decimal_point = *length;
   } else if (exponent >= 0) {
     // 0 <= exponent <= 11

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/fixed-dtoa.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/fixed-dtoa.h b/c_src/double-conversion/fixed-dtoa.h
index 3bdd08e..43de94e 100644
--- a/c_src/double-conversion/fixed-dtoa.h
+++ b/c_src/double-conversion/fixed-dtoa.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_FIXED_DTOA_H_
 #define DOUBLE_CONVERSION_FIXED_DTOA_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/ieee.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/ieee.h b/c_src/double-conversion/ieee.h
index 839dc47..661141d 100644
--- a/c_src/double-conversion/ieee.h
+++ b/c_src/double-conversion/ieee.h
@@ -256,6 +256,8 @@ class Double {
     return (significand & kSignificandMask) |
         (biased_exponent << kPhysicalSignificandSize);
   }
+
+  DISALLOW_COPY_AND_ASSIGN(Double);
 };
 
 class Single {
@@ -391,6 +393,8 @@ class Single {
   static const uint32_t kNaN = 0x7FC00000;
 
   const uint32_t d32_;
+
+  DISALLOW_COPY_AND_ASSIGN(Single);
 };
 
 }  // namespace double_conversion

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/strtod.cc
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/strtod.cc b/c_src/double-conversion/strtod.cc
index 9758989..17abcbb 100644
--- a/c_src/double-conversion/strtod.cc
+++ b/c_src/double-conversion/strtod.cc
@@ -137,6 +137,7 @@ static void TrimAndCut(Vector<const char> buffer, int exponent,
   Vector<const char> right_trimmed = TrimTrailingZeros(left_trimmed);
   exponent += left_trimmed.length() - right_trimmed.length();
   if (right_trimmed.length() > kMaxSignificantDecimalDigits) {
+    (void) space_size;  // Mark variable as used.
     ASSERT(space_size >= kMaxSignificantDecimalDigits);
     CutToMaxSignificantDigits(right_trimmed, exponent,
                               buffer_copy_space, updated_exponent);
@@ -263,7 +264,6 @@ static DiyFp AdjustmentPowerOfTen(int exponent) {
     case 7: return DiyFp(UINT64_2PART_C(0x98968000, 00000000), -40);
     default:
       UNREACHABLE();
-      return DiyFp(0, 0);
   }
 }
 
@@ -286,7 +286,7 @@ static bool DiyFpStrtod(Vector<const char> buffer,
   const int kDenominator = 1 << kDenominatorLog;
   // Move the remaining decimals into the exponent.
   exponent += remaining_decimals;
-  int error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
+  uint64_t error = (remaining_decimals == 0 ? 0 : kDenominator / 2);
 
   int old_e = input.e();
   input.Normalize();
@@ -515,6 +515,7 @@ float Strtof(Vector<const char> buffer, int exponent) {
     double double_next2 = Double(double_next).NextDouble();
     f4 = static_cast<float>(double_next2);
   }
+  (void) f2;  // Mark variable as used.
   ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
 
   // If the guess doesn't lie near a single-precision boundary we can simply

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/strtod.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/strtod.h b/c_src/double-conversion/strtod.h
index ed0293b..00cf8a7 100644
--- a/c_src/double-conversion/strtod.h
+++ b/c_src/double-conversion/strtod.h
@@ -28,7 +28,7 @@
 #ifndef DOUBLE_CONVERSION_STRTOD_H_
 #define DOUBLE_CONVERSION_STRTOD_H_
 
-#include "utils.h"
+#include "double-conversion/utils.h"
 
 namespace double_conversion {
 

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5d6b2651/c_src/double-conversion/utils.h
----------------------------------------------------------------------
diff --git a/c_src/double-conversion/utils.h b/c_src/double-conversion/utils.h
index 9ebb9ee..ce41e62 100644
--- a/c_src/double-conversion/utils.h
+++ b/c_src/double-conversion/utils.h
@@ -33,7 +33,8 @@
 
 #include <assert.h>
 #ifndef ASSERT
-#define ASSERT(condition)      (assert(condition))
+#define ASSERT(condition)         \
+    assert(condition);
 #endif
 #ifndef UNIMPLEMENTED
 #define UNIMPLEMENTED() (abort())
@@ -55,11 +56,16 @@
 #if defined(_M_X64) || defined(__x86_64__) || \
     defined(__ARMEL__) || defined(__avr32__) || \
     defined(__hppa__) || defined(__ia64__) || \
-    defined(__mips__) || defined(__powerpc__) || \
+    defined(__mips__) || \
+    defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \
+    defined(_POWER) || defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
     defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
     defined(__SH4__) || defined(__alpha__) || \
-    defined(_MIPS_ARCH_MIPS32R2)
+    defined(_MIPS_ARCH_MIPS32R2) || \
+    defined(__AARCH64EL__) || defined(__aarch64__)
 #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+#elif defined(__mc68000__)
+#undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
 #if defined(_WIN32)
 // Windows uses a 64bit wide floating point stack.
@@ -71,6 +77,11 @@
 #error Target architecture was not detected as supported by Double-Conversion.
 #endif
 
+#if defined(__GNUC__)
+#define DOUBLE_CONVERSION_UNUSED __attribute__((unused))
+#else
+#define DOUBLE_CONVERSION_UNUSED
+#endif
 
 #if defined(_WIN32) && !defined(__MINGW32__)
 
@@ -90,6 +101,8 @@ typedef unsigned __int64 uint64_t;
 
 #endif
 
+typedef uint16_t uc16;
+
 // The following macro works on both 32 and 64-bit platforms.
 // Usage: instead of writing 0x1234567890123456
 //      write UINT64_2PART_C(0x12345678,90123456);
@@ -155,8 +168,8 @@ template <typename T>
 class Vector {
  public:
   Vector() : start_(NULL), length_(0) {}
-  Vector(T* data, int length) : start_(data), length_(length) {
-    ASSERT(length == 0 || (length > 0 && data != NULL));
+  Vector(T* data, int len) : start_(data), length_(len) {
+    ASSERT(len == 0 || (len > 0 && data != NULL));
   }
 
   // Returns a vector using the same backing storage as this one,
@@ -198,8 +211,8 @@ class Vector {
 // buffer bounds on all operations in debug mode.
 class StringBuilder {
  public:
-  StringBuilder(char* buffer, int size)
-      : buffer_(buffer, size), position_(0) { }
+  StringBuilder(char* buffer, int buffer_size)
+      : buffer_(buffer, buffer_size), position_(0) { }
 
   ~StringBuilder() { if (!is_finalized()) Finalize(); }
 
@@ -292,24 +305,12 @@ class StringBuilder {
 // you can use BitCast to cast one pointer type to another.  This confuses gcc
 // enough that it can no longer see that you have cast one pointer type to
 // another thus avoiding the warning.
-//
-// Adding an unused attribute for this static check. Apparently GCC 4.8
-// now throws an error for unused typedefs which triggers -Werror.
-//
-// PJD: 4-24-2013
-//
-
-#if defined(__GNUC__)
-#define UNUSED __attribute__((unused))
-#else
-#define UNUSED
-#endif
-
 template <class Dest, class Source>
 inline Dest BitCast(const Source& source) {
   // Compile time assertion: sizeof(Dest) == sizeof(Source)
   // A compile error here means your Dest and Source have different sizes.
-  UNUSED typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+  DOUBLE_CONVERSION_UNUSED
+      typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
 
   Dest dest;
   memmove(&dest, &source, sizeof(dest));


[35/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge pull request #93 from ratelle/master

Add replace_undefined and escape_forward_slashes

Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/b403e4ab
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/b403e4ab
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/b403e4ab

Branch: refs/heads/master
Commit: b403e4ab5b8f64ee1b62a9e23453e3ad522d6ba2
Parents: 446e284 1784ca2
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:18:30 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:18:30 2015 -0500

----------------------------------------------------------------------
 c_src/decoder.c                 | 10 ++++++----
 c_src/encoder.c                 | 17 +++++++++++++++++
 c_src/jiffy.c                   |  2 ++
 c_src/jiffy.h                   |  3 +++
 c_src/util.c                    | 28 ++++++++++++++++++++++++++++
 test/jiffy_02_literal_tests.erl | 11 +++++++++++
 test/jiffy_04_string_tests.erl  | 14 +++++++++++++-
 7 files changed, 80 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[45/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Fix dialyzer type specs


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/a32a12f8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/a32a12f8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/a32a12f8

Branch: refs/heads/master
Commit: a32a12f8b5262a975084ccf918390c650b0b4aff
Parents: 454928f
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 18:43:06 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 18:43:06 2015 -0500

----------------------------------------------------------------------
 src/jiffy.erl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/a32a12f8/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index 9edaa3a..6fc0fa3 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -23,7 +23,7 @@
 -type json_number() :: integer() | float().
 -type json_object() :: {[{json_string(),json_value()}]}.
 
--type decode_result() :: json_value()
+-type jiffy_decode_result() :: json_value()
                         | {has_trailer, json_value(), binary()}.
 
 -type decode_option() :: return_maps
@@ -37,7 +37,7 @@
                         | pretty
                         | force_utf8
                         | escape_forward_slashes
-                        | {bytes_per_iter, non_neg_integer()},
+                        | {bytes_per_iter, non_neg_integer()}
                         | {bytes_per_red, non_neg_integer()}.
 
 -type decode_options() :: [decode_option()].


[16/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Disable strict aliasing

This is motivated by issue #60 to see if we can get away with `-O3`
while still handling the cast of a `Decoder**` to `void**`.

Fixes #60


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/307c3838
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/307c3838
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/307c3838

Branch: refs/heads/master
Commit: 307c3838214bdf78afcfc2becbf65229daa99cd8
Parents: b3ef636
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Jun 17 14:48:40 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Jun 17 14:48:40 2014 -0500

----------------------------------------------------------------------
 rebar.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/307c3838/rebar.config
----------------------------------------------------------------------
diff --git a/rebar.config b/rebar.config
index 910433c..e805dba 100644
--- a/rebar.config
+++ b/rebar.config
@@ -7,7 +7,7 @@
 ]}.
 
 {port_env, [
-    {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -O3"},
+    {".*", "CFLAGS", "$CFLAGS -g -Wall -Werror -O3 -fno-strict-aliasing"},
     {".*", "CXXFLAGS", "$CXXFLAGS -g -Wall -Werror -O3"},
 
     {"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin)",


[06/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Enable Travis-CI builds


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/4774f72d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/4774f72d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/4774f72d

Branch: refs/heads/master
Commit: 4774f72d557c7c76355513e799e6e95eea496d50
Parents: 11ab973
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 16 21:06:22 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Mon Jun 16 21:06:22 2014 -0500

----------------------------------------------------------------------
 .travis.yml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/4774f72d/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2d661f6
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,14 @@
+language: erlang
+notifications:
+  email: paul.joseph.davis@gmail.com
+otp_release:
+   - 17.0
+   - R16B03-1
+   - R16B02
+   - R16B01
+   - R15B03
+   - R15B02
+   - R15B01
+   - R14B04
+   - R14B03
+   - R14B02


[20/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Tweak the nil encoding logic

I must've managed to miss the PR update from Stanislav the other day
when merging this.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/5eb499d7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/5eb499d7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/5eb499d7

Branch: refs/heads/master
Commit: 5eb499d73e52be6518b9e3e705be220788529ede
Parents: 2dbf89f
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sat Aug 23 05:49:12 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sat Aug 23 05:50:21 2014 -0500

----------------------------------------------------------------------
 c_src/encoder.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5eb499d7/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index b6ea141..992b5d5 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -713,11 +713,15 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             stack = enif_make_list_cell(env, e->atoms->ref_array, stack);
             stack = enif_make_list_cell(env, item, stack);
         } else if(enif_compare(curr, e->atoms->atom_null) == 0 
-                    || (e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0)) {
             if(!enc_literal(e, "null", 4)) {
                 ret = enc_error(e, "null");
                 goto done;
-            }        
+            }
+        } else if(e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0)) {
+            if(!enc_literal(e, "null", 4)) {
+                ret = enc_error(e, "null");
+                goto done;
+            }
         } else if(enif_compare(curr, e->atoms->atom_true) == 0) {
             if(!enc_literal(e, "true", 4)) {
                 ret = enc_error(e, "true");


[29/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
update README.md fixing typo in maps example

Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/5337135b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/5337135b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/5337135b

Branch: refs/heads/master
Commit: 5337135b8313293927349fea0b14433f8337c0e8
Parents: 801f9e7
Author: Feiko Nanninga <ad...@clonejo.de>
Authored: Fri Apr 24 16:15:05 2015 +0200
Committer: Feiko Nanninga <ad...@clonejo.de>
Committed: Fri Apr 24 16:15:05 2015 +0200

----------------------------------------------------------------------
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/5337135b/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index a609b77..13bc42e 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ Data Format
     {[]}                       -> {}             -> {[]}
     {[{foo, bar}]}             -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]}
     {[{<<"foo">>, <<"bar">>}]} -> {"foo": "bar"} -> {[{<<"foo">>, <<"bar">>}]}
-    #{<<"foo">> => <<"bar">>}  -> {"foo": "bar"} -> #{<<"foo">> -> <<"bar">>}
+    #{<<"foo">> => <<"bar">>}  -> {"foo": "bar"} -> #{<<"foo">> => <<"bar">>}
 
 N.B. The last entry in this table is only valid for VM's that support
 the `maps` data type (i.e., 17.0 and newer) and client code must pass


[41/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Merge pull request #65 from lpgauth/no_native

Add compile option no_native

Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/2c394028
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/2c394028
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/2c394028

Branch: refs/heads/master
Commit: 2c394028691ad6cd60cf5bd7faa14c645ff27381
Parents: e371ec1 79f1dd1
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Jul 15 15:49:37 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Jul 15 15:49:37 2015 -0500

----------------------------------------------------------------------
 src/jiffy.erl | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/2c394028/src/jiffy.erl
----------------------------------------------------------------------


[26/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Account for char possibly being unsigned

This sounds rather insane to me but I've managed to show that `(char)
-1` is converted to 255 on some platforms. This was reproduced on
ppc64el via Qemu on OS X. A simple program that does `fprintf(stderr,
"%d\r\n", (char) -1);` prints 255 to the console. Rather than rely on
the signedness of a char I've just updated things to use an unsigned
char (which hopefully is never signed) and replaced -1 with 255 for the
sentinel value when converting hex values.

Thanks to Balint Reczey (@rbalint) for the report.

Fixes #74


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/137d3d94
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/137d3d94
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/137d3d94

Branch: refs/heads/master
Commit: 137d3d94b6ee10001d761d412cbbe7f665680c98
Parents: b0fc299
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Nov 12 18:46:06 2014 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Nov 12 19:19:27 2014 -0600

----------------------------------------------------------------------
 c_src/utf8.c | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/137d3d94/c_src/utf8.c
----------------------------------------------------------------------
diff --git a/c_src/utf8.c b/c_src/utf8.c
index e251bc6..cd0c717 100644
--- a/c_src/utf8.c
+++ b/c_src/utf8.c
@@ -3,15 +3,23 @@
 #include "jiffy.h"
 #include <stdio.h>
 
-static const char hexvals[256] = {
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
+static const unsigned char hexvals[256] = {
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+      0,   1,   2,   3,   4,   5,   6,   7,
+      8,   9, 255, 255, 255, 255, 255, 255,
+    255,  10,  11,  12,  13,  14,  15, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255,  10,  11,  12,  13,  14,  15, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255,
+    255, 255, 255, 255, 255, 255, 255, 255
 };
 
 static const char hexdigits[16] = {
@@ -27,10 +35,10 @@ int_from_hex(const unsigned char* p)
     unsigned char* h = (unsigned char*) p;
     int ret;
 
-    if(hexvals[*(h+0)] < 0) return -1;
-    if(hexvals[*(h+1)] < 0) return -1;
-    if(hexvals[*(h+2)] < 0) return -1;
-    if(hexvals[*(h+3)] < 0) return -1;
+    if(hexvals[*(h+0)] == 255) return -1;
+    if(hexvals[*(h+1)] == 255) return -1;
+    if(hexvals[*(h+2)] == 255) return -1;
+    if(hexvals[*(h+3)] == 255) return -1;
 
     ret = (hexvals[*(h+0)] << 12)
         + (hexvals[*(h+1)] << 8)


[15/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Be explicit on the stdlib dependency


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/b3ef636a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/b3ef636a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/b3ef636a

Branch: refs/heads/master
Commit: b3ef636af2c7a42e9f8ae28d5cdbe67b104ab184
Parents: 03f2b30
Author: Paul J. Davis <pa...@gmail.com>
Authored: Tue Jun 17 02:58:27 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Jun 17 02:58:27 2014 -0500

----------------------------------------------------------------------
 src/jiffy.app.src | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/b3ef636a/src/jiffy.app.src
----------------------------------------------------------------------
diff --git a/src/jiffy.app.src b/src/jiffy.app.src
index 4ea304a..6f49231 100644
--- a/src/jiffy.app.src
+++ b/src/jiffy.app.src
@@ -2,5 +2,5 @@
     {description, "JSON Decoder/Encoder."},
     {vsn, git},
     {registered, []},
-    {applications, [kernel]}
+    {applications, [kernel, stdlib]}
 ]}.


[19/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Improved Elixir compatibility

This implements the `use_nil` option as discussed on issue #64. Passing
the atom `use_nil` as an option to both encode and decode will replace
the atom `null` with `nil` when decoding and encode `nil` as `null` when
encoding values.

Fixes #64
Fixes #68


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/2dbf89f5
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/2dbf89f5
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/2dbf89f5

Branch: refs/heads/master
Commit: 2dbf89f51c547914e994f51457140df9e9a1ca83
Parents: 99867af
Author: Stanislav Vishnevskiy <vi...@gmail.com>
Authored: Tue Aug 19 11:44:49 2014 -0700
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Aug 19 14:48:50 2014 -0500

----------------------------------------------------------------------
 c_src/decoder.c                 | 6 +++++-
 c_src/encoder.c                 | 9 +++++++--
 c_src/jiffy.c                   | 2 ++
 c_src/jiffy.h                   | 2 ++
 test/jiffy_02_literal_tests.erl | 6 ++++++
 5 files changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/2dbf89f5/c_src/decoder.c
----------------------------------------------------------------------
diff --git a/c_src/decoder.c b/c_src/decoder.c
index 7cc74bd..e7dc48b 100644
--- a/c_src/decoder.c
+++ b/c_src/decoder.c
@@ -52,6 +52,7 @@ typedef struct {
     size_t          bytes_per_iter;
     int             is_partial;
     int             return_maps;
+    int             use_nil;
 
     char*           p;
     unsigned char*  u;
@@ -79,6 +80,7 @@ dec_new(ErlNifEnv* env)
     d->bytes_per_iter = DEFAULT_BYTES_PER_ITER;
     d->is_partial = 0;
     d->return_maps = 0;
+    d->use_nil = 0;
 
     d->p = NULL;
     d->u = NULL;
@@ -707,6 +709,8 @@ decode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
 #else
             return enif_make_badarg(env);
 #endif
+        } else if(enif_compare(val, d->atoms->atom_use_nil) == 0) {
+            d->use_nil = 1;
         } else {
             return enif_make_badarg(env);
         }
@@ -777,7 +781,7 @@ decode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
                             ret = dec_error(d, "invalid_literal");
                             goto done;
                         }
-                        val = d->atoms->atom_null;
+                        val = d->use_nil ? d->atoms->atom_nil : d->atoms->atom_null;
                         dec_pop(d, st_value);
                         d->i += 4;
                         break;

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/2dbf89f5/c_src/encoder.c
----------------------------------------------------------------------
diff --git a/c_src/encoder.c b/c_src/encoder.c
index fff9752..b6ea141 100644
--- a/c_src/encoder.c
+++ b/c_src/encoder.c
@@ -33,6 +33,7 @@ typedef struct {
 
     int             uescape;
     int             pretty;
+    int             use_nil;
 
     int             shiftcnt;
     int             count;
@@ -75,6 +76,7 @@ enc_new(ErlNifEnv* env)
     e->bytes_per_iter = DEFAULT_BYTES_PER_ITER;
     e->uescape = 0;
     e->pretty = 0;
+    e->use_nil = 0;
     e->shiftcnt = 0;
     e->count = 0;
 
@@ -578,6 +580,8 @@ encode_init(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             e->uescape = 1;
         } else if(enif_compare(val, e->atoms->atom_pretty) == 0) {
             e->pretty = 1;
+        } else if(enif_compare(val, e->atoms->atom_use_nil) == 0) {
+            e->use_nil = 1;
         } else if(enif_compare(val, e->atoms->atom_force_utf8) == 0) {
             // Ignore, handled in Erlang
         } else if(get_bytes_per_iter(env, val, &(e->bytes_per_iter))) {
@@ -708,11 +712,12 @@ encode_iter(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
             stack = enif_make_list_cell(env, curr, stack);
             stack = enif_make_list_cell(env, e->atoms->ref_array, stack);
             stack = enif_make_list_cell(env, item, stack);
-        } else if(enif_compare(curr, e->atoms->atom_null) == 0) {
+        } else if(enif_compare(curr, e->atoms->atom_null) == 0 
+                    || (e->use_nil && enif_compare(curr, e->atoms->atom_nil) == 0)) {
             if(!enc_literal(e, "null", 4)) {
                 ret = enc_error(e, "null");
                 goto done;
-            }
+            }        
         } else if(enif_compare(curr, e->atoms->atom_true) == 0) {
             if(!enc_literal(e, "true", 4)) {
                 ret = enc_error(e, "true");

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/2dbf89f5/c_src/jiffy.c
----------------------------------------------------------------------
diff --git a/c_src/jiffy.c b/c_src/jiffy.c
index b3b4ba4..205de91 100644
--- a/c_src/jiffy.c
+++ b/c_src/jiffy.c
@@ -26,6 +26,8 @@ load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
     st->atom_iter = make_atom(env, "iter");
     st->atom_bytes_per_iter = make_atom(env, "bytes_per_iter");
     st->atom_return_maps = make_atom(env, "return_maps");
+    st->atom_nil = make_atom(env, "nil");
+    st->atom_use_nil = make_atom(env, "use_nil");
 
     // Markers used in encoding
     st->ref_object = make_atom(env, "$object_ref$");

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/2dbf89f5/c_src/jiffy.h
----------------------------------------------------------------------
diff --git a/c_src/jiffy.h b/c_src/jiffy.h
index 90f364c..34dff75 100644
--- a/c_src/jiffy.h
+++ b/c_src/jiffy.h
@@ -28,6 +28,8 @@ typedef struct {
     ERL_NIF_TERM    atom_iter;
     ERL_NIF_TERM    atom_bytes_per_iter;
     ERL_NIF_TERM    atom_return_maps;
+    ERL_NIF_TERM    atom_nil;
+    ERL_NIF_TERM    atom_use_nil;
 
     ERL_NIF_TERM    ref_object;
     ERL_NIF_TERM    ref_array;

http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/2dbf89f5/test/jiffy_02_literal_tests.erl
----------------------------------------------------------------------
diff --git a/test/jiffy_02_literal_tests.erl b/test/jiffy_02_literal_tests.erl
index 4c50a34..a5ff576 100644
--- a/test/jiffy_02_literal_tests.erl
+++ b/test/jiffy_02_literal_tests.erl
@@ -26,3 +26,9 @@ null_test_() ->
         {"Decode", ?_assertEqual(null, jiffy:decode(<<"null">>))},
         {"Encode", ?_assertEqual(<<"null">>, jiffy:encode(null))}
     ]}.
+
+nil_test_() ->
+    {"null", [
+        {"Decode", ?_assertEqual(nil, jiffy:decode(<<"null">>, [use_nil]))},
+        {"Encode", ?_assertEqual(<<"null">>, jiffy:encode(nil, [use_nil]))}
+    ]}.


[04/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/11ab9738/test/009-reg-issue-24.t
----------------------------------------------------------------------
diff --git a/test/009-reg-issue-24.t b/test/009-reg-issue-24.t
deleted file mode 100755
index 8c50247..0000000
--- a/test/009-reg-issue-24.t
+++ /dev/null
@@ -1,3459 +0,0 @@
-#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
-% See the LICENSE file for more information.
-
-main([]) ->
-    code:add_pathz("ebin"),
-    code:add_pathz("test"),
-
-    etap:plan(1),
-    jiffy:encode(big_doc(), [uescape]),
-    etap:is(1, 1, "No segfault encoding large doc with uescapes."),
-    etap:end_tests().
-
-
-big_doc() ->
-    {[{<<"_id">>,<<"_design/bookmarks">>},
-      {<<"_rev">>,<<"1-1794a8236590d2fc6c288115dc539a3d">>},
-      {<<"lib">>,
-       {[{<<"app">>,
-          <<"\nmodule.exports = {\n\n    views: require('./views'),\n    shows : require('./shows'),\n    rewrites: require('./rewrites'),\n    updates: require('./updates')\n};\n\n// Bind event handlers\n// require('./events')\n">>},
-         {<<"rewrites">>,
-          <<"/**\n * Rewrite settings to be exported from the design doc\n */\n\nmodule.exports = [\n    {from: '/static/*', to: 'static/*'},\n    {from: '/bootstrap/*', to: 'bootstrap/*'},\n    {from: '/modules.js', to: 'modules.js' },\n    {\"from\": \"/_db/*\", \"to\": \"../../*\" },\n    {\"from\": \"/_db\", \"to\": \"../..\" },\n    {\"from\": \"/bookmark_lite\", \"to\" : \"_show/bookmark_lite\"},\n    {\"from\": \"/bookmark\", \"to\" : \"_show/bookmark\"},\n    {\"from\": \"/save\", \"to\" : \"_update/bookmark\"},\n    {\"from\": \"/click/*\", \"to\" : \"_update/click/*\"},\n    {\"from\": \"/archive/*\", \"to\" : \"_update/archive/*\"},\n    {from: '/', to: 'index.html'}\n];">>},
-         {<<"shows">>,
-          <<"var templates = require('handlebars').templates;\n\nexports.bookmark_lite = function(doc, req) {\n\n    return {\n        code: 200,\n        headers: {'content-type' : 'text/html'},\n        body: templates['newBookmark.html']({\n            title : req.query.title,\n            url  : req.query.url\n        })\n    };\n\n}\n\nexports.bookmark = function(doc, req) {\n    return {\n        code: 200,\n        headers: {'content-type' : 'text/html'},\n        body: '<h2>Hellp</h2>'\n    };\n}\n\n">>},
-         {<<"updates">>,
-          <<"\nvar md5 = require('md5');\nvar querystring = require('querystring');\n\nexports.bookmark = function(doc, req) {\n\n    var details = {};\n    if (req.body && req.body.length > 0) {\n        details = querystring.parse(req.body);\n    }\n    if (req.query.title) details.title = req.query.title;\n    if (req.query.url)   details.url = req.query.url;\n\n    if (!doc) {\n        var id = md5.hex(details.url);\n        var doc = {\n            _id : id,\n            type: 'com.eckoit.bookmark',\n            title : decodeURIComponent(details.title),\n            url : decodeURIComponent(details.url),\n            timestamp: new Date().getTime()\n        };\n        if (details.short_text) doc.short_text = details.short_text;\n        log(doc);\n        return [doc, 'SUCCESS']\n\n    } else {\n\n    }\n}\n\nexports.click = function(doc, req) {\n    if (!doc.clicks) doc.clicks = 0;\n    doc.clicks++;\n    return [doc, 'SUCCESS'];\n}\n\nexports.archive = function(doc, req) {\
 n    doc.archive = true;\n    return [doc, 'SUCCESS'];\n}">>},
-         {<<"views">>,
-          <<"\n\nexports.by_date = {\n    map : function(doc) {\n\n        if (doc.archive) return;\n\n        if (doc.type && doc.type === 'com.eckoit.bookmark' ) {\n            var timestamp = doc.timestamp;\n            if (!timestamp) timestamp = new Date(0);\n            emit(timestamp, null);\n        }\n    }\n}\n\nexports.by_views = {\n    map : function(doc) {\n\n        if (doc.archive) return;\n\n        if (doc.type && doc.type === 'com.eckoit.bookmark' ) {\n            var clicks = doc.clicks;\n            if (!clicks) clicks = 0;\n\n            var timestamp = doc.timestamp;\n            if (!timestamp) timestamp = new Date(0);\n\n            emit([clicks, timestamp], null);\n        }\n    }\n}\n\nexports.all_tags = {\n    map : function(doc) {\n        if (doc.type && doc.type == 'garden.tag') {\n            emit(doc.hash, null);\n        }\n    }\n}\n">>}]}},
-      {<<"underscore">>,
-       <<"//     Underscore.js 1.3.1\n//     (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.\n//     Underscore is freely distributable under the MIT license.\n//     Portions of Underscore are inspired or borrowed from Prototype,\n//     Oliver Steele's Functional, and John Resig's Micro-Templating.\n//     For all details and documentation:\n//     http://documentcloud.github.com/underscore\n\n(function() {\n\n  // Baseline setup\n  // --------------\n\n  // Establish the root object, `window` in the browser, or `global` on the server.\n  var root = this;\n\n  // Save the previous value of the `_` variable.\n  var previousUnderscore = root._;\n\n  // Establish the object that gets returned to break out of a loop iteration.\n  var breaker = {};\n\n  // Save bytes in the minified (but not gzipped) version:\n  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;\n\n  // Create quick reference variables for speed access to core prototypes.\n
   var slice            = ArrayProto.slice,\n      unshift          = ArrayProto.unshift,\n      toString         = ObjProto.toString,\n      hasOwnProperty   = ObjProto.hasOwnProperty;\n\n  // All **ECMAScript 5** native function implementations that we hope to use\n  // are declared here.\n  var\n    nativeForEach      = ArrayProto.forEach,\n    nativeMap          = ArrayProto.map,\n    nativeReduce       = ArrayProto.reduce,\n    nativeReduceRight  = ArrayProto.reduceRight,\n    nativeFilter       = ArrayProto.filter,\n    nativeEvery        = ArrayProto.every,\n    nativeSome         = ArrayProto.some,\n    nativeIndexOf      = ArrayProto.indexOf,\n    nativeLastIndexOf  = ArrayProto.lastIndexOf,\n    nativeIsArray      = Array.isArray,\n    nativeKeys         = Object.keys,\n    nativeBind         = FuncProto.bind;\n\n  // Create a safe reference to the Underscore object for use below.\n  var _ = function(obj) { return new wrapper(obj); };\n\n  // Export the Underscore object fo
 r **Node.js**, with\n  // backwards-compatibility for the old `require()` API. If we're in\n  // the browser, add `_` as a global object via a string identifier,\n  // for Closure Compiler \"advanced\" mode.\n  if (typeof exports !== 'undefined') {\n    if (typeof module !== 'undefined' && module.exports) {\n      exports = module.exports = _;\n    }\n    exports._ = _;\n  } else {\n    root['_'] = _;\n  }\n\n  // Current version.\n  _.VERSION = '1.3.1';\n\n  // Collection Functions\n  // --------------------\n\n  // The cornerstone, an `each` implementation, aka `forEach`.\n  // Handles objects with the built-in `forEach`, arrays, and raw objects.\n  // Delegates to **ECMAScript 5**'s native `forEach` if available.\n  var each = _.each = _.forEach = function(obj, iterator, context) {\n    if (obj == null) return;\n    if (nativeForEach && obj.forEach === nativeForEach) {\n      obj.forEach(iterator, context);\n    } else if (obj.length === +obj.length) {\n      for (var i = 0, l = 
 obj.length; i < l; i++) {\n        if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;\n      }\n    } else {\n      for (var key in obj) {\n        if (_.has(obj, key)) {\n          if (iterator.call(context, obj[key], key, obj) === breaker) return;\n        }\n      }\n    }\n  };\n\n  // Return the results of applying the iterator to each element.\n  // Delegates to **ECMAScript 5**'s native `map` if available.\n  _.map = _.collect = function(obj, iterator, context) {\n    var results = [];\n    if (obj == null) return results;\n    if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n    each(obj, function(value, index, list) {\n      results[results.length] = iterator.call(context, value, index, list);\n    });\n    if (obj.length === +obj.length) results.length = obj.length;\n    return results;\n  };\n\n  // **Reduce** builds up a single result from a list of values, aka `inject`,\n  // or `foldl`. Delegates to **ECMAScript 5**'s
  native `reduce` if available.\n  _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {\n    var initial = arguments.length > 2;\n    if (obj == null) obj = [];\n    if (nativeReduce && obj.reduce === nativeReduce) {\n      if (context) iterator = _.bind(iterator, context);\n      return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);\n    }\n    each(obj, function(value, index, list) {\n      if (!initial) {\n        memo = value;\n        initial = true;\n      } else {\n        memo = iterator.call(context, memo, value, index, list);\n      }\n    });\n    if (!initial) throw new TypeError('Reduce of empty array with no initial value');\n    return memo;\n  };\n\n  // The right-associative version of reduce, also known as `foldr`.\n  // Delegates to **ECMAScript 5**'s native `reduceRight` if available.\n  _.reduceRight = _.foldr = function(obj, iterator, memo, context) {\n    var initial = arguments.length > 2;\n    if (obj == null) obj = [];\n    
 if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {\n      if (context) iterator = _.bind(iterator, context);\n      return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);\n    }\n    var reversed = _.toArray(obj).reverse();\n    if (context && !initial) iterator = _.bind(iterator, context);\n    return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);\n  };\n\n  // Return the first value which passes a truth test. Aliased as `detect`.\n  _.find = _.detect = function(obj, iterator, context) {\n    var result;\n    any(obj, function(value, index, list) {\n      if (iterator.call(context, value, index, list)) {\n        result = value;\n        return true;\n      }\n    });\n    return result;\n  };\n\n  // Return all the elements that pass a truth test.\n  // Delegates to **ECMAScript 5**'s native `filter` if available.\n  // Aliased as `select`.\n  _.filter = _.select = function(obj, iterator, context) {\n    
 var results = [];\n    if (obj == null) return results;\n    if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);\n    each(obj, function(value, index, list) {\n      if (iterator.call(context, value, index, list)) results[results.length] = value;\n    });\n    return results;\n  };\n\n  // Return all the elements for which a truth test fails.\n  _.reject = function(obj, iterator, context) {\n    var results = [];\n    if (obj == null) return results;\n    each(obj, function(value, index, list) {\n      if (!iterator.call(context, value, index, list)) results[results.length] = value;\n    });\n    return results;\n  };\n\n  // Determine whether all of the elements match a truth test.\n  // Delegates to **ECMAScript 5**'s native `every` if available.\n  // Aliased as `all`.\n  _.every = _.all = function(obj, iterator, context) {\n    var result = true;\n    if (obj == null) return result;\n    if (nativeEvery && obj.every === nativeEvery) return obj.
 every(iterator, context);\n    each(obj, function(value, index, list) {\n      if (!(result = result && iterator.call(context, value, index, list))) return breaker;\n    });\n    return result;\n  };\n\n  // Determine if at least one element in the object matches a truth test.\n  // Delegates to **ECMAScript 5**'s native `some` if available.\n  // Aliased as `any`.\n  var any = _.some = _.any = function(obj, iterator, context) {\n    iterator || (iterator = _.identity);\n    var result = false;\n    if (obj == null) return result;\n    if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);\n    each(obj, function(value, index, list) {\n      if (result || (result = iterator.call(context, value, index, list))) return breaker;\n    });\n    return !!result;\n  };\n\n  // Determine if a given value is included in the array or object using `===`.\n  // Aliased as `contains`.\n  _.include = _.contains = function(obj, target) {\n    var found = false;\n    if (obj 
 == null) return found;\n    if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;\n    found = any(obj, function(value) {\n      return value === target;\n    });\n    return found;\n  };\n\n  // Invoke a method (with arguments) on every item in a collection.\n  _.invoke = function(obj, method) {\n    var args = slice.call(arguments, 2);\n    return _.map(obj, function(value) {\n      return (_.isFunction(method) ? method || value : value[method]).apply(value, args);\n    });\n  };\n\n  // Convenience version of a common use case of `map`: fetching a property.\n  _.pluck = function(obj, key) {\n    return _.map(obj, function(value){ return value[key]; });\n  };\n\n  // Return the maximum element or (element-based computation).\n  _.max = function(obj, iterator, context) {\n    if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);\n    if (!iterator && _.isEmpty(obj)) return -Infinity;\n    var result = {computed : -Infinity};\n    each(ob
 j, function(value, index, list) {\n      var computed = iterator ? iterator.call(context, value, index, list) : value;\n      computed >= result.computed && (result = {value : value, computed : computed});\n    });\n    return result.value;\n  };\n\n  // Return the minimum element (or element-based computation).\n  _.min = function(obj, iterator, context) {\n    if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);\n    if (!iterator && _.isEmpty(obj)) return Infinity;\n    var result = {computed : Infinity};\n    each(obj, function(value, index, list) {\n      var computed = iterator ? iterator.call(context, value, index, list) : value;\n      computed < result.computed && (result = {value : value, computed : computed});\n    });\n    return result.value;\n  };\n\n  // Shuffle an array.\n  _.shuffle = function(obj) {\n    var shuffled = [], rand;\n    each(obj, function(value, index, list) {\n      if (index == 0) {\n        shuffled[0] = value;\n      } else {\n      
   rand = Math.floor(Math.random() * (index + 1));\n        shuffled[index] = shuffled[rand];\n        shuffled[rand] = value;\n      }\n    });\n    return shuffled;\n  };\n\n  // Sort the object's values by a criterion produced by an iterator.\n  _.sortBy = function(obj, iterator, context) {\n    return _.pluck(_.map(obj, function(value, index, list) {\n      return {\n        value : value,\n        criteria : iterator.call(context, value, index, list)\n      };\n    }).sort(function(left, right) {\n      var a = left.criteria, b = right.criteria;\n      return a < b ? -1 : a > b ? 1 : 0;\n    }), 'value');\n  };\n\n  // Groups the object's values by a criterion. Pass either a string attribute\n  // to group by, or a function that returns the criterion.\n  _.groupBy = function(obj, val) {\n    var result = {};\n    var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };\n    each(obj, function(value, index) {\n      var key = iterator(value, index);\n      (re
 sult[key] || (result[key] = [])).push(value);\n    });\n    return result;\n  };\n\n  // Use a comparator function to figure out at what index an object should\n  // be inserted so as to maintain order. Uses binary search.\n  _.sortedIndex = function(array, obj, iterator) {\n    iterator || (iterator = _.identity);\n    var low = 0, high = array.length;\n    while (low < high) {\n      var mid = (low + high) >> 1;\n      iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;\n    }\n    return low;\n  };\n\n  // Safely convert anything iterable into a real, live array.\n  _.toArray = function(iterable) {\n    if (!iterable)                return [];\n    if (iterable.toArray)         return iterable.toArray();\n    if (_.isArray(iterable))      return slice.call(iterable);\n    if (_.isArguments(iterable))  return slice.call(iterable);\n    return _.values(iterable);\n  };\n\n  // Return the number of elements in an object.\n  _.size = function(obj) {\n    return _.toArr
 ay(obj).length;\n  };\n\n  // Array Functions\n  // ---------------\n\n  // Get the first element of an array. Passing **n** will return the first N\n  // values in the array. Aliased as `head`. The **guard** check allows it to work\n  // with `_.map`.\n  _.first = _.head = function(array, n, guard) {\n    return (n != null) && !guard ? slice.call(array, 0, n) : array[0];\n  };\n\n  // Returns everything but the last entry of the array. Especcialy useful on\n  // the arguments object. Passing **n** will return all the values in\n  // the array, excluding the last N. The **guard** check allows it to work with\n  // `_.map`.\n  _.initial = function(array, n, guard) {\n    return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));\n  };\n\n  // Get the last element of an array. Passing **n** will return the last N\n  // values in the array. The **guard** check allows it to work with `_.map`.\n  _.last = function(array, n, guard) {\n    if ((n != null) && !guard) {\n   
    return slice.call(array, Math.max(array.length - n, 0));\n    } else {\n      return array[array.length - 1];\n    }\n  };\n\n  // Returns everything but the first entry of the array. Aliased as `tail`.\n  // Especially useful on the arguments object. Passing an **index** will return\n  // the rest of the values in the array from that index onward. The **guard**\n  // check allows it to work with `_.map`.\n  _.rest = _.tail = function(array, index, guard) {\n    return slice.call(array, (index == null) || guard ? 1 : index);\n  };\n\n  // Trim out all falsy values from an array.\n  _.compact = function(array) {\n    return _.filter(array, function(value){ return !!value; });\n  };\n\n  // Return a completely flattened version of an array.\n  _.flatten = function(array, shallow) {\n    return _.reduce(array, function(memo, value) {\n      if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));\n      memo[memo.length] = value;\n      return memo;\n    }, []);
 \n  };\n\n  // Return a version of the array that does not contain the specified value(s).\n  _.without = function(array) {\n    return _.difference(array, slice.call(arguments, 1));\n  };\n\n  // Produce a duplicate-free version of the array. If the array has already\n  // been sorted, you have the option of using a faster algorithm.\n  // Aliased as `unique`.\n  _.uniq = _.unique = function(array, isSorted, iterator) {\n    var initial = iterator ? _.map(array, iterator) : array;\n    var result = [];\n    _.reduce(initial, function(memo, el, i) {\n      if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {\n        memo[memo.length] = el;\n        result[result.length] = array[i];\n      }\n      return memo;\n    }, []);\n    return result;\n  };\n\n  // Produce an array that contains the union: each distinct element from all of\n  // the passed-in arrays.\n  _.union = function() {\n    return _.uniq(_.flatten(arguments, true));\n  };\n\n  // Produce a
 n array that contains every item shared between all the\n  // passed-in arrays. (Aliased as \"intersect\" for back-compat.)\n  _.intersection = _.intersect = function(array) {\n    var rest = slice.call(arguments, 1);\n    return _.filter(_.uniq(array), function(item) {\n      return _.every(rest, function(other) {\n        return _.indexOf(other, item) >= 0;\n      });\n    });\n  };\n\n  // Take the difference between one array and a number of other arrays.\n  // Only the elements present in just the first array will remain.\n  _.difference = function(array) {\n    var rest = _.flatten(slice.call(arguments, 1));\n    return _.filter(array, function(value){ return !_.include(rest, value); });\n  };\n\n  // Zip together multiple lists into a single array -- elements that share\n  // an index go together.\n  _.zip = function() {\n    var args = slice.call(arguments);\n    var length = _.max(_.pluck(args, 'length'));\n    var results = new Array(length);\n    for (var i = 0; i < lengt
 h; i++) results[i] = _.pluck(args, \"\" + i);\n    return results;\n  };\n\n  // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),\n  // we need this function. Return the position of the first occurrence of an\n  // item in an array, or -1 if the item is not included in the array.\n  // Delegates to **ECMAScript 5**'s native `indexOf` if available.\n  // If the array is large and already in sort order, pass `true`\n  // for **isSorted** to use binary search.\n  _.indexOf = function(array, item, isSorted) {\n    if (array == null) return -1;\n    var i, l;\n    if (isSorted) {\n      i = _.sortedIndex(array, item);\n      return array[i] === item ? i : -1;\n    }\n    if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);\n    for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;\n    return -1;\n  };\n\n  // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.\n  _.lastIndexOf = f
 unction(array, item) {\n    if (array == null) return -1;\n    if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);\n    var i = array.length;\n    while (i--) if (i in array && array[i] === item) return i;\n    return -1;\n  };\n\n  // Generate an integer Array containing an arithmetic progression. A port of\n  // the native Python `range()` function. See\n  // [the Python documentation](http://docs.python.org/library/functions.html#range).\n  _.range = function(start, stop, step) {\n    if (arguments.length <= 1) {\n      stop = start || 0;\n      start = 0;\n    }\n    step = arguments[2] || 1;\n\n    var len = Math.max(Math.ceil((stop - start) / step), 0);\n    var idx = 0;\n    var range = new Array(len);\n\n    while(idx < len) {\n      range[idx++] = start;\n      start += step;\n    }\n\n    return range;\n  };\n\n  // Function (ahem) Functions\n  // ------------------\n\n  // Reusable constructor function for prototype setting.\n
   var ctor = function(){};\n\n  // Create a function bound to a given object (assigning `this`, and arguments,\n  // optionally). Binding with arguments is also known as `curry`.\n  // Delegates to **ECMAScript 5**'s native `Function.bind` if available.\n  // We check for `func.bind` first, to fail fast when `func` is undefined.\n  _.bind = function bind(func, context) {\n    var bound, args;\n    if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));\n    if (!_.isFunction(func)) throw new TypeError;\n    args = slice.call(arguments, 2);\n    return bound = function() {\n      if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));\n      ctor.prototype = func.prototype;\n      var self = new ctor;\n      var result = func.apply(self, args.concat(slice.call(arguments)));\n      if (Object(result) === result) return result;\n      return self;\n    };\n  };\n\n  // Bind all of an object's methods to 
 that object. Useful for ensuring that\n  // all callbacks defined on an object belong to it.\n  _.bindAll = function(obj) {\n    var funcs = slice.call(arguments, 1);\n    if (funcs.length == 0) funcs = _.functions(obj);\n    each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });\n    return obj;\n  };\n\n  // Memoize an expensive function by storing its results.\n  _.memoize = function(func, hasher) {\n    var memo = {};\n    hasher || (hasher = _.identity);\n    return function() {\n      var key = hasher.apply(this, arguments);\n      return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));\n    };\n  };\n\n  // Delays a function for the given number of milliseconds, and then calls\n  // it with the arguments supplied.\n  _.delay = function(func, wait) {\n    var args = slice.call(arguments, 2);\n    return setTimeout(function(){ return func.apply(func, args); }, wait);\n  };\n\n  // Defers a function, scheduling it to run after the current call stack
  has\n  // cleared.\n  _.defer = function(func) {\n    return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));\n  };\n\n  // Returns a function, that, when invoked, will only be triggered at most once\n  // during a given window of time.\n  _.throttle = function(func, wait) {\n    var context, args, timeout, throttling, more;\n    var whenDone = _.debounce(function(){ more = throttling = false; }, wait);\n    return function() {\n      context = this; args = arguments;\n      var later = function() {\n        timeout = null;\n        if (more) func.apply(context, args);\n        whenDone();\n      };\n      if (!timeout) timeout = setTimeout(later, wait);\n      if (throttling) {\n        more = true;\n      } else {\n        func.apply(context, args);\n      }\n      whenDone();\n      throttling = true;\n    };\n  };\n\n  // Returns a function, that, as long as it continues to be invoked, will not\n  // be triggered. The function will be called after it stops being ca
 lled for\n  // N milliseconds.\n  _.debounce = function(func, wait) {\n    var timeout;\n    return function() {\n      var context = this, args = arguments;\n      var later = function() {\n        timeout = null;\n        func.apply(context, args);\n      };\n      clearTimeout(timeout);\n      timeout = setTimeout(later, wait);\n    };\n  };\n\n  // Returns a function that will be executed at most one time, no matter how\n  // often you call it. Useful for lazy initialization.\n  _.once = function(func) {\n    var ran = false, memo;\n    return function() {\n      if (ran) return memo;\n      ran = true;\n      return memo = func.apply(this, arguments);\n    };\n  };\n\n  // Returns the first function passed as an argument to the second,\n  // allowing you to adjust arguments, run code before and after, and\n  // conditionally execute the original function.\n  _.wrap = function(func, wrapper) {\n    return function() {\n      var args = [func].concat(slice.call(arguments, 0));\n 
      return wrapper.apply(this, args);\n    };\n  };\n\n  // Returns a function that is the composition of a list of functions, each\n  // consuming the return value of the function that follows.\n  _.compose = function() {\n    var funcs = arguments;\n    return function() {\n      var args = arguments;\n      for (var i = funcs.length - 1; i >= 0; i--) {\n        args = [funcs[i].apply(this, args)];\n      }\n      return args[0];\n    };\n  };\n\n  // Returns a function that will only be executed after being called N times.\n  _.after = function(times, func) {\n    if (times <= 0) return func();\n    return function() {\n      if (--times < 1) { return func.apply(this, arguments); }\n    };\n  };\n\n  // Object Functions\n  // ----------------\n\n  // Retrieve the names of an object's properties.\n  // Delegates to **ECMAScript 5**'s native `Object.keys`\n  _.keys = nativeKeys || function(obj) {\n    if (obj !== Object(obj)) throw new TypeError('Invalid object');\n    var keys = 
 [];\n    for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;\n    return keys;\n  };\n\n  // Retrieve the values of an object's properties.\n  _.values = function(obj) {\n    return _.map(obj, _.identity);\n  };\n\n  // Return a sorted list of the function names available on the object.\n  // Aliased as `methods`\n  _.functions = _.methods = function(obj) {\n    var names = [];\n    for (var key in obj) {\n      if (_.isFunction(obj[key])) names.push(key);\n    }\n    return names.sort();\n  };\n\n  // Extend a given object with all the properties in passed-in object(s).\n  _.extend = function(obj) {\n    each(slice.call(arguments, 1), function(source) {\n      for (var prop in source) {\n        obj[prop] = source[prop];\n      }\n    });\n    return obj;\n  };\n\n  // Fill in a given object with default properties.\n  _.defaults = function(obj) {\n    each(slice.call(arguments, 1), function(source) {\n      for (var prop in source) {\n        if (obj[prop] == null) 
 obj[prop] = source[prop];\n      }\n    });\n    return obj;\n  };\n\n  // Create a (shallow-cloned) duplicate of an object.\n  _.clone = function(obj) {\n    if (!_.isObject(obj)) return obj;\n    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);\n  };\n\n  // Invokes interceptor with the obj, and then returns obj.\n  // The primary purpose of this method is to \"tap into\" a method chain, in\n  // order to perform operations on intermediate results within the chain.\n  _.tap = function(obj, interceptor) {\n    interceptor(obj);\n    return obj;\n  };\n\n  // Internal recursive comparison function.\n  function eq(a, b, stack) {\n    // Identical objects are equal. `0 === -0`, but they aren't identical.\n    // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.\n    if (a === b) return a !== 0 || 1 / a == 1 / b;\n    // A strict comparison is necessary because `null == undefined`.\n    if (a == null || b == null) return a === b;\n    // Unwr
 ap any wrapped objects.\n    if (a._chain) a = a._wrapped;\n    if (b._chain) b = b._wrapped;\n    // Invoke a custom `isEqual` method if one is provided.\n    if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);\n    if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);\n    // Compare `[[Class]]` names.\n    var className = toString.call(a);\n    if (className != toString.call(b)) return false;\n    switch (className) {\n      // Strings, numbers, dates, and booleans are compared by value.\n      case '[object String]':\n        // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n        // equivalent to `new String(\"5\")`.\n        return a == String(b);\n      case '[object Number]':\n        // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for\n        // other numeric values.\n        return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);\n      case '[object Date]':\n      case '[ob
 ject Boolean]':\n        // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n        // millisecond representations. Note that invalid dates with millisecond representations\n        // of `NaN` are not equivalent.\n        return +a == +b;\n      // RegExps are compared by their source patterns and flags.\n      case '[object RegExp]':\n        return a.source == b.source &&\n               a.global == b.global &&\n               a.multiline == b.multiline &&\n               a.ignoreCase == b.ignoreCase;\n    }\n    if (typeof a != 'object' || typeof b != 'object') return false;\n    // Assume equality for cyclic structures. The algorithm for detecting cyclic\n    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n    var length = stack.length;\n    while (length--) {\n      // Linear search. Performance is inversely proportional to the number of\n      // unique nested structures.\n      if (stack[length] == a) return
  true;\n    }\n    // Add the first object to the stack of traversed objects.\n    stack.push(a);\n    var size = 0, result = true;\n    // Recursively compare objects and arrays.\n    if (className == '[object Array]') {\n      // Compare array lengths to determine if a deep comparison is necessary.\n      size = a.length;\n      result = size == b.length;\n      if (result) {\n        // Deep compare the contents, ignoring non-numeric properties.\n        while (size--) {\n          // Ensure commutative equality for sparse arrays.\n          if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;\n        }\n      }\n    } else {\n      // Objects with different constructors are not equivalent.\n      if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;\n      // Deep compare objects.\n      for (var key in a) {\n        if (_.has(a, key)) {\n          // Count the expected number of properties.\n          size++;\n  
         // Deep compare each member.\n          if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;\n        }\n      }\n      // Ensure that both objects contain the same number of properties.\n      if (result) {\n        for (key in b) {\n          if (_.has(b, key) && !(size--)) break;\n        }\n        result = !size;\n      }\n    }\n    // Remove the first object from the stack of traversed objects.\n    stack.pop();\n    return result;\n  }\n\n  // Perform a deep comparison to check if two objects are equal.\n  _.isEqual = function(a, b) {\n    return eq(a, b, []);\n  };\n\n  // Is a given array, string, or object empty?\n  // An \"empty\" object has no enumerable own-properties.\n  _.isEmpty = function(obj) {\n    if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;\n    for (var key in obj) if (_.has(obj, key)) return false;\n    return true;\n  };\n\n  // Is a given value a DOM element?\n  _.isElement = function(obj) {\n    return !!(obj && obj
 .nodeType == 1);\n  };\n\n  // Is a given value an array?\n  // Delegates to ECMA5's native Array.isArray\n  _.isArray = nativeIsArray || function(obj) {\n    return toString.call(obj) == '[object Array]';\n  };\n\n  // Is a given variable an object?\n  _.isObject = function(obj) {\n    return obj === Object(obj);\n  };\n\n  // Is a given variable an arguments object?\n  _.isArguments = function(obj) {\n    return toString.call(obj) == '[object Arguments]';\n  };\n  if (!_.isArguments(arguments)) {\n    _.isArguments = function(obj) {\n      return !!(obj && _.has(obj, 'callee'));\n    };\n  }\n\n  // Is a given value a function?\n  _.isFunction = function(obj) {\n    return toString.call(obj) == '[object Function]';\n  };\n\n  // Is a given value a string?\n  _.isString = function(obj) {\n    return toString.call(obj) == '[object String]';\n  };\n\n  // Is a given value a number?\n  _.isNumber = function(obj) {\n    return toString.call(obj) == '[object Number]';\n  };\n\n  // Is t
 he given value `NaN`?\n  _.isNaN = function(obj) {\n    // `NaN` is the only value for which `===` is not reflexive.\n    return obj !== obj;\n  };\n\n  // Is a given value a boolean?\n  _.isBoolean = function(obj) {\n    return obj === true || obj === false || toString.call(obj) == '[object Boolean]';\n  };\n\n  // Is a given value a date?\n  _.isDate = function(obj) {\n    return toString.call(obj) == '[object Date]';\n  };\n\n  // Is the given value a regular expression?\n  _.isRegExp = function(obj) {\n    return toString.call(obj) == '[object RegExp]';\n  };\n\n  // Is a given value equal to null?\n  _.isNull = function(obj) {\n    return obj === null;\n  };\n\n  // Is a given variable undefined?\n  _.isUndefined = function(obj) {\n    return obj === void 0;\n  };\n\n  // Has own property?\n  _.has = function(obj, key) {\n    return hasOwnProperty.call(obj, key);\n  };\n\n  // Utility Functions\n  // -----------------\n\n  // Run Underscore.js in *noConflict* mode, returning th
 e `_` variable to its\n  // previous owner. Returns a reference to the Underscore object.\n  _.noConflict = function() {\n    root._ = previousUnderscore;\n    return this;\n  };\n\n  // Keep the identity function around for default iterators.\n  _.identity = function(value) {\n    return value;\n  };\n\n  // Run a function **n** times.\n  _.times = function (n, iterator, context) {\n    for (var i = 0; i < n; i++) iterator.call(context, i);\n  };\n\n  // Escape a string for HTML interpolation.\n  _.escape = function(string) {\n    return (''+string).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;').replace(/'/g, '&#x27;').replace(/\\//g,'&#x2F;');\n  };\n\n  // Add your own custom functions to the Underscore object, ensuring that\n  // they're correctly added to the OOP wrapper as well.\n  _.mixin = function(obj) {\n    each(_.functions(obj), function(name){\n      addToWrapper(name, _[name] = obj[name]);\n    });\n  };\n\n  // Generate a u
 nique integer id (unique within the entire client session).\n  // Useful for temporary DOM ids.\n  var idCounter = 0;\n  _.uniqueId = function(prefix) {\n    var id = idCounter++;\n    return prefix ? prefix + id : id;\n  };\n\n  // By default, Underscore uses ERB-style template delimiters, change the\n  // following template settings to use alternative delimiters.\n  _.templateSettings = {\n    evaluate    : /<%([\\s\\S]+?)%>/g,\n    interpolate : /<%=([\\s\\S]+?)%>/g,\n    escape      : /<%-([\\s\\S]+?)%>/g\n  };\n\n  // When customizing `templateSettings`, if you don't want to define an\n  // interpolation, evaluation or escaping regex, we need one that is\n  // guaranteed not to match.\n  var noMatch = /.^/;\n\n  // Within an interpolation, evaluation, or escaping, remove HTML escaping\n  // that had been previously added.\n  var unescape = function(code) {\n    return code.replace(/\\\\\\\\/g, '\\\\').replace(/\\\\'/g, \"'\");\n  };\n\n  // JavaScript micro-templating, similar 
 to John Resig's implementation.\n  // Underscore templating handles arbitrary delimiters, preserves whitespace,\n  // and correctly escapes quotes within interpolated code.\n  _.template = function(str, data) {\n    var c  = _.templateSettings;\n    var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +\n      'with(obj||{}){__p.push(\\'' +\n      str.replace(/\\\\/g, '\\\\\\\\')\n         .replace(/'/g, \"\\\\'\")\n         .replace(c.escape || noMatch, function(match, code) {\n           return \"',_.escape(\" + unescape(code) + \"),'\";\n         })\n         .replace(c.interpolate || noMatch, function(match, code) {\n           return \"',\" + unescape(code) + \",'\";\n         })\n         .replace(c.evaluate || noMatch, function(match, code) {\n           return \"');\" + unescape(code).replace(/[\\r\\n\\t]/g, ' ') + \";__p.push('\";\n         })\n         .replace(/\\r/g, '\\\\r')\n         .replace(/\\n/g, '\\\\n')\n         .replace(/\\t/g, '\\\\t')\n  
        + \"');}return __p.join('');\";\n    var func = new Function('obj', '_', tmpl);\n    if (data) return func(data, _);\n    return function(data) {\n      return func.call(this, data, _);\n    };\n  };\n\n  // Add a \"chain\" function, which will delegate to the wrapper.\n  _.chain = function(obj) {\n    return _(obj).chain();\n  };\n\n  // The OOP Wrapper\n  // ---------------\n\n  // If Underscore is called as a function, it returns a wrapped object that\n  // can be used OO-style. This wrapper holds altered versions of all the\n  // underscore functions. Wrapped objects may be chained.\n  var wrapper = function(obj) { this._wrapped = obj; };\n\n  // Expose `wrapper.prototype` as `_.prototype`\n  _.prototype = wrapper.prototype;\n\n  // Helper function to continue chaining intermediate results.\n  var result = function(obj, chain) {\n    return chain ? _(obj).chain() : obj;\n  };\n\n  // A method to easily add functions to the OOP wrapper.\n  var addToWrapper = function(name,
  func) {\n    wrapper.prototype[name] = function() {\n      var args = slice.call(arguments);\n      unshift.call(args, this._wrapped);\n      return result(func.apply(_, args), this._chain);\n    };\n  };\n\n  // Add all of the Underscore functions to the wrapper object.\n  _.mixin(_);\n\n  // Add all mutator Array functions to the wrapper.\n  each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {\n    var method = ArrayProto[name];\n    wrapper.prototype[name] = function() {\n      var wrapped = this._wrapped;\n      method.apply(wrapped, arguments);\n      var length = wrapped.length;\n      if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];\n      return result(wrapped, this._chain);\n    };\n  });\n\n  // Add all accessor Array functions to the wrapper.\n  each(['concat', 'join', 'slice'], function(name) {\n    var method = ArrayProto[name];\n    wrapper.prototype[name] = function() {\n      return result(method.apply(
 this._wrapped, arguments), this._chain);\n    };\n  });\n\n  // Start chaining a wrapped Underscore object.\n  wrapper.prototype.chain = function() {\n    this._chain = true;\n    return this;\n  };\n\n  // Extracts the result from a wrapped and chained object.\n  wrapper.prototype.value = function() {\n    return this._wrapped;\n  };\n\n}).call(this);\n">>},
-      {<<"async">>,
-       <<"/*global setTimeout: false, console: false */\n(function () {\n\n    var async = {};\n\n    // global on the server, window in the browser\n    var root = this,\n        previous_async = root.async;\n\n    if (typeof module !== 'undefined' && module.exports) {\n        module.exports = async;\n    }\n    else {\n        root.async = async;\n    }\n\n    async.noConflict = function () {\n        root.async = previous_async;\n        return async;\n    };\n\n    //// cross-browser compatiblity functions ////\n\n    var _forEach = function (arr, iterator) {\n        if (arr.forEach) {\n            return arr.forEach(iterator);\n        }\n        for (var i = 0; i < arr.length; i += 1) {\n            iterator(arr[i], i, arr);\n        }\n    };\n\n    var _map = function (arr, iterator) {\n        if (arr.map) {\n            return arr.map(iterator);\n        }\n        var results = [];\n        _forEach(arr, function (x, i, a) {\n            results.push(iterator(x, i, a));
 \n        });\n        return results;\n    };\n\n    var _reduce = function (arr, iterator, memo) {\n        if (arr.reduce) {\n            return arr.reduce(iterator, memo);\n        }\n        _forEach(arr, function (x, i, a) {\n            memo = iterator(memo, x, i, a);\n        });\n        return memo;\n    };\n\n    var _keys = function (obj) {\n        if (Object.keys) {\n            return Object.keys(obj);\n        }\n        var keys = [];\n        for (var k in obj) {\n            if (obj.hasOwnProperty(k)) {\n                keys.push(k);\n            }\n        }\n        return keys;\n    };\n\n    var _indexOf = function (arr, item) {\n        if (arr.indexOf) {\n            return arr.indexOf(item);\n        }\n        for (var i = 0; i < arr.length; i += 1) {\n            if (arr[i] === item) {\n                return i;\n            }\n        }\n        return -1;\n    };\n\n    //// exported async module functions ////\n\n    //// nextTick implementation with b
 rowser-compatible fallback ////\n    if (typeof process === 'undefined' || !(process.nextTick)) {\n        async.nextTick = function (fn) {\n            setTimeout(fn, 0);\n        };\n    }\n    else {\n        async.nextTick = process.nextTick;\n    }\n\n    async.forEach = function (arr, iterator, callback) {\n        if (!arr.length) {\n            return callback();\n        }\n        var completed = 0;\n        _forEach(arr, function (x) {\n            iterator(x, function (err) {\n                if (err) {\n                    callback(err);\n                    callback = function () {};\n                }\n                else {\n                    completed += 1;\n                    if (completed === arr.length) {\n                        callback();\n                    }\n                }\n            });\n        });\n    };\n\n    async.forEachSeries = function (arr, iterator, callback) {\n        if (!arr.length) {\n            return callback();\n        }\n    
     var completed = 0;\n        var iterate = function () {\n            iterator(arr[completed], function (err) {\n                if (err) {\n                    callback(err);\n                    callback = function () {};\n                }\n                else {\n                    completed += 1;\n                    if (completed === arr.length) {\n                        callback();\n                    }\n                    else {\n                        iterate();\n                    }\n                }\n            });\n        };\n        iterate();\n    };\n    \n    async.forEachLimit = function (arr, limit, iterator, callback) {\n        if (!arr.length || limit <= 0) {\n            return callback(); \n        }\n        var completed = 0;\n        var started = 0;\n        var running = 0;\n        \n        (function replenish () {\n          if (completed === arr.length) {\n              return callback();\n          }\n          \n          while (running 
 < limit && started < arr.length) {\n            iterator(arr[started], function (err) {\n              if (err) {\n                  callback(err);\n                  callback = function () {};\n              }\n              else {\n                  completed += 1;\n                  running -= 1;\n                  if (completed === arr.length) {\n                      callback();\n                  }\n                  else {\n                      replenish();\n                  }\n              }\n            });\n            started += 1;\n            running += 1;\n          }\n        })();\n    };\n\n\n    var doParallel = function (fn) {\n        return function () {\n            var args = Array.prototype.slice.call(arguments);\n            return fn.apply(null, [async.forEach].concat(args));\n        };\n    };\n    var doSeries = function (fn) {\n        return function () {\n            var args = Array.prototype.slice.call(arguments);\n            return fn.apply(nul
 l, [async.forEachSeries].concat(args));\n        };\n    };\n\n\n    var _asyncMap = function (eachfn, arr, iterator, callback) {\n        var results = [];\n        arr = _map(arr, function (x, i) {\n            return {index: i, value: x};\n        });\n        eachfn(arr, function (x, callback) {\n            iterator(x.value, function (err, v) {\n                results[x.index] = v;\n                callback(err);\n            });\n        }, function (err) {\n            callback(err, results);\n        });\n    };\n    async.map = doParallel(_asyncMap);\n    async.mapSeries = doSeries(_asyncMap);\n\n\n    // reduce only has a series version, as doing reduce in parallel won't\n    // work in many situations.\n    async.reduce = function (arr, memo, iterator, callback) {\n        async.forEachSeries(arr, function (x, callback) {\n            iterator(memo, x, function (err, v) {\n                memo = v;\n                callback(err);\n            });\n        }, function (er
 r) {\n            callback(err, memo);\n        });\n    };\n    // inject alias\n    async.inject = async.reduce;\n    // foldl alias\n    async.foldl = async.reduce;\n\n    async.reduceRight = function (arr, memo, iterator, callback) {\n        var reversed = _map(arr, function (x) {\n            return x;\n        }).reverse();\n        async.reduce(reversed, memo, iterator, callback);\n    };\n    // foldr alias\n    async.foldr = async.reduceRight;\n\n    var _filter = function (eachfn, arr, iterator, callback) {\n        var results = [];\n        arr = _map(arr, function (x, i) {\n            return {index: i, value: x};\n        });\n        eachfn(arr, function (x, callback) {\n            iterator(x.value, function (v) {\n                if (v) {\n                    results.push(x);\n                }\n                callback();\n            });\n        }, function (err) {\n            callback(_map(results.sort(function (a, b) {\n                return a.index - b.inde
 x;\n            }), function (x) {\n                return x.value;\n            }));\n        });\n    };\n    async.filter = doParallel(_filter);\n    async.filterSeries = doSeries(_filter);\n    // select alias\n    async.select = async.filter;\n    async.selectSeries = async.filterSeries;\n\n    var _reject = function (eachfn, arr, iterator, callback) {\n        var results = [];\n        arr = _map(arr, function (x, i) {\n            return {index: i, value: x};\n        });\n        eachfn(arr, function (x, callback) {\n            iterator(x.value, function (v) {\n                if (!v) {\n                    results.push(x);\n                }\n                callback();\n            });\n        }, function (err) {\n            callback(_map(results.sort(function (a, b) {\n                return a.index - b.index;\n            }), function (x) {\n                return x.value;\n            }));\n        });\n    };\n    async.reject = doParallel(_reject);\n    async.reje
 ctSeries = doSeries(_reject);\n\n    var _detect = function (eachfn, arr, iterator, main_callback) {\n        eachfn(arr, function (x, callback) {\n            iterator(x, function (result) {\n                if (result) {\n                    main_callback(x);\n                    main_callback = function () {};\n                }\n                else {\n                    callback();\n                }\n            });\n        }, function (err) {\n            main_callback();\n        });\n    };\n    async.detect = doParallel(_detect);\n    async.detectSeries = doSeries(_detect);\n\n    async.some = function (arr, iterator, main_callback) {\n        async.forEach(arr, function (x, callback) {\n            iterator(x, function (v) {\n                if (v) {\n                    main_callback(true);\n                    main_callback = function () {};\n                }\n                callback();\n            });\n        }, function (err) {\n            main_callback(false);
 \n        });\n    };\n    // any alias\n    async.any = async.some;\n\n    async.every = function (arr, iterator, main_callback) {\n        async.forEach(arr, function (x, callback) {\n            iterator(x, function (v) {\n                if (!v) {\n                    main_callback(false);\n                    main_callback = function () {};\n                }\n                callback();\n            });\n        }, function (err) {\n            main_callback(true);\n        });\n    };\n    // all alias\n    async.all = async.every;\n\n    async.sortBy = function (arr, iterator, callback) {\n        async.map(arr, function (x, callback) {\n            iterator(x, function (err, criteria) {\n                if (err) {\n                    callback(err);\n                }\n                else {\n                    callback(null, {value: x, criteria: criteria});\n                }\n            });\n        }, function (err, results) {\n            if (err) {\n                r
 eturn callback(err);\n            }\n            else {\n                var fn = function (left, right) {\n                    var a = left.criteria, b = right.criteria;\n                    return a < b ? -1 : a > b ? 1 : 0;\n                };\n                callback(null, _map(results.sort(fn), function (x) {\n                    return x.value;\n                }));\n            }\n        });\n    };\n\n    async.auto = function (tasks, callback) {\n        callback = callback || function () {};\n        var keys = _keys(tasks);\n        if (!keys.length) {\n            return callback(null);\n        }\n\n        var results = {};\n\n        var listeners = [];\n        var addListener = function (fn) {\n            listeners.unshift(fn);\n        };\n        var removeListener = function (fn) {\n            for (var i = 0; i < listeners.length; i += 1) {\n                if (listeners[i] === fn) {\n                    listeners.splice(i, 1);\n                    return;\n 
                }\n            }\n        };\n        var taskComplete = function () {\n            _forEach(listeners, function (fn) {\n                fn();\n            });\n        };\n\n        addListener(function () {\n            if (_keys(results).length === keys.length) {\n                callback(null, results);\n            }\n        });\n\n        _forEach(keys, function (k) {\n            var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k];\n            var taskCallback = function (err) {\n                if (err) {\n                    callback(err);\n                    // stop subsequent errors hitting callback multiple times\n                    callback = function () {};\n                }\n                else {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    if (args.length <= 1) {\n                        args = args[0];\n                    }\n                    results[k] = args;\n                  
   taskComplete();\n                }\n            };\n            var requires = task.slice(0, Math.abs(task.length - 1)) || [];\n            var ready = function () {\n                return _reduce(requires, function (a, x) {\n                    return (a && results.hasOwnProperty(x));\n                }, true);\n            };\n            if (ready()) {\n                task[task.length - 1](taskCallback, results);\n            }\n            else {\n                var listener = function () {\n                    if (ready()) {\n                        removeListener(listener);\n                        task[task.length - 1](taskCallback, results);\n                    }\n                };\n                addListener(listener);\n            }\n        });\n    };\n\n    async.waterfall = function (tasks, callback) {\n        if (!tasks.length) {\n            return callback();\n        }\n        callback = callback || function () {};\n        var wrapIterator = function (it
 erator) {\n            return function (err) {\n                if (err) {\n                    callback(err);\n                    callback = function () {};\n                }\n                else {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    var next = iterator.next();\n                    if (next) {\n                        args.push(wrapIterator(next));\n                    }\n                    else {\n                        args.push(callback);\n                    }\n                    async.nextTick(function () {\n                        iterator.apply(null, args);\n                    });\n                }\n            };\n        };\n        wrapIterator(async.iterator(tasks))();\n    };\n\n    async.parallel = function (tasks, callback) {\n        callback = callback || function () {};\n        if (tasks.constructor === Array) {\n            async.map(tasks, function (fn, callback) {\n                if (fn) {\n   
                  fn(function (err) {\n                        var args = Array.prototype.slice.call(arguments, 1);\n                        if (args.length <= 1) {\n                            args = args[0];\n                        }\n                        callback.call(null, err, args);\n                    });\n                }\n            }, callback);\n        }\n        else {\n            var results = {};\n            async.forEach(_keys(tasks), function (k, callback) {\n                tasks[k](function (err) {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    if (args.length <= 1) {\n                        args = args[0];\n                    }\n                    results[k] = args;\n                    callback(err);\n                });\n            }, function (err) {\n                callback(err, results);\n            });\n        }\n    };\n\n    async.series = function (tasks, callback) {\n        callback = callb
 ack || function () {};\n        if (tasks.constructor === Array) {\n            async.mapSeries(tasks, function (fn, callback) {\n                if (fn) {\n                    fn(function (err) {\n                        var args = Array.prototype.slice.call(arguments, 1);\n                        if (args.length <= 1) {\n                            args = args[0];\n                        }\n                        callback.call(null, err, args);\n                    });\n                }\n            }, callback);\n        }\n        else {\n            var results = {};\n            async.forEachSeries(_keys(tasks), function (k, callback) {\n                tasks[k](function (err) {\n                    var args = Array.prototype.slice.call(arguments, 1);\n                    if (args.length <= 1) {\n                        args = args[0];\n                    }\n                    results[k] = args;\n                    callback(err);\n                });\n            }, func
 tion (err) {\n                callback(err, results);\n            });\n        }\n    };\n\n    async.iterator = function (tasks) {\n        var makeCallback = function (index) {\n            var fn = function () {\n                if (tasks.length) {\n                    tasks[index].apply(null, arguments);\n                }\n                return fn.next();\n            };\n            fn.next = function () {\n                return (index < tasks.length - 1) ? makeCallback(index + 1): null;\n            };\n            return fn;\n        };\n        return makeCallback(0);\n    };\n\n    async.apply = function (fn) {\n        var args = Array.prototype.slice.call(arguments, 1);\n        return function () {\n            return fn.apply(\n                null, args.concat(Array.prototype.slice.call(arguments))\n            );\n        };\n    };\n\n    var _concat = function (eachfn, arr, fn, callback) {\n        var r = [];\n        eachfn(arr, function (x, cb) {\n           
  fn(x, function (err, y) {\n                r = r.concat(y || []);\n                cb(err);\n            });\n        }, function (err) {\n            callback(err, r);\n        });\n    };\n    async.concat = doParallel(_concat);\n    async.concatSeries = doSeries(_concat);\n\n    async.whilst = function (test, iterator, callback) {\n        if (test()) {\n            iterator(function (err) {\n                if (err) {\n                    return callback(err);\n                }\n                async.whilst(test, iterator, callback);\n            });\n        }\n        else {\n            callback();\n        }\n    };\n\n    async.until = function (test, iterator, callback) {\n        if (!test()) {\n            iterator(function (err) {\n                if (err) {\n                    return callback(err);\n                }\n                async.until(test, iterator, callback);\n            });\n        }\n        else {\n            callback();\n        }\n    };\n\n    
 async.queue = function (worker, concurrency) {\n        var workers = 0;\n        var q = {\n            tasks: [],\n            concurrency: concurrency,\n            saturated: null,\n            empty: null,\n            drain: null,\n            push: function (data, callback) {\n                q.tasks.push({data: data, callback: callback});\n                if(q.saturated && q.tasks.length == concurrency) q.saturated();\n                async.nextTick(q.process);\n            },\n            process: function () {\n                if (workers < q.concurrency && q.tasks.length) {\n                    var task = q.tasks.shift();\n                    if(q.empty && q.tasks.length == 0) q.empty();\n                    workers += 1;\n                    worker(task.data, function () {\n                        workers -= 1;\n                        if (task.callback) {\n                            task.callback.apply(task, arguments);\n                        }\n                     
    if(q.drain && q.tasks.length + workers == 0) q.drain();\n                        q.process();\n                    });\n                }\n            },\n            length: function () {\n                return q.tasks.length;\n            },\n            running: function () {\n                return workers;\n            }\n        };\n        return q;\n    };\n\n    var _console_fn = function (name) {\n        return function (fn) {\n            var args = Array.prototype.slice.call(arguments, 1);\n            fn.apply(null, args.concat([function (err) {\n                var args = Array.prototype.slice.call(arguments, 1);\n                if (typeof console !== 'undefined') {\n                    if (err) {\n                        if (console.error) {\n                            console.error(err);\n                        }\n                    }\n                    else if (console[name]) {\n                        _forEach(args, function (x) {\n                      
       console[name](x);\n                        });\n                    }\n                }\n            }]));\n        };\n    };\n    async.log = _console_fn('log');\n    async.dir = _console_fn('dir');\n    /*async.info = _console_fn('info');\n    async.warn = _console_fn('warn');\n    async.error = _console_fn('error');*/\n\n    async.memoize = function (fn, hasher) {\n        var memo = {};\n        var queues = {};\n        hasher = hasher || function (x) {\n            return x;\n        };\n        var memoized = function () {\n            var args = Array.prototype.slice.call(arguments);\n            var callback = args.pop();\n            var key = hasher.apply(null, args);\n            if (key in memo) {\n                callback.apply(null, memo[key]);\n            }\n            else if (key in queues) {\n                queues[key].push(callback);\n            }\n            else {\n                queues[key] = [callback];\n                fn.apply(null, args.conca
 t([function () {\n                    memo[key] = arguments;\n                    var q = queues[key];\n                    delete queues[key];\n                    for (var i = 0, l = q.length; i < l; i++) {\n                      q[i].apply(null, arguments);\n                    }\n                }]));\n            }\n        };\n        memoized.unmemoized = fn;\n        return memoized;\n    };\n\n    async.unmemoize = function (fn) {\n      return function () {\n        return (fn.unmemoized || fn).apply(null, arguments);\n      }\n    };\n\n}());\n">>},
-      {<<"handlebars">>,
-       <<47,47,32,108,105,98,47,104,97,110,100,108,101,98,97,114,115,47,98,97,115,
-         101,46,106,115,10,118,97,114,32,72,97,110,100,108,101,98,97,114,115,32,
-         61,32,123,125,59,10,10,72,97,110,100,108,101,98,97,114,115,46,86,69,82,
-         83,73,79,78,32,61,32,34,49,46,48,46,98,101,116,97,46,50,34,59,10,10,72,
-         97,110,100,108,101,98,97,114,115,46,104,101,108,112,101,114,115,32,32,61,
-         32,123,125,59,10,72,97,110,100,108,101,98,97,114,115,46,112,97,114,116,
-         105,97,108,115,32,61,32,123,125,59,10,10,72,97,110,100,108,101,98,97,114,
-         115,46,114,101,103,105,115,116,101,114,72,101,108,112,101,114,32,61,32,
-         102,117,110,99,116,105,111,110,40,110,97,109,101,44,32,102,110,44,32,105,
-         110,118,101,114,115,101,41,32,123,10,32,32,105,102,40,105,110,118,101,
-         114,115,101,41,32,123,32,102,110,46,110,111,116,32,61,32,105,110,118,101,
-         114,115,101,59,32,125,10,32,32,116,104,105,115,46,104,101,108,112,101,
-         114,115,91,110,97,109,101,93,32,61,32,102,110,59,10,125,59,10,10,72,97,
-         110,100,108,101,98,97,114,115,46,114,101,103,105,115,116,101,114,80,97,
-         114,116,105,97,108,32,61,32,102,117,110,99,116,105,111,110,40,110,97,109,
-         101,44,32,115,116,114,41,32,123,10,32,32,116,104,105,115,46,112,97,114,
-         116,105,97,108,115,91,110,97,109,101,93,32,61,32,115,116,114,59,10,125,
-         59,10,10,72,97,110,100,108,101,98,97,114,115,46,114,101,103,105,115,116,
-         101,114,72,101,108,112,101,114,40,39,104,101,108,112,101,114,77,105,115,
-         115,105,110,103,39,44,32,102,117,110,99,116,105,111,110,40,97,114,103,41,
-         32,123,10,32,32,105,102,40,97,114,103,117,109,101,110,116,115,46,108,101,
-         110,103,116,104,32,61,61,61,32,50,41,32,123,10,32,32,32,32,114,101,116,
-         117,114,110,32,117,110,100,101,102,105,110,101,100,59,10,32,32,125,32,
-         101,108,115,101,32,123,10,32,32,32,32,116,104,114,111,119,32,110,101,119,
-         32,69,114,114,111,114,40,34,67,111,117,108,100,32,110,111,116,32,102,105,
-         110,100,32,112,114,111,112,101,114,116,121,32,39,34,32,43,32,97,114,103,
-         32,43,32,34,39,34,41,59,10,32,32,125,10,125,41,59,10,10,72,97,110,100,
-         108,101,98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,
-         101,114,40,39,98,108,111,99,107,72,101,108,112,101,114,77,105,115,115,
-         105,110,103,39,44,32,102,117,110,99,116,105,111,110,40,99,111,110,116,
-         101,120,116,44,32,111,112,116,105,111,110,115,41,32,123,10,32,32,118,97,
-         114,32,105,110,118,101,114,115,101,32,61,32,111,112,116,105,111,110,115,
-         46,105,110,118,101,114,115,101,32,124,124,32,102,117,110,99,116,105,111,
-         110,40,41,32,123,125,44,32,102,110,32,61,32,111,112,116,105,111,110,115,
-         46,102,110,59,10,10,10,32,32,118,97,114,32,114,101,116,32,61,32,34,34,59,
-         10,32,32,118,97,114,32,116,121,112,101,32,61,32,79,98,106,101,99,116,46,
-         112,114,111,116,111,116,121,112,101,46,116,111,83,116,114,105,110,103,46,
-         99,97,108,108,40,99,111,110,116,101,120,116,41,59,10,10,32,32,105,102,40,
-         116,121,112,101,32,61,61,61,32,34,91,111,98,106,101,99,116,32,70,117,110,
-         99,116,105,111,110,93,34,41,32,123,10,32,32,32,32,99,111,110,116,101,120,
-         116,32,61,32,99,111,110,116,101,120,116,40,41,59,10,32,32,125,10,10,32,
-         32,105,102,40,99,111,110,116,101,120,116,32,61,61,61,32,116,114,117,101,
-         41,32,123,10,32,32,32,32,114,101,116,117,114,110,32,102,110,40,116,104,
-         105,115,41,59,10,32,32,125,32,101,108,115,101,32,105,102,40,99,111,110,
-         116,101,120,116,32,61,61,61,32,102,97,108,115,101,32,124,124,32,99,111,
-         110,116,101,120,116,32,61,61,32,110,117,108,108,41,32,123,10,32,32,32,32,
-         114,101,116,117,114,110,32,105,110,118,101,114,115,101,40,116,104,105,
-         115,41,59,10,32,32,125,32,101,108,115,101,32,105,102,40,116,121,112,101,
-         32,61,61,61,32,34,91,111,98,106,101,99,116,32,65,114,114,97,121,93,34,41,
-         32,123,10,32,32,32,32,105,102,40,99,111,110,116,101,120,116,46,108,101,
-         110,103,116,104,32,62,32,48,41,32,123,10,32,32,32,32,32,32,102,111,114,
-         40,118,97,114,32,105,61,48,44,32,106,61,99,111,110,116,101,120,116,46,
-         108,101,110,103,116,104,59,32,105,60,106,59,32,105,43,43,41,32,123,10,32,
-         32,32,32,32,32,32,32,114,101,116,32,61,32,114,101,116,32,43,32,102,110,
-         40,99,111,110,116,101,120,116,91,105,93,41,59,10,32,32,32,32,32,32,125,
-         10,32,32,32,32,125,32,101,108,115,101,32,123,10,32,32,32,32,32,32,114,
-         101,116,32,61,32,105,110,118,101,114,115,101,40,116,104,105,115,41,59,10,
-         32,32,32,32,125,10,32,32,32,32,114,101,116,117,114,110,32,114,101,116,59,
-         10,32,32,125,32,101,108,115,101,32,123,10,32,32,32,32,114,101,116,117,
-         114,110,32,102,110,40,99,111,110,116,101,120,116,41,59,10,32,32,125,10,
-         125,41,59,10,10,72,97,110,100,108,101,98,97,114,115,46,114,101,103,105,
-         115,116,101,114,72,101,108,112,101,114,40,39,101,97,99,104,39,44,32,102,
-         117,110,99,116,105,111,110,40,99,111,110,116,101,120,116,44,32,111,112,
-         116,105,111,110,115,41,32,123,10,32,32,118,97,114,32,102,110,32,61,32,
-         111,112,116,105,111,110,115,46,102,110,44,32,105,110,118,101,114,115,101,
-         32,61,32,111,112,116,105,111,110,115,46,105,110,118,101,114,115,101,59,
-         10,32,32,118,97,114,32,114,101,116,32,61,32,34,34,59,10,10,32,32,105,102,
-         40,99,111,110,116,101,120,116,32,38,38,32,99,111,110,116,101,120,116,46,
-         108,101,110,103,116,104,32,62,32,48,41,32,123,10,32,32,32,32,102,111,114,
-         40,118,97,114,32,105,61,48,44,32,106,61,99,111,110,116,101,120,116,46,
-         108,101,110,103,116,104,59,32,105,60,106,59,32,105,43,43,41,32,123,10,32,
-         32,32,32,32,32,114,101,116,32,61,32,114,101,116,32,43,32,102,110,40,99,
-         111,110,116,101,120,116,91,105,93,41,59,10,32,32,32,32,125,10,32,32,125,
-         32,101,108,115,101,32,123,10,32,32,32,32,114,101,116,32,61,32,105,110,
-         118,101,114,115,101,40,116,104,105,115,41,59,10,32,32,125,10,32,32,114,
-         101,116,117,114,110,32,114,101,116,59,10,125,41,59,10,10,72,97,110,100,
-         108,101,98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,
-         101,114,40,39,105,102,39,44,32,102,117,110,99,116,105,111,110,40,99,111,
-         110,116,101,120,116,44,32,111,112,116,105,111,110,115,41,32,123,10,32,32,
-         105,102,40,33,99,111,110,116,101,120,116,32,124,124,32,72,97,110,100,108,
-         101,98,97,114,115,46,85,116,105,108,115,46,105,115,69,109,112,116,121,40,
-         99,111,110,116,101,120,116,41,41,32,123,10,32,32,32,32,114,101,116,117,
-         114,110,32,111,112,116,105,111,110,115,46,105,110,118,101,114,115,101,40,
-         116,104,105,115,41,59,10,32,32,125,32,101,108,115,101,32,123,10,32,32,32,
-         32,114,101,116,117,114,110,32,111,112,116,105,111,110,115,46,102,110,40,
-         116,104,105,115,41,59,10,32,32,125,10,125,41,59,10,10,72,97,110,100,108,
-         101,98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,101,
-         114,40,39,117,110,108,101,115,115,39,44,32,102,117,110,99,116,105,111,
-         110,40,99,111,110,116,101,120,116,44,32,111,112,116,105,111,110,115,41,
-         32,123,10,32,32,118,97,114,32,102,110,32,61,32,111,112,116,105,111,110,
-         115,46,102,110,44,32,105,110,118,101,114,115,101,32,61,32,111,112,116,
-         105,111,110,115,46,105,110,118,101,114,115,101,59,10,32,32,111,112,116,
-         105,111,110,115,46,102,110,32,61,32,105,110,118,101,114,115,101,59,10,32,
-         32,111,112,116,105,111,110,115,46,105,110,118,101,114,115,101,32,61,32,
-         102,110,59,10,10,32,32,114,101,116,117,114,110,32,72,97,110,100,108,101,
-         98,97,114,115,46,104,101,108,112,101,114,115,91,39,105,102,39,93,46,99,
-         97,108,108,40,116,104,105,115,44,32,99,111,110,116,101,120,116,44,32,111,
-         112,116,105,111,110,115,41,59,10,125,41,59,10,10,72,97,110,100,108,101,
-         98,97,114,115,46,114,101,103,105,115,116,101,114,72,101,108,112,101,114,
-         40,39,119,105,116,104,39,44,32,102,117,110,99,116,105,111,110,40,99,111,
-         110,116,101,120,116,44,32,111,112,116,105,111,110,115,41,32,123,10,32,32,
-         114,101,116,117,114,110,32,111,112,116,105,111,110,115,46,102,110,40,99,
-         111,110,116,101,120,116,41,59,10,125,41,59,10,59,10,47,47,32,108,105,98,
-         47,104,97,110,100,108,101,98,97,114,115,47,99,111,109,112,105,108,101,
-         114,47,112,97,114,115,101,114,46,106,115,10,47,42,32,74,105,115,111,110,
-         32,103,101,110,101,114,97,116,101,100,32,112,97,114,115,101,114,32,42,47,
-         10,118,97,114,32,104,97,110,100,108,101,98,97,114,115,32,61,32,40,102,
-         117,110,99,116,105,111,110,40,41,123,10,10,118,97,114,32,112,97,114,115,
-         101,114,32,61,32,123,116,114,97,99,101,58,32,102,117,110,99,116,105,111,
-         110,32,116,114,97,99,101,40,41,32,123,32,125,44,10,121,121,58,32,123,125,
-         44,10,115,121,109,98,111,108,115,95,58,32,123,34,101,114,114,111,114,34,
-         58,50,44,34,114,111,111,116,34,58,51,44,34,112,114,111,103,114,97,109,34,
-         58,52,44,34,69,79,70,34,58,53,44,34,115,116,97,116,101,109,101,110,116,
-         115,34,58,54,44,34,115,105,109,112,108,101,73,110,118,101,114,115,101,34,
-         58,55,44,34,115,116,97,116,101,109,101,110,116,34,58,56,44,34,111,112,
-         101,110,73,110,118,101,114,115,101,34,58,57,44,34,99,108,111,115,101,66,
-         108,111,99,107,34,58,49,48,44,34,111,112,101,110,66,108,111,99,107,34,58,
-         49,49,44,34,109,117,115,116,97,99,104,101,34,58,49,50,44,34,112,97,114,
-         116,105,97,108,34,58,49,51,44,34,67,79,78,84,69,78,84,34,58,49,52,44,34,
-         67,79,77,77,69,78,84,34,58,49,53,44,34,79,80,69,78,95,66,76,79,67,75,34,
-         58,49,54,44,34,105,110,77,117,115,116,97,99,104,101,34,58,49,55,44,34,67,
-         76,79,83,69,34,58,49,56,44,34,79,80,69,78,95,73,78,86,69,82,83,69,34,58,
-         49,57,44,34,79,80,69,78,95,69,78,68,66,76,79,67,75,34,58,50,48,44,34,112,
-         97,116,104,34,58,50,49,44,34,79,80,69,78,34,58,50,50,44,34,79,80,69,78,
-         95,85,78,69,83,67,65,80,69,68,34,58,50,51,44,34,79,80,69,78,95,80,65,82,
-         84,73,65,76,34,58,50,52,44,34,112,97,114,97,109,115,34,58,50,53,44,34,
-         104,97,115,104,34,58,50,54,44,34,112,97,114,97,109,34,58,50,55,44,34,83,
-         84,82,73,78,71,34,58,50,56,44,34,73,78,84,69,71,69,82,34,58,50,57,44,34,
-         66,79,79,76,69,65,78,34,58,51,48,44,34,104,97,115,104,83,101,103,109,101,
-         110,116,115,34,58,51,49,44,34,104,97,115,104,83,101,103,109,101,110,116,
-         34,58,51,50,44,34,73,68,34,58,51,51,44,34,69,81,85,65,76,83,34,58,51,52,
-         44,34,112,97,116,104,83,101,103,109,101,110,116,115,34,58,51,53,44,34,83,
-         69,80,34,58,51,54,44,34,36,97,99,99,101,112,116,34,58,48,44,34,36,101,
-         110,100,34,58,49,125,44,10,116,101,114,109,105,110,97,108,115,95,58,32,
-         123,50,58,34,101,114,114,111,114,34,44,53,58,34,69,79,70,34,44,49,52,58,
-         34,67,79,78,84,69,78,84,34,44,49,53,58,34,67,79,77,77,69,78,84,34,44,49,
-         54,58,34,79,80,69,78,95,66,76,79,67,75,34,44,49,56,58,34,67,76,79,83,69,
-         34,44,49,57,58,34,79,80,69,78,95,73,78,86,69,82,83,69,34,44,50,48,58,34,
-         79,80,69,78,95,69,78,68,66,76,79,67,75,34,44,50,50,58,34,79,80,69,78,34,
-         44,50,51,58,34,79,80,69,78,95,85,78,69,83,67,65,80,69,68,34,44,50,52,58,
-         34,79,80,69,78,95,80,65,82,84,73,65,76,34,44,50,56,58,34,83,84,82,73,78,
-         71,34,44,50,57,58,34,73,78,84,69,71,69,82,34,44,51,48,58,34,66,79,79,76,
-         69,65,78,34,44,51,51,58,34,73,68,34,44,51,52,58,34,69,81,85,65,76,83,34,
-         44,51,54,58,34,83,69,80,34,125,44,10,112,114,111,100,117,99,116,105,111,
-         110,115,95,58,32,91,48,44,91,51,44,50,93,44,91,52,44,51,93,44,91,52,44,
-         49,93,44,91,52,44,48,93,44,91,54,44,49,93,44,91,54,44,50,93,44,91,56,44,
-         51,93,44,91,56,44,51,93,44,91,56,44,49,93,44,91,56,44,49,93,44,91,56,44,
-         49,93,44,91,56,44,49,93,44,91,49,49,44,51,93,44,91,57,44,51,93,44,91,49,
-         48,44,51,93,44,91,49,50,44,51,93,44,91,49,50,44,51,93,44,91,49,51,44,51,
-         93,44,91,49,51,44,52,93,44,91,55,44,50,93,44,91,49,55,44,51,93,44,91,49,
-         55,44,50,93,44,91,49,55,44,50,93,44,91,49,55,44,49,93,44,91,50,53,44,50,
-         93,44,91,50,53,44,49,93,44,91,50,55,44,49,93,44,91,50,55,44,49,93,44,91,
-         50,55,44,49,93,44,91,50,55,44,49,93,44,91,50,54,44,49,93,44,91,51,49,44,
-         50,93,44,91,51,49,44,49,93,44,91,51,50,44,51,93,44,91,51,50,44,51,93,44,
-         91,51,50,44,51,93,44,91,51,50,44,51,93,44,91,50,49,44,49,93,44,91,51,53,
-         44,51,93,44,91,51,53,44,49,93,93,44,10,112,101,114,102,111,114,109,65,99,
-         116,105,111,110,58,32,102,117,110,99,116,105,111,110,32,97,110,111,110,
-         121,109,111,117,115,40,121,121,116,101,120,116,44,121,121,108,101,110,
-         103,44,121,121,108,105,110,101,110,111,44,121,121,44,121,121,115,116,97,
-         116,101,44,36,36,44,95,36,41,32,123,10,10,118,97,114,32,36,48,32,61,32,
-         36,36,46,108,101,110,103,116,104,32,45,32,49,59,10,115,119,105,116,99,
-         104,32,40,121,121,115,116,97,116,101,41,32,123,10,99,97,115,101,32,49,58,
-         32,114,101,116,117,114,110,32,36,36,91,36,48,45,49,93,32,10,98,114,101,
-         97,107,59,10,99,97,115,101,32,50,58,32,116,104,105,115,46,36,32,61,32,
-         110,101,119,32,121,121,46,80,114,111,103,114,97,109,78,111,100,101,40,36,
-         36,91,36,48,45,50,93,44,32,36,36,91,36,48,93,41,32,10,98,114,101,97,107,
-         59,10,99,97,115,101,32,51,58,32,116,104,105,115,46,36,32,61,32,110,101,
-         119,32,121,121,46,80,114,111,103,114,97,109,78,111,100,101,40,36,36,91,
-         36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,52,58,32,116,
-         104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,80,114,111,103,114,
-         97,109,78,111,100,101,40,91,93,41,32,10,98,114,101,97,107,59,10,99,97,
-         115,101,32,53,58,32,116,104,105,115,46,36,32,61,32,91,36,36,91,36,48,93,
-         93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,54,58,32,36,36,91,36,
-         48,45,49,93,46,112,117,115,104,40,36,36,91,36,48,93,41,59,32,116,104,105,
-         115,46,36,32,61,32,36,36,91,36,48,45,49,93,32,10,98,114,101,97,107,59,10,
-         99,97,115,101,32,55,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,
-         121,121,46,73,110,118,101,114,115,101,78,111,100,101,40,36,36,91,36,48,
-         45,50,93,44,32,36,36,91,36,48,45,49,93,44,32,36,36,91,36,48,93,41,32,10,
-         98,114,101,97,107,59,10,99,97,115,101,32,56,58,32,116,104,105,115,46,36,
-         32,61,32,110,101,119,32,121,121,46,66,108,111,99,107,78,111,100,101,40,
-         36,36,91,36,48,45,50,93,44,32,36,36,91,36,48,45,49,93,44,32,36,36,91,36,
-         48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,57,58,32,116,104,
-         105,115,46,36,32,61,32,36,36,91,36,48,93,32,10,98,114,101,97,107,59,10,
-         99,97,115,101,32,49,48,58,32,116,104,105,115,46,36,32,61,32,36,36,91,36,
-         48,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,49,49,58,32,116,104,
-         105,115,46,36,32,61,32,110,101,119,32,121,121,46,67,111,110,116,101,110,
-         116,78,111,100,101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,
-         99,97,115,101,32,49,50,58,32,116,104,105,115,46,36,32,61,32,110,101,119,
-         32,121,121,46,67,111,109,109,101,110,116,78,111,100,101,40,36,36,91,36,
-         48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,49,51,58,32,116,
-         104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,77,117,115,116,97,
-         99,104,101,78,111,100,101,40,36,36,91,36,48,45,49,93,91,48,93,44,32,36,
-         36,91,36,48,45,49,93,91,49,93,41,32,10,98,114,101,97,107,59,10,99,97,115,
-         101,32,49,52,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,
-         46,77,117,115,116,97,99,104,101,78,111,100,101,40,36,36,91,36,48,45,49,
-         93,91,48,93,44,32,36,36,91,36,48,45,49,93,91,49,93,41,32,10,98,114,101,
-         97,107,59,10,99,97,115,101,32,49,53,58,32,116,104,105,115,46,36,32,61,32,
-         36,36,91,36,48,45,49,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,
-         49,54,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,77,
-         117,115,116,97,99,104,101,78,111,100,101,40,36,36,91,36,48,45,49,93,91,
-         48,93,44,32,36,36,91,36,48,45,49,93,91,49,93,41,32,10,98,114,101,97,107,
-         59,10,99,97,115,101,32,49,55,58,32,116,104,105,115,46,36,32,61,32,110,
-         101,119,32,121,121,46,77,117,115,116,97,99,104,101,78,111,100,101,40,36,
-         36,91,36,48,45,49,93,91,48,93,44,32,36,36,91,36,48,45,49,93,91,49,93,44,
-         32,116,114,117,101,41,32,10,98,114,101,97,107,59,10,99,97,115,101,32,49,
-         56,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,80,97,
-         114,116,105,97,108,78,111,100,101,40,36,36,91,36,48,45,49,93,41,32,10,98,
-         114,101,97,107,59,10,99,97,115,101,32,49,57,58,32,116,104,105,115,46,36,
-         32,61,32,110,101,119,32,121,121,46,80,97,114,116,105,97,108,78,111,100,
-         101,40,36,36,91,36,48,45,50,93,44,32,36,36,91,36,48,45,49,93,41,32,10,98,
-         114,101,97,107,59,10,99,97,115,101,32,50,48,58,32,10,98,114,101,97,107,
-         59,10,99,97,115,101,32,50,49,58,32,116,104,105,115,46,36,32,61,32,91,91,
-         36,36,91,36,48,45,50,93,93,46,99,111,110,99,97,116,40,36,36,91,36,48,45,
-         49,93,41,44,32,36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,99,97,
-         115,101,32,50,50,58,32,116,104,105,115,46,36,32,61,32,91,91,36,36,91,36,
-         48,45,49,93,93,46,99,111,110,99,97,116,40,36,36,91,36,48,93,41,44,32,110,
-         117,108,108,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,50,51,58,
-         32,116,104,105,115,46,36,32,61,32,91,91,36,36,91,36,48,45,49,93,93,44,32,
-         36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,50,
-         52,58,32,116,104,105,115,46,36,32,61,32,91,91,36,36,91,36,48,93,93,44,32,
-         110,117,108,108,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,50,53,
-         58,32,36,36,91,36,48,45,49,93,46,112,117,115,104,40,36,36,91,36,48,93,41,
-         59,32,116,104,105,115,46,36,32,61,32,36,36,91,36,48,45,49,93,59,32,10,98,
-         114,101,97,107,59,10,99,97,115,101,32,50,54,58,32,116,104,105,115,46,36,
-         32,61,32,91,36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,99,97,115,
-         101,32,50,55,58,32,116,104,105,115,46,36,32,61,32,36,36,91,36,48,93,32,
-         10,98,114,101,97,107,59,10,99,97,115,101,32,50,56,58,32,116,104,105,115,
-         46,36,32,61,32,110,101,119,32,121,121,46,83,116,114,105,110,103,78,111,
-         100,101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,
-         101,32,50,57,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,121,
-         46,73,110,116,101,103,101,114,78,111,100,101,40,36,36,91,36,48,93,41,32,
-         10,98,114,101,97,107,59,10,99,97,115,101,32,51,48,58,32,116,104,105,115,
-         46,36,32,61,32,110,101,119,32,121,121,46,66,111,111,108,101,97,110,78,
-         111,100,101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,
-         115,101,32,51,49,58,32,116,104,105,115,46,36,32,61,32,110,101,119,32,121,
-         121,46,72,97,115,104,78,111,100,101,40,36,36,91,36,48,93,41,32,10,98,114,
-         101,97,107,59,10,99,97,115,101,32,51,50,58,32,36,36,91,36,48,45,49,93,46,
-         112,117,115,104,40,36,36,91,36,48,93,41,59,32,116,104,105,115,46,36,32,
-         61,32,36,36,91,36,48,45,49,93,32,10,98,114,101,97,107,59,10,99,97,115,
-         101,32,51,51,58,32,116,104,105,115,46,36,32,61,32,91,36,36,91,36,48,93,
-         93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,52,58,32,116,104,
-         105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,36,36,91,36,48,
-         93,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,53,58,32,116,104,
-         105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,110,101,119,32,
-         121,121,46,83,116,114,105,110,103,78,111,100,101,40,36,36,91,36,48,93,41,
-         93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,54,58,32,116,104,
-         105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,110,101,119,32,
-         121,121,46,73,110,116,101,103,101,114,78,111,100,101,40,36,36,91,36,48,
-         93,41,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,55,58,32,116,
-         104,105,115,46,36,32,61,32,91,36,36,91,36,48,45,50,93,44,32,110,101,119,
-         32,121,121,46,66,111,111,108,101,97,110,78,111,100,101,40,36,36,91,36,48,
-         93,41,93,32,10,98,114,101,97,107,59,10,99,97,115,101,32,51,56,58,32,116,
-         104,105,115,46,36,32,61,32,110,101,119,32,121,121,46,73,100,78,111,100,
-         101,40,36,36,91,36,48,93,41,32,10,98,114,101,97,107,59,10,99,97,115,101,
-         32,51,57,58,32,36,36,91,36,48,45,50,93,46,112,117,115,104,40,36,36,91,36,
-         48,93,41,59,32,116,104,105,115,46,36,32,61,32,36,36,91,36,48,45,50,93,59,
-         32,10,98,114,101,97,107,59,10,99,97,115,101,32,52,48,58,32,116,104,105,
-         115,46,36,32,61,32,91,36,36,91,36,48,93,93,32,10,98,114,101,97,107,59,10,
-         125,10,125,44,10,116,97,98,108,101,58,32,91,123,51,58,49,44,52,58,50,44,
-         53,58,91,50,44,52,93,44,54,58,51,44,56,58,52,44,57,58,53,44,49,49,58,54,
-         44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,44,57,93,44,49,53,58,91,
-         49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,44,49,57,58,91,49,44,49,49,
-         93,44,50,50,58,91,49,44,49,51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,
-         58,91,49,44,49,53,93,125,44,123,49,58,91,51,93,125,44,123,53,58,91,49,44,
-         49,54,93,125,44,123,53,58,91,50,44,51,93,44,55,58,49,55,44,56,58,49,56,
-         44,57,58,53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,
-         49,44,57,93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,
-         44,49,57,58,91,49,44,49,57,93,44,50,48,58,91,50,44,51,93,44,50,50,58,91,
-         49,44,49,51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,58,91,49,44,49,53,
-         93,125,44,123,53,58,91,50,44,53,93,44,49,52,58,91,50,44,53,93,44,49,53,
-         58,91,50,44,53,93,44,49,54,58,91,50,44,53,93,44,49,57,58,91,50,44,53,93,
-         44,50,48,58,91,50,44,53,93,44,50,50,58,91,50,44,53,93,44,50,51,58,91,50,
-         44,53,93,44,50,52,58,91,50,44,53,93,125,44,123,52,58,50,48,44,54,58,51,
-         44,56,58,52,44,57,58,53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,
-         49,52,58,91,49,44,57,93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,
-         44,49,50,93,44,49,57,58,91,49,44,49,49,93,44,50,48,58,91,50,44,52,93,44,
-         50,50,58,91,49,44,49,51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,58,91,
-         49,44,49,53,93,125,44,123,52,58,50,49,44,54,58,51,44,56,58,52,44,57,58,
-         53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,44,57,
-         93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,44,49,57,
-         58,91,49,44,49,49,93,44,50,48,58,91,50,44,52,93,44,50,50,58,91,49,44,49,
-         51,93,44,50,51,58,91,49,44,49,52,93,44,50,52,58,91,49,44,49,53,93,125,44,
-         123,53,58,91,50,44,57,93,44,49,52,58,91,50,44,57,93,44,49,53,58,91,50,44,
-         57,93,44,49,54,58,91,50,44,57,93,44,49,57,58,91,50,44,57,93,44,50,48,58,
-         91,50,44,57,93,44,50,50,58,91,50,44,57,93,44,50,51,58,91,50,44,57,93,44,
-         50,52,58,91,50,44,57,93,125,44,123,53,58,91,50,44,49,48,93,44,49,52,58,
-         91,50,44,49,48,93,44,49,53,58,91,50,44,49,48,93,44,49,54,58,91,50,44,49,
-         48,93,44,49,57,58,91,50,44,49,48,93,44,50,48,58,91,50,44,49,48,93,44,50,
-         50,58,91,50,44,49,48,93,44,50,51,58,91,50,44,49,48,93,44,50,52,58,91,50,
-         44,49,48,93,125,44,123,53,58,91,50,44,49,49,93,44,49,52,58,91,50,44,49,
-         49,93,44,49,53,58,91,50,44,49,49,93,44,49,54,58,91,50,44,49,49,93,44,49,
-         57,58,91,50,44,49,49,93,44,50,48,58,91,50,44,49,49,93,44,50,50,58,91,50,
-         44,49,49,93,44,50,51,58,91,50,44,49,49,93,44,50,52,58,91,50,44,49,49,93,
-         125,44,123,53,58,91,50,44,49,50,93,44,49,52,58,91,50,44,49,50,93,44,49,
-         53,58,91,50,44,49,50,93,44,49,54,58,91,50,44,49,50,93,44,49,57,58,91,50,
-         44,49,50,93,44,50,48,58,91,50,44,49,50,93,44,50,50,58,91,50,44,49,50,93,
-         44,50,51,58,91,50,44,49,50,93,44,50,52,58,91,50,44,49,50,93,125,44,123,
-         49,55,58,50,50,44,50,49,58,50,51,44,51,51,58,91,49,44,50,53,93,44,51,53,
-         58,50,52,125,44,123,49,55,58,50,54,44,50,49,58,50,51,44,51,51,58,91,49,
-         44,50,53,93,44,51,53,58,50,52,125,44,123,49,55,58,50,55,44,50,49,58,50,
-         51,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,52,125,44,123,49,55,58,
-         50,56,44,50,49,58,50,51,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,52,
-         125,44,123,50,49,58,50,57,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,
-         52,125,44,123,49,58,91,50,44,49,93,125,44,123,54,58,51,48,44,56,58,52,44,
-         57,58,53,44,49,49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,
-         44,57,93,44,49,53,58,91,49,44,49,48,93,44,49,54,58,91,49,44,49,50,93,44,
-         49,57,58,91,49,44,49,49,93,44,50,50,58,91,49,44,49,51,93,44,50,51,58,91,
-         49,44,49,52,93,44,50,52,58,91,49,44,49,53,93,125,44,123,53,58,91,50,44,
-         54,93,44,49,52,58,91,50,44,54,93,44,49,53,58,91,50,44,54,93,44,49,54,58,
-         91,50,44,54,93,44,49,57,58,91,50,44,54,93,44,50,48,58,91,50,44,54,93,44,
-         50,50,58,91,50,44,54,93,44,50,51,58,91,50,44,54,93,44,50,52,58,91,50,44,
-         54,93,125,44,123,49,55,58,50,50,44,49,56,58,91,49,44,51,49,93,44,50,49,
-         58,50,51,44,51,51,58,91,49,44,50,53,93,44,51,53,58,50,52,125,44,123,49,
-         48,58,51,50,44,50,48,58,91,49,44,51,51,93,125,44,123,49,48,58,51,52,44,
-         50,48,58,91,49,44,51,51,93,125,44,123,49,56,58,91,49,44,51,53,93,125,44,
-         123,49,56,58,91,50,44,50,52,93,44,50,49,58,52,48,44,50,53,58,51,54,44,50,
-         54,58,51,55,44,50,55,58,51,56,44,50,56,58,91,49,44,52,49,93,44,50,57,58,
-         91,49,44,52,50,93,44,51,48,58,91,49,44,52,51,93,44,51,49,58,51,57,44,51,
-         50,58,52,52,44,51,51,58,91,49,44,52,53,93,44,51,53,58,50,52,125,44,123,
-         49,56,58,91,50,44,51,56,93,44,50,56,58,91,50,44,51,56,93,44,50,57,58,91,
-         50,44,51,56,93,44,51,48,58,91,50,44,51,56,93,44,51,51,58,91,50,44,51,56,
-         93,44,51,54,58,91,49,44,52,54,93,125,44,123,49,56,58,91,50,44,52,48,93,
-         44,50,56,58,91,50,44,52,48,93,44,50,57,58,91,50,44,52,48,93,44,51,48,58,
-         91,50,44,52,48,93,44,51,51,58,91,50,44,52,48,93,44,51,54,58,91,50,44,52,
-         48,93,125,44,123,49,56,58,91,49,44,52,55,93,125,44,123,49,56,58,91,49,44,
-         52,56,93,125,44,123,49,56,58,91,49,44,52,57,93,125,44,123,49,56,58,91,49,
-         44,53,48,93,44,50,49,58,53,49,44,51,51,58,91,49,44,50,53,93,44,51,53,58,
-         50,52,125,44,123,53,58,91,50,44,50,93,44,56,58,49,56,44,57,58,53,44,49,
-         49,58,54,44,49,50,58,55,44,49,51,58,56,44,49,52,58,91,49,44,57,93,44,49,
-         53,58,91,49,44,49,48,93,44,49,54,58,91,

<TRUNCATED>

[53/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Remove travis notification


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/0f7708ae
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/0f7708ae
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/0f7708ae

Branch: refs/heads/master
Commit: 0f7708ae94d89f83271376aa328a6919c90cd6e0
Parents: 1e291d0
Author: Alexander Shorin <kx...@apache.org>
Authored: Sat Jul 25 15:51:07 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Sat Jul 25 15:51:07 2015 +0300

----------------------------------------------------------------------
 .travis.yml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/0f7708ae/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 2865a8a..51614ce 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,5 @@
 language: erlang
-notifications:
-  email: paul.joseph.davis@gmail.com
+
 otp_release:
    - 17.5
    - 17.4


[47/54] jiffy commit: updated refs/heads/master to ef77de4

Posted by kx...@apache.org.
Add map typespec for dialyzer

This obviously only exists on VMs that support it.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/commit/e132b633
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/tree/e132b633
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/diff/e132b633

Branch: refs/heads/master
Commit: e132b633f586281cfce7d4f1e71a41c96555e963
Parents: f284a1b
Author: Paul J. Davis <pa...@gmail.com>
Authored: Fri Jul 17 11:59:50 2015 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Jul 17 11:59:50 2015 -0500

----------------------------------------------------------------------
 src/jiffy.erl | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/e132b633/src/jiffy.erl
----------------------------------------------------------------------
diff --git a/src/jiffy.erl b/src/jiffy.erl
index c987997..4ee2a9e 100644
--- a/src/jiffy.erl
+++ b/src/jiffy.erl
@@ -23,6 +23,10 @@
 -type json_number() :: integer() | float().
 -type json_object() :: {[{json_string(),json_value()}]}.
 
+-ifndef(JIFFY_NO_MAPS).
+-type #{json_string() => json_value()}.
+-endif.
+
 -type jiffy_decode_result() :: json_value()
                         | {has_trailer, json_value(), binary()}.