anchor.diff:      list_to_binary(integer_to_list(X));
   to_json_type(_, void) -> <<"ok">>;
   to_json_type(X, {type,_,<<"uint", _/binary>>,_}) when is_integer(X), X >= 0 ->
  -    X;
  -to_json_type(false, {type,_,<<"boolean">>,_}) -> false;
  -to_json_type(true, {type,_,<<"boolean">>,_}) -> true;
  -to_json_type(X0, {type,_,<<"enumeration">>, En} = T) ->
  -    %% We always return the key (binary) - not the value (integer).
  -    %% This seems to be in keeping with how NETCONF does it.
  -    X = if is_integer(X0) -> list_to_binary(integer_to_list(X0));
  -	   is_binary(X0)  -> X0;
  -	   is_list(X0) -> list_to_binary(X0)
  -	end,
  -    case find_enum(En, X) of
  -	[] -> error({type_error, [X0, T]});
  -	[{Key, _}] ->
  -	    Key;
  -	[{K1, V1}, {K2, V2}] ->
  -	    %% Either V1 or V2 must be equal to X, or it's an error
  -	    if V1 == X -> K1;
  -	       V2 == X -> K2;
  -	       true -> error({type_error, [X0, T]})
  -	    end
  +    list_to_binary(integer_to_list(X));
  +to_json_type(false, {type,_,<<"boolean">>,_}) -> <<"0">>;
  +to_json_type(true, {type,_,<<"boolean">>,_}) -> <<"1">>;
  +to_json_type(X, {type,_,<<"enumeration">>, En} = T) ->
  +    case [lists:keyfind(value,1,I1) || {enum,_,E1,I1} <- En,
  +				       E1 == X] of
  +	[{value,_,V,_}] ->
  +	    V;
  +	[] ->
  +	    error({type_error, [X, T]})
       end;
   to_json_type(X, {type, _, <<"union">>, Ts} = Type) ->
       to_json_type_union(Ts, X, Type);
  -to_json_type(_, {type, _, <<"empty">>, _}) -> <<>>;
   to_json_type(X, _) ->
       X.
   
  
positive.code: markdown([]) ->
      [].
  
  markdown_rpcs([{Not, {notification, Info, Msg}} | T]) ->
      ["#### Notification: ", Not, "\n",
       "```json\n", pp_json(Msg), "\n```\n\n",
       case proplists:get_value(description, Info, "") of
  	 "" -> "";
  	 Descr ->
  	     [Descr, "\n\n"]
       end,
       markdown_extensions(Info), "\n\n",
       markdown_descriptions(Msg), "\n\n" | markdown_rpcs(T)];
  markdown_rpcs([{RPC, {Info, {request, Req}, {reply, Rep}}} | T]) ->
      ["### RPC: ", RPC, "\n\n",
       "#### Request\n", "```json\n", pp_json(Req), "\n```\n\n",
       case proplists:get_value(description, Info, "") of
  	 "" -> "";
  	 Descr ->
  	     [Descr, "\n\n"]
       end,
       markdown_extensions(Info), "\n\n",
       markdown_descriptions(Req), "\n\n",
       "#### Reply\n", "```json\n", pp_json(Rep), "\n```\n\n",
       markdown_descriptions(Rep), "\n\n" | markdown_rpcs(T)];
  markdown_rpcs([]) ->
      [].
  
negative.code: 	[] -> [];
  	[{K,{D,T}}|Tail] ->
  	    ["**descriptions**\n",
  	     "<dl><dt>", K, "</dt>\n", "<dd>", D,
  	     " (<b>type:</b> ", type_to_text(T), ")", "</dd>",
  	     [["\n<dt>", K1, "</dt>\n", "<dd>", D1,
  	       " (<b>type:</b> ", type_to_text(T1), ")", "</dd>"]
  	      || {K1,{D1,T1}} <- Tail],
  	     "\n</dl>\n\n"]
      end.
  
  collect_descriptions({struct, L}, Acc) ->
      lists:foldl(fun collect_descriptions/2, Acc, L);
  