Пример #1
0
/*! \fn void Filter::Print()
 * \brief to write the filter features
 */
void Filter::Print()
{
  std::cerr << "The filter has the following features \n";
  PrintId();
  PrintHost();
  PrintPort();
}
Пример #2
0
static void PrintModules (const cc65_moduleinfo* M)
/* Output a list of modules */
{
    unsigned I;
    const cc65_moduledata* D;

    /* Modules */
    for (I = 0, D = M->data; I < M->count; ++I, ++D) {
        PrintId (D->module_id, 8);
        Print ("%-24s", D->module_name);
        PrintId (D->source_id, 8);
        PrintId (D->library_id, 9);
        PrintId (D->scope_id, 6);
        NewLine ();
    }
}
Пример #3
0
/*! \fn void Synchronizer::Print()
 * \brief to write the synchronizer features
 */
void Synchronizer::Print()
{
  std::cerr << "The synchronizer has the following features \n";
  PrintId();
  PrintHost();
  PrintPort();
}
Пример #4
0
static void PrintLines (const cc65_lineinfo* L)
/* Output a list of lines */
{
    unsigned I;
    const cc65_linedata* D;

    /* Lines */
    for (I = 0, D = L->data; I < L->count; ++I, ++D) {
        PrintId (D->line_id, 8);
        PrintId (D->source_id, 8);
        PrintNumber (D->source_line, 6, 9);
        PrintNumber (D->line_type, 4, 6);
        PrintNumber (D->count, 3, 0);
        NewLine ();
    }
}
Пример #5
0
/*! \fn void Module::Print()
 * \brief to write the module features
 */
void Module::Print()
{
  std::cerr << "The module has the following features \n";
  PrintId();
  PrintHost();
  PrintPort();
}
Пример #6
0
static void PrintSpans (const cc65_spaninfo* S)
/* Output a list of spans */
{
    unsigned I;
    const cc65_spandata* D;

    /* Segments */
    for (I = 0, D = S->data; I < S->count; ++I, ++D) {
        PrintId (D->span_id, 7);
        PrintAddr (D->span_start, 8);
        PrintAddr (D->span_end, 9);
        PrintId (D->segment_id, 7);
        PrintId (D->type_id, 6);
        PrintNumber (D->line_count, 6, 7);
        PrintNumber (D->scope_count, 7, 0);
        NewLine ();
    }
}
Пример #7
0
static void PrintScopes (const cc65_scopeinfo* S)
/* Output a list of scopes */
{
    unsigned I;
    const cc65_scopedata* D;

    /* Segments */
    for (I = 0, D = S->data; I < S->count; ++I, ++D) {
        PrintId (D->scope_id, 8);
        Print ("%-24s", D->scope_name);
        PrintNumber (D->scope_type, 4, 8);     /* ## */
        PrintSize (D->scope_size, 8);
        PrintId (D->parent_id, 8);
        PrintId (D->symbol_id, 8);
        PrintId (D->module_id, 0);
        NewLine ();
    }
}
Пример #8
0
/*! \fn void RoutingNode::Print()
 * \brief to write the RoutingNode features
 */
void RoutingNode::Print()
{
  std::cerr << "The routing node has the following features \n";
  PrintId();
  PrintHost();
  PrintSource();
  PrintPrevious();
  PrintType();
  PrintFull();
}
Пример #9
0
static void PrintCSymbols (const cc65_csyminfo* S)
/* Output a list of C symbols */
{
    unsigned I;
    const cc65_csymdata* D;

    /* Segments */
    for (I = 0, D = S->data; I < S->count; ++I, ++D) {
        PrintId (D->csym_id, 6);
        Print ("%-28s", D->csym_name);
        PrintId (D->type_id, 6);
        PrintNumber (D->csym_kind, 4, 6);
        PrintNumber (D->csym_sc, 4, 6);
        PrintNumber (D->csym_offs, 4, 8);
        PrintId (D->symbol_id, 6);
        PrintId (D->scope_id, 0);
        NewLine ();
    }
}
Пример #10
0
static void PrintSymbols (const cc65_symbolinfo* S)
/* Output a list of symbols */
{
    unsigned I;
    const cc65_symboldata* D;

    /* Segments */
    for (I = 0, D = S->data; I < S->count; ++I, ++D) {
        PrintId (D->symbol_id, 6);
        Print ("%-24s", D->symbol_name);
        PrintNumber (D->symbol_type, 4, 6);
        PrintNumber (D->symbol_size, 4, 6);
        PrintNumber (D->symbol_value, 5, 7);
        PrintId (D->export_id, 7);
        PrintId (D->segment_id, 6);
        PrintId (D->scope_id, 6);
        PrintId (D->parent_id, 0);
        NewLine ();
    }
}
Пример #11
0
static void PrintType (unsigned Id, const cc65_typedata* T)
/* Output one type */
{
    /* Output the id */
    PrintId (Id, 6);

    while (1) {
        switch (T->what) {

            case CC65_TYPE_VOID:
                Print ("VOID");
                goto ExitPoint;

            case CC65_TYPE_BYTE:
                Print ("BYTE");
                goto ExitPoint;

            case CC65_TYPE_WORD:
                Print ("WORD");
                goto ExitPoint;

            case CC65_TYPE_DBYTE:
                Print ("DBYTE");
                goto ExitPoint;

            case CC65_TYPE_DWORD:
                Print ("DWORD");
                goto ExitPoint;

            case CC65_TYPE_FARPTR:
                Print ("FAR ");
                /* FALLTHROUGH */

            case CC65_TYPE_PTR:
                Print ("POINTER TO ");
                T = T->data.ptr.ind_type;
                break;

            case CC65_TYPE_ARRAY:
                Print ("ARRAY[%u] OF ", T->data.array.ele_count);
                T = T->data.array.ele_type;
                break;

            default:
                /* Anything else is currently not implemented */
                Print ("***NOT IMPLEMENTED***");
                goto ExitPoint;
        }
    }

ExitPoint:
    NewLine ();
}
Пример #12
0
static void PrintLibraries (const cc65_libraryinfo* L)
/* Output a list of libraries */
{
    unsigned I;
    const cc65_librarydata* D;

    /* Libraries */
    for (I = 0, D = L->data; I < L->count; ++I, ++D) {
        PrintId (D->library_id, 8);
        Print ("%-24s", D->library_name);
        NewLine ();
    }
}
Пример #13
0
static void PrintSources (const cc65_sourceinfo* S)
/* Output a list of sources */
{
    unsigned I;
    const cc65_sourcedata* D;

    /* Segments */
    for (I = 0, D = S->data; I < S->count; ++I, ++D) {
        PrintId (D->source_id, 8);
        Print ("%-30s", D->source_name);
        PrintNumber (D->source_size, 7, 9);
        PrintTime (D->source_mtime, 0);
        NewLine ();
    }
}
Пример #14
0
//-------------------------------------------------------------------------
void CMaskWriterFasta::Print( objects::CBioseq_Handle& bsh,
                              const TMaskList & mask,
                              bool parsed_id )
{
    PrintId( bsh, parsed_id );
    os << endl;
    CSeqVector data = bsh.GetSeqVector(CBioseq_Handle::eCoding_Iupac);

    /// FIXME: this can be implemented as a call to CFastaOstream, which
    /// understands masking via a seq-loc

    // if( dest->GetIupacna().CanGet() )
    if( true )
    {
        string accumulator;
        TMaskList::const_iterator imask = mask.begin();

        for( TSeqPos i = 0; i < data.size(); ++i )
        {
            char letter = data[i];

            if( imask != mask.end() && i >= imask->first ) {
                if( i <= imask->second ) 
                    letter = tolower((unsigned char) letter);
                else
                {
                    ++imask;

                    if(    imask != mask.end() 
                        && i >= imask->first && i <= imask->second )
                        letter = tolower((unsigned char) letter);
                }
            }

            accumulator.append( 1, letter );

            if( !((i + 1)%60) )
            {
                os << accumulator << "\n";
                accumulator = "";
            }
        }

        if( accumulator.length() ) os << accumulator << "\n";
    }
}
Пример #15
0
static void PrintSegments (const cc65_segmentinfo* S)
/* Output a list of segments */
{
    unsigned I;
    const cc65_segmentdata* D;

    /* Segments */
    for (I = 0, D = S->data; I < S->count; ++I, ++D) {
        PrintId (D->segment_id, 8);
        Print ("%-16s", D->segment_name);
        PrintAddr (D->segment_start, 9);
        PrintSize (D->segment_size, 7);
        Print ("%-16s", D->output_name? D->output_name : "");
        PrintSize (D->output_offs, 6);
        NewLine ();
    }
}
Пример #16
0
void CAlnVecPrinter::PopsetStyle(int scrn_width,
                                 EAlgorithm algorithm)
{
    x_SetChars();

    switch(algorithm) {
    case eUseSeqString:
        {
            TSeqPos aln_len = m_AlnVec.GetAlnStop() + 1;
            const CAlnMap::TNumrow nrows = m_NumRows;
            const CAlnMap::TNumseg nsegs = m_AlnVec.GetNumSegs();
            const CDense_seg::TStarts& starts = m_AlnVec.GetDenseg().GetStarts();
            const CDense_seg::TLens& lens = m_AlnVec.GetDenseg().GetLens();
            
            vector<string> buffer(nrows);
            for (CAlnMap::TNumrow row = 0; row < nrows; row++) {
            
                // allocate space for the row
                buffer[row].reserve(aln_len + 1);
                string buff;
                
                int seg, pos, left_seg = -1, right_seg = -1;
                TSignedSeqPos start;
                TSeqPos len;
            
                // determine the ending right seg
                for (seg = nsegs - 1, pos = seg * nrows + row;
                     seg >= 0; --seg, pos -= nrows) {
                    if (starts[pos] >= 0) {
                        right_seg = seg;
                        break;
                    }
                }
            
                for (seg = 0, pos = row;  seg < nsegs; ++seg, pos += nrows) {
                    len = lens[seg];
                    if ((start = starts[pos]) >= 0) {
                    
                        left_seg = seg; // ending left seg is at most here
                    
                        m_AlnVec.GetSeqString(buff,
                                              row,
                                              start,
                                              start + len * m_AlnVec.GetWidth(row) - 1);
                        buffer[row] += buff;
                    } else {
                        // add appropriate number of gap/end chars
                        char* ch_buff = new char[len+1];
                        char fill_ch;
                        if (left_seg < 0  ||  seg > right_seg  &&  right_seg > 0) {
                            fill_ch = m_AlnVec.GetEndChar();
                        } else {
                            fill_ch = m_AlnVec.GetGapChar(row);
                        }
                        memset(ch_buff, fill_ch, len);
                        ch_buff[len] = 0;
                        buffer[row] += ch_buff;
                        delete[] ch_buff;
                    }
                }
            }
        
            TSeqPos pos = 0;
            do {
                for (CAlnMap::TNumrow row = 0; row < nrows; row++) {
                    PrintNumRow(row);
                    PrintId(row);
                    PrintSeqPos(m_AlnVec.GetSeqPosFromAlnPos(row, pos, CAlnMap::eLeft));
                    *m_Out << buffer[row].substr(pos, scrn_width)
                           << "  "
                           << m_AlnVec.GetSeqPosFromAlnPos(row, pos + scrn_width - 1,
                                                           CAlnMap::eLeft)
                           << endl;
                }
                *m_Out << endl;
                pos += scrn_width;
                if (pos + scrn_width > aln_len) {
                    scrn_width = aln_len - pos;
                }
            } while (pos < aln_len);
            break;
        }
    case eUseAlnSeqString:
        {
            TSeqPos aln_pos = 0;
            CAlnMap::TSignedRange rng;
            
            do {
                // create range
                rng.Set(aln_pos, aln_pos + scrn_width - 1);
                
                string aln_seq_str;
                aln_seq_str.reserve(scrn_width + 1);
                // for each sequence
                for (CAlnMap::TNumrow row = 0; row < m_NumRows; row++) {
                    PrintNumRow(row);
                    PrintId(row);
                    PrintSeqPos(m_AlnVec.GetSeqPosFromAlnPos(row, rng.GetFrom(),
                                                             CAlnMap::eLeft));
                    *m_Out << m_AlnVec.GetAlnSeqString(aln_seq_str, row, rng)
                           << " "
                           << m_AlnVec.GetSeqPosFromAlnPos(row, rng.GetTo(),
                                                           CAlnMap::eLeft)
                           << endl;
                }
                *m_Out << endl;
                aln_pos += scrn_width;
            } while (aln_pos < m_AlnVec.GetAlnStop());
            break;
        }
    case eUseWholeAlnSeqString:
        {
            CAlnMap::TNumrow row, nrows = m_NumRows;

            vector<string> buffer(nrows);
            vector<CAlnMap::TSeqPosList> insert_aln_starts(nrows);
            vector<CAlnMap::TSeqPosList> insert_starts(nrows);
            vector<CAlnMap::TSeqPosList> insert_lens(nrows);
            vector<CAlnMap::TSeqPosList> scrn_lefts(nrows);
            vector<CAlnMap::TSeqPosList> scrn_rights(nrows);
        
            // Fill in the vectors for each row
            for (row = 0; row < nrows; row++) {
                m_AlnVec.GetWholeAlnSeqString
                    (row,
                     buffer[row],
                     &insert_aln_starts[row],
                     &insert_starts[row],
                     &insert_lens[row],
                     scrn_width,
                     &scrn_lefts[row],
                     &scrn_rights[row]);
            }
        
            // Visualization
            TSeqPos pos = 0, aln_len = m_AlnVec.GetAlnStop() + 1;
            do {
                for (row = 0; row < nrows; row++) {
                    PrintNumRow(row);
                    PrintId(row);
                    PrintSeqPos(scrn_lefts[row].front());
                    *m_Out << buffer[row].substr(pos, scrn_width)
                           << " "
                           << scrn_rights[row].front()
                           << endl;
                    scrn_lefts[row].pop_front();
                    scrn_rights[row].pop_front();
                }
                *m_Out << endl;
                pos += scrn_width;
                if (pos + scrn_width > aln_len) {
                    scrn_width = aln_len - pos;
                }
            } while (pos < aln_len);

            break;
        }
    }
    x_UnsetChars();
}
Пример #17
0
void CAlnVecPrinter::ClustalStyle(int scrn_width,
                                  EAlgorithm algorithm)
{
    x_SetChars();

    *m_Out << "CLUSTAL W (1.83) multiple sequence alignment" << endl << endl;

    switch(algorithm) {
    case eUseSeqString:
        {
            TSeqPos aln_len = m_AlnVec.GetAlnStop() + 1;
            const CAlnMap::TNumseg nsegs = m_AlnVec.GetNumSegs();
            const CDense_seg::TStarts& starts = m_AlnVec.GetDenseg().GetStarts();
            const CDense_seg::TLens& lens = m_AlnVec.GetDenseg().GetLens();
            CAlnMap::TNumrow row;
            
            vector<string> buffer(m_NumRows+1);
            for (row = 0; row < m_NumRows; row++) {
            
                // allocate space for the row
                buffer[row].reserve(aln_len + 1);
                string buff;
                
                int seg, pos, left_seg = -1, right_seg = -1;
                TSignedSeqPos start;
                TSeqPos len;
            
                // determine the ending right seg
                for (seg = nsegs - 1, pos = seg * m_NumRows + row;
                     seg >= 0; --seg, pos -= m_NumRows) {
                    if (starts[pos] >= 0) {
                        right_seg = seg;
                        break;
                    }
                }
            
                for (seg = 0, pos = row;  seg < nsegs; ++seg, pos += m_NumRows) {
                    len = lens[seg];
                    if ((start = starts[pos]) >= 0) {
                    
                        left_seg = seg; // ending left seg is at most here
                    
                        m_AlnVec.GetSeqString(buff,
                                              row,
                                              start,
                                              start + len * m_AlnVec.GetWidth(row) - 1);
                        buffer[row] += buff;
                    } else {
                        // add appropriate number of gap/end chars
                        char* ch_buff = new char[len+1];
                        char fill_ch;
                        if (left_seg < 0  ||  seg > right_seg  &&  right_seg > 0) {
                            fill_ch = m_AlnVec.GetEndChar();
                        } else {
                            fill_ch = m_AlnVec.GetGapChar(row);
                        }
                        memset(ch_buff, fill_ch, len);
                        ch_buff[len] = 0;
                        buffer[row] += ch_buff;
                        delete[] ch_buff;
                    }
                }
            }
            // Find identities
            buffer[m_NumRows].resize(aln_len);
            for (TSeqPos pos = 0; pos < aln_len; pos++) {
                bool identity = true;
                char residue = buffer[0][pos];
                for (row = 1; row < m_NumRows; row++) {
                    if (buffer[row][pos] != residue) {
                        identity = false;
                        break;
                    }
                }
                buffer[m_NumRows][pos] = (identity ? '*' : ' ');
            }

        
            TSeqPos aln_pos = 0;
            do {
                for (CAlnMap::TNumrow row = 0; row < m_NumRows; row++) {
                    PrintId(row);
                    *m_Out << buffer[row].substr(aln_pos, scrn_width)
                           << endl;
                }
                m_Out->width(m_IdFieldLen);
                *m_Out << "";
                *m_Out << buffer[m_NumRows].substr(aln_pos, scrn_width)
                       << endl << endl;

                aln_pos += scrn_width;
                if (aln_pos + scrn_width > aln_len) {
                    scrn_width = aln_len - aln_pos;
                }
            } while (aln_pos < aln_len);
            break;
        }
    case eUseAlnSeqString:
        {
            TSeqPos aln_pos = 0;
            TSeqPos aln_stop = m_AlnVec.GetAlnStop();
            CAlnMap::TSignedRange rng;
            
            string identities_str;
            identities_str.reserve(scrn_width + 1);

            do {
                // create range
                rng.Set(aln_pos, min(aln_pos + scrn_width - 1, aln_stop));
                
                string aln_seq_str;
                aln_seq_str.reserve(scrn_width + 1);

                // for each sequence
                for (CAlnMap::TNumrow row = 0; row < m_NumRows; row++) {
                    PrintId(row);
                    *m_Out << m_AlnVec.GetAlnSeqString(aln_seq_str, row, rng)
                           << endl;

                    if (row == 0) {
                        identities_str = aln_seq_str;
                    } else {
                        for (size_t i = 0; i < aln_seq_str.length(); i++) {
                            if (aln_seq_str[i] != identities_str[i]) {
                                identities_str[i] = ' ';
                            }
                        }
                    }
                }
                for (size_t i = 0; i < identities_str.length(); i++) {
                    if (identities_str[i] != ' ') {
                        identities_str[i] = '*';
                    }
                }
                m_Out->width(m_IdFieldLen);
                *m_Out << "";
                *m_Out << identities_str
                       << endl << endl;
                aln_pos += scrn_width;
            } while (aln_pos < m_AlnVec.GetAlnStop());
            break;
        }
    case eUseWholeAlnSeqString:
        {
            CAlnMap::TNumrow row;

            vector<string> buffer(m_NumRows+1);
        
            // Fill in the vectors for each row
            for (row = 0; row < m_NumRows; row++) {
                m_AlnVec.GetWholeAlnSeqString(row, buffer[row]);
            }
        
            TSeqPos pos = 0;
            const TSeqPos aln_len = m_AlnVec.GetAlnStop() + 1;
            
            // Find identities
            buffer[m_NumRows].resize(aln_len);
            for (pos = 0; pos < aln_len; pos++) {
                bool identity = true;
                char residue = buffer[0][pos];
                for (row = 1; row < m_NumRows; row++) {
                    if (buffer[row][pos] != residue) {
                        identity = false;
                        break;
                    }
                }
                buffer[m_NumRows][pos] = (identity ? '*' : ' ');
            }


            // Visualization
            pos = 0;
            do {
                for (row = 0; row < m_NumRows; row++) {
                    PrintId(row);
                    *m_Out << buffer[row].substr(pos, scrn_width)
                        << endl;
                }
                m_Out->width(m_IdFieldLen);
                *m_Out << "";
                *m_Out << buffer[m_NumRows].substr(pos, scrn_width)
                       << endl << endl;
                
                pos += scrn_width;
                if (pos + scrn_width > aln_len) {
                    scrn_width = aln_len - pos;
                }
            } while (pos < aln_len);

            break;
        }
    }
    x_UnsetChars();
}
Пример #18
0
void FnIdGenerator::OnInput(wxCommandEvent &event)
{
	PrintId();
	event.Skip();
}