1 | print qq(/* THIS FILE WAS AUTOGENERATED BY STUBGEN.PL --- DO NOT EDIT BY HAND!!! */\n\n); |
---|
2 | print qq(#include "owl.h"); |
---|
3 | |
---|
4 | foreach $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(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
17 | print "void owl_global_set_${altvarname}_off(owl_global *g) {\n"; |
---|
18 | print " owl_variable_set_bool_off(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
19 | print "int owl_global_is_$altvarname(const owl_global *g) {\n"; |
---|
20 | print " return owl_variable_get_bool(owl_variable_get_var(&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(owl_variable_get_var(&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(owl_variable_get_var(&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(owl_variable_get_var(&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(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
31 | } |
---|
32 | } |
---|
33 | } |
---|
34 | close(FILE); |
---|
35 | print "\n"; |
---|
36 | } |
---|