OPT_REF

Previous  Next

 

OPT_REF( ref-value, default )

 


 

Retrieve an optional REFERENCE.  Return the default value if the parameter wasn't present.

 

Example

 

void*       pValue;

mb_data_e   type;

 

BEGIN_PARSE( s, l )

  POP_INT( nIntValue )

  OPT_REF( pRef, NULL )

END_PARSE

 

if ( pRef )

  {

  // Get the pointer and the type of variable the pointer points at

  mb_translate_reference( s, l, pRef, &pValue, &type );

 

  // If the variable pointed to by the REFERENCE is an INTEGER

  // then set the variable to the value of nIntValue

  if ( type == MB_DT_INT )

     {

     int* pInt = (int*)pValue;

     *pInt = nIntValue;

     }

  endif

  }

endif