
my $ifdef_level = 0;
my $in_win32    = 0;
my $win32_level = -1;

  while (! eof STDIN) {
    my $line, $dont_print;

    chomp ($line = <STDIN>);

    $dont_print = 0;

    if ($line =~ /^#if/) {
      $ifdef_level++;
    }

    if      ((! $in_win32) && ($line =~ /^#ifdef\s+WIN32/)) {
      $in_win32     = 1;
      $win32_level  = $ifdef_level;
    } elsif ((! $in_win32) && ($line =~ /^#ifndef\s+WIN32/)) {
      $in_win32     = -1;
      $dont_print   = 1;
      $win32_level  = $ifdef_level;
    } elsif ($line =~ /^#else/) {
      if ($ifdef_level == $win32_level) {
        $dont_print = 1;
        $in_win32   = - $in_win32;
      }
    } elsif ($line =~ /^#endif/) {
      if ($ifdef_level == $win32_level) {
        $in_win32    = 0;
        $dont_print  = 1;
        $win32_level = -1; # Ne sert a rien
      }
      $ifdef_level--;
    }

    if (( $in_win32 <= 0 ) && (! $dont_print)) {
      print "$line\n";
#      print "[Y] ";
    }
#    print "in_win32=$in_win32 ifdef_level=$ifdef_level\t$line\n";

  }
 
