|
Revision 394, 1.3 kB
(checked in by moo, 19 months ago)
|
|
merged [393] from trunk: svn:eol-style
|
-
Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 | #! /usr/bin/awk -f |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | BEGIN { |
|---|
| 5 | FS=" " |
|---|
| 6 | max = 0; |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | /^ZEND_VM_HANDLER\(/ { |
|---|
| 10 | |
|---|
| 11 | gsub(/ +/, ""); |
|---|
| 12 | if (!match($0, /^ZEND_VM_HANDLER\(([0-9]+),([A-Z_]+),([A-Z|]+),([A-Z|]+)\)/)) { |
|---|
| 13 | print "error unmatch $0"; |
|---|
| 14 | exit; |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | sub(/^ZEND_VM_HANDLER\(/, ""); |
|---|
| 18 | id = $0; |
|---|
| 19 | sub(/,.*/, "", id); |
|---|
| 20 | id = 0 + id; |
|---|
| 21 | sub(/^([0-9]+),/, ""); |
|---|
| 22 | sub(/,.*/, ""); |
|---|
| 23 | name = $0; |
|---|
| 24 | if (max < id) { |
|---|
| 25 | max = id; |
|---|
| 26 | } |
|---|
| 27 | opcodes[id] = name; |
|---|
| 28 | next; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | /^ |
|---|
| 32 | id = 0 + $3; |
|---|
| 33 | name = $2; |
|---|
| 34 | if (max < id) { |
|---|
| 35 | max = id; |
|---|
| 36 | } |
|---|
| 37 | opcodes[id] = name; |
|---|
| 38 | next; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | /end of block/ { |
|---|
| 42 | exit; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | END { |
|---|
| 46 | mymax = 112; |
|---|
| 47 | if (max < mymax) { |
|---|
| 48 | for (i = max + 1; i <= mymax; i ++) { |
|---|
| 49 | opcodes[i] = "UNDEF"; |
|---|
| 50 | } |
|---|
| 51 | max = mymax; |
|---|
| 52 | opcodes[110] = "ZEND_DO_FCALL_BY_FUNC"; |
|---|
| 53 | opcodes[111] = "ZEND_INIT_FCALL_BY_FUNC"; |
|---|
| 54 | opcodes[112] = "UNDEF"; |
|---|
| 55 | } |
|---|
| 56 | printf "/* size = %d */\n", max; |
|---|
| 57 | print "static const char *const xc_opcode_names[] = {"; |
|---|
| 58 | for (i = 0; i <= max; i ++) { |
|---|
| 59 | if (i != 0) { |
|---|
| 60 | print ","; |
|---|
| 61 | } |
|---|
| 62 | printf "/* %d */\t", i |
|---|
| 63 | if (i in opcodes) { |
|---|
| 64 | name = opcodes[i]; |
|---|
| 65 | sub(/^ZEND_/, "", name); |
|---|
| 66 | printf "\"%s\"", name; |
|---|
| 67 | } |
|---|
| 68 | else if (i == 137) { |
|---|
| 69 | printf "\"%s\"", "OP_DATA"; |
|---|
| 70 | } |
|---|
| 71 | else { |
|---|
| 72 | printf "\"UNDEF\""; |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | print ""; |
|---|
| 76 | print "};"; |
|---|
| 77 | } |
|---|