diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 |
commit | 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 (patch) | |
tree | bad482b7afa4cdf47422d60a5dd2c61c7e333b09 /src/asmformatter.h | |
download | ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.tar.gz ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.zip |
Added KDE3 version of ktechlab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/asmformatter.h')
-rw-r--r-- | src/asmformatter.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/asmformatter.h b/src/asmformatter.h new file mode 100644 index 0000000..a6fa361 --- /dev/null +++ b/src/asmformatter.h @@ -0,0 +1,76 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef ASMFORMATTER_H +#define ASMFORMATTER_H + +#include <qstringlist.h> + +/** +@author David Saxton + */ +class InstructionParts +{ + public: + /** + * Breaks up the line into parts. + */ + InstructionParts( QString line ); + + QString label() const { return m_label; } + QString operand() const { return m_operand; } + QString operandData() const { return m_operandData; } + QString comment() const { return m_comment; } + + protected: + QString m_label; + QString m_operand; + QString m_operandData; + QString m_comment; ///< includes the ";" part +}; + +/** +@author David Saxton +*/ +class AsmFormatter +{ + public: + AsmFormatter(); + ~AsmFormatter(); + + enum LineType + { + Equ, + Instruction, // could include label + Other, // eg comments, __config + }; + + QString tidyAsm( QStringList lines ); + + static LineType lineType( QString line ); + + protected: + QString tidyInstruction( const QString & line ); + QString tidyEqu( const QString & line ); + /** + * Appends spaces to the end of text until it is greater or equakl to + * length. + */ + static void pad( QString & text, int length ); + + int m_indentAsmName; + int m_indentAsmData; + int m_indentEqu; + int m_indentEquValue; + int m_indentEquComment; + int m_indentComment; +}; + +#endif |