| OLD | NEW | 
|---|
| 1 #!/usr/bin/env perl | 1 #!/usr/bin/env perl | 
| 2 ## | 2 ## | 
| 3 ##  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 3 ##  Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 
| 4 ## | 4 ## | 
| 5 ##  Use of this source code is governed by a BSD-style license | 5 ##  Use of this source code is governed by a BSD-style license | 
| 6 ##  that can be found in the LICENSE file in the root of the source | 6 ##  that can be found in the LICENSE file in the root of the source | 
| 7 ##  tree. An additional intellectual property rights grant can be found | 7 ##  tree. An additional intellectual property rights grant can be found | 
| 8 ##  in the file PATENTS.  All contributing project authors may | 8 ##  in the file PATENTS.  All contributing project authors may | 
| 9 ##  be found in the AUTHORS file in the root of the source tree. | 9 ##  be found in the AUTHORS file in the root of the source tree. | 
| 10 ## | 10 ## | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
| 34 sub trim($) | 34 sub trim($) | 
| 35 { | 35 { | 
| 36     my $string = shift; | 36     my $string = shift; | 
| 37     $string =~ s/^\s+//; | 37     $string =~ s/^\s+//; | 
| 38     $string =~ s/\s+$//; | 38     $string =~ s/\s+$//; | 
| 39     return $string; | 39     return $string; | 
| 40 } | 40 } | 
| 41 | 41 | 
| 42 while (<STDIN>) | 42 while (<STDIN>) | 
| 43 { | 43 { | 
|  | 44     # Load and store alignment | 
|  | 45     s/@/,:/g; | 
|  | 46 | 
| 44     # Comment character | 47     # Comment character | 
| 45     s/;/@/g; | 48     s/;/@/g; | 
| 46 | 49 | 
| 47     # Hexadecimal constants prefaced by 0x | 50     # Hexadecimal constants prefaced by 0x | 
| 48     s/#&/#0x/g; | 51     s/#&/#0x/g; | 
| 49 | 52 | 
| 50     # Convert :OR: to | | 53     # Convert :OR: to | | 
| 51     s/:OR:/ | /g; | 54     s/:OR:/ | /g; | 
| 52 | 55 | 
| 53     # Convert :AND: to & | 56     # Convert :AND: to & | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 90         s/=/==/g; | 93         s/=/==/g; | 
| 91     } | 94     } | 
| 92 | 95 | 
| 93     # Convert INCLUDE to .INCLUDE "file" | 96     # Convert INCLUDE to .INCLUDE "file" | 
| 94     s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/; | 97     s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/; | 
| 95 | 98 | 
| 96     # Code directive (ARM vs Thumb) | 99     # Code directive (ARM vs Thumb) | 
| 97     s/CODE([0-9][0-9])/.code $1/; | 100     s/CODE([0-9][0-9])/.code $1/; | 
| 98 | 101 | 
| 99     # No AREA required | 102     # No AREA required | 
| 100     s/^\s*AREA.*$/.text/; | 103     # But ALIGNs in AREA must be obeyed | 
|  | 104     s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/; | 
|  | 105     # If no ALIGN, strip the AREA and align to 4 bytes | 
|  | 106     s/^\s*AREA.*$/.text\n.p2align 2/; | 
| 101 | 107 | 
| 102     # DCD to .word | 108     # DCD to .word | 
| 103     # This one is for incoming symbols | 109     # This one is for incoming symbols | 
| 104     s/DCD\s+\|(\w*)\|/.long $1/; | 110     s/DCD\s+\|(\w*)\|/.long $1/; | 
| 105 | 111 | 
| 106     # DCW to .short | 112     # DCW to .short | 
| 107     s/DCW\s+\|(\w*)\|/.short $1/; | 113     s/DCW\s+\|(\w*)\|/.short $1/; | 
| 108     s/DCW(.*)/.short $1/; | 114     s/DCW(.*)/.short $1/; | 
| 109 | 115 | 
| 110     # Constants defined in scope | 116     # Constants defined in scope | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 130 | 136 | 
| 131     # No vertical bars required; make additional symbol with prepended | 137     # No vertical bars required; make additional symbol with prepended | 
| 132     # underscore | 138     # underscore | 
| 133     s/^\|(\$?\w+)\|/_$1\n\t$1:/g; | 139     s/^\|(\$?\w+)\|/_$1\n\t$1:/g; | 
| 134 | 140 | 
| 135     # Labels need trailing colon | 141     # Labels need trailing colon | 
| 136 #   s/^(\w+)/$1:/ if !/EQU/; | 142 #   s/^(\w+)/$1:/ if !/EQU/; | 
| 137     # put the colon at the end of the line in the macro | 143     # put the colon at the end of the line in the macro | 
| 138     s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/; | 144     s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/; | 
| 139 | 145 | 
| 140     # Strip ALIGN | 146     # ALIGN directive | 
| 141     s/\sALIGN/@ ALIGN/g; | 147     s/ALIGN/.balign/g; | 
| 142 | 148 | 
| 143     # Strip ARM | 149     # Strip ARM | 
| 144     s/\sARM/@ ARM/g; | 150     s/\sARM/@ ARM/g; | 
| 145 | 151 | 
| 146     # Strip REQUIRE8 | 152     # Strip REQUIRE8 | 
| 147     #s/\sREQUIRE8/@ REQUIRE8/g; | 153     #s/\sREQUIRE8/@ REQUIRE8/g; | 
| 148     s/\sREQUIRE8/@ /g; | 154     s/\sREQUIRE8/@ /g; | 
| 149 | 155 | 
| 150     # Strip PRESERVE8 | 156     # Strip PRESERVE8 | 
| 151     s/\sPRESERVE8/@ PRESERVE8/g; | 157     s/\sPRESERVE8/@ PRESERVE8/g; | 
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 186         $key =~ s/\$/\\\$/; | 192         $key =~ s/\$/\\\$/; | 
| 187         s/$key\b/$value/g; | 193         s/$key\b/$value/g; | 
| 188     } | 194     } | 
| 189 | 195 | 
| 190     # For macros, use \ to reference formal params | 196     # For macros, use \ to reference formal params | 
| 191 #   s/\$/\\/g;                  # End macro definition | 197 #   s/\$/\\/g;                  # End macro definition | 
| 192     s/MEND/.endm/;              # No need to tell it where to stop assembling | 198     s/MEND/.endm/;              # No need to tell it where to stop assembling | 
| 193     next if /^\s*END\s*$/; | 199     next if /^\s*END\s*$/; | 
| 194     print; | 200     print; | 
| 195 } | 201 } | 
| OLD | NEW | 
|---|