Extend universal modules with module context (#61)

* extend universal modules with module context

* implement module calls and events for universal modules

* pr comments
This commit is contained in:
Dario Lipicar
2026-05-19 12:49:15 -03:00
committed by GitHub
parent 25c88f4d48
commit 8bdbd13848
16 changed files with 1787 additions and 450 deletions
+31
View File
@@ -1,6 +1,7 @@
#include "legacy/legacy_main.h"
#include "experimental/lidl_gen_client.h"
#include "experimental/lidl_gen_provider.h"
#include "experimental/lidl_serializer.h"
#include "experimental/impl_header_parser.h"
#include <QCoreApplication>
@@ -110,6 +111,36 @@ int main(int argc, char* argv[])
out << "Generated: " << glueHeaderAbs << "\n";
out << "Generated: " << dispatchAbs << "\n";
// Events bodies (Qt-MOC-style) and LIDL sidecar — emitted
// when the impl declares any `logos_events:` prototypes.
// The sidecar travels in the dep's headers-* output so
// consumer-side codegen can generate typed `on<X>()`
// accessors without reintrospecting the .dylib.
if (!mod.events.isEmpty()) {
QString eventsAbs = QDir(genDirPath).filePath(mod.name + "_events.cpp");
{
QFile f(eventsAbs);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
err << "Failed to write events source: " << eventsAbs << "\n";
return 8;
}
f.write(lidlMakeEventsSource(mod, implClass, implHeader).toUtf8());
}
out << "Generated: " << eventsAbs << "\n";
QString lidlAbs = QDir(genDirPath).filePath(mod.name + ".lidl");
{
QFile f(lidlAbs);
if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) {
err << "Failed to write LIDL sidecar: " << lidlAbs << "\n";
return 9;
}
f.write(lidlSerialize(mod).toUtf8());
}
out << "Generated: " << lidlAbs << "\n";
}
out.flush();
return 0;
}