void AIUpdate()
	{
		if ( IsTimerFinished( mStompTimer ) )
		{
			if( m_bStomp == false )
			{
				m_bStomp = true;
				Announce( "Volkhan prepares to shatter his Brittle Golems!" );
				CastSpellNowNoScheduling( mStomp );
				ResetTimer( mStompTimer, 3000 );
			}
			else
			{
				DoStomp();
				ResetTimer( mStompTimer, TIMER_STOMP + ( RandomUInt( 6 ) * 1000 ) );
			}
		};

		if ( GetHealthPercent() <= ( 100 - ( 20 * mPhase ) ) )
		{
			ForceWaypointMove( 1 );
			Announce( "Volkhan runs to his anvil!" );
			++mPhase;
		}

		ParentClass::AIUpdate();
	};
void MMatchServer::OnAdminHide(const MUID& uidAdmin)
{
	MMatchObject* pObj = GetObject(uidAdmin);
	if (!IsEnabledObject(pObj)) return;

	// 관리자 권한을 가진 사람이 아니면 연결을 끊는다.
	if (!IsAdminGrade(pObj))
	{
//		DisconnectObject(uidAdmin);		
		return;
	}

#if defined(LOCALE_NHNUSA) || defined(_DEBUG)
	m_HackingChatList.Init();
	mlog( "reload hacking chat list.\n" );
#endif

	if (pObj->CheckPlayerFlags(MTD_PlayerFlags_AdminHide)) {
		pObj->SetPlayerFlag(MTD_PlayerFlags_AdminHide, false);
		Announce(pObj, "Now Revealing...");
	} else {
		pObj->SetPlayerFlag(MTD_PlayerFlags_AdminHide, true);
		Announce(pObj, "Now Hiding...");
	}
}
	void switchStance(int32 pStance)
	{
		switch( pStance )
		{
		case STANCE_BATTLE:
			ApplyAura(SPELL_BATTLE_AURA);
			ApplyAura(SPELL_BATTLE_STANCE);
			Emote("Defend yourself, for all the good it will do!", Text_Yell, 14151);
			Announce( "General Bjarngrim switches to Battle Stance!" );
			SetPhase(1);
			break;
		case STANCE_BERSERKER:
			ApplyAura(SPELL_BERSERKER_AURA);
			ApplyAura(SPELL_BERSERKER_STANCE);
			Emote("GRAAAAAH! Behold the fury of iron and steel! ", Text_Yell, 14152);
			Announce( "General Bjarngrim switches to Berserker Stance!" );
			SetPhase(2);
			break;
		case STANCE_DEFENSIVE:
			ApplyAura(SPELL_DEFENSIVE_AURA);
			ApplyAura(SPELL_DEFENSIVE_STANCE);
			Emote("Give me your worst! ", Text_Yell, 14150);
			Announce( "General Bjarngrim switches to Defensive Stance!" );
			SetPhase(3);
			break;
		}
	};
void OutputManagerChecksum::Output(
	const Time & time
) {
	// Get processor rank
	int nRank;
	MPI_Comm_rank(MPI_COMM_WORLD, &nRank);

	// Equation set
	const EquationSet & eqn = m_grid.GetModel().GetEquationSet();

	// Compute checksums
	DataArray1D<double> dChecksum;

	m_grid.Checksum(DataType_State, dChecksum);
	if (nRank == 0) {
		for (int c = 0; c < eqn.GetComponents(); c++) {
			Announce("..Checksum (%s): %1.15e",
				eqn.GetComponentShortName(c).c_str(), dChecksum[c]);
		}
	}

	m_grid.Checksum(DataType_Tracers, dChecksum);
	if (nRank == 0) {
		for (int c = 0; c < eqn.GetTracers(); c++) {
			Announce("..Checksum (%s): %1.15e",
				eqn.GetTracerShortName(c).c_str(), dChecksum[c]);
		}
	}
}
void PrintMemoryLine(const char * szString) {
	rusage ruse;

	getrusage(RUSAGE_SELF, &ruse);

	if (szString == NULL) {
		Announce("MEMORY RES %lu", ruse.ru_maxrss);
	} else {
		Announce("%s : RES %lu : DATA %lu : STACK %lu",
			szString, ruse.ru_maxrss);
	}
}
Пример #6
0
ChatCommandPack SMOnlineRoom::ParseCommands(MString& data, unsigned int clientNum) {
    MString command;
    m_cNum = clientNum;

    if (data.find("/") != 0) {
        return ChatCommandPack(NONE);
    }
    command = GetCommand(data);

    ChatCommandPack ccp;

    if (m_clients[clientNum]->IsAdmin())
    {
        if (Announce(command, data, ccp))
            return ccp;
        if (Drop(command, data, ccp))
            return ccp;
    }

    if (Kick(command, data, ccp))
        return ccp;
    if (Ban(command, data, ccp))
        return ccp;
    if (Msg(command, data, ccp))
        return ccp;

    return ccp;
}
Пример #7
0
void CClient::CharDisconnect()
{
	ADDTOCALLSTACK("CClient::CharDisconnect");
	// Disconnect the CChar from the client.
	// Even tho the CClient might stay active.
	if ( !m_pChar )
		return;

	Announce(false);
	bool fCanInstaLogOut = CanInstantLogOut();
	int iLingerTime = g_Cfg.m_iClientLingerTime;

	// We are not a client anymore
	if ( m_bChatActive )
		g_Serv.m_Chats.QuitChat(this);

	if ( m_pHouseDesign )
		m_pHouseDesign->EndCustomize(true);

	if ( IsTrigUsed(TRIGGER_LOGOUT) )
	{
		CScriptTriggerArgs Args(iLingerTime, fCanInstaLogOut);
		m_pChar->OnTrigger(CTRIG_LogOut, m_pChar, &Args);
		iLingerTime = static_cast<int>(Args.m_iN1);
		fCanInstaLogOut = (Args.m_iN2 != 0);
	}

	m_pChar->ClientDetach();	// we are not a client any more.

	if ( iLingerTime <= 0 )
		fCanInstaLogOut = true;

	// Gump memory cleanup, we don't want them on logged out players
	m_mapOpenedGumps.clear();

	// Layer dragging, moving it to backpack
	CItem *pItemDragging = m_pChar->LayerFind(LAYER_DRAGGING);
	if ( pItemDragging )
		m_pChar->ItemBounce(pItemDragging);

	// log out immediately ? (test before ClientDetach())
	if ( !fCanInstaLogOut )
	{
		// become an NPC for a little while
		CItem *pItemChange = CItem::CreateBase(ITEMID_RHAND_POINT_W);
		ASSERT(pItemChange);
		pItemChange->SetName("Client Linger");
		pItemChange->SetType(IT_EQ_CLIENT_LINGER);
		pItemChange->SetTimeout(iLingerTime);
		m_pChar->LayerAdd(pItemChange, LAYER_FLAG_ClientLinger);
	}
	else
	{
		// remove me from other clients screens now.
		m_pChar->SetDisconnected();
	}

	m_pChar = NULL;
}
Пример #8
0
int main(int argc, char ** argv) {

    // Initialize MPI
    MPI_Init(&argc, &argv);

    try {

        // Input filename
        std::string strInputFile;

        // Output filename
        std::string strOutputFile;

        // List of variables to extract
        std::string strVariables;

        // Extract geopotential height
        bool fGeopotentialHeight;

        // Pressure levels to extract
        std::string strPressureLevels;

        // Height levels to extract
        std::string strHeightLevels;

        // Extract variables at the surface
        bool fExtractSurface;

        // Extract total energy
        bool fExtractTotalEnergy;

        // Parse the command line
        BeginCommandLine()
        CommandLineString(strInputFile, "in", "");
        CommandLineString(strOutputFile, "out", "");
        CommandLineString(strVariables, "var", "");
        CommandLineBool(fGeopotentialHeight, "output_z");
        CommandLineBool(fExtractTotalEnergy, "output_energy");
        CommandLineString(strPressureLevels, "p", "");
        CommandLineString(strHeightLevels, "z", "");
        CommandLineBool(fExtractSurface, "surf");

        ParseCommandLine(argc, argv);
        EndCommandLine(argv)

        AnnounceBanner();


        AnnounceEndBlock("Done");

    } catch(Exception & e) {
        Announce(e.ToString().c_str());
    }

    // Finalize MPI
    MPI_Finalize();

}
void SolveEvolutionMatrix(
	DataMatrix<double> & matM,
	DataMatrix<double> & matB,
	DataVector<double> & vecAlphaR,
	DataVector<double> & vecAlphaI,
	DataVector<double> & vecBeta,
	DataMatrix<double> & matVR
) {
	int iInfo = 0;

	char jobvl = 'N';
	char jobvr = 'V';

	int n = matM.GetRows();
	int lda = matM.GetRows();
	int ldb = matM.GetRows();
	int ldvl = 1;
	int ldvr = matVR.GetRows();

	DataVector<double> vecWork;
	vecWork.Initialize(8 * n);
	int lwork = vecWork.GetRows();

	dggev_(
		&jobvl,
		&jobvr,
		&n,
		&(matM[0][0]),
		&lda,
		&(matB[0][0]),
		&ldb,
		&(vecAlphaR[0]),
		&(vecAlphaI[0]),
		&(vecBeta[0]),
		NULL,
		&ldvl,
		&(matVR[0][0]),
		&ldvr,
		&(vecWork[0]),
		&lwork,
		&iInfo);

	int nCount = 0;
	for (int i = 0; i < n; i++) {
		if (vecBeta[i] != 0.0) {
			//printf("%i %1.5e %1.5e\n", i, vecAlphaR[i] / vecBeta[i], vecAlphaI[i] / vecBeta[i]);
			nCount++;
		}
	}
/*
	for (int i = 0; i < 40; i++) {
		printf("%1.5e %1.5e\n", matVR[11][4*i+2], matVR[12][4*i+2]);
	}
*/
	Announce("%i total eigenvalues found", nCount);
}
Пример #10
0
// Prepare weights used by map2alm. weight array must be allocated already:
void PrepRingWeights(int col, arr<double> & weight, int nside) {
  double *tempweight;
  int status;
  long i;

  if (USE_WEIGHTS==1) {
    Announce("Loading Healpix map weights... ");
    tempweight = vector<double>(0, 2*nside-1);
    status = ReadHealpixWeights(col, nside, tempweight);
    if (status==0) for (i=0; i<2*nside; i++) weight[i]=1.0+tempweight[i];
    else { 
      warning("PrepRingWeights: could not load Healpix weights, using 1.0 instead.");
      weight.fill(1);
    }
    free_vector(tempweight, 0, 2*nside-1);
    Announce();
  }
  else weight.fill(1);
}
Пример #11
0
		void AIUpdate()
		{
			if(GetHealthPercent() <= 25 && mEnraged == false)
			{
				ApplyAura(FRENZY);
				Announce("Ormorok the Tree-Shaper goes into a frenzy!");
				mEnraged = true;
			};

			ParentClass::AIUpdate();
		};
Пример #12
0
		void ChargeRift()
		{
			SummonRift(true);

			Announce("Anomalus shields himself and diverts his power to the rifts!");
			Emote("Indestructible.", Text_Yell, 13189);
			ApplyAura(47748);   // me immune
			SetCanMove(false);

			mRift = true;
			mSummon += 1;
		};
		void AIUpdate()
		{
			if(IsTimerFinished(mNovaTimer))
			{
				switch(RandomUInt(2))
				{
					case 0:
						Emote("You cannot hide from fate!",			Text_Yell,	14163);
						break;
					case 1:
						Emote("Come closer. I will make it quick.",	Text_Yell,	14164);
						break;
					case 2:
						Emote("Your flesh cannot hold out for long.",	Text_Yell,	14165);
						break;
				};

				Announce("Loken begins to cast Lightning Nova!");
				CastSpellNowNoScheduling(mNova);
				ResetTimer(mNovaTimer, TIMER_NOVA + (RandomUInt(8) * 1000));
			};

			if(mSpeech == 4)
				return;

			if(GetHealthPercent() <= (100 - (25 * mSpeech)))
			{
				switch(mSpeech)
				{
					case 1:
						Emote("You stare blindly into the abyss!",	                                    Text_Yell, 14169);
						break;
					case 2:
						Emote("Your ignorance is profound. Can you not see where this path leads?",    Text_Yell, 14170);
						break;
					case 3:
						Emote("You cross the precipice of oblivion!",                                  Text_Yell, 14171);
						break;
						++mSpeech;
				};
			};

			if(IsTimerFinished(mRespondTimer))
			{
				Emote("My master has shown me the future, and you have no place in it. Azeroth will be reborn in darkness. Yogg-Saron shall be released! The Pantheon shall fall!", Text_Yell, 14161);
				RemoveTimer(mRespondTimer);
				RemoveAIUpdateEvent();
			};

			ParentClass::AIUpdate();
		};
Пример #14
0
		void SummonRift(bool bToCharge)
		{
			if(!bToCharge)
				Emote("Reality... unwoven.", Text_Yell, 13188);

			Announce("Anomalus opens a Chaotic Rift!");
			//we are linked with CN_CHAOTIC_RIFT.
			CreatureAIScript* chaoticRift = SpawnCreature(CN_CHAOTIC_RIFT, _unit->GetPositionX() + 13.5f, _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation(), false);
			if(chaoticRift != NULL)
			{
				SetLinkedCreature(chaoticRift);
				chaoticRift->SetLinkedCreature(this);
			}
		};
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::CleanUpEntity(SHoldEntityDetails *pDetails)
{
	CCCPOINT(HoldObjective_CleanUpActiveCaptureEntity);

	if (pDetails->m_localPlayerIsWithinRange)
	{		
		CHUDEventDispatcher::CallEvent(SHUDEvent(eHUDEvent_OnSiteAboutToExplode));
	}

	OnRemoveHoldEntity(pDetails);

	gEnv->pEntitySystem->RemoveEntityEventListener(pDetails->m_id, ENTITY_EVENT_ENTERAREA, this);
	gEnv->pEntitySystem->RemoveEntityEventListener(pDetails->m_id, ENTITY_EVENT_LEAVEAREA, this);

	if (m_spawnPOIType == eSPT_Avoid)
	{
		IGameRulesSpawningModule *pSpawningModule = g_pGame->GetGameRules()->GetSpawningModule();
		if (pSpawningModule)
		{
			pSpawningModule->RemovePOI(pDetails->m_id);
		}
	}

	IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pDetails->m_id);
	if (pEntity)
	{
		IScriptTable *pScript = pEntity->GetScriptTable();
		if (pScript != NULL && pScript->GetValueType("DeactivateCapturePoint") == svtFunction)
		{
			IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
			pScriptSystem->BeginCall(pScript, "DeactivateCapturePoint");
			pScriptSystem->PushFuncParam(pScript);
			pScriptSystem->PushFuncParam(true);
			pScriptSystem->EndCall();
		}

		CGameRules *pGameRules = g_pGame->GetGameRules();
		EGameMode gamemode = pGameRules->GetGameMode();
		if (gamemode == eGM_CrashSite)
		{
			Announce("Destruct", k_announceType_CS_Destruct);
		}
	}

	pDetails->Reset();

	// Fade out effect
	m_effectData.alphaLerp.Set(1.0f,0.0f,0.0f);
}
Пример #16
0
void OutputManager::InitialOutput(
	const Time & time
) {
	// Check if we were initialized from a recovery file
	if (m_fFromRestartFile) {
		Announce("%s (%i): %s (Initial; Output Suppressed)",
			GetName(),
			m_ixOutputFile+1,
			time.ToString().c_str());

	// Output initial conditions
	} else {
		Announce("%s (%i/%i): %s (Initial)",
			GetName(),
			m_ixOutputFile+1,
			m_ixOutputTime+1,
			time.ToString().c_str());

		PerformOutput(time);
	}

	m_timeNextOutput = time;
	m_timeNextOutput += m_timeOutputFrequency;
}
Пример #17
0
bool
Client::Connect(const SocketType& type)
{
  fType = type;
  try {
    Start();
    PrepareConnection();
    Announce();
  } catch (Exception& e) { 
    e.Dump();
    return false;
  }

  fIsConnected = true;
  return true;
}
Пример #18
0
int main(int argc, char** argv) {

    NcError error(NcError::silent_nonfatal);

    try {

        // Resolution
        int nResolution;

        // Dual mesh
        bool fDual;

        // Output filename
        std::string strOutputFile;

        // Parse the command line
        BeginCommandLine()
        CommandLineInt(nResolution, "res", 10);
        CommandLineBool(fDual, "dual");
        CommandLineString(strOutputFile, "file", "outICOMesh.g");

        ParseCommandLine(argc, argv);
        EndCommandLine(argv)

        // Generate Mesh
        AnnounceBanner();
        AnnounceStartBlock("Generating Mesh");
        Mesh mesh;
        GenerateIcosahedralQuadGrid(nResolution, mesh.nodes, mesh.faces);
        AnnounceEndBlock("Done");

        // Generate the dual grid
        if (fDual) {
            Dual(mesh);
        }

        // Output the mesh
        AnnounceStartBlock("Writing Mesh to file");
        Announce("Mesh size: Nodes [%i] Elements [%i]",
                 mesh.nodes.size(), mesh.faces.size());
        mesh.Write(strOutputFile);
        AnnounceEndBlock("Done");

    } catch(Exception & e) {
        std::cout << e.ToString() << std::endl;
    }
}
Пример #19
0
void OutputManager::FinalOutput(
	const Time & time
) {
	// Verify that the time has changed sufficiently since last output
	if (time == m_timeLastOutput) {
		return;
	}

	// Notification
	Announce("%s (%i/%i): %s (Final)",
		GetName(),
		m_ixOutputFile+1,
		m_ixOutputTime+1,
		time.ToString().c_str());

	// Output
	PerformOutput(time);
}
void MMatchServer::OnAdminRequestSwitchLadderGame(const MUID& uidAdmin, const bool bEnabled)
{
	MMatchObject* pObj = GetObject(uidAdmin);
	if (!IsEnabledObject(pObj)) return;

	// 관리자 권한을 가진 사람이 아니면 연결을 끊는다.
	if (!IsAdminGrade(pObj))
	{
//		DisconnectObject(uidAdmin);		
		return;
	}

	
	MGetServerConfig()->SetEnabledCreateLadderGame(bEnabled);


	char szMsg[256] = "설정되었습니다.";
	Announce(pObj, szMsg);
}
Пример #21
0
void OutputManager::ManageOutput(
	const Time & time
) {
	// Notification
	Announce("%s (%i/%i): %s",
		GetName(),
		m_ixOutputFile+1,
		m_ixOutputTime+1,
		time.ToString().c_str());

	// Perform the output
	PerformOutput(time);

	// Update last output time
	m_timeLastOutput = time;

	// Update next output time
	m_timeNextOutput += m_timeOutputFrequency;
}
Пример #22
0
void AnnounceEndBlock(const char * szText) {
	// Do not remove a block at minimum indentation level
	if (s_nIndentationLevel == 0) {
		return;
	}

#ifdef TEMPEST_MPIOMP
	// Only output on rank zero
	if (g_fOnlyOutputOnRankZero) {
		int nRank;

		MPI_Comm_rank(MPI_COMM_WORLD, &nRank);

		if (nRank > 0) {
			return;
		}
	}
#endif

	// Check block flag
	if (szText != NULL) {
		if (s_fBlockFlag) {
			s_fBlockFlag = false;

			fprintf(g_fpAnnounceOutput, ".. ");
			fprintf(g_fpAnnounceOutput, "%s", szText);
			fprintf(g_fpAnnounceOutput, "\n");

		} else {
			Announce(szText);
		}
	}

	s_nIndentationLevel--;

	fflush(g_fpAnnounceOutput);
}
Пример #23
0
Discovery::Announce Discovery::Announce::fromBinary(const QByteArray &data) {
	Announce rc;

	if (data.startsWith(QByteArray("BSYNC\0", 6))) {
		libtorrent::entry e = libtorrent::bdecode(data.begin()+6, data.end());
		libtorrent::entry::dictionary_type dict = e.dict();

		MessageType m = (MessageType) dict.at("m").integer();
		std::string peerId = dict.at("peer").string();
		std::string shareHash = dict.at("share").string();
		PeerAddress localAddress, externalAddress;
		if (dict.count("la")) {
			localAddress = PeerAddress::fromBinary(dict.at("la").string());
		}
		if (dict.count("a")) {
			externalAddress = PeerAddress::fromBinary(dict.at("a").string());
		}


		rc = Announce(Secret::fromShareHash(shareHash), Peer(QByteArray(peerId.data(), peerId.length()), localAddress, externalAddress));
	}

	return rc;
}
//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::DoAddEntityId(int type, EntityId entityId, int index, bool isNewEntity)
{
	CRY_ASSERT(index < HOLD_OBJECTIVE_MAX_ENTITIES);
	CryLog("CGameRulesHoldObjectiveBase::DoAddEntityId() received objective, eid=%i, index=%i", entityId, index);

	SHoldEntityDetails *pDetails = &m_entities[index];

	pDetails->m_id = entityId;

	if (m_spawnPOIType == eSPT_Avoid)
	{
		IGameRulesSpawningModule *pSpawningModule = g_pGame->GetGameRules()->GetSpawningModule();
		if (pSpawningModule)
		{
			pSpawningModule->AddAvoidPOI(entityId, m_spawnPOIDistance, true, AreObjectivesStatic());
		}
	}

	OnNewHoldEntity(pDetails, index);
	CCCPOINT(HoldObjective_AddEntity);

	gEnv->pEntitySystem->AddEntityEventListener(entityId, ENTITY_EVENT_ENTERAREA, this);
	gEnv->pEntitySystem->AddEntityEventListener(entityId, ENTITY_EVENT_LEAVEAREA, this);

	if (gEnv->bServer)
	{
		CHANGED_NETWORK_STATE(g_pGame->GetGameRules(), HOLD_OBJECTIVE_STATE_ASPECT);
	}

	if(isNewEntity)
	{
		//Not playing for the first time because it clashes with game start
		Announce("Incoming", k_announceType_CS_Incoming, m_shouldPlayIncomingAudio);
		m_shouldPlayIncomingAudio = true;
	}

	IEntity *pEntity = gEnv->pEntitySystem->GetEntity(entityId);
	if (pEntity)
	{
		IScriptTable *pScript = pEntity->GetScriptTable();
		CRY_TODO(11, 02, 2009, "function name from xml?");
		if (pScript)
		{
			if (pScript->GetValueType("ActivateCapturePoint") == svtFunction)
			{
				if (isNewEntity)
				{
					// Set flag to say we're expecting a trackview to start - so we can set the start position in the callback
					m_bExpectingMovieStart = true;

					if (!m_bAddedMovieListener)
					{
						if (gEnv->pMovieSystem)
						{
							CryLog("CGameRulesHoldObjectiveBase::CGameRulesHoldObjectiveBase() adding movie listener");
							gEnv->pMovieSystem->AddMovieListener(NULL, this);
							m_bAddedMovieListener = true;
						}
					}
				}

				IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
				pScriptSystem->BeginCall(pScript, "ActivateCapturePoint");
				pScriptSystem->PushFuncParam(pScript);
				pScriptSystem->PushFuncParam(isNewEntity);
				pScriptSystem->EndCall();
			}
			SmartScriptTable propertiesTable;
			if (pScript->GetValue("Properties", propertiesTable))
			{
				pDetails->m_controlRadius = 5.f;
				propertiesTable->GetValue("ControlRadius", pDetails->m_controlRadius);
				pDetails->m_controlRadiusSqr = (pDetails->m_controlRadius * pDetails->m_controlRadius);
				pDetails->m_controlHeight = 5.f;
				propertiesTable->GetValue("ControlHeight", pDetails->m_controlHeight);
				pDetails->m_controlOffsetZ = 0.f;
				propertiesTable->GetValue("ControlOffsetZ", pDetails->m_controlOffsetZ);
			}
		}

		const IActor *pLocalPlayer = g_pGame->GetIGameFramework()->GetClientActor();
		if (pLocalPlayer != NULL && IsActorEligible(pLocalPlayer))
		{
			CheckLocalPlayerInside(pDetails, pEntity, pLocalPlayer->GetEntity());
		}
	}
}
Пример #25
0
void configure_intfc::on_pushButton_TestAlarmSound_clicked()
{
    Announce(2, "Test", "Test Alarm Sound");
}
Пример #26
0
int main(int argc, char **argv)
{
    int		    i, Mail = FALSE;
    char	    *cmd;
    struct passwd   *pw;
    struct tm	    *t;

    InitConfig();
    ftnd_TermInit(1, 80, 25);
    t_start = time(NULL);
    t = localtime(&t_start);
    Diw = t->tm_wday;
    Miy = t->tm_mon;
    umask(002);

	
    /*
     * Catch all signals we can, and ignore the rest.
     */
    for (i = 0; i < NSIG; i++) {
	if ((i == SIGHUP) || (i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGIOT))
	    signal(i, (void (*))die);
	else if ((i != SIGKILL) && (i != SIGSTOP))
	    signal(i, SIG_IGN);
    }

    if (argc < 2)
	Help();

    cmd = xstrcpy((char *)"Command line: ftnaff");

    for (i = 1; i < argc; i++) {

	cmd = xstrcat(cmd, (char *)" ");
	cmd = xstrcat(cmd, tl(argv[i]));

	if (!strncmp(argv[i], "a", 1))
	    do_announce = TRUE;
	if (!strncmp(argv[i], "f", 1))
	    do_filefind = TRUE;
	if (!strncmp(argv[i], "-q", 2))
	    do_quiet = TRUE;

    }

    ProgName();
    pw = getpwuid(getuid());
    InitClient(pw->pw_name, (char *)"ftnaff", CFG.location, CFG.logfile, 
	    CFG.util_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);

    Syslog(' ', " ");
    Syslog(' ', "FTNDAFF v%s", VERSION);
    Syslog(' ', cmd);
    free(cmd);

    if (!do_quiet)
	printf("\n");

    if (enoughspace(CFG.freespace) == 0)
	die(FTNERR_DISK_FULL);

    if (lockprogram((char *)"ftnaff")) {
	if (!do_quiet)
	    printf("Can't lock ftnaff, abort.\n");
	die(FTNERR_NO_PROGLOCK);
    }

    memset(&MsgBase, 0, sizeof(MsgBase));

    if (do_announce)
	if (Announce())
	    Mail = TRUE;

    if (do_filefind)
	if (Filefind())
	    Mail = TRUE;

    if (Mail) {
	CreateSema((char *)"mailout");
	CreateSema((char *)"msglink");
    }

    die(FTNERR_OK);
    return 0;
}
void ReadCFTimeDataFromNcFile(
	NcFile * ncfile,
	const std::string & strFilename,
	std::vector<Time> & vecTimes,
	bool fWarnOnMissingCalendar
) {
	// Empty existing Time vector
	vecTimes.clear();

	// Get time dimension
	NcDim * dimTime = ncfile->get_dim("time");
	if (dimTime == NULL) {
		_EXCEPTION1("Dimension \"time\" not found in file \"%s\"",
			strFilename.c_str());
	}

	// Get time variable
	NcVar * varTime = ncfile->get_var("time");
	if (varTime == NULL) {
		_EXCEPTION1("Variable \"time\" not found in file \"%s\"",
			strFilename.c_str());
	}
	if (varTime->num_dims() != 1) {
		_EXCEPTION1("Variable \"time\" has more than one dimension in file \"%s\"",
			strFilename.c_str());
	}
	if (strcmp(varTime->get_dim(0)->name(), "time") != 0) {
		_EXCEPTION1("Variable \"time\" does not have dimension \"time\" in file \"%s\"",
			strFilename.c_str());
	}

	// Calendar attribute
	NcAtt * attTimeCal = varTime->get_att("calendar");
	std::string strCalendar;
	if (attTimeCal == NULL) {
		if (fWarnOnMissingCalendar) {
			Announce("WARNING: Variable \"time\" is missing \"calendar\" attribute; assuming \"standard\"");
		}
		strCalendar = "standard";
	} else {
		strCalendar = attTimeCal->as_string(0);
	}
	Time::CalendarType eCalendarType =
		Time::CalendarTypeFromString(strCalendar);

	// Units attribute
	NcAtt * attTimeUnits = varTime->get_att("units");
	if (attTimeUnits == NULL) {
		_EXCEPTION1("Variable \"time\" is missing \"units\" attribute in file \"%s\"",
			strFilename.c_str());
	}
	std::string strTimeUnits = attTimeUnits->as_string(0);

	// Load in time data
	DataVector<int> vecTimeInt;
	DataVector<float> vecTimeFloat;
	DataVector<double> vecTimeDouble;
	DataVector<ncint64> vecTimeInt64;

	if (varTime->type() == ncInt) {
		vecTimeInt.Initialize(dimTime->size());
		varTime->set_cur((long)0);
		varTime->get(&(vecTimeInt[0]), dimTime->size());

	} else if (varTime->type() == ncFloat) {
		vecTimeFloat.Initialize(dimTime->size());
		varTime->set_cur((long)0);
		varTime->get(&(vecTimeFloat[0]), dimTime->size());

	} else if (varTime->type() == ncDouble) {
		vecTimeDouble.Initialize(dimTime->size());
		varTime->set_cur((long)0);
		varTime->get(&(vecTimeDouble[0]), dimTime->size());

	} else if (varTime->type() == ncInt64) {
		vecTimeInt64.Initialize(dimTime->size());
		varTime->set_cur((long)0);
		varTime->get(&(vecTimeInt64[0]), dimTime->size());

	} else {
		_EXCEPTION1("Variable \"time\" has invalid type "
			"(expected \"int\", \"int64\", \"float\" or \"double\")"
			" in file \"%s\"", strFilename.c_str());
	}

	for (int t = 0; t < dimTime->size(); t++) {
		Time time(eCalendarType);
		if (varTime->type() == ncInt) {
			time.FromCFCompliantUnitsOffsetInt(
				strTimeUnits,
				vecTimeInt[t]);

		} else if (varTime->type() == ncFloat) {
			time.FromCFCompliantUnitsOffsetDouble(
				strTimeUnits,
				static_cast<double>(vecTimeFloat[t]));

		} else if (varTime->type() == ncDouble) {
			time.FromCFCompliantUnitsOffsetDouble(
				strTimeUnits,
				vecTimeDouble[t]);

		} else if (varTime->type() == ncInt64) {
			time.FromCFCompliantUnitsOffsetInt(
				strTimeUnits,
				(int)(vecTimeInt64[t]));

		}

		vecTimes.push_back(time);
	}
}
Пример #28
0
void configure_intfc::on_pushButton_TestInfoSound_clicked()
{
    Announce(1, "Test", "Test Info Sound");
}
Пример #29
0
void configure_intfc::on_pushButton_TestCatastrophySound_clicked()
{
    Announce(3, "Test", "Test Catastrophy Sound");
}
Пример #30
0
void configure_intfc::on_pushButton_TestLostSound_clicked()
{
    Announce(4, "Test", "Test Processor Lost Sound");
}