mb_get_state

Previous  Next

 

mb_state_v mb_get_state( mb_interpreter_t* s )

 


 

Returns information about the state of the interpreter.  The information is returned as a structure defined as:

 

typedef struct mb_state_v

  {

  uint_t            id;

  uint_t            parent_id;

  mb_state_e        state;  

  } mb_state_v;

 

Parent ID will be 0 if this is top level interpreter.  The States are defined as enum flags.

 

typedef enum mb_state_e

  {

  MB_STATE_NIL         = 0x0000,

  MB_STATE_INVALID     = 0x0000,

  MB_STATE_OPEN        = 0x0001,

  MB_STATE_PARSED      = 0x0002,

  MB_STATE_RUNNING     = 0x0004,

  MB_STATE_SUSPENDED   = 0x0008,

  }

  mb_state_e;

 

Example

 

mb_state_v state;

 

state = mb_get_state( bas );

 

// Make sure we're open but not running

if ( ( state.state & MB_STATE_OPEN ) &&

   !( state.state & MB_STATE_RUNNING ) )

{

  mb_run( bas );

}