PARSE_FUNCTION

Previous  Next

 

PARSE_FUNCTION( funcname, mb_interpreter*, void** )

 


 

Declares aMyBASIC2 parsing function.  The second parameter is the mb_interpreter pointer and the third is the standard pointer to AST chain.  These will be passed to the BEGIN_PARSE macro.  A PERSE_FUNCTION must be ended with END_PARSE_FUNCTION.

 

Note; If you're creating an Extension Library using MFC, the macro will insert the required AFX_MANAGE_STATE( AfxGetStaticModuleState() ) to make sure that the state of MFC is correct in case the DLL is dynamically linked againts the MFC DLLs.

 

Example

 

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

// Returns the Windows Folder

//

PARSE_FUNCTION( mb_ext_getwinfolder, s, l )

  {

  BEGIN_PARSE( s, l )

     POP_INT( nFolderID )

  END_PARSE

 

  char szFolder[_MAX_PATH+1];

    

  if ( !SHGetSpecialFolderPath( NULL, szFolder, nFolderID, FALSE ) )

     {

     RETURN_ERROR( SE_RN_INVALID_ARGUMENT );

     }

  endif

 

  RETURN_STRCPY( szFolder );

  }

END_PARSE_FUNCTION