aboutsummaryrefslogtreecommitdiff
path: root/rt/tools/genintf.pl
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2026-01-01 18:04:40 -0700
committerJosh Rahm <joshuarahm@gmail.com>2026-01-01 18:04:40 -0700
commit628174c992a5a740feb4dc119adf8dfb1f89f992 (patch)
tree683361b27cf4b6df2c5cc782d70de9bdf5fd38a8 /rt/tools/genintf.pl
parentbe1ef8cee5f68eb9afecca94071069a1ff82825e (diff)
downloadmontis-628174c992a5a740feb4dc119adf8dfb1f89f992.tar.gz
montis-628174c992a5a740feb4dc119adf8dfb1f89f992.tar.bz2
montis-628174c992a5a740feb4dc119adf8dfb1f89f992.zip
Have Meson orchestrate the whole build rather than stack.
As a part of this, I changed the file layout to: rt/ - the Montis runtime plug/ - the Montis plugin wlroots/ - wlroots
Diffstat (limited to 'rt/tools/genintf.pl')
-rw-r--r--rt/tools/genintf.pl42
1 files changed, 42 insertions, 0 deletions
diff --git a/rt/tools/genintf.pl b/rt/tools/genintf.pl
new file mode 100644
index 0000000..794f966
--- /dev/null
+++ b/rt/tools/genintf.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/env perl
+
+$comment="";
+
+print "#ifndef _PLUG_INTF\n";
+print "#define _PLUG_INTF\n";
+print "\n#include <stdint.h>\n";
+print "\n#include <plugin_types.h>\n";
+
+while (<STDIN>) {
+ if (/^\s*\/\*/) {
+ $_ =~ s/^\s*//;
+ $comment="$_";
+ next;
+ }
+
+ if (/^\s*\*/) {
+ $_ =~ s/^\s*/ /;
+ $comment="$comment$_";
+ next;
+ }
+
+ if (/^\s*EXPORT_INCLUDE\((.*)\)/) {
+ print "#include $1\n";
+ } elsif (/^\s*EXPORT/) {
+ my $line = "$_";
+ while (not ($line =~ /;$/)) {
+ my $nextline = <STDIN>;
+ last unless defined $nextline;
+
+ $line="$line$nextline";
+ }
+ if ($line =~ /^\s*EXPORT\(\s*((?:\w|\s*\*\s*)+)\s*\(\*(\w+)\)\s*\((.*)\)\);/s) {
+ print "$comment";
+ print "$1 $2($3);\n\n";
+ $comment="";
+ } elsif ($line =~ /^\s*EXPORT\((.*)\);/s) {
+ print "$1\n";
+ }
+ }
+}
+print "#endif /* _PLUG_INTF */\n";