[kw-pm] how to *delete* all "#if 0" content from a source tree

Richard Dice rdice at pobox.com
Sat Mar 17 09:13:21 PDT 2007


This isn't particularly a Perl question, is it?

That said, if you're interested in doing this with Perl, you should look
into Damian Conway's module called Text::Balanced.

http://search.cpan.org/~dconway/Text-Balanced-v2.0.0/lib/Text/Balanced.pm

This only identifies the nested #if 0 ... #endif blocks. Traversing the
source tree, keeping what you what in the files, editing and saving the
files in place, etc., is all up to you.  But these are pretty easy to do
with Perl (plus some standard Unix shell tools like "find" and "xargs") too.
:-)

Cheers,
Richard

On 3/17/07, Robert P. J. Day <rpjday at mindspring.com> wrote:
>
>
>   is there a convenient way to, throughout an entire source tree,
> delete all content in all source or header files that's been
> de-activated with an "#if 0"?  that would, of course, include the "#if
> 0" line and all content up to and including the terminating "#endif"
> (which might have some extraneous comment content after it).
>
>   thoughts?
>
> rday
> _______________________________________________
> kw-pm mailing list
> kw-pm at pm.org
> http://mail.pm.org/mailman/listinfo/kw-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kw-pm/attachments/20070317/ce34eaf7/attachment.html 


More information about the kw-pm mailing list