source: stubgen.pl @ a27acf7

release-1.10release-1.7release-1.8release-1.9
Last change on this file since a27acf7 was fd03b12, checked in by David Benjamin <davidben@mit.edu>, 14 years ago
Properly revert globalnotifier changes to stubgen.pl Apparently I made some typoes and didn't do the obvious thing of checking out the old copy when punting the experiment. Variables with different varname and altvarname got slightly confused.
  • Property mode set to 100755
File size: 1.6 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    if ($vartype =~ /^BOOL/) {
15        print "void owl_global_set_${altvarname}_on(owl_global *g) {\n";
16        print "  owl_variable_set_bool_on(&g->vars, \"$varname\");\n}\n";
17        print "void owl_global_set_${altvarname}_off(owl_global *g) {\n";
18        print "  owl_variable_set_bool_off(&g->vars, \"$varname\");\n}\n";
19        print "int owl_global_is_$altvarname(const owl_global *g) {\n";
20        print "  return owl_variable_get_bool(&g->vars, \"$varname\");\n}\n";
21    } elsif ($vartype =~ /^PATH/ or $vartype =~ /^STRING/) {
22        print "void owl_global_set_$altvarname(owl_global *g, const char *text) {\n";
23        print "  owl_variable_set_string(&g->vars, \"$varname\", text);\n}\n";
24        print "const char *owl_global_get_$altvarname(const owl_global *g) {\n";
25        print "  return owl_variable_get_string(&g->vars, \"$varname\");\n}\n";
26    } elsif ($vartype =~ /^INT/ or $vartype =~ /^ENUM/) {
27        print "void owl_global_set_$altvarname(owl_global *g, int n) {\n";
28        print "  owl_variable_set_int(&g->vars, \"$varname\", n);\n}\n";
29        print "int owl_global_get_$altvarname(const owl_global *g) {\n";
30        print "  return owl_variable_get_int(&g->vars, \"$varname\");\n}\n";
31    } 
32    }
33    }
34    close(FILE);
35    print "\n";
36}
Note: See TracBrowser for help on using the repository browser.