File: trans

package info (click to toggle)
libgraphics-libplot-perl 2.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 204 kB
  • sloc: perl: 369; ansic: 238; makefile: 5
file content (47 lines) | stat: -rwxr-xr-x 922 bytes parent folder | download | duplicates (10)
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
45
46
47
#!/usr/bin/perl
=pod
 Translate the header file plot.h to xsub declarations.
 use with gnu libplot
=cut


while(<>) {
    next unless /^int|^double|^FILE/;
    chomp;
    print "#  $_ \n";
    ($return_type,$name,$arglist) = 
	/(\S+)\s+(\w+)\s*___P\s*\(\(([^\)]*)\)\)/;
    @args = split('\s*,\s*',$arglist);
    @argtype=();
    @argname=();
    foreach $arg (@args) {
	$arg =~ s/___const\s+//g;
	$arg =~ s/^s*//; $arg =~ s/\s*$//;
	($argtype,$argname) = split('\s+',$arg);
	next unless defined $argtype and defined $argname;
	push @argtype,$argtype;
	push @argname,$argname;
    }
    print $return_type,"\n";
    print "$name(";
#    print "$name\n";
    for($i=0;$i<@argname;$i++) {
	$outname = $argname[$i];
	$outname =~ s/\*//g;
	print $outname;
	print "," unless $i == $#argname;
    }
    print ")\n";
    for($i=0;$i<@argname;$i++) {
	print "      $argtype[$i]  $argname[$i]\n";
    }
    print "\n\n";
}