anchor.diff:      undefined.
   
   
  --spec segment_count(raw_segment_id() | segment_id(), raw_msg() | msg()) -> non_neg_integer().
  +-spec segment_count(segment_id() | raw_segment_id(), msg() | raw_msg()) -> non_neg_integer().
   segment_count(SegmentId, Msg) ->
       segment_count(SegmentId, Msg, 0).
   
  
positive.code: 
  -on_load(init/0).
  
  -type raw_msg() :: [tuple()].
  -type msg() :: [tuple()].
  -type raw_segment_id() :: binary().
  -type segment_id() :: atom().
  -type raw_segment() :: tuple().
  -type segment() :: tuple().
  -type raw_field() :: binary().
  -type field() :: tuple() | binary() | integer() | calendar:date() | calendar:datetime() | float().
  -type field_index() :: non_neg_integer() | [non_neg_integer()].
  -type field_data_type() :: 'string' | 'integer' | 'date' | 'float'.
  -type field_length() :: non_neg_integer().
  -type decode_option() :: 'raw'.
  -type encode_option() :: 'raw' | 'disable_simplify'.
  
  
  %%%===================================================================
  %%% API
  %%%===================================================================
  
  -spec init() -> ok | {error, Reason :: any()}.
  init() ->
      erlang:load_nif("priv/ehl7", 0).
  
  
  -spec decode(Buffer :: binary()) -> {ok, raw_msg()} | {error, Reason :: any()}.
  decode(Buffer) ->
      decode(Buffer, []).
  
  -spec decode(Buffer :: binary(), [decode_option()]) -> {ok, raw_msg()} | {error, Reason :: any()}.
  decode(Buffer, Options) ->
      case raw_decode(Buffer) of
          [] ->
              {error, {invalid_hl7_message, Buffer}};
          RawMsg when is_list(RawMsg) ->
              case lists:member(raw, Options) of
                  true ->
                      RawMsg;
                  false ->
                      decode_msg(RawMsg, [])
              end;
          {error, _Reason} = Error ->
  
negative.code: %%% Internal functions
  %%%===================================================================
  
  -spec raw_decode(buffer()) -> raw_msg() | error().
  raw_decode(_Buffer) ->
      nif_error(?LINE).
  
  
  -spec raw_encode(raw_msg()) -> buffer() | error().
  raw_encode(_Msg) ->
      nif_error(?LINE).
  
  