source: stubgen.pl @ 8ea3d47

release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 8ea3d47 was 8ea3d47, checked in by Anders Kaseorg <andersk@mit.edu>, 12 years ago
codelist.pl, stubgen.pl: Don’t default to processing *.c.
  • Property mode set to 100755
File size: 1.6 KB
Line 
1
2# $Id$
3
4print qq(/* THIS FILE WAS AUTOGENERATED BY STUBGEN.PL --- DO NOT EDIT BY HAND!!! */\n\n);
5print qq(#include "owl.h");
6
7foreach $file (@ARGV) {
8    open(FILE, $file);
9
10    print "/* -------------------------------- $file -------------------------------- */\n";
11    while (<FILE>) {
12        if (m|^\s*OWLVAR_([A-Z_0-9]+)\s*\(\s*"([^"]+)"\s*/\*\s*%OwlVarStub:?([a-z0-9_]+)?\s*\*/|) {   # "
13    my $vartype = $1;
14    my $varname = $2;
15    my $altvarname = $2;
16    $altvarname = $3 if ($3);
17    if ($vartype =~ /^BOOL/) {
18        print "void owl_global_set_${altvarname}_on(owl_global *g) {\n";
19        print "  owl_variable_set_bool_on(&g->vars, \"$varname\");\n}\n";
20        print "void owl_global_set_${altvarname}_off(owl_global *g) {\n";
21        print "  owl_variable_set_bool_off(&g->vars, \"$varname\");\n}\n";
22        print "int owl_global_is_$altvarname(const owl_global *g) {\n";
23        print "  return owl_variable_get_bool(&g->vars, \"$varname\");\n}\n";
24    } elsif ($vartype =~ /^PATH/ or $vartype =~ /^STRING/) {
25        print "void owl_global_set_$altvarname(owl_global *g, const char *text) {\n";
26        print "  owl_variable_set_string(&g->vars, \"$varname\", text);\n}\n";
27        print "const char *owl_global_get_$altvarname(const owl_global *g) {\n";
28        print "  return owl_variable_get_string(&g->vars, \"$varname\");\n}\n";
29    } elsif ($vartype =~ /^INT/ or $vartype =~ /^ENUM/) {
30        print "void owl_global_set_$altvarname(owl_global *g, int n) {\n";
31        print "  owl_variable_set_int(&g->vars, \"$varname\", n);\n}\n";
32        print "int owl_global_get_$altvarname(const owl_global *g) {\n";
33        print "  return owl_variable_get_int(&g->vars, \"$varname\");\n}\n";
34    } 
35    }
36    }
37    close(FILE);
38    print "\n";
39}
Note: See TracBrowser for help on using the repository browser.