Compare commits
1 commit
master
...
sic_sim_de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c6379c62d |
7 changed files with 123 additions and 0 deletions
2
simulator_SIC_XE/devices/FA.dev
Normal file
2
simulator_SIC_XE/devices/FA.dev
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
5
|
||||
0
|
||||
26
simulator_SIC_XE/include/code.h
Normal file
26
simulator_SIC_XE/include/code.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef CODE_H
|
||||
#define CODE_H
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#include "node.h"
|
||||
|
||||
class Code {
|
||||
|
||||
public:
|
||||
Code() = default;
|
||||
|
||||
void addLine(const std::shared_ptr<Node>& line);
|
||||
|
||||
const std::vector<std::shared_ptr<Node>>& getLines() const;
|
||||
|
||||
const string toString() const;
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<Node>> _lines;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // CODE_H
|
||||
16
simulator_SIC_XE/include/mnemonic.h
Normal file
16
simulator_SIC_XE/include/mnemonic.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#ifndef MNEMONIC_H
|
||||
#define MNEMONIC_H
|
||||
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
class Mnemonic {
|
||||
public:
|
||||
string toString() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // MNEMONIC_H
|
||||
31
simulator_SIC_XE/include/node.h
Normal file
31
simulator_SIC_XE/include/node.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#ifndef NODE_H
|
||||
#define NODE_H
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include "mnemonic.h"
|
||||
|
||||
using std::string;
|
||||
|
||||
class Node {
|
||||
public:
|
||||
|
||||
string getLabel() const;
|
||||
|
||||
string getComment() const;
|
||||
|
||||
std::shared_ptr<Mnemonic> getMnemonic() const;
|
||||
|
||||
string toString() const;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
string _label;
|
||||
std::shared_ptr<Mnemonic> _mnemonic;
|
||||
string _comment;
|
||||
};
|
||||
|
||||
|
||||
#endif // NODE_H
|
||||
20
simulator_SIC_XE/src/code.cpp
Normal file
20
simulator_SIC_XE/src/code.cpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "code.h"
|
||||
|
||||
void Code::addLine(const std::shared_ptr<Node> &line)
|
||||
{
|
||||
_lines.emplace_back(line);
|
||||
}
|
||||
|
||||
const std::vector<std::shared_ptr<Node>> &Code::getLines() const
|
||||
{
|
||||
return _lines;
|
||||
}
|
||||
|
||||
const string Code::toString() const
|
||||
{
|
||||
string result;
|
||||
for (const auto& line : _lines) {
|
||||
result += line->toString() + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
6
simulator_SIC_XE/src/mnemonic.cpp
Normal file
6
simulator_SIC_XE/src/mnemonic.cpp
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#include "mnemonic.h"
|
||||
|
||||
string Mnemonic::toString() const
|
||||
{
|
||||
return string();
|
||||
}
|
||||
22
simulator_SIC_XE/src/node.cpp
Normal file
22
simulator_SIC_XE/src/node.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "node.h"
|
||||
|
||||
string Node::getLabel() const
|
||||
{
|
||||
return _label;
|
||||
}
|
||||
|
||||
string Node::getComment() const
|
||||
{
|
||||
return _comment;
|
||||
}
|
||||
|
||||
std::shared_ptr<Mnemonic> Node::getMnemonic() const
|
||||
{
|
||||
return _mnemonic;
|
||||
}
|
||||
|
||||
string Node::toString() const
|
||||
{
|
||||
return (_label.length() > 0 ? _label + " " : "") + (_mnemonic ? _mnemonic->toString() + " ": "") + "." + _comment;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue