source: stubgen.pl @ 678a505c

release-1.10release-1.7release-1.8release-1.9
Last change on this file since 678a505c was 5b80b87, checked in by David Benjamin <davidben@mit.edu>, 15 years ago
Avoid flagrant violations of layering and just g_object_notify in the setters. g_object_set_property calls g_object_freeze_notify and g_object_thaw_notify, so it should Just Work.
  • Property mode set to 100755
File size: 1.8 KB
Line 
1print qq(/* THIS FILE WAS AUTOGENERATED BY STUBGEN.PL --- DO NOT EDIT BY HAND!!! */\n\n);
2print qq(#include "owl.h");
3
4foreach $file (@ARGV) {
5    open(FILE, $file);
6
7    print "/* -------------------------------- $file -------------------------------- */\n";
8    while (<FILE>) {
9        if (m|^\s*OWLVAR_([A-Z_0-9]+)\s*\(\s*"([^"]+)"\s*/\*\s*%OwlVarStub:?([a-z0-9_]+)?\s*\*/|) {   # "
10    my $vartype = $1;
11    my $varname = $2;
12    my $altvarname = $2;
13    $altvarname = $3 if ($3);
14    my $detailname = $altvarname;
15    $detailname =~ s/[^a-zA-Z0-9]/-/g;
16    $detailname =~ s/^[^a-zA-Z]+//;
17    if ($vartype =~ /^BOOL/) {
18        print <<EOT;
19void owl_global_set_${altvarname}_on(owl_global *g) {
20  owl_variable_set_bool_on(&g->vars, "$altvarname");
21  g_object_notify(G_OBJECT(g->gn), "$detailname");
22}
23void owl_global_set_${altvarname}_off(owl_global *g) {
24  owl_variable_set_bool_off(&g->vars, "$altvarname");
25  g_object_notify(G_OBJECT(g->gn), "$detailname");
26}
27int owl_global_is_$altvarname(const owl_global *g) {
28  return owl_variable_get_bool(&g->vars, "$varname");
29}
30EOT
31    } elsif ($vartype =~ /^PATH/ or $vartype =~ /^STRING/) {
32        print <<EOT;
33void owl_global_set_${altvarname}(owl_global *g, const char *text) {
34  owl_variable_set_string(&g->vars, "$altvarname", text);
35  g_object_notify(G_OBJECT(g->gn), "$detailname");
36}
37const char *owl_global_get_$altvarname(const owl_global *g) {
38  return owl_variable_get_string(&g->vars, "$varname");
39}
40EOT
41    } elsif ($vartype =~ /^INT/ or $vartype =~ /^ENUM/) {
42        print <<EOT;
43void owl_global_set_${altvarname}(owl_global *g, int n) {
44  owl_variable_set_int(&g->vars, "$altvarname", n);
45  g_object_notify(G_OBJECT(g->gn), "$detailname");
46}
47int owl_global_get_$altvarname(const owl_global *g) {
48  return owl_variable_get_int(&g->vars, "$varname");
49}
50EOT
51    } 
52    }
53    }
54    close(FILE);
55    print "\n";
56}
Note: See TracBrowser for help on using the repository browser.