Esempio n. 1
0
	void process( QFile &file, const Billon &billon )
	{
		QXmlStreamWriter stream;
		init(file,stream);
		appendTags( stream, billon );
		appendPith( stream, billon, 0 );
		startComponents(stream);
		appendComponent( stream, billon, 0, 1 );
		endComponents(stream);
		close(stream);
	}
Esempio n. 2
0
void App::runNormal()
{
   bool componentsStarted = false;
   RunMode runMode;

   // init data objects
   initDataObjects(argc, argv);

   // check if mgmt host is defined if mode is not "help"
   runMode = this->cfg->determineRunMode();
   if ( (runMode != RunMode_INVALID) && !cfg->getSysMgmtdHost().length() )
      throw InvalidConfigException("Management host undefined");

   // tests
   if ( cfg->getDebugRunStartupTests() )
   {
      if ( !StartupTests::perform() )
      {
         this->log->log(1, "Startup Tests failed => shutting down...");
         appResult = APPCODE_RUNTIME_ERROR;
         return;
      }
   }

   // init components

   try
   {
      initComponents();

      // tests
      if(cfg->getDebugRunComponentTests() )
      {
         if(!ComponentTests::perform() )
         {
            this->log->log(1, "Component Tests failed => shutting down...");
            appResult = APPCODE_RUNTIME_ERROR;
            return;
         }
      }
   }
   catch(ComponentInitException& e)
   {
      log->logErr(e.what() );
      log->log(1, "A hard error occurred. Shutting down...");
      appResult = APPCODE_INITIALIZATION_ERROR;
      return;
   }


   // log system and configuration info

   logInfos();


   // detach process

   try
   {
      if(this->cfg->getRunDaemonized() )
         daemonize();
   }
   catch(InvalidConfigException& e)
   {
      log->logErr(e.what() );
      log->log(1, "A hard error occurred. Shutting down...");
      appResult = APPCODE_INVALID_CONFIG;
      return;
   }


   // start component threads

   if(this->cfg->getDebugRunComponentThreads() )
   {
      startComponents();

      componentsStarted = true;

      // tests
      if(cfg->getDebugRunIntegrationTests() )
      {
         if(!IntegrationTests::perform() )
         {
            this->log->log(1, "Integration Tests failed => shutting down...");
            appResult = APPCODE_RUNTIME_ERROR;

            stopComponents();
            goto err_joinAndExit;
         }
      }

      appResult = executeMode(runMode);

      // self-termination
      stopComponents();
   }


err_joinAndExit:
   if(componentsStarted)
   {
      joinComponents();
      log->log(3, "All components stopped. Exiting now!");
   }
}
Esempio n. 3
0
//void startComponents(memory);
int main(int argc, char *argv[])
{

  signal(SIGINT, intHandler);

  init_memory(memory);

  reset_cpu(&cpu);
  struct _vic vicstruct;
  vic = &vicstruct;
  init_display(vic);

  // handling parameter --memory <dumpfile>
  if(argc==3){
    if(!strcmp(argv[1], "--memory")){
      printf("Loading %s into memory\n", argv[2]);
      read_memorydump(argv[2], memory);
    }
  }
  // handling parameter --binary <dumpfile>
  if(argc==4){
    if(!strcmp(argv[1], "--binary")){
      int adr =0;
      sscanf(argv[3], "%4x ", &adr);

      printf("Loading %s into memory at 0x%04x\n", argv[2], adr);
      // testvector
      read_binary_memorydump(argv[2], memory, adr);
      // cl-6502
      //      read_binary_memorydump(argv[2], memory, 0x0000);
    }
  }
  startComponents(memory,&cpu);
  vic->videobase = 0x200;
  printf("Video memory base at %04x\n", vic->videobase);

  draw_bitmap_memory(&cpu, vic, memory); // draw_memory(memory+videobase);


  print_cpu_dis(&cpu,memory);
  while(1){
	// read input
	// parse input
	// do the stuff

    char *line = read_line();
    int z = parse_line(&cpu, memory, line);

    fetch(&cpu, memory);
    exec(&cpu, memory);

    print_cpu_dis(&cpu,memory);
    while(z){
      line = read_line();
      z = parse_line(&cpu, memory, line);
    }
    draw_bitmap_memory(&cpu, vic, memory);

  }

  printf("quit repl and cpu ..\n");
  SDL_Quit();
  exit(0);
  //  quit_monitor();
  return 0;
}