コード例 #1
0
// ---------------------------------------------------------------------------
// Sets passed descriptor to data from internal buffer.
// Size and length of the data are read from the buffer.
// ---------------------------------------------------------------------------
//
void CPosReadBufStorage::GetL( TPtrC& aData ) 
  {
  TInt size, length;
  GetL( length );
  GetL( size );
  if ( size >= 0 && length >= 0 && size >= length && iPointer + size <= iBoundary ) 
    {
    aData.Set( (TUint16*) iPointer, length );
    iPointer += size;  
    }
  else
    {
    User::Leave( KErrCorrupt );
    }
  }
コード例 #2
0
ファイル: smplx_lp.cpp プロジェクト: davidlove/omrp
void SimplexLP::ShiftLowerBoundsToZero( void )
{
	//--------------------------------------------------------------------------
	//	Shift lower bounds to zero (where possible, i.e. where the lower bounds
	//	are finite. Adjust the finite upper bound on variable as well as the
	//	value of the objective function fixed adjustment accordingly.
	//
	Int_T i, nn = GetN(), len;
	Ptr<Real_T> a;
	Ptr<Int_T> row;

	for( i = 0; i < nn; i++ )
	{
		Real_T ll = GetL( i );
		Bool_T up = ( GetVarType( i ) & VT_HAS_LO_BND ) ? True : False;

		if( up && IsNonZero( ll ) )
		{
			for( MPS_LP::GetColumn( i, a, row, len ); len; --len, ++a, ++row )
				b[ *row ] -= *a * ll;

			if( up ) u[i] -= ll;

			f += GetC( i ) * ll;
		}
	}
}
コード例 #3
0
ファイル: TESTIMG.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
  Auxiliary Function for T-CoGridStep-RunTestStepL.\n
  @return Width of the text in pixels contained in the grid cell.\n
*/
TInt CTestCellImg::DataWidthInPixelsL(const TCellRef& aCell) const
	{
	const TDesC* des=GetL(aCell.iRow,aCell.iCol);
	if (des!=NULL)
		return iFont->TextWidthInPixels(*des);
	return 0;
	}
コード例 #4
0
ファイル: TESTIMG.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
  Auxiliary Function for T-CoGridStep-RunTestStepL.\n
  Draw function for the grid cell and the data contained in the cell.\n
  Calculates the effective rectange and sets the brush style and colour.\n
  Redraws the text in the grid cell .\n
*/
void CTestCellImg::DrawL(CGraphicsContext* aGc,const TCellRef& aCell,const TRect& aRect,const TRect& aClipRect) const
	{
	TInt offset = aRect.Height()-iFont->DescentInPixels();
	TRect effectiveRect=aRect;
	effectiveRect.iTl.iX-=BurstLeft();
	effectiveRect.iBr.iX+=BurstRight();
	aGc->UseFont(iFont);
	aGc->SetPenColor(iGridColors.iForeground);
	TRect realClipRect=aRect;
	realClipRect.Grow(1,1);
	realClipRect.Intersection(effectiveRect);
	realClipRect.Intersection(aClipRect);
	aGc->SetClippingRect(realClipRect);
	aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc->SetBrushColor(iGridColors.iBackground);
	const TDesC* des=GetL(aCell.iRow,aCell.iCol-BurstColOffset());
	if (des)
		aGc->DrawText(*des,effectiveRect,offset,CGraphicsContext::ELeft);
	else
		{
		aGc->SetPenStyle(CGraphicsContext::ENullPen);
		aGc->DrawRect(effectiveRect);
		}
	aGc->CancelClippingRect();
	aGc->Reset();
	}
コード例 #5
0
// ---------------------------------------------------------------------------
// Copies descriptor from internal buffer to aData buffer.
// Size of the data to be copied is read from the buffer.
// Leaves if target descriptor cannot accept descriptor in buffer.
// ---------------------------------------------------------------------------
//
void CPosReadBufStorage::GetL( TDes8& aData ) 
  {
  TInt size;
  GetL( size );
  if ( size >= 0 && 
     aData.MaxSize() >= size &&
     iPointer + size <= iBoundary ) 
    {
    aData = TPtrC8( (TUint8*) iPointer, size );
    iPointer += size;
    }
  else
    {
    User::Leave( KErrCorrupt );
    }
  }
コード例 #6
0
ファイル: aica.cpp プロジェクト: AndroidGX/reicast-emulator
void update_arm_interrupts()
{
	u32 p_ints=SCIEB->full & SCIPD->full;

	u32 Lval=0;
	if (p_ints)
	{
		u32 bit_value=1;//first bit
		//scan all interrupts , lo to hi bit.I assume low bit ints have higher priority over others
		for (u32 i=0;i<11;i++)
		{
			if (p_ints & bit_value)
			{
				//for the first one , Set the L reg & exit
				Lval=GetL(i);
				break;
			}
			bit_value<<=1; //next bit
		}
	}

	libARM_InterruptChange(p_ints,Lval);
}
コード例 #7
0
ファイル: smplx_lp.cpp プロジェクト: davidlove/omrp
void SimplexLP::UndoStandard( void )
{
	//--------------------------------------------------------------------------
	//	Restore the original positions of the lower bounds.
	//
	Int_T i, len;
	Ptr<Real_T> a;
	Ptr<Int_T> row;

	for( i = 0; i < n; i++ )
	{
		Real_T ll = GetL( i );
		Bool_T up = ( GetVarType( i ) & VT_HAS_LO_BND ) ? True : False;

		if( up && IsNonZero( ll ) )
		{
			for( MPS_LP::GetColumn( i, a, row, len ); len; --len, ++a, ++row )
				b[ *row ] += *a * ll;

			if( up ) u[i] += ll;
		}
	}
}
コード例 #8
0
//
// Constructor
//
State::State(std::string const & name) : m_name(name)
{
    std::int32_t ee, nn;
    char ll;

    //assert(name.empty());
    BOOST_ASSERT(!name.empty());
    if (std::sscanf(name.c_str(), "%d%c%d", &nn, &ll, &ee) == EOF)
    {
        throw std::invalid_argument("name (str) is incorrect!");
    }

    // printf("nn = %d, ll = %c, ee = %d\n", nn, ll, ee);

    m_l = GetL(ll);
    //m_n = static_cast<size_t>(nn - m_l - 1);
    m_n = boost::numeric_cast<std::size_t>(nn - m_l - 1);
    m_eigVal = 0.0;
    auto const occ = boost::numeric_cast<std::size_t>(ee);
    m_occ = static_cast<std::size_t>(ee);

    // printf("name = %s, n = %lu, l = %lu, occ = %lu\n", name, (unsigned long)m_n, (unsigned long)m_l, (unsigned long)m_occ);
    // fflush(stdout);
}
コード例 #9
0
// ---------------------------------------------------------------------------
// rename a media object
// ---------------------------------------------------------------------------
//
void CMPXCollectionHelperImp::RenameL( const TDesC& aOldUri,
                                       const TDesC& aNewUri,
                                       TMPXGeneralCategory aItemCat )
    {
    MPX_FUNC("CMPXCollectionHelperImp::RenameL");
    MPX_DEBUG3("aOldUri = %S, aNewUri = %S", &aOldUri, &aNewUri);

    if (aItemCat != EMPXSong && aItemCat != EMPXPlaylist && aItemCat != EMPXAbstractAlbum)
        {
        User::Leave(KErrArgument);
        }

    // find the media using the old URI
    RArray<TMPXAttribute> attributes;
    CleanupClosePushL( attributes );
    attributes.AppendL(KMPXMediaGeneralId);
    attributes.AppendL(KMPXMediaMusicAlbumArtFileName);

    CMPXMedia* media = GetL(aOldUri, attributes.Array(), aItemCat);
    CleanupStack::PopAndDestroy(&attributes);
    CleanupStack::PushL(media);

    const TDesC& fileName(media->ValueText(KMPXMediaMusicAlbumArtFileName));
    
    // the songs have embedded albumart.
    if(fileName.CompareF(aOldUri) == 0)
        {
        // change the Art filename to the new Uri
        media->SetTextValueL(KMPXMediaMusicAlbumArtFileName, aNewUri);
        
        // Rename the thumbnail
        TRAPD(err, RenameThumbnailL(aOldUri, aNewUri));
        if(KErrNone != err)
            {
            MPX_DEBUG2("Thumbnail renames failed. Err: %d", err);
            }
        }

    // change file path to the new file path
    media->SetTextValueL(KMPXMediaGeneralUri, aNewUri);

    // ask harvester to rename the file if any of the following is true:
    // 1) renaming a song
    // 2) renaming a playlist scanned through file system.
    //
    //    There are 3 types of playlists. The ones created from the device
    //    are virtual playlists which have file extension .vir. There are
    //    no physical playlist files associated with them; hence not
    //    registered with harvester. For virtual playlists, IsPlaylistL
    //    will return EFalse because there is not a playlist plugin that
    //    deals with .vir playlist files.
    //
    //    The ones synced from PC through MTP have file extension .pla.
    //    There are 0-byte .pla files associated with them but they
    //    are not registered with harvester either. IsPlaylistL will also
    //    return EFalse because there is not a playlist plugin that deals
    //    with .pla.
    //
    //    The 3rd type of playlists is .m3u on the file system. They are
    //    added to the collection through file scan and registered with
    //    harvester. IsPlaylistL will return ETrue.
    if (aItemCat == EMPXSong || iHvsUtility->IsPlaylistL(aOldUri))
        {
        const TUid& collection =
             media->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId);
        iHvsUtility->RenameFileL( aOldUri, aNewUri, collection.iUid );
        }

    // Update collection via CMPXCommand
    //
    CMPXCommand* cmd = CMPXCommand::NewL();
    CleanupStack::PushL( cmd );
    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
    TUid colId (media->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) );
    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
    cmd->SetCObjectValueL( KMPXCommandColSetMedia, media );
    iCollectionUtil->Collection().CommandL( *cmd );
    CleanupStack::PopAndDestroy( cmd );

    CleanupStack::PopAndDestroy(media);
    }
コード例 #10
0
ファイル: TESTIMG.CPP プロジェクト: cdaffara/symbiandump-mw1
/**
  Auxiliary Function for T-CoGridStep-RunTestStepL.\n
  @return Boolean,True if the grid cell contains data else False.\n

*/
TBool CTestCellImg::DoesCellContainDataL(const TCellRef& aCell) const
	{
	const TDesC* des=GetL(aCell.iRow,aCell.iCol);
	return des!=NULL;
	}
コード例 #11
0
///////////////////////////////////////////////////////////////////////////////
// GetHangulCharCluster
//
// The return value is the number of chars eaten; clusterSize is the number of 
// chars generated. In the large majority of cases, they will be equal.
//
eastl_size_t Typesetter::GetHangulCharCluster(eastl_size_t i, eastl_size_t iCharEnd, 
                                              Char* pCharCluster, eastl_size_t& clusterSize, int& clusterType)
{
    EA_ASSERT((i < iCharEnd) && (iCharEnd <= mLineLayout.mCharArray.size()));

    bool         bCompose  = false;  // To do: Make this configurable, perhaps part of LayoutSettings.
    eastl_size_t charCount = 0;

    if(!bCompose) // If we leave the characters as-is and don't convert Jamo to composed syllables...
    {
        clusterType     = kHangulClusterTypeUnicode;
        pCharCluster[0] = mLineLayout.mCharArray[i];
        clusterSize     = 1;
        charCount       = 1;
    }
    else
    {
        clusterSize = 0;
        clusterType = kHangulClusterTypeJamo; // This might change below.

        for(const Char* p = &mLineLayout.mCharArray[i], *pEnd = &mLineLayout.mCharArray[iCharEnd]; 
            (p < pEnd) && (clusterSize < kMaxHangulCharClusterSize); ++p, ++charCount)
        {
            const Char c = *p;
            const bool bIsAnyHangul = (IsS(c) || IsJ(c) || IsTone(c));

            if(clusterSize != 0) // If this is not the first char in the cluster...
            {
                const Char cPrev = p[-1];

                // If the current character cannot combine with the previous character...
                // To consider: This should be a table lookup instead of a bunch of comparisons.
                if(!bIsAnyHangul ||
                ( IsT(cPrev) && IsL(c)) ||
                ( IsV(cPrev) && IsL(c)) ||
                ( IsT(cPrev) && IsV(c)) ||
                (!IsL(cPrev) && IsS(c)) ||
                    IsTone(cPrev))
                {
                    // We have a completed syllable.
                    break;
                }
            }

            if(!bIsAnyHangul) // If not any kind of Hangul (syllable, jamo, tone)...
            {
                // We have non-Hangul Unicode (e.g. Latin or simply a space chars).
                pCharCluster[clusterSize++] = c;
                ++charCount;
                clusterType = kHangulClusterTypeUnicode;
                break;
            }
            else if(IsS(c)) // If the char is a Hangul syllable...
            {
                // We break the Hangul syllable down to its Jamo components. 
                // We'll put them back together again in the next step of 
                // the shaping pipeline.
                pCharCluster[clusterSize++] = GetL(c);
                pCharCluster[clusterSize++] = GetV(c);

                if(HasT(c))
                    pCharCluster[clusterSize++] = GetT(c);
            }
            else if((clusterSize == 0) && IsTone(c)) // If char is an initial Hangul tone...
            {
                // We have a standalone tone.
                pCharCluster[clusterSize++] = c;
                ++charCount;
                clusterType = kHangulClusterTypeTone;
                break;
            }
            else
                pCharCluster[clusterSize++] = c; // Else we are working with individual Jamo symbols...
        }
    }

    EA_ASSERT_MESSAGE(clusterType != kHangulClusterTypeNone, "Typesetter::GetHangulCharCluster: Unknown cluster type.");
    EA_ASSERT((charCount > 0) && (clusterSize > 0));

    return charCount;
}
コード例 #12
0
// ---------------------------------------------------------------------------
// Copies TUint16 from internal buffer
// ---------------------------------------------------------------------------
//
void CPosReadBufStorage::GetL( TUint16& aData ) 
  {
  GetL( (TUint8*) &aData, sizeof( TUint16 ) );
  }