mb_load_string_ex |
status_t mb_load_string_ex( mb_interpreter_t* s, const char* pBuffer, uint_t dwOptions )
This is an extended version of mb_load_string. It loads a string containing source code into the interpreter. The mb_load_file/mb_load_file_ex calls this function after it has read the source file into a buffer. You can call this function instead of mb_load_file/mb_load_file_ex if you want to read the source code from some other source than a file or if you want to do your own file handling.
The extended version has these additional parameters:
dwOptions - MB_LOAD_NORMAL No additional options MB_LOAD_ONCE Used for include files to indicate that it should only be included once (see $INCLUDE) MB_LOAD_INC Indicates that this is an Include File MB_LOAD_CHECKONLY Will only check that the file exists MB_LOAD_NOSYSFILES Prevents System Include and Llibrary files to be loaded
Example
// Load the script
if ( bFileMode ) { nStatus = mb_load_file_ex( m_bas, strFileName, NULL, NULL, dwRunOptionFlags ); } else { nStatus = mb_load_string_ex( m_bas, strSourceCode, dwRunOptionFlags ); } endif
if ( nStatus == MB_FUNC_OK ) { // Check if we need to start debugger (ALT Pressed)
if ( bDebug ) { if ( !StartDebugger() ) { AfxMessageBox( "WARNING: Unable to start Basic Script Debugger" ); } endif } endif
// Prevent Application from exiting while running script SetNoExit( TRUE );
// Set Run-Time Environment mb_set_environment( m_bas, m_nRunTimeEnvironment );
// Run the script mb_run( m_bas );
// Stop Debugger if enabled mb_debug_enable( m_bas, MB_DBG_ENABLE_NONE, 0 );
// Reset Interpreter mb_reset( &m_bas, false );
// Ok to Exit SetNoExit( FALSE ); } endif
|