Exemplo n.º 1
0
void command_line_options_parser_solve(slice_index si)
{
  int const argc = SLICE_U(si).command_line_options_parser.argc;
  char **argv = SLICE_U(si).command_line_options_parser.argv;
  int const idx_end_of_options = parseCommandlineOptions(argc,argv);
  char const *filename = idx_end_of_options<argc ? argv[idx_end_of_options] : "";
  slice_index const opener = input_plaintext_alloc_opener(filename);

  slice_insertion_insert(si,&opener,1);

  pipe_solve_delegate(si);
}
Exemplo n.º 2
0
int main( int argc, char** argv)
{
	appArgc = argc;
	appArgv = argv;

	std::set_terminate(generateGoodBacktraceTerminateHandler);

	g_thread_init(NULL);

	const char *renderMode;
#if defined(TARGET_DEVICE) && defined(HAVE_OPENGL)
	::setenv("QT_PLUGIN_PATH", "/usr/plugins", 1);
	renderMode = "HW egl";
#elif defined(TARGET_DEVICE) || defined(TARGET_EMULATOR)
	::setenv("QT_PLUGIN_PATH", "/usr/plugins", 1);	
	renderMode = "Software";
#elif defined(HAVE_OPENGL)
	renderMode = "HW OpenGL";
#else
	renderMode = "Software";
#endif

	g_debug("SysMgr compiled against Qt %s, running on %s, %s render mode requested", QT_VERSION_STR, qVersion(), renderMode);

	// Command-Line options
  	parseCommandlineOptions(argc, argv);

    if (s_debugTrapStr && 0 == strcasecmp(s_debugTrapStr, "on")) {
        debugCrashes = true;
    }

	if (s_mallocStatsFileStr) {
		setupMallocStats(s_mallocStatsFileStr);
	}

    sysmgrPid = getpid();

	// Load Settings (first!)
	Settings* settings = Settings::LunaSettings();

	// Initialize logging handler
	g_log_set_default_handler(logFilter, NULL);

#if defined(TARGET_DESKTOP)
	// use terminal logging when running on desktop
	settings->logger_useTerminal = true;
#endif

	// disable color logging using an environment variable. Useful when run from QtCreator
	const char* useColor = ::getenv("COLOR_LOGGING");
	if (useColor)
		settings->logger_useColor = (useColor[0] != 0 && useColor[0] != '0');

	HostBase* host = HostBase::instance();
	// the resolution is just a hint, the actual
	// resolution may get picked up from the fb driver on arm
	host->init(settings->displayWidth, settings->displayHeight);

#if defined(TARGET_DEVICE) && defined(HAVE_OPENGL)
	if (settings->forceSoftwareRendering)
		::setenv("QT_QPA_PLATFORM", "palm-soft", 0);
	else
		::setenv("QT_QPA_PLATFORM", "palm", 0);
#else
    // Do not override the value if the variable exists
    ::setenv("QT_QPA_PLATFORM", "palm", 0);
#endif
	
	
#if defined(TARGET_DEVICE) && defined(HAVE_OPENGL)
	if (!settings->forceSoftwareRendering)
		::setenv("QWS_DISPLAY", "egl", 1);
#endif

    // Install the handler for signals that we want to trap:
    // Note: We install the handlers after we initialize the setting because
    // we may do something different depending on the settings values.
    installOuterCrashHandler(SIGILL);
    installOuterCrashHandler(SIGSEGV);
    installOuterCrashHandler(SIGTERM);

    // Not needed anymore?
    ::prctl(PR_SET_NAME, (unsigned long) "WebAppMgr", 0, 0, 0);
    ::prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);

    const HostInfo* info = &(HostBase::instance()->getInfo());
    WebAppManager::instance()->setHostInfo(info);

    initMallocStatsCb(WebAppManager::instance()->mainLoop(), s_mallocStatsInterval);

    logInit();

    // Start the Browser App Launcher
    #ifdef NO_WEBKIT_INIT
        //WindowServer::instance()->bootupFinished();
    #else
        WebAppManager::instance()->run(); // Sync execution of the task
    #endif

    return 0;
}
Exemplo n.º 3
0
/**
 * Main program entry point
 *
 * This function is the one called by the operating system to start Luna.
 * 
 * This function sets {@link appArgc appArgc} and {@link appArgv appArgv}.
 * 
 * @see appArgc
 * @see appArgv
 *
 * @param	argc		Number of command-line arguments
 * @param	argv		Pointer to list of char* of each of the arguments
 *
 * @return			0 = success, anything else = failure
 */
int main( int argc, char** argv)
{
	appArgc = argc;
	appArgv = argv;

	std::set_terminate(generateGoodBacktraceTerminateHandler);

	g_thread_init(NULL);

	const char *renderMode;
#if defined(TARGET_DEVICE) && defined(HAVE_OPENGL)
	::setenv("QT_PLUGIN_PATH", "/usr/plugins", 1);
	renderMode = "HW egl";
#elif defined(TARGET_DEVICE) || defined(TARGET_EMULATOR)
	::setenv("QT_PLUGIN_PATH", "/usr/plugins", 1);	
	renderMode = "Software";
#elif defined(HAVE_OPENGL)
	renderMode = "HW OpenGL";
#else
	renderMode = "Software";
#endif

	WindowServer::markBootStart();

	g_debug("SysMgr compiled against Qt %s, running on %s, %s render mode requested", QT_VERSION_STR, qVersion(), renderMode);

	// Command-Line options
  	parseCommandlineOptions(argc, argv);

    if (s_debugTrapStr && 0 == strcasecmp(s_debugTrapStr, "on")) {
        debugCrashes = true;
    }

	if (s_mallocStatsFileStr) {
		setupMallocStats(s_mallocStatsFileStr);
	}

    sysmgrPid = getpid();

	// Load Settings (first!)
	Settings* settings = Settings::LunaSettings();

	// Initialize logging handler
	g_log_set_default_handler(logFilter, NULL);

#if defined(TARGET_DESKTOP)
	// use terminal logging when running on desktop
	settings->logger_useTerminal = true;
#endif

	// disable color logging using an environment variable. Useful when run from QtCreator
	const char* useColor = ::getenv("COLOR_LOGGING");
	if (useColor)
		settings->logger_useColor = (useColor[0] != 0 && useColor[0] != '0');

	HostBase* host = HostBase::instance();
	// the resolution is just a hint, the actual
	// resolution may get picked up from the fb driver on arm
	host->init(settings->displayWidth, settings->displayHeight);

#if defined(TARGET_DEVICE)
	pid_t animPid= spawnBootupAnimationProcess();
	if(animPid < 0) { // failed to start the Animation process
		return -1;
	}
#endif

#if defined(TARGET_DEVICE) && defined(HAVE_OPENGL) && defined(HAVE_QPA)
	if (settings->forceSoftwareRendering)
		::setenv("QT_QPA_PLATFORM", "palm-soft", 1);
	else
		::setenv("QT_QPA_PLATFORM", "palm", 1);
#endif
	
	
#if defined(TARGET_DEVICE) && defined(HAVE_OPENGL)
	if (!settings->forceSoftwareRendering)
		::setenv("QWS_DISPLAY", "egl", 1);
#endif


	pid_t webKitPid= spawnWebKitProcess();
	if(webKitPid < 0) { // failed to start the WebKit process
		return -1;
	}

	// Tie LunaSysMgr to Processor 0
	setCpuAffinity(getpid(), 1);

	// Tie WebAppMgr to Processor 1
	setCpuAffinity(webKitPid, 0);

	// Safe to create logging threads now
	logInit();

	// Initialize Ipc Server
	(void) IpcServer::instance();

	// Ipc Server is ready, so signal the WebAppMgr process (via pipe) to go ahead and connect
	::write(WebAppMgrPipeFd, &msgOkToContinue, 1);
	::close(WebAppMgrPipeFd);
	WebAppMgrPipeFd = -1;


#if !defined(TARGET_DESKTOP)
	// Set "nice" property
	setpriority(PRIO_PROCESS,getpid(),-1);
#endif

#if !defined(TARGET_DESKTOP) && !defined(HAVE_QPA)
	QWSServer::setDefaultMouse("HiddTp");
	QWSServer::setDefaultKeyboard("HiddKbd");
	::setenv("QWS_DBLCLICK_DISTANCE", QString("%0").arg(Settings::LunaSettings()->tapRadius).toAscii().constData(), 1);
#endif

	qInstallMsgHandler(qtMsgHandler);
	QApplication app(argc, argv);
	QApplication::setStartDragDistance(settings->tapRadius);
	QApplication::setDoubleClickInterval (Settings::LunaSettings()->tapDoubleClickDuration);
	host->show();
	
	initMallocStatsCb(HostBase::instance()->mainLoop(), s_mallocStatsInterval);

	// Initialize Preferences handler
	(void) Preferences::instance();

	// Initialize Localization handler
	(void) Localization::instance();

	//Register vibration/haptics support
	HapticsController::instance()->startService();

	(void) DeviceInfo::instance();

	// Initialize Security handler
	(void) Security::instance();

	// Initialize the System Service
	SystemService::instance()->init();

	// Initialize the application mgr
	ApplicationManager::instance()->init();

	// Initialize the Application Installer
	ApplicationInstaller::instance();

	// Start the window manager
	WindowServer *windowServer = WindowServer::instance();
	windowServer->installEventFilter(windowServer);

	// Initialize the SysMgr MemoryMonitor
	MemoryMonitor::instance();

	// load all set policies
	EASPolicyManager::instance()->load();

	// Launching of the System UI launcher and headless apps has been moved to WebAppMgrProxy::connectWebAppMgr

	// Did user specify an app to launch
	if (s_appToLaunchStr) {
		WebAppMgrProxy::setAppToLaunchUponConnection(s_appToLaunchStr);
	}

	app.exec();
	return 0;
}
Exemplo n.º 4
0
int main(int argc, char ** argv)
{
    setenv("QT_PLUGIN_PATH","/usr/plugins",1);
    setenv("QT_QPA_PLATFORM", "minimal",1);
    QApplication app(argc, argv);

	parseCommandlineOptions(argc, argv);
	setLoglevel(Settings::settings()->m_logLevel.c_str());

	g_log_set_default_handler(logFilter, NULL);
	g_warning("Started");

	SystemRestore::createSpecialDirectories();
	
	// Initialize the Preferences database
	(void) PrefsDb::instance();
	///and system restore (refresh settings while I'm at it...)
	SystemRestore::instance()->refreshDefaultSettings();
	
	//run startup restore before anything else starts
	SystemRestore::startupConsistencyCheck();
	
	Mainloop * mainLoopObj = new Mainloop();
	g_gmainLoop = mainLoopObj->getMainLoopPtr();
	
	//GMainLoop* mainLoop =  g_main_loop_new(NULL, FALSE);	
	
	LSPalmService* serviceHandle = NULL;
	LSError lsError;
	bool result;

	LSErrorInit(&lsError);

	// Register the service
	result = LSRegisterPalmService("com.palm.systemservice", &serviceHandle, &lsError);
	if (!result) {
		g_warning("Failed to register service: com.palm.sysservice");
		return -1;
	}

//	LSHandle * serviceHandlePublic = LSPalmServiceGetPublicConnection(serviceHandle);
	LSHandle * serviceHandlePrivate = LSPalmServiceGetPrivateConnection(serviceHandle);
		
	result = LSGmainAttachPalmService(serviceHandle, g_gmainLoop, &lsError);
	if (!result) {
		g_warning("Failed to attach service handle to main loop");
		return -1;
	}

	//turn novacom on if requested
	if (Settings::settings()->m_turnNovacomOnAtStartup)
	{
		turnNovacomOn(serviceHandlePrivate);
	}

	if ((result = LSCall(serviceHandlePrivate,"palm://com.palm.bus/signal/registerServerStatus",
			"{\"serviceName\":\"com.palm.image2\", \"subscribe\":true}",
			cbComPalmImage2Status,NULL,NULL, &lsError)) == false)
	{
		//non-fatal
		LSErrorFree(&lsError);
		LSErrorInit(&lsError);
	}

	// register for storage daemon signals
	result = LSCall(serviceHandlePrivate,
			"palm://com.palm.lunabus/signal/addmatch",
			"{\"category\":\"/storaged\", \"method\":\"MSMAvail\"}",
			SystemRestore::msmAvailCallback, NULL, SystemRestore::instance()->getLSStorageToken(), &lsError);
	if (!result)
		return -1;

	result = LSCall(serviceHandlePrivate,
			"palm://com.palm.lunabus/signal/addmatch",
			"{\"category\":\"/storaged\", \"method\":\"MSMProgress\"}",
			SystemRestore::msmProgressCallback, NULL, SystemRestore::instance()->getLSStorageToken(), &lsError);
	if (!result)
		return -1;

	result = LSCall(serviceHandlePrivate,
			"palm://com.palm.lunabus/signal/addmatch",
			"{\"category\":\"/storaged\", \"method\":\"MSMEntry\"}",
			SystemRestore::msmEntryCallback, NULL, SystemRestore::instance()->getLSStorageToken(), &lsError);
	if (!result)
		return -1;

	result = LSCall(serviceHandlePrivate,
			"palm://com.palm.lunabus/signal/addmatch",
			"{\"category\":\"/storaged\", \"method\":\"MSMFscking\"}",
			SystemRestore::msmFsckingCallback, NULL, SystemRestore::instance()->getLSStorageToken(), &lsError);
	if (!result)
		return -1;

	result = LSCall(serviceHandlePrivate,
			"palm://com.palm.lunabus/signal/addmatch",
			"{\"category\":\"/storaged\", \"method\":\"PartitionAvail\"}",
			SystemRestore::msmPartitionAvailCallback, NULL, SystemRestore::instance()->getLSStorageToken(), &lsError);
	if (!result)
		return -1;

	// Initialize the Prefs Factory
	PrefsFactory::instance()->setServiceHandle(serviceHandle);
	BackupManager::instance()->setServiceHandle(serviceHandle);

	//init the image service
	ImageServices * imgSvc = ImageServices::instance(mainLoopObj);
	if (!imgSvc) {
		g_warning("Image service failed init!");
	}

	//init the timezone service;
	TimeZoneService* tzSvc = TimeZoneService::instance();
	tzSvc->setServiceHandle(serviceHandle);
	
	// Run the main loop
	g_main_loop_run(g_gmainLoop);
	
	return 0;
}