IDEBool IDEAPI IDERunYourSelfArgv // COMPILE A PROGRAM ( IDEDllHdl hdl, // - handle for this instantiation int argc, // - # of arguments char **args, // - argument vector IDEBool* fatal_error ) // - addr[fatality indication] { //**************************** // Do a compile of a file //**************************** jmp_buf env; char infile[_MAX_PATH]; // - input file name char outfile[4 + _MAX_PATH]; // - output file name (need room for "-fo=") char **argv = NULL; int ret; TBreak(); // clear any pending IDEStopRunning's *fatal_error = FALSE; FatalEnv = &env; if( (ret = setjmp( env )) != 0 ) { /* if fatal error has occurred */ *fatal_error = TRUE; } else { argv = getFrontEndArgv( args, argc, infile, outfile ); ret = FrontEnd( argv ); } if( !GlobalCompFlags.ide_cmd_line_has_files ) { free( argv ); } #if HEAP_CHK == 1 heap_check(); #endif return( ret != 0 ); }
IDEBool IDEAPI IDERunYourSelf // COMPILE A PROGRAM ( IDEDllHdl hdl // - handle for this instantiation , const char* opts // - options , IDEBool* fatal_error ) { // - addr[fatality indication] //**************************** // Do a compile of a file //**************************** jmp_buf env; char infile[_MAX_PATH]; // - input file name char outfile[4 + _MAX_PATH]; // - output file name (need room for "-fo=") char *argv[4]; int ret; hdl = hdl; TBreak(); // clear any pending IDEStopRunning's *fatal_error = FALSE; FatalEnv = &env; if( (ret = setjmp( env )) != 0 ) { /* if fatal error has occurred */ *fatal_error = TRUE; } else { argv[0] = (char *)opts; argv[1] = NULL; getFrontEndArgv( argv, 0, infile, outfile ); ret = FrontEnd( argv ); } #if HEAP_CHK == 1 heap_check(); #endif #ifdef __OS2__ _heapmin(); #endif return( ret != 0 ); }
TOKEN ChkControl( void ) { int lines_skipped; ppctl_t old_ppctl; if( !CompFlags.doing_macro_expansion ) { if( CompFlags.cpp_output ) { PrintWhiteSpace = FALSE; } } while( CurrChar == '\n' ) { if( TBreak() ) { CErr1( ERR_BREAK_KEY_HIT ); CSuicide(); } lines_skipped = 0; old_ppctl = CompFlags.pre_processing; for( ; CurrChar != EOF_CHAR; ) { if( CompFlags.cpp_output ) { CppPrtChar( '\n' ); } NextChar(); if( CurrChar != PreProcChar ) { SkipAhead(); } if( CurrChar == EOF_CHAR ) break; if( CurrChar == PreProcChar ) { /* start of comp control line */ PPCTL_ENABLE_EOL(); PPCTL_DISABLE_MACROS(); PreProcStmt(); PPFlush2EOL(); CompFlags.pre_processing = old_ppctl; } else if( NestLevel != SkipLevel ) { PPCTL_ENABLE_EOL(); PPCTL_DISABLE_MACROS(); PPNextToken(); /* get into token mode */ PPFlush2EOL(); CompFlags.pre_processing = old_ppctl; } if( NestLevel == SkipLevel ) break; if( CurrChar == '\n' ) { lines_skipped = 1; } } if( CompFlags.cpp_output ) { if( lines_skipped ) { if( SrcFile != NULL ) { /* 14-may-92 */ EmitLine( SrcFile->src_loc.line, SrcFile->src_name ); } } } } // we have already skipped past all white space at the start of the line CurToken = T_WHITE_SPACE; // CurToken = ScanToken(); return( T_WHITE_SPACE ); }
static void CheckEvents( void ) /*********************************/ { uint ticks; ticks = GetTickCnt(); if( ticks < LastBlipCount || ticks >= NextTickCount ) { OSCall(); /* force a DOS call to get version number */ if( ticks < LastBlipCount || ticks >= NextBlipCount ) { FEMessage( MSG_BLIP, NULL ); LastBlipCount = ticks; SetNextBlipCount(); } SetNextTickCount(); } if( TBreak() ) { FatalError( "Program interrupted from keyboard" ); } }
static bool CompSProg( void ) { bool fini_subprog; InitSubProg(); fini_subprog = FALSE; for(;;) { for(;;) { if( CurrFile->flags & INC_PENDING ) { CurrFile->flags &= ~INC_PENDING; ProcInclude(); ComRead(); } else if( CurrFile->flags & CONC_PENDING ) { if( ( ProgSw & PS_DONT_GENERATE ) && ( ( Options & OPT_SYNTAX ) == 0 ) && ( ( ProgSw & PS_ERROR ) == 0 ) && ( CurrFile->link == NULL ) ) break; Conclude(); if( CurrFile == NULL ) break; ComRead(); } else { break; } } Options = NewOptions; if( ProgSw & ( PS_SOURCE_EOF | PS_END_OF_SUBPROG ) ) break; CompStatement(); if( ProgSw & ( PS_SOURCE_EOF | PS_END_OF_SUBPROG ) ) { // consider: call sam // end // c$include sam // Before we open 'sam', we must finish off the subprogram // so we get the correct file name in the traceback. FiniSubProg(); fini_subprog = TRUE; } if( TBreak() ) return( TRUE ); } if( !fini_subprog ) { FiniSubProg(); } return( FALSE ); }
IDEBool IDEAPI IDERunYourSelf // COMPILE A PROGRAM ( IDEDllHdl hdl // - handle for this instantiation , const char* opts // - options , IDEBool* fatal_error ) // - addr[ fatality indication ] { DLL_DATA dllinfo; // - information passed to DLL auto char input[1+_MAX_PATH+1]; // - input file name ("<fname>") auto char output[4+1+_MAX_PATH+1];//- output file name (-fo="<fname>") hdl = hdl; DbgVerify( hdl == CompInfo.idehdl , "RunYourSelf -- handle mismatch" ); TBreak(); // clear any pending IDEStopRunning's initDLLInfo( &dllinfo ); dllinfo.cmd_line = (char*)opts; fillInputOutput( input, output ); WppCompile( &dllinfo, input, output ); *fatal_error = (IDEBool)CompFlags.fatal_error; return( (IDEBool)CompFlags.compile_failed ); }
IDEBool IDEAPI IDERunYourSelfArgv(// COMPILE A PROGRAM (ARGV ARGS) IDEDllHdl hdl, // - handle for this instantiation int argc, // - # of arguments char **argv, // - argument vector IDEBool* fatal_error ) // - addr[ fatality indication ] { DLL_DATA dllinfo; // - information passed to DLL auto char input[1+_MAX_PATH+1]; // - input file name ("<fname>") auto char output[4+1+_MAX_PATH+1];//- output file name (-fo="<fname>") hdl = hdl; DbgVerify( hdl == CompInfo.idehdl , "RunYourSelf -- handle mismatch" ); TBreak(); // clear any pending IDEStopRunning's initDLLInfo( &dllinfo ); dllinfo.argc = argc; dllinfo.argv = argv; fillInputOutput( input, output ); WppCompile( &dllinfo, input, output ); *fatal_error = (IDEBool)CompFlags.fatal_error; return( (IDEBool)CompFlags.compile_failed ); }
static void CheckEvents() { /*****************************/ if( TBreak() ) { FatalError( "Program interrupted from keyboard" ); } }
unsigned ExecProg( bool tracing, bool do_flip, bool want_wps ) { bool have_brk_at_ip; bool act_wps; bool first_time; mad_trace_how how; execute_state es; unsigned conditions; unsigned run_conditions; bool already_stopping; bool force_stop; if( !want_wps ) ++InCall; tracing = TraceStart( tracing ); WriteDbgRegs(); first_time = true; es = ES_NORMAL; run_conditions = 0; if( !HaveRemoteAsync() ) { DUIPlayDead( true ); } how = MTRH_STOP; for( ;; ) { switch( es ) { case ES_FORCE_BREAK: case ES_NORMAL: if( tracing ) { how = TraceHow( false ); } else { _SwitchOn( SW_EXECUTE_LONG ); how = MTRH_BREAK; } break; case ES_STEP_ONE: how = TraceHow( true ); break; } if( how == MTRH_STOP ) break; switch( how ) { case MTRH_BREAK: DbgUpdate( UP_CSIP_JUMPED ); _SwitchOn( SW_TOUCH_SCREEN_BUFF ); /* fall through */ case MTRH_SIMULATE: case MTRH_STEP: case MTRH_STEPBREAK: if( _IsOff( SW_TOUCH_SCREEN_BUFF ) ) break; /* fall through */ default: if( !(ScrnState & USR_SCRN_ACTIVE) && do_flip ) { DUIStop(); } _SwitchOff( SW_TOUCH_SCREEN_BUFF ); break; } if( first_time ) { /* got to be down here so that SW_EXECUTE_LONG is properly set */ SetThreadStates(); first_time = false; } have_brk_at_ip = InsertBPs( (es == ES_FORCE_BREAK) ); act_wps = UpdateWPs(); if( how == MTRH_BREAK ) { if( have_brk_at_ip ) { es = ES_STEP_ONE; RemoveBPs(); continue; /* back to top */ } if( act_wps && want_wps ) { InsertWPs(); } } SetMemBefore( tracing ); switch( how ) { case MTRH_SIMULATE: if( TraceSimulate() ) { conditions = COND_TRACE; break; } /* fall through */ case MTRH_STEP: /* only updates stack/execution */ conditions = DoRun( true ); break; default: /* only updates stack/execution */ conditions = DoRun( false ); break; } if( _IsOn( SW_EXECUTE_LONG ) ) { if( ScrnState & DBG_SCRN_ACTIVE ) { _SwitchOn( SW_MIGHT_HAVE_LOST_DISPLAY ); } _SwitchOff( SW_EXECUTE_LONG ); } SetMemAfter( tracing ); run_conditions &= ~COND_WATCH; run_conditions |= conditions; RemoveBPs(); if( conditions & COND_MESSAGE ) { if( !RecordMsgText( &conditions ) ) { conditions &= ~COND_MESSAGE; } } conditions = CheckBPs( conditions, run_conditions ); if( _IsOn( SW_BREAK_ON_DEBUG_MESSAGE ) && ( conditions & COND_MESSAGE ) ) { conditions |= COND_STOP; } if( HaveRemoteAsync() && (conditions & COND_THREAD ) ) { conditions |= COND_STOP; } if( how == MTRH_STEPBREAK && (conditions & COND_BREAK) && DbgTmpBrk.status.b.hit ) { conditions &= ~COND_BREAK; conditions |= COND_TRACE; } if( conditions & COND_LIBRARIES ) { already_stopping = ( conditions & COND_STOPPERS ) != 0; conditions &= ~COND_LIBRARIES; force_stop = false; if( AddLibInfo( already_stopping, &force_stop ) ) { if( force_stop || DLLMatch() ) { conditions |= COND_STOP | COND_LIBRARIES; } } ReMapPoints( NULL ); } if( conditions & COND_SECTIONS ) { SectTblRead( DbgRegs ); InvalidateTblCache(); } if( (es == ES_STEP_ONE) && (conditions & COND_TRACE) ) { conditions &= ~COND_TRACE; } if( tracing ) { conditions = TraceCheck( conditions ); } if( !(conditions & COND_STOPPERS) && TBreak() ) { conditions |= COND_USER; break; } if( conditions & COND_STOPPERS ) break; switch( es ) { case ES_STEP_ONE: es = ES_FORCE_BREAK; break; case ES_FORCE_BREAK: es = ES_NORMAL; break; } if( (run_conditions & COND_WATCH) && es == ES_NORMAL ) { /* We got a spurious watch point indication. Make the next instruction single step since we might be dealing with a control flow opcode on a machine without a T-bit (e.g. Alpha). */ es = ES_STEP_ONE; } } TraceStop( tracing ); DUIPlayDead( false ); SetProgState( run_conditions ); _SwitchOff( SW_KNOW_EMULATOR ); if( !want_wps ) --InCall; return( conditions ); }
void ChkBreak( void ) { if( TBreak() ) Error( ERR_NONE, LIT_ENG( ERR_DBG_INTERRUPT ) ); }