Example #1
0
int main(void)
{
    init();
    while (true) {
        main_step();
    }
}
Example #2
0
int main(void)
{
    main_init();
    while(1) {
        main_step();
    }
}
Example #3
0
/* executed on the actual hardware */
void main_realtime(int argc, char *argv[])
{
   main_init(argc, argv);
   main_realtime_init();
   interval_t interval;
   interval_init(&interval);
   DATA_DEFINITION();
   PERIODIC_THREAD_LOOP_BEGIN
   {
      dt = interval_measure(&interval);
      sensor_status = platform_read_sensors(&marg_data, &gps_data, &ultra_z, &baro_z, &voltage, &current, channels);
      main_step(dt, &marg_data, &gps_data, ultra_z, baro_z, voltage, current, channels, sensor_status, 0);
   }
   PERIODIC_THREAD_LOOP_END
}
Example #4
0
void baseRateTask(void *arg)
{
  runModel = (rtmGetErrorStatus(main_M) == (NULL)) && !rtmGetStopRequested
    (main_M);
  while (runModel) {
    sem_wait(&baserateTaskSem);
    main_step();

    /* Get model outputs here */
    runModel = (rtmGetErrorStatus(main_M) == (NULL)) && !rtmGetStopRequested
      (main_M);
  }

  sem_post(&termSem);
  pthread_exit((void *)0);
}
Example #5
0
File: gui.c Project: adtools/db101
void main_event_handler()
{
	ULONG result;
    UWORD Code;
    static char *strinfo, *args;
	static char *path;
	int line=0;
	int *iptr;
    struct Node *node;
	uint32 addr;
	struct Process *pr;

    while ((result = RA_HandleInput(MainWinObj, &Code)) != WMHI_LASTMSG && done != TRUE)
    {
		switch (result & WMHI_CLASSMASK)
        {
        	case WMHI_CLOSEWINDOW:
            	done = TRUE;
                break;
				
			case WMHI_ICONIFY:
				if( RA_Iconify(MainWinObj) )
				mainwin = NULL;
				break;

			case WMHI_UNICONIFY:
				mainwin = RA_Uniconify(MainWinObj);
				if( !mainwin )
					done = TRUE;
				break;

			case WMHI_MENUPICK:
				if (Code != MENUNULL)
				switch (MENUNUM(Code))
				{
					case MENU_FILE:
						switch(ITEMNUM(Code))
						{
							case MENU_PREFS:
								preferences_open_window();
								break;
							case MENU_MODULES:
								modules_open_window();
								break;
							case MENU_ABOUT:
								show_about();
								break;
							case MENU_QUIT:
								done = TRUE;
								break;
						}
				}
				break;
			
            case WMHI_GADGETUP:
            switch(result & WMHI_GADGETMASK)
            {
				case GAD_SELECT_BUTTON:

					strinfo = request_file(mainwin, &path);
					if (!strinfo)
						break;

					strcpy (filename, strinfo);
					if (strlen(path) > 0)
					{
						strcpy (childpath, path);
					}

					if(!request_arguments(&args))
					{
						console_printf(OUTPUT_WARNING, "User aborted!");
						break;
					}

					main_load (strinfo, path, args);
									
                    break;
                                    
				case GAD_RELOAD_BUTTON:
								
					main_load(strinfo, path, args);
					break;
									
				case GAD_ATTACH_BUTTON:

					if(!isattached)
					{
						pr = attach_select_process();
						if(main_attach (pr))
							button_set_detach();
					}
					else
					{
						console_printf(OUTPUT_SYSTEM, "Detaching from external process...");
						detach();
						stabs_free_stabs();
						button_set_attach();
						enable(TRUE, GAD_SELECT_BUTTON, TAG_END);
						enable(FALSE, GAD_START_BUTTON, GAD_PAUSE_BUTTON, GAD_KILL_BUTTON, GAD_STEPOVER_BUTTON,
										GAD_STEPINTO_BUTTON, GAD_STEPOUT_BUTTON, GAD_SETBREAK_BUTTON, GAD_HEX_BUTTON, TAG_END);
						console_printf(OUTPUT_SYSTEM, "Done!");
					}
						
					break;

				case GAD_START_BUTTON:

					main_play();
					break;

				case GAD_PAUSE_BUTTON:

					main_pause();
					break;

				case GAD_STEPOVER_BUTTON:

					main_step();
					break;

				case GAD_STEPINTO_BUTTON:
				
					main_into();
					break;

				case GAD_STEPOUT_BUTTON:
				
					main_out();
					break;

				case GAD_KILL_BUTTON:

					main_kill();
					break;
#if 0
				case GAD_CRASH_BUTTON:

					crash();
					break;
#endif
				case GAD_SETBREAK_BUTTON:

					breakpoints_open_window();
					break;

				case GAD_VARIABLES_LISTBROWSER:
								
					variables_handle_input();
					break;

				case GAD_SIGNAL_BUTTON:
				
					sigwin_open_window();
					break;

				case GAD_IMPORT_BUTTON:
				
					import_open_window();
					break;

				case GAD_X_BUTTON:

					console_clear();
					break;

				case GAD_HEX_BUTTON:

					hex_open_window();
					break;

				case GAD_DISASSEMBLER_LISTBROWSER:
					disassembler_show_selected();
					break;
									
				case GAD_DISASSEMBLER_STEP_BUTTON:
					asmstep();
					should_continue = FALSE;
					asm_trace = TRUE;
					break;
									
				case GAD_DISASSEMBLER_SKIP_BUTTON:
					asmskip();
					disassembler_makelist();
					break;

				case GAD_SOURCE_LISTBROWSER:
					source_handle_input();
					source_show_currentline();
					break;
				
				case GAD_SOURCELIST_LISTBROWSER:
					sourcelist_handle_input();
					break;
					
				case GAD_AREXX_BUTTON:
				case GAD_AREXX_STRING:
				{
					char *str;
									
                    IIntuition->GetAttrs( MainObj[GAD_AREXX_STRING], STRINGA_TextVal, &str, TAG_DONE );
					strcpy (arexxcommandstring, str);

					arexxexecute.MethodID = AM_EXECUTE;
					arexxexecute.ape_CommandString = arexxcommandstring;
					arexxexecute.ape_PortName = "AREXXDB101";
					arexxexecute.ape_IO = (BPTR)NULL;

                    IIntuition->SetAttrs( MainObj[GAD_AREXX_STRING], STRINGA_TextVal, "", TAG_DONE );
					IIntuition->RefreshGadgets ((struct Gadget *)MainObj[GAD_AREXX_STRING], mainwin, NULL);

					console_printf(OUTPUT_AREXX, arexxcommandstring);
					IIntuition->IDoMethodA(arexx_obj, (Msg)&arexxexecute);
	
					//IIntuition->ActivateGadget((struct Gadget *)MainObj[GAD_AREXX_STRING], mainwin, NULL);
					ILayout->ActivateLayoutGadget((struct Gadget *)MainObj[GAD_TOPLAYOUT], mainwin, NULL, (uint32)MainObj[GAD_AREXX_STRING]);
					break;
				}
			}
			break;
		}
	}
	return;
}