mb_attempt_open_bracket

Previous  Next

 

status_t mb_attempt_open_bracket( mb_interpreter_t* s, void** l )

 


 

Checks that a registered  function with parameters starts with an open bracket (parentheses)

 

Example

 

/////////////////////////////////////////////////////////////////////////////

//

int _std_asc( mb_interpreter_t* s, void** l )

  {

  /* Get the ASCII code of a character */

 

  char* arg = 0;

 

  mb_assert( s && l );

 

  mb_check( mb_attempt_open_bracket( s, l ) );

  mb_check( mb_pop_string( s, l, &arg ) );

  mb_check( mb_attempt_close_bracket( s, l ) );

 

  if ( ( arg[0] == '\0' ) || ( safe_strlen( arg ) > 1 ) )

     {

     mb_set_error( s, l, SE_RN_CHAR_EXPECTED );

 

     return MB_FUNC_ERR;

     }

  endif

 

  mb_check( mb_push_int( s, l, (int_t)arg[0] ) );

 

  return MB_FUNC_OK;

  }

endfunc