Exemplo n.º 1
0
int main(int argc, char* argv[])
{
    for (int i = 1; i < argc; i++)
        if (!IsSwitchChar(argv[i][0]))
            fCommandLine = true;
    fDaemon = !fCommandLine;

#ifdef __WXGTK__
    if (!fCommandLine)
    {
        // Daemonize
        pid_t pid = fork();
        if (pid < 0)
        {
            fprintf(stderr, "Error: fork() returned %d errno %d\n", pid, errno);
            return 1;
        }
        if (pid > 0)
            pthread_exit((void*)0);
    }
#endif

    if (!AppInit(argc, argv))
        return 1;

    while (!fShutdown)
        Sleep(1000000);
    return 0;
}
Exemplo n.º 2
0
void AppMain()
{
    AppInit(1280, 720, "silver-winner");

    for (;;)
    {
        MSG msg;
        while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
        {
            TranslateMessage(&msg);
            DispatchMessageW(&msg);
        }

        if (g_App.bShouldClose)
        {
            break;
        }

        ImGui_ImplDX11_NewFrame();

        RendererPaint();
    }

    AppExit();
}
Exemplo n.º 3
0
void VAppBase::Execute(VAppImpl* pImpl)
{
  // Early out in case one of the startup modules triggered a quit
  if (WantsToQuit())
    return;

  if(pImpl == NULL)
  {
    hkvLog::FatalError("No implmentation found!");
    return;
  }
  
  m_pAppImpl = pImpl;
	Vision::SetApplication(this);

  // On callback based platforms the remaining code of the execute function
  // is triggered via the corresponding platform specific functions
  if (IsCallbackBased())
    return;

  AppInit();
  {
    // Main application loop (non callback based platforms only)
    bool bRun = true;
    while (bRun)
    {
      bRun = AppRun();
    }
  }
  AppDeInit();
}
Exemplo n.º 4
0
int PASCAL WinMain (HINSTANCE instance_in, HINSTANCE previous_instance,
  LPSTR command_line, int show_style)
{

 	MSG		  msg;

  instance = instance_in;
  WinInit ();
  AppInit ();
  while (!quit) {
		if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))	{
			if (msg.message == WM_QUIT)
				quit = true;
			else {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
    } else
      AppUpdate ();

  }
  AppTerm ();
  return 0;

}
Exemplo n.º 5
0
int     main() /** no params because they're not used */
{
    // Acronyms acr;
    // AcronymsInit(&acr);
    // acr.activate(&acr, (e_acronyms)4);
    // acr.activate(&acr, (e_acronyms)5);
    // acr.activate(&acr, (e_acronyms)1);
    // acr.activate(&acr, (e_acronyms)0);
    // for (int i = 0; i < 12; i++)
    // {
    //     std::cout << "[" << i << "] " << acr.names[i] << " = ";
    //     std::cout << (acr.selected[i] ? "(true)" : "(false)") << std::endl;
    // }
    // std::cout << acr.ToString(&acr) << std::endl;
    // std::cout << acr.CSVFormatter(&acr) << std::endl;
    // std::cout << acr.CountSelected(&acr) << std::endl;
    // std::cout << acr << std::endl;

    Application app;

    //todo();

    AppInit(&app); /** initialisation of the `app` structure and reading data from file*/
    app.Start(&app); /** start of the inifinite loop in the function `loop` */
    app.Loop(&app); /** execution of the infinite loop */

    AppDestroy(&app); /** cleaning of the structure and saving data */
    return (EXIT_SUCCESS);
}
Exemplo n.º 6
0
int main(void)
{

	BYTE	stBtn1;
	BYTE	stBtn2;

	DeviceInit();
	AppInit();

        
        while(stBtn1!=stPressed && stBtn2!=stPressed)
        {
            mT5IntEnable(fFalse);
            stBtn1 = btnBtn1.stBtn;
            stBtn2 = btnBtn2.stBtn;
            mT5IntEnable(fTrue);
        }

        RightReverse;
        LeftReverse;
        SetLeftSpeed(dtcMtrMedium);
        SetRightSpeed(dtcMtrMedium);

        mCNIntEnable(fTrue);	//Sensors will trigger
        while(fTrue);
}
Exemplo n.º 7
0
std::tuple<bool, boost::thread*> RunSharkfund(int argc, char* argv[])
{
	boost::thread* detectShutdownThread = NULL;
	static boost::thread_group threadGroup;
	SetupEnvironment();

	bool fRet = false;

	// Connect Dacrsd signal handlers
	noui_connect();

	fRet = AppInit(argc, argv,threadGroup);

	detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));

	if (!fRet) {
		if (detectShutdownThread)
			detectShutdownThread->interrupt();

		threadGroup.interrupt_all();

		// threadGroup.join_all(); was left out intentionally here, because we didn't re-test all of
		// the startup-failure cases to make sure they don't result in a hang due to some
		// thread-blocking-waiting-for-another-thread-during-startup case
	}
  return std::make_tuple (fRet,detectShutdownThread);
}
Exemplo n.º 8
0
int main(int argc, char* argv[])
{
    bool fRet = false;
    fRet = AppInit(argc, argv);

    if (fRet && fDaemon)
        pthread_exit((void*)0);
}
Exemplo n.º 9
0
int main(int argc, char* argv[])
{
    SetupEnvironment();

    // Connect bitcoind signal handlers
    noui_connect();

    return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);
}
Exemplo n.º 10
0
int main(int argc, char* argv[])
{
    SetupEnvironment();

    // Connect bitcoind signal handlers
    noui_connect();

    return (AppInit(argc, argv) ? 0 : 1);
}
Exemplo n.º 11
0
void NativeApplication::Initialize(float vertOffset, float rotStep)
{
	if (rotStep > 10.0f)
		throw NativeException("too big rotation step!");

	rotStep *= 2.0f * 3.14159265359f / 360.0f;
	AppInit(vertOffset, rotStep);
	GenerateVertexData();
}
Exemplo n.º 12
0
int main(int argc, char* argv[])
{
    bool fRet = false;
    fRet = AppInit(argc, argv);

    if (fRet && fDaemon)
        return 0;

    return 1;
}
Exemplo n.º 13
0
Arquivo: main.cpp Projeto: Kreyl/nute
void Init() {
    Uart.Init(115200);
    Uart.Printf("usb AHB=%u; APB1=%u; APB2=%u; UsbSdio=%u\r\n", Clk.AHBFreqHz, Clk.APB1FreqHz, Clk.APB2FreqHz, Clk.UsbSdioFreqHz);
    Usb.Init();
    Usb.Disconnect();
    chThdSleepMilliseconds(999);
    Usb.Connect();
    // Application init
    AppInit();
}
Exemplo n.º 14
0
int main(int argc, char* argv[])
{
    RegisterPrettyTerminateHander();
    RegisterPrettySignalHandlers();

    SetupEnvironment();

    // Connect dashd signal handlers
    noui_connect();

    return (AppInit(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE);
}
Exemplo n.º 15
0
int main(int argc, char* argv[])
{
    bool fRet = false;

    // Connect darksilkd signal handlers
    noui_connect();

    fRet = AppInit(argc, argv);

    if (fRet && fDaemon)
        return 0;

    return (fRet ? 0 : 1);
}
Exemplo n.º 16
0
int main(int argc, char* argv[])
{
    bool fRet = false;
    fHaveGUI = false;
    
    // Connect vtorrentd signal handlers
    noui_connect();
    
    fRet = AppInit(argc, argv);
    
    if (fRet && fDaemon)
        return 0;
    
    return (fRet ? 0 : 1);
};
Exemplo n.º 17
0
int main(int argc, char* argv[])
{
    SetupEnvironment();

    bool fRet = false;

    // Connect bitcoind signal handlers
    noui_connect();

    fRet = AppInit(argc, argv);

    if (fRet && fDaemon)
        return 0;

    return (fRet ? 0 : 1);
}
Exemplo n.º 18
0
int main(int argc, char* argv[])
{
    bool fRet = false;
    fHaveGUI = false;

    //GenesisMiner();

    // Connect bitcoind signal handlers
    noui_connect();

    fRet = AppInit(argc, argv);

    if (fRet && fDaemon)
        return 0;

    return (fRet ? 0 : 1);
}
Exemplo n.º 19
0
EXPORT jboolean CALL Java_emu_project64_jni_NativeExports_appInit(JNIEnv* env, jclass cls, jstring BaseDir)
{
    if (g_Logger == NULL)
    {
        g_Logger = new AndroidLogger();
    }
    TraceAddModule(g_Logger);

    Notify().DisplayMessage(10, "    ____               _           __  _____ __ __");
    Notify().DisplayMessage(10, "   / __ \\_________    (_)__  _____/ /_/ ___// // /");
    Notify().DisplayMessage(10, "  / /_/ / ___/ __ \\  / / _ \\/ ___/ __/ __ \\/ // /_");
    Notify().DisplayMessage(10, " / ____/ /  / /_/ / / /  __/ /__/ /_/ /_/ /__  __/");
    Notify().DisplayMessage(10, "/_/   /_/   \\____/_/ /\\___/\\___/\\__/\\____/  /_/");
    Notify().DisplayMessage(10, "                /___/");
    Notify().DisplayMessage(10, "http://www.pj64-emu.com/");
    Notify().DisplayMessage(10, stdstr_f("%s Version %s", VER_FILE_DESCRIPTION_STR, VER_FILE_VERSION_STR).c_str());
    Notify().DisplayMessage(10, "");

    if (g_JavaVM == NULL)
    {
        Notify().DisplayError("No java VM");
        return false;
    }

    const char *baseDir = env->GetStringUTFChars(BaseDir, 0);
    bool res = AppInit(&Notify(), baseDir, 0, NULL);

    env->ReleaseStringUTFChars(BaseDir, baseDir);
    if (res)
    {
        g_JavaBridge = new JavaBridge(g_JavaVM);
        g_SyncBridge = new SyncBridge(g_JavaBridge);
        g_Plugins->SetRenderWindows(g_JavaBridge, g_SyncBridge);

        JniBridegSettings = new CJniBridegSettings();

        RegisterUISettings();
        g_Settings->RegisterChangeCB(GameRunning_CPU_Running, NULL, (CSettings::SettingChangedFunc)GameCpuRunning);
    }
    else
    {
        AppCleanup();
    }
    return res;
}
Exemplo n.º 20
0
int WINAPI WinMain (HINSTANCE hInstance,
					     HINSTANCE hPrevInstance,
					     LPSTR lpszCmdLine,
					     int nCmdShow)

{
  MSG		  msg;

  if (!AppInit (hInstance, hPrevInstance, nCmdShow))
	 return 0;

  while (GetMessage (&msg, NULL, 0, 0)) {
	 TranslateMessage (&msg);
	 DispatchMessage (&msg);
  }

  return msg.wParam;
}
Exemplo n.º 21
0
bool JsAppInit( HWND hMainWnd )
{
	s_hMainWnd = hMainWnd;
	bool bl = false;
	jscontext = AppInit();
	 
	BSTR bs;

	if ( ReadScriptFile_ANSI(INITIAL_FILE, &bs )) // *.js
	{

		JsRun( bs );
			
		::SysFreeString(bs);
		bl = true;
	}

	return bl;
}
Exemplo n.º 22
0
/**
 * 入口函数
 */
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nShowCmd)
{
	if(!AppInit(hInst)){
		MessageBox(0, "AppInit() - FAILED", 0, 0);
		return 0;
	}

	if(!AppSetup()){
		MessageBox(0, "AppSetup() - FAILED", 0, 0);
		return 0;
	}

	MSG msg;
	ZeroMemory(&msg, sizeof(MSG));

	LARGE_INTEGER lpf;
	QueryPerformanceFrequency(&lpf);
	LONGLONG nFreq = lpf.QuadPart;
	QueryPerformanceCounter(&lpf);
	static LONGLONG lastFreq = lpf.QuadPart;

	while(msg.message != WM_QUIT){
		if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		QueryPerformanceCounter(&lpf);
		LONGLONG curFreq = lpf.QuadPart;
		float deltaTime = (curFreq - lastFreq) / (float)nFreq;
		Time::deltaTime = deltaTime;
		lastFreq = curFreq;

		if(!AppLoop()){
			MessageBox(0, "AppLoop() - FAILED", 0, 0);
		}
	}

	AppDestory();

	return msg.wParam;
}
Exemplo n.º 23
0
int main (int argc, char* argv[])
{
  glutInit (&argc, argv);
  glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
  glutInitDisplayString("double rgba depth>=16 rgba");
  glutInitWindowSize (width, height);
  glutInitWindowPosition (0,0);
  glutCreateWindow (APP_TITLE);
  glutVisibilityFunc(visible);
  glutReshapeFunc (resize);
  glutKeyboardFunc (keyboard);
  glutSpecialFunc (keyboard_s);

  AppInit ();

  glutMainLoop();

  AppTerm ();

  return 0;
}
Exemplo n.º 24
0
std::tuple<bool, boost::thread*> RunDacrs(int argc, char* argv[]) {
	boost::thread* detectShutdownThread = NULL;
	static boost::thread_group threadGroup;
	SetupEnvironment();

	bool fRet = false;

	// Connect Dacrsd signal handlers
	noui_connect();

	fRet = AppInit(argc, argv, threadGroup);

	detectShutdownThread = new boost::thread(boost::bind(&DetectShutdownThread, &threadGroup));

	if (!fRet) {
		if (detectShutdownThread)
			detectShutdownThread->interrupt();

		threadGroup.interrupt_all();
	}
	return std::make_tuple(fRet, detectShutdownThread);
}
Exemplo n.º 25
0
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE /*hPrevInst*/, LPSTR /*cmdLine*/, int /*cmdShow*/)
{
	appInst = hInst;
	
	if (!AppInit())
	{
		return 1;
	}
	
	// Message pump
	MSG msg;
	
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	
	AppDone();
	
	return msg.wParam;
}
Exemplo n.º 26
0
I32 main(I32 argc, CHAR** argv)
{
  if(argc < 2)
  {
    NAssert(VA("%s : requires server argument.",argv[0]));
    return -1;
  }

  // init the application
  AppInit(argc-1, &argv[1]);

  // run the application
  while(s_exit == FALSE)
  {
    AppRun();
  }

  // exit the application
  AppExit();
	
	return 0;
}
Exemplo n.º 27
0
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
  //*** Call initialization procedure
  GetModuleFileName(NULL, AppPath, 1048);
  *(strrchr(AppPath, '\\') + 1) = 0;
  strcpy(IniFile, AppPath);
  strcat(IniFile, "bitview.ini");
  
  char fnBuf[1048];
  
  GetPrivateProfileString("Bitview", "palette", "pal.pal", 
            fnBuf, sizeof(fnBuf), IniFile);
  
  pal = GFXPalette::load(fnBuf);
  curShadeIndex = pal->getMaxShade() / 2;
  
  GetPrivateProfileString("Bitview", "backgnd", "back.bmp", 
            fnBuf, sizeof(fnBuf), IniFile);
  
  bkgnd = GFXBitmap::load(fnBuf);
 
  LoadBitmap(szCmdLine);
  
  if (!AppInit(hInst,hPrev,sw,szCmdLine))
    return FALSE;

    //*** Polling messages from event queue until quit
  
  GFXCDSSurface::setFunctionTable(&rclip_table);
  
  GFXSurface::createRasterList(3000);
  GFXCDSSurface::create(sfc, TRUE, bkgnd->getWidth(), bkgnd->getHeight(), hwndApp);
  sfc->setPalette(pal);
  pal->setTransLevel(1);
  sfc->lock();
  Redraw();
  ProcessReadyEvents();
  return 0;
}
Exemplo n.º 28
0
Arquivo: qa.c Projeto: mingpen/OpenNT
/*----------------------------------------------------------------------------*\
|   WinMain( hInst, hPrev, lpszCmdLine, cmdShow )                              |
|                                                                              |
|   Description:                                                               |
|       The main procedure for the App.  After initializing, it just goes      |
|       into a message-processing loop until it gets a WM_QUIT message         |
|       (meaning the app was closed).                                          |
|                                                                              |
|   Arguments:                                                                 |
|       hInst           instance handle of this instance of the app            |
|       hPrev           instance handle of previous instance, NULL if first    |
|       szCmdLine       ->null-terminated command line                         |
|       cmdShow         specifies how the window is initially displayed        |
|                                                                              |
|   Returns:                                                                   |
|       The exit code as specified in the WM_QUIT message.                     |
|                                                                              |
\*----------------------------------------------------------------------------*/
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
    MSG     msg;
    DWORD   dw=0;

    /* Call initialization procedure */
    if (!AppInit(hInst,hPrev,sw,szCmdLine))
        return FALSE;

#ifdef WIN32
    CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)IdleThread, 0, 0, &dw);
#endif

    /*
     * Polling messages from event queue
     */
    for (;;)
    {
        if (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE))
        {
            if (msg.message == WM_QUIT)
                break;

	    if (hAccelApp && TranslateAccelerator(hwndApp, hAccelApp, &msg))
		continue;

            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
	{
	    if (dw!=0 || AppIdle())
                WaitMessage();
        }
    }

    AppExit();
    return msg.wParam;
}
Exemplo n.º 29
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	// 保存主程序句柄
	g_hTheApp = hInstance;

	// 初始化Windows窗口和程序
	g_hMainWnd = AppInit(g_hTheApp, nCmdShow);
	if (g_hMainWnd == NULL)
	{
		MessageBox(NULL, "Can't create main window", "Error", MB_OK);
		return 0;
	}

	// 初始化主程序
	if (!AppEntryClass()->Initialize(g_hTheApp, g_hMainWnd))
	{
		MessageBox(NULL, "Initialize AppEntry Failed", "Error", MB_OK);
		return 0;
	}

	// 进入主消息循环
	return AppMsgLoop();
}
Exemplo n.º 30
0
/*----------------------------------------------------------------------------*\
|   WinMain( hInst, hPrev, lpszCmdLine, cmdShow )                              |
|                                                                              |
|   Description:                                                               |
|       The main procedure for the App.  After initializing, it just goes      |
|       into a message-processing loop until it gets a WM_QUIT message         |
|       (meaning the app was closed).                                          |
|                                                                              |
|   Arguments:                                                                 |
|       hInst           instance handle of this instance of the app            |
|       hPrev           instance handle of previous instance, NULL if first    |
|       szCmdLine       ->null-terminated command line                         |
|       cmdShow         specifies how the window is initially displayed        |
|                                                                              |
|   Returns:                                                                   |
|       The exit code as specified in the WM_QUIT message.                     |
|                                                                              |
\*----------------------------------------------------------------------------*/
int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
    MSG     msg;

    if (!WinG.Load()) {				//link to WinG DLL.
		   MessageBox(0,"Can't find WING32.DLL","WTWIN Error!",MB_OK);
		   return FALSE;
    }

    /* Call initialization procedure */
    if (!AppInit(hInst,hPrev,sw,szCmdLine))
			return FALSE;

    /*
     * Polling messages from event queue
     */
    for (;;)
    {
        if (PeekMessage(&msg, NULL, 0, 0,PM_REMOVE))
        {
            if (msg.message == WM_QUIT)
                break;

            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
        else
		 {
	    if (AppIdle())
                WaitMessage();
        }
    }

    AppExit();
    WinG.Free();						//terminate WinG DLL link.
    return msg.wParam;
}