anchor.diff:           change_handler/2, post_op/2]).
   -export([bp_set/3, bp_set_cond/3, bp_del/2]).
   -export([bp_step/1, bp_cont/1, bp_barrier/1]).
  +
  +-type bp_name() :: atom().
  +
  +-type bp_message() ::
  +          {'$gen_component', bp, breakpoint, step, pid()}
  +        | {'$gen_component', bp, breakpoint, cont}
  +        | {'$gen_component', bp, msg_in_bp_waiting, pid()}
  +        | {'$gen_component', bp, barrier}
  +        | {'$gen_component', bp, bp_set_cond, fun(), bp_name()}
  +        | {'$gen_component', bp, bp_set, comm:message_tag(), bp_name()}
  +        | {'$gen_component', bp, bp_del, bp_name()}.
  +
  +-type bp() ::
  +        {bp, MsgTag :: comm:message_tag(), bp_name()}
  +      | {bp_cond, Condition :: fun(), bp_name()}.
  +
  +-type bp_state() :: {[bp()],
  +                     boolean(),
  +                     [bp_message()],
  +                     boolean(),
  +                     pid() | unknown}.
  +
  +-type component_state() ::
  +        {Options :: list(), Slowest :: float(), bp_state()}.
   
   %% userdevguide-begin gen_component:behaviour
   -spec behaviour_info(atom()) -> [{atom(), arity()}] | undefined.
  
positive.code:     {'$gen_component', [{on_handler, Handler}], State}.
  
  %% @doc perform a post op, i.e. handle a message directly after another
  -spec post_op(State, Message::comm:message())
          -> {'$gen_component', [{post_op, Message::comm:message()}], State}.
  post_op(State, Message) ->
      {'$gen_component', [{post_op, Message}], State}.
  
  %% requests regarding breakpoint processing
  -spec bp_set(Pid::comm:erl_local_pid(), MsgTag::comm:message_tag(), BPName::any()) -> ok.
  bp_set(Pid, MsgTag, BPName) ->
      Pid ! {'$gen_component', bp, bp_set, MsgTag, BPName},
      ok.
  
  %% @doc Module:Function(Message, State, Params) will be evaluated to decide
  %% whether a BP is reached. Params can be used as a payload.
  -spec bp_set_cond(Pid::comm:erl_local_pid(),
                    Cond::{module(), atom(), 2} | fun((comm:message(), State::any()) -> boolean()),
                    BPName::any()) -> ok.
  bp_set_cond(Pid, {_Module, _Function, _Params = 2} = Cond, BPName) ->
      Pid ! {'$gen_component', bp, bp_set_cond, Cond, BPName},
      ok;
  
negative.code:             {Module, On, Message}
      end.
  
  -spec bp_cont(pid()) -> ok.
  bp_cont(Pid) ->
      Pid !  {'$gen_component', bp, breakpoint, cont},
      ok.
  
  %% @doc delay further breakpoint requests until a breakpoint actually occurs
  -spec bp_barrier(pid()) -> ok.
  bp_barrier(Pid) ->
      Pid ! {'$gen_component', bp, barrier},
      ok.
  