std::string normalizeInstructionsToHTML(std::vector<SgAsmX86Instruction*>::iterator beg, std::vector<SgAsmX86Instruction*>::iterator end) { string normalizedUnparsedInstructions; map<SgAsmExpression*, size_t> valueNumbers[3]; numberOperands( beg,end, valueNumbers); // Unparse the normalized forms of the instructions for (; beg != end; ++beg ) { SgAsmX86Instruction* insn = *beg; string mne = insn->get_mnemonic(); boost::to_lower(mne); mne = "<font color=\"red\">" + htmlEscape(mne)+"</font>"; normalizedUnparsedInstructions += mne; const SgAsmExpressionPtrList& operands = getOperands(insn); // Add to total for this variant // Add to total for each kind of operand size_t operandCount = operands.size(); normalizedUnparsedInstructions += "<font color=\"blue\">"; for (size_t i = 0; i < operandCount; ++i) { SgAsmExpression* operand = operands[i]; ExpressionCategory cat = getCategory(operand); map<SgAsmExpression*, size_t>::const_iterator numIter = valueNumbers[(int)cat].find(operand); assert (numIter != valueNumbers[(int)cat].end()); size_t num = numIter->second; normalizedUnparsedInstructions += (cat == ec_reg ? " R" : cat == ec_mem ? " M" : " V") + boost::lexical_cast<string>(num); } normalizedUnparsedInstructions += "; </font> <br> "; } return normalizedUnparsedInstructions; };