예제 #1
0
uint32  EquipImprove::cost(GameItem* item)
{
	uint32 coststonenum=0;
	uint32 costmoney=100;

	uint32 money = m_owner->getMoney(MoneyType_Money);

	if(coststonenum != 0)
	{
		GameItem *stone = m_owner->m_pack_manager.m_commom_pack.getItemByBaseID(100001);
		CheckCondition(stone,ERR_STONE);
		CheckCondition(stone->getItemNumber()>coststonenum,ERR_STONE);
	}

	CheckCondition(money>=costmoney,ERR_MONEY);


	m_owner->subMoney(MoneyType_Money,costmoney,DelMoneyAction_EquipImprove);
	if(coststonenum != 0)
	{
		m_owner->m_pack_manager.reduceItemNumByBaseID(100001,coststonenum,DelItemAction_Improve);
	}
	return ERR_SUCCESS;

}
예제 #2
0
static GLuint CreateIndexBuffer()
{
    GLuint inds[IndexCount];
    GLuint* pIndex = &inds[0];

    GLuint n = 0;
    for (GLuint i = 0; i < Slices; i++)
    {
        for (GLuint j = 0; j < Stacks; j++)
        {
            *pIndex++ = n + j;
            *pIndex++ = n + (j + 1) % Stacks;
            *pIndex++ = n + j + Stacks;

            *pIndex++ = n + j + Stacks;
            *pIndex++ = n + (j + 1) % Stacks;
            *pIndex++ = n + (j + 1) % Stacks + Stacks;
        }
        n += Stacks;
    }

    CheckCondition(n == VertexCount, "Tessellation error.");
    CheckCondition(pIndex - &inds[0] == IndexCount, "Tessellation error.");

    GLuint handle;
    GLsizeiptr size = sizeof(inds);
    const GLvoid* data = &inds[0];
    GLenum usage = GL_STATIC_DRAW;

    glGenBuffers(1, &handle);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, data, usage);

    return handle;
}
예제 #3
0
파일: c_test.c 프로젝트: Aleda/tera
unsigned char FilterKeyMatch(
    void* arg,
    const char* key, size_t length,
    const char* filter, size_t filter_length) {
  CheckCondition(filter_length == 4);
  CheckCondition(memcmp(filter, "fake", 4) == 0);
  return fake_filter_result;
}
예제 #4
0
파일: c_test.c 프로젝트: as2120/ZLevelDbWin
// Callback from leveldb_writebatch_iterate()
static void CheckDel(void* ptr, const char* k, size_t klen)
{
    int* state = (int*) ptr;
    CheckCondition(*state == 2);
    CheckEqual("bar", k, klen);
    (*state)++;
}
예제 #5
0
// Generic jmpr implementation
// JMPcc $R
// 0001 0111 rrr0 cccc
// Jump to address; set program counter to a value from register $R.
void jmprcc(const UDSPInstruction opc)
{
	if (CheckCondition(opc & 0xf))
	{
		u8 reg = (opc >> 5) & 0x7;
		g_dsp.pc = dsp_op_read_reg(reg);
	}
예제 #6
0
// Generic jmp implementation
// Jcc addressA
// 0000 0010 1001 cccc
// aaaa aaaa aaaa aaaa
// Jump to addressA if condition cc has been met. Set program counter to
// address represented by value that follows this "jmp" instruction.
void jcc(const UDSPInstruction opc)
{
	u16 dest = dsp_fetch_code();
	if (CheckCondition(opc & 0xf))
	{
		g_dsp.pc = dest;
	}
}
예제 #7
0
// Generic if implementation
// IFcc
// 0000 0010 0111 cccc
// Execute following opcode if the condition has been met.
void ifcc(const UDSPInstruction opc)
{
	if (!CheckCondition(opc & 0xf))
	{
		// skip the next opcode - we have to lookup its size.
		dsp_skip_inst();
	}
}
예제 #8
0
// Generic callr implementation
// CALLRcc $R
// 0001 0111 rrr1 cccc
// Call function if condition cc has been met. Push program counter of
// instruction following "call" to call stack $st0. Set program counter to
// register $R.
void callr(const UDSPInstruction opc)
{
	if (CheckCondition(opc & 0xf))
	{
		u8 reg  = (opc >> 5) & 0x7;
		u16 addr = dsp_op_read_reg(reg);
		dsp_reg_store_stack(DSP_STACK_C, g_dsp.pc);
		g_dsp.pc = addr;
	}
void
ODM_ReadAndConfig_PHY_REG_PG_8723B(
 	IN   PDM_ODM_T  pDM_Odm
 	)
{
	u4Byte     hex = 0;
	u4Byte     i           = 0;
	u2Byte     count       = 0;
	pu4Byte    ptr_array   = NULL;
	u1Byte     platform    = pDM_Odm->SupportPlatform;
	u1Byte     _interface   = pDM_Odm->SupportInterface;
	u1Byte     board       = pDM_Odm->BoardType;
	u4Byte     ArrayLen    = sizeof(Array_PHY_REG_PG_8723B)/sizeof(u4Byte);
	pu4Byte    Array       = Array_PHY_REG_PG_8723B;

//TODO,130422
//	pDM_Odm->PhyRegPgVersion = 1;
//	pDM_Odm->PhyRegPgValueType = PHY_REG_PG_RELATIVE_VALUE;
	hex += board;
	hex += _interface << 8;
	hex += platform << 16;
	hex += 0xFF000000;
	for (i = 0; i < ArrayLen; i += 6 )
	{
	    u4Byte v1 = Array[i];
	    u4Byte v2 = Array[i+1];
	    u4Byte v3 = Array[i+2];
	    u4Byte v4 = Array[i+3];
	    u4Byte v5 = Array[i+4];
	    u4Byte v6 = Array[i+5];

	    // this line is a line of pure_body
	    if ( v1 < 0xCDCDCDCD )
	    {
		 	 odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4, v5, v6);
		 	 continue;
	    }
	    else
	    { // this line is the start of branch
	        if ( !CheckCondition(Array[i], hex) )
	        { // don't need the hw_body
	            i += 2; // skip the pair of expression
	            v1 = Array[i];
	            v2 = Array[i+1];
	            v3 = Array[i+2];
	            while (v2 != 0xDEAD)
	            {
	                i += 3;
	                v1 = Array[i];
	                v2 = Array[i+1];
	                v3 = Array[i+1];
	            }
	        }
	    }
	}
}
예제 #10
0
bool CTesterProgram::NextLine(char &type, CString &cmd)
{
	if(m_iStackDepth <= 0) //not running in any function
		return false;

	CString line;
	CString para;
	
	//stay in some function ,retrieve the parameter first
	para = m_fun.GetAt(m_iStackDepth);
	line = m_fun.GetAt(m_iFunpos[m_iStackDepth]);
	m_iFunpos[m_iStackDepth]+=1;
	
	//replace the ^i^ with the corresponding parameter
	if(line.Find('^',0) > 0)
	{
		int count = 1;
		while(1)
		{
			CString str2;
			int pos;
			pos=para.Find(',',0);
			if(pos < 0)
				break;
			str2.Format("^%d^",count++);
			line.Replace(str2,para.Left(pos));
			para = para.Right(para.GetLength()-pos-1);
		}
	}
	
	//skip empty lines
	if(line.GetLength() < 1)
		line = _T("//");

	if(line.GetAt(0) == '{')//function calls
	{
		while(FunEnter(line));
	}
	else
	{
		if(line.GetAt(0) == '>')
		{
			m_iStackDepth--;
		}
	}

	if(CheckCondition(line,type))
	{
		if(!ProgramFunction(type,line))
		{
			cmd = line;
			return true;
		}
	}
	return false;
}
예제 #11
0
void
ODM_ReadAndConfig_PHY_REG_PG_8188E(
 	IN   PDM_ODM_T  pDM_Odm
 	)
{
	u4Byte     hex = 0;
	u4Byte     i           = 0;
	u2Byte     count       = 0;
	pu4Byte    ptr_array   = NULL;
	u1Byte     platform    = pDM_Odm->SupportPlatform;
	u1Byte     interfaceValue   = pDM_Odm->SupportInterface;
	u1Byte     board       = pDM_Odm->BoardType;  
	u4Byte     ArrayLen    = sizeof(Array_PHY_REG_PG_8188E)/sizeof(u4Byte);
	pu4Byte    Array       = Array_PHY_REG_PG_8188E;
	BOOLEAN		biol = FALSE;

	hex += board;
	hex += interfaceValue << 8;
	hex += platform << 16;
	hex += 0xFF000000;

	for (i = 0; i < ArrayLen; i += 3 )
	{
	    u4Byte v1 = Array[i];
	    u4Byte v2 = Array[i+1];
	    u4Byte v3 = Array[i+2];

	    // this line is a line of pure_body
	    if ( v1 < 0xCDCDCDCD )
	    {
			
		 	odm_ConfigBB_PHY_REG_PG_8188E(pDM_Odm, v1, v2, v3);
			
		 	 continue;
	    }
	    else
	    { // this line is the start of branch
	        if ( !CheckCondition(Array[i], hex) )
	        { // don't need the hw_body
	            i += 2; // skip the pair of expression
	            v1 = Array[i];
	            v2 = Array[i+1];
	            v3 = Array[i+2];
	            while (v2 != 0xDEAD)
	            {
	                i += 3;
	                v1 = Array[i];
	                v2 = Array[i+1];
	                v3 = Array[i+1];
	            }
	        }
	    }
	}

}
예제 #12
0
void ODM_ReadAndConfig_RadioA_1T_8723A(struct dm_odm_t *pDM_Odm)
{
	#define READ_NEXT_PAIR(v1, v2, i)			\
		 do {						\
			 i += 2; v1 = Array[i]; v2 = Array[i+1];\
		 } while (0)

	u32     hex         = 0;
	u32     i           = 0;
	u8     platform    = 0x04;
	u8     interfaceValue   = pDM_Odm->SupportInterface;
	u8     board       = pDM_Odm->BoardType;
	u32     ArrayLen    = sizeof(Array_RadioA_1T_8723A)/sizeof(u32);
	u32 *Array = Array_RadioA_1T_8723A;

	hex += board;
	hex += interfaceValue << 8;
	hex += platform << 16;
	hex += 0xFF000000;

	for (i = 0; i < ArrayLen; i += 2) {
		u32 v1 = Array[i];
		u32 v2 = Array[i+1];

		/*  This (offset, data) pair meets the condition. */
		if (v1 < 0xCDCDCDCD) {
			odm_ConfigRFReg_8723A(pDM_Odm, v1, v2, RF_PATH_A, v1);
			continue;
		} else {
			if (!CheckCondition(Array[i], hex)) {
				/*  Discard the following (offset, data) pairs. */
				READ_NEXT_PAIR(v1, v2, i);
				while (v2 != 0xDEAD &&
				       v2 != 0xCDEF &&
				       v2 != 0xCDCD && i < ArrayLen - 2)
					READ_NEXT_PAIR(v1, v2, i);
				i -= 2; /*  prevent from for-loop += 2 */
			} else {
				/*  Configure matched pairs and skip to end of if-else. */
				READ_NEXT_PAIR(v1, v2, i);
				while (v2 != 0xDEAD &&
				       v2 != 0xCDEF &&
				       v2 != 0xCDCD && i < ArrayLen - 2) {
					odm_ConfigRFReg_8723A(pDM_Odm, v1, v2,
							      RF_PATH_A, v1);
					READ_NEXT_PAIR(v1, v2, i);
				}

				while (v2 != 0xDEAD && i < ArrayLen - 2)
					READ_NEXT_PAIR(v1, v2, i);
			}
		}
	}
}
예제 #13
0
static u2Byte
odm_SetArrayPointerGetLength_8192C(
     IN   PDM_ODM_T  pDM_Odm,
     IN   u4Byte     ArrayLen,
     IN   pu4Byte    Array,
     OUT  pu4Byte    *gArrayPointer
     )
{
	u4Byte     hex = 0;
	u4Byte     i           = 0;
	u2Byte     count       = 0;
	pu4Byte    ptr_array   = NULL;
	u1Byte     platform    = pDM_Odm->SupportPlatform;
	u1Byte     interface   = pDM_Odm->SupportInterface;
	u1Byte     board       = pDM_Odm->BoardType;  
	ODM_AllocateMemory(pDM_Odm, (PVOID*)&ptr_array, sizeof(u4Byte) * RETURNED_ARRAY_SIZE);

	hex += board;
	hex += interface << 8;
	hex += platform << 16;
	hex += 0xFF000000;
	for (i = 0; i < ArrayLen; i += 2 )
	{
	    u4Byte v1 = Array[i];
	    u4Byte v2 = Array[i+1];

	    // this line is a line of pure_body
	    if ( v1 < 0xCDCDCDCD )
	    {
	        ptr_array[count++] = v1;
	        ptr_array[count++] = v2;
	        continue;
	    }
	    else
	    { // this line is the start of branch
	        if ( !CheckCondition(Array[i], hex) )
	        { // don't need the hw_body
	            i += 2;
	            v1 = Array[i];
	            v2 = Array[i+1];
	            while (v2 != 0xDEAD)
	            {
	                i += 2;
	                v1 = Array[i];
	                v2 = Array[i+1];
	            }
	        }
	    }
	}
	*gArrayPointer = ptr_array;
	return count;
}
예제 #14
0
std::vector<std::vector<int> > CellularAutomaton::NextGeneration(){
	std::vector<std::vector<int> > nextData = data;
	for(int i = 0; i < data.size(); i++){
		for(int j = 0; j < data[0].size(); j++){
			if(j < data[0].size()-1 && i < data.size()-1 && j > 1 && i > 1){ //if we are not at the edge
				int nsum = NeighborhoodSum(i, j);

				//if current cell is at the last count, set it to 0. if it's not at a stay position increment
				if(data[i][j] == (rule.c[rule.c.size() - 1] - 1)) nextData[i][j] = 0;
				else if(!CheckCondition(data[i][j], rule.s) && data[i][j]){
					nextData[i][j] += 1;
				}

				else if(CheckCondition(nsum, rule.b) && !data[i][j]){
					nextData[i][j] = 1;
				}
			}
		}
	}
	data = nextData;
	return data;
}
예제 #15
0
void
ODM_ReadAndConfig_AGC_TAB_5G_8192C(
 	IN   PDM_ODM_T  pDM_Odm
 	)
{
	u4Byte     hex         = 0;
	u4Byte     i           = 0;
	u2Byte     count       = 0;
	pu4Byte    ptr_array   = NULL;
	u1Byte     platform    = pDM_Odm->SupportPlatform;
	u1Byte     interface   = pDM_Odm->SupportInterface;
	u1Byte     board       = pDM_Odm->BoardType;  
	u4Byte     ArrayLen    = sizeof(Array_AGC_TAB_5G_8192C)/sizeof(u4Byte);
	pu4Byte    Array       = Array_AGC_TAB_5G_8192C;


	hex += board;
	hex += interface << 8;
	hex += platform << 16;
	hex += 0xFF000000;
	for (i = 0; i < ArrayLen; i += 2 )
	{
	    u4Byte v1 = Array[i];
	    u4Byte v2 = Array[i+1];
	
	    // this line is a line of pure_body
	    if ( v1 < 0xCDCDCDCD )
	    {
		    odm_ConfigBB_AGC_8192C(pDM_Odm, v1, bMaskDWord, v2);
		    continue;
	 	}
		else
		{ // this line is the start of branch
		    if ( !CheckCondition(Array[i], hex) )
		    { // don't need the hw_body
		        i += 2;
		        v1 = Array[i];
		        v2 = Array[i+1];
		        while (v2 != 0xDEAD && 
	                   v2 != 0xCDEF && 
	                   v2 != 0xCDCD)
		        {
		            i += 2;
		            v1 = Array[i];
		            v2 = Array[i+1];
		        }
		    }
		}
	}

}
void
ODM_ReadAndConfig_PHY_REG_MP_8723A(
 	IN   PDM_ODM_T  pDM_Odm
 	)
{
	u4Byte     hex         = 0;
	u4Byte     i           = 0;
	u2Byte     count       = 0;
	pu4Byte    ptr_array   = NULL;
	u1Byte     platform    = pDM_Odm->SupportPlatform;
	u1Byte     interface   = pDM_Odm->SupportInterface;
	u1Byte     board       = pDM_Odm->BoardType;  
	u4Byte     ArrayLen    = sizeof(Array_PHY_REG_MP_8723A)/sizeof(u4Byte);
	pu4Byte    Array       = Array_PHY_REG_MP_8723A;


	hex += board;
	hex += interface << 8;
	hex += platform << 16;
	hex += 0xFF000000;
	for (i = 0; i < ArrayLen; i += 2 )
	{
	    u4Byte v1 = Array[i];
	    u4Byte v2 = Array[i+1];
	
	    // This (offset, data) pair meets the condition.
	    if ( v1 < 0xCDCDCDCD )
	    {
		   	odm_ConfigBB_PHY_8723A(pDM_Odm, v1, bMaskDWord, v2);
		    continue;
	 	}
		else
		{ // This line is the start line of branch.
		    if ( !CheckCondition(Array[i], hex) )
		    { // Discard the following (offset, data) pairs.
		        i += 2;
		        v1 = Array[i];
		        v2 = Array[i+1];
		        while (v2 != 0xDEAD && 
	                   v2 != 0xCDEF && 
	                   v2 != 0xCDCD)
		        {
		            i += 2;
		            v1 = Array[i];
		            v2 = Array[i+1];
		        }
		    }
		}
	}

}
예제 #17
0
uint32 EquipImprove::strengthenEquip(uint32 thisid)
{

	GameItem *item= GlobalItemManager::instance().getItemByThisID(thisid);
	CheckCondition(item,ERR_PARAMS);

	uint32 ret = cost(item);
	if(ret!=ERR_SUCCESS)
	{
		item->updateEquipStrengthenLev();
		return ERR_SUCCESS;
	}
	return ret;
}
예제 #18
0
파일: Crafting.cpp 프로젝트: kgrubb/iceee
const CraftRecipe* CraftManager::GetRecipe(std::vector<CraftInputSlot> &inputItems)
{
	SortInputs(inputItems);
	size_t inputCount = inputItems.size();
	for(size_t i = 0; i < mRecipes.size(); i++)
	{
		CraftRecipe *recipe = &mRecipes[i];
		if(recipe->mInputCount != inputCount)
			continue;
		if(CheckCondition(recipe->mConditions, inputItems) == true)
			return recipe;
	}
	return NULL;
}
예제 #19
0
파일: c_test.c 프로젝트: Aleda/tera
// Callback from leveldb_writebatch_iterate()
static void CheckPut(void* ptr,
                     const char* k, size_t klen,
                     const char* v, size_t vlen) {
  int* state = (int*) ptr;
  CheckCondition(*state < 2);
  switch (*state) {
    case 0:
      CheckEqual("bar", k, klen);
      CheckEqual("b", v, vlen);
      break;
    case 1:
      CheckEqual("box", k, klen);
      CheckEqual("c", v, vlen);
      break;
  }
  (*state)++;
}
	Sound* SoundManager::createSound(const Ogre::String& name, 
		const Ogre::String& fileName, bool loop, bool stream)
	{
		// Lock Mutex
		OGREAL_LOCK_AUTO_MUTEX

		CheckCondition(mSoundMap.find(name) == mSoundMap.end(), 13, "A Sound with name '" + name + "' already exists.");

		Ogre::NameValuePairList fileTypePair;
		fileTypePair[SOUND_FILE] = fileName;
		fileTypePair[LOOP_STATE] = Ogre::StringConverter::toString(loop);
		fileTypePair[STREAM] = Ogre::StringConverter::toString(stream);
		
		Sound *newSound = static_cast<Sound*>(mSoundFactory->createInstance(name, NULL, &fileTypePair));
		mSoundMap[name] = newSound;
		return newSound;
	}
void ControlHelpSystem::Advance()
{
	if (g_inputManager->getInputMode() != INPUT_MODE_GAMEPAD && g_prefsManager->GetInt(OTHER_CONTROLHELPENABLED, 1))
		return;

	// Clear all helpIcons
	for (int i = 0; i < MaxIcons; i++)
		m_icons[i]->Clear();

	// Decay the usage on the conditions
	for (int i = 0; i < MaxConditions; i++)
		DecayCond(i);

	// Check conditions
	for (int i = 0; i < MaxConditions; i++)
		if (CheckCondition(i))
			SetCondIcon(i);
}
예제 #22
0
  void Update(NMEA_INFO *Basic, DERIVED_INFO *Calculated) {
    if (!Calculated->Flying) 
      return;

    bool restart = false;
    if (Ready_Time_Check(Basic->Time, &restart)) {
      LastTime_Check = Basic->Time;
      if (CheckCondition(Basic, Calculated)) {
	if (Ready_Time_Notification(Basic->Time) && !restart) {
	  LastTime_Notification = Basic->Time;
	  Notify();
	  SaveLast();
	}
      }
      if (restart) {
        SaveLast();
      }
    }
  }
예제 #23
0
BOOL HumanSkillUpgrade::HumanSkillLevelUp( const Obj_Human* pHuman, SkillID_t iSkillID, INT iLevel )
{
	__ENTER_FUNCTION;

	InitAttr(pHuman, iSkillID, iLevel);
	if( !CheckCondition() )
	{
		SendFailedSkillLevelupMsg();
		return FALSE;
	}

	DepleteHumanAttr();
	UpgradeLevel();
	SendSuccessSkillLevelupMsg();

	StartPassiveSkill(iSkillID, pHuman);
	return TRUE;

	__LEAVE_FUNCTION
}
예제 #24
0
void ctkDICOMDataset::InitializeFromDataset(DcmDataset* dataset, bool takeOwnership)
{
  Q_D(ctkDICOMDataset);

  if(d->m_DcmDataset != dataset)
  {
    if (d->m_TakeOwnership)
    {
      delete d->m_DcmDataset;
    }
    d->m_DcmDataset = NULL;
  }

  if (dataset)
  {
    d->m_DcmDataset=dataset;
    d->m_TakeOwnership = takeOwnership;
    if (!d->m_DICOMDataSetInitialized)
    {
      d->m_DICOMDataSetInitialized = true;
      OFString encoding;
      if ( CheckCondition( dataset->findAndGetOFString(DCM_SpecificCharacterSet, encoding) ) )
      {
        d->m_SpecificCharacterSet = encoding.c_str();
      }
      }
      if (d->m_SpecificCharacterSet.isEmpty())
      {
        ///
        /// see Bug # 6458:
        /// There are cases, where different studies of the same person get encoded both with and without the SpecificCharacterSet attribute set.
        /// DICOM says: default is ASCII / ISO_IR 6 / ISO 646
        /// Since we experienced such mixed data, we supplement missing characterset information with the ISO_IR 100 / Latin1 character set.
        /// Since Latin1 is a superset of ASCII, this will not cause problems. PLUS in most cases (Europe) we will guess right and suppress
        /// "double patients" in applications.
        ///
        SetElementAsString( DCM_SpecificCharacterSet, "ISO_IR 100" );
      }
    }
  }
예제 #25
0
static GLuint CreateVertexBuffer()
{
    RenderContext& rc = GlobalRenderContext;

    Vertex* pVert = &rc.Verts[0];

    float ds = 1.0f / (Slices - 1);
    float dt = 1.0f / Stacks;

    // The upper bounds in these loops are tweaked to reduce the
    // chance of precision error causing an incorrect # of iterations.

    for (float s = 0; s < 1 + ds / 2; s += ds)
    {
        for (float t = 0; t < 1 - dt / 2; t += dt)
        {
            const float E = 0.01f;
            vec3 p = EvaluateMobius(s, t);
            vec3 u = EvaluateMobius(s + E, t) - p;
            vec3 v = EvaluateMobius(s, t + E) - p;
            vec3 n = u.Cross(v).Normalized();

            pVert->Position = vec4(p, 1.0f);
            pVert->Normal = n;
            ++pVert;
        }
    }

    CheckCondition(pVert - &rc.Verts[0] == VertexCount, "Tessellation error.");

    GLuint handle;
    GLsizeiptr size = sizeof(rc.Verts);
    GLenum usage = GL_DYNAMIC_DRAW;

    glGenBuffers(1, &handle);
    glBindBuffer(GL_ARRAY_BUFFER, handle);
    glBufferData(GL_ARRAY_BUFFER, size, 0, usage);

    return handle;
}
예제 #26
0
void ODM_ReadAndConfig_PHY_REG_PG_8188E(struct odm_dm_struct *dm_odm)
{
	u32  hex;
	u32  i           = 0;
	u8  platform    = dm_odm->SupportPlatform;
	u8  interfaceValue   = dm_odm->SupportInterface;
	u8  board       = dm_odm->BoardType;
	u32  arraylen    = sizeof(array_phy_reg_pg_8188e) / sizeof(u32);
	u32 *array       = array_phy_reg_pg_8188e;

	hex = board + (interfaceValue << 8);
	hex += (platform << 16) + 0xFF000000;

	for (i = 0; i < arraylen; i += 3) {
		u32 v1 = array[i];
		u32 v2 = array[i+1];
		u32 v3 = array[i+2];

		/*  this line is a line of pure_body */
		if (v1 < 0xCDCDCDCD) {
			odm_ConfigBB_PHY_REG_PG_8188E(dm_odm, v1, v2, v3);
			continue;
		} else { /*  this line is the start of branch */
			if (!CheckCondition(array[i], hex)) {
				/*  don't need the hw_body */
				i += 2; /*  skip the pair of expression */
				v1 = array[i];
				v2 = array[i+1];
				v3 = array[i+2];
				while (v2 != 0xDEAD) {
					i += 3;
					v1 = array[i];
					v2 = array[i+1];
					v3 = array[i+1];
				}
			}
		}
	}
}
예제 #27
0
void
ConditionMonitor::Update(const GlideComputer& cmp)
{
  if (!cmp.Calculated().flight.flying)
    return;

  bool restart = false;
  const fixed Time = cmp.Basic().time;
  if (Ready_Time_Check(Time, &restart)) {
    LastTime_Check = Time;
    if (CheckCondition(cmp)) {
      if (Ready_Time_Notification(Time) && !restart) {
        LastTime_Notification = Time;
        Notify();
        SaveLast();
      }
    }

    if (restart)
      SaveLast();
  }
}
예제 #28
0
void
ConditionMonitor::Update(const NMEAInfo &basic, const DerivedInfo &calculated,
                         const ComputerSettings &settings)
{
  if (!calculated.flight.flying)
    return;

  bool restart = false;
  const fixed Time = basic.time;
  if (Ready_Time_Check(Time, &restart)) {
    LastTime_Check = Time;
    if (CheckCondition(basic, calculated, settings)) {
      if (Ready_Time_Notification(Time) && !restart) {
        LastTime_Notification = Time;
        Notify();
        SaveLast();
      }
    }

    if (restart)
      SaveLast();
  }
}
예제 #29
0
void 
RET (void)
{
  long constant;

  switch (GetSym ())
    {
    case name:
      if ((constant = CheckCondition ()) != -1)
        *codeptr++ = 192 + constant * 8;	/* RET cc  instruction opcode */
      else
        ReportError (CURRENTFILE->fname, CURRENTFILE->line, 11);
      break;

    case newline:
      *codeptr++ = 201;
      break;

    default:
      ReportError (CURRENTFILE->fname, CURRENTFILE->line, 1);
      return;
    }
  ++PC;
}
예제 #30
0
bool ctkDICOMDataset::CopyElement( DcmDataset* dataset, const DcmTagKey& tag, int type )
{
  Q_D(ctkDICOMDataset);
  switch (type)
  {
    case 0x1:
    case 0x1C:
    case 0x2:
    case 0x2C:
    case 0x3:
      // these are ok
      break;
    default:
      // nothing else is ok
      std::cerr << "Unknown attribute type. Cannot process call to ExtractElement " << TagKey(tag).toStdString() << std::endl;
      return false;
  }

  bool missing(false);
  bool copied(true);

  if (!dataset) return false;
  if (dataset == d->m_DcmDataset)
  {
    throw std::logic_error("Trying to copy tag to yourself. Please check application logic!"); 
  }

  // type 1 or 1C must exist AND have a value
  if (!dataset->tagExistsWithValue( tag ))
  {
    if (type == 0x1 || type == 0x1C) missing = true;
  }

  // type 2 or 2C must exist but may have an empty value
  if (!dataset->tagExists( tag ))
  {
    if (type == 0x1 || type == 0x1C) missing = true;
    if (type == 0x2 || type == 0x2C) missing = true;
  }
  else
  {
    // we found this tag
    DcmElement* element(NULL);
    dataset->findAndGetElement( tag, element, OFFalse, OFTrue ); // OFTrue is important (copies element), DcmDataset takes ownership and deletes elements on its own destruction
    if (element)
    {
      copied = CheckCondition( d->m_DcmDataset->insert(element) );
    }
  }

  if (missing)
  {
    std::cerr << "Tag " << TagKey(tag).toStdString() << " [" << TagDescription(tag).toStdString() << "] of type " << QString("%1").arg(type,0,16).toStdString() << " missing or empty." << std::endl;
  }

  if (!copied)
  {
    std::cerr << "Tag " << TagKey(tag).toStdString() << " [" << TagDescription(tag).toStdString() << "] not copied successfully" << std::endl;
  }

  return !missing && copied;
}