当前位置: 首页>>代码示例>>C++>>正文


C++ GetType函数代码示例

本文整理汇总了C++中GetType函数的典型用法代码示例。如果您正苦于以下问题:C++ GetType函数的具体用法?C++ GetType怎么用?C++ GetType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetType函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: idVarDef

/*
============
idProgram::AllocDef
============
*/
idVarDef *idProgram::AllocDef( idTypeDef *type, const char *name, idVarDef *scope, bool constant ) {
	idVarDef	*def;
	idStr		element;
	idVarDef	*def_x;
	idVarDef	*def_y;
	idVarDef	*def_z;

	// allocate a new def
	def = new idVarDef( type );
	def->scope		= scope;
	def->numUsers	= 1;
	def->num		= varDefs.Append( def );

	// add the def to the list with defs with this name and set the name pointer
	AddDefToNameList( def, name );

	if ( ( type->Type() == ev_vector ) || ( ( type->Type() == ev_field ) && ( type->FieldType()->Type() == ev_vector ) ) ) {
		//
		// vector
		//
		if ( !strcmp( name, RESULT_STRING ) ) {
			// <RESULT> vector defs don't need the _x, _y and _z components
			assert( scope->Type() == ev_function );
			def->value.stackOffset	= scope->value.functionPtr->locals;
			def->initialized		= idVarDef::stackVariable;
			scope->value.functionPtr->locals += type->Size();
		} else if ( scope->TypeDef()->Inherits( &type_object ) ) {
			idTypeDef	newtype( ev_field, NULL, "float field", 0, &type_float );
			idTypeDef	*type = GetType( newtype, true );

			// set the value to the variable's position in the object
			def->value.ptrOffset = scope->TypeDef()->Size();

			// make automatic defs for the vectors elements
			// origin can be accessed as origin_x, origin_y, and origin_z
			sprintf( element, "%s_x", def->Name() );
			def_x = AllocDef( type, element, scope, constant );

			sprintf( element, "%s_y", def->Name() );
			def_y = AllocDef( type, element, scope, constant );
			def_y->value.ptrOffset = def_x->value.ptrOffset + type_float.Size();

			sprintf( element, "%s_z", def->Name() );
			def_z = AllocDef( type, element, scope, constant );
			def_z->value.ptrOffset = def_y->value.ptrOffset + type_float.Size();
		} else {
			// make automatic defs for the vectors elements
			// origin can be accessed as origin_x, origin_y, and origin_z
			sprintf( element, "%s_x", def->Name() );
			def_x = AllocDef( &type_float, element, scope, constant );

			sprintf( element, "%s_y", def->Name() );
			def_y = AllocDef( &type_float, element, scope, constant );

			sprintf( element, "%s_z", def->Name() );
			def_z = AllocDef( &type_float, element, scope, constant );

			// point the vector def to the x coordinate
			def->value			= def_x->value;
			def->initialized	= def_x->initialized;
		}
	} else if ( scope->TypeDef()->Inherits( &type_object ) ) {
		//
		// object variable
		//
		// set the value to the variable's position in the object
		def->value.ptrOffset = scope->TypeDef()->Size();
	} else if ( scope->Type() == ev_function ) {
		//
		// stack variable
		//
		// since we don't know how many local variables there are,
		// we have to have them go backwards on the stack
		def->value.stackOffset	= scope->value.functionPtr->locals;
		def->initialized		= idVarDef::stackVariable;

		if ( type->Inherits( &type_object ) ) {
			// objects only have their entity number on the stack, not the entire object
			scope->value.functionPtr->locals += type_object.Size();
		} else {
			scope->value.functionPtr->locals += type->Size();
		}
	} else {
		//
		// global variable
		//
		def->value.bytePtr = &variables[ numVariables ];
		numVariables += def->TypeDef()->Size();
		if ( numVariables > sizeof( variables ) ) {
			throw idCompileError( va( "Exceeded global memory size (%d bytes)", sizeof( variables ) ) );
		}

		memset( def->value.bytePtr, 0, def->TypeDef()->Size() );
	}

//.........这里部分代码省略.........
开发者ID:bagobor,项目名称:doom3.gpl,代码行数:101,代码来源:Script_Program.cpp

示例2: if

void WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType chunk, bool forceExecute)
{
	if(chunk < FIRST_CONTEXT_CHUNK && !forceExecute)
	{
		if(m_State == READING)
		{
			m_pDevice->GetResourceManager()->MarkInFrame(false);

			m_pDevice->ProcessChunk(offset, chunk);
			m_pSerialiser->PopContext(NULL, chunk);

			m_pDevice->GetResourceManager()->MarkInFrame(true);
		}
		else if(m_State == EXECUTING)
		{
			m_pSerialiser->SkipCurrentChunk();
			m_pSerialiser->PopContext(NULL, chunk);
		}
		return;
	}

	m_CurChunkOffset = offset;

	RDCASSERT(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE);

	uint64_t cOffs = m_pSerialiser->GetOffset();

	ResourceId ctxId;
	m_pSerialiser->Serialise("context", ctxId);

	WrappedID3D11DeviceContext *context = (WrappedID3D11DeviceContext *)m_pDevice->GetResourceManager()->GetLiveResource(ctxId);

	if(m_FakeContext != ResourceId())
	{
		if(m_FakeContext == ctxId)
			context = this;
		else
		{
			m_pSerialiser->SetOffset(cOffs);
			m_pSerialiser->SkipCurrentChunk();
			m_pSerialiser->PopContext(NULL, chunk);
			return;
		}
	}
	
	RDCASSERT(WrappedID3D11DeviceContext::IsAlloc(context));
	
	LogState state = context->m_State;

	if(forceExecute)
		context->m_State = EXECUTING;
	else
		context->m_State = m_State;

	m_AddedDrawcall = false;

	switch(chunk)
	{
	case SET_INPUT_LAYOUT:
		context->Serialise_IASetInputLayout(0x0);
		break;
	case SET_VBUFFER:
		context->Serialise_IASetVertexBuffers(0, 0, 0x0, 0x0, 0x0);
		break;
	case SET_IBUFFER:
		context->Serialise_IASetIndexBuffer(0, DXGI_FORMAT_UNKNOWN, 0);
		break;
	case SET_TOPOLOGY:
		context->Serialise_IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED);
		break;

	case SET_VS_CBUFFERS:
		context->Serialise_VSSetConstantBuffers(0, 0, 0x0);
		break;
	case SET_VS_RESOURCES:
		context->Serialise_VSSetShaderResources(0, 0, 0x0);
		break;
	case SET_VS_SAMPLERS:
		context->Serialise_VSSetSamplers(0, 0, 0x0);
		break;
	case SET_VS:
		context->Serialise_VSSetShader(0x0, 0x0, 0);
		break;

	case SET_HS_CBUFFERS:
		context->Serialise_HSSetConstantBuffers(0, 0, 0x0);
		break;
	case SET_HS_RESOURCES:
		context->Serialise_HSSetShaderResources(0, 0, 0x0);
		break;
	case SET_HS_SAMPLERS:
		context->Serialise_HSSetSamplers(0, 0, 0x0);
		break;
	case SET_HS:
		context->Serialise_HSSetShader(0x0, 0x0, 0);
		break;

	case SET_DS_CBUFFERS:
		context->Serialise_DSSetConstantBuffers(0, 0, 0x0);
		break;
//.........这里部分代码省略.........
开发者ID:FeuernD,项目名称:renderdoc,代码行数:101,代码来源:d3d11_context.cpp

示例3: sys_err


//.........这里部分代码省略.........
		BYTE bHeader = (BYTE) *(c_pData);
		const char * c_pszName;

		if (bHeader == 0) // 암호화 처리가 있으므로 0번 헤더는 스킵한다.
			iPacketLen = 1;
		else if (!m_pPacketInfo->Get(bHeader, &iPacketLen, &c_pszName))
		{
			sys_err("UNKNOWN HEADER: %d, LAST HEADER: %d(%d), REMAIN BYTES: %d, fd: %d",
					bHeader, bLastHeader, iLastPacketLen, m_iBufferLeft, lpDesc->GetSocket());
			//printdata((BYTE *) c_pvOrig, m_iBufferLeft);
			lpDesc->SetPhase(PHASE_CLOSE);
			return true;
		}

		if (m_iBufferLeft < iPacketLen)
			return true;

		if (bHeader)
		{
			if (test_server && bHeader != HEADER_CG_MOVE)
				sys_log(0, "Packet Analyze [Header %d][bufferLeft %d] ", bHeader, m_iBufferLeft);

			m_pPacketInfo->Start();

			int iExtraPacketSize = Analyze(lpDesc, bHeader, c_pData);

			if (iExtraPacketSize < 0)
				return true;

			iPacketLen += iExtraPacketSize;
			lpDesc->Log("%s %d", c_pszName, iPacketLen);
			m_pPacketInfo->End();
		}

		// TRAFFIC_PROFILER
		if (g_bTrafficProfileOn)
			TrafficProfiler::instance().Report(TrafficProfiler::IODIR_INPUT, bHeader, iPacketLen);
		// END_OF_TRAFFIC_PROFILER

		if (bHeader == HEADER_CG_PONG)
			sys_log(0, "PONG! %u %u", m_pPacketInfo->IsSequence(bHeader), *(BYTE *) (c_pData + iPacketLen - sizeof(BYTE)));

		if (m_pPacketInfo->IsSequence(bHeader))
		{
			BYTE bSeq = lpDesc->GetSequence();
			BYTE bSeqReceived = *(BYTE *) (c_pData + iPacketLen - sizeof(BYTE));

			if (bSeq != bSeqReceived)
			{
				sys_err("SEQUENCE %x mismatch 0x%x != 0x%x header %u", get_pointer(lpDesc), bSeq, bSeqReceived, bHeader);

				LPCHARACTER	ch = lpDesc->GetCharacter();

				char buf[1024];
				int	offset, len;

				offset = snprintf(buf, sizeof(buf), "SEQUENCE_LOG [%s]-------------\n", ch ? ch->GetName() : "UNKNOWN");

				if (offset < 0 || offset >= (int) sizeof(buf))
					offset = sizeof(buf) - 1;

				for (size_t i = 0; i < lpDesc->m_seq_vector.size(); ++i)
				{
					len = snprintf(buf + offset, sizeof(buf) - offset, "\t[%03d : 0x%x]\n",
							lpDesc->m_seq_vector[i].hdr,
							lpDesc->m_seq_vector[i].seq);

					if (len < 0 || len >= (int) sizeof(buf) - offset)
						offset += (sizeof(buf) - offset) - 1;
					else
						offset += len;
				}

				snprintf(buf + offset, sizeof(buf) - offset, "\t[%03d : 0x%x]\n", bHeader, bSeq);
				sys_err("%s", buf);

				lpDesc->SetPhase(PHASE_CLOSE);
				return true;
			}
			else
			{
				lpDesc->push_seq(bHeader, bSeq);
				lpDesc->SetNextSequence();
				//sys_err("SEQUENCE %x match %u next %u header %u", lpDesc, bSeq, lpDesc->GetSequence(), bHeader);
			}
		}

		c_pData	+= iPacketLen;
		m_iBufferLeft -= iPacketLen;
		r_iBytesProceed += iPacketLen;

		iLastPacketLen = iPacketLen;
		bLastHeader	= bHeader;

		if (GetType() != lpDesc->GetInputProcessor()->GetType())
			return false;
	}

	return true;
}
开发者ID:mehtiNET,项目名称:Server,代码行数:101,代码来源:input.cpp

示例4: ArenaTeamInfoType

void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
{
    // Remove member from team
    for (MemberList::iterator itr = Members.begin(); itr != Members.end(); ++itr)
        if (itr->Guid == guid)
        {
            Members.erase(itr);
            break;
        }

    // Remove arena team info from player data
    if (Player* player = ObjectAccessor::FindPlayer(guid))
    {
        // delete all info regarding this team
        for (uint32 i = 0; i < ARENA_TEAM_END; ++i)
            player->SetArenaTeamInfoField(GetSlot(), ArenaTeamInfoType(i), 0);
        TC_LOG_DEBUG("bg.arena", "Player: %s [GUID: %u] left arena team type: %u [Id: %u, Name: %s].", player->GetName().c_str(), player->GetGUIDLow(), GetType(), GetId(), GetName().c_str());
    }

    // Only used for single member deletion, for arena team disband we use a single query for more efficiency
    if (cleanDb)
    {
        PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ARENA_TEAM_MEMBER);
        stmt->setUInt32(0, GetId());
        stmt->setUInt32(1, GUID_LOPART(guid));
        CharacterDatabase.Execute(stmt);
    }
}
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:28,代码来源:ArenaTeam.cpp

示例5: GUID_LOPART

bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& arenaTeamName,
                                         uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor,
                                         uint8 borderStyle, uint32 borderColor)
{
    // Check if captain is present
    if (!ObjectAccessor::FindPlayer(captainGuid))
        return false;

    // Check if arena team name is already taken
    if (sArenaTeamMgr->GetArenaTeamByName(arenaTeamName))
        return false;

    // Generate new arena team id
    TeamId = sArenaTeamMgr->GenerateArenaTeamId();

    // Assign member variables
    CaptainGuid = captainGuid;
    Type = type;
    TeamName = arenaTeamName;
    BackgroundColor = backgroundColor;
    EmblemStyle = emblemStyle;
    EmblemColor = emblemColor;
    BorderStyle = borderStyle;
    BorderColor = borderColor;
    uint32 captainLowGuid = GUID_LOPART(captainGuid);

    // Save arena team to db
    PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM);
    stmt->setUInt32(0, TeamId);
    stmt->setString(1, TeamName);
    stmt->setUInt32(2, captainLowGuid);
    stmt->setUInt8(3, Type);
    stmt->setUInt16(4, Stats.Rating);
    stmt->setUInt32(5, BackgroundColor);
    stmt->setUInt8(6, EmblemStyle);
    stmt->setUInt32(7, EmblemColor);
    stmt->setUInt8(8, BorderStyle);
    stmt->setUInt32(9, BorderColor);
    CharacterDatabase.Execute(stmt);

    // Add captain as member
    AddMember(CaptainGuid);

    TC_LOG_DEBUG("bg.arena", "New ArenaTeam created [Id: %u, Name: %s] [Type: %u] [Captain low GUID: %u]", GetId(), GetName().c_str(), GetType(), captainLowGuid);
    return true;
}
开发者ID:redlaine,项目名称:InfinityCore-Ark,代码行数:46,代码来源:ArenaTeam.cpp

示例6: GetObjectInfo

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int C_BaseObject::GetDisplayPriority( void )
{
	return GetObjectInfo( GetType() )->m_iDisplayPriority;	
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:7,代码来源:c_baseobject.cpp

示例7: GetColor

const std::string CayenneBody::GetDescription() const
{
  std::stringstream desc;
  desc << GetColor() <<  " Cayenne " << IBody::GetTypeName(GetType()) << " body";
  return desc.str();
}
开发者ID:vlnovikov,项目名称:creationalpatterns,代码行数:6,代码来源:PorscheParts.cpp

示例8: GetType

bool PluginPreference::IsBoolean() { return GetType() == PluginPreferenceType::CheckBox; }
开发者ID:DocWhoChat,项目名称:appetizer,代码行数:1,代码来源:PluginPreference.cpp

示例9: switch

uint32_t PERKRecord::GetFieldAttribute(FIELD_IDENTIFIERS, uint32_t WhichAttribute)
    {
    switch(FieldID)
        {
        case 0: //recType
            return GetType();
        case 1: //flags1
            return CB_UINT32_FLAG_FIELD;
        case 2: //fid
            return CB_FORMID_FIELD;
        case 3: //versionControl1
            switch(WhichAttribute)
                {
                case 0: //fieldType
                    return CB_UINT8_ARRAY_FIELD;
                case 1: //fieldSize
                    return 4;
                default:
                    return CB_UNKNOWN_FIELD;
                }
            return CB_UNKNOWN_FIELD;
        case 4: //eid
            return CB_ISTRING_FIELD;
        case 5: //formVersion
            return CB_UINT16_FIELD;
        case 6: //versionControl2
            switch(WhichAttribute)
                {
                case 0: //fieldType
                    return CB_UINT8_ARRAY_FIELD;
                case 1: //fieldSize
                    return 2;
                default:
                    return CB_UNKNOWN_FIELD;
                }
            return CB_UNKNOWN_FIELD;
        case 7: //full
            return CB_STRING_FIELD;
        case 8: //description
            return CB_STRING_FIELD;
        case 9: //iconPath
            return CB_ISTRING_FIELD;
        case 10: //smallIconPath
            return CB_ISTRING_FIELD;
        case 11: //ctda Conditions
            return CB_UINT8_FIELD;
        case 12: //ctda_p Conditions
            switch(WhichAttribute)
                {
                case 0: //fieldType
                    return CB_UINT8_ARRAY_FIELD;
                case 1: //fieldSize
                    return 3;
                default:
                    return CB_UNKNOWN_FIELD;
                }
            return CB_UNKNOWN_FIELD;
        case 13: //ctda Conditions
            return CB_UNKNOWN_FIELD; // UNPARSED_FIELD;
        case 14: //ctda Conditions
            return CB_UINT32_FIELD;
        case 15: //ctda_p Conditions
            switch(WhichAttribute)
                {
                case 0: //fieldType
                    return CB_UINT8_ARRAY_FIELD;
                case 1: //fieldSize
                    return 4;
                default:
                    return CB_UNKNOWN_FIELD;
                }
            return CB_UNKNOWN_FIELD;
        case 16: //ctda_p Conditions
            switch(WhichAttribute)
                {
                case 0: //fieldType
                    return CB_UINT8_ARRAY_FIELD;
                case 1: //fieldSize
                    return 4;
                default:
                    return CB_UNKNOWN_FIELD;
                }
            return CB_UNKNOWN_FIELD;
        case 17: //ctda Conditions
            return CB_UINT32_FIELD;
        case 18: //ctda Conditions
            return CB_UNKNOWN_FIELD; // UNPARSED_FIELD;
        case 19: //data DATA ,, Struct
            return CB_UINT8_FIELD;
        case 20: //data DATA ,, Struct
            return CB_UINT8_FIELD;
        case 21: //data DATA ,, Struct
            return CB_UINT8_FIELD;
        case 22: //data DATA ,, Struct
            return CB_UINT8_FIELD;
        case 23: //data DATA ,, Struct
            return CB_UINT8_FIELD;
        case 24: //prke PRKE ,, Struct
            return CB_UINT8_FIELD;
        case 25: //prke PRKE ,, Struct
//.........这里部分代码省略.........
开发者ID:Dienes,项目名称:CBash,代码行数:101,代码来源:PERKRecordAPI.cpp

示例10: return

// operator==
bool
BGradient::operator==(const BGradient& other) const
{
	return ((other.GetType() == GetType()) && ColorStopsAreEqual(other));
}
开发者ID:mmanley,项目名称:Antares,代码行数:6,代码来源:Gradient.cpp

示例11: strncpy


//.........这里部分代码省略.........

    /* Pone datos en el heap */
    LogAlarm.Put(5, "TrxOff: Pone datos en el Heap\n");
	ret=Heap.PutData(idHeap,(char *)&infoHeap, sizeof(infoHeap));
	if (ret==NOOK)
	{
		LogAlarm.Put(0, "TrxOff: ERROR (%d) al insertar en Heap. Clave:[%s]\n", Heap.GetErrno(), idHeap);

		/* Libera la caja */
		ret = P.SetPosFree(data_tar.nro_ca, trxOff.nro_suc, trxOff.nro_caj);
		if (ret != OK)
		{
			LogAlarm.Put(0, "TrxOff: ERROR en SetPosFree. CA:[%s] Emp:[%s] Caj:[%s]\n", 
								data_tar.nro_ca, trxOff.nro_suc, trxOff.nro_caj);
		}
        EnviarMsg(orig_pid, "ERROR", 5);
		return NOOK;
	}

    /* Carga estructura para actualizar la base de datos */
	strncpy( trxPk.nroSuc  , trxOff.nro_suc, sizeof(trxPk.nroSuc  ) );
    strncpy( trxPk.nroTerm , trxOff.nro_caj, sizeof(trxPk.nroTerm ) );
    strncpy( trxPk.nroTrans, trxOff.nro_tic, sizeof(trxPk.nroTrans) );
    strncpy( trxPk.fechaTrx, trxOff.fec_loc, sizeof(trxPk.fechaTrx) );
    strncpy( trxPk.rowid   , trxOff.rowid  , sizeof(trxPk.rowid   ) );

    /* Carga estructura para actualizar la base de datos */
	strncpy(InfoEnvio.cod_est, "01", sizeof(InfoEnvio.cod_est ));
    strncpy(InfoEnvio.fec_env, szFechaEnvio, sizeof(InfoEnvio.fec_env ));
    strncpy(InfoEnvio.nro_lot, "0000", sizeof(InfoEnvio.nro_lot));
    strncpy(InfoEnvio.nro_trc, IsoMsg->GetField(11), sizeof(InfoEnvio.nro_trc));

	/* Actualiza la base de datos */
    ret=DBUpdEnvio(trxPk , InfoEnvio);
    LogAlarm.Put(0, "TrxOff: Actualiza informacion de Envio. Retorno:%d\n", ret);

    /* Registra en cola de timeout */
	strcpy(aux_str, IsoMsg->GetField(11));
    Cfg.GetItem("TimeOutDaemon", "MsgTimeOut1", aux_str1);
	LogAlarm.Put(0, "TrxOff: Timeout ID Trace [%s]\n", idHeap);
    ret=timeout_queue.SetTimeOut(idHeap, atoi(aux_str1), GetType(), "");
    if (ret==NOOK)
    {
        LogAlarm.Put(0, "TrxOff: ERROR (%d) al registrar en TOQ\n",ret);

		/* Libera la caja */
		ret = P.SetPosFree(data_tar.nro_ca, trxOff.nro_suc, trxOff.nro_caj);
		if (ret != OK)
		{
			LogAlarm.Put(0, "TrxOff: ERROR en SetPosFree. CA:[%s] Emp:[%s] Caj:[%s]\n", 
							data_tar.nro_ca, trxOff.nro_suc, trxOff.nro_caj);
		}

		/* Retira del heap */
		ret=Heap.GetData(idHeap,(char *)&infoHeap, sizeof(infoHeap));
		if (ret == NOOK)
		{
			LogAlarm.Put( 0, "TrxOff: ERROR (%d) al obtener del heap\n", Heap.GetErrno());
		}
		
		/* Envia respuesta */
		EnviarMsg(orig_pid, "ERROR", 5);
		
		return NOOK;
    }

    /* Aplana el mensaje */
    len=IsoMsg->GetMsgString(msg_str);

	/* Loguea el mensaje */
	for (iCont=0; iCont<64; iCont++)
	{
		if (IsoMsg->ChkField(iCont))
		{
			LogAlarm.Put(5, "TrxOff: Campo %02d: Valor:[%s]\n", iCont, IsoMsg->GetField(iCont) );
		}
	}

    /* Envia el mensaje a X25 */
	LogAlarm.Put(0, "TrxOff: Envia a X.25. CAut [%s]\n", term_data.nro_ca);
    ret=XQueue.SendMsg(atoi(term_data.nro_ca)+1, msg_str, len);
    if (ret!=OK)
    {
        LogAlarm.Put(0, "TrxOff: ERROR en Envio X.25(%d)\n", XQueue.GetErrno());

		/* Libera la caja */
        ret = P.SetPosFree(data_tar.nro_ca, trxOff.nro_suc, trxOff.nro_caj);
        if (ret != OK)
        {
             LogAlarm.Put(0, "TrxOff: ERROR en SetPosFree. CA:[%s] Emp:[%s] Caj:[%s]\n", 
								data_tar.nro_ca, trxOff.nro_suc, trxOff.nro_caj);
        }
        
		/* Envia respuesta */
		EnviarMsg(orig_pid, "ERROR", 5);

        return NOOK;
    }
    return OK;
}
开发者ID:aguirrel,项目名称:aguirrel.github.io,代码行数:101,代码来源:TrxOff.C

示例12: sci_mcisendstring

/*--------------------------------------------------------------------------*/
int sci_mcisendstring(char *fname, unsigned long l)
{
    int m1, n1, l1;

    char *Output = NULL;
    int *BoolOutput = NULL;
    int *CodeOutput = NULL;

    CheckRhs(1, 1);
    CheckLhs(1, 3);

    if (GetType(1) == sci_strings)
    {
        MCIERROR Error;
        char *MCICommand = NULL;
        char ReturnString[2048];

        GetRhsVar(1, STRING_DATATYPE, &m1, &n1, &l1);
        MCICommand = cstk(l1);

        Error = mciSendString(MCICommand, (LPSTR)ReturnString, sizeof(ReturnString), NULL);

        BoolOutput = (int*)MALLOC(sizeof(int));
        CodeOutput = (int*)MALLOC(sizeof(int));

        *BoolOutput = (int)0;
        *CodeOutput = (int)Error;
        if (Error)
        {
            char ErrorText[128];
            *BoolOutput = (int)FALSE;

            if ( mciGetErrorString(Error, ErrorText, sizeof(ErrorText)) == FALSE )
            {
                wsprintf(ErrorText, "%s", "Unknown MCI error");
            }

            Output = strdup(ErrorText);
        }
        else
        {
            *BoolOutput = (int)TRUE;
            Output = strdup("OK");
        }

        n1 = 1;

        if ( Lhs == 1 )
        {
            CreateVarFromPtr(Rhs + 1, MATRIX_OF_BOOLEAN_DATATYPE, &n1, &n1, &BoolOutput);
            LhsVar(1) = Rhs + 1;
        }
        else if ( Lhs == 2 )
        {
            CreateVarFromPtr(Rhs + 1, MATRIX_OF_BOOLEAN_DATATYPE, &n1, &n1, &BoolOutput);
            LhsVar(1) = Rhs + 1;

            CreateVarFromPtr(Rhs + 2, MATRIX_OF_INTEGER_DATATYPE, &n1, &n1, &CodeOutput);
            LhsVar(2) = Rhs + 2;
        }
        else /* Lhs == 3 */
        {
            CreateVarFromPtr(Rhs + 1, MATRIX_OF_BOOLEAN_DATATYPE, &n1, &n1, &BoolOutput);
            LhsVar(1) = Rhs + 1;

            CreateVarFromPtr(Rhs + 2, MATRIX_OF_INTEGER_DATATYPE, &n1, &n1, &CodeOutput);
            LhsVar(2) = Rhs + 2;

            m1 = (int)strlen(Output);
            CreateVarFromPtr(Rhs + 3, STRING_DATATYPE, &m1, &n1, &Output);
            LhsVar(3) = Rhs + 3;
        }

        if (Output)
        {
            FREE(Output);
            Output = NULL;
        }
        if (BoolOutput)
        {
            FREE(BoolOutput);
            BoolOutput = NULL;
        }
        if (CodeOutput)
        {
            FREE(CodeOutput);
            Output = NULL;
        }

        PutLhsVar();

        return 0;
    }
    else
    {
        Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
        return 0;
    }
}
开发者ID:ASP1234,项目名称:Scilabv5.5.2,代码行数:100,代码来源:sci_mcisendstring.c

示例13: SubstChildren

    // For a synth fun, we need to ensure that arguments are
    // all aux vars (either base or derived)
    void SpecRewriter::VisitUserSynthFuncExpression(const UserSynthFuncExpression* Exp)
    {
        // Push through the children first.
        auto const& Children = Exp->GetChildren();
        const uint32 NumChildren = Children.size();
        for (auto const& Child : Children) {
            Child->Accept(this);
        }

        // The rewritten expressions are on the stack now,
        // we need to check if any of them is an expression
        // which needs to be computed. If so, we create an
        // aux var for the subexpression and set up an evaluation
        // rule
        // Gather the child expressions first
        vector<Expression> SubstChildren(Children.size());
        for (uint32 i = 0; i < NumChildren; ++i) {
            SubstChildren[Children.size() - i - 1] = RewriteStack.back();
            RewriteStack.pop_back();
        }

        vector<Expression> NewSubstChildren;

        for (auto const& Child : SubstChildren) {
            if (Child->GetOp()->GetArity() > 1) {
                // We need to fixup an eval rule for this child
                // Check if one already exists for it first
                auto it = ExpMap.find(Child);
                if (it != ExpMap.end()) {
                    NewSubstChildren.push_back(it->second);
                } else {
                    // Create a new aux var
                    auto Op = Solver->CreateAuxVariable(AuxIDCounter++, Child->GetType());
                    auto AuxExp = Solver->CreateExpression(Op);
                    ExpMap[Child] = AuxExp;

                    auto Pure = IsPure(Child);
                    if (Pure) {
                        BaseAuxVarOps.push_back(Op);
                    } else {
                        DerivedAuxVarOps.push_back(Op);
                        // set up an eval rule for this aux var
                        EvalRules.push_back(EvalRule(Op, Child));
                    }
                    NewSubstChildren.push_back(AuxExp);
                }
            } else {
                NewSubstChildren.push_back(Child);
            }
        }

        // Create the expression with the substitutions
        auto NewExp = Solver->CreateExpression(Exp->GetOp(), NewSubstChildren);

        // Since this is a synth func expression,
        // we need to create a derived aux var for 
        // ourselves and substitute the derived aux for
        // ourself. But first check if there is already
        // a derived var available (CSE)
        auto it = ExpMap.find(Exp);
        if (it != ExpMap.end()) {
            // No need to create more derived vars
            RewriteStack.push_back(it->second);
        } else {
            auto Op = Solver->CreateAuxVariable(AuxIDCounter++, NewExp->GetType());
            auto AuxExp = Solver->CreateExpression(Op);
            ExpMap[Exp] = AuxExp;

            DerivedAuxVarOps.push_back(Op);
            EvalRules.push_back(EvalRule(Op, NewExp));
            RewriteStack.push_back(AuxExp);
        }
    }
开发者ID:LaserPope,项目名称:sygus-comp14,代码行数:75,代码来源:SpecRewriter.cpp

示例14: GetHoldInput

void AirspaceHoldInSim::getDesc( ResourceDesc& resDesc )
{
	resDesc.resid = GetHoldInput()->getID();
	resDesc.resType = GetType();
	resDesc.strRes = PrintResource();
}
开发者ID:chenbk85,项目名称:tphProjects,代码行数:6,代码来源:AirspaceHoldInSim.cpp

示例15: GetStatusName

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_BaseObject::GetTargetIDString( wchar_t *sIDString, int iMaxLenInBytes )
{
	sIDString[0] = '\0';

	C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();

	if ( !pLocalPlayer )
		return;

	if ( InSameTeam( pLocalPlayer ) || pLocalPlayer->IsPlayerClass( TF_CLASS_SPY ) || pLocalPlayer->GetTeamNumber() == TEAM_SPECTATOR )
	{
		wchar_t wszBuilderName[ MAX_PLAYER_NAME_LENGTH ];

		const char *pszStatusName = GetStatusName();
		wchar_t *wszObjectName = g_pVGuiLocalize->Find( pszStatusName );

		if ( !wszObjectName )
		{
			wszObjectName = L"";
		}

		C_BasePlayer *pBuilder = GetOwner();

		if ( pBuilder )
		{
			g_pVGuiLocalize->ConvertANSIToUnicode( pBuilder->GetPlayerName(), wszBuilderName, sizeof(wszBuilderName) );
		}
		else
		{
			wszBuilderName[0] = '\0';
		}

		// building or live, show health
		const char *printFormatString;
		
		if ( GetObjectInfo(GetType())->m_AltModes.Count() > 0 )
		{
			printFormatString = "#TF_playerid_object_mode";

			pszStatusName = GetObjectInfo( GetType() )->m_AltModes.Element( m_iObjectMode * 3 + 1 );
			wchar_t *wszObjectModeName = g_pVGuiLocalize->Find( pszStatusName );

			if ( !wszObjectModeName )
			{
				wszObjectModeName = L"";
			}

			g_pVGuiLocalize->ConstructString( sIDString, iMaxLenInBytes, g_pVGuiLocalize->Find(printFormatString),
				4,
				wszObjectName,
				wszBuilderName,
				wszObjectModeName);
		}
		else
		{
			if ( m_bMiniBuilding )
				printFormatString = "#TF_playerid_object_mini";
			else
				printFormatString = "#TF_playerid_object";

			g_pVGuiLocalize->ConstructString( sIDString, iMaxLenInBytes, g_pVGuiLocalize->Find( printFormatString ),
				3,
				wszObjectName,
				wszBuilderName );
		}
	}
}
开发者ID:Deathreus,项目名称:TF2Classic,代码行数:70,代码来源:c_baseobject.cpp


注:本文中的GetType函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。