This commit is contained in:
Borna Rajkovic committed 2022-03-29 23:49:32 +02:00
1 parent 4c921759ef
commit 18d84727ab
35 files changed
+362 -636

No files matched your search

-6
View File
@@ -1,6 +0,0 @@
#include "display.h"
Display::Display()
{
}
-18
View File
@@ -1,18 +0,0 @@
#ifndef DOMAIN_DISPLAY_DISPLAY_H
#define DOMAIN_DISPLAY_DISPLAY_H
#include "displayitem.h"
#include <comdel/parser/astnode.h>
#include <vector>
class Display: AstNode
{
public:
Display();
std::vector<DisplayItem> items;
};
#endif // DOMAIN_DISPLAY_DISPLAY_H
-6
View File
@@ -1,6 +0,0 @@
#include "displayitem.h"
DisplayItem::DisplayItem()
{
}
-17
View File
@@ -1,17 +0,0 @@
#ifndef DISPLAYITEM_H
#define DISPLAYITEM_H
#include <comdel/parser/astnode.h>
#include <vector>
#include "../library/value.h"
class DisplayItem: AstNode
{
public:
IdentifierNode type;
std::vector<PropertyNode> values;
DisplayItem();
};
#endif // DISPLAYITEM_H
-6
View File
@@ -1,6 +0,0 @@
#include "addressspace.h"
AddressSpace::AddressSpace()
{
}
-19
View File
@@ -1,19 +0,0 @@
#ifndef ADDRESSSPACE_H
#define ADDRESSSPACE_H
#include <string>
#include <comdel/parser/astnode.h>
class AddressSpace: public AstNode
{
public:
IdentifierNode name;
NumberNode start;
NumberNode end;
AddressSpace();
};
#endif // ADDRESSSPACE_H
-5
View File
@@ -1,5 +0,0 @@
#include "attribute.h"
Attribute::Attribute()
{
}
-21
View File
@@ -1,21 +0,0 @@
#ifndef DOMAIN_LIBRARY_ATTRIBUTE_H
#define DOMAIN_LIBRARY_ATTRIBUTE_H
#include "value.h"
#include "popup.h"
#include <optional>
class Attribute: AstNode
{
public:
Value::ValueType type;
IdentifierNode name;
std::optional<Value> defaultValue;
std::optional<Popup> popup;
Attribute();
};
#endif // DOMAIN_LIBRARY_ATTRIBUTE_H
-6
View File
@@ -1,6 +0,0 @@
#include "bus.h"
Bus::Bus()
{
}
-33
View File
@@ -1,33 +0,0 @@
#ifndef DOMAIN_LIBRARY_BUS_H
#define DOMAIN_LIBRARY_BUS_H
#include "wire.h"
#include <string>
#include <vector>
#include <domain/display/display.h>
#include <comdel/parser/astnode.h>
class Bus: AstNode
{
public:
enum BusType {
AUTOMATIC,
REGULAR
};
BusType type;
IdentifierNode name;
StringNode tooltip;
CountNode count;
Display display;
std::vector<Wire> wires;
Bus();
};
#endif // DOMAIN_LIBRARY_BUS_H
-6
View File
@@ -1,6 +0,0 @@
#include "component.h"
Component::Component()
{
}
-37
View File
@@ -1,37 +0,0 @@
#ifndef COMPONENT_H
#define COMPONENT_H
#include "rule.h"
#include "pin.h"
#include "attribute.h"
#include <string>
#include <vector>
#include <domain/display/display.h>
class Component: AstNode
{
public:
enum ComponentType {
OTHER,
PROCESSOR,
MEMORY
};
IdentifierNode name;
StringNode tooltip;
StringNode source;
ComponentType type;
std::vector<Rule> rules;
StringNode instanceName;
CountNode count;
Display display;
std::vector<Pin> pin;
std::vector<Attribute> attributes;
Component();
};
#endif // COMPONENT_H
-6
View File
@@ -1,6 +0,0 @@
#include "connection.h"
Connection::Connection()
{
}
-23
View File
@@ -1,23 +0,0 @@
#ifndef DOMAIN_LIBRARY_CONNECTION_H
#define DOMAIN_LIBRARY_CONNECTION_H
#include "attribute.h"
#include "bus.h"
#include "component.h"
#include <string>
#include <vector>
class Connection: AstNode
{
public:
IdentifierNode component;
IdentifierNode pin;
IdentifierNode bus;
std::vector<Attribute> attributes;
std::vector<IdentifierNode> wires;
Connection();
};
#endif // DOMAIN_LIBRARY_CONNECTION_H
-6
View File
@@ -1,6 +0,0 @@
#include "library.h"
Library::Library()
{
}
-34
View File
@@ -1,34 +0,0 @@
#ifndef LIBRARY_H
#define LIBRARY_H
#include "addressspace.h"
#include "bus.h"
#include "component.h"
#include "connection.h"
#include <map>
#include <string>
#include <vector>
class Library: AstNode
{
public:
StringNode name;
StringNode libraryInfo;
StringNode header;
StringNode componentDirectory;
std::vector<AddressSpace> addressSpaces;
std::vector<Component> components;
std::vector<Bus> buses;
std::vector<Connection> connections;
std::vector<PropertyNode> messages;
Library();
};
#endif // LIBRARY_H
-6
View File
@@ -1,6 +0,0 @@
#include "pin.h"
Pin::Pin()
{
}
-43
View File
@@ -1,43 +0,0 @@
#ifndef DOMAIN_LIBRARY_PIN_H
#define DOMAIN_LIBRARY_PIN_H
#include <domain/display/display.h>
#include <string>
#include <comdel/parser/astnode.h>
class PinConnection: AstNode {
public:
enum ConnectionType {
CHECK_ONLY,
AUTOMATICALLY
};
StringNode message;
ConnectionType type;
};
class Pin: AstNode
{
public:
enum PinType {
IN_OUT,
IN,
OUT
};
IdentifierNode name;
PinType type;
StringNode tooltip;
PinConnection connection;
Display display;
Pin();
};
#endif // DOMAIN_LIBRARY_PIN_H
-6
View File
@@ -1,6 +0,0 @@
#include "popup.h"
Popup::Popup()
{
}
-37
View File
@@ -1,37 +0,0 @@
#ifndef DOMAIN_LIBRARY_POPUP_H
#define DOMAIN_LIBRARY_POPUP_H
#include "rule.h"
#include <map>
#include <string>
#include <vector>
class EnumerationNode: AstNode {
public:
StringNode key;
Value value;
};
class Popup: AstNode
{
public:
enum PopupType {
AUTOMATIC,
ON_DEMAND
};
PopupType type;
StringNode title;
StringNode text;
bool enumerated;
std::vector<EnumerationNode> enumeration;
std::vector<Rule> rules;
Popup();
};
#endif // DOMAIN_LIBRARY_POPUP_H
-6
View File
@@ -1,6 +0,0 @@
#include "rule.h"
Rule::Rule()
{
}
-44
View File
@@ -1,44 +0,0 @@
#ifndef DOMAIN_LIBRARY_RULE_H
#define DOMAIN_LIBRARY_RULE_H
#include "value.h"
#include <string>
#include <vector>
class Action;
class Condition;
class IfStmt;
class Rule: AstNode
{
public:
std::vector<IfStmt> statements;
Rule();
};
class Action: AstNode {
public:
enum ActionType {
ERROR,
WARNING
};
ActionType type;
StringNode message;
};
class Condition {
public:
bool negated;
IdentifierNode functionName;
std::vector<Value> params;
};
class IfStmt: AstNode {
public:
Condition condition;
Action action;
};
#endif // DOMAIN_LIBRARY_RULE_H
-5
View File
@@ -1,5 +0,0 @@
#include "value.h"
Value::Value()
{
}
-100
View File
@@ -1,100 +0,0 @@
#ifndef DOMAIN_LIBRARY_VALUE_H
#define DOMAIN_LIBRARY_VALUE_H
#include <optional>
#include <string>
#include <comdel/parser/astnode.h>
class Value: AstNode
{
public:
enum ValueType {
INT,
STRING,
BOOL,
IDENTIFIER
};
private:
ValueType type;
std::optional<long long> intValue;
std::optional<std::string> stringValue;
std::optional<bool> boolValue;
std::optional<std::string> identifierValue;
public:
Value();
ValueType getType() {
return type;
}
long long asInt() {
if(is(INT)) {
return intValue.value();
}
throw "cannot convert type to int";
}
std::string asString() {
if(is(STRING)) {
return stringValue.value();
}
throw "cannot convert type to string";
}
std::string asIdentifier() {
if(is(IDENTIFIER)) {
return identifierValue.value();
}
throw "cannot convert type to identifier";
}
bool asBool() {
if(is(BOOL)) {
return boolValue.value();
}
throw "cannot convert type to bool";
}
bool is(ValueType type) {
return this->type == type;
}
static Value ofBool(bool _value) {
Value value;
value.type = BOOL;
value.boolValue = std::optional<bool>(_value);
return value;
}
static Value ofInt(long long _value) {
Value value;
value.type = INT;
value.intValue = std::optional<long long>(_value);
return value;
}
static Value ofString(std::string _value) {
Value value;
value.type = STRING;
value.stringValue = std::optional<std::string>(_value);
return value;
}
static Value ofIdentifier(std::string _value) {
Value value;
value.type = IDENTIFIER;
value.identifierValue = std::optional<std::string>(_value);
return value;
}
};
class PropertyNode: public AstNode {
public:
IdentifierNode key;
Value value;
PropertyNode() {}
};
#endif // DOMAIN_LIBRARY_VALUE_H
-6
View File
@@ -1,6 +0,0 @@
#include "wire.h"
Wire::Wire()
{
}
-31
View File
@@ -1,31 +0,0 @@
#ifndef DOMAIN_LIBRARY_WIRE_H
#define DOMAIN_LIBRARY_WIRE_H
#include <string>
#include <comdel/parser/astnode.h>
class Wire: public AstNode
{
public:
enum WireType {
WIRE,
WIRED_AND,
WIRED_OR,
R_WIRE
};
WireType type;
IdentifierNode name;
NumberNode size;
/*
bool isTerminatedWith;
long terminatedWith;
bool isIfUntrminated;
long ifUnterminated;
*/
Wire();
};
#endif // DOMAIN_LIBRARY_WIRE_H
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef DOMAIN_SCHEMA_ATTRIBUTE_H
#define DOMAIN_SCHEMA_ATTRIBUTE_H
#include <domain/library/value.h>
#include <comdel/parser/astnode.h>
class InstanceAttribute: AstNode
{
+1 -2
View File
@@ -2,14 +2,13 @@
#define DOMAIN_SCHEMA_WIREINSTANCE_H
#include <string>
#include <domain/display/display.h>
#include <comdel/parser/astnode.h>
class WireInstance: AstNode
{
std::string name;
std::pair<int, int> position;
Display display;
DisplayNode display;
public:
WireInstance();