Index: /trunk/Decompiler.class.php
===================================================================
--- /trunk/Decompiler.class.php	(revision 760)
+++ /trunk/Decompiler.class.php	(revision 761)
@@ -71,5 +71,5 @@
 }
 // }}}
-function unquoteName_($str, $asProperty, $indent = '') // {{{
+function unquoteName_($str, $asVariableName, $indent = '') // {{{
 {
 	$str = str($str, $indent);
@@ -77,5 +77,5 @@
 		return str_replace('\\\\', '\\', substr($str, 1, -1));
 	}
-	else if ($asProperty) {
+	else if ($asVariableName) {
 		return "{" . $str . "}";
 	}
@@ -85,5 +85,5 @@
 }
 // }}}
-function unquoteProperty($str, $indent = '') // {{{
+function unquoteVariableName($str, $indent = '') // {{{
 {
 	return unquoteName_($str, true, $indent);
@@ -247,5 +247,5 @@
 		foreach ($this->offsets as $i => $dim) {
 			if ($this->isObject && $i == $last) {
-				$exp .= '->' . unquoteProperty($dim, $indent);
+				$exp .= '->' . unquoteVariableName($dim, $indent);
 			}
 			else {
@@ -437,4 +437,18 @@
 	function Decompiler()
 	{
+		// {{{ testing
+		// XC_UNDEF XC_OP_DATA
+		$this->test = !empty($_ENV['XCACHE_DECOMPILER_TEST']);
+		$this->usedOps = array();
+
+		if ($this->test) {
+			$content = file_get_contents(__FILE__);
+			for ($i = 0; $opname = xcache_get_opcode($i); $i ++) {
+				if (!preg_match("/\\bXC_" . $opname . "\\b(?!')/", $content)) {
+					echo "not recognized opcode ", $opname, "\n";
+				}
+			}
+		}
+		// }}}
 		// {{{ opinfo
 		$this->unaryops = array(
@@ -619,4 +633,5 @@
 			$last = count($opcodes) - 1;
 			if ($opcodes[$last]['opcode'] == XC_HANDLE_EXCEPTION) {
+				$this->usedOps[XC_HANDLE_EXCEPTION] = true;
 				unset($opcodes[$last]);
 				--$last;
@@ -882,4 +897,5 @@
 			$opc = $op['opcode'];
 			if ($opc == XC_NOP) {
+				$this->usedOps[$opc] = true;
 				continue;
 			}
@@ -911,7 +927,9 @@
 			$call = array(&$this, $opname);
 			if (is_callable($call)) {
+				$this->usedOps[$opc] = true;
 				$this->{$opname}($op, $EX);
 			}
 			else if (isset($this->binops[$opc])) { // {{{
+				$this->usedOps[$opc] = true;
 				$op1val = $this->getOpVal($op1, $EX, false);
 				$op2val = $this->getOpVal($op2, $EX, false);
@@ -921,4 +939,5 @@
 			}
 			else if (isset($this->unaryops[$opc])) { // {{{
+				$this->usedOps[$opc] = true;
 				$op1val = $this->getOpVal($op1, $EX);
 				$myop = $this->unaryops[$opc];
@@ -928,4 +947,5 @@
 			}
 			else {
+				$covered = true;
 				switch ($opc) {
 				case XC_NEW: // {{{
@@ -1165,5 +1185,5 @@
 						$obj = '$this';
 					}
-					$rvalue = str($obj) . "->" . unquoteProperty($this->getOpVal($op2, $EX), $EX);
+					$rvalue = str($obj) . "->" . unquoteVariableName($this->getOpVal($op2, $EX), $EX);
 					if ($res['op_type'] != XC_IS_UNUSED) {
 						$resvar = $rvalue;
@@ -1182,11 +1202,5 @@
 				case XC_ISSET_ISEMPTY_VAR: // {{{
 					if ($opc == XC_ISSET_ISEMPTY_VAR) {
-						$rvalue = $this->getOpVal($op1, $EX);;
-						if (preg_match($this->rQuotedName, $rvalue)) {
-							$rvalue = '$' . substr($rvalue, 1, -1);
-						}
-						else {
-							$rvalue = '${' . $rvalue . '}';
-						}
+						$rvalue = $this->getOpVal($op1, $EX);
 						if ($op2['EA.type'] == ZEND_FETCH_STATIC_MEMBER) {
 							$class = $this->getOpVal($op2, $EX);
@@ -1201,13 +1215,11 @@
 						$dim = $this->getOpVal($op2, $EX);
 						if ($opc == XC_ISSET_ISEMPTY_PROP_OBJ) {
-							if (preg_match($this->rQuotedName, $dim)) {
-								$rvalue = $container . "->" . substr($dim, 1, -1);
+							if (!isset($container)) {
+								$container = '$this';
 							}
-							else {
-								$rvalue = $container . "->{" . $dim . "}";
-							}
+							$rvalue = $container . "->" . unquoteVariableName($dim);
 						}
 						else {
-							$rvalue = $container . "[$dim]";
+							$rvalue = $container . '[' . str($dim) .']';
 						}
 					}
@@ -1357,4 +1369,5 @@
 							break;
 						}
+						$this->usedOps[XC_ADD_INTERFACE] = true;
 
 						$fetchop = &$opcodes[$i + 1];
@@ -1402,5 +1415,5 @@
 				case XC_PRINT: // {{{
 					$op1val = $this->getOpVal($op1, $EX);
-					$resvar = "print($op1val)";
+					$resvar = "print(" . str($op1val) . ")";
 					break;
 					// }}}
@@ -1584,5 +1597,5 @@
 					$flags = array_flip(explode('_', $opname));
 					if (isset($flags['OBJ'])) {
-						$resvar = $this->getOpVal($op1, $EX) . '->' . unquoteProperty($this->getOpVal($op2, $EX), $EX);
+						$resvar = $this->getOpVal($op1, $EX) . '->' . unquoteVariableName($this->getOpVal($op2, $EX), $EX);
 					}
 					else {
@@ -1661,5 +1674,9 @@
 				default: // {{{
 					echo "\x1B[31m * TODO ", $opname, "\x1B[0m\n";
-					// }}}
+					$covered = false;
+					// }}}
+				}
+				if ($covered) {
+					$this->usedOps[$opc] = true;
 				}
 			}
@@ -2079,5 +2096,22 @@
 		$this->dop_array($this->dc['op_array']);
 		echo "\n?" . ">\n";
+
+		if (!empty($this->test)) {
+			$this->outputUnusedOp();
+		}
 		return true;
+	}
+	// }}}
+	function outputUnusedOp() // {{{
+	{
+		for ($i = 0; $opname = xcache_get_opcode($i); $i ++) {
+			if ($opname == 'UNDEF')  {
+				continue;
+			}
+
+			if (!isset($this->usedOps[$i])) {
+				echo "not covered opcode ", $opname, "\n";
+			}
+		}
 	}
 	// }}}
@@ -2187,8 +2221,8 @@
 define('IS_LONG',     1);
 define('IS_DOUBLE',   2);
-define('IS_STRING',   3);
+define('IS_BOOL',     ZEND_ENGINE_2 ? 3 : 6);
 define('IS_ARRAY',    4);
 define('IS_OBJECT',   5);
-define('IS_BOOL',     6);
+define('IS_STRING',   ZEND_ENGINE_2 ? 6 : 3);
 define('IS_RESOURCE', 7);
 define('IS_CONSTANT', 8);
@@ -2257,13 +2291,4 @@
 	}
 }
-
-//* XC_UNDEF XC_OP_DATA
-$content = file_get_contents(__FILE__);
-for ($i = 0; $opname = xcache_get_opcode($i); $i ++) {
-	if (!preg_match("/\\bXC_" . $opname . "\\b(?!')/", $content)) {
-		echo "not done ", $opname, "\n";
-	}
-}
-// */
 // }}}
 
Index: /trunk/decompilesample.php
===================================================================
--- /trunk/decompilesample.php	(revision 760)
+++ /trunk/decompilesample.php	(revision 761)
@@ -206,4 +206,48 @@
 $a = $b xor $c;
 $a = !$b;
+$a = $b === $c;
+$a = $b !== $c;
+$a = $b << 2;
+$a = $b >> 3;
+$a += $b;
+$a -= $b;
+$a *= $b;
+$a /= $b;
+$a <<= $b;
+$a >>= $b;
+$a &= $b;
+$a |= $b;
+$a .= $b;
+$a %= $b;
+$a ^= $b;
+$a = 'a' . 'b';
+$a = 'a' . 'abc';
+@f1();
+print('1');
+ref(&$a);
+$a = $array['index'];
+$a = $object->prop;
+$a = $this->prop;
+$array['index'] = 1;
+$object->prop = 1;
+$this->prop = 1;
+$a = isset($b);
+$a = empty($b);
+$a = isset($array['index']);
+$a = empty($array['index']);
+$a = isset($object->prop);
+$a = empty($object->prop);
+$a = isset($this->prop);
+$a = empty($this->prop);
+$a = (int) $b;
+$a = (double) $b;
+$a = (string) $b;
+$a = (array) $b;
+$a = (object) $b;
+$a = (bool) $b;
+$a = (unset) $b;
+$a = (array) $b;
+$a = (object) $b;
+// PHP6+ $a = (scalar) $b;
 $a = $b ? $c : $d;
 $a = f1() ? f2() : f3();
@@ -323,4 +367,5 @@
 };
 // */
+exit();
 
 ?>
