[7d4fbcd] | 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/) { |
---|
[fd03b12] | 15 | print "void owl_global_set_${altvarname}_on(owl_global *g) {\n"; |
---|
[ca54fd6] | 16 | print " owl_variable_set_bool_on(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
[fd03b12] | 17 | print "void owl_global_set_${altvarname}_off(owl_global *g) {\n"; |
---|
[ca54fd6] | 18 | print " owl_variable_set_bool_off(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
[fd03b12] | 19 | print "int owl_global_is_$altvarname(const owl_global *g) {\n"; |
---|
[ca54fd6] | 20 | print " return owl_variable_get_bool(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
[7d4fbcd] | 21 | } elsif ($vartype =~ /^PATH/ or $vartype =~ /^STRING/) { |
---|
[fd03b12] | 22 | print "void owl_global_set_$altvarname(owl_global *g, const char *text) {\n"; |
---|
[ca54fd6] | 23 | print " owl_variable_set_string(owl_variable_get_var(&g->vars, \"$varname\"), text);\n}\n"; |
---|
[fd03b12] | 24 | print "const char *owl_global_get_$altvarname(const owl_global *g) {\n"; |
---|
[ca54fd6] | 25 | print " return owl_variable_get_string(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
[7d4fbcd] | 26 | } elsif ($vartype =~ /^INT/ or $vartype =~ /^ENUM/) { |
---|
[fd03b12] | 27 | print "void owl_global_set_$altvarname(owl_global *g, int n) {\n"; |
---|
[ca54fd6] | 28 | print " owl_variable_set_int(owl_variable_get_var(&g->vars, \"$varname\"), n);\n}\n"; |
---|
[fd03b12] | 29 | print "int owl_global_get_$altvarname(const owl_global *g) {\n"; |
---|
[ca54fd6] | 30 | print " return owl_variable_get_int(owl_variable_get_var(&g->vars, \"$varname\"));\n}\n"; |
---|
[7d4fbcd] | 31 | } |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | close(FILE); |
---|
| 35 | print "\n"; |
---|
| 36 | } |
---|