New IntBasic file viewer, various code clean up and bug fixes.

This commit is contained in:
Mark Long 2021-01-22 15:45:10 -06:00
parent e353df7232
commit a30eaec4c0
111 changed files with 19732 additions and 19546 deletions

View File

@ -1,143 +1,149 @@
QT += core gui printsupport
CONFIG += c++11
MOC_DIR = ./.build
UI_DIR = ./.build
OBJECTS_DIR = ./.build
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = AppleSAWS
TEMPLATE = app
INCLUDEPATH += src/
INCLUDEPATH += src/relocatablefile
INCLUDEPATH += src/diskfiles
INCLUDEPATH += src/diskfiles/dos33
INCLUDEPATH += src/util
INCLUDEPATH += src/applesoftfile
INCLUDEPATH += src/binaryfile
INCLUDEPATH += src/textfile
INCLUDEPATH += src/ui/viewers
INCLUDEPATH += src/imported
INCLUDEPATH += src/internals
INCLUDEPATH += src/ui/diskexplorer/
INCLUDEPATH += src/ui/widgets/
INCLUDEPATH += src/ui
DEFINES += WS_VIDEO
SOURCES += \
src/main.cpp \
src/diskfiles/dos33/diskfile.cxx \
src/diskfiles/dos33/sector.cxx \
src/diskfiles/dos33/vtoc.cxx \
src/diskfiles/dos33/catalogsector.cxx \
src/diskfiles/dos33/tracksectorlist.cxx \
src/diskfiles/dos33/filedescriptiveentry.cxx \
src/diskfiles/dos33/genericfile.cxx \
src/util/applestring.cxx \
src/applesoftfile/applesoftfile.cxx \
src/applesoftfile/applesofttoken.cxx \
src/applesoftfile/applesoftformatter.cxx \
src/binaryfile/disassembler.cxx \
src/binaryfile/binaryfile.cxx \
src/textfile/textfile.cxx \
src/ui/catalogwidget.cxx \
src/ui/viewers/hiresviewwidget.cxx \
src/ui/viewers/applesoftfileviewer.cxx \
src/ui/viewers/disassemblerviewer.cpp \
src/ui/viewers/hexdumpviewer.cpp \
src/ui/viewers/texthexdumpviewer.cpp \
src/ui/viewers/mazeviewer.cpp \
src/ui/viewers/charsetviewer.cpp \
src/internals/memory.cxx \
src/relocatablefile/relocatablefile.cxx \
src/binaryfile/binaryfilemetadata.cpp \
src/util/charset.cpp \
src/ui/widgets/characterwidget.cpp \
src/ui/viewers/applesoftfiledetailviewer.cpp \
src/ui/widgets/hexconverter.cpp \
src/ui/viewers/viewerbase.cpp \
src/ui/widgets/CharacterSetExplorer.cpp \
src/ui/widgets/HiresScreenWidget.cpp \
src/ui/widgets/DisassemblerMetadataDialog.cpp \
src/binaryfile/EntryPointModel.cpp \
src/ui/widgets/LocationInfoDialog.cpp \
src/binaryfile/EntryPoints.cpp \
src/binaryfile/AssemblerSymbols.cpp \
src/binaryfile/AssemblerSymbolModel.cpp \
src/ui/diskexplorer/DiskExplorer.cpp \
src/ui/diskexplorer/DiskExplorerMapWidget.cpp \
src/applesoftfile/ApplesoftRetokenizer.cpp \
src/internals/JumpLineManager.cpp \
src/ui/widgets/FlowLineTextBrowser.cpp
HEADERS += \
src/diskfiles/dos33/diskfile.h \
src/diskfiles/dos33/sector.h \
src/diskfiles/dos33/vtoc.h \
src/diskfiles/dos33/catalogsector.h \
src/diskfiles/dos33/tracksectorlist.h \
src/diskfiles/dos33/filedescriptiveentry.h \
src/diskfiles/dos33/genericfile.h \
src/util/util.h \
src/util/applestring.h \
src/applesoftfile/applesoftfile.h \
src/applesoftfile/applesofttoken.h \
src/binaryfile/disassembler.h \
src/binaryfile/binaryfile.h \
src/textfile/textfile.h \
src/ui/catalogwidget.h \
src/ui/viewers/hiresviewwidget.h \
src/ui/viewers/applesoftfileviewer.h \
src/applesoftfile/applesoftformatter.h \
src/applesoftfile/applesoftline.h \
src/internals/memory.h \
src/ui/viewers/disassemblerviewer.h \
src/ui/viewers/hexdumpviewer.h \
src/ui/viewers/texthexdumpviewer.h \
src/relocatablefile/relocatablefile.h \
src/ui/viewers/mazeviewer.h \
src/binaryfile/binaryfilemetadata.h \
src/ui/widgets/characterwidget.h \
src/util/charset.h \
src/ui/viewers/charsetviewer.h \
src/ui/viewers/applesoftfiledetailviewer.h \
src/ui/widgets/hexconverter.h \
src/ui/widgets/hrcgcontrolsinfo.h \
src/ui/viewers/viewerbase.h \
src/ui/viewers/fileviewerinterface.h \
src/ui/widgets/CharacterSetExplorer.h \
src/ui/widgets/HiresScreenWidget.h \
src/ui/widgets/DisassemblerMetadataDialog.h \
src/binaryfile/EntryPointModel.h \
src/ui/widgets/LocationInfoDialog.h \
src/binaryfile/EntryPoints.h \
src/binaryfile/AssemblerSymbols.h \
src/binaryfile/AssemblerSymbolModel.h \
src/binaryfile/MemoryUsageMap.h \
src/ui/diskexplorer/DiskExplorer.h \
src/ui/diskexplorer/DiskExplorerMapWidget.h \
src/applesoftfile/ApplesoftRetokenizer.h \
src/util/AppleColors.h \
src/internals/JumpLineManager.h \
src/ui/widgets/FlowLineTextBrowser.h \
src/ui/widgets/asciiinfodialog.h
FORMS += \
src/ui/catalogwidget.ui \
src/ui/viewers/applesoftfileviewer.ui \
src/ui/viewers/disassemblerviewer.ui \
src/ui/viewers/hexdumpviewer.ui \
src/ui/viewers/texthexdumpviewer.ui \
src/ui/viewers/applesoftfiledetailviewer.ui \
src/ui/widgets/hexconverter.ui \
src/ui/widgets/hrcgcontrolsinfo.ui \
src/ui/viewers/viewerbase.ui \
src/ui/widgets/CharacterSetExplorer.ui \
src/ui/widgets/DisassemblerMetadataDialog.ui \
src/ui/widgets/LocationInfoDialog.ui \
src/ui/widgets/asciiinfodialog.ui
QT += core gui printsupport
CONFIG += c++11
MOC_DIR = ./.build
UI_DIR = ./.build
OBJECTS_DIR = ./.build
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = AppleSAWS
TEMPLATE = app
INCLUDEPATH += src/
INCLUDEPATH += src/relocatablefile
INCLUDEPATH += src/diskfiles
INCLUDEPATH += src/diskfiles/dos33
INCLUDEPATH += src/util
INCLUDEPATH += src/applesoftfile
INCLUDEPATH += src/intbasic
INCLUDEPATH += src/binaryfile
INCLUDEPATH += src/textfile
INCLUDEPATH += src/ui/viewers
INCLUDEPATH += src/imported
INCLUDEPATH += src/internals
INCLUDEPATH += src/ui/diskexplorer/
INCLUDEPATH += src/ui/widgets/
INCLUDEPATH += src/ui
DEFINES += WS_VIDEO
SOURCES += \
src/intbasic/IntBasicFile.cxx \
src/main.cpp \
src/diskfiles/dos33/diskfile.cxx \
src/diskfiles/dos33/sector.cxx \
src/diskfiles/dos33/vtoc.cxx \
src/diskfiles/dos33/catalogsector.cxx \
src/diskfiles/dos33/tracksectorlist.cxx \
src/diskfiles/dos33/filedescriptiveentry.cxx \
src/diskfiles/dos33/genericfile.cxx \
src/ui/viewers/intbasicfileviewer.cxx \
src/util/applestring.cxx \
src/applesoftfile/applesoftfile.cxx \
src/applesoftfile/applesofttoken.cxx \
src/applesoftfile/applesoftformatter.cxx \
src/binaryfile/disassembler.cxx \
src/binaryfile/binaryfile.cxx \
src/textfile/textfile.cxx \
src/ui/catalogwidget.cxx \
src/ui/viewers/hiresviewwidget.cxx \
src/ui/viewers/applesoftfileviewer.cxx \
src/ui/viewers/disassemblerviewer.cpp \
src/ui/viewers/hexdumpviewer.cpp \
src/ui/viewers/texthexdumpviewer.cpp \
src/ui/viewers/mazeviewer.cpp \
src/ui/viewers/charsetviewer.cpp \
src/internals/memory.cxx \
src/relocatablefile/relocatablefile.cxx \
src/binaryfile/binaryfilemetadata.cpp \
src/util/charset.cpp \
src/ui/widgets/characterwidget.cpp \
src/ui/viewers/applesoftfiledetailviewer.cpp \
src/ui/widgets/hexconverter.cpp \
src/ui/viewers/viewerbase.cpp \
src/ui/widgets/CharacterSetExplorer.cpp \
src/ui/widgets/HiresScreenWidget.cpp \
src/ui/widgets/DisassemblerMetadataDialog.cpp \
src/binaryfile/EntryPointModel.cpp \
src/ui/widgets/LocationInfoDialog.cpp \
src/binaryfile/EntryPoints.cpp \
src/binaryfile/AssemblerSymbols.cpp \
src/binaryfile/AssemblerSymbolModel.cpp \
src/ui/diskexplorer/DiskExplorer.cpp \
src/ui/diskexplorer/DiskExplorerMapWidget.cpp \
src/applesoftfile/ApplesoftRetokenizer.cpp \
src/internals/JumpLineManager.cpp \
src/ui/widgets/FlowLineTextBrowser.cpp
HEADERS += \
src/diskfiles/dos33/diskfile.h \
src/diskfiles/dos33/sector.h \
src/diskfiles/dos33/vtoc.h \
src/diskfiles/dos33/catalogsector.h \
src/diskfiles/dos33/tracksectorlist.h \
src/diskfiles/dos33/filedescriptiveentry.h \
src/diskfiles/dos33/genericfile.h \
src/intbasic/IntBasicFile.h \
src/ui/viewers/intbasicfileviewer.h \
src/util/util.h \
src/util/applestring.h \
src/applesoftfile/applesoftfile.h \
src/applesoftfile/applesofttoken.h \
src/binaryfile/disassembler.h \
src/binaryfile/binaryfile.h \
src/textfile/textfile.h \
src/ui/catalogwidget.h \
src/ui/viewers/hiresviewwidget.h \
src/ui/viewers/applesoftfileviewer.h \
src/applesoftfile/applesoftformatter.h \
src/applesoftfile/applesoftline.h \
src/internals/memory.h \
src/ui/viewers/disassemblerviewer.h \
src/ui/viewers/hexdumpviewer.h \
src/ui/viewers/texthexdumpviewer.h \
src/relocatablefile/relocatablefile.h \
src/ui/viewers/mazeviewer.h \
src/binaryfile/binaryfilemetadata.h \
src/ui/widgets/characterwidget.h \
src/util/charset.h \
src/ui/viewers/charsetviewer.h \
src/ui/viewers/applesoftfiledetailviewer.h \
src/ui/widgets/hexconverter.h \
src/ui/widgets/hrcgcontrolsinfo.h \
src/ui/viewers/viewerbase.h \
src/ui/viewers/fileviewerinterface.h \
src/ui/widgets/CharacterSetExplorer.h \
src/ui/widgets/HiresScreenWidget.h \
src/ui/widgets/DisassemblerMetadataDialog.h \
src/binaryfile/EntryPointModel.h \
src/ui/widgets/LocationInfoDialog.h \
src/binaryfile/EntryPoints.h \
src/binaryfile/AssemblerSymbols.h \
src/binaryfile/AssemblerSymbolModel.h \
src/binaryfile/MemoryUsageMap.h \
src/ui/diskexplorer/DiskExplorer.h \
src/ui/diskexplorer/DiskExplorerMapWidget.h \
src/applesoftfile/ApplesoftRetokenizer.h \
src/util/AppleColors.h \
src/internals/JumpLineManager.h \
src/ui/widgets/FlowLineTextBrowser.h \
src/ui/widgets/asciiinfodialog.h
FORMS += \
src/ui/catalogwidget.ui \
src/ui/viewers/applesoftfileviewer.ui \
src/ui/viewers/disassemblerviewer.ui \
src/ui/viewers/hexdumpviewer.ui \
src/ui/viewers/intbasicfileviewer.ui \
src/ui/viewers/texthexdumpviewer.ui \
src/ui/viewers/applesoftfiledetailviewer.ui \
src/ui/widgets/hexconverter.ui \
src/ui/widgets/hrcgcontrolsinfo.ui \
src/ui/viewers/viewerbase.ui \
src/ui/widgets/CharacterSetExplorer.ui \
src/ui/widgets/DisassemblerMetadataDialog.ui \
src/ui/widgets/LocationInfoDialog.ui \
src/ui/widgets/asciiinfodialog.ui

44
LICENSE
View File

@ -1,22 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Mark D. Long
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The MIT License (MIT)
Copyright (c) 2015 Mark D. Long
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,42 +1,42 @@
# AppleSAWS
##Apple Software Analysis WorkShop
This is a toolkit for exploring DOS 3.3 disk contents. I started this because I had become interested in a game that I used to play a long time ago and I wanted to dig deeper into the internals of how it worked. Since it was a nice combination of a series of Applesoft and Binary files, I decided that a tool to help explore those types of things would be handy. Of course, I've ended up spending far more time writing the tool than I have actually exploring the game, but nonetheless, it's been a fun ongoing project.
This code is being developed using Qt5, with development work being done on Linux, but it should compile and run without problems on Windows and Mac.
Among other things, the app includes:
* Code that reads and parses DOS-format disk images at the disk-structure level. (It's just read-only for now, and ProDOS is on the horizon)
* An Applesoft parser/retokenizer/reformatter which can show code in its normal form or reindented on multiple lines with syntax highlighting, and can optionally show integers as hex values inline. The retokenizer creates new tokens for strings, variable names, numeric values, DATA payloads, REM remarks, and other things that are nice to have -- and sets the stage to create an analyzer for deeper processing of the code later on.
* A binary file processor with a flow-tracing disassembler, which can show hex dumps and disassembly of code and data blocks (it also temporarily has some common labels for well-known addresses hard-coded into the display, though dynamic labeling of symbols is in the works.) It can also display the relocation table for type-R relocatable files. It also displays a linear graph of jumps, subroutines, and branches!
* A Text file viewer.
* A graphics viewer which can show hires screen dumps as monochrome, with NTSC artifacts, or a hybrid mode where each pixel's natural color is shown in-place (with no white color blending.)
* An HRCG character set viewer and explorer
* Exporting files and graphics to the local filesystem (as either .txt or .png files, as appropriate)
* A disk explorer which allows viewing the disk at the sector level, exploring directory and VTOC structure, and more!
* (Though not useful to most) A maze viewer for the game which I was originally exploring (Datamost's *The Missing Ring*, by Terry Romine, 1982)
* Probably some other stuff I can't think of at the moment.
There is also a Hex/Decimal converter utility and some in-app documentation for HRCG control character codes. Mainly stuff that I found useful at the time I was writing it.
In the pipeline are some more useful features (as I get a chance):
* Syntax Highlighting **(Currently in progress!)**
* More low-level disk exploration tools (sector-level stuff, comparing DOS versions between disks, etc.)
* More analysis of Applesoft programs (Tracing flow control; determining unaccessable lines of code; finding addresses of PEEKS, POKES, CALLS, USRs, and &'s; determining "hidden" areas of memory stuffed between lines or after the end of the program itself)
* Processing and analysis of Integer Basic files
* Much more robust disassembly tools:
* Handling differences between 6502/65C02/65816 ops, as well as "undocumented" ops on the original 6502
* Automated detection of Code Segments vs Data Segments **(Currently in progress!)**
* Allowing user-defined labels for addresses **(Currently in progress!)**
* Shape table processing and viewing
* ProDOS support
* Modification/Writing disk images
* Lots of optimization and refactoring -- **(Ongoing)**
* Tools for processing DHGR graphics
* Introduction of project management, allowing annotation and documention of interconnectivity between files and disk image contents, as well as preferences of groups of default viewers to open for a given image or set of images **(In progress!)**
* Plenty of other stuff!
Anyway, if you take a look at it and think it's interesting, I'd love to hear some feedback.
![Screenshot](/image/AppleSAWS_screenshot.png)
# AppleSAWS
##Apple Software Analysis WorkShop
This is a toolkit for exploring DOS 3.3 disk contents. I started this because I had become interested in a game that I used to play a long time ago and I wanted to dig deeper into the internals of how it worked. Since it was a nice combination of a series of Applesoft and Binary files, I decided that a tool to help explore those types of things would be handy. Of course, I've ended up spending far more time writing the tool than I have actually exploring the game, but nonetheless, it's been a fun ongoing project.
This code is being developed using Qt5, with development work being done on Linux, but it should compile and run without problems on Windows and Mac.
Among other things, the app includes:
* Code that reads and parses DOS-format disk images at the disk-structure level. (It's just read-only for now, and ProDOS is on the horizon)
* An Applesoft parser/retokenizer/reformatter which can show code in its normal form or reindented on multiple lines with syntax highlighting, and can optionally show integers as hex values inline. The retokenizer creates new tokens for strings, variable names, numeric values, DATA payloads, REM remarks, and other things that are nice to have -- and sets the stage to create an analyzer for deeper processing of the code later on.
* A binary file processor with a flow-tracing disassembler, which can show hex dumps and disassembly of code and data blocks (it also temporarily has some common labels for well-known addresses hard-coded into the display, though dynamic labeling of symbols is in the works.) It can also display the relocation table for type-R relocatable files. It also displays a linear graph of jumps, subroutines, and branches!
* A Text file viewer.
* A graphics viewer which can show hires screen dumps as monochrome, with NTSC artifacts, or a hybrid mode where each pixel's natural color is shown in-place (with no white color blending.)
* An HRCG character set viewer and explorer
* Exporting files and graphics to the local filesystem (as either .txt or .png files, as appropriate)
* A disk explorer which allows viewing the disk at the sector level, exploring directory and VTOC structure, and more!
* (Though not useful to most) A maze viewer for the game which I was originally exploring (Datamost's *The Missing Ring*, by Terry Romine, 1982)
* Probably some other stuff I can't think of at the moment.
There is also a Hex/Decimal converter utility and some in-app documentation for HRCG control character codes. Mainly stuff that I found useful at the time I was writing it.
In the pipeline are some more useful features (as I get a chance):
* Syntax Highlighting **(Currently in progress!)**
* More low-level disk exploration tools (sector-level stuff, comparing DOS versions between disks, etc.)
* More analysis of Applesoft programs (Tracing flow control; determining unaccessable lines of code; finding addresses of PEEKS, POKES, CALLS, USRs, and &'s; determining "hidden" areas of memory stuffed between lines or after the end of the program itself)
* Processing and analysis of Integer Basic files
* Much more robust disassembly tools:
* Handling differences between 6502/65C02/65816 ops, as well as "undocumented" ops on the original 6502
* Automated detection of Code Segments vs Data Segments **(Currently in progress!)**
* Allowing user-defined labels for addresses **(Currently in progress!)**
* Shape table processing and viewing
* ProDOS support
* Modification/Writing disk images
* Lots of optimization and refactoring -- **(Ongoing)**
* Tools for processing DHGR graphics
* Introduction of project management, allowing annotation and documention of interconnectivity between files and disk image contents, as well as preferences of groups of default viewers to open for a given image or set of images **(In progress!)**
* Plenty of other stuff!
Anyway, if you take a look at it and think it's interesting, I'd love to hear some feedback.
![Screenshot](/image/AppleSAWS_screenshot.png)

File diff suppressed because it is too large Load Diff

View File

@ -1,52 +1,52 @@
#ifndef APPLESOFTRETOKENIZER_H
#define APPLESOFTRETOKENIZER_H
#include "applesoftline.h"
#include <QByteArray>
#include <QVector>
#include <QList>
#include <QPair>
class ApplesoftRetokenizer
{
public:
ApplesoftRetokenizer();
void setData(QByteArray data);
void parse(quint16 start_address = 0x0801);
quint16 getEndOfDataOffset() const { return m_data_end; }
QVector<ApplesoftLine> getRetokenizedLines() { return m_retokenized_lines; }
QList<QPair<quint16, quint16> > getFlowTargets() const { return m_flowTargets; }
private:
void retokenizeLinesForFormatting();
void retokenizeLine(ApplesoftLine &line);
QList<ApplesoftToken> retokenizeRems(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeStrings(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeDataStatements(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeDataPayload(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeVariables(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeNumbers(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeNegativeNumbers(QList<ApplesoftToken> &datatokens);
QVector<ApplesoftLine> m_retokenized_lines;
QByteArray m_data;
quint16 m_data_end;
bool m_isParsed;
QList<QPair<quint16, quint16> > m_flowTargets;
};
#endif // APPLESOFTRETOKENIZER_H
#ifndef APPLESOFTRETOKENIZER_H
#define APPLESOFTRETOKENIZER_H
#include "applesoftline.h"
#include <QByteArray>
#include <QVector>
#include <QList>
#include <QPair>
class ApplesoftRetokenizer
{
public:
ApplesoftRetokenizer();
void setData(QByteArray data);
void parse(quint16 start_address = 0x0801);
quint16 getEndOfDataOffset() const { return m_data_end; }
QVector<ApplesoftLine> getRetokenizedLines() { return m_retokenized_lines; }
QList<QPair<quint16, quint16> > getFlowTargets() const { return m_flowTargets; }
private:
void retokenizeLinesForFormatting();
void retokenizeLine(ApplesoftLine &line);
QList<ApplesoftToken> retokenizeRems(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeStrings(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeDataStatements(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeDataPayload(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeVariables(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeNumbers(QList<ApplesoftToken> &datatokens);
QList<ApplesoftToken> retokenizeNegativeNumbers(QList<ApplesoftToken> &datatokens);
QVector<ApplesoftLine> m_retokenized_lines;
QByteArray m_data;
quint16 m_data_end;
bool m_isParsed;
QList<QPair<quint16, quint16> > m_flowTargets;
};
#endif // APPLESOFTRETOKENIZER_H

View File

@ -1,78 +1,78 @@
#include "applesoftfile.h"
#include "util.h"
#include <QDebug>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QRegularExpressionMatchIterator>
#include <QList>
ApplesoftFile::ApplesoftFile(QByteArray data) : GenericFile(data)
{
m_retokenizer = Q_NULLPTR;
m_data_end = data.length();
if (!data.isEmpty())
{
setData(data);
}
setAddress(0x801);
}
void ApplesoftFile::setData(QByteArray data)
{
if (!m_retokenizer)
{
m_retokenizer = new ApplesoftRetokenizer();
}
GenericFile::setData(data);
quint8 addlo = m_data.at(0);
quint8 addhi = m_data.at(1);
m_length = makeWord(addlo,addhi);
m_data.remove(0,2);
m_retokenizer->setData(m_data);
m_retokenizer->parse();
m_data_end = m_retokenizer->getEndOfDataOffset();
m_lines = m_retokenizer->getRetokenizedLines();
m_flowTargets = m_retokenizer->getFlowTargets();
}
QByteArray ApplesoftFile::rawData() {
QByteArray retval;
retval.append(m_length % 255);
retval.append(m_length / 255);
retval.append(m_data);
return retval;
}
QStringList ApplesoftFile::extraDataHexValues() {
QStringList retval;
QString debugline = "";
int count = 0;
foreach (quint8 val, extraData()) {
debugline.append(QString("%1").arg(val,2,16,QChar('0')).toUpper());
count++;
if (count == 16) {
retval.append(debugline);
debugline = "";
count = 0;
} else {
debugline.append(" ");
}
}
if (!debugline.simplified().isEmpty()) {
retval.append(debugline);
}
return retval;
}
QByteArray ApplesoftFile::extraData()
{
return m_data.mid(m_data_end);
}
#include "applesoftfile.h"
#include "util.h"
#include <QDebug>
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QRegularExpressionMatchIterator>
#include <QList>
ApplesoftFile::ApplesoftFile(QByteArray data) : GenericFile(data)
{
m_retokenizer = Q_NULLPTR;
m_data_end = data.length();
if (!data.isEmpty())
{
setData(data);
}
setAddress(0x801);
}
void ApplesoftFile::setData(QByteArray data)
{
if (!m_retokenizer)
{
m_retokenizer = new ApplesoftRetokenizer();
}
GenericFile::setData(data);
quint8 addlo = m_data.at(0);
quint8 addhi = m_data.at(1);
m_length = makeWord(addlo,addhi);
m_data.remove(0,2);
m_retokenizer->setData(m_data);
m_retokenizer->parse();
m_data_end = m_retokenizer->getEndOfDataOffset();
m_lines = m_retokenizer->getRetokenizedLines();
m_flowTargets = m_retokenizer->getFlowTargets();
}
QByteArray ApplesoftFile::rawData() {
QByteArray retval;
retval.append(m_length % 255);
retval.append(m_length / 255);
retval.append(m_data);
return retval;
}
QStringList ApplesoftFile::extraDataHexValues() {
QStringList retval;
QString debugline = "";
int count = 0;
foreach (quint8 val, extraData()) {
debugline.append(QString("%1").arg(val,2,16,QChar('0')).toUpper());
count++;
if (count == 16) {
retval.append(debugline);
debugline = "";
count = 0;
} else {
debugline.append(" ");
}
}
if (!debugline.simplified().isEmpty()) {
retval.append(debugline);
}
return retval;
}
QByteArray ApplesoftFile::extraData()
{
return m_data.mid(m_data_end);
}

View File

@ -1,43 +1,43 @@
#ifndef APPLESOFTFILE_H
#define APPLESOFTFILE_H
#include <QByteArray>
#include <QStringList>
#include <QMap>
#include <QVector>
#include "applesoftline.h"
#include "genericfile.h"
#include "applesofttoken.h"
#include "ApplesoftRetokenizer.h"
class ApplesoftFile : public GenericFile
{
public:
ApplesoftFile(QByteArray data = QByteArray());
void setData(QByteArray data);
QByteArray extraData();
QStringList extraDataHexValues();
QVector<ApplesoftLine> getLines() const { return m_lines; }
quint16 length() const { return m_length; }
QByteArray rawData();
private:
QVector<ApplesoftLine> m_lines;
int m_data_end;
quint16 m_length;
ApplesoftRetokenizer *m_retokenizer;
QList<QPair<quint16, quint16> > m_flowTargets;
};
#endif // APPLESOFTFILE_H
#ifndef APPLESOFTFILE_H
#define APPLESOFTFILE_H
#include <QByteArray>
#include <QStringList>
#include <QMap>
#include <QVector>
#include "applesoftline.h"
#include "genericfile.h"
#include "applesofttoken.h"
#include "ApplesoftRetokenizer.h"
class ApplesoftFile : public GenericFile
{
public:
ApplesoftFile(QByteArray data = QByteArray());
void setData(QByteArray data);
QByteArray extraData();
QStringList extraDataHexValues();
QVector<ApplesoftLine> getLines() const { return m_lines; }
quint16 length() const { return m_length; }
QByteArray rawData();
private:
QVector<ApplesoftLine> m_lines;
int m_data_end;
quint16 m_length;
ApplesoftRetokenizer *m_retokenizer;
QList<QPair<quint16, quint16> > m_flowTargets;
};
#endif // APPLESOFTFILE_H

View File

@ -1,174 +1,174 @@
#include "applesoftformatter.h"
#include "util.h"
#include <QTextCursor>
#include <QTextCharFormat>
#include <QChar>
#define HEXPREFIX "0x"
ApplesoftFormatter::ApplesoftFormatter(QObject *parent) :
QObject(parent)
{
m_file = Q_NULLPTR;
}
void ApplesoftFormatter::setFile(ApplesoftFile *file)
{
m_file = file;
emit newFile(file);
}
void ApplesoftFormatter::formatDocument(QTextDocument *doc)
{
if (!doc) return;
doc->clear();
QTextCursor cursor(doc);
cursor.beginEditBlock();
bool synhl = (m_format_options.testFlag(SyntaxHighlighting));
foreach (ApplesoftLine line, m_file->getLines())
{
QString linestring = QString("%1 ").arg(line.linenum,5,10,QChar(' '));
if (synhl)
{
cursor.insertText(linestring,
ApplesoftToken::textFormat(ApplesoftToken::LineNumberTokenVal));
}
else
{
cursor.insertText(linestring,ApplesoftToken::defaultTextFormat());
}
QVectorIterator<ApplesoftToken>tokenIt(line.tokens);
bool isBranchTarget = false;
while (tokenIt.hasNext())
{
ApplesoftToken token = tokenIt.next();
if (token.isOptFmtToken())
{
switch (token.getTokenId())
{
case ApplesoftToken::OptFmtFlagFlowTargetNextTokenValue:
{
if (m_format_options.testFlag(ShowIntsAsHex))
isBranchTarget = true;
break;
}
case ApplesoftToken::OptFmtIndentLineBreakTokenValue:
{
if (m_format_options.testFlag(ReindentCode))
cursor.insertBlock();
break;
}
case ApplesoftToken::OptFmtIndentSpaceTokenValue:
{
if (m_format_options.testFlag(ReindentCode))
cursor.insertText(" ",ApplesoftToken::defaultTextFormat());
break;
}
case ApplesoftToken::OptFmtIndentTabTokenValue:
{
if (m_format_options.testFlag(ReindentCode))
cursor.insertText(" ",ApplesoftToken::defaultTextFormat());
break;
}
case ApplesoftToken::OptFmtLeadingSpaceTokenValue:
{
cursor.insertText(" ",ApplesoftToken::defaultTextFormat());
break;
}
case ApplesoftToken::OptFmtReturnLineBreakTokenValue:
{
if (m_format_options.testFlag(BreakAfterReturn))
cursor.insertBlock();
break;
}
default:
{
break;
}
}
} // isOptFmt
else
{
QString tokenstr = token.getRawPrintableString();
QTextCharFormat fmt = ApplesoftToken::defaultTextFormat();
if (synhl) fmt = token.textFormat();
if (token.getTokenId() == ApplesoftToken::IntegerTokenVal)
{
if (m_format_options.testFlag(ShowIntsAsHex) && !isBranchTarget)
{
quint32 ui32val = token.getUnsignedIntegerValue();
qint32 i32val = token.getIntegerValue();
if ((i32val < 128 && i32val >= -128) || ui32val < 256)
{
quint8 ui8 = ui32val;
tokenstr = HEXPREFIX+uint8ToHex(ui8);
}
else if ((i32val < 32768 && i32val >= -32768) || ui32val < 65536)
{
quint16 ui16 = ui32val;
tokenstr = HEXPREFIX+uint16ToHex(ui16);
}
else
{
tokenstr = HEXPREFIX+uint32ToHex(ui32val);
}
} // isShowIntsAsHex
isBranchTarget = false;
}
// if (m_format_options.testFlag(ShowCtrlChars))
// {
// tokenstr.replace(QChar(0x7f),QChar(0x2401));
// for (int idx = 1; idx <= 0x1f; idx++) {
// if (idx == '\n') continue;
// tokenstr.replace(QChar(idx),QChar(idx+0x2400));
// }
// } // if ShowCtrlChars
QTextCharFormat invFormat = ApplesoftToken::defaultInverseTextFormat();
if (m_format_options.testFlag(SyntaxHighlighting))
invFormat = ApplesoftToken::textFormat(
ApplesoftToken::ControlCharTokenVal);
foreach (QChar ch, tokenstr)
{
if (ch == QChar(0x7f))
{
cursor.insertText(QChar(0x00d7),invFormat);
}
else if (ch < QChar(' '))
{
if (m_format_options.testFlag(ShowCtrlChars))
{
QChar newch = ch.unicode()+0x40;
cursor.insertText(newch,invFormat);
}
}
else cursor.insertText(ch,fmt);
}
}
} // while tokenIt.hasNext()
//formattedText.append("\n");
cursor.insertBlock();
} // foreach line
cursor.endEditBlock();
}
#include "applesoftformatter.h"
#include "util.h"
#include <QTextCursor>
#include <QTextCharFormat>
#include <QChar>
#define HEXPREFIX "0x"
ApplesoftFormatter::ApplesoftFormatter(QObject *parent) :
QObject(parent)
{
m_file = Q_NULLPTR;
}
void ApplesoftFormatter::setFile(ApplesoftFile *file)
{
m_file = file;
emit newFile(file);
}
void ApplesoftFormatter::formatDocument(QTextDocument *doc)
{
if (!doc) return;
doc->clear();
QTextCursor cursor(doc);
cursor.beginEditBlock();
bool synhl = (m_format_options.testFlag(SyntaxHighlighting));
foreach (ApplesoftLine line, m_file->getLines())
{
QString linestring = QString("%1 ").arg(line.linenum,5,10,QChar(' '));
if (synhl)
{
cursor.insertText(linestring,
ApplesoftToken::textFormat(ApplesoftToken::LineNumberTokenVal));
}
else
{
cursor.insertText(linestring,ApplesoftToken::defaultTextFormat());
}
QVectorIterator<ApplesoftToken>tokenIt(line.tokens);
bool isBranchTarget = false;
while (tokenIt.hasNext())
{
ApplesoftToken token = tokenIt.next();
if (token.isOptFmtToken())
{
switch (token.getTokenId())
{
case ApplesoftToken::OptFmtFlagFlowTargetNextTokenValue:
{
if (m_format_options.testFlag(ShowIntsAsHex))
isBranchTarget = true;
break;
}
case ApplesoftToken::OptFmtIndentLineBreakTokenValue:
{
if (m_format_options.testFlag(ReindentCode))
cursor.insertBlock();
break;
}
case ApplesoftToken::OptFmtIndentSpaceTokenValue:
{
if (m_format_options.testFlag(ReindentCode))
cursor.insertText(" ",ApplesoftToken::defaultTextFormat());
break;
}
case ApplesoftToken::OptFmtIndentTabTokenValue:
{
if (m_format_options.testFlag(ReindentCode))
cursor.insertText(" ",ApplesoftToken::defaultTextFormat());
break;
}
case ApplesoftToken::OptFmtLeadingSpaceTokenValue:
{
cursor.insertText(" ",ApplesoftToken::defaultTextFormat());
break;
}
case ApplesoftToken::OptFmtReturnLineBreakTokenValue:
{
if (m_format_options.testFlag(BreakAfterReturn))
cursor.insertBlock();
break;
}
default:
{
break;
}
}
} // isOptFmt
else
{
QString tokenstr = token.getRawPrintableString();
QTextCharFormat fmt = ApplesoftToken::defaultTextFormat();
if (synhl) fmt = token.textFormat();
if (token.getTokenId() == ApplesoftToken::IntegerTokenVal)
{
if (m_format_options.testFlag(ShowIntsAsHex) && !isBranchTarget)
{
quint32 ui32val = token.getUnsignedIntegerValue();
qint32 i32val = token.getIntegerValue();
if ((i32val < 128 && i32val >= -128) || ui32val < 256)
{
quint8 ui8 = ui32val;
tokenstr = HEXPREFIX+uint8ToHex(ui8);
}
else if ((i32val < 32768 && i32val >= -32768) || ui32val < 65536)
{
quint16 ui16 = ui32val;
tokenstr = HEXPREFIX+uint16ToHex(ui16);
}
else
{
tokenstr = HEXPREFIX+uint32ToHex(ui32val);
}
} // isShowIntsAsHex
isBranchTarget = false;
}
// if (m_format_options.testFlag(ShowCtrlChars))
// {
// tokenstr.replace(QChar(0x7f),QChar(0x2401));
// for (int idx = 1; idx <= 0x1f; idx++) {
// if (idx == '\n') continue;
// tokenstr.replace(QChar(idx),QChar(idx+0x2400));
// }
// } // if ShowCtrlChars
QTextCharFormat invFormat = ApplesoftToken::defaultInverseTextFormat();
if (m_format_options.testFlag(SyntaxHighlighting))
invFormat = ApplesoftToken::textFormat(
ApplesoftToken::ControlCharTokenVal);
foreach (QChar ch, tokenstr)
{
if (ch == QChar(0x7f))
{
cursor.insertText(QChar(0x00d7),invFormat);
}
else if (ch < QChar(' '))
{
if (m_format_options.testFlag(ShowCtrlChars))
{
QChar newch = ch.unicode()+0x40;
cursor.insertText(newch,invFormat);
}
}
else cursor.insertText(ch,fmt);
}
}
} // while tokenIt.hasNext()
//formattedText.append("\n");
cursor.insertBlock();
} // foreach line
cursor.endEditBlock();
}

View File

@ -1,53 +1,53 @@
#ifndef APPLESOFTFORMATTER_H
#define APPLESOFTFORMATTER_H
#include <QObject>
#include <QFlags>
#include <QTextDocument>
#include <QSharedPointer>
#include "applesoftfile.h"
class ApplesoftFormatter : public QObject
{
Q_OBJECT
public:
enum FormatOption {
NoOptions = 0x00,
SyntaxHighlighting = 0x01,
ShowCtrlChars = 0x02,
BreakAfterReturn = 0x04,
ReindentCode = 0x08,
ShowIntsAsHex = 0x10,
AllFlags = 0xffffffff
};
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
public:
explicit ApplesoftFormatter(QObject *parent = 0);
void setFlags(FormatOptions options) { m_format_options = options; }
void setFile(ApplesoftFile *file);
FormatOptions flags() { return m_format_options; }
void formatDocument(QTextDocument *doc);
signals:
void newFile(ApplesoftFile *file);
public slots:
private:
FormatOptions m_format_options;
ApplesoftFile *m_file;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(ApplesoftFormatter::FormatOptions)
#endif // APPLESOFTFORMATTER_H
#ifndef APPLESOFTFORMATTER_H
#define APPLESOFTFORMATTER_H
#include <QObject>
#include <QFlags>
#include <QTextDocument>
#include <QSharedPointer>
#include "applesoftfile.h"
class ApplesoftFormatter : public QObject
{
Q_OBJECT
public:
enum FormatOption {
NoOptions = 0x00,
SyntaxHighlighting = 0x01,
ShowCtrlChars = 0x02,
BreakAfterReturn = 0x04,
ReindentCode = 0x08,
ShowIntsAsHex = 0x10,
AllFlags = 0xffffffff
};
Q_DECLARE_FLAGS(FormatOptions, FormatOption)
public:
explicit ApplesoftFormatter(QObject *parent = 0);
void setFlags(FormatOptions options) { m_format_options = options; }
void setFile(ApplesoftFile *file);
FormatOptions flags() { return m_format_options; }
void formatDocument(QTextDocument *doc);
signals:
void newFile(ApplesoftFile *file);
public slots:
private:
FormatOptions m_format_options;
ApplesoftFile *m_file;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(ApplesoftFormatter::FormatOptions)
#endif // APPLESOFTFORMATTER_H

View File

@ -1,16 +1,16 @@
#ifndef APPLESOFTLINE_H
#define APPLESOFTLINE_H
#include <Qt>
#include <QVector>
class ApplesoftToken;
struct ApplesoftLine {
qint16 address;
quint16 next_address;
quint16 linenum;
QVector<ApplesoftToken> tokens;
};
#endif // APPLESOFTLINE_H
#ifndef APPLESOFTLINE_H
#define APPLESOFTLINE_H
#include <Qt>
#include <QVector>
class ApplesoftToken;
struct ApplesoftLine {
qint16 address;
quint16 next_address;
quint16 linenum;
QVector<ApplesoftToken> tokens;
};
#endif // APPLESOFTLINE_H

View File

@ -1,360 +1,360 @@
#include "applesofttoken.h"
QMap<quint16, QString> ApplesoftToken::m_tokens = QMap<quint16, QString>();
ApplesoftToken::ApplesoftToken()
{
if (m_tokens.size() == 0) { initializeTokenTable(); }
setTokenId(DefaultTokenVal);
}
ApplesoftToken::ApplesoftToken(quint16 id)
{
if (m_tokens.size() == 0) { initializeTokenTable(); }
setTokenId(id);
}
ApplesoftToken::ApplesoftToken(quint16 id, QVariant payload)
{
if (m_tokens.size() == 0) { initializeTokenTable(); }
setTokenId(id);
setValue(payload);
}
void ApplesoftToken::setTokenId(quint16 id)
{
m_token_id = id;
m_token_type = UNKNOWN_TOKEN;
m_command_type = NONE;
if (id <= 0x7f) {
setValue(id);
m_token_type = ASCIICHAR_TOKEN;
m_command_type = NONE;
} else if (id <= 0xC7) {
setValue(id);
m_token_type = APPLESOFT_TOKEN;
m_command_type = COMMAND;
} else if (id <= 0xD1) {
setValue(id);
m_token_type = APPLESOFT_TOKEN;
m_command_type = OPERATOR;
} else if (id <= 0xEA) {
setValue(id);
m_token_type = APPLESOFT_TOKEN;
m_command_type = FUNCTION;
} else if (id <= 0xFF) {
setValue(id);
m_token_type = UNDEFINED_APPLESOFT_TOKEN;
m_command_type = NONE;
} else if (id == StringTokenVal) {
m_token_type = STRING_TOKEN;
m_command_type = NONE;
} else if (id == RemStringTokenVal) {
m_token_type = REM_TOKEN;
m_command_type = NONE;
} else if (id == DataStringTokenVal) {
m_token_type = DATASTRING_TOKEN;
m_command_type = NONE;
} else if (id == IntegerTokenVal) {
m_token_type = INTEGER_TOKEN;
m_command_type = NONE;
} else if (id == FloatTokenVal) {
m_token_type = FLOAT_TOKEN;
m_command_type = NONE;
} else if (id == IntVarTokenVal) {
m_token_type = INT_VARIABLE_TOKEN;
m_command_type = NONE;
} else if (id == IntAryVarTokenVal) {
m_token_type = INT_ARY_VARIABLE_TOKEN;
m_command_type = NONE;
} else if (id == FloatVarTokenVal) {
m_token_type = FLOAT_VARIABLE_TOKEN;
m_command_type = NONE;
} else if (id == FloatAryVarTokenVal) {
m_token_type = FLOAT_ARY_VARIABLE_TOKEN;
m_command_type = NONE;
} else if (id == StringVarTokenVal) {
m_token_type = STRING_VARIABLE_TOKEN;
m_command_type = NONE;
} else if (id == StringAryVarTokenVal) {
m_token_type = STRING_ARY_VARIABLE_TOKEN;
m_command_type = NONE;
} else if (id >= 0xe000 && id < 0xf000) {
m_token_type = OPTIONAL_FORMAT_TOKEN;
m_command_type = OPTIONAL_FORMAT;
}
}
void ApplesoftToken::setValue(QVariant value)
{
m_payload = value;
}
QString ApplesoftToken::getRawPrintableString() const
{
if (m_token_id == DefaultTokenVal) {
return "";
} else if (m_token_id == 0x00) {
return "";
} else if (m_token_id <= 0x7f) {
return QString((m_token_id));
} else if (m_token_id <= 0xff) {
return m_tokens[m_token_id];
} else if (m_token_id == StringTokenVal) {
return getStringValue();
} else if (m_token_id == RemStringTokenVal) {
return getStringValue();
} else if (m_token_id == DataStringTokenVal) {
return getStringValue();
} else if (m_token_id == IntegerTokenVal) {
return getStringValue();
} else if (m_token_id == FloatTokenVal) {
return getStringValue();
} else if (m_token_id == IntVarTokenVal) {
return getStringValue();
} else if (m_token_id == IntAryVarTokenVal) {
return getStringValue();
} else if (m_token_id == FloatVarTokenVal) {
return getStringValue();
} else if (m_token_id == FloatAryVarTokenVal) {
return getStringValue();
} else if (m_token_id == StringVarTokenVal) {
return getStringValue();
} else if (m_token_id == StringAryVarTokenVal) {
return getStringValue();
} else if (m_token_id >= 0xe000 && m_token_id < 0xf000) {
return "";
} else {
return "[temp undefined]";
}
}
QTextCharFormat ApplesoftToken::defaultTextFormat()
{
QTextCharFormat tf; // Default
tf.setForeground(Qt::black);
return tf;
}
QTextCharFormat ApplesoftToken::defaultInverseTextFormat()
{
QTextCharFormat tf;
tf.setForeground(Qt::white);
tf.setBackground(Qt::black);
return tf;
}
QTextCharFormat ApplesoftToken::textFormat(quint16 tokenType)
{
QTextCharFormat tf = defaultTextFormat();
if (tokenType < 0x80) // Ascii
{
tf.setForeground(Qt::black);
}
else if (tokenType < 0x100) // Applesoft Tokens
{
tf.setForeground(Qt::black);
}
else if (tokenType == StringTokenVal)
{
tf.setForeground(Qt::blue);
tf.setFontWeight(QFont::Bold);
}
else if (tokenType == IntegerTokenVal || tokenType == FloatTokenVal)
{
tf.setForeground(Qt::darkGreen);
tf.setFontWeight(QFont::Bold);
}
else if (tokenType == StringVarTokenVal ||
tokenType == StringAryVarTokenVal ||
tokenType == IntVarTokenVal ||
tokenType == IntAryVarTokenVal ||
tokenType == FloatVarTokenVal ||
tokenType == FloatAryVarTokenVal)
{
tf.setFontWeight(QFont::Bold);
tf.setForeground(Qt::darkMagenta);
}
else if (tokenType == RemStringTokenVal)
{
tf.setForeground(Qt::darkGray);
tf.setFontUnderline(true);
}
else if (tokenType == DataStringTokenVal)
{
tf.setForeground(Qt::darkRed);
}
else if (tokenType == ControlCharTokenVal)
{
// Inverse of StringTokenVal
tf.setForeground(Qt::white);
tf.setBackground(Qt::blue);
}
return tf;
}
void ApplesoftToken::makeTextCharFormats()
{
// TCFDefault,
// TCFCtrlChar,
// TCFAscii,
// TCFFunction,
// TCFOperator,
// TCFUnusedToken,
// TCFNumber,
// TCFString,
// TCFVariable,
// TCFDataString,
// TCFRemString,
// TCFUnknown
}
void ApplesoftToken::initializeTokenTable()
{