2015-12-01 16:24:51 +00:00
|
|
|
#ifndef APPLESOFTFILE_H
|
|
|
|
#define APPLESOFTFILE_H
|
|
|
|
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QMap>
|
2015-12-14 09:20:36 +00:00
|
|
|
#include <QVector>
|
2015-12-01 16:24:51 +00:00
|
|
|
|
|
|
|
#include "genericfile.h"
|
2015-12-14 09:20:36 +00:00
|
|
|
#include "applesofttoken.h"
|
2015-12-01 16:24:51 +00:00
|
|
|
|
|
|
|
struct ApplesoftLine {
|
2015-12-14 09:20:36 +00:00
|
|
|
qint16 address;
|
2015-12-01 16:24:51 +00:00
|
|
|
quint16 next_address;
|
|
|
|
quint16 linenum;
|
2015-12-14 09:20:36 +00:00
|
|
|
QVector<ApplesoftToken> tokens;
|
|
|
|
// QByteArray raw_tokens;
|
|
|
|
// QByteArray advanced_tokens;
|
2015-12-01 16:24:51 +00:00
|
|
|
QString detokenized_line;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ApplesoftFile : public GenericFile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ApplesoftFile(QByteArray data = QByteArray());
|
|
|
|
void setData(QByteArray data);
|
|
|
|
QByteArray extraData();
|
|
|
|
QList<ApplesoftLine> detokenized() { return m_detokenized; }
|
|
|
|
void list();
|
|
|
|
QStringList extraDataHexValues();
|
|
|
|
|
|
|
|
private:
|
2015-12-14 09:20:36 +00:00
|
|
|
QList<ApplesoftLine> detokenize(quint16 start_address = 0x0801);
|
2015-12-01 16:24:51 +00:00
|
|
|
|
|
|
|
int m_data_end;
|
|
|
|
quint16 m_length;
|
|
|
|
QList<ApplesoftLine> m_detokenized;
|
2015-12-14 09:20:36 +00:00
|
|
|
|
|
|
|
friend class Retokenizer;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Retokenizer {
|
|
|
|
public:
|
|
|
|
static void retokenize(ApplesoftLine &line);
|
|
|
|
private:
|
|
|
|
QByteArray retokenizePart(QByteArray part);
|
2015-12-01 16:24:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // APPLESOFTFILE_H
|