Exemplo n.º 1
0
Arquivo: exec.c Projeto: moxley/parse1
struct t_value * exec_stmt(struct t_exec *exec)
{
  struct t_value *res;
  struct t_token *token;
  
  debug(1, "%s(): Calling parse_stmt()\n", __FUNCTION__);
  if (parse_stmt(&exec->parser) < 0) {
    res = NULL;
  }
  else {
    debug(1, "%s(): Calling exec_run()\n", __FUNCTION__);
    if (exec_run(exec) < 0) {
      res = NULL;
    }
    else {
      res = list_pop(&exec->stack);
    }
  }
  
  token = parser_token(&exec->parser);
  
  if (!res) {
    while (token->type != TT_EOL && token->type != TT_EOF) {
      token = parser_next(&exec->parser);
    }
  }
  
  while (token->type == TT_EOL) {
    token = parser_next(&exec->parser);
  }
  
  return res;
}
Exemplo n.º 2
0
Arquivo: exec.c Projeto: moxley/parse1
int exec_statements(struct t_exec *exec)
{
  if (parse(&exec->parser) < 0) {
    return -1;
  }
  
  if (exec_run(exec) < 0) {
    return -1;
  }
  
  return 0;
}
Exemplo n.º 3
0
int32_t exec_runprog(const uint8_t &progNum)
{			   
	if (progNum!=0 && (progNum>EXEC_MAX_PROGS || g_progTable[progNum-1]==NULL))
		return -1;

	g_execArg = 0;

	if (progNum==0) // default program!
		prm_get("Default program", &g_program, END);
  	else
		g_program = progNum-1;
	return exec_run();
}
Exemplo n.º 4
0
void Tmainwin::cmd_runscript()
{
	if (G_curscript()==NULL)
	{
		reporterror(this,_text("There is no script present"));
		return;
	}
	G_3DCosmos().Reset_requeststop();
	QString error;
	scriptaction_pre();
	if (!exec_run(error))
//	if (!G_curscript()->exec_run(error))
	{
		scriptaction_post();
		scriptsourceview->scrollinside_sel();
		reporterror(this,error);
	}
	else scriptaction_post();
}
Exemplo n.º 5
0
int main(int argc, char** argv){
  if(argc != 2){
    printf("Usage: sacs <source-file>\n");
    return 0;
  }

  struct asm_binary* bin = asm_parse_file(argv[1]);

  mem_init();
  mem_dynamic_alloc(0x400000,MEM_FAKE_ALLOC|MEM_USE_LOCKED);
  uint32_t loc = mem_dynamic_alloc(bin->size,MEM_USE_LOCKED);
  assert(loc == 0x400000);
  memcpy(mem_translate_addr(loc),bin->binary,bin->size);

  struct exec_stats_t* stats = exec_run(loc,loc,loc+bin->data_segment);

  mem_cleanup();

  printf("C: %d\nIC: %d\nNOPs: %d\n",stats->c,stats->ic,stats->nopc);
  return 0;
}
Exemplo n.º 6
0
Arquivo: exec.cpp Projeto: hateif/pixy
int32_t exec_runprog(const uint8_t &progNum, Chirp *chirp)
{
    uint8_t progNum2 = progNum;

    if (chirp)
    {
        g_programChirp = progNum2;
        g_execArgChirp = 0;
    }
    if (g_programChirp>=0) // if PixyMon is setting program, it overrides
        progNum2 = g_programChirp;

    g_program = 0;
    if (progNum2>=EXEC_MAX_PROGS || g_progTable[progNum2]==NULL)
        return -1;

    if (g_programChirp>=0) // if PixyMon is setting program, save arg too
        g_execArg = g_execArgChirp;
    else
        g_execArg = 0;

    g_program = progNum2;
    return exec_run();
}
Exemplo n.º 7
0
Arquivo: exec.c Projeto: Yomi0/jesus
void
exec_execute(Efm_File *f)
{
    const char *name, *mime_type;
    Eina_List *mime_types;
    Efreet_Desktop *icon;

    eo_do(f, mime_type = efm_file_mimetype_get());

    // first check in config for a "special" open wish
    name = eina_hash_find(config->mime_type_open, mime_type);

    if (!name)
      {
         mime_types = efreet_util_desktop_mime_list(mime_type);
         if (!mime_types)
           return;

         icon = eina_list_data_get(mime_types);
      }
    else
      icon = efreet_util_desktop_name_find(name);
    exec_run(icon, f);
}
Exemplo n.º 8
0
void exec_loop()
{
	uint8_t state = 0;
	bool prevConnected = false;
	bool connected;

	exec_select();

	while(1)
	{
		connected = g_chirpUsb->connected();

		exec_periodic();

		switch (state)
		{
		case 0:	// setup state
			led_set(0);  // turn off any stray led
			if ((*g_progTable[g_program]->setup)()<0)
				state = 3; // stop state
			else 
				state = 1; // loop state
			break;

		case 1:	 // loop state
			if (g_override)
			{
				// need to stop M0 because it's using the same memory and can possibly interfere.
				// For example if we try to grab a raw frame while M0 is running (gathering RLS values)
				// M0 could overwrite the frame memory with RLS scratch data.
				exec_stopM0(); 
				state = 2; // override state
			}
			else if (!g_run  || (*g_progTable[g_program]->loop)()<0)
				state = 3; // stop state
			else if (prevConnected && !connected) // if we disconnect from pixymon, revert back to default program
			{
				exec_runprog(0); // run default program
				state = 0; // setup state
			}
			break;

		case 2:	// override state
			if (!g_override) 
				state = 0; // back to setup state
			break;

		case 3:	// stop state
			// set variable to indicate we've stopped
			g_run = false;
			g_running = false;
			// stop M0
			exec_stopM0();
			state = 4; // wait for run state
			break;

		case 4:	// wait for run state
			if (g_run) 
			{
				exec_run();
				state = 0; // back to setup state
			}
			else if (!connected || !USB_Configuration) // if we disconnect from pixy or unplug cable, revert back to default program
			{
				exec_runprog(0); // run default program
				state = 0;	// back to setup state
			}
			break;

		default:
			state = 3; // stop state				
		}

		prevConnected = connected;
	}
}
Exemplo n.º 9
0
int main (void)
{
	exec_init();
	exec_run();	
	return 0;
}