in reply to nested #if directive matching matching
#!/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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: nested #if directive matching matching
by roboticus (Chancellor) on Jun 26, 2012 at 12:22 UTC | |
by choroba (Cardinal) on Jun 26, 2012 at 12:53 UTC | |
by Anonymous Monk on Jun 26, 2012 at 19:35 UTC | |
by GrandFather (Saint) on Jun 26, 2012 at 21:13 UTC | |
|
Re^2: nested #if directive matching matching
by tobyink (Canon) on Jun 26, 2012 at 10:12 UTC | |
by choroba (Cardinal) on Jun 26, 2012 at 10:16 UTC |