void FBaseParser::ParseNameWithPotentialAPIMacroPrefix(FString& DeclaredName, FString& RequiredAPIMacroIfPresent, const TCHAR* FailureMessage) { // Expecting Name | (MODULE_API Name) FToken NameToken; // Read an identifier if (!GetIdentifier(NameToken)) { FError::Throwf(TEXT("Missing %s name"), FailureMessage); } // Is the identifier the name or an DLL import/export API macro? FString NameTokenStr = NameToken.Identifier; if (NameTokenStr.EndsWith(TEXT("_API"), ESearchCase::CaseSensitive)) { RequiredAPIMacroIfPresent = NameTokenStr; // Read the real name if (!GetIdentifier(NameToken)) { FError::Throwf(TEXT("Missing %s name"), FailureMessage); } DeclaredName = NameToken.Identifier; } else { DeclaredName = NameTokenStr; RequiredAPIMacroIfPresent.Empty(); } }
BOOL SERVER::SetMonitor (BOOL fShouldMonitor, ULONG *pStatus) { BOOL rc = TRUE; ULONG status = 0; if (m_fMonitor != fShouldMonitor) { LPCELL lpCell; if ((lpCell = m_lpiCell->OpenCell (&status)) == NULL) rc = FALSE; else { NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier()); if ((m_fMonitor = fShouldMonitor) == FALSE) { FreeAll(); (lpCell->m_nServersUnmonitored)++; } else // (fMonitor == TRUE) { (lpCell->m_nServersUnmonitored)--; Invalidate(); rc = RefreshAll (&status); } NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), m_lastStatus); lpCell->Close(); } } if (!rc && pStatus) *pStatus = status; return rc; }
BOOL SERVER::RefreshStatus (BOOL fNotify, ULONG *pStatus) { BOOL rc = TRUE; DWORD status = 0; if (m_fStatusOutOfDate) { m_fStatusOutOfDate = FALSE; if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusBegin, GetIdentifier()); LPCELL lpCell; if ((lpCell = OpenCell (&status)) == NULL) rc = FALSE; else { PVOID hCell; if ((hCell = lpCell->GetCellObject (&status)) == NULL) rc = FALSE; else { WORKERPACKET wp; wp.wpClientAFSServerGet.hCell = hCell; wp.wpClientAFSServerGet.pszServer = m_szName; if (!Worker_DoTask (wtaskClientAFSServerGet, &wp, &status)) rc = FALSE; else { m_ss.nAddresses = 0; for (size_t iAddr = 0; iAddr < AFS_MAX_SERVER_ADDRESS; ++iAddr) { if (wp.wpClientAFSServerGet.Entry.serverAddress[ iAddr ] == 0) continue; AfsClass_IntToAddress (&m_ss.aAddresses[ m_ss.nAddresses++ ], wp.wpClientAFSServerGet.Entry.serverAddress[ iAddr ]); } lpCell->m_lServers->Update (this); // That update affected a hashlistkey } } lpCell->Close(); } if (fNotify) NOTIFYCALLBACK::SendNotificationToAll (evtRefreshStatusEnd, GetIdentifier(), ((rc) ? 0 : status)); } if (pStatus && !rc) *pStatus = status; return TRUE; }
// Get the URL of the page where the plugin is hosted CString CPlugin::GetHostURL() const { CString url; BOOL bOK = FALSE; NPVariant vLocation; VOID_TO_NPVARIANT(vLocation); NPVariant vHref; VOID_TO_NPVARIANT(vHref); try { NPObject* pWindow = GetWindow(); if ((!NPN_GetProperty( m_pNPInstance, pWindow, GetIdentifier("location"), &vLocation)) || !NPVARIANT_IS_OBJECT (vLocation)) { throw(CString(_T("Cannot get window.location"))); } if ((!NPN_GetProperty( m_pNPInstance, NPVARIANT_TO_OBJECT(vLocation), GetIdentifier("href"), &vHref)) || !NPVARIANT_IS_STRING(vHref)) { throw(CString(_T("Cannot get window.location.href"))); } // Convert encoding of window.location.href int buffer_size = vHref.value.stringValue.UTF8Length + 1; char* szUnescaped = new char[buffer_size]; DWORD dwSize = buffer_size; if (SUCCEEDED(UrlUnescapeA(const_cast<LPSTR>(vHref.value.stringValue.UTF8Characters), szUnescaped, &dwSize, 0))) { WCHAR* szURL = new WCHAR[dwSize + 1]; if (MultiByteToWideChar(CP_UTF8, 0, szUnescaped, -1, szURL, dwSize + 1) > 0) { url = CW2T(szURL); } delete[] szURL; } delete[] szUnescaped; } catch (const CString& strMessage) { UNUSED(strMessage); TRACE(_T("[CPlugin::GetHostURL Exception] %s\n"), strMessage); } if (!NPVARIANT_IS_VOID(vHref)) NPN_ReleaseVariantValue(&vHref); if (!NPVARIANT_IS_VOID(vLocation)) NPN_ReleaseVariantValue(&vLocation); return url; }
/////////////////////////////////////////////////////////////////////////////// /// CSRConnection::SendACK /// @description Composes an ack and writes it to the channel. ACKS are saved /// to the protocol's state and are written again during resends to try and /// maximize througput. /// @param The message to ACK. /// @pre A message has been accepted. /// @post The m_currentack member is set to the ack and the message will /// be resent during resend until it expires. /////////////////////////////////////////////////////////////////////////////// void CSRConnection::SendACK(const CMessage &msg) { Logger.Debug << __PRETTY_FUNCTION__ << std::endl; unsigned int seq = msg.GetSequenceNumber(); freedm::broker::CMessage outmsg; ptree pp; pp.put("src.hash",msg.GetHash()); // Presumably, if we are here, the connection is registered outmsg.SetSourceUUID(GetConnection()->GetConnectionManager().GetUUID()); outmsg.SetSourceHostname(GetConnection()->GetConnectionManager().GetHostname()); outmsg.SetStatus(freedm::broker::CMessage::Accepted); outmsg.SetSequenceNumber(seq); outmsg.SetSendTimestampNow(); outmsg.SetProtocol(GetIdentifier()); outmsg.SetProtocolProperties(pp); Logger.Notice<<"Generating ACK. Source exp time "<<msg.GetExpireTime()<<std::endl; outmsg.SetExpireTime(msg.GetExpireTime()); Write(outmsg); m_currentack = outmsg; /// Hook into resend until the message expires. m_timeout.cancel(); m_timeout.expires_from_now(boost::posix_time::milliseconds(REFIRE_TIME)); m_timeout.async_wait(boost::bind(&CSRConnection::Resend,this, boost::asio::placeholders::error)); }
uint32 CLogArchiver::GetNameValue(const char* &pStr, uint32 &nName, CString &oValue, uint32 &nValue) { bool bInt; uint32 nRet; CString oName; nRet = GetIdentifier(pStr, oName); if(!nRet) nRet = GetNameType(oName, nName, bInt); if(!nRet) { SkipWhiteSpace(pStr); if(pStr[0] != '=') nRet = 1; else ++pStr; } if(!nRet) { if(bInt) { nRet = GetInt(pStr, oValue); if(!nRet) nValue = CString::Atoi(oValue.GetStr()); } else nRet = GetString(pStr, oValue); } return nRet; }
void pgForeignServer::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids = true; browser->RemoveDummyChild(this); // Log wxLogInfo(wxT("Adding child object to foreign server %s"), GetIdentifier().c_str()); if (settings->GetDisplayOption(_("User Mappings"))) browser->AppendCollection(this, userMappingFactory); } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("Type"), GetType()); properties->AppendItem(_("Version"), GetVersion()); properties->AppendItem(_("Options"), GetOptions()); } }
bool NAMESPACE_TUPLE::Triple::Equals(const ITuple& rhs) const { return rhs.GetNumAttributes() == GetNumAttributes() && rhs.GetIdentifier() == GetIdentifier() && rhs.GetAttribute(0) == GetAttribute(0) && rhs.GetValue(0) == GetValue(0); }
int GetNextToken() { EatWhitespace(); if (isalpha(LastChar)) { return GetIdentifier(); } if (isdigit(LastChar) || LastChar == '.') { return GetNumber(); } if (LastChar == '#') { SkipComment(); if (LastChar != EOF) { return GetNextToken(); } } if (LastChar == EOF) { return static_cast<int>(Token::Eof); } int ch = LastChar; LastChar = getchar(); return ch; }
NPObject* CPlugin::GetWindowPropertyObject(const NPUTF8* szPropertyName) const { NPObject* pWindow = GetWindow(); NPVariant vObject; VOID_TO_NPVARIANT(vObject); if ((!NPN_GetProperty(m_pNPInstance, pWindow, GetIdentifier(szPropertyName), &vObject)) || !NPVARIANT_IS_OBJECT(vObject)) { if (!NPVARIANT_IS_VOID(vObject)) NPN_ReleaseVariantValue(&vObject); throw CString(_T("Cannot get window.")) + NPStringCharactersToCString(szPropertyName); } NPObject* pObject = NPVARIANT_TO_OBJECT(vObject); if (!pObject) { NPN_ReleaseVariantValue(&vObject); throw CString(_T("window.")) + NPStringCharactersToCString(szPropertyName) + _T(" is null"); } NPN_RetainObject(pObject); NPN_ReleaseVariantValue(&vObject); return pObject; }
void CSUConnection::Send(CMessage msg) { unsigned int msgseq; msgseq = m_outseq; msg.SetSequenceNumber(msgseq); m_outseq = (m_outseq+1) % SEQUENCE_MODULO; msg.SetSourceUUID(GetConnection()->GetConnectionManager().GetUUID()); msg.SetSourceHostname( GetConnection()->GetConnectionManager().GetHostname()); msg.SetProtocol(GetIdentifier()); msg.SetSendTimestampNow(); QueueItem q; q.ret = MAX_RETRIES; q.msg = msg; m_window.push_back(q); if(m_window.size() < WINDOW_SIZE) { Write(msg); m_timeout.cancel(); m_timeout.expires_from_now(boost::posix_time::milliseconds(50)); m_timeout.async_wait(boost::bind(&CSUConnection::Resend,this, boost::asio::placeholders::error)); } }
/////////////////////////////////////////////////////////////////////////////// /// CSRConnection::CSRConnection /// @description Send function for the CSRConnection. Sending using this /// protocol involves an alternating bit scheme. Messages can expire and /// delivery won't be attempted after the deadline is passed. Killed messages /// are noted in the next outgoing message. The reciever tracks the killed /// messages and uses them to help maintain ordering. /// @pre The protocol is intialized. /// @post At least one message is in the channel and actively being resent. /// The send window is greater than or equal to one. The timer for the /// resend is freshly set or is currently running for a resend. /// If a message is written to the channel, the m_killable flag is set. /// @param msg The message to write to the channel. /////////////////////////////////////////////////////////////////////////////// void CSRConnection::Send(CMessage msg) { Logger.Debug << __PRETTY_FUNCTION__ << std::endl; ptree x = static_cast<ptree>(msg); unsigned int msgseq; if(m_outsync == false) { SendSYN(); } CMessage outmsg(x); msgseq = m_outseq; outmsg.SetSequenceNumber(msgseq); m_outseq = (m_outseq+1) % SEQUENCE_MODULO; outmsg.SetSourceUUID(GetConnection()->GetConnectionManager().GetUUID()); outmsg.SetSourceHostname(GetConnection()->GetConnectionManager().GetHostname()); outmsg.SetProtocol(GetIdentifier()); outmsg.SetSendTimestampNow(); if(!outmsg.HasExpireTime()) { Logger.Notice<<"Set Expire time"<<std::endl; outmsg.SetExpireTimeFromNow(boost::posix_time::milliseconds(3000)); } m_window.push_back(outmsg); if(m_window.size() == 1) { Write(outmsg); boost::system::error_code x; Resend(x); } }
void edbPackage::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *properties, ctlSQLBox *sqlPane) { if (!expandedKids) { expandedKids=true; browser->RemoveDummyChild(this); // Log wxLogInfo(wxT("Adding child object to package %s"), GetIdentifier().c_str()); browser->AppendCollection(this, packageFunctionFactory); browser->AppendCollection(this, packageProcedureFactory); browser->AppendCollection(this, packageVariableFactory); } if (properties) { CreateListColumns(properties); properties->AppendItem(_("Name"), GetName()); properties->AppendItem(_("OID"), GetOid()); properties->AppendItem(_("Owner"), GetOwner()); properties->AppendItem(_("Header"), firstLineOnly(GetHeader())); properties->AppendItem(_("Body"), firstLineOnly(GetBody())); properties->AppendItem(_("ACL"), GetAcl()); properties->AppendItem(_("System package?"), GetSystemObject()); if (GetConnection()->EdbMinimumVersion(8, 2)) properties->AppendItem(_("Comment"), firstLineOnly(GetComment())); } }
void GetToken(void) { //int n =0; // Simply reads in the next statement and places it in the // token buffer. ParseWhitespace(); switch (chr_table[*src]) { case LETTER: //token_type = IDENTIFIER; tok.type=IDENTIFIER; GetIdentifier(); break; case DIGIT: //token_type = DIGIT; tok.type=DIGIT; GetNumber(); break; case SPECIAL: //token_type = CONTROL; tok.type=CONTROL; GetPunctuation(); break; } //printf("token: %s\n", tok.ident); if (!*src && inevent) { err("Unexpected end of file"); } }
GfMatrix4d UsdGeomConstraintTarget::ComputeInWorldSpace( UsdTimeCode time, UsdGeomXformCache *xfCache) const { if (not IsDefined()) { TF_CODING_ERROR("Invalid constraint target."); return GfMatrix4d(1); } const UsdPrim &modelPrim = GetAttr().GetPrim(); GfMatrix4d localToWorld(1); if (xfCache) { xfCache->SetTime(time); localToWorld = xfCache->GetLocalToWorldTransform(modelPrim); } else { UsdGeomXformCache cache; cache.SetTime(time); localToWorld = cache.GetLocalToWorldTransform(modelPrim); } GfMatrix4d localConstraintSpace(1.); if (not Get(&localConstraintSpace, time)) { TF_WARN("Failed to get value of constraint target '%s' at path <%s>.", GetIdentifier().GetText(), GetAttr().GetPath().GetText()); return localConstraintSpace; } return localConstraintSpace * localToWorld; }
double CPlugin::GetZoomLevel() { double level = 1; NPVariant vLevel; VOID_TO_NPVARIANT(vLevel); try { NPObject* pContainer = GetContainer(); if (!NPN_Invoke(m_pNPInstance, pContainer, GetIdentifier("getZoomLevel"), NULL, 0, &vLevel)) { throw CString(_T("Cannot invoke window.Container.getZoomLevel()")); } if (NPVARIANT_IS_DOUBLE(vLevel)) level = NPVARIANT_TO_DOUBLE(vLevel); else if ( NPVARIANT_IS_INT32(vLevel) ) level = NPVARIANT_TO_INT32(vLevel); } catch (const CString& strMessage) { level = 1; UNUSED(strMessage); TRACE(_T("[CPlugin::GetZoomLevel Exception] %s\n"), strMessage); } if (!NPVARIANT_IS_VOID(vLevel)) NPN_ReleaseVariantValue(&vLevel); return level; }
CString CPlugin::GetNavigateParam(const NPUTF8* name) const { CString strParam; NPVariant vParam; VOID_TO_NPVARIANT(vParam); try { NPObject* pContainer = GetContainer(); if (!NPN_Invoke(m_pNPInstance, pContainer, GetIdentifier(name), NULL, 0, &vParam)) { throw(CString(_T("Cannot invoke window.Container.getXXX()"))); } if (!NPVARIANT_IS_STRING(vParam)) { throw(CString(_T("Invalid return value."))); } strParam = NPStringToCString(vParam.value.stringValue); } catch (const CString& strMessage) { UNUSED(strMessage); TRACE(_T("[CPlugin::GetNavigateHeaders Exception] %s\n"), strMessage); } if (!NPVARIANT_IS_VOID(vParam)) NPN_ReleaseVariantValue(&vParam); return strParam; }
void SERVICE::Invalidate (void) { if (!m_fStatusOutOfDate) { m_fStatusOutOfDate = TRUE; NOTIFYCALLBACK::SendNotificationToAll (evtInvalidate, GetIdentifier()); } }
void AbstractCellCycleModel::OutputCellCycleModelInfo(out_stream& rParamsFile) { std::string cell_cycle_model_type = GetIdentifier(); *rParamsFile << "\t\t<" << cell_cycle_model_type << ">\n"; OutputCellCycleModelParameters(rParamsFile); *rParamsFile << "\t\t</" << cell_cycle_model_type << ">\n"; }
void AbstractCaUpdateRule<DIM>::OutputUpdateRuleInfo(out_stream& rParamsFile) { std::string update_type = GetIdentifier(); *rParamsFile << "\t\t<" << update_type << ">\n"; OutputUpdateRuleParameters(rParamsFile); *rParamsFile << "\t\t</" << update_type << ">\n"; }
void AbstractForce<ELEMENT_DIM, SPACE_DIM>::OutputForceInfo(out_stream& rParamsFile) { std::string force_type = GetIdentifier(); *rParamsFile << "\t\t<" << force_type << ">\n"; OutputForceParameters(rParamsFile); *rParamsFile << "\t\t</" << force_type << ">\n"; }
void AbstractCaBasedDivisionRule<SPACE_DIM>::OutputCellCaBasedDivisionRuleInfo(out_stream& rParamsFile) { std::string cell_division_rule_type = GetIdentifier(); *rParamsFile << "\t\t\t<" << cell_division_rule_type << ">\n"; OutputCellCaBasedDivisionRuleParameters(rParamsFile); *rParamsFile << "\t\t\t</" << cell_division_rule_type << ">\n"; }
// embeddedFusionName BOOL CLRTypeName::TypeNameParser::EASSEMSPEC() { GetIdentifier(m_pTypeName->GetAssembly(), TypeNameEmbeddedFusionName); NextToken(); return TRUE; }
// fusionName BOOL CLRTypeName::TypeNameParser::ASSEMSPEC() { IfFalseReturn(TokenIs(TypeNameASSEMSPEC)); GetIdentifier(m_pTypeName->GetAssembly(), TypeNameFusionName); NextToken(); return TRUE; }
void CellBasedPdeHandler<DIM>::OutputParameters(out_stream& rParamsFile) { std::string type = GetIdentifier(); *rParamsFile << "\t\t<" << type << ">\n"; *rParamsFile << "\t\t<WriteAverageRadialPdeSolution>" << mWriteAverageRadialPdeSolution << "</WriteAverageRadialPdeSolution>\n"; *rParamsFile << "\t\t<WriteDailyAverageRadialPdeSolution>" << mWriteDailyAverageRadialPdeSolution << "</WriteDailyAverageRadialPdeSolution>\n"; *rParamsFile << "\t\t<SetBcsOnCoarseBoundary>" << mSetBcsOnCoarseBoundary << "</SetBcsOnCoarseBoundary>\n"; *rParamsFile << "\t\t<NumRadialIntervals>" << mNumRadialIntervals << "</NumRadialIntervals>\n"; *rParamsFile << "\t\t</" << type << ">\n"; }
void SearchForDefined() { char *ptr, *id, *sptr; int c; SDef tdef, *p; ptr = inptr; while(1) { if (PeekCh() == 0) // Stop at end of current input break; SkipSpaces(); sptr = inptr; id = GetIdentifier(); if (id) { if (strcmp(id, "defined") == 0) { c = NextNonSpace(0); if (c != '(') { err(20); break; } id = GetIdentifier(); if (id == NULL) { err(21); break; } c = NextNonSpace(0); if (c != ')') err(22); tdef.name = id; p = (SDef *)htFind(&HashInfo, &tdef); SubMacro((char *)(p ? "1" : "0"), inptr-sptr); } } else NextCh(); } inptr = ptr; }
std::string Object::GetOverrideString(uint8 index) const { const char * identifier = GetIdentifier(); rct_string_id stringId = language_get_object_override_string_id(identifier, index); const utf8 * result = nullptr; if (stringId != STR_NONE) { result = language_get_string(stringId); } return String::ToStd(result); }
void SERVER::InvalidateServices (void) { if (!m_fServicesOutOfDate) { if (m_wGhost & GHOST_HAS_SERVER_ENTRY) { m_fServicesOutOfDate = TRUE; } NOTIFYCALLBACK::SendNotificationToAll (evtInvalidate, GetIdentifier()); } }
void CSUConnection::SendACK(const CMessage &msg) { unsigned int seq = msg.GetSequenceNumber(); freedm::broker::CMessage outmsg; // Presumably, if we are here, the connection is registered outmsg.SetSourceUUID(GetConnection()->GetConnectionManager().GetUUID()); outmsg.SetSourceHostname(GetConnection()->GetConnectionManager().GetHostname()); outmsg.SetStatus(freedm::broker::CMessage::Accepted); outmsg.SetSequenceNumber(seq); outmsg.SetProtocol(GetIdentifier()); outmsg.SetSendTimestampNow(); Write(outmsg); }
bool NAMESPACE_TUPLE::Triple::LessThan(const ITuple& rhs) const { long otherIdentifier = rhs.GetIdentifier(); if (otherIdentifier != m_identifier) { return GetIdentifier() < otherIdentifier; } long otherAttrType = rhs.GetAttribute(0); if (otherAttrType != m_attribute) { return GetAttribute(0) < otherAttrType; } return GetValue(0) < rhs.GetValue(0); }