Index: /branches/1.1/admin/config.php.example
===================================================================
--- /branches/1.1/admin/config.php.example	(revision 125)
+++ /branches/1.1/admin/config.php.example	(revision 255)
@@ -16,8 +16,11 @@
 function ob_filter_path_nicer($o)
 {
-	$o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}/", $o);
-	$xcachedir = realpath(dirname(__FILE__) . "/../");
-	$o = str_replace($xcachedir . "/", "{XCache}/", $o);
-	$o = str_replace("/home/", "{H}/", $o);
+	$sep = DIRECTORY_SEPARATOR;
+	$o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}$sep", $o);
+	$xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
+	$o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
+	if ($sep == '/') {
+		$o = str_replace("/home/", "{H}/", $o);
+	}
 	return $o;
 }
Index: /branches/1.1/admin/common.php
===================================================================
--- /branches/1.1/admin/common.php	(revision 134)
+++ /branches/1.1/admin/common.php	(revision 255)
@@ -3,15 +3,25 @@
 function get_language_file_ex($name, $l, $s)
 {
-	static $map = array(
+	static $lmap = array(
 			'zh'    => 'zh-simplified',
 			'zh-hk' => 'zh-traditional',
 			'zh-tw' => 'zh-traditional',
 			);
+	static $smap = array(
+			'gbk'     => 'gb2312',
+			'gb18030' => 'gb2312',
+			);
 
-	if (isset($map[$l])) {
-		$l = $map[$l];
+	if (isset($lmap[$l])) {
+		$l = $lmap[$l];
 	}
 	if (file_exists($file = "$name-$l-$s.lang.php")) {
 		return $file;
+	}
+	if (isset($smap[$s])) {
+		$s = $smap[$s];
+		if (file_exists($file = "$name-$l-$s.lang.php")) {
+			return $file;
+		}
 	}
 	if (file_exists($file = "$name-$l.lang.php")) {
Index: /branches/1.1/mkstructinfo.awk
===================================================================
--- /branches/1.1/mkstructinfo.awk	(revision 52)
+++ /branches/1.1/mkstructinfo.awk	(revision 255)
@@ -3,6 +3,33 @@
 BEGIN {
 	brace = 0;
+	incomment = 0;
 	buffer_len = 0;
 }
+
+# multiline comment handling
+{
+	# removes one line comment
+	gsub(/\/\*(.+?)\*\//, " ");
+}
+/\*\// {
+	if (incomment) {
+		sub(/.*\*\//, "");
+		incomment = 0;
+	}
+}
+incomment {
+	next;
+}
+/\/\*/ {
+	sub(/\/\*.*/, "");
+	incomment = 1;
+	# fall through
+}
+
+# skip file/line mark here to be faster
+/^#/ {
+	next;
+}
+
 /^}.*;/ {
 	if (instruct) {
@@ -51,4 +78,5 @@
 {
 	if (brace == 1 && instruct) {
+		gsub(/(^[\t ]+|[\t ]+$)/, ""); # trim whitespaces
 		sub(/.*[{}]/, "");
 		gsub(/\[[^\]]+\]/, ""); # ignore [...]
@@ -63,4 +91,6 @@
 		}
 		else {
+			# process normal variables
+
 			# ignore any ()s
 			while (gsub(/(\([^)]*\))/, "")) {
@@ -69,13 +99,19 @@
 				next;
 			}
+			# unsigned int *a,  b; int c;
 			gsub(/[*]/, " ");
+			# unsigned int a,  b; int c;
 			gsub(/ +/, " ");
+			# unsigned int a, b; int c;
 			gsub(/ *[,;]/, ";");
+			# unsigned int a; b; int c;
 			if (!match($0, /;/)) {
 				next;
 			}
+			# print "=DEBUG=" $0 "==";
 			split($0, chunks, ";");
-			# get var of "int *var, var;" etc
-			for (i in chunks) {
+			# [unsigned int a, b, c]
+
+			for (i = 1; i in chunks; i ++) {
 				if (chunks[i] == "") {
 					delete chunks[i];
@@ -83,16 +119,27 @@
 				}
 				split(chunks[i], pieces, " ");
+				# [unsigned, int, a]
+				# [b]
+				# [c]
 
-				for (j in pieces) {
+				last_piece = "";
+				for (j = 1; j in pieces; j ++) {
 					last_piece = pieces[j];
-					delete pieces[i];
+					delete pieces[j];
 				}
 				if (last_piece == "") {
-					print "=====" chunks[i];
+					# print "=ERROR=" chunks[i] "==";
+					delete chunks[i];
+					continue;
 				}
+				# a
+				# b
+				# c
+
 				buffer[buffer_len] = last_piece;
 				buffer_len ++;
-				delete chunks[i];
+				delete chunks[i]
 			}
+			last_piece = "";
 		}
 		next;
@@ -105,5 +152,5 @@
 	next;
 }
-/^typedef struct .*\{/ {
+/^typedef struct .*\{[^}]*$/ {
 	brace = 1;
 	instruct = 1;
Index: /branches/1.1/xcache.ini
===================================================================
--- /branches/1.1/xcache.ini	(revision 127)
+++ /branches/1.1/xcache.ini	(revision 255)
@@ -2,4 +2,5 @@
 ;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
 zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
+; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
 ;; For windows users, replace xcache.so with php_xcache.dll
 zend_extension_ts = c:/php/extensions/php_xcache.dll
@@ -19,7 +20,10 @@
 [xcache]
 ; ini only settings, all the values here is default unless explained
+
+; select low level shm/allocator scheme implemenation
+xcache.shm_scheme =        "mmap"
 ; to disable: xcache.size=0
-; to enable : xcache.size=any size > 0 and your system mmap allows
-xcache.size =                  0
+; to enable : xcache.size=64M etc (any size > 0) and your system mmap allows
+xcache.size  =                0M
 ; set to cpu count (cat /proc/cpuinfo |grep -c processor)
 xcache.count =                 1
@@ -32,5 +36,5 @@
 
 ; same as aboves but for variable cache
-xcache.var_size  =             0
+xcache.var_size  =            0M
 xcache.var_count =             1
 xcache.var_slots =            8K
Index: /branches/1.1/mmap.c
===================================================================
--- /branches/1.1/mmap.c	(revision 148)
+++ /branches/1.1/mmap.c	(revision 255)
@@ -85,8 +85,8 @@
 {
 	if (shm->diff) {
-		assert(xc_mmap_is_readonly(p));
+		assert(xc_mmap_is_readonly(shm, p));
 		p = PTR_SUB(p, shm->diff);
 	}
-	assert(xc_mmap_is_readwrite(p));
+	assert(xc_mmap_is_readwrite(shm, p));
 	return p;
 }
@@ -94,8 +94,8 @@
 static XC_SHM_TO_READONLY(xc_mmap_to_readonly) /* {{{ */
 {
-	assert(xc_shm_is_readwrite(p));
+	assert(xc_mmap_is_readwrite(shm, p));
 	if (shm->diff) {
 		p = PTR_ADD(p, shm->diff);
-		assert(xc_mmap_is_readonly(p));
+		assert(xc_mmap_is_readonly(shm, p));
 	}
 	return p;
Index: /branches/1.1/coverager/common-zh-simplified-gb2312.lang.php
===================================================================
--- /branches/1.1/coverager/common-zh-simplified-gb2312.lang.php	(revision 255)
+++ /branches/1.1/coverager/common-zh-simplified-gb2312.lang.php	(revision 255)
@@ -0,0 +1,25 @@
+<?php
+
+$strings = array(
+		'root'
+		=> '��ʼ',
+		'Directory'
+		=> 'Ŀ¼',
+		'File'
+		=> '�ļ�',
+		'Percent'
+		=> '������',
+		'Hits'
+		=> '����',
+		'Lines'
+		=> '����',
+		'TODO'
+		=> '�����ļ�',
+		'XCache PHP Code Coverage Viewer'
+		=> 'XCache PHP ���븲�ǲ鿴��',
+		'module'
+		=> 'ģ��',
+		''
+		=> '',
+		);
+
Index: /branches/1.1/coverager/common.php
===================================================================
--- /branches/1.1/coverager/common.php	(revision 134)
+++ /branches/1.1/coverager/common.php	(revision 255)
@@ -3,15 +3,25 @@
 function get_language_file_ex($name, $l, $s)
 {
-	static $map = array(
+	static $lmap = array(
 			'zh'    => 'zh-simplified',
 			'zh-hk' => 'zh-traditional',
 			'zh-tw' => 'zh-traditional',
 			);
+	static $smap = array(
+			'gbk'     => 'gb2312',
+			'gb18030' => 'gb2312',
+			);
 
-	if (isset($map[$l])) {
-		$l = $map[$l];
+	if (isset($lmap[$l])) {
+		$l = $lmap[$l];
 	}
 	if (file_exists($file = "$name-$l-$s.lang.php")) {
 		return $file;
+	}
+	if (isset($smap[$s])) {
+		$s = $smap[$s];
+		if (file_exists($file = "$name-$l-$s.lang.php")) {
+			return $file;
+		}
 	}
 	if (file_exists($file = "$name-$l.lang.php")) {
Index: /branches/1.1/coverager/coverager.tpl.php
===================================================================
--- /branches/1.1/coverager/coverager.tpl.php	(revision 145)
+++ /branches/1.1/coverager/coverager.tpl.php	(revision 255)
@@ -2,5 +2,4 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<meta http-equiv="Content-Language" content="en-us" />
 <?php
 echo <<<HEAD
@@ -68,4 +67,5 @@
 	global $cycle;
 	if ($info['files'] || $info['todos']) {
+		$srcdir .= DIRECTORY_SEPARATOR;
 		$c = $cycle->next();
 		$srcdir_html = htmlspecialchars($srcdir);
Index: /branches/1.1/coverager/coverager.php
===================================================================
--- /branches/1.1/coverager/coverager.php	(revision 124)
+++ /branches/1.1/coverager/coverager.php	(revision 255)
@@ -62,5 +62,7 @@
 		$this->path = isset($_GET['path']) ? $_GET['path'] : '';
 		$this->path = preg_replace('!\.{2,}!', '.', $this->path);
-		$this->path = preg_replace('![\\\\/]{2,}!', '/', $this->path);
+		$qsep = preg_quote(DIRECTORY_SEPARATOR, '!');
+		$this->path = preg_replace("![\\\\$qsep]{2,}!", DIRECTORY_SEPARATOR, $this->path);
+		$this->path = preg_replace("!$qsep$!", '', $this->path);
 		if ($this->path == '/') {
 			$this->path = '';
@@ -118,5 +120,5 @@
 			list($tplfile, $tpllines, $tplcov) = $this->loadTplCov($fileinfo['cov'], substr($this->outpath, $this->datadir_len));
 			if ($tplfile) {
-				$tplcov = sprint_cov($tplinfo['tplcov'], $tpllines);
+				$tplcov = sprint_cov($tplcov, $tpllines);
 				unset($tpllines);
 			}
Index: /branches/1.1/coverager/config.php.example
===================================================================
--- /branches/1.1/coverager/config.php.example	(revision 124)
+++ /branches/1.1/coverager/config.php.example	(revision 255)
@@ -21,8 +21,11 @@
 function ob_filter_path_nicer($o)
 {
-	$o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}/", $o);
-	$xcachedir = realpath(dirname(__FILE__) . "/../");
-	$o = str_replace($xcachedir . "/", "{XCache}/", $o);
-	$o = str_replace("/home/", "{H}/", $o);
+	$sep = DIRECTORY_SEPARATOR;
+	$o = str_replace($_SERVER['DOCUMENT_ROOT'],  "{DOCROOT}$sep", $o);
+	$xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
+	$o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
+	if ($sep == '/') {
+		$o = str_replace("/home/", "{H}/", $o);
+	}
 	return $o;
 }
Index: /branches/1.1/processor/processor.m4
===================================================================
--- /branches/1.1/processor/processor.m4	(revision 253)
+++ /branches/1.1/processor/processor.m4	(revision 255)
@@ -56,4 +56,7 @@
 dnl {{{ zend_brk_cont_element
 DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `
+#ifdef ZEND_ENGINE_2_2
+	DISPATCH(int, start)
+#endif
 	DISPATCH(int, cont)
 	DISPATCH(int, brk)
Index: /branches/1.1/processor/head.m4
===================================================================
--- /branches/1.1/processor/head.m4	(revision 148)
+++ /branches/1.1/processor/head.m4	(revision 255)
@@ -54,6 +54,6 @@
 #define MAX_DUP_STR_LEN 256
 dnl }}}
-/* export: typedef struct _processor_t processor_t; :export {{{ */
-struct _processor_t {
+/* export: typedef struct _xc_processor_t xc_processor_t; :export {{{ */
+struct _xc_processor_t {
 	char *p;
 	zend_uint size;
@@ -117,5 +117,5 @@
 /* {{{ xc_calc_string_n */
 REDEF(`KIND', `calc')
-static inline void xc_calc_string_n(processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) {
+static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) {
 	pushdef(`__LINE__', `relayline')
 	int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
@@ -139,5 +139,5 @@
 /* {{{ xc_store_string_n */
 REDEF(`KIND', `store')
-static inline zstr xc_store_string_n(processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) {
+static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, zstr str, long size IFASSERT(`, int relayline')) {
 	pushdef(`__LINE__', `relayline')
 	int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
@@ -166,5 +166,5 @@
  * return class_index + 1
  */
-static zend_ulong xc_get_class_num(processor_t *processor, zend_class_entry *ce) {
+static zend_ulong xc_get_class_num(xc_processor_t *processor, zend_class_entry *ce) {
 	zend_ulong i;
 	const xc_entry_t *xce = processor->xce_src;
@@ -188,5 +188,5 @@
 /* {{{ xc_get_class */
 #ifdef ZEND_ENGINE_2
-static zend_class_entry *xc_get_class(processor_t *processor, zend_ulong class_num) {
+static zend_class_entry *xc_get_class(xc_processor_t *processor, zend_ulong class_num) {
 	/* must be parent or currrent class */
 	assert(class_num <= processor->active_class_num);
@@ -197,5 +197,5 @@
 #ifdef ZEND_ENGINE_2
 /* fix method on store */
-static void xc_fix_method(processor_t *processor, zend_op_array *dst) /* {{{ */
+static void xc_fix_method(xc_processor_t *processor, zend_op_array *dst) /* {{{ */
 {
 	zend_function *zf = (zend_function *) dst;
@@ -251,5 +251,5 @@
 xc_entry_t *xc_processor_store_xc_entry_t(xc_entry_t *src TSRMLS_DC) {
 	xc_entry_t *dst;
-	processor_t processor;
+	xc_processor_t processor;
 
 	memset(&processor, 0, sizeof(processor));
@@ -324,5 +324,5 @@
 /* export: xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src, zend_bool readonly_protection TSRMLS_DC); :export {{{ */
 xc_entry_t *xc_processor_restore_xc_entry_t(xc_entry_t *dst, const xc_entry_t *src, zend_bool readonly_protection TSRMLS_DC) {
-	processor_t processor;
+	xc_processor_t processor;
 
 	memset(&processor, 0, sizeof(processor));
@@ -335,5 +335,5 @@
 /* export: zval *xc_processor_restore_zval(zval *dst, const zval *src TSRMLS_DC); :export {{{ */
 zval *xc_processor_restore_zval(zval *dst, const zval *src TSRMLS_DC) {
-	processor_t processor;
+	xc_processor_t processor;
 
 	memset(&processor, 0, sizeof(processor));
Index: /branches/1.1/processor/struct.m4
===================================================================
--- /branches/1.1/processor/struct.m4	(revision 93)
+++ /branches/1.1/processor/struct.m4	(revision 255)
@@ -9,7 +9,7 @@
 	FUNC_NAME`'(
 		IFDPRINT( `const $1 * const src, int indent')
-		IFCALC(   `processor_t *processor, const $1 * const src')
-		IFSTORE(  `processor_t *processor, $1 *dst, const $1 * const src')
-		IFRESTORE(`processor_t *processor, $1 *dst, const $1 * const src')
+		IFCALC(   `xc_processor_t *processor, const $1 * const src')
+		IFSTORE(  `xc_processor_t *processor, $1 *dst, const $1 * const src')
+		IFRESTORE(`xc_processor_t *processor, $1 *dst, const $1 * const src')
 		IFDASM(   `zval *dst, const $1 * const src')
 		IFASM(    `$1 *dst, const $1 * const src')
Index: /branches/1.1/THANKS
===================================================================
--- /branches/1.1/THANKS	(revision 135)
+++ /branches/1.1/THANKS	(revision 255)
@@ -3,5 +3,5 @@
 Alex <ale@freebsd.org>, redist to FreeBSD
 darix <darix@irssi.org>, redist to openSUSE
-judas_iscariote <darix@irssi.org>, redist/test with openSUSE
+judas_iscariote <judas.iscariote@gmail.com>, redist/test with openSUSE
 Finjon Kiang <kiange@gmail.com>, Chinese Traditional translation
 
Index: /branches/1.1/coverager.c
===================================================================
--- /branches/1.1/coverager.c	(revision 90)
+++ /branches/1.1/coverager.c	(revision 255)
@@ -235,4 +235,5 @@
 			zend_hash_move_forward(XG(coverages));
 		}
+		efree(outfilename);
 	}
 
Index: /branches/1.1/NEWS
===================================================================
--- /branches/1.1/NEWS	(revision 247)
+++ /branches/1.1/NEWS	(revision 255)
@@ -31,4 +31,6 @@
 
 Others:
+ * fix build on rare arch
+ * fix build on Mac OS X
  * kill compiler warnings
  * zts build
@@ -37,4 +39,9 @@
 ChangeLog
 ========
+ * merged from trunk: 159,161-162,167-180,182,184,186-187,194
+   * [194] PHP_5_2: new element in zend_brk_cont_element
+   * [186] [187] fix build on some rare arch
+   * [184] fix tplcov
+   * [178] fix type processor_t conflict with Mac OS X
  * remove redundant open_basedir check, it's done before compiling
  * trick in_compilation state, don't trigger __autoload at compile time
Index: /branches/1.1/config.m4
===================================================================
--- /branches/1.1/config.m4	(revision 148)
+++ /branches/1.1/config.m4	(revision 255)
@@ -59,6 +59,17 @@
 
   AC_PATH_PROGS([AWK], [gawk awk])
+  dnl clean locale for gawk 3.1.5 assertion bug
+  if echo | LANG=C "$AWK" -- '' > /dev/null 2>&1 ; then
+    AWK="LANG=C $AWK"
+  else
+    if echo | /usr/bin/env - "$AWK" -- '' > /dev/null 2>&1 ; then
+      AWK="/usr/bin/env - $AWK"
+    fi
+  fi
   PHP_SUBST([AWK])
   AC_PATH_PROGS([M4], [m4])
+  if echo | "$M4" -E > /dev/null 2>&1 ; then
+    M4="$M4 -E"
+  fi
   PHP_SUBST([M4])
   AC_PATH_PROGS([GREP], [grep])
Index: /branches/1.1/xcache-zh-gb2312.ini
===================================================================
--- /branches/1.1/xcache-zh-gb2312.ini	(revision 149)
+++ /branches/1.1/xcache-zh-gb2312.ini	(revision 255)
@@ -20,7 +20,10 @@
 [xcache]
 ; ����Ķ���ѡ����� ini ������޸�, �����г��Ķ���Ĭ��ֵ, ��������˵��
+
+; select low level shm/allocator scheme implemenation
+xcache.shm_scheme =        "mmap"
 ; ����: xcache.size=0
-; ����: xcache.size=����>0��ֵ, ͬʱ��ע������ϵͳ mmap ����
-xcache.size =                  0
+; ����: xcache.size=64M ֮�� (����>0��ֵ) ͬʱ��ע������ϵͳ mmap ����
+xcache.size  =                0M
 ; ��������Ϊ cpu �� (cat /proc/cpuinfo |grep -c processor)
 xcache.count =                 1
@@ -33,5 +36,5 @@
 
 ; ͬ��, ֻ����Ա�����������
-xcache.var_size  =             0
+xcache.var_size  =            0M
 xcache.var_count =             1
 xcache.var_slots =            8K
@@ -59,4 +62,5 @@
 
 xcache.cacher =               On
+xcache.stat   =               On
 xcache.optimizer =           Off
 
