oo binding

git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@202 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-10-07 11:02:38 +00:00
parent 4ca5671d10
commit 9f2efd4771
25 changed files with 268 additions and 10 deletions

View File

@@ -89,7 +89,7 @@ sub scan_dir {
print(STDERR "Scanning $path\n");
my @paths = sort(readdir($dh));
foreach my $p (@paths) {
if ($p eq '.' || $p eq '..') {
if ($p eq '.' || $p eq '..' || $p eq 'MwOO') {
next;
}
scan_dir($first, $path . "/" . $p);

55
tools/genoo.pl Executable file
View File

@@ -0,0 +1,55 @@
#!/usr/bin/env perl
# $Id$
my $objs = "";
opendir(DIR, "include/Mw/Widget");
my @files = readdir(DIR);
foreach my $f (@files) {
if ($f eq '.' || $f eq '..') {
next;
}
$f =~ /^(.+)\.h$/;
my $name = $1;
open(OUT, ">", "include/MwOO/Widget/$f");
print(OUT "/* \$Id\$ */\n");
print(OUT "#ifndef __MWOO_WIDGET_" . uc($name) . "_H__\n");
print(OUT "#define __MWOO_WIDGET_" . uc($name) . "_H__\n");
print(OUT "\n");
print(OUT "#include <MwOO/Base.h>\n");
print(OUT "\n");
print(OUT "class MwOO${name}Widget : public MwOOWidget {\n");
print(OUT "public:\n");
print(OUT
" MwOO${name}Widget(const char* name, MwOOWidget* parent, int x, int y, int w, int h);\n"
);
print(OUT "};\n");
print(OUT "\n");
print(OUT "#endif\n");
close(OUT);
open(OUT, ">", "oosrc/widget/" . lc($name) . ".cc");
print(OUT "/* \$Id\$ */\n");
print(OUT "#include <MwOO/Widget/$name.h>\n");
print(OUT "#include <Mw/Widget/$name.h>\n");
print(OUT "\n");
print(OUT
"MwOO${name}Widget::MwOO${name}Widget(const char* name, MwOOWidget* parent, int x, int y, int w, int h) : MwOOWidget(name, parent, x, y, w, h){\n"
);
print(OUT " this->widget_class = Mw${name}Class;\n");
print(OUT "}\n");
close(OUT);
if (!($name eq 'Vulkan' || $name eq 'OpenGL')) {
$objs = $objs . " oosrc/widget/" . lc($name) . ".o";
}
}
closedir(DIR);
open(OUT, ">", "oosrc/deps.mk");
print(OUT "# \$Id\$\n");
print(OUT "OOL_OBJS +=$objs\n");
close(OUT);