summaryrefslogtreecommitdiffstats
path: root/src/languages/asmparser.h
blob: ab2183771f5f4cfb20d35cbe4011b694475d641e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/***************************************************************************
 *   Copyright (C) 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 ASMPARSER_H
#define ASMPARSER_H

#include <qstring.h>

class GpsimDebugger;

/**
Reads in an assembly file, and extracts useful information from it, such as the
PIC ID

@author David Saxton
*/
class AsmParser
{
	public:
		AsmParser( const QString &url );
		~AsmParser();
		
		enum Type { Relocatable, Absolute };
		
		/**
		 * Read in data from file, return success status.
		 * @param debugger if this is non-null, then source-line markers read
		 * from the assembly file (such as those beginning with ";#CSRC" will be
		 * passed to hllDebugger).
		 */
		bool parse( GpsimDebugger * debugger = 0l );
		/**
		 * Returns the PIC ID
		 */
		QString picID() const { return m_picID; }
		/**
		 * Returns whether or not the assembly file contained the "set radix"
		 * directive
		 */
		bool containsRadix() const { return m_bContainsRadix; }
		/**
		 * If the assembly file contains any of several key words that identify
		 * it as a relocatable object, then this will return Relocatable.
		 */
		Type type() const { return m_type; }
		
	protected:
		const QString m_url;
		QString m_picID;
		bool m_bContainsRadix;
		Type m_type;
};

#endif