# Create the prototypes for all functions # on a given C source file use strict; use warnings; my @ctypes = qw( void unsigned signed long short int float double struct char static const ); my @contents = <>; for my $line (0 .. $#contents) { my $lref = \$contents[$line]; my $prot = ''; for my $type (@ctypes) { if ($$lref =~ /^$type/) { while ($contents[$line] !~ /\{/) { # seek for { $prot .= "$contents[$line++] "; } chop $prot; # the last space $prot =~ s/\n//go; # remove LFs $prot =~ s/\w*,/, /go; # remove argument intentifiers $prot =~ s/\w*\)/)/go; # remove the last argument $prot .= ';'; # append a semicolon print $prot, "\n"; next; } } }
segunda-feira, 22 de novembro de 2010
Prototype maker 2.0
There is no patter alignment anymore .. !
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário