00001 /*************************************************************************** 00002 * Copyright (C) 2003-2005 by David Saxton * 00003 * david@bluehaze.org * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 ***************************************************************************/ 00010 00011 #ifndef ASMFORMATTER_H 00012 #define ASMFORMATTER_H 00013 00014 #include <qstringlist.h> 00015 00016 00018 00022 class InstructionParts 00023 { 00024 public: 00028 InstructionParts( QString line ); 00029 00030 QString label() const { return m_label; } 00031 QString operand() const { return m_operand; } 00032 QString operandData() const { return m_operandData; } 00033 QString comment() const { return m_comment; } 00034 00035 protected: 00036 QString m_label; 00037 QString m_operand; 00038 QString m_operandData; 00039 QString m_comment; 00040 }; 00041 00045 class AsmFormatter 00046 { 00047 public: 00048 AsmFormatter(); 00049 ~AsmFormatter(); 00050 00051 enum LineType 00052 { 00053 Equ, 00054 Instruction, // could include label 00055 Other, // eg comments, __config 00056 }; 00057 00058 QString tidyAsm( QStringList lines ); 00059 00060 static LineType lineType( QString line ); 00061 00062 protected: 00063 QString tidyInstruction( const QString & line ); 00064 QString tidyEqu( const QString & line ); 00069 static void pad( QString & text, int length ); 00070 00071 int m_indentAsmName; 00072 int m_indentAsmData; 00073 int m_indentEqu; 00074 int m_indentEquValue; 00075 int m_indentEquComment; 00076 int m_indentComment; 00077 }; 00078 00079 #endif
1.5.1