File: control_define

package info (click to toggle)
ocaml-speex 0.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 228 kB
  • sloc: ml: 871; ansic: 667; perl: 30; makefile: 8
file content (44 lines) | stat: -rwxr-xr-x 673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl

my $comment = 0;
my @results;
my @names;

while (<STDIN>) {

my $new_comment = $comment;

s/^\s+//;
s/\/\*.*\*\///;
s/\/\/.*//;
if (m/\/\*/) { $new_comment++; }
if (m/\*\//)  { $new_comment--; }
s/SPEEX_(GET|SET)_PF//;

if (!$comment && !$new_comment)
 {  
   if (/^#define\s+(SPEEX_(?:GET|SET).+)\s+(.+)/)

     {  my $pair = "$1:$2";
        push(@results,$pair); 
        push(@names,$1); }

 }

$comment = $new_comment;

}

my $types = join(" |\n  ", @names);
print "type control = \n  $types\n";


print <<BLA;

let int_of_control x =
    match x with
BLA
foreach (@results) {
  my ($name,$value) = split (":");
  print "      | $name -> $value\n";
}