Imported Upstream version 530
[platform/upstream/less.git] / mkfuncs.pl
1 #! /usr/bin/perl
2 use strict;
3
4 my $state = 0;
5 my $def;
6 my $params;
7
8 while (<>) {
9         if (/^\tpublic\s+(.*)/) {
10                 $def = "public $1";
11                 $state = 1;
12                 $params = 0;
13         } elsif ($state == 1 and /(\w+)\s*\(/) {
14                 $def .= " $1 LESSPARAMS ((";
15                 $state = 2;
16         } elsif ($state == 2) {
17                 if (/^{/) {
18                         $def .= 'VOID_PARAM' if not $params;
19                         print "$def));\n";
20                         $state = 0;
21                 } elsif (/^\s*([^;]*)/) {
22                         $def .= ', ' if substr($def,-1) ne '(';
23                         $def .= $1;
24                         $params = 1;
25                 }
26         }
27 }