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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/***************************************************************************
* Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.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 DISASSEMBLER_H
#define DISASSEMBLER_H
#include "common/common/purl_base.h"
#include "devices/pic/base/pic_config.h"
namespace Device { class Data; class Memory; }
namespace Pic { class Data; class Memory; }
//-----------------------------------------------------------------------------
namespace SourceLine
{
enum Type { Indented, NotIndented, Title, Separator, Empty };
class Data {
public:
Data(Type _type = Empty, const QString &_code = QString::null, const QString &_comment = QString::null)
: type(_type), code(_code), comment(_comment) {}
Type type;
QString code, comment;
};
class List : public QValueList<Data>
{
public:
List() {}
void appendSeparator() { append(Separator); }
void appendEmpty() { append(Empty); }
void appendTitle(const QString &text) { append(Data(Title, QString::null, text)); }
void appendIndentedCode(const QString &code, const QString &comment = QString::null) { append(Data(Indented, code, comment)); }
void appendNotIndentedCode(const QString &code, const QString &comment = QString::null) { append(Data(NotIndented, code, comment)); }
};
extern QString comment(PURL::SourceFamily family, const QString &text);
extern QStringList lines(PURL::SourceFamily family, const List &list, uint nbSpaces);
extern QString text(PURL::SourceFamily family, const List &list, uint nbSpaces);
extern QString transformConfigName(const Pic::Data &data, uint wordIndex, const QString &name);
extern QStringList ignoredConfigNames(const Pic::Data &data, uint wordIndex);
extern QStringList extraConfigNames(const Pic::Data &data, uint wordIndex, const Pic::Config::Value &value);
extern QStringList configNames(Pic::ConfigNameType type, const Pic::Memory &memory, uint word, bool &ok);
} // namespace
//-----------------------------------------------------------------------------
namespace GPUtils
{
extern QString toDeviceName(const QString &device);
extern SourceLine::List includeLines(const Device::Data &data);
extern SourceLine::List generateConfigLines(const Pic::Memory &memory, bool &ok);
extern SourceLine::List disassemble(const Pic::Memory &memory);
} // namespace
//-----------------------------------------------------------------------------
namespace Tool
{
class SourceGenerator
{
public:
SourceGenerator() {}
virtual ~SourceGenerator() {}
virtual SourceLine::List configLines(PURL::ToolType type, const Device::Memory &memory, bool &ok) const = 0;
SourceLine::List templateSourceFile(PURL::ToolType type, const Device::Data &data, bool &ok) const;
virtual SourceLine::List sourceFileContent(PURL::ToolType type, const Device::Data &data, bool &ok) const = 0;
virtual SourceLine::List includeLines(PURL::ToolType type, const Device::Data &data) const = 0;
};
} // namespace
#endif
|