17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-03 17:50:21 +01:00

First implementation of graph vehicles

This commit is contained in:
2026-10-14 12:20:49 +02:00
parent 70abf879b3
commit 1ef465264c
121 changed files with 12292 additions and 729 deletions

View File

@@ -27,6 +27,7 @@ struct node_desc
std::string type;
std::string title;
std::vector<named_value> params; // as stored in the file; checked against the catalog when the graph is compiled
std::string script; // source of a lua block ("lua" in the file)
};
struct connection_desc
@@ -50,6 +51,16 @@ struct document
std::vector<connection_desc> connections;
};
// type of the nodes standing for modules: graphs of logic kept in their own files (by convention .vhgm) and used as
// one block. the "file" parameter names the module file, relative to the file of the graph using it
inline constexpr std::string_view module_type{"module"};
// replaces the module nodes of the document with the blocks of their modules, read from their files relative to
// Directory (with a trailing separator, or empty). the blocks get ids "<module node id>/<id in the module>", and the
// connections of the module node are passed to the blocks connected to its module.input and module.output blocks.
// modules can use other modules. problems are appended to the diagnostics; returns false on errors
bool expand_modules(document &Document, std::string const &Directory, std::vector<diagnostic> &Diagnostics);
// parses the content of a .vhg file. problems are appended to the diagnostics; returns false on errors
bool parse_document(std::string const &Text, document &Document, std::vector<diagnostic> &Diagnostics);
// reads and parses the specified .vhg file