Feature #1738

Feature #44: Implement basic introspection support

Implement participant creation and destruction hooks

Added by J. Moringen over 7 years ago. Updated about 7 years ago.

Status:ResolvedStart date:03/24/2014
Priority:NormalDue date:03/24/2014
Assignee:J. Moringen% Done:

100%

Category:Common Lisp
Target version:rsb-0.11

Associated revisions

Revision 9f6ca6da
Added by J. Moringen about 7 years ago

Mention participant creation, state change hooks in news.rst

refs #1738

  • news.rst (RSB 0.11): mention the new hooks make-participant-hook and
    participant-state-change-hook

Revision 5a8b3754
Added by J. Moringen about 7 years ago

Participant creation and state change hooks in src/variables.lisp

fixes #1738

  • src/protocol.lisp (participant): forward declaration
    (declaim special participant-state-change-hook): likewise
    (detach :around participant): new method; run
    `*participant-state-change-hook*'
    (scope): forward declaration
    (declaim special make-participant-hook): likewise
    (make-participant-using-class :around class t scope): new method; run
    `*make-participant-hook*'
  • src/variables.lisp (make-participant-hook): new variable; list of
    handlers to run when a participant is created
    (participant-state-change-hook): new variable; list of handlers to
    run when the state of a participant changes
  • src/package.lisp (package rsb): added exported
    symbols make-participant-hook and participant-state-change-hook
  • tests/protocol.lisp: new file; contains unit test for protocols;
    currently contains tests for `*make-participant-hook*' and
    `*participant-state-change-hook*'
  • cl-rsb.asd (system cl-rsb-test): added file tests/protocol.lisp

Revision 76b346c6
Added by J. Moringen about 7 years ago

Processing of make-participant-hook return values in src/protocol.lisp

refs #1738

Do not treat the hook invocation returning nil as an error but as a
request to use the constructed participant without modification.

  • src/protocol.lisp
    (make-participant-using-class :around class t scope): do not treat the
    hook invocation returning nil as an error but as a request to use the
    constructed participant without modification
  • test/protocol.lisp (buggy-handler-error): new condition class; used to
    simulate buggy handlers
    (participant-creation-error-caused-by-buggy-handler-error?) new
    function; predicate for recognizing particular error conditions
    (participant-creation-error-caused-by-buggy-handler-error): new type;
    corresponding type
    (test hooks-root::make-participant-hook/buggy-handler): instead of
    checking for a `program-error' in case of handlers returning nil,
    check for errors when handlers actually signal errors; also check new
    default behavior in case handlers return nil
  • test/package.lisp (test suite participant-suite): removed local
    function `check-participant'; turned into ordinary toplevel function
    (check-participant): new function; extracted from `participant-suite'
    test suite

History

#1 Updated by J. Moringen about 7 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100

Also available in: Atom PDF