source: stubgen.pl @ 680ed23

barnowl_perlaimdebianowlrelease-1.10release-1.4release-1.5release-1.6release-1.7release-1.8release-1.9
Last change on this file since 680ed23 was 1aee7d9, checked in by Erik Nygren <nygren@mit.edu>, 22 years ago
* Added RCS Id strings to all files. * 'show keymaps' shows details of all keymaps after summary list.
  • Property mode set to 100755
File size: 1.7 KB
Line 
1
2# $Id$
3
4if ($#ARGV eq -1) {
5    @ARGV=`ls *.c`;
6    chop(@ARGV);
7}
8
9print qq(/* THIS FILE WAS AUTOGENERATED BY STUBGEN.PL --- DO NOT EDIT BY HAND!!! */\n\n);
10print qq(#include "owl.h");
11
12foreach $file (@ARGV) {
13    open(FILE, $file);
14
15    print "/* -------------------------------- $file -------------------------------- */\n";
16    while (<FILE>) {
17        if (m|^\s*OWLVAR_([A-Z_0-9]+)\s*\(\s*"([^"]+)"\s*/\*\s*%OwlVarStub:?([a-z0-9_]+)?\s*\*/|) {   # "
18    my $vartype = $1;
19    my $varname = $2;
20    my $altvarname = $2;
21    $altvarname = $3 if ($3);
22    if ($vartype =~ /^BOOL/) {
23        print "void owl_global_set_${altvarname}_on(owl_global *g) {\n";
24        print "  owl_variable_set_bool_on(&g->vars, \"$varname\");\n}\n";
25        print "void owl_global_set_${altvarname}_off(owl_global *g) {\n";
26        print "  owl_variable_set_bool_off(&g->vars, \"$varname\");\n}\n";
27        print "int owl_global_is_$altvarname(owl_global *g) {\n";
28        print "  return owl_variable_get_bool(&g->vars, \"$varname\");\n}\n";
29    } elsif ($vartype =~ /^PATH/ or $vartype =~ /^STRING/) {
30        print "void owl_global_set_$altvarname(owl_global *g, char *text) {\n";
31        print "  owl_variable_set_string(&g->vars, \"$varname\", text);\n}\n";
32        print "char *owl_global_get_$altvarname(owl_global *g) {\n";
33        print "  return owl_variable_get_string(&g->vars, \"$varname\");\n}\n";
34    } elsif ($vartype =~ /^INT/ or $vartype =~ /^ENUM/) {
35        print "void owl_global_set_$altvarname(owl_global *g, int n) {\n";
36        print "  owl_variable_set_int(&g->vars, \"$varname\", n);\n}\n";
37        print "int owl_global_get_$altvarname(owl_global *g) {\n";
38        print "  return owl_variable_get_int(&g->vars, \"$varname\");\n}\n";
39    } 
40    }
41    }
42    close(FILE);
43    print "\n";
44}
Note: See TracBrowser for help on using the repository browser.