Annotation of linux/boot/gas-convert, revision 1.1.1.1

1.1       root        1: #!/afs/net/tools/@sys/perl
                      2: #
                      3: #
                      4: 
                      5: $in_block_comment = 0;
                      6: 
                      7: while (<>) {
                      8:        if (/^\|/) {
                      9:                if (! $in_block_comment) {
                     10:                        print "/* \n";
                     11:                        $in_block_comment = 1;
                     12:                }
                     13:                s/\|/ */;
                     14:                print;
                     15:                next;
                     16:        } else {
                     17:                if ($in_block_comment) {
                     18:                        print " */\n";
                     19:                        $in_block_comment = 0;
                     20:                }
                     21:        }
                     22:                        
                     23:        s/#/$/;         # Convert immediate references
                     24:        s/\|/#/;        # Convert in-line comments
                     25: 
                     26:        s/(\b|,)([abcd][xhl])(\b|,|$)/\1%\2\3/g;
                     27:        s/(\b|,)([cdsefg]s)(\b|,|$)/\1%\2\3/g;
                     28:        s/(\b|,)([sd]i)(\b|,|$)/\1%\2\3/g;
                     29:        s/(\b|,)([sb]p)(\b|,|$)/\1%\2\3/g;
                     30:        s/(\b|,)(e[abcd]x)(\b|,|$)/\1%\2\3/g;
                     31: 
                     32:        if (/^(([a-zA-Z]+:[ \t]+)|[ \t]+)([a-zA-Z]+)/) {
                     33:                $op = $3;
                     34:                if (($op eq "mov") || ($op eq "add") || ($op eq "sub") ||
                     35:                    ($op eq "xor") || ($op eq "and") || ($op eq "shr") ||
                     36:                    ($op eq "shl") || ($op eq "in")  || ($op eq "out")) {
                     37:                        #
                     38:                        # We need to swap arguments...
                     39:                        #
                     40:                        s/([0-9a-zA-Z%\$]+)(,)([0-9a-zA-Z%\$]+)/\3\2\1/;
                     41:                }
                     42:        }
                     43:        
                     44:        print;
                     45: }
                     46: 
                     47: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.