Esempio n. 1
0
void
phEnd(PhPrFun prf, PhPrFun pprf, Pointer ob)
{
	if (phCurrent->flags & PHX_GcAfter) {
		int	cd;

		if (phCurrent->flags & PHX_StoAudit) stoAudit();
		stoGc();
		if (phCurrent->flags & PHX_StoAudit) stoAudit();

		for (cd = 0; cd < OB_LIMIT; cd++) {
			if (stoPiecesGc[cd])
				fprintf(osStdout, "%ld * %s\n",
					stoPiecesGc[cd], obInfo[cd].str);
		}
		fprintf(osStdout, "\n");
	}
	else if (phCurrent->flags & PHX_StoAudit)
		stoAudit();

	phCurrent->time	 += osCpuTime()	  - thisPhaseStartCPU;
	phCurrent->alloc += stoBytesAlloc - thisPhaseStartAlloc;
	phCurrent->free	 += stoBytesFree  - thisPhaseStartFree;
	phCurrent->gc	 += stoBytesGc	  - thisPhaseStartGc;

	if ((phCurrent->flags & PHX_Announce) && allPhasesVerbose) {
		fprintf(osStdout, "Time  %5ld.%.3ld s\n",
			phCurrent->time / 1000, phCurrent->time % 1000);
		fprintf(osStdout, "Store  %8ld B ", stoBytesOwn);
#ifndef NDEBUG
		fprintf(osStdout, ": %ld B alloc - %ld B free - %ld gc = %ld\n",
			phCurrent->alloc,
			phCurrent->free,
			phCurrent->gc,
			stoBytesAlloc - stoBytesFree - stoBytesGc);
#else
		fprintf(osStdout, "\n");
#endif
	}

	if (phCurrent->flags & (PHX_Print | PHX_Report))
		fprintf(osStdout, "*** Result of %s:\n", phCurrent->name);

	if (phCurrent->flags & PHX_Print) {
		if (pprf) pprf(osStdout, ob);
		fprintf(osStdout, "\n\n");
	}
	if (phCurrent->flags & PHX_Report) {
		if (prf) prf(osStdout, ob);
		fprintf(osStdout, "\n\n");
	}
	if (phCurrent->flags & PHX_Terminates)
		exitSuccess();
}
Esempio n. 2
0
Mento::Mento(QObject *parent) :
    QObject(parent)
{
    if(CocoaInitialize::DefaultApp()->checkRunning())
    {
        initsuccess=false;
        QMessageBox::warning(0,"Warning","Cocoa Mento 正在运行当中!",QMessageBox::Ok,QMessageBox::Ok);
        return;
    }
    else initsuccess=true;

    log=new QTextBrowser();
    log->setWindowModality(Qt::WindowModal);
    log->setWindowFlags(Qt::WindowStaysOnTopHint|Qt::CustomizeWindowHint|Qt::WindowCloseButtonHint);
    log->setGeometry(200,200,400,500);
    log->setWindowTitle(tr("认证日志"));

    gt=new Guite();

    main=new Menu("Cocoa Mento");
    sub=new Menu("Settings");

    status=new MenuItem("[状态:正常] 未连接");
    connectHandle=new MenuItem("开始认证");
    settings=new MenuItem("偏好设置");
    about=new MenuItem("关于CocoaMento");
    aboutQt=new MenuItem("关于Qt");
    help=new MenuItem("使用说明");
    exit=new MenuItem("退出");
    resetsettings=new MenuItem("重置偏好设置");
    logs=new MenuItem("显示日志");

    cv=new ConfigView();
    cvcontainer=new MenuViewItem("Settings",cv);

    cv->setPalette(Qt::white);
    cv->show();

    settings->setSubMenu(sub);

    main->addMenuItem(status);
    main->addMenuSeparator();
    main->addMenuItem(connectHandle);
    main->addMenuItem(settings);
    main->addMenuItem(resetsettings);
    main->addMenuItem(logs);
    main->addMenuSeparator();
    main->addMenuItem(help);
    main->addMenuItem(about);
    main->addMenuItem(aboutQt);
    main->addMenuSeparator();
    main->addMenuItem(exit);

    sub->addMenuItem(cvcontainer);

    icon=new StatusIcon();
    icon->setMenu(main);
    icon->showIcon();

    mainthread=new MentoThread(cv->Config());

    connect((QObject*)exit->port,SIGNAL(trigger()),this,SLOT(quitApp()));
    connect((QObject*)resetsettings->port,SIGNAL(trigger()),cv,SLOT(resetConfig()));
    connect((QObject*)connectHandle->port,SIGNAL(trigger()),this,SLOT(toggleConnect()));
    connect((QObject*)logs->port,SIGNAL(trigger()),log,SLOT(show()));
    connect((QObject*)about->port,SIGNAL(trigger()),gt,SLOT(showAbout()));
    connect((QObject*)aboutQt->port,SIGNAL(trigger()),this,SLOT(showAboutQt()));
    connect((QObject*)help->port,SIGNAL(trigger()),gt,SLOT(showHelp()));


    connect(mainthread,SIGNAL(output(QString)),this,SLOT(outputHandle(QString)));
    connect(mainthread,SIGNAL(exitSuccess()),this,SLOT(exitHandle()));
    connect(mainthread,SIGNAL(statusChanged(QString,int)),this,SLOT(statusHandle(QString,int)));
    connect(mainthread,SIGNAL(error(QString)),this,SLOT(errorHandle(QString)));
    connect(mainthread,SIGNAL(authError()),this,SLOT(authMento()));
    connect(mainthread,SIGNAL(noConfig()),this,SLOT(noconfigHandle()));
    connect(mainthread,SIGNAL(notify(QString)),this,SLOT(notifyHandle(QString)));

    if(cv->autoConnect()) toggleConnect();
}
Esempio n. 3
0
int main(int argc, char* argv[])
{
	// Ensure we are called by our Node library.
	if (argc == 1 || !std::getenv("MEDIASOUP_CHANNEL_FD"))
	{
		std::cerr << "ERROR: you don't seem to be my real father" << std::endl;
		std::_Exit(EXIT_FAILURE);
	}

	std::string id = std::string(argv[1]);
	int channelFd = std::stoi(std::getenv("MEDIASOUP_CHANNEL_FD"));

	// Initialize libuv stuff (we need it for the Channel).
	DepLibUV::ClassInit();

	// Set the Channel socket (this will be handled and deleted by the Loop).
	Channel::UnixStreamSocket* channel = new Channel::UnixStreamSocket(channelFd);

	// Initialize the Logger.
	Logger::Init(id, channel);

	// Setup the configuration.
	try
	{
		Settings::SetConfiguration(argc, argv);
	}
	catch (const MediaSoupError &error)
	{
		MS_ERROR("configuration error: %s", error.what());

		exitWithError();
	}

	// Print the effective configuration.
	Settings::PrintConfiguration();

	MS_DEBUG("starting " MS_PROCESS_NAME " [pid:%ld]", (long)getpid());

	#if defined(MS_LITTLE_ENDIAN)
		MS_DEBUG("detected Little-Endian CPU");
	#elif defined(MS_BIG_ENDIAN)
		MS_DEBUG("detected Big-Endian CPU");
	#endif

	#if defined(INTPTR_MAX) && defined(INT32_MAX) && (INTPTR_MAX == INT32_MAX)
		MS_DEBUG("detected 32 bits architecture");
	#elif defined(INTPTR_MAX) && defined(INT64_MAX) && (INTPTR_MAX == INT64_MAX)
		MS_DEBUG("detected 64 bits architecture");
	#else
		MS_WARN("cannot determine whether the architecture is 32 or 64 bits");
	#endif

	try
	{
		init();

		// Run the Loop.
		Loop loop(channel);

		destroy();

		MS_DEBUG_STD("success exit");
		exitSuccess();
	}
	catch (const MediaSoupError &error)
	{
		destroy();

		MS_ERROR_STD("failure exit: %s", error.what());
		exitWithError();
	}
}
Esempio n. 4
0
local int
cmdDoOptDeveloper(String arg)
{
	int	rc = 0;
 
	if (!arg[0])
		rc = -1;
 
	if (strAEqual("trap", arg)) {
		cmdTrapFlag = true;
	}
	else if (strAEqual("check", arg)) {
		_dont_assert = false;	   /* Test assertions. */
		stoCtl(StoCtl_Wash, true); /* Initialize of store. */
	}
	else if (strAEqual("no-fatal", arg))
		_fatal_assert = false;	   /* Make assertions non-fatal. */
	else if (strAEqual("runtime", arg))
		genSetRuntime();
	else if (strEqual("debug", arg))
		genSetDebugWanted(true);
	else if (strEqual("debugger", arg))
		genSetDebuggerWanted(true);
	else if (strEqual("depend", arg))
		emitSetDependsWanted(true);
	else if (strEqual("small-hcodes", arg))
		genSetSmallHashCodes(true);
	else if (strEqual("lazy-catch", arg))
		gfSetLazyCatch(true);
	else if (strEqual("dumb-import", arg))
		stabSetDumbImport(true);
	else if (strEqual("trace-cfuns", arg))
		gencSetTraceFuns(true);
	else if (strEqual("no-where", arg))
		NoWhereHack = true;
	else if (strAEqual("runtime-hashcheck", arg))
		genSetHashcheck();
	else if (strAIsPrefix("keyword", arg)) {
		String darg = cmdDGetOptArg(arg, "keyword", NULL);
		cmdDoKeywordStatus(darg, true);
	}
	else if (strAIsPrefix("no-keyword", arg)) {
		String darg = cmdDGetOptArg(arg, "no-keyword", NULL);
		cmdDoKeywordStatus(darg, false);
	}
	else if (strEqual("no-negated-tests", arg))
		jflowSetNegate(false);
	else if (strAEqual("audit", arg))
		foamAuditSetAll();
	else if (strAEqual("nhash", arg))
		genSetAxiomAx(true);
	else if (strAEqual("missing-ok", arg))
		tiSetSoftMissing(true);
	else if (strAEqual("sexpr", arg)) {
		cmdSExprFlag = true;
	}
	else if (strAEqual("seval", arg)) {
		cmdSEvalFlag = true;
	}
	else if (strAEqual("no-gc", arg)) {
		/* Handled already - no action need be taken here */
	}
	else if (strAEqual("gc", arg)) {
		/* Handled already - no action need be taken here */
		cmdGcFlag = true;
	}
	else if (strAEqual("gcfile", arg)) {
		/* Handled already - no action need be taken here */
		cmdGcFileFlag = true;
	}
	else if (strAEqual("loops", arg)) {
		optSetLoopOption();
	}
	else if (strAEqual("emerge-noalias", arg)) {
		emSetNoAlias();
	}
	else if (strAIsPrefix("test", arg)) {
		String darg = cmdDGetOptArg(arg, "test", NULL);
		testSelf(darg);
		exitSuccess();
	}
	else if (strAIsPrefix("rtcache", arg)) {
		String darg = cmdDGetOptArg(arg, "rtcache", NULL);
		long rtsize;
		extern void gen0SetRtCacheSize(AInt);

		sscanf(darg, "%ld", &rtsize);
		gen0SetRtCacheSize((AInt)rtsize);
	}
	else if (strAIsPrefix("D", arg)) {
		char	sep;
		String  darg = cmdDGetOptArg(arg, "D", &sep);
		rc   = cmdDDebug(darg, sep == '+');
	}
	else if (strAIsPrefix("T", arg)) {
		rc = phTraceOption(arg+strlen("T"));
	}
	else if (strAIsPrefix("name", arg)) {
		String darg = cmdDGetOptArg(arg, "name", NULL);
		emitSetFileIdName(darg);
	}
	else if (strAIsPrefix("prefix", arg)) {
		String darg = cmdDGetOptArg(arg, "prefix", NULL);
		emitSetFileIdPrefix(darg);
	}
	else if (strAEqual("floatrep", arg)) {
		cmdFloatRepFlag = true;
	}
	else
		rc = -1;

	return rc;
}