#!/usr/bin/perl # Script to add comments for Natural Doc. http://www.naturaldoc.org use Tie::File; use strict; use warnings; use Data::Dumper; my @FILE_ARRAY; tie @FILE_ARRAY, 'Tie::File', "searchfs.c", recsep => "\n" or die $!; my $found = 0; foreach (@FILE_ARRAY) { #if (/^(sub .+)/) { # Match .c function if (/^(?:([0-9_a-zA-Z*]+) +)?(?:([0-9_a-zA-Z*]+) +)?(?:([0-9_a-zA-Z*]+) +)?([0-9_a-zA-Z*]+)\((.+?)\)/) { my ($a, $b, $c, $d, $e) = ("") x 5; if (defined($1)) { $a = $1; } if (defined($2)) { $b = $2; } if (defined($3)) { $c = $3; } if (defined($4)) { $d = $4; } if (defined($5)) { $e = $5; } print $a . " " . $b . " " . $c . " " . $d . " ARGS: " . $e . "\n"; } }