-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from 0x444d4d/feature/macros
Feature/macros
- Loading branch information
Showing
18 changed files
with
753 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
./**/test_strip.csv | ||
./**/__pycache__ | ||
unit_tests.py | ||
tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# This file is used to ignore files which are generated | ||
# ---------------------------------------------------------------------------- | ||
|
||
*~ | ||
*.autosave | ||
*.a | ||
*.core | ||
*.moc | ||
*.o | ||
*.obj | ||
*.orig | ||
*.rej | ||
*.so | ||
*.so.* | ||
*_pch.h.cpp | ||
*_resource.rc | ||
*.qm | ||
.#* | ||
*.*# | ||
core | ||
!core/ | ||
tags | ||
.DS_Store | ||
.directory | ||
*.debug | ||
Makefile* | ||
*.prl | ||
*.app | ||
moc_*.cpp | ||
ui_*.h | ||
qrc_*.cpp | ||
Thumbs.db | ||
*.res | ||
*.rc | ||
/.qmake.cache | ||
/.qmake.stash | ||
|
||
# qtcreator generated files | ||
*.pro.user* | ||
|
||
# xemacs temporary files | ||
*.flc | ||
|
||
# Vim temporary files | ||
.*.swp | ||
|
||
# Visual Studio generated files | ||
*.ib_pdb_index | ||
*.idb | ||
*.ilk | ||
*.pdb | ||
*.sln | ||
*.suo | ||
*.vcproj | ||
*vcproj.*.*.user | ||
*.ncb | ||
*.sdf | ||
*.opensdf | ||
*.vcxproj | ||
*vcxproj.* | ||
|
||
# MinGW generated files | ||
*.Debug | ||
*.Release | ||
|
||
# Python byte code | ||
*.pyc | ||
|
||
# Binaries | ||
# -------- | ||
*.dll | ||
*.exe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
noop | ||
limm 0 R1 | ||
limm 1 R2 | ||
limm 10 R3 | ||
:for | ||
add R1 R2 R1 | ||
sub R3 R1 zero | ||
jnz for | ||
:end | ||
jump end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>qtSCC</class> | ||
<widget class="QWidget" name="qtSCC"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>800</width> | ||
<height>600</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>qtSCC</string> | ||
</property> | ||
<widget class="QWidget" name="verticalLayoutWidget"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>10</x> | ||
<y>10</y> | ||
<width>781</width> | ||
<height>581</height> | ||
</rect> | ||
</property> | ||
<layout class="QVBoxLayout" name="verticalLayout"> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout_2"> | ||
<item> | ||
<widget class="QLineEdit" name="inputEdit"> | ||
<property name="readOnly"> | ||
<bool>false</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="SeachButton"> | ||
<property name="text"> | ||
<string>Search</string> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="assembleButton"> | ||
<property name="text"> | ||
<string>Assemble</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout"> | ||
<item> | ||
<widget class="QListWidget" name="fileList"/> | ||
</item> | ||
<item> | ||
<layout class="QVBoxLayout" name="verticalLayout_2"> | ||
<item> | ||
<widget class="QTextEdit" name="textEdit"> | ||
<property name="readOnly"> | ||
<bool>true</bool> | ||
</property> | ||
</widget> | ||
</item> | ||
<item> | ||
<layout class="QHBoxLayout" name="horizontalLayout_3"> | ||
<item> | ||
<widget class="QLineEdit" name="lineEdit"/> | ||
</item> | ||
<item> | ||
<widget class="QPushButton" name="pushButton"> | ||
<property name="text"> | ||
<string>Save</string> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</item> | ||
</layout> | ||
</widget> | ||
</widget> | ||
<resources/> | ||
<connections/> | ||
</ui> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# This Python file uses the following encoding: utf-8 | ||
import sys | ||
import tempfile | ||
|
||
from PyQt5.QtGui import * | ||
from PyQt5.QtWidgets import * | ||
from PyQt5.QtCore import * | ||
|
||
from qtSCC import Ui_qtSCC | ||
import os | ||
sys.path.append(os.path.abspath('../../SCC')) | ||
import SCCUtils | ||
|
||
class qtSCC(QMainWindow, Ui_qtSCC): | ||
def __init__(self, *args, **kwargs): | ||
super(qtSCC, self).__init__(*args, **kwargs) | ||
self.setupUi(self) | ||
self.virtual_file = tempfile.SpooledTemporaryFile(mode = "w+", encoding = "utf-8", dir = "/tmp/") | ||
self.binaryCode = [] | ||
self.translationQueue = [] | ||
|
||
self.SearchButton.clicked.connect(self.onSearchButtonClicked) | ||
self.assembleButton.clicked.connect(self.onAssembleButtonClicked) | ||
self.saveButton.clicked.connect(self.onSaveButtonClicked) | ||
self.fileList.itemClicked.connect(self.onFileListItemClicked) | ||
self.translateList.itemClicked.connect(self.onTranslateListItemClicked) | ||
|
||
self.show() | ||
|
||
def onSaveButtonClicked(self): | ||
pass | ||
# fileName = self.saveEdit.text() | ||
# SCCUtils.writeList2File(fileName, self.binaryCode) | ||
|
||
def onAssembleButtonClicked(self): | ||
for fileName in self.translationQueue: | ||
binaryCode = self.assembleFile(fileName) | ||
binFileName = fileName.split('.')[0]; | ||
binFileName = binFileName + ".bin" | ||
SCCUtils.writeList2File(binFileName, binaryCode) | ||
self.translationQueue = []; | ||
|
||
def onSearchButtonClicked(self): | ||
self.fileList.clear() | ||
path = self.inputEdit.text() | ||
path = QDir(path) | ||
print(path.dirName()) | ||
path.setFilter(QDir.Files) | ||
contentsList = path.entryList() | ||
for content in contentsList: | ||
basePath = self.inputEdit.text() | ||
filePath = os.path.join(basePath, content) | ||
self.fileList.addItem(content) | ||
|
||
def onFileListItemClicked(self, item): | ||
basePath = self.inputEdit.text() | ||
filePath = os.path.join(basePath, item.text()) | ||
self.translateList.addItem(item.text()) | ||
self.translationQueue.append(filePath) | ||
|
||
def onTranslateListItemClicked(self, item): | ||
self.translationQueue.remove(item.text()) | ||
self.translateList.takeItem(self.translateList.currentRow()) | ||
|
||
def assembleFile(self, fileName): | ||
with open(fileName, 'r') as inputFile: | ||
SCCUtils.strip_input(self.virtual_file, inputFile) | ||
SCCUtils.operateFile(self.virtual_file, SCCUtils.resolveDirections) | ||
binaryCode = SCCUtils.operateFile(self.virtual_file, SCCUtils.translate) | ||
return binaryCode | ||
|
||
if __name__ == "__main__": | ||
app = QApplication([]) | ||
window = qtSCC() | ||
app.exec_() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"files": ["main.py","form.ui","qtSCC.py"] | ||
} |
Oops, something went wrong.