summaryrefslogtreecommitdiff
path: root/invert-bitfields.pl
blob: 64f77eb02c95195f069be09c1a869b3259e3d8ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/perl
###############################################################################
##									     ##
##	File:     invert-bitfields.pl					     ##
##	Author:   Wolfgang S. Rupprecht <wolfgang@wsrcc.com>		     ##
##	Created:  Mon Jul 25 01:58:12 PDT 2005				     ##
##	Contents: invert the bitfields                                       ##
##									     ##
##	Copyright (c) 2005 Wolfgang S. Rupprecht.			     ##
##	All rights reserved.						     ##
##									     ##
##	$Id: invert-bitfields.pl,v 1.1 2005/07/25 09:21:19 wolfgang Exp $
###############################################################################

$inside    = 0;
$linestack = "";

while (<>) {
    if (/^[ 	]+uint[ 	]+parity:6;/) {
        $inside = 1;

        # print ">>> starting inside\n";

        $linestack = $_ . $linestack;
    }
    elsif (/^[ 	]+uint[ 	]+_pad:2;/) {
        $inside    = 0;
        $linestack = $_ . $linestack;
        print $linestack;
        $linestack = "";
        # print ">>> starting outside\n";
    }
    else {
        if ($inside) {
            $linestack = $_ . $linestack;
        }
        else {
            print $_;
        }
    }
}

# end