Changeset 796
- Timestamp:
- 04/26/2011 07:33:03 AM (2 years ago)
- Files:
-
- 1 modified
-
trunk/Decompiler.class.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Decompiler.class.php
r795 r796 742 742 743 743 $this->beginComplexBlock($EX); 744 echo $indent, 'try {', PHP_EOL;744 echo $indent, "try {", PHP_EOL; 745 745 $this->recognizeAndDecompileClosedBlocks($EX, $tryFirst, $tryLast, $indent . INDENT); 746 746 echo $indent, '}', PHP_EOL; … … 750 750 $this->recognizeAndDecompileClosedBlocks($EX, $catchFirst, $catchOpLine, $indent); 751 751 $catchOp = &$opcodes[$catchOpLine]; 752 echo $indent, 'catch (', str($this->getOpVal($catchOp['op1'], $EX)), ' ', str($this->getOpVal($catchOp['op2'], $EX)), ') {', PHP_EOL;752 echo $indent, 'catch (', str($this->getOpVal($catchOp['op1'], $EX)), ' ', str($this->getOpVal($catchOp['op2'], $EX)), ") {", PHP_EOL; 753 753 unset($catchOp); 754 754 … … 761 761 } 762 762 // }}} 763 763 // {{{ switch/case 764 764 if ($firstOp['opcode'] == XC_SWITCH_FREE && isset($T[$firstOp['op1']['var']])) { 765 765 // TODO: merge this code to CASE code. use SWITCH_FREE to detect begin of switch by using $Ts if possible 766 766 $this->beginComplexBlock($EX); 767 echo $indent, 'switch (' . str($this->getOpVal($firstOp['op1'], $EX)) . ') {', PHP_EOL;767 echo $indent, 'switch (', str($this->getOpVal($firstOp['op1'], $EX)), ") {", PHP_EOL; 768 768 echo $indent, '}', PHP_EOL; 769 769 $this->endComplexBlock($EX); … … 806 806 $this->beginComplexBlock($EX); 807 807 808 echo $indent, 'switch (', str($this->getOpVal($caseOp['op1'], $EX, true, true), $EX), ') {', PHP_EOL;808 echo $indent, 'switch (', str($this->getOpVal($caseOp['op1'], $EX, true, true), $EX), ") {", PHP_EOL; 809 809 $caseIsOut = false; 810 810 foreach ($cases as $caseFirst => $caseLast) { … … 860 860 return; 861 861 } 862 862 // }}} 863 // {{{ do/while 863 864 if ($lastOp['opcode'] == XC_JMPNZ && !empty($lastOp['jmpouts']) 864 865 && $lastOp['jmpouts'][0] == $first) { … … 866 867 $this->beginComplexBlock($EX); 867 868 868 echo $indent, 'do {', PHP_EOL;869 echo $indent, "do {", PHP_EOL; 869 870 $this->recognizeAndDecompileClosedBlocks($EX, $first, $last, $indent . INDENT); 870 echo $indent, '} while (', str($this->getOpVal($lastOp['op1'], $EX)), ');', PHP_EOL;871 echo $indent, "} while (", str($this->getOpVal($lastOp['op1'], $EX)), ');', PHP_EOL; 871 872 872 873 $this->endComplexBlock($EX); 873 874 return; 874 875 } 875 876 // }}} 877 878 // {{{ search firstJmpOp 876 879 $firstJmp = null; 877 880 $firstJmpOp = null; … … 883 886 } 884 887 } 885 888 // }}} 889 890 // {{{ while 886 891 if (isset($firstJmpOp) 887 892 && $firstJmpOp['opcode'] == XC_JMPZ … … 897 902 $body = ob_get_clean(); 898 903 899 echo $indent, 'while (', str($this->getOpVal($firstJmpOp['op1'], $EX)), ') {', PHP_EOL;904 echo $indent, 'while (', str($this->getOpVal($firstJmpOp['op1'], $EX)), ") {", PHP_EOL; 900 905 echo $body; 901 906 echo $indent, '}', PHP_EOL; … … 904 909 return; 905 910 } 906 911 // }}} 912 // {{{ foreach 907 913 if (isset($firstJmpOp) 908 914 && $firstJmpOp['opcode'] == XC_FE_FETCH … … 930 936 return; 931 937 } 938 // }}} 932 939 933 940 $this->decompileBasicBlock($EX, $first, $last, $indent);

