示例#1
0
int ShowUserByName(int argc, char *argv[])
{
  struct mqelem *top;
  char buf[BUFSIZ];

  top = GetUserInfo(BY_NAME, argv[1], argv[2]);

  if (!top)		/* if there was an error then return. */
    return DM_NORMAL;

  if (!PromptWithDefault("Print full information, or just the names (f/n)?",
			 buf, 2, "f"))
    return DM_NORMAL;

  switch (buf[0])
    {
    case 'F':
    case 'f':
      Loop(top, PrintUserInfo);
      break;
    case 'N':
    case 'n':
      Loop(top, PrintUserName);
      break;
    }

  FreeQueue(top);
  return DM_NORMAL;
}
int
D3DOverdrawWindow::
Graph(Array<t_edge>& Edge)
{
    m_iTested = 0;
    m_iRendered = 0;
    d3d->BeginScene();

    for (int i = 0; i < m_pClusterStart->GetSize() - 1; i++)
    {
        for (int j = i + 1; j < m_pClusterStart->GetSize() - 1 ; j++)
        {
            int cij = Loop(i, j);
            //debugf(("%d %d -> %d", i, j, cij));
            int cji = Loop(j, i);

            //debugf(("%d %d -> %d", j, i, cji));
            if (cij > cji)
            {
                t_edge e = {j, i, cij - cji};

                if (!Edge.PushBack(e))
                {
                    // out of memory
                    return 0;
                }

            }
            else if (cij < cji)
            {
                t_edge e = {i, j, cji - cij};

                if (!Edge.PushBack(e))
                {
                    // out of memory
                    return 0;
                }
            }
        }
    }

    debugf(("Fraction rendered: %f ", m_iRendered / (float)m_iTested));
    /*
    printf("p %d %d\n", m_pClusterStart->GetSize()-1, Edge.GetSize());
    for (int i = 0; i < Edge.GetSize(); i++)
        printf("a %d %d %d\n", Edge[i].from, Edge[i].to, Edge[i].cost);
    */
    d3d->EndScene();
    return 1;
}
示例#3
0
文件: tasks.c 项目: chch1028/rtems
rtems_task Test_task(
  rtems_task_argument task_index
)
{
  uint32_t          cpu_num;
  char              name[5];
  char             *p;

  /* Get the task name */
  p = rtems_object_get_name( RTEMS_SELF, 5, name );
  rtems_test_assert( p != NULL );

   /* Get the CPU Number */
  cpu_num = rtems_smp_get_current_processor();

  /* Print that the task is up and running. */
  Loop();
  locked_printf(" CPU %" PRIu32 " running Task %s\n", cpu_num, name);

  /* Set the flag that the task is up and running */
  TaskRan[cpu_num] = true;


  /* Drop into a loop which will keep this task on
   * running on the cpu.
   */
  while(1);
}
示例#4
0
int ListByAdministrator(int argc, char **argv)
{
  char buf[BUFSIZ], temp_buf[BUFSIZ], *type, *name;
  struct mqelem *top;

  type = strdup("USER");
  if (GetTypeFromUser("Type of member", "member", &type) == SUB_ERROR)
    return DM_NORMAL;

  sprintf(buf, "Name of %s", type);
  name = strdup(user);
  if (GetValueFromUser(buf, &name) == SUB_ERROR)
    return DM_NORMAL;

  switch (YesNoQuestion("Do you want a recursive search (y/n)", FALSE))
    {
    case TRUE:
      sprintf(temp_buf, "R%s", type);	/* "USER" to "RUSER" etc. */
      free(type);
      type = strdup(temp_buf);
      break;
    case FALSE:
      break;
    default:
      return DM_NORMAL;
    }

  top = GetListInfo(ACE_USE, type, name);
  Loop(top, PrintListAce);

  FreeQueue(top);
  return DM_NORMAL;
}
示例#5
0
void CCrossDlg::SetInfo(const INFO& Info)
{
	SetPos(Info.Pos);
	SetSeconds(Info.Seconds);
	Loop(Info.Loop);
	SetWaveform(Info.Waveform);
}
示例#6
0
int ShowNFSService(int argc, char **argv)
{
  int stat;
  struct mqelem *elem = NULL;
  char *args[10];

  if (!ValidName(argv[1]))
    return DM_NORMAL;

  args[0] = canonicalize_hostname(strdup(argv[1]));
  args[1] = strdup(DEFAULT_DIR);
  if (GetValueFromUser("Directory:", &args[1]) == SUB_ERROR)
    return DM_NORMAL;

  if ((stat = do_mr_query("get_nfsphys", 2, args, StoreInfo, &elem)))
    com_err(program_name, stat, " in ShowNFSServices.");
  free(args[0]);
  free(args[1]);		/* prevents memory leaks. */

  elem = QueueTop(elem);
  Loop(elem, (void (*)(char **)) PrintNFSInfo);

  FreeQueue(elem);
  return DM_NORMAL;
}
示例#7
0
void WindowLoop(void (*Loop)())
{
	struct timespec ts[3];
	int done = 0;
	XEvent event;

	clock_gettime(CLOCK_MONOTONIC, ts+2);
	ts[0] = ts[1] = ts[2];


	while(!done)
	{
    XQueryPointer(display, window, &window_returned,
         &window_returned, &root_x, &root_y, &win_x, &win_y,
         &mask_return);


    glEnable (GL_BLEND);
    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

		Loop();
		glXSwapBuffers(display, window);
		frame++;
		clock_gettime(CLOCK_MONOTONIC, ts+(frame%2));
		dtime = 1e-9*(ts[frame%2].tv_nsec - ts[!(frame%2)].tv_nsec) + (ts[frame%2].tv_sec - ts[!(frame%2)].tv_sec);
		ftime = 1e-9*(ts[frame%2].tv_nsec - ts[2].tv_nsec) + (ts[frame%2].tv_sec - ts[2].tv_sec);
	}

	//WindowKill(0);
}
示例#8
0
int UserBySponsor(int argc, char **argv)
{
  char buf[BUFSIZ], temp_buf[BUFSIZ], *type, *name;
  struct mqelem *top;

  type = strdup("USER");
  if (GetTypeFromUser("Type of sponsor", "search_ace_type", &type) == SUB_ERROR)
    return DM_NORMAL;

  sprintf(buf, "Name of %s", type);
  name = strdup(user);
  if (GetValueFromUser(buf, &name) == SUB_ERROR)
    return DM_NORMAL;

  switch (YesNoQuestion("Do you want a recursive search (y/n)", FALSE))
    {
    case TRUE:
      sprintf(temp_buf, "R%s", type);     /* "USER to "RUSER", etc. */
      free(type);
      type = strdup(temp_buf);
      break;
    case FALSE:
      break;
    default:
      return DM_NORMAL;
    }

  top = GetUserBySponsor(type, name);
  Loop(top, PrintLogin);

  FreeQueue(top);
  return DM_NORMAL;
}
示例#9
0
文件: Pong.cpp 项目: zarac/tgspu
void Pong::Play(void)
{
	pixels[4*width+5] = 0;
	playing = true;
	while (playing)
		Loop();
}
示例#10
0
int main(int argc, char* argv[])
{
	int sock; 

	if (argc < 3)
	{
		printf("usage: %s <ip addr> <port>\n",argv[0]);
		exit(1);
	}

	if (! SetupPrimesense() )
		return 1;

	if (! SetupBuffers() )
		return 1;

	sock = SetupClient(argv[1],argv[2]);
	
	GetTargetScreenSize(sock);
	
	Loop(sock);

	TeardownPrimesense();

	return 0;
}
示例#11
0
void LoopB0(TString cutconfig="newcutopt8"){

  TH1D* Loop(TTree*,double,double,int);
  TH1D* LoopGen(TTree*,double,double);
  
  TString infname_data="Original/testOriginal.root";

  TFile *inf_data = new TFile(infname_data.Data());
  
  TTree *nt_data = (TTree*) inf_data->Get("ntKstar");
    
  TH1D *hMass1=Loop(nt_data,10.,60.,1);
    
  TCanvas*canvas=new TCanvas("canvas","canvas",1000,500);
  canvas->Divide(3,1);
  canvas->cd(1);
  hMass1->Draw();
  canvas->SaveAs("canvasLoop.pdf");
  
  TFile*fB0output=new TFile(Form("ResultsLoopBzero/B0output_%s.root",cutconfig.Data()),"recreate");
  fB0output->cd();
  hMass1->SetName("hMass1");
  hMass1->Write();
  fB0output->Close();

}
示例#12
0
文件: SDLWin.cpp 项目: Rocks25/Voa
int SDLWin::Run()
{
	WM->CreateSDLWindow();										// Initialize SDL
	WM->InitOpenGL();											// Initialize OpenGL
	Game->InitResources();
	Game->Pause();												// Switch to Menu Mode
	WM->GetRenderer()->Init();									// Initialize Renderer
	InitGeometry();												// Create Menus
	InitTextures();												// Initialize Menu Textures
	WM->GetRenderer()->To2D();									// Switch to 2D Rendering

    SDL_Event Event;											// Create an event variable for catching events that SDL sends
    while(WM->IsRunning())									// Main Loop starts here
    {
        if(SDL_PollEvent(&Event)) {
			GEM->ProcessEvent(&Event);				// Send Events to the 'Events' function for processing
        }
		if(WM->IsActive())
		{
			Loop();						// Game loop processing
			Render();					// Draw to the screen
			_CrtCheckMemory( );
		}
		SDL_Delay(TimeLeft());			// Limit the frame rate
    }

    Cleanup();							// Once everything is done, make sure to clean up all loose ends
    return 1;							// Return 1 so that we know everything went fine
}
示例#13
0
文件: Client.cpp 项目: airtrack/snet
int main(int argc, const char **argv)
{
    if (argc != 4)
    {
        fprintf(stderr, "Usage: %s ServerIP Port Key\n", argv[0]);
        return 1;
    }

    auto event_loop = snet::CreateEventLoop();
    snet::TimerList timer_list;

    Server server(argv[1], atoi(argv[2]), argv[3],
                  event_loop.get(), &timer_list);

    if (!server.IsListenOk())
    {
        fprintf(stderr, "Listen address %s:%d error\n",
                SOCKS5_LISTEN_IP, SOCKS5_LISTEN_PORT);
        return 1;
    }

    snet::TimerDriver timer_driver(timer_list);
    event_loop->AddLoopHandler(&timer_driver);
    event_loop->Loop();

    return 0;
}
示例#14
0
文件: CApp.cpp 项目: roxygen/Oxygen
int CApp::Execute() {
    if(Init() == false) {
        std::cout << "Init unsuccesed\n";
        return -1;
    }
    std::cout << "Init succesed\n";
    mStateManager->Change(CStateIntro::Instance(), this);
    
    while(!mDone) {
        loop_tick = 0;
        while( SDL_GetTicks() > next_game_tick && loop_tick < MAX_FRAMESKIP)
        {
            while( SDL_PollEvent(&mEvent) ) {
                Event();
            }
            Loop();
            next_game_tick += SKIP_TICKS;
            loop_tick++;
        }
        Render();
    }
    
    Cleanup();
    return 0;
}
示例#15
0
/*** Main ***/
int main( int argc, char** argv )
{
  Init();    // Inicializo recursos

  /* Conteo del tiempo */
  struct timeval iTime = { 0, 0 };
  struct timeval fTime = { 0, 0 };
  float elapsed        = 0.0f;
  gettimeofday( &iTime, NULL );

  /* Loop Init */
  while( !g_ExitProgram )
  {
      gettimeofday( &fTime, NULL );                            // Tiempo Actual
      elapsed = ( fTime.tv_usec - iTime.tv_usec ) / 1000000.0f // Microsegundos
	        + ( fTime.tv_sec - iTime.tv_sec );             // Segundos
      iTime = fTime;                                           // Actualizo el tiempo

      Loop( elapsed );    // Mensajes y Loop(video, sonido, input, etc...)
  }
  /* Loop End */

  Free();    // Libero Recursos
  
  return 0;
}
示例#16
0
int App::Run()
{
	// Comprobamos que se ha llamado a RegisterExecutableDir para establecer la ruta del ejecutable
	if (m_executableDir == "")
	{
		log << "[ERROR] No se ha definido la ruta del ejecutable. ";
		log << "LLamar a App::RegisterExecutableDir() antes que a App::Run()";
		log << std::endl;

		return GGE::StatusAppInitFailed;
	}

	// Cambiamos los aplicacion a ejecutandose
	m_running = true;

	// PreInit() Se encarga de 2 cosas:
	// 1) Abrir el archivo de configuración
	// 2) Crear la ventana con los valores obtenidos del archivo
	PreInit();

	// Init() Se encarga de crear el SceneManager y cargar la primera escena
	Init();

	// Loop() Implementa el bucle de la aplicación
	Loop();

	// Cleanup() Se encarga de eliminar todos los objetos creados
	Cleanup();

	// Código de salida de la aplicación
	return m_exitCode;
}
示例#17
0
int main(int argc, char **argv)
{ 
	int i;
	unsigned long t;
    
	setvbuf(stdout, (char *) NULL, _IOLBF, 0);
	if (argc != 2 && argc != 3)
	{
		fprintf(stderr, "syntax: %s input_file [-r]\n", argv[0]);
		return 1;
	}
	if (*argv[1] == '-')
	{
		fprintf(stderr, "syntax: %s input_file [-r]\n", argv[0]);
		return 1;
	}
	if ((FP = fopen(argv[1], "r")) == NULL)
	{
		fprintf(stderr, "%s: cannot open input file %s\n", argv[0], argv[1]);
		return 1;
	}
	if (argc == 3)
	{
		if (strcmp(argv[2], "-r") == 0)
		{
			Redir = (char *) RedirPrefix;
			fprintf(stdout, "%s\n", argv[0]);
		}
		else
		{
			fprintf(stderr, "syntax: %s input_file [-r]\n", argv[0]);
			return 1;
		}
	}
	memset(Mem, 0, MEMSIZE * sizeof(unsigned));
	for (i = PCINIT; !feof(FP); i += 4)
	{
		if (fgets(Buf, BUFSIZE, FP) == NULL)
		{
			if (feof(FP))
				break;
			fprintf(stderr, "%s: file %s reading error\n", argv[0], argv[1]);
			return 1;
		}
		if (sscanf(Buf, "%lx", &t) != 1)
		{
			fprintf(stderr, "%s: file %s error in line %d, continue...\n",
                    argv[0], argv[1], i - PCINIT + 1);
			MEM(i) = 0;
		}
		else
		{
			MEM(i) = strtoul(Buf, (char **) NULL, 16);
		}
	}
	Loop();
	fclose(FP);
	return 0;
}
示例#18
0
文件: main.c 项目: Monty1991/reck
int main(int argc, char **argv)
{
  Init();
  Loop();
  CleanUp();

  return 0;
}
示例#19
0
int main(int argc, char *argv[]) {
  userthread_id ut_id;
  UserThreadInit();
  UserThreadCreate(&ut_id, ThreadFunc, "I am thread 1");
  UserThreadCreate(&ut_id, ThreadFunc, "I am thread 2");
  Loop();
  return 0;
}
示例#20
0
文件: hlib.cpp 项目: vanhieubk/HLib
/**
 @brief main function of the program. Implement Setup(), Loop() framework of the HLib library
 @return No meaning
*/
int main(void){
  /* Looping framework */
  HLib::HLib_Start();
  Setup();
  while (1){
    Loop();
  }
}
示例#21
0
TreeReader::TreeReader()
{
			std::string tempFileName = "singleRun_richtig.root";
      f = new TFile(tempFileName.c_str(),"UPDATE");
      tree = (TTree*)gDirectory->Get("entered");
   	  Init(tree);
			Loop();
}
示例#22
0
int main (){

  Initialize();
  Loop();
  Shutdown();

  exit(0);
}
示例#23
0
文件: printer.c 项目: jdreed/moira
int GetPrnByContact(int argc, char **argv)
{
  struct mqelem *top;

  top = GetPrnInfo(argv[1], BY_CONTACT); /* get info. */
  Loop(top, (void (*)(char **)) PrintPrnInfo);
  FreeQueue(top);		/* clean the queue. */
  return DM_NORMAL;
}
示例#24
0
文件: printer.c 项目: jdreed/moira
int GetPrnByLocation(int argc, char **argv)
{
  struct mqelem *top;

  top = GetPrnInfo(argv[1], BY_LOCATION); /* get info. */
  Loop(top, (void (*)(char **)) PrintPrnInfo);
  FreeQueue(top);		/* clean the queue. */
  return DM_NORMAL;
}
示例#25
0
文件: printer.c 项目: jdreed/moira
int GetPrnByHostname(int argc, char **argv)
{
  struct mqelem *top;

  top = GetPrnInfo(argv[1], BY_HOSTNAME); /* get info. */
  Loop(top, (void (*)(char **)) PrintPrnInfo);
  FreeQueue(top);		/* clean the queue. */
  return DM_NORMAL;
}
示例#26
0
int GetFS(int argc, char **argv)
{
  struct mqelem *top;
  char *fs_label;

  fs_label = argv[1];

  top = GetFSInfo(ALIAS_CHECK, argv[1]);
  if (top != NULL) {
    Loop(top, (void (*)(char **))GetFSLabel);
    fs_label = labelbuf;
  }

  top = GetFSInfo(LABEL, fs_label); /* get info. */
  Loop(top, (void (*)(char **))PrintFSInfo);
  FreeQueue(top);		/* clean the queue. */
  return DM_NORMAL;
}
示例#27
0
int GetACL(int argc, char **argv)
{
  struct mqelem *top;

  top = GetACLInfo(argv[1], argv[2]);
  Loop(top, (void (*)(char **)) PrintACLInfo);
  FreeQueue(top);		/* clean the queue. */
  return DM_NORMAL;
}
示例#28
0
文件: Timer.cpp 项目: marmysh/FX-Lib
void Timer::MainLoop()
{
	uint32_t timeoutInMs = 0;

	for (; m_continue; m_event.AcquireInMs(timeoutInMs))
	{
		timeoutInMs = Loop();
	}
}
示例#29
0
void MulVsDiv::BenchAll()
{
	Loop();
	//LoopVectorized();
	//DynamicArrayLoop();
	//DynamicArrayLoopVectorized();
	//DependendDynamicArrayLoop();
	//CsabaDynamicArrayLoop();
}
示例#30
0
void LoopESCCalibration (void)
{
	
	Menu_LoadPage(PAGE_HOME_ESC_CALIBRATION);
	while (1)
	{
		Loop();
	}		
		
}