Exemplo n.º 1
0
int spotMemcache(struct conn *c)
{
    int ret;
    struct app **app_p, *app;

    app_p = arrayIndex(WorkerProcess->apps, 0);
    app = *app_p;
    if (!app->is_init) {
        ret = initApp(app);
        if (ret == WHEAT_WRONG)
            return WHEAT_WRONG;
    }
    c->app = app;
    ret = initAppData(c);
    if (ret == WHEAT_WRONG) {
        wheatLog(WHEAT_WARNING, "init app data failed");
        return WHEAT_WRONG;
    }
    ret = app->appCall(c, NULL);
    if (ret == WHEAT_WRONG) {
        wheatLog(WHEAT_WARNING, "app failed, exited");
        app->deallocApp();
        app->is_init = 0;
    }
    finishConn(c);
    return ret;
}
extern "C" AcRx::AppRetCode

acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)

{

    switch (msg) {

    case AcRx::kInitAppMsg:

        acrxDynamicLinker->unlockApplication(appId);

		acrxDynamicLinker->registerAppMDIAware(appId);

        initApp();

        break;

    case AcRx::kUnloadAppMsg:

        unloadApp();

    }

    return AcRx::kRetOK;

}
Exemplo n.º 3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QTimer::singleShot(0,this,SLOT(initApp()));
}
Exemplo n.º 4
0
extern "C" AcRx::AppRetCode 
acrxEntryPoint(AcRx::AppMsgCode msg, void* appId)
{
    switch (msg) {
    case AcRx::kInitAppMsg:
        acrxDynamicLinker->unlockApplication(appId);
		acrxDynamicLinker->registerAppMDIAware(appId);
		acrxDynamicLinker->loadModule("square.dbx", true);
        initApp();
        break;
    case AcRx::kUnloadAppMsg:
        unloadApp();
        break;
    case AcRx::kLoadDwgMsg:

        break;
    case AcRx::kUnloadDwgMsg:

        break;
	case AcRx::kInvkSubrMsg:

		break;
    default:
		;
    }
    return AcRx::kRetOK;
}
Exemplo n.º 5
0
extern "C" AcRx::AppRetCode acrxEntryPoint( AcRx::AppMsgCode msg, void* pkt)
{
	switch( msg )
	{
		case AcRx::kInitAppMsg:
			if (!acrxLoadModule("curveText.dbx", false))
					return AcRx::kRetError;
			acrxDynamicLinker->unlockApplication(pkt);
			acrxRegisterAppMDIAware(pkt);
			initApp();
			updateRegistry();
			pCurvetextContextMenu = new curvetextContextMenu;
			pCurveContextMenu = new curveContextMenu;
			acedAddObjectContextMenu(AcDbCurve::desc(), pCurveContextMenu, pkt);
			acedAddObjectContextMenu(AdcgCurveText::desc(), pCurvetextContextMenu, pkt);
		break;
		case AcRx::kUnloadAppMsg:
			unloadApp(); 
			acedRemoveObjectContextMenu(AcDbCurve::desc(), pCurveContextMenu);
			acedRemoveObjectContextMenu(AdcgCurveText::desc(), pCurvetextContextMenu);
			acrxUnloadModule("curveText.dbx");
			delete pCurveContextMenu;
			delete pCurvetextContextMenu;
		break;
		default:
		break;
	}
	return AcRx::kRetOK;
}
Exemplo n.º 6
0
	void cApplication::run(HINSTANCE hInstance)
	{
		initialize();
		initException();
		setDebugLeakFlag();	

		if (_getCore()->initialize(hInstance, _wndProc))
		{
			if (initApp())
			{
				MSG msg;
				while (!m_quit)
				{
					while (PeekMessage(&msg, NULL, 0U, 0U, PM_REMOVE))
					{					
						TranslateMessage(&msg);
						DispatchMessage(&msg);
					}

					procedure();
				}
			}
		}

		terminate();
	}
Exemplo n.º 7
0
int main(int argc, char *argv[]) {
	pthread_t 		thread;

	/* init threads */
    g_thread_init (NULL);
    gdk_threads_init ();
    gdk_threads_enter ();

    gtk_init(&argc, &argv);

    initApp();

    appdata->program = HILDON_PROGRAM(hildon_program_get_instance());
    g_set_application_name("Webview");

    appdata->window = HILDON_WINDOW(hildon_window_new());
    hildon_program_add_window(appdata->program, appdata->window);


    create_menu(appdata->window);
    build_interface(appdata->window);

    /* Connect signal to X in the upper corner */
    g_signal_connect(G_OBJECT(appdata->window), "delete_event", G_CALLBACK(destroy), NULL);

	update_image();
	load_settings();

	gtk_widget_show_all(GTK_WIDGET(appdata->window));

	if(! start_camera(appdata->window))
	{
		g_warning("Unable to start camera\n");

		GtkWidget *failDialog = gtk_message_dialog_new(NULL,
	     		GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
	     		GTK_BUTTONS_OK,
	     		"Unable to start camera\n");
		gtk_dialog_run (GTK_DIALOG (failDialog));
		gtk_widget_destroy (failDialog);
	}

	if(! start_webserver())
	{
		GtkWidget *failDialog = gtk_message_dialog_new(NULL,
	     		GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR,
	     		GTK_BUTTONS_OK,
	     		"Unable to start web server.\nCheck server port is not already in use.\n");
		gtk_dialog_run (GTK_DIALOG (failDialog));
		gtk_widget_destroy (failDialog);
	}
	sleep(1);

	pthread_create(&thread, NULL, count_down_thread, NULL);

	gtk_main();

	gdk_threads_leave ();
	return( 0 );
}
Exemplo n.º 8
0
int main (int argc, char * argv[])
{
  int err;	
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGBA);

  if (argc > 1){
     sprintf(FragLoc,"%s",argv[1]);
  }
  else{
     sprintf(FragLoc,"%s",FRAG_LOC);
  }
  glutInitWindowSize(800, 600);
  glutInitWindowPosition(100, 75);
  glutCreateWindow("ARB shaders");

  initApp();
  
  printf("\n");
  printf("F toggles use of fragment shader\n");
  printf("T draws teapot\n");
  printf("S draws sphere\n");
  printf("\n");
  
  glutDisplayFunc(display);
  glutReshapeFunc(resize);
  glutIdleFunc(animate);
  glutKeyboardFunc(asciiKey);
  
  glutMainLoop();
  return 0;	/* Keeps compiler happy */
}
Exemplo n.º 9
0
int main( void )
{
 initApp();
 initQEI();
 initSM();
 initRS485();
 //int* Z0;
 //Z0=(int*)&TXdata.Z;
 
 
/*        TRISAbits.TRISA4 = 0;     // verbunden mit RB8
        TRISBbits.TRISB4 = 0;     // verbunden mit RB9 
        PORTAbits.RA4 = 1; 
        PORTBbits.RB4 = 1;
*/ 
 
 while(1) 
 {
  readData();
  sendData();
//  blink_led(10);
 
//  GMSstep(-1);
// *Z0=(int)POS2CNT;
 } 
 return 0; 
}  
Exemplo n.º 10
0
void ColorKeyingApp::run()
{
	SDL_Event e;
	bool quit = false;
	
	if (!initApp())
	{
		std::cout << "Failed to initialize!\n" << std::endl;
	}
	else
	{
		// Load Media
		if (!loadMedia())
		{
			std::cout << "Failed to load media!\n" << std::endl;
		}
		else
		{			

			//Clear screen
			SDL_SetRenderDrawColor( gCurrentRenderer, 0xFF, 0xFF, 0xFF, 0xFF );
			SDL_RenderClear( gCurrentRenderer );

			//Set rendering space and render to screen
			SDL_Rect renderQuad = { 0, 0, gBackgroundTexture.getWidth(), gBackgroundTexture.getHeight()};
			// SDL_RenderCopy( gCurrentRenderer, gBackgroundTexture.getTexture(), NULL, &renderQuad );
			// renderToScreen(gBackgroundTexture, &renderQuad);
			gBackgroundTexture.renderTexture(gCurrentRenderer, &renderQuad);
			
			renderQuad.x = 200;
			renderQuad.y =200;
			renderQuad.w = gCharacterTexture.getWidth();
			renderQuad.h = gCharacterTexture.getHeight();
			
			// renderToScreen(gCharacterTexture, &renderQuad);
			gCharacterTexture.renderTexture(gCurrentRenderer, &renderQuad);

			//Update screen
			SDL_RenderPresent( gCurrentRenderer );

			while (!quit)
			{
				while (SDL_PollEvent(&e) != 0)
				{
					if (e.type == SDL_QUIT)
					{
						quit = true;
						std::cout << "Program quit after "<< e.quit.timestamp << " ticks!" << std::endl;
					}

				}
				
			}
			
		}
	}
	
	close();
}
Exemplo n.º 11
0
QtTestApp::QtTestApp(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)
{
	initApp();
	initUpdater();

	connect(ui.pushButton, SIGNAL(clicked(bool)), this, SLOT(onClicked()));
}
Exemplo n.º 12
0
int 
CServerApp::foregroundStartup(int argc, char** argv)
{
	initApp(argc, argv);

	// never daemonize
	return mainLoop();
}
Exemplo n.º 13
0
//------------------------------------------------------------------------------
int main(void)
{
    tOplkError  ret = kErrorOk;
    const UINT8 aMacAddr[] = {MAC_ADDR};
    UINT8       nodeid;

    // Initialize helper modules
    gpio_init();
    lcd_init();

    // get node ID from input
    nodeid = gpio_getNodeid();

    // initialize instance
    memset(&instance_l, 0, sizeof(instance_l));

    instance_l.cycleLen     = CYCLE_LEN;
    instance_l.nodeId       = (nodeid != 0) ? nodeid : NODEID;
    instance_l.fShutdown    = FALSE;
    instance_l.fGsOff       = FALSE;

    // set mac address (last byte is set to node ID)
    memcpy(instance_l.aMacAddr, aMacAddr, sizeof(aMacAddr));
    instance_l.aMacAddr[5]  = instance_l.nodeId;

    initEvents(&eventCbPowerlink);
    arp_init((UINT8)instance_l.nodeId);

    PRINTF("----------------------------------------------------\n");
    PRINTF("openPOWERLINK embedded CN DEMO application\n");
    PRINTF("using openPOWERLINK Stack: %s\n", PLK_DEFINED_STRING_VERSION);
    PRINTF("----------------------------------------------------\n");

    PRINTF("NODEID=0x%02X\n", instance_l.nodeId);
    lcd_printNodeId(instance_l.nodeId);

    if ((ret = initPowerlink(&instance_l)) != kErrorOk)
        goto Exit;

    if ((ret = initApp()) != kErrorOk)
        goto Exit;

    if ((ret = oplk_setNonPlkForward(TRUE)) != kErrorOk)
        goto Exit;

    loopMain(&instance_l);

Exit:
    arp_exit();
    shutdownPowerlink(&instance_l);
    shutdownApp();

    // Shutdown helper modules
    lcd_exit();
    gpio_exit();

    return 0;
}
Exemplo n.º 14
0
void ApplicationContext::initAppForAndroid(AAssetManager* assetMgr, ANativeWindow* window)
{
    mAConfig = AConfiguration_new();
    AConfiguration_fromAssetManager(mAConfig, assetMgr);
    mAAssetMgr = assetMgr;
    mAWindow = window;

    initApp();
}
Exemplo n.º 15
0
SWIGEXPORT jint JNICALL Java_org_pjsip_pjsua_pjsua_1appJNI_initApp(JNIEnv *jenv, jclass jcls) {
  jint jresult = 0 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  result = (int)initApp();
  jresult = (jint)result; 
  return jresult;
}
void ApplicationContextAndroid::initAppForAndroid(AAssetManager* assetMgr, ANativeWindow* window)
{
    mAConfig = AConfiguration_new();
    AConfiguration_fromAssetManager(mAConfig, assetMgr);
    mAAssetMgr = assetMgr;

    mWindows.resize(1);
    mWindows[0].native = window;

    initApp();
}
Exemplo n.º 17
0
	virtual AcRx::AppRetCode On_kInitAppMsg (void *pkt) {
		// TODO: Load dependencies here

		// You *must* call On_kInitAppMsg here
		AcRx::AppRetCode retCode =AcRxArxApp::On_kInitAppMsg (pkt) ;

		// TODO: Add your initialization code here
		initApp();

		return (retCode) ;
	}
Exemplo n.º 18
0
void
Win::initWindow(HINSTANCE hInst)
{
	wc.cbSize 			= sizeof(WNDCLASSEX);
	wc.hInstance 		= hInst;
	wc.style 			= CS_BYTEALIGNCLIENT | CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
	wc.lpfnWndProc 		= WndProc;
	wc.cbClsExtra 		= 0;
	wc.cbWndExtra 		= sizeof(long);
	wc.hIcon 			= LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON));
	wc.hIconSm 			= (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);
	wc.hCursor 			= LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground 	= CreateSolidBrush(RGB(230, 255, 255));;
	wc.lpszMenuName 	= NULL;
	wc.lpszClassName 	= windowClassName;

	RegisterClassEx(&wc);

	hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, windowClassName, "ABC123 | Alphabets and Numbers for Curious Eva",
		WS_MAXIMIZE|WS_VISIBLE|WS_POPUP, 0, 0,  
		GetSystemMetrics(SM_CXFULLSCREEN), 
		GetSystemMetrics(SM_CYFULLSCREEN),  
		0, 0, 0, NULL); 
	SetWindowLongPtr(hwnd, GWLP_USERDATA, (long)this);
	int status = initApp();
	SetWindowPos(hwnd, 0, 0, 0, 
		GetSystemMetrics(SM_CXMAXIMIZED), 
		GetSystemMetrics(SM_CYMAXIMIZED),  
		SWP_NOZORDER|SWP_NOMOVE);	
	ShowWindow(hwnd,SW_SHOW);

	initKioskMode();
	escape_counter=0;
	while ( msg.message != WM_QUIT) {
		if( PeekMessage( &msg, 0, 0, 0, PM_REMOVE ) ) {
			TranslateMessage( &msg );
			if(msg.message == WM_KEYDOWN) {
				if(msg.wParam==VK_ESCAPE){
					if(escape_counter++ >= 2){
						DispatchMessage( &msg ); //for escape_counter++
						closeKioskMode();
						break;
					}
				}else{ //continous 3 press of escape, reset otherwise
					escape_counter=0;
				}
			}
			DispatchMessage(  &msg );
		}
		Sleep(MSG_DELAY_MILLISECS);
	}
}
Exemplo n.º 19
0
int 
CServerApp::standardStartup(int argc, char** argv)
{
	initApp(argc, argv);

	// daemonize if requested
	if (args().m_daemon) {
		return ARCH->daemonize(daemonName(), daemonMainLoopStatic);
	}
	else {
		return mainLoop();
	}
}
Exemplo n.º 20
0
	void SampleContext::go(Sample* initialSample)
	{
		while (!mLastRun)
		{
			mLastRun = TRUE;
			initApp(initialSample);
			if (mEngine->getRenderSystem() != NULL)
			{
				mEngine->startRendering();
			}
			closeApp();
			mFirstRun = FALSE;
		}
	}
Exemplo n.º 21
0
HlpFlightPlannerApp::HlpFlightPlannerApp(QWidget *parent) :
  QMainWindow(parent),
  ui(new Ui::HlpFlightPlannerApp)
{
  ui->setupUi(this);

  initApp();

  // test
//  QgsRasterLayer *mypLayer = new QgsRasterLayer( "/home/denis/Documents/cpp/hfp/hfp/data/cn1244.png", "cn1244");
//  HlpMapRegistry::instance()->addMapLayer(mypLayer);
//  QgsRasterLayer *mypLayer2 = new QgsRasterLayer( "/home/denis/Documents/cpp/hfp/hfp/data/cn1244.png", "cn1264");
//  HlpMapRegistry::instance()->addMapLayer(mypLayer2);
}
Exemplo n.º 22
0
int main(int argc, char *argv[], char *env[])
{
    initApp();

    // send arguments
    for (int i = 2; i < argc; i++)
        if (argv[i] != NULL)
            sendCmd("/arg", argv[i]);

    // send environment
    for (int i = 0; env[i]; i++)
        if (env[i] != NULL)
            sendCmd("/env", env[i]);

    // current working directory
    char *cwd = _getcwd(NULL, 0);
    sendCmd("/dir", cwd);
    free(cwd);

    // send clj file
    if (argc > 1) {
        sendCmd("/main", argv[1]);
    } else {
        fprintf(stderr, "Starting Clojure REPL...\nType Ctrl-Z <Enter> to exit\n");
        sendCmd("/main", "");
    }

    bool eof = false;

    // process input from stdin and from the server
    while(1) {
        char buf[5] = {0};
        int len = sizeof(buf)-1;
        if (recv(server_socket, buf, len, 0) < len)
            cleanExit(-4);
        if (strcmp(buf, "/out") == 0) {
            recvToFD(stdout_handle, getLen());
        } else if (strcmp(buf, "/err") == 0) {
            recvToFD(stderr_handle, getLen());
        } else if (strcmp(buf, "/ext") == 0) {
            // processExit(buf, getCmdLen());
        } else {
            fprintf(stderr, "Unexpected server command %s\n", buf);
            char dbuf[21] = {0};
            recv(server_socket, dbuf, sizeof(dbuf)-1, 0);
            cleanExit(-5);
        }
    }
}
//------------------------------------------------------------------------------
int main(void)
{
    tOplkError  ret = kErrorOk;
    const UINT8 aMacAddr[] = {MAC_ADDR};
    UINT8       nodeid;

    lcd_init();

    // get node ID from input
    nodeid = gpio_getNodeid();

    // initialize instance
    OPLK_MEMSET(&instance_l, 0, sizeof(instance_l));

    instance_l.cycleLen         = CYCLE_LEN;
    instance_l.nodeId           = (nodeid != 0) ? nodeid : NODEID;
    instance_l.fShutdown        = FALSE;
    instance_l.fGsOff           = FALSE;
    instance_l.pCdcBuffer       = (unsigned char*)aCdcBuffer;
    instance_l.cdcBufferSize    = sizeof(aCdcBuffer);

    // set mac address (last byte is set to node ID)
    OPLK_MEMCPY(instance_l.aMacAddr, aMacAddr, sizeof(aMacAddr));
    instance_l.aMacAddr[5] = instance_l.nodeId;

    initEvents(&instance_l.fGsOff);

    PRINTF("----------------------------------------------------\n");
    PRINTF("openPOWERLINK console MN DEMO application\n");
    PRINTF("using openPOWERLINK Stack: %s\n", PLK_DEFINED_STRING_VERSION);
    PRINTF("----------------------------------------------------\n");

    PRINTF("NODEID=0x%02X\n", instance_l.nodeId);
    lcd_printNodeId((WORD)instance_l.nodeId);

    if ((ret = initPowerlink(&instance_l)) != kErrorOk)
        goto Exit;

    if ((ret = initApp()) != kErrorOk)
        goto Exit;

    loopMain(&instance_l);

Exit:
    shutdownPowerlink(&instance_l);
    shutdownApp();

    return 0;
}
Exemplo n.º 24
0
int CALLBACK
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	MSG msg;

	initApp(hInstance);

	/* create a window for displaying the message */
	makeMainWin();

	/* message loop */
	while (GetMessage(&msg, NULL, 0, 0))
	{
		DispatchMessage(&msg);
	}
}
Exemplo n.º 25
0
extern "C" __declspec(dllexport) AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void *p)
{
    switch (msg)
    {
    case AcRx::kInitAppMsg:
        acrxRegisterAppMDIAware(p);
        acrxUnlockApplication(p);
        initApp();
        break;
    case AcRx::kUnloadAppMsg:
        unloadApp();
        break;
    }
    return AcRx::kRetOK;
}
Exemplo n.º 26
0
extern "C" AcRx::AppRetCode acrxEntryPoint( AcRx::AppMsgCode msg, void* pkt)
{
  switch( msg ) 
  {
    case AcRx::kInitAppMsg: 
      initApp();
      acrxUnlockApplication(pkt);
	  acrxDynamicLinker->registerAppMDIAware(pkt);
      break;
    case AcRx::kUnloadAppMsg: 
      unloadApp(); 
      break;
    default:
      break;
  }
  return AcRx::kRetOK; 
}
Exemplo n.º 27
0
extern "C" AcRx::AppRetCode
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
    switch (msg) {
    case AcRx::kInitAppMsg:
        // This application can be unloaded
        acrxDynamicLinker->unlockApplication(pkt);
        // This is an MDI aware application
        acrxDynamicLinker->registerAppMDIAware(pkt);
        initApp();
        break;
    case AcRx::kUnloadAppMsg:
        unloadApp();
		break;
    }
    return AcRx::kRetOK;
}
Exemplo n.º 28
0
/////////////////////////////////////////////////////////////////////////////
// ZRX EntryPoint
extern "C" AcRx::AppRetCode 
zcrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
{
    AcRxDynamicLinker *pLinker = acrxDynamicLinker;
    switch (msg) {
    case AcRx::kInitAppMsg:
        // Comment out the following line if your
        // application should be locked into memory
        pLinker->unlockApplication(pkt);
        pLinker->registerAppMDIAware(pkt);
        initApp();
        break;
    case AcRx::kUnloadAppMsg:
        unloadApp();
        break;
    }
    return AcRx::kRetOK;
}
/****************************************************************************
NAME
    handleAppInit

DESCRIPTION
    Handles the application initialise message.
    
*/
static void handleAppInit(void)
{
    mvdAppState app_state = the_app->app_state;
    
    switch ( app_state )
    {
        case AppStateUninitialised:
        {
            setAppState(AppStateInitialising);
            initApp();
            break;
        }    
        default:
        {
            unexpectedAppMessage(APP_INIT, app_state);
        }
    }
}    
Exemplo n.º 30
0
void testApp :: setup()
{
	ofSetFrameRate( 30 );
	ofSetVerticalSync( true );
	ofEnableSmoothing();
	ofEnableAlphaBlending();
	ofDisableArbTex();
	ofBackground( 150, 150, 150 );

	glEnable( GL_DEPTH_TEST );
	glDepthFunc( GL_LEQUAL );
	
	initRenderArea();
	initApp();
	initColorMap();
	initShereBg();
	initRibbons();
	initFields();
	initAudio();
}