IF_END_PARSE

Previous  Next

 

IF_END_PARSE( bool-var )

 


 

This macro checks if end bracket and stops any further parameter parsing.  Sets the supplied BOOL argument to TRUE if stopped.  This is useful if you have 2 different parameters syntax with different amount of parameters.  For example, see GRID.SetFont where we have 2 forms, short and long form.

 

Example

 

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

  {

  AFX_MANAGE_STATE( AfxGetStaticModuleState() );

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

 

  BEGIN_PARSE( s, l )

     POP_INT( nControl )

     POP_STRING( lpszName )

     IF_END_PARSE( bShortFrom )

     POP_INT( nSize )

     POP_INT( nWeight )

     POP_INT( bItalic )

     POP_INT( bUnderLine )

  END_PARSE

 

  if ( bShortFrom )

     {

     // We're using short form with String Font Argument

 

     LOGFONT lf;

     CStringFont font( lpszName );

     font.ToFont( &lf );

 

     mb_free( lpszName );

     mb_malloc( strlen( font.GetFontName( &lf ) ) + 1 );

     strcpy( lpszName, font.GetFontName( &lf ) );

     nSize = font.GetFontSize( &lf );

     nWeight = font.IsFontBold( &lf ) ? FW_BOLD : FW_NORMAL;

     bItalic = font.IsFontItalic( &lf );

     bUnderLine = FALSE;

     }

  endif

 

  int nRet = g_this->SetFont( nControl, lpszName, nSize, nWeight, bItalic, bUnderLine );

 

  RETURN_INT( nRet );

  }

endfunc