示例#1
0
QString SpimView::formatMemoryContents(mem_addr from, mem_addr to)
{
    mem_addr i = ROUND_UP(from, BYTES_PER_WORD);
    QString windowContents = formatPartialQuadWord(i, to);
    i = ROUND_UP(i, BYTES_PER_LINE); // Next quadword

    for ( ; i < to; )
    {
        mem_word val;

        /* Count consecutive zero words */
        int j;
        for (j = 0; (i + (uint32) j * BYTES_PER_WORD) < to; j += 1)
	{
            val = read_mem_word(i + (uint32) j * BYTES_PER_WORD);
            if (val != 0)
	    {
                break;
	    }
	}

        if (j >= 4)
	{
            /* Block of 4 or more zero memory words: */
            windowContents += QString("[") % formatAddress(i)
                % QString("]..[") % formatAddress(i + (uint32) j * BYTES_PER_WORD - 1)
                % QString("]") % nnbsp(2) % QString("00000000<br>");

            i = i + (uint32) j * BYTES_PER_WORD;
            windowContents += formatPartialQuadWord(i, to);
            i = ROUND_UP(i, BYTES_PER_LINE); // Next quadword
	}
        else
	{
            /* Fewer than 4 zero words, print them on a single line: */
            windowContents += QString("[") % formatAddress(i) % "]" % nnbsp(2);
            mem_addr j = i;
            do
	    {
                val = read_mem_word(i);
                windowContents += nnbsp(2) % formatWord(val, st_dataSegmentDisplayBase);
                i += BYTES_PER_WORD;
	    }
            while ((i % BYTES_PER_LINE) != 0 && i < to);

            windowContents += nnbsp(2) % formatAsChars(j, i) % QString("<br>");
	}
    }
    return windowContents;
}
示例#2
0
QString SpimView::formatPartialQuadWord(mem_addr from, mem_addr to)
{
    QString windowContents = QString("");

    if ((from % BYTES_PER_LINE) != 0 && from < to)
    {
        windowContents += QString("[") % formatAddress(from) % QString("]") % nnbsp(2);

        mem_addr a;
        for (a = from; (a % BYTES_PER_LINE) != 0; a += BYTES_PER_WORD)
	{
            mem_word val = read_mem_word(a);
            windowContents += nnbsp(2) % formatWord(val, st_dataSegmentDisplayBase);
	}

        windowContents += formatAsChars(from, a) % QString("<br>");
    }

    return windowContents;
}
示例#3
0
void WordsCount::count()
{
	ifstream file(m_sPathname.c_str());
	file.seekg(m_start, ios::beg);
	string str;


	while(file >> str && m_curr < m_end){

		if(str == "."
			&& str == ","
			&& str == " "
            ){
			continue;
		}

		str = formatWord(str);
		++m_wordsMap[str];
		m_curr += str.size();
	}

	file.close();
}
示例#4
0
void HelpFormatter::clearWord(std::ostream& ostr, int& pos, std::string& word, int indent) const
{
	formatWord(ostr, pos, word, indent);
	word.clear();
}