Skip to content
ionous edited this page Apr 6, 2016 · 1 revision

Brief summary of interface changes between versions.

Changes

Version 0.5

|| In progress ||

  • Lua support is coming, changes to the builder as it gets exercised more.
  • builder code has moved under the hsm directory

Version 0.4

  • changed/unified the interface of enter, exit, etc. callbacks using a new struct: hsm_status ( see below )
  • simplifies the declaration of machines with context data ( see below )
  • makes info callbacks global ( instead of per-statemachine ), and adds more things you can listen for.
  • shrinks HSM_MAX_DEPTH from 32 to 16
  • separates "test" code into actual unit tests ( in "/test" ) and separate "/samples"
  • add the HsmBuilder interface
  • greatly improved the doxygen based documentation

The depth changes and the callbacks going global were to support the simplified context machine decl. and still keep the size of the core statemachine object small. The core hsm_machine_t had been 24 bytes, now it's 16 bytes. Adding a context stack ( by, using hsm_context_machine_t instead of hsm_machine_t ) brings it up to 32 bytes.

  // instead of callbacks looking like this:
  hsm_state MyStateEvent( hsm_machine_t*hsm, hsm_context_t*ctx,   WatchEvent* evt )
  {
  }

  // they now look like this:
  hsm_state MyStateEvent( hsm_status status )
  {
     // everything is still there, and a little more:
     // status->hsm, status->ctx, status->evt
     //
     // and also:
     // status->state
  }
// was:
    hsm_machine_t hsm;
    hsm_context_stack_t stack;
    HsmMachine( &hsm, &stack, NULL );
    HsmStart( &hsm, &context, first_state );

// now:
    hsm_context_machine_t hsm;
    HsmMachineWithContext( &hsm, &context );   
    HsmStart( &hsm, first_state );

Version 0.1

  • original distribution
Clone this wiki locally