Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
    UNUSED_PARAMETER(argc);
    UNUSED_PARAMETER(argv);

    if (!Startup())
    {
        Shutdown();
        return 1;
    }

    MainLoop();

    Shutdown();
    return 0;
}
Ejemplo n.º 2
0
//------------------------------------------------------------  main()
//
int main(int argc, char **argv)
{		
	
	if ( !(subject_name = Parser(argc, argv)) ) 		// Parsea la linea de comandos: 	parser.c
		exit (1);			
	
	OnInit();						//Inicializa todo lo inicializable: sdlgl_control.h	
	
	ExperimentSetup(); 				//Configura el experimento
	MainLoop();						//Lanza el experimento propiamente dicho
	ExperimentSave();				//Salva los resultados en un archivo
	
	OnExit();						//Cierra limpiamente todico: sdlgl_control.h
	
	return APPSUCCESS;
}
Ejemplo n.º 3
0
int main(int argc, char *argv[]) {
	// set input_file, output_file
	strcpy(input_file, "data/small-data.txt");
	strcpy(input_file2, "data/rand-data.txt");
	if (argc == 2) strcpy(input_file, argv[1]);

	// MainLoop (for presentation)
	MainLoop();
	
	//build_test();
	//query_key_test();
	//query_range_test();
	//modify_test();
	//delete_test();
	return 0;
}
Ejemplo n.º 4
0
int wmain(int argc, WCHAR* argv[])
{
    LARGE_INTEGER lint;
    DWORD Written;
    COORD Coord = { 0, 0 };

    myself = GetModuleHandle(NULL);

    GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
                               &ScreenBufferInfo);
    ScreenBufferInfo.dwSize.X = ScreenBufferInfo.srWindow.Right - ScreenBufferInfo.srWindow.Left + 1;
    ScreenBufferInfo.dwSize.Y = ScreenBufferInfo.srWindow.Bottom - ScreenBufferInfo.srWindow.Top + 1;
    ScreenBuffer = CreateConsoleScreenBuffer(GENERIC_WRITE,
                                             0,
                                             NULL,
                                             CONSOLE_TEXTMODE_BUFFER,
                                             NULL);
    if (ScreenBuffer == INVALID_HANDLE_VALUE)
    {
        wprintf(L"%s: could not create a new screen buffer\n", app_name);
        return EXIT_FAILURE;
    }

    /* Fill buffer with black background */
    FillConsoleOutputAttribute(ScreenBuffer,
                               0,
                               ScreenBufferInfo.dwSize.X * ScreenBufferInfo.dwSize.Y,
                               Coord,
                               &Written);

    WaitableTimer = CreateWaitableTimer(NULL, FALSE, NULL);
    if (WaitableTimer == INVALID_HANDLE_VALUE)
    {
        wprintf(L"CreateWaitabletimer() failed\n");
        return 1;
    }
    lint.QuadPart = -2000000;
    if (!SetWaitableTimer(WaitableTimer, &lint, 200, NULL, NULL, FALSE))
    {
        wprintf(L"SetWaitableTimer() failed: 0x%lx\n", GetLastError());
        return 2;
    }
    SetConsoleActiveScreenBuffer(ScreenBuffer);
    MainLoop();
    CloseHandle(ScreenBuffer);
    return EXIT_SUCCESS;
}
Ejemplo n.º 5
0
int main(int argc, const char** argv)
{
	cfg::LoadParams(argc, argv);			

	GPUHandle::Init(cfg::dev_id);	

	LoadRawData(graph_data, raw_string, labels);
	LoadTrainIndexes(cfg::train_idx_file, train_idx, graph_data, raw_string, labels);
	LoadTestIndexes(cfg::test_idx_file, test_idx, inv_test_idx, graph_data, raw_string, labels);

	InitModel();

    MainLoop(); 
	
	GPUHandle::Destroy();
	return 0;
}
Ejemplo n.º 6
0
  i32 TCPServer::StartRoutine()
  {
    int status;

    // allow the socket to take connections listen(已建立、尚未连接的套接字号,连接队列的最大长度)
    status = listen(m_ServerSocket, 1);
    if(status == SOCKET_ERROR)
    {
      CLOG_ERROR("ERROR: listen unsuccessful\r\n");
      return (i32)SocketResult_CanotListen;
    }

    CLOG("Waiting for connection...\r\n");

    MainLoop();
    return 0;
  }
Ejemplo n.º 7
0
int main2() {
  // Install standard binary operators.
  // 1 is lowest precedence.
  BinopPrecedence['<'] = 10;
  BinopPrecedence['+'] = 20;
  BinopPrecedence['-'] = 20;
  BinopPrecedence['*'] = 40;  // highest.

  // Prime the first token.
  fprintf(stderr, "ready> ");
  getNextToken();

  // Run the main "interpreter loop" now.
  MainLoop();

  return 0;
}
Ejemplo n.º 8
0
int
main(int argc, char** argv)
{
	gRequestPort = find_port(kPortNameReq);
	if (gRequestPort < B_OK) {
		fprintf(stderr, "%s\n", strerror(gRequestPort));
		return gRequestPort;
	}

	gReplyPort = find_port(kPortNameRpl);
	if (gReplyPort < B_OK) {
		fprintf(stderr, "%s\n", strerror(gReplyPort));
		return gReplyPort;
	}

	return MainLoop();
}
Ejemplo n.º 9
0
Archivo: Home.cpp Proyecto: nooro/Kagan
Home::Home()
{
    //Initialize the window
    window = SDL_CreateWindow("Kagan III - Home", 0, 0, 0, 0, SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP);
    if(window == NULL)
        cout << "Failed to initialize the home window: " << SDL_GetError() << endl;

    //Initialize the renderer
    renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    if(renderer == NULL)
        cout << "Failed to initialize the renderer: " << SDL_GetError() << endl;

    //Initialize the size of the cursor
    cursorRect.w = 35;
    cursorRect.h = 35;
    //Hide the default cursor
    SDL_ShowCursor(false);

    //Initialize the Chiller font
    font_chiller = TTF_OpenFont("Resources/Fonts/Chiller.ttf", 999);

    //Initialize the user-name input label texture
    InitTheUsernameLabel();

    //Initialize the character bar
    InitTheCharacterBar();

    //Initialize all the textures used in the home window
    InitTheTextures();

    //Initialize the play button
    InitThePlayButton();

    //Add the background texture to the renderer
    SDL_RenderCopy(renderer, backgroundTexture, NULL, NULL);

    //Add the user-name label texture to the renderer
    SDL_RenderCopy(renderer, usernameLabel, NULL, &usernameLabelRect);

    //And GOD said "Let there be light!". (aka show everything to the screen)
    SDL_RenderPresent(renderer);

    homeWindowIsActive = true;
    MainLoop();
}
Ejemplo n.º 10
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{
	HWND hWnd;
 
	int screenWidth = GetSystemMetrics(SM_CXSCREEN);
	int screenHeight = GetSystemMetrics(SM_CYSCREEN);

	hWnd = CreateMyWindow("Савельев", screenWidth, screenHeight, 1, true, hInstance);
 
	// Выходим при ошибке
	if(hWnd == NULL) return TRUE;
 
	// Инициализируем OpenGL
	Init(hWnd);
 
	// Запускаем игровой цикл
	return MainLoop();
}
Ejemplo n.º 11
0
int BannerWindow::Run()
{
	int choice = -1;

	while(choice == -1)
	{
		usleep(50000);

		if (shutdown) //for power button
			Sys_Shutdown();
		else if (reset) //for reset button
			Sys_Reboot();

		choice = MainLoop();
	}

	return choice;
}
Ejemplo n.º 12
0
WPARAM
CGame::Start()
{
	m_quit = false;							// Bool Variable To Exit Loop
	bool fullscreen = false;

	// Create Our OpenGL Window
	if (!CGLRender::Instance().CreateGLWindow(m_windowTitle,1024,768,32,fullscreen))
	{
		return 0;									// Quit If Window Was Not Created
	}

	while(!m_quit)									// Loop That Runs While done=FALSE
	{
		
		if (CInputManager::Instance().CheckInput())
			;
		else {
			// Draw The Scene.  Watch For ESC Key And Quit Messages From DrawGLScene()
			if (CGLRender::Instance().getActive())						// Program Active?
			{
				CGLRender::Instance().StartGLScene();					// Draw The Scene
				MainLoop();
				//CGLRender::Instance().drawFloor();
				CGLRender::Instance().EndGLScene();	
				
			} if (CInputManager::Instance().KeyState(VK_F1)) {
				CInputManager::Instance().KeyUp(VK_F1);
				CGLRender::Instance().KillGLWindow();						// Kill Our Current Window
				fullscreen=!fullscreen;									// Toggle Fullscreen / Windowed Mode
				
				// Recreate Our OpenGL Window
				if (!CGLRender::Instance().CreateGLWindow(m_windowTitle,1024,768,32,fullscreen))
				{
					return 0;						// Quit If Window Was Not Created
				}
			}
		}
	}

	// Shutdown
	CGLRender::Instance().KillGLWindow();			// Kill The Window
	return 0;							// Exit The Program
}
Ejemplo n.º 13
0
void Zoo::Run() {
  rank_ = communication_.Rank();

  srand(rand() + rank_);

  for (int i = 0; i < 4; i++) {
    ship_.requests_[i] = requests_[i];
    port_.requests_[i] = requests_[i];
  }

//  communication_.ReceiveAll(port_.requests_, Tag::kRequest);
//  communication_.ReceiveAll(port_.requests_, Tag::kReply);
//
  communication_.ReceiveAll(ship_.requests_[int(Tag::kRequest)], Tag::kRequest);
  communication_.ReceiveAll(ship_.requests_[int(Tag::kReply)], Tag::kReply);
  communication_.ReceiveAll(ship_.requests_[int(Tag::kAcquire)], Tag::kAcquire);
  communication_.ReceiveAll(ship_.requests_[int(Tag::kRelease)], Tag::kRelease);
  MainLoop();
}
Ejemplo n.º 14
0
int		main(int argc, char **argv)
	{
	#define mDNSRecord mDNSStorage
	mDNS_PlatformSupport	platformStorage;
	mStatus					err;

	bzero(&mDNSRecord, sizeof mDNSRecord);
	bzero(&platformStorage, sizeof platformStorage);

	ParseCmdLinArgs(argc, argv);

	err = mDNS_Init(&mDNSRecord, &platformStorage, gRRCache, RR_CACHE_SIZE, mDNS_Init_AdvertiseLocalAddresses, 
					mDNS_Init_NoInitCallback, mDNS_Init_NoInitCallbackContext); 

	if (mStatus_NoError == err)
		err = udsserver_init();
		
	Reconfigure(&mDNSRecord);

	// Now that we're finished with anything privileged, switch over to running as "nobody"
	if (mStatus_NoError == err)
		{
		const struct passwd *pw = getpwnam("nobody");
		if (pw != NULL)
			setuid(pw->pw_uid);
		else
			LogMsg("WARNING: mdnsd continuing as root because user \"nobody\" does not exist");
		}

	if (mStatus_NoError == err)
		err = MainLoop(&mDNSRecord);
 
	mDNS_Close(&mDNSRecord);

	if (udsserver_exit() < 0)
		LogMsg("ExitCallback: udsserver_exit failed");
 
 #if MDNS_DEBUGMSGS > 0
	printf("mDNSResponder exiting normally with %ld\n", err);
 #endif
 
	return err;
	}
Ejemplo n.º 15
0
void MainProgram::Run()
{
  //Init stuff which are needed before the main loop
  if (InitSystems())
  {
    //if the systems initialized properly
    //Enter the loop
    MainLoop();
  }

  //end program
  SDL_DestroyRenderer(m_renderer.GetRenderer());
  SDL_DestroyWindow(m_window.GetWindow());

  m_window.SetNull();
  m_renderer.SetNull();

  SDL_Quit();
}
Ejemplo n.º 16
0
//---------------------------------------------------------------------------
CATResult CATApp::Run()
{
    CATResult result = CAT_SUCCESS;

    result = OnStart();

    // If starting failed, then bail without entering main loop.
    if (CATFAILED(result))
    {
        return result;
    }

    result = MainLoop();

    // Pass the result from the MainLoop into OnEnd.
    result = OnEnd(result);

    return result;
}
Ejemplo n.º 17
0
void main(int argc, char **argv)
{
  MyProgram mydata;

  mydata.bitmap = (char *)malloc(100*100);  /* a 100x100 bitmap */
  if (mydata.bitmap == NULL)
   {
     fprintf(stderr, "Fooey, no memory for bitmap.\n");
     exit(10);
   }
  mydata.bitmap_width   = 100;
  mydata.bitmap_height  = 100;

  init_display(argc, argv, &mydata);  /* setup the display */

  fill_in_bitmap(&mydata);            /* put some stuff in the bitmap */

  MainLoop();                         /* go right into the main loop */
}
Ejemplo n.º 18
0
//====================================
// Main
//====================================
int main(int argc, char* argv[]){ 
    // Change this line to use your name!
    m_yourName = "Anda Li";

    if(Init(argc, argv) == true){
#if _WIN32
		// Glut callbacks
		glutDisplayFunc(MainLoop);
		glutKeyboardFunc(KeyCallback);

		// Start Glut's main loop
		glutMainLoop();
#else 
		MainLoop();
#endif
    }

    return 0;
}
Ejemplo n.º 19
0
INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow )
{
	FILE *f=fopen("bass.dll","rb");
	if (f)
	{
		fclose(f);
		DebugStart=false;
		int MemUsage=0;
		if ((GetSystemMetrics(SM_CXSCREEN)>=1024 && GetSystemMetrics(SM_CYSCREEN)>=768) || strstr(GetCommandLine(),"-fullscreen") && !strstr(GetCommandLine(),"-windowed"))
		{
	#ifndef Public_Release
			LastClickedToolTip="ADVANCED DIGITAL DYNAMITE INTRO CREATION TOOL V1.97";
	#else
			LastClickedToolTip="ADVANCED DIGITAL DYNAMITE INTRO CREATION TOOL V1.97 PUBLIC RELEASE";
	#endif
			SetupEnvironment();
			if (strstr(GetCommandLine(),"-fullscreen") || (GetSystemMetrics(SM_CXSCREEN)==1024 && GetSystemMetrics(SM_CYSCREEN==768)) && !strstr(GetCommandLine(),"-windowed")) fullscreen=true;
	#ifndef Public_Release
			Intro_CreateWindow("a.D.D.i.c.t. V1.97 (Build Date: " __DATE__ " " __TIME__ ")\0", 1024, 768, 32, fullscreen, LoadIcon(hInstance, MAKEINTRESOURCE(101)));
	#else
			Intro_CreateWindow("a.D.D.i.c.t. V1.97 Public Release (Build Date: " __DATE__ " " __TIME__ ")\0", 1024, 768, 32, fullscreen, LoadIcon(hInstance, MAKEINTRESOURCE(101)));
	#endif
			InitRadiosityStuff();
			
			WGLSWAPINTERVALEXT wglSwapIntervalEXT = (WGLSWAPINTERVALEXT) wglGetProcAddress("wglSwapIntervalEXT");
			if (wglSwapIntervalEXT && fullscreen) wglSwapIntervalEXT(1); // enable vertical synchronisation
		
			//InitDemoSave();
			InitGUI();
			initVertexBlend();
			MainLoop();
			//DeinitDemoSave();
			ReleaseDC(hWnd,hDC);
			if (fullscreen)	ChangeDisplaySettings(NULL,0);
			return 0;
		}
		else
		MessageBox( 0, "Sorry a.D.D.i.c.t. 2 requires at least a screen resolution of 1024x768 pixels.", "Error!", MB_OK );
	}
	else MessageBox( 0, "bass.dll not found", "Error!", MB_OK );
	return 0;
}
Ejemplo n.º 20
0
Client::Client(int delay, int memorySize, int numMessages, bool random, int msgSize){
	totalMem = memorySize;
	sleepTime = delay;
	msgsMax = numMessages;
	Mutex* mutex = new Mutex();
	mutex->Lock();
	hFileMap = CreateFileMapping(
		INVALID_HANDLE_VALUE,
		NULL,
		PAGE_READWRITE,
		(DWORD)0,
		memorySize,
		(LPCWSTR) "shared");

	size_t* help;
	mData = (char*)MapViewOfFile(hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
	help = (size_t*)mData;
	mControl = help;
	help += 101;
	mData = (char*)help;

	if (GetLastError() == ERROR_ALREADY_EXISTS)
		ownsMemory = false;
	else{
		ownsMemory = true;
		std::fill(mControl + 1, mControl + 100, 1);
	}

	bool foundTail=false;
	clientId = 0;
	while (foundTail == false){
		mControl++;
		clientId++;
		if (*mControl == 1){
			foundTail = true;
			*mControl = 0;
			mutex->~Mutex();
		}
	}
	
	MainLoop();
}
Ejemplo n.º 21
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{	
	// Create the main window and offset the height by the menu pixel height
	HWND hWnd = CreateMyWindow("www.GameTutorials.com - MapEditor(1)", 
			    			   SCREEN_WIDTH, SCREEN_HEIGHT + MENU_OFFSET, 0, hInstance);

	// If we never got a valid window handle, quit the program
	if(hWnd == NULL) return TRUE;

	// Create our tool bar window offset by the scroll bar pixel width and to compensate
	// for the small title bar we offset the height with the menu offset
	g_hWndTool = CreateToolWindow(hWnd, "", TILE_WIDTH + SCROLL_BAR_OFFSET, HEIGHT + MENU_OFFSET, 
								  WS_POPUP| WS_SYSMENU | WS_CAPTION , hInstance);

	// Initialize our important things after the window is created
	Init(hWnd);													

	// Run our message loop and after it's done, return the result
	return (int)MainLoop();						
}
Ejemplo n.º 22
0
HRESULT ColladaLoader::Run()
{
	StartLogging();

	if(!Initialize()) {
        StopLogging();
        return -1;
    } else {
        SetupShaders();
        SetupMatrices();
        SetupLights();
        SetupGeometry();
        MainLoop();
        Terminate();
        StopLogging();
    }

	return 0;

}
Ejemplo n.º 23
0
/*****************************************************************************
 * Run: main loop
 *****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
    if( p_intf->pf_show_dialog )
    {
        /* The module is used in dialog provider mode */

        /* Create a new thread for the dialogs provider */
        if( vlc_thread_create( p_intf, "Skins Dialogs Thread",
                               MainLoop, 0, VLC_TRUE ) )
        {
            msg_Err( p_intf, "cannot create Skins Dialogs Thread" );
            p_intf->pf_show_dialog = NULL;
        }
    }
    else
    {
        /* The module is used in interface mode */
        MainLoop( p_intf );
    }
}
Ejemplo n.º 24
0
void ServerConsole::Run()
{
    CPrintf(CON_CMDOUTPUT, COL_RED "-Server Console initialized (%s-V0.1)-\n" COL_NORMAL, appname);

    // Run any script files specified on the command line with -run=filename.
    csRef<iCommandLineParser> cmdline = csQueryRegistry<iCommandLineParser>(objreg);
    csRef<iVFS> vfs = csQueryRegistry<iVFS>(objreg);
    if (cmdline && vfs)
    {
        const char *autofile;
        for (int i = 0; (autofile = cmdline->GetOption("run", i)); i++)
        {
            csRef<iDataBuffer> script = vfs->ReadFile(autofile);
            if (script.IsValid())
                ExecuteScript(*(*script));
        }
    }

    MainLoop();
}
Ejemplo n.º 25
0
void InitGame( char* ScreenName, int Width, int Height )
{
    LGame.Window = SDL_CreateWindow( ScreenName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, Width, Height, SDL_WINDOW_SHOWN );
    if( LGame.Window )
    {
        LGame.Renderer =  SDL_CreateRenderer( LGame.Window, -1, SDL_RENDERER_ACCELERATED );
        if( LGame.Renderer )
        {
            LGame.Surface = SDL_GetWindowSurface( LGame.Window );
            if( LGame.Surface )
            {
                if( IMG_Init( IMG_INIT_PNG ) )
                {
                    LGame.ScreenWidth = Width;
                    LGame.ScreenHeight = Height;
                    InitBackground( );
                    InitPlayer( );
                    LGame.Gravity = 4.25f;
                    LGame.bRunning = true;
                    MainLoop( );   
                }
                else
                {
                    printf( "Failed to init IMG %s\n", IMG_GetError( ) );
                }
            }
            else
            {
                printf( "Failed to create surface %s\n", SDL_GetError( ) );
            }
        }
        else
        {
            printf( "Failed to create renderer %s\n", SDL_GetError( ) );
        }
    }
    else
    {
        printf( "Failed to Create window %s\n", SDL_GetError( ) );
    }
}
Ejemplo n.º 26
0
int main ( int argc, char** argv )
{
    srand(time(NULL));
    _automatic_terminator at;
	SDL_Init(SDL_INIT_TIMER);
/* [TEMP] [ALISTAIR] with 4.1, apparently an argv is thrown in, causing the assertion below to fail
#ifndef NDEBUG
    if (argc > 1)
    {
        assert(!strcmp(argv[1], "-test"));
		assert(argc > 2);
		std::string test = argv[2];
		std::vector<std::string> testParameters;
		if (argc > 3)
		{
			for (int i = 3; i < argc; i++)
			{
				testParameters.push_back(std::string(argv[i]));
			}
		}
		bool testReturnCode = TestHarness::InvokeTest ( test, testParameters );
		if (testReturnCode)
		{
			return 0;
		}
		else
		{
			return -1;
		}
    }
#else
	if (0)
	{
	}
#endif
    else
    {
[TEMP]*/        MainLoop();
    // [TEMP]    }
    return 0;
}
Ejemplo n.º 27
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprev, PSTR cmdline, int ishow)
{	
	HWND hWnd;

	// Check if we want full screen or not
	if(MessageBox(NULL, "Click Yes to go to full screen (Recommended)", "Options", MB_YESNO | MB_ICONQUESTION) == IDNO)
		g_bFullScreen = false;
	
	// Create our window with our function we create that passes in the:
	// name, width, height, any flags for the window, if we want fullscreen of not, and the hInstance.
	hWnd = CreateMyWindow("www.GameTutorials.com - 3DS Animation", SCREEN_WIDTH, SCREEN_HEIGHT, 0, g_bFullScreen, hInstance);

	// If we never got a valid window handle, quit the program
	if(hWnd == NULL) return true;

	// INIT OpenGL
	Init(hWnd);													

	// Run our message loop and after it's done, return the result
	return (int)MainLoop();						
}
Ejemplo n.º 28
0
/*!
 *     @brief
 *          The main function of the project.
 *     @param
 *          void
 *     @return
 *          int
 */
int main(void)
/*lint -restore Enable MISRA rule (6.3) checking. */
{
    /* Write your local variable definition here */

    /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
    PE_low_level_init();
    /*** End of Processor Expert internal initialization.                    ***/

    /* Write your code here */
    /* For example: for(;;) { } */
    (void)TestApp_Init(); /* Initialize the USB Test Application */
    /* Initialize on-chip and peripheral devices */
#if DEBUG
    GPIOTest();
    printf("+UserInit begins...\n");
#endif
    UserInit();
#if DEBUG
    printf("-UserInit finished.\n");
#endif

#if DEBUG
    GPIOTest();
#endif
    
    Init_State = 200;//Init is OK
    /* The main loop */
    MainLoop();

    /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
  #ifdef PEX_RTOS_START
    PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
  #endif
  /*** End of RTOS startup code.  ***/
  /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
  for(;;){}
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
Ejemplo n.º 29
0
int main ( int argc, char** argv )
{
    srand(time(NULL));
    _automatic_terminator at;
	SDL_Init(SDL_INIT_TIMER);
#ifndef NDEBUG
    if (argc > 1)
    {
        assert(!strcmp(argv[1], "-test"));
		assert(argc > 2);
		std::string test = argv[2];
		std::vector<std::string> testParameters;
		if (argc > 3)
		{
			for (int i = 3; i < argc; i++)
			{
				testParameters.push_back(std::string(argv[i]));
			}
		}
		bool testReturnCode = TestHarness::InvokeTest ( test, testParameters );
		if (testReturnCode)
		{
			return 0;
		}
		else
		{
			return -1;
		}
    }
#else
	if (0)
	{
	}
#endif
    else
    {
        MainLoop();
    }
    return 0;
}
Ejemplo n.º 30
0
//top main
int main(int argc, char **argv){
	DB(fprintf(stderr,"IN main()\n"));
	//argment analysis
	OPT serv_op;
	InitOpt(&serv_op);
	GetOpt(argc-1,argv+1,&serv_op);
	DB(fprintf(stderr,"n_file :%s:\n",serv_op.n_file));
	DB(fprintf(stderr,"data file :%s:\n",serv_op.db_file));
	DB(fprintf(stderr,"default service :%s:\n",SERVICE_NAME));
	DB(fprintf(stderr,"sub port :%d:\n",serv_op.port));

	//init global vars
	InitBuf(&RecvBuf,SHORT_BUF_SIZE);
	InitBuf(&CommBuf,LONG_BUF_SIZE);

	//init socket
	if(InitSocket(SERVICE_NAME,serv_op.port) == -1){
		return(-1);
	}

	//init signal - bind()
	InitSignal();

	//listen
	listen(Soc,SOMAXCONN);

	//data read
	read_db_n(serv_op);
        read_db_term(serv_op);

	//mainloop - data read, accept(), fork(), ChildLoop()
	MainLoop(serv_op);

	//close socket
	CloseSocket();

	DB(fprintf(stderr,"OUT main()\n"));
	return(0);
}