On Mon, Jul 25, 2005 at 08:39:26PM -0600, Marcelo E. Magallon wrote: > A small parser that looks for extern "C", the "{" right after it and > the matching "}" should make things much easier.
The attached script should work in most cases. -- Marcelo
#!/usr/bin/perl use strict; use warnings; my $n = 0; while (<>) { last if /extern\s+"C"/; print; } do { $n++ if /{/ } while ($n == 0 && ($_ = <>)); while ($n > 0 && ($_ = <>)) { $n++ if /{/; $n-- if /}/; } print while <>;