##// END OF EJS Templates
Added bool loadfile(abstractBinFile* file)...
Added bool loadfile(abstractBinFile* file) and bool dumpMemory(unsigned int address, unsigned int count, QString file, const QString &format); to the genericPySysDriver, now all plugins can load an abstract binary file(bin/srec/elf) and they can dump any memory space to either an srec or a binary file. This function are able to deal with file and host endianness. Functions: -bool dumpMemory(unsigned int address,unsigned int count,QString file); -bool memSet(unsigned int address,int value, unsigned int count); -bool loadbin(unsigned int address,QString file); are moved to socexplorerplugin which makes them available from C++.

File last commit:

r0:1aa783210b8e default
r71:c4b98d42ee59 default
Show More
PygmentsHighlighter.cpp
63 lines | 1.7 KiB | text/x-c | CppLexer
/*! \file PygmentsHighlighter.cpp
* \brief implements PygmentsHighlighter
* \author "Melven Zoellner" <melven@topen.org>
*
*/
#include "PygmentsHighlighter.h"
#include <QApplication>
#include <PythonQt.h>
#include <socexplorer.h>
#include <QFile>
#include <QFileInfo>
PygmentsHighlighter::PygmentsHighlighter(QTextDocument *parentDoc) :
QSyntaxHighlighter(parentDoc)
{
// create an own pythonqt context for the highlighter
_context = PythonQt::self()->createUniqueModule();
// name this object
setObjectName("pygmentsHighlighter");
// make it accessable in pythonqt,
// this allows to delegate the work in highlightBlock
// to a python function
_context.addObject(objectName(),this);
// initialize python
QString fileName = QString(PYMODULES)+"/PygmentsHighlighter.py";
QString code;
QFile file;
QFileInfo fileinfo;
code.clear();
file.setFileName(fileName);
fileinfo.setFile(fileName);
if(!fileinfo.suffix().compare("py"))
{
file.open(QIODevice::ReadOnly);
QTextStream filestrm(&file);
while(!filestrm.atEnd())code.append(filestrm.readLine()+"\n");
_context.evalScript(code);
file.close();
// this->mainContext->evalFile(pathList.at(i));
}
//_context.evalFile(QString(PYMODULES)+"/PygmentsHighlighter.py");
}
// just delegate the protected method setFormat from base class
void PygmentsHighlighter::_setFormat(int start, int count, const QTextCharFormat &format)
{
setFormat(start, count, format);
}
void PygmentsHighlighter::highlightBlock(const QString &text)
{
// call python function to do everything
QVariantList args;
args.append(text);
_context.call("highlightCode", args);
}