Пример #1
0
void CColourPopup::OnMouseMove(UINT nFlags, CPoint point) 
{
    int nNewSelection = INVALID_COLOUR;

    // Translate points to be relative raised window edge
    point.x -= m_nMargin;
    point.y -= m_nMargin;

    // First check we aren't in text box
    if (m_strCustomText.GetLength() && m_CustomTextRect.PtInRect(point))
        nNewSelection = CUSTOM_BOX_VALUE;
    else if (m_strDefaultText.GetLength() && m_DefaultTextRect.PtInRect(point))
        nNewSelection = DEFAULT_BOX_VALUE;
    else
    {
        // Take into account text box
        if (m_strDefaultText.GetLength()) 
            point.y -= m_DefaultTextRect.Height();  

        // Get the row and column
        nNewSelection = GetIndex(point.y / m_nBoxSize, point.x / m_nBoxSize);

        // In range? If not, default and exit
        if (nNewSelection < 0 || nNewSelection >= m_nNumColours)
        {
            CWnd::OnMouseMove(nFlags, point);
            return;
        }
    }

    // OK - we have the row and column of the current selection (may be CUSTOM_BOX_VALUE)
    // Has the row/col selection changed? If yes, then redraw old and new cells.
    if (nNewSelection != m_nCurrentSel)
        ChangeSelection(nNewSelection);

    CWnd::OnMouseMove(nFlags, point);
}
Пример #2
0
void DlgPalette::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
    long x = point.x - m_xoffset;
    long y = point.y - m_yoffset;

	if (x>=0 && y>=0){
		long i = GetIndex(y / (m_boxheight+m_boxgap), x / (m_boxwidth+m_boxgap));

		if (i>=0 && i<m_numcolors){

			COLORREF c;

			if (m_editalpha)
				c=RGB(m_pal[i].rgbReserved,m_pal[i].rgbReserved,m_pal[i].rgbReserved);
			else
				c=RGB(m_pal[i].rgbRed,m_pal[i].rgbGreen,m_pal[i].rgbBlue);

	        CColorDialog dlg(c,	CC_FULLOPEN | CC_ANYCOLOR, this);

			if (dlg.DoModal() == IDOK){
				c = dlg.GetColor();
				if (m_editalpha){
					m_pal[i].rgbReserved=GetRValue(c);
				} else {
					m_pal[i].rgbRed=GetRValue(c);
					m_pal[i].rgbGreen=GetGValue(c);
					m_pal[i].rgbBlue=GetBValue(c);
				}
				m_changed=1;
				m_selected=i;
				Invalidate(1);
			}
		}
	}

	CDialog::OnLButtonDblClk(nFlags, point);
}
CDictionaryBasedTempPath CDictionaryBasedTempPath::GetCommonRoot
    (const CDictionaryBasedTempPath& rhs) const
{
    // short-cut: different base directories anyway?

    if (rhs.GetIndex() != GetIndex())
        return CDictionaryBasedTempPath (inherited::GetCommonRoot (rhs));

    // match relative paths

    typedef std::vector<std::string>::const_iterator IT;
    IT begin = relPathElements.begin();
    IT end = relPathElements.end();
    IT iter = begin;

    IT rhsEnd = relPathElements.end();
    IT rhsIter = relPathElements.begin();

    while ((iter != end) && (rhsIter != rhsEnd) && (*iter == *rhsIter))
    {
        ++iter;
        ++rhsIter;
    }

    // construct the result

    CDictionaryBasedTempPath result (GetBasePath());
    result.relPathElements.insert (result.relPathElements.begin(), begin, iter);

    // update the debug-only _path member

#ifdef _DEBUG
    result._path = result.GetPath();
#endif

    return result;
}
Пример #4
0
// Read values from a text file or terminal
static
void TakeFloatValues(cmsFloat64Number Float[])
{
    cmsUInt32Number i, n;
    char ChannelName[cmsMAX_PATH];
    char Buffer[cmsMAX_PATH];

    if (xisatty(stdin))
        fprintf(stderr, "\nEnter values, 'q' to quit\n");

    if (InputNamedColor) {

        // This is named color index, which is always cmsUInt16Number
        cmsUInt16Number index = GetIndex();
        memcpy(Float, &index, sizeof(cmsUInt16Number));
        return;
    }

    n = cmsChannelsOf(InputColorSpace);
    for (i=0; i < n; i++) {

        if (InputColorant) {
            cmsNamedColorInfo(InputColorant, i, ChannelName, NULL, NULL, NULL, NULL);          
        }
        else {
            InputRange = 1;
            sprintf(ChannelName, "Channel #%u", i+1);
        }

        GetLine(Buffer, "%s? ", ChannelName);

        Float[i] = (cmsFloat64Number) atof(Buffer) / InputRange;
    }       

    if (xisatty(stdin))
        fprintf(stderr, "\n");
}
Пример #5
0
    TEST(NativeCode, AndRowJzMatches)
    {
        ShardId c_numShards = 1;
        char const * text =
            "LoadRowJz {"
            "  Row: Row(0, 0, 0, false),"
            "  Child: AndRowJz {"
            "    Row: Row(1, 0, 0, false),"
            "    Child: AndRowJz {"
            "      Row: Row(2, 0, 0, false),"
            "      Child: Report {"
            "        Child: "
            "      }"
            "    }"
            "  }"
            "}";

        const Rank initialRank = 0;
        NativeCodeVerifier verifier(GetIndex(c_numShards), initialRank);

        verifier.DeclareRow("2");
        verifier.DeclareRow("3");
        verifier.DeclareRow("5");

        for (auto iteration : verifier.GetIterations())
        {
            const size_t slice = verifier.GetSliceNumber(iteration);
            const size_t offset = verifier.GetOffset(iteration);

            const uint64_t row0 = verifier.GetRowData(0, offset, slice);
            const uint64_t row1 = verifier.GetRowData(1, offset, slice);
            const uint64_t row2 = verifier.GetRowData(2, offset, slice);
            verifier.ExpectResult(row0 & row1 & row2, offset, slice);
        }

        verifier.Verify(text);
    }
Пример #6
0
BOOL Palette_GetEntryLabel( LPPALETTE lpHeadPalette, int iPalette, int iEntry,
                              LPTSTR lpColorLabel )
/************************************************************************/
{
LPPALETTE lpPalette;
LPTSTR lpLabels, lpLast;
WORD Index;
BYTE Type, Length;

lpColorLabel[0] = _T('\0');
lpPalette = Palette_Get(lpHeadPalette, NULL, iPalette);
if (lpPalette)
	{
	if (!lpPalette->iColors || iEntry < 0 || iEntry >= lpPalette->iColors)
		return(FALSE);
	lpLabels = lpPalette->lpLabels;
	if (!lpLabels)
		return(TRUE);
	lpLast = lpLabels + lpPalette->LabelsLength;
	while (lpLabels < lpLast)
		{
		Index = GetIndex(lpLabels);
		Type = *lpLabels++;
		Length = *lpLabels++;
		lpLabels += 2;
		if (Index == iEntry)
			{
			Palette_FormatEntryLabel(lpPalette, Type, lpLabels,
					 lpColorLabel);
			break;
			}
		lpLabels += (Length-4);
		}
	return(TRUE);
	}
return(FALSE);
}
Пример #7
0
DefTableKeyList FillInsertKeyList (DefTableKeyList orig)
{ DefTableKeyList missing = NULLDefTableKeyList, l = orig;
  int index = 1;
  while (l != NULLDefTableKeyList)
  { DefTableKey insKey = HeadDefTableKeyList (l);
    int elemindex = GetIndex (insKey, index);
    while (index < elemindex)
    { DefTableKey newk = NewKey ();
      ResetType (newk, nodeType); 
      ResetIndex (newk, index++);
      ResetUsed (newk, 0);
      missing = ConsDefTableKeyList (newk, missing);
    }
    index++;
    l = TailDefTableKeyList (l);
  }
  while (missing != NULLDefTableKeyList)
  { DefTableKey insKey = HeadDefTableKeyList (missing);
    orig = AddToOrderedSetDefTableKeyList
             (insKey, orig, cmpPatIndex);
    missing = TailDefTableKeyList (missing);
  }
  return orig;
}
Пример #8
0
/**
Adds a recognition result to the hash map of the particular directory.
This is only done if it isn't already existing.
The return value specifies if the number of entries was increased by one (ETrue) or not.
@internalComponent
*/
TBool CRecognitionResultHashMap::AddL(const TDesC& aKey, TTime aLastModified, const TDataRecognitionResult& aResult)
	{
	const TUint index = GetIndex(aKey);

	//check if there already is an entry for the file
	for(CRecognitionResultHashMapEntry* entry = Entry(index); entry; entry = entry->Next())
		{
		if(entry->FileName().Compare(aKey) == 0)
			{
			// already there -> check modification date
			if( entry->LastModified() != aLastModified )
				{
				entry->UpdateL(aLastModified, aResult);
				}

			return EFalse;
			}
		}

	//create new entry
	SetEntry(index, CRecognitionResultHashMapEntry::NewL(aKey, aLastModified, aResult, Entry(index)));
	iNumberOfEntries++;
	return ETrue;
	}
Пример #9
0
void NPC::Spawn(Vector origin)
{
	pev->solid = SOLID_BBOX;
	pev->takedamage = DAMAGE_AIM;
	pev->deadflag = DEAD_NO;
	pev->health = pev->max_health;
	pev->fixangle = true;

	SET_SIZE(GetEntity(), g_npcSize[0], g_npcSize[1]);
	SET_ORIGIN(GetEntity(), origin);

	m_pmodel = null;

	DROP_TO_FLOOR(GetEntity());

	pev->animtime = gpGlobals->time;
	pev->nextthink = m_nextThinkTime = gpGlobals->time + 0.2f;
	m_frameInterval = gpGlobals->time;

	m_iDamage = false;
	SetEntityAction(GetIndex(), m_npcTeam, 1);

	m_workNPC = true;
}
Пример #10
0
void RoutesPage::ClickDelete2(int result)
{
	int i;
	GPXRoute *f;

	if(result==MSGBOX_YES)
	{
		i=GetIndex(m_editroutelist.GetSelectionString());
		if(i>=0)
		{
			f=m_routes.GetEntry(i);
			delete f;
			m_routes.DeleteEntry(i);
			--m_numroutes;
			m_editroutelist.SetSelection(0);

			UpdateRouteList();
			Load();
			//SavePrefs();
			return;
		}
		assert(false,"route not found!");
	}
}
Пример #11
0
	void GCAlloc::SweepGuts(GCBlock *b)
	{	
		// TODO: MMX version for IA32
		uint32_t *bits = (uint32_t*) b->GetBits();
		uint32_t count = b->nextItem ? GetIndex(b, b->nextItem) : m_itemsPerBlock;
		// round up to eight
		uint32_t numInts = ((count+7)&~7) >> 3;
		for(uint32_t i=0; i < numInts; i++) 
		{
			uint32_t marks = bits[i];
			// hmm, is it better to screw around with exact counts or just examine
			// 8 items on each pass, with the later we open the door to unrolling
			uint32_t subCount = i==(numInts-1) ? ((count-1)&7)+1 : 8;
			for(uint32_t j=0; j<subCount;j++,marks>>=4)
			{
				int mq = marks & kFreelist;
				if(mq == kMark || mq == kQueued)	// Sweeping is lazy; don't sweep objects on the mark stack
				{
					// live item, clear bits
					bits[i] &= ~(kFreelist<<(j*4));
					continue;					
				}

				 if(mq == kFreelist)
					 continue; // freelist item, ignore

				// garbage, freelist it
				void *item = (char*)b->items + m_itemSize*(i*8+j);
#ifdef MMGC_HOOKS
				if(m_gc->heap->HooksEnabled())
					m_gc->heap->FreeHook(GetUserPointer(item), b->size - DebugSize(), 0xba);
#endif
				b->FreeItem(item, (i*8+j));
			}
		}
	}
Пример #12
0
// ---------------------------------------------------------------------
// GETINDEX (astral coordinates version)
unsigned short int GetIndex(trixel* trixel, double& ra, double& dec)
{
    if (IsCorrectRA(ra) && IsCorrectDEC(dec))
    {
        double rProjection = sin(90 - abs(dec));
        double x = rProjection * cos(ra);
        double y = rProjection * sin(ra);
        double z = cos(90 - abs(dec));
        Eigen::Vector3d p(x, y, z);
        unsigned short int ret = GetIndex(trixel, p);
        if (ret == max<unsigned short>()) // Is it not good ..?
        {
            // Did nothing in the first place...
        }
        return ret;
    }
    else
    {
        llog::warn["HTM"]
            << "Given <ra> [" << ra << "] or <dec> [" << dec << "] is out of bounds"
            << std::endl;
    }
    return max<unsigned short>();
}
Пример #13
0
bool UMovieScene::RemovePossessable( const FGuid& PossessableGuid )
{
	bool bAnythingRemoved = false;

	for( auto PossesableIter( Possessables.CreateIterator() ); PossesableIter; ++PossesableIter )
	{
		auto& CurPossesable = *PossesableIter;

		if( CurPossesable.GetGuid() == PossessableGuid )
		{	
			Modify();

			// Found it!
			Possessables.RemoveAt( PossesableIter.GetIndex() );

			RemoveObjectBinding( PossessableGuid );

			bAnythingRemoved = true;
			break;
		}
	}

	return bAnythingRemoved;
}
Пример #14
0
BOOL CCoolMenuBarCtrl::OpenMenuChar(UINT nChar)
{
	CMenu pMenu;
	pMenu.Attach( m_hMenu );

	for ( UINT nItem = 0 ; nItem < pMenu.GetMenuItemCount() ; nItem++ )
	{
		CString strMenu;
		pMenu.GetMenuString( nItem, strMenu, MF_BYPOSITION );

		LPCTSTR pszChar = _tcschr( strMenu, '&' );
		if ( ! pszChar++ ) continue;

		if ( toupper( *pszChar ) == toupper( nChar ) )
		{
			pMenu.Detach();
			if ( m_pSelect = GetIndex( nItem ) ) PostMessage( WM_TIMER, 5 );
			return TRUE;
		}
	}

	pMenu.Detach();
	return FALSE;
}
Пример #15
0
BOOL CKeyshortcutsDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	m_ctrlCBRecord.SetCurSel(GetIndex(cHotKeyOpts.m_RecordStart.m_vKey));
	m_ctrlCBStop.SetCurSel(GetIndex(cHotKeyOpts.m_RecordEnd.m_vKey));
	m_ctrlCBCancel.SetCurSel(GetIndex(cHotKeyOpts.m_RecordCancel.m_vKey));
	m_ctrlCBNext.SetCurSel(GetIndex(cHotKeyOpts.m_Next.m_vKey));
	m_ctrlCBPrev.SetCurSel(GetIndex(cHotKeyOpts.m_Prev.m_vKey));
	m_ctrlCBShow.SetCurSel(GetIndex(cHotKeyOpts.m_ShowLayout.m_vKey));
	m_ctrlCBAutopan.SetCurSel(GetIndex(cHotKeyOpts.m_Autopan.m_vKey));

	m_ctrlButtonRecordCTRL.SetCheck((cHotKeyOpts.m_RecordStart.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonStopCTRL.SetCheck((cHotKeyOpts.m_RecordEnd.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonCancelCTRL.SetCheck((cHotKeyOpts.m_RecordCancel.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonNextCTRL.SetCheck((cHotKeyOpts.m_Next.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonPrevCTRL.SetCheck((cHotKeyOpts.m_Prev.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonShowCTRL.SetCheck((cHotKeyOpts.m_ShowLayout.m_fsMod & MOD_CONTROL) > 0);
	m_ctrlButtonAutoSpanCTRL.SetCheck((cHotKeyOpts.m_Autopan.m_fsMod & MOD_CONTROL) > 0);

	m_ctrlButtonRecordALT.SetCheck((cHotKeyOpts.m_RecordStart.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonStopALT.SetCheck((cHotKeyOpts.m_RecordEnd.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonCancelALT.SetCheck((cHotKeyOpts.m_RecordCancel.m_fsMod) > 0);
	m_ctrlButtonNextALT.SetCheck((cHotKeyOpts.m_Next.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonPrevALT.SetCheck((cHotKeyOpts.m_Prev.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonShowALT.SetCheck((cHotKeyOpts.m_ShowLayout.m_fsMod & MOD_ALT) > 0);
	m_ctrlButtonAutoSpanALT.SetCheck((cHotKeyOpts.m_Autopan.m_fsMod & MOD_ALT) > 0);

	m_ctrlButtonRecordSHFT.SetCheck((cHotKeyOpts.m_RecordStart.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonStopSHFT.SetCheck((cHotKeyOpts.m_RecordEnd.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonCancelSHFT.SetCheck((cHotKeyOpts.m_RecordCancel.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonNextSHFT.SetCheck((cHotKeyOpts.m_Next.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonPrevSHFT.SetCheck((cHotKeyOpts.m_Prev.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonShowCHFT.SetCheck((cHotKeyOpts.m_ShowLayout.m_fsMod & MOD_SHIFT) > 0);
	m_ctrlButtonAutoSpanSHFT.SetCheck((cHotKeyOpts.m_Autopan.m_fsMod & MOD_SHIFT) > 0);
	return TRUE; // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Пример #16
0
void Scene_Debug::Update() {
	range_window->Update();
	if (range_index != range_window->GetIndex()){
		range_index = range_window->GetIndex();
		var_window->UpdateList(range_page * 100 + range_index * 10 + 1);
		var_window->Refresh();
	}
	var_window->Update();

	if (numberinput_window->GetActive())
		numberinput_window->Update();

	if (Input::IsTriggered(Input::CANCEL)) {
		Game_System::SePlay(Game_System::GetSystemSE(Game_System::SFX_Cancel));
		if (range_window->GetActive())
			Scene::Pop();
		else if (var_window->GetActive()) {
			var_window->SetActive(false);
			range_window->SetActive(true);
			var_window->Refresh();
		} else if (numberinput_window->GetActive()) {
			numberinput_window->SetVisible(false);
			numberinput_window->SetActive(false);
			var_window->SetActive(true);
		}
	} else if (Input::IsTriggered(Input::DECISION)) {
		var_window->Refresh();
		if (range_window->GetActive()) {
			range_window->SetActive(false);
			var_window->SetActive(true);
		} else if (var_window->GetActive()) {
			if (current_var_type == TypeSwitch && Game_Switches.IsValid(GetIndex()))
				Game_Switches[GetIndex()] = !Game_Switches[GetIndex()];
			else if (current_var_type == TypeInt && Game_Variables.IsValid(GetIndex())) {
				var_window->SetActive(false);
				numberinput_window->SetNumber(Game_Variables[GetIndex()]);
				numberinput_window->SetVisible(true);
				numberinput_window->SetActive(true);
			}
			var_window->Refresh();
		} else if (numberinput_window->GetActive()) {
			Game_Variables[GetIndex()] = numberinput_window->GetNumber();
			numberinput_window->SetActive(false);
			numberinput_window->SetVisible(false);
			var_window->SetActive(true);
			var_window->Refresh();
		}
		Game_Map::SetNeedRefresh(Game_Map::Refresh_All);
	} else if (range_window->GetActive() &&  Input::IsTriggered(Input::RIGHT)) {
		range_page++;
		if (current_var_type == TypeSwitch && !Game_Switches.IsValid(range_page*100+1)) {
			range_page = 0;
			current_var_type = TypeInt;
			var_window->SetShowSwitch(false);
		} else if (current_var_type == TypeInt && !Game_Variables.IsValid(range_page*100+1)) {
			range_page = 0;
			current_var_type = TypeSwitch;
			var_window->SetShowSwitch(true);
		}
		var_window->UpdateList(range_page * 100 + range_index * 10 + 1);
		UpdateRangeListWindow();
		var_window->Refresh();
	} else if (range_window->GetActive() && Input::IsTriggered(Input::LEFT)) {
		range_page--;
		if (current_var_type == TypeSwitch && range_page < 0) {
			range_page = 0;
			for (;;)
				if (Game_Variables.IsValid(range_page*100 + 101))
					range_page++;
				else
					break;
			current_var_type = TypeInt;
			var_window->SetShowSwitch(false);
		} else if (current_var_type == TypeInt && range_page < 0) {
			range_page = 0;
			for (;;)
				if (Game_Switches.IsValid(range_page*100 + 101))
					range_page++;
				else
					break;
			current_var_type = TypeSwitch;
			var_window->SetShowSwitch(true);
		}
		var_window->UpdateList(range_page * 100 + range_index * 10 + 1);
		UpdateRangeListWindow();
		var_window->Refresh();
	}
}
Пример #17
0
 wxString GetName() const
     { return m_parent->GetString(GetIndex()); }
void CBCGPTransferFunction::Calculate(CArray<double, double>& output) const
{
	output.RemoveAll();

	int size = (int)m_Points.GetSize();
	if (size == 0)
	{
		return;
	}

	int count = (int)fabs((m_InputValueMax - m_InputValueMin) / m_InputValueStep) + 1;
	if (count == 1)
	{
		return;
	}

	output.SetSize(count);

	XPoint pt(m_Points[0]);
	if (m_InputValueMin < pt.m_Point)
	{
		for (int i = 0; i <= GetIndex(pt.m_Point); i++)
		{
			output[i] = pt.m_Value;
		}
	}

	if (size > 1)
	{
		pt = m_Points[size - 1];
	}

	if (pt.m_Point < m_InputValueMax)
	{
		for (int i = GetIndex(pt.m_Point); i < count; i++)
		{
			output[i] = pt.m_Value;
		}
	}

	// linear
	size = (int)m_Points.GetSize ();
	if (size < 2)
	{
		return;
	}

	for(long k = size - 1; k >= 1; k--)
	{
		CArray<double, double> points;

		XPoint pt1(m_Points[k - 1]);
		XPoint pt2(m_Points[k]);

		int index1 = GetIndex(pt1.m_Point);
		int index2 = GetIndex(pt2.m_Point);
		double dY = (pt2.m_Value - pt1.m_Value) / (double)(index2 - index1);
		double value = pt1.m_Value;
		for(int i = index1; i <= index2; i++)
		{
			points.Add(bcg_clamp(value, m_OutputValueMin, m_OutputValueMax));
			value += dY;
		}

		if(points.GetSize() <= 2)
		{
			continue;
		}

		int kInsert = index1;
		for(int kk = 0; kk <= points.GetSize() - 1; kk++)
		{
			output[kInsert++] = points[kk];
		}
	}
}
Пример #19
0
void MyBOManager::DisplaySphere(String a_sName, vector3 a_v3Color)
{
	int nIndex = GetIndex(a_sName);
	DisplaySphere(nIndex, a_v3Color);
}
Пример #20
0
//Accessors
MyBOClass* MyBOManager::GetBoundingObject(String a_sIndex)
{
	int nIndex = GetIndex(a_sIndex);
	return GetBoundingObject(nIndex);
}
Пример #21
0
void MyBOManager::DisplayReAlligned(String a_sName, vector3 a_v3Color)
{
	int nIndex = GetIndex(a_sName);
	DisplayReAlligned(nIndex, a_v3Color);
}
/*
 * 函数功能:完成字典压缩
 * 参数1:   文件指针
 * 返回值:  压缩后的二维数组,里面整个文件的索引 和每一列的样本值 
 * */
void * Dictionary_Compress(FILE * fp)
{

	if(!fp)
		return (void *)ERRO ;
	struct DF * df =NULL;

	Byte ** map=NULL ;
	int i =0 ;

	char list[COLUMN_LEN][STRING_MAX]={'\0'};
	char line[LINE_MAX]={0};
	int data =-1 ,index=0,tmp=0,size=0;
	int j = 0 ;

	df = (struct DF *)malloc(sizeof(struct DF));
	UpdateUsedMem(&DF_Mem,sizeof(struct DF));

	map= (Byte **)calloc(ROW_LEN , sizeof(Byte *));
	if(!map)
	{
		fprintf(OUTPUT,"%s\n",strerror(errno));
		return (void *)ERRO;
	}
	UpdateUsedMem(&DF_Mem,sizeof(struct Byte *)*ROW_LEN);

	for(i = 0 ; i < ROW_LEN ; i++)
	{
		
		/*reate a single column mem*/
		map[i] = (Byte *)calloc(COLUMN_LEN,sizeof(Byte));
		UpdateUsedMem(&DF_Mem,sizeof(Byte)*COLUMN_LEN);
		if(!map[i])
		{
			fprintf(OUTPUT,"%s\n",strerror(errno));
			return (void *)ERRO;
		}

		//make is column datas to dic as index samples 
		df->smp[i] = MakeSamle(fp,i);  

		index = 0 ;
		j=0 ;
		fseek(fp,0,SEEK_SET);
		while(fgets(line,LINE_MAX,fp)!=NULL)
		{
			if(line[0]=='\0')
				continue ;
			if(++index<=2)
				continue ;

			if(ROW_LEN!=cvs_parse(line,list,ROW_LEN))
			{
				fprintf(OUTPUT,"cvs_parse erro\n");
				return (void *)ERRO;
			}

			if(list[i][0]=='\0')
				continue ;
			if(0==sscanf(list[i],"%d",&data))
				continue ;
			tmp = GetIndex(df->smp[i],data);
			map[i][j++]=(Byte)(tmp&0xFF);

		}
	}
	df->pm=map ;
	return (void *)df;
}
Пример #23
0
void
Written_Reference::WrittenScalars(set<string>* __written){
if(GetIndex()->GetSize()==0)
        __written->insert(GetName());
}
Пример #24
0
void
Written_Reference::TagIndex(int __stmt, vector<Expression*>* __iter){
GetIndex()->Instanciate(__stmt,__iter);
}
Пример #25
0
BOOLEAN	 WrapString( INT16 *pStr, INT16 *pStr2, UINT16 usWidth, INT32 uiFont )
{
	UINT32 Cur, uiLet, uiNewLet, uiHyphenLet;
	UINT16 *curletter,transletter;
	BOOLEAN	fLineSplit = FALSE;
	HVOBJECT	hFont;

	// CHECK FOR WRAP					
	Cur=0;
	uiLet = 0;
	curletter=pStr;

	// GET FONT
	hFont = GetFontObject( uiFont );

	// LOOP FORWARDS AND COUNT
	while((*curletter)!=0)
	{
		transletter=GetIndex(*curletter);
		Cur+=GetWidth( hFont, transletter );

		if ( Cur > usWidth )
		{
			// We are here, loop backwards to find a space
			// Generate second string, and exit upon completion.
			uiHyphenLet = uiLet;	//Save the hyphen location as it won't change.
			uiNewLet = uiLet;
			while((*curletter)!=0)
			{
				if ( (*curletter) == 32 )
				{
					 // Split Line!
					 fLineSplit = TRUE;

					 pStr[ uiNewLet ] = (INT16)'\0';

					 wcscpy( pStr2, &(pStr[ uiNewLet + 1 ]) );
				}

				if ( fLineSplit )
					break;

				uiNewLet--;
				curletter--;
						
			}
			if( !fLineSplit)
			{
				//We completed the check for a space, but failed, so use the hyphen method.
				swprintf( pStr2, L"-%s", &(pStr[uiHyphenLet]) );
				pStr[uiHyphenLet] = (INT16)'/0';
				fLineSplit = TRUE;  //hyphen method
				break;
			}
		}

//		if ( fLineSplit )
//			break;

		uiLet++;
		curletter++;
	}

	return( fLineSplit );

}
Пример #26
0
bool FAudioDeviceManager::ShutdownAudioDevice(uint32 Handle)
{
	if (!IsValidAudioDeviceHandle(Handle))
	{
		return false;
	}

	check(NumActiveAudioDevices > 0);
	--NumActiveAudioDevices;

	// If there are more than 1 device active, check to see if this handle is the main audio device handle
	if (NumActiveAudioDevices >= 1)
	{
		uint32 MainDeviceHandle = GEngine->GetAudioDeviceHandle();

		if (NumActiveAudioDevices == 1)
		{
			// If we only have one audio device left, then set the active
			// audio device to be the main audio device
			SetActiveDevice(MainDeviceHandle);
		}

		// If this is the main device handle and there's more than one reference to the main device, 
		// don't shut it down until it's the very last handle to get shut down
		// this is because it's possible for some PIE sessions to be using the main audio device as a fallback to 
		// preserve CPU performance on low-performance machines
		if (NumWorldsUsingMainAudioDevice > 0 && MainDeviceHandle == Handle)
		{
			--NumWorldsUsingMainAudioDevice;

			return true;
		}
	}

	uint32 Index = GetIndex(Handle);
	uint8 Generation = GetGeneration(Handle);

	check(int32(Index) < Generations.Num());

	// Bump up the generation at the given index. This will invalidate
	// the handle without needing to broadcast to everybody who might be using the handle
	Generations[Index] = ++Generation;

	// Make sure we have a non-null device ptr in the index slot, then delete it
	FAudioDevice* AudioDevice = Devices[Index];
	check(AudioDevice != nullptr);

    // Tear down the audio device
	AudioDevice->Teardown();

	delete AudioDevice;

	// Nullify the audio device slot for future audio device creations
	Devices[Index] = nullptr;

	// Add this index to the list of free indices
	++FreeIndicesSize;
	FreeIndices.Enqueue(Index);

	return true;
}
Пример #27
0
Bot *BotControl::GetBot (edict_t *ent)
{
   // same as above, but using bot entity

   return GetBot (GetIndex (ent));
}
Пример #28
0
const CVector3DF &CBezierPatch::GetPoint(int a, int b) const
{
    return m_aAdditionalPoints[GetIndex(a,b)];
}
Пример #29
0
const CVector3DF &CBezierPatch::GetPoint(QVector2D bar) const
{
    return m_aAdditionalPoints[GetIndex(bar.x(),bar.y())];
}
Пример #30
0
void mitk::pa::Volume::SetData(double data, unsigned int x, unsigned int y, unsigned int z)
{
  m_FastAccessDataPointer[GetIndex(x, y, z)] = data;
}