示例#1
0
void TLexer::Read() {
    char c;
    std::string value = "";
    while (true) {
        c = GetChar();
        if (FileEOF()) {
            break;
        }
        value += c;
        switch (c) {
            case 34: {
                ReadString(value);
                break;
            }

            case 39: {
                ReadSymbol(value);
                break;
            }

            case '.' : {
                FindToken(State_Point, value);
                break;
            }

            case '(': {
                FindToken(State_Lbkt,value);
                break;
            }

            case ')': {
                FindToken(State_Rbkt,value);
                break;
            }
            case '#': {
                ReadSharp(value);
                break;
            }
            default: {
                if (isspecial(c) || isalpha(c)) {
                    ReadIdent(value);
                } else if (isdigit(c)) {
                    ReadNumber(value);
                } else if (IsEndToken(c)) {
                    value.erase(value.size() - 1, value.size());
                }
                break;
            }
        }
    }
    value = "EOF";
    FindToken(State_EOF, value);
}
示例#2
0
bool MusBinInput::ReadNote( MusNote *note )
{
	ReadElementAttr( note );
	Read( &note->sil, 1 );
	Read( &note->val, 1 );
	// Add this for reading version 1 in version 2 because value of CUSTOS changed
	//if ( ( sil == _SIL ) && ( val == AX1_CUSTOS ) )
	//	-> custos
	Read( &note->inv_val, 1 );
	Read( &note->point, 1 );
	Read( &note->stop_rel, 1 );
	Read( &note->acc, 1 );
	Read( &note->accInvis, 1 );
	Read( &note->q_auto, 1 );
	Read( &note->queue, 1 );
	Read( &note->stacc, 1 );
	Read( &note->oblique, 1 );
	Read( &note->queue_lig, 1 );
	Read( &note->chord, 1 );
	Read( &note->fchord, 1 );
	Read( &note->lat, 1 );
	Read( &note->haste, 1 );
	unsigned char c;
	Read( &c, 1 );
	note->code = (unsigned short)c; // code deplace dans element, unsigned SHORT !!
	Read( &note->tetenot, 1 );
	Read( &note->typStac, 1 );
	
	char count;
	Read( &count, 1 );
	
	for ( int i = 0; i < count; i++ ) {
		MusSymbol *lyric = new MusSymbol();
		Read( &lyric->TYPE, 1 );
		ReadSymbol( lyric );
		lyric->m_note_ptr = note;				 		
		note->m_lyrics.Add( lyric );
	}
	
	return true;
}
示例#3
0
bool MusBinInput::ReadStaff( MusStaff *staff )
{
	unsigned int k;

	Read( &uint32, 4 );
	staff->nblement = wxUINT32_SWAP_ON_BE( uint32 );
	Read( &uint16, 2 );
	staff->voix = wxUINT16_SWAP_ON_BE( uint16 );
	Read( &uint16, 2 );
	staff->noGrp = wxUINT16_SWAP_ON_BE( uint16 );
	Read( &uint16, 2 );
	staff->totGrp = wxUINT16_SWAP_ON_BE( uint16 );
	Read( &uint16, 2 );
	staff->noLigne = wxUINT16_SWAP_ON_BE( uint16 );
	Read( &uint16, 2 );
	staff->no = wxUINT16_SWAP_ON_BE( uint16 );
	Read( &staff->armTyp, 1 );
	Read( &staff->armNbr, 1 );
	Read( &staff->notAnc, 1 );
	//staff->notAnc = true;// force notation ancienne
	Read( &staff->grise, 1 );
	Read( &staff->invisible, 1 );
	Read( &uint16, 2 );
	staff->ecart = wxUINT16_SWAP_ON_BE( uint16 );
	Read( &staff->vertBarre, 1 );
	Read( &staff->brace, 1 );
	Read( &staff->pTaille, 1 );
    Read( &int32, 4 );
    staff->indent = wxINT32_SWAP_ON_BE( int32 );
	Read( &staff->indentDroite, 1 );
	Read( &staff->portNbLine, 1 );
	Read( &staff->accol, 1 );
	Read( &staff->accessoire, 1 );
	Read( &uint16, 2 );
	staff->reserve = wxUINT16_SWAP_ON_BE( uint16 );
	unsigned char c;
	for ( k = 0; k < staff->nblement; k++ )
	{
		Read( &c, 1 );
		if ( c == NOTE )
		{
			MusNote *note = new MusNote();
			note->no = k;
			ReadNote( note );
            
            /*
			//Test code
			if ( (int)note->m_lyrics.GetCount() == 0 ){
				MusSymbol *lyric = new MusSymbol();
				lyric->flag = CHAINE;
				lyric->fonte = LYRIC;
				lyric->m_debord_str = "z";
				lyric->xrel = note->xrel - 10;
				lyric->dec_y = - STAFF_OFFSET;   //Add define for height
				lyric->offset = note->offset;
				lyric->m_note_ptr = note;		
				note->m_lyrics.Add( lyric );	
				
				MusSymbol *lyric2 = new MusSymbol();
				lyric2->flag = CHAINE;
				lyric2->fonte = LYRIC;
				lyric2->m_debord_str = "d";
				lyric2->xrel = note->xrel;
				lyric2->dec_y = - STAFF_OFFSET;   //Add define for height
				lyric2->offset = note->offset;
				lyric2->m_note_ptr = note;
				note->m_lyrics.Add( lyric2 );
			}
            */
				 
			staff->m_elements.Add( note );
		}
		else if ( c == SYMB )
		{
			MusSymbol *symbol = new MusSymbol();
			symbol->no = k;
			ReadSymbol( symbol );
			staff->m_elements.Add( symbol );
		}
        else if ( c == NEUME )
		{
			MusNeume *neume = new MusNeume();
			ReadNeume( neume );
			staff->m_elements.Add(  neume );
		}
		if ( m_flag == MUS_BIN_ARUSPIX_CMP )
		{		
			MusElement *elem = &staff->m_elements.Last();
			Read( &int32, 4 );
			Read( elem->m_im_filename.GetWriteBuf( wxINT32_SWAP_ON_BE( int32 ) + 1 ) , wxINT32_SWAP_ON_BE( int32 ) + 1 );
			elem->m_im_filename.UngetWriteBuf();
			Read( &int32, 4 );
			elem->m_im_staff = wxINT32_SWAP_ON_BE( int32 );
			Read( &int32, 4 );
			elem->m_im_pos = wxINT32_SWAP_ON_BE( int32 );
			Read( &int32, 4 );
			elem->m_cmp_flag = wxINT32_SWAP_ON_BE( int32 );
		}
	}
			
	return true;
}