mirror of
https://github.com/hyprwm/hyprwayland-scanner.git
synced 2025-12-20 06:50:03 +01:00
source: Generate protocol specific dummy_type names (#20)
This commit is contained in:
parent
fcca0c61f9
commit
b3b0f1f40a
1 changed files with 7 additions and 5 deletions
12
src/main.cpp
12
src/main.cpp
|
|
@ -516,6 +516,8 @@ class {} {{
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseSource() {
|
void parseSource() {
|
||||||
|
std::string DUMMY_TYPE_TABLE_NAME = PROTO_DATA.name + "_dummyTypes";
|
||||||
|
|
||||||
SOURCE += std::format(R"#(#define private public
|
SOURCE += std::format(R"#(#define private public
|
||||||
#define HYPRWAYLAND_SCANNER_NO_INTERFACES
|
#define HYPRWAYLAND_SCANNER_NO_INTERFACES
|
||||||
#include "{}.hpp"
|
#include "{}.hpp"
|
||||||
|
|
@ -527,9 +529,9 @@ void parseSource() {
|
||||||
// reference interfaces
|
// reference interfaces
|
||||||
|
|
||||||
// dummy
|
// dummy
|
||||||
SOURCE += R"#(
|
SOURCE += std::format(R"#(
|
||||||
static const wl_interface* dummyTypes[] = { nullptr };
|
static const wl_interface* {}[] = {{ nullptr }};
|
||||||
)#";
|
)#", DUMMY_TYPE_TABLE_NAME);
|
||||||
|
|
||||||
SOURCE += R"#(
|
SOURCE += R"#(
|
||||||
// Reference all other interfaces.
|
// Reference all other interfaces.
|
||||||
|
|
@ -823,7 +825,7 @@ static const wl_message {}[] = {{
|
||||||
const auto TYPE_TABLE_NAME = camelize(std::string{"_"} + "C_" + IFACE_NAME + "_" + rq.name + "_types");
|
const auto TYPE_TABLE_NAME = camelize(std::string{"_"} + "C_" + IFACE_NAME + "_" + rq.name + "_types");
|
||||||
|
|
||||||
SOURCE += std::format(" {{ .name = \"{}\", .signature = \"{}\", .types = {}}},\n", rq.name, argsToShort(rq.args, rq.since),
|
SOURCE += std::format(" {{ .name = \"{}\", .signature = \"{}\", .types = {}}},\n", rq.name, argsToShort(rq.args, rq.since),
|
||||||
rq.args.empty() ? "dummyTypes + 0" : TYPE_TABLE_NAME + " + 0");
|
rq.args.empty() ? std::format("{} + 0", DUMMY_TYPE_TABLE_NAME) : TYPE_TABLE_NAME + " + 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCE += "};\n";
|
SOURCE += "};\n";
|
||||||
|
|
@ -839,7 +841,7 @@ static const wl_message {}[] = {{
|
||||||
const auto TYPE_TABLE_NAME = camelize(std::string{"_"} + "C_" + IFACE_NAME + "_" + ev.name + "_types");
|
const auto TYPE_TABLE_NAME = camelize(std::string{"_"} + "C_" + IFACE_NAME + "_" + ev.name + "_types");
|
||||||
|
|
||||||
SOURCE += std::format(" {{ .name = \"{}\", .signature = \"{}\", .types = {}}},\n", ev.name, argsToShort(ev.args, ev.since),
|
SOURCE += std::format(" {{ .name = \"{}\", .signature = \"{}\", .types = {}}},\n", ev.name, argsToShort(ev.args, ev.since),
|
||||||
ev.args.empty() ? "dummyTypes + 0" : TYPE_TABLE_NAME + " + 0");
|
ev.args.empty() ? std::format("{} + 0", DUMMY_TYPE_TABLE_NAME) : TYPE_TABLE_NAME + " + 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
SOURCE += "};\n";
|
SOURCE += "};\n";
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue