#!/usr/bin/perl use warnings; use strict; my $depth; while (<DATA>) { /#ifdef|#if|#ifndef/ and $depth++; print unless $depth; /#endif/ and $depth--; # this comes after the print not to be prin +ted } __DATA__ { #if 1 #define done 9 #define do 10 #ifdef #define def1 11 #define thread 12 #endif #define mutex 13 #define inter 14 #endif #define intel 15 #define intel_64 16 }
In reply to Re: nested #if directive matching matching
by choroba
in thread nested #if directive matching matching
by prassi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |