Index: /trunk/processor/head.m4
===================================================================
--- /trunk/processor/head.m4	(revision 994)
+++ /trunk/processor/head.m4	(revision 998)
@@ -13,5 +13,5 @@
 #include "util/xc_align.h"
 #include "xcache/xc_const_string.h"
-#include "xcache/xc_processor.h"
+#include "xc_processor.h"
 #include "xcache_globals.h"
 
Index: /trunk/xcache/xc_mem.c
===================================================================
--- /trunk/xcache/xc_mem.c	(revision 989)
+++ /trunk/xcache/xc_mem.c	(revision 998)
@@ -1,8 +1,11 @@
 #ifdef TEST
-#include <limits.h>
-#include <stdio.h>
+#	include <limits.h>
+#	include <stdio.h>
 #	define XCACHE_DEBUG
+typedef int zend_bool;
+#	define ZEND_ATTRIBUTE_PTR_FORMAT(a, b, c)
+#	define zend_error(type, error) fprintf(stderr, "%s", error)
 #else
-#include <php.h>
+#	include <php.h>
 #endif
 
@@ -18,5 +21,5 @@
 #define XC_MEM_IMPL _xc_mem_mem_t
 #include "xc_shm.h"
-#include "xc_utils.h"
+// #include "xc_utils.h"
 #include "util/xc_align.h"
 #include "util/xc_trace.h"
@@ -323,5 +326,10 @@
 /* {{{ testing */
 #undef CHECK
-#define CHECK(a, msg) do { if ((a) == NULL) { puts(msg); return -1; } } while (0)
+#define CHECK(a, msg) do { \
+	if (!(a)) { \
+		fprintf(stderr, "%s\n", msg); return -1; \
+	} \
+} while (0)
+
 #include <time.h>
 
@@ -331,6 +339,6 @@
 	void *p;
 	void *memory;
-	xc_mem_t *mem;
 	void **ptrs;
+	xc_mem_t mem_holder, *mem = &mem_holder;
 	int size, i;
 
@@ -342,8 +350,9 @@
 #endif
 	CHECK(memory = malloc(size), "OOM");
-	CHECK(ptrs   = malloc(size * sizeof(void*)), "OOM");
-	CHECK(mem    = xc_mem_init(memory, size), "Failed init memory allocator");
+	CHECK(ptrs   = malloc(size * sizeof(void *)), "OOM");
+	CHECK(mem    = xc_mem_init(memory, mem, size), "Failed init memory allocator");
 
 	while ((p = xc_mem_malloc(mem, 1))) {
+		fprintf(stderr, "%d %p\n", count, ptrs);
 		ptrs[count ++] = p;
 	}
Index: /trunk/xcache/xc_processor.c
===================================================================
--- /trunk/xcache/xc_processor.c	(revision 982)
+++ /trunk/xcache/xc_processor.c	(revision 998)
@@ -1,1 +1,1 @@
-#include "xc_processor_real.c"
+#include "../xc_processor.c.h"
Index: /trunk/Makefile.frag
===================================================================
--- /trunk/Makefile.frag	(revision 997)
+++ /trunk/Makefile.frag	(revision 998)
@@ -1,6 +1,6 @@
 XCACHE_PROC_SRC=$(srcdir)/processor/main.m4
-XCACHE_PROC_OUT=$(builddir)/processor.out
-XCACHE_PROC_C=$(builddir)/xcache/xc_processor_real.c
-XCACHE_PROC_H=$(builddir)/xcache/xc_processor.h
+XCACHE_PROC_OUT=$(builddir)/processor.out.c
+XCACHE_PROC_C=$(builddir)/xc_processor.c.h
+XCACHE_PROC_H=$(builddir)/xc_processor.h
 XCACHE_INCLUDES_SRC=$(srcdir)/includes.c
 XCACHE_INCLUDES_I=$(builddir)/includes.i
@@ -26,7 +26,7 @@
 	-$(XCACHE_INDENT) < $(XCACHE_PROC_OUT) > $(XCACHE_PROC_C).tmp && mv $(XCACHE_PROC_C).tmp $(XCACHE_PROC_C)
 
-$(builddir)/xcache/xc_processor.lo: $(XCACHE_PROC_C) $(XCACHE_PROC_H) $(srcdir)/xcache/xc_processor.c
+$(builddir)/xcache/xc_processor.lo: $(XCACHE_PROC_C) $(XCACHE_PROC_H)
 
-$(builddir)/submodules/xc_disassembler.lo: $(XCACHE_PROC_H) $(srcdir)/xcache/xc_processor.c
+$(builddir)/submodules/xc_disassembler.lo: $(XCACHE_PROC_H)
 
 $(builddir)/xc_opcode_spec.lo: $(srcdir)/xcache.h $(srcdir)/xc_opcode_spec.c $(srcdir)/xc_opcode_spec_def.h $(srcdir)/xc_const_string.h
@@ -35,5 +35,6 @@
 
 xcachesvnclean: clean
-	cat $(srcdir)/.cvsignore | grep -v ^Makefile | grep -v ^config.nice | xargs rm -rf
+	-svn propget svn:ignore . > .svnignore.tmp 2>/dev/null && mv .svnignore.tmp .svnignore
+	cat .svnignore | grep -v devel | grep -v svnignore | grep -v ^Makefile | grep -v ^config.nice | xargs rm -rf
 
 xcachetest: all
Index: /trunk/devel/make
===================================================================
--- /trunk/devel/make	(revision 998)
+++ /trunk/devel/make	(revision 998)
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec ./run make "$@"
Index: /trunk/devel/prepare
===================================================================
--- /trunk/devel/prepare	(revision 988)
+++ /trunk/devel/prepare	(revision 998)
@@ -2,8 +2,8 @@
 SELF="$0"
 
-if test -e prepare.inc ; then
-	. prepare.inc
+if test -e devel/prepare.inc ; then
+	. devel/prepare.inc
 else
-	echo prepare.inc is required, see prepare.inc.example >&2
+	echo devel/prepare.inc is required, see devel/prepare.inc.example >&2
 	exit
 fi
Index: /trunk/devel/run
===================================================================
--- /trunk/devel/run	(revision 995)
+++ /trunk/devel/run	(revision 998)
@@ -1,8 +1,17 @@
 #!/bin/bash
 # this script is for developers only
+set -e
 
-case "$1" in
+. devel/run.cfg
+if [[ ! -z $1 ]]; then
+	type=$1
+fi
+
+case "$type" in
 prep*)
 	exec ./devel/prepare
+	;;
+xtest)
+	exec /usr/bin/make -f devel/test.mak
 	;;
 tags)
@@ -11,12 +20,13 @@
 esac
 
-. run.cfg
-
 basename=$(basename $(pwd))
 if echo $basename | grep -- - >/dev/null; then :; else
+	svn propget svn:ignore . > .svnignore
+
 	dirs=${dirs:-php5-debug}
-
 	for dir in $dirs; do
+		mkdir -p ../${basename}-${dir}
 		cd ../${basename}-${dir} || exit
+		lndir ../${basename} > /dev/null
 
 		pwd
@@ -30,14 +40,4 @@
 xcachesrcdir=../$xcachebasename
 
-rm -f php-src
-find -L . -type l | xargs rm -f
-lndir "$xcachesrcdir" >/dev/null
-find . -iname .\*.swp | xargs rm -f
-ln -sf ~/src/php/$phpbasename php-src
-for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
-	[[ -r $i ]] && ln -sf "$i" php-cgi
-done
-ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
-
 if [[ ! -z $1 ]]; then
 	type=$1
@@ -47,7 +47,27 @@
 		args=("$@")
 	elif [[ -z $args ]]; then
-		args=(test.php)
+		args=(devel.php)
 	fi
 fi
+
+case "$type" in
+reb*)
+	if [[ -r Makefile ]]; then
+		make xcachesvnclean
+	fi
+	;;
+esac
+
+rm -f php-src
+find -L . -type l | xargs rm -f
+lndir "$xcachesrcdir" >/dev/null
+find . -iname .\*.swp | xargs rm -f
+ln -sf ~/src/php/$phpbasename php-src
+for i in ~/src/php/$phpbasename/sapi/cgi/php{,-cgi}; do
+	if [[ -r $i ]]; then
+		ln -sf "$i" php-cgi
+	fi
+done
+ln -sf ~/src/php/$phpbasename/sapi/cli/php php-cli
 
 case "$type" in
@@ -59,5 +79,4 @@
 	fi
 	export PATH=$PHPDIRS/$phpbasename/bin:$PATH
-	[[ -r Makefile ]] && make xcachesvnclean
 	phpize --clean \
 	&& phpize \
@@ -87,5 +106,5 @@
 	;;
 *)
-	cmd=(./php-cgi -q -c php.ini)
+	cmd=(./php-cgi -q -c devel.ini)
 	"${cmd[@]}" -v
 	;;
@@ -116,8 +135,8 @@
 	;;
 dc)
-	exec ./php-cli -c php.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
+	exec ./php-cli -c devel.ini ./bin/phpdc.phpr "${args[@]}" | tee decompiled.php
 	;;
 dop)
-	exec ./php-cli -c php.ini ./bin/phpdop.phpr "${args[@]}"
+	exec ./php-cli -c devel.ini ./bin/phpdop.phpr "${args[@]}"
 	;;
 retest)
Index: /trunk/devel/prepare.cfg.example
===================================================================
--- /trunk/devel/prepare.cfg.example	(revision 998)
+++ /trunk/devel/prepare.cfg.example	(revision 998)
@@ -0,0 +1,11 @@
+# copy this file as prepare.cfg before modifying
+PHP4_x_DIR=
+PHP5_0_DIR=
+PHP5_1_DIR=
+PHP5_3_DIR=
+PHP6_x_DIR=
+
+PHP_DEVEL_DIR=
+
+# path to eaccelerator source dir
+EA_DIR=
Index: /trunk/devel/test.mak
===================================================================
--- /trunk/devel/test.mak	(revision 982)
+++ /trunk/devel/test.mak	(revision 998)
@@ -4,11 +4,11 @@
 OBJS=mem.o
 CC=gcc
-CFLAGS=-g -O0 -D TEST -Wall
+CFLAGS=-g -O0 -I. -D TEST -Wall
 TEST=valgrind
 
 all: mem
 
-mem_test: mem.c
-	$(CC) $(CFLAGS) -o mem_test mem.c
+mem_test: xcache/xc_mem.c xcache/xc_mem.h util/xc_trace.c util/xc_trace.h
+	$(CC) $(CFLAGS) -o mem_test xcache/xc_mem.c util/xc_trace.c
 	
 mem: mem_test
@@ -17,5 +17,2 @@
 clean:
 	rm -f $(OBJS) $(EXES)
-
-leakcheck:
-	valgrind php -c test.ini test.ini
Index: /unk/devel/prepare.inc.example
===================================================================
--- /trunk/devel/prepare.inc.example	(revision 988)
+++ 	(revision )
@@ -1,11 +1,0 @@
-# copy this file as ../devel.prepare.inc before modifying
-PHP4_x_DIR=
-PHP5_0_DIR=
-PHP5_1_DIR=
-PHP5_3_DIR=
-PHP6_x_DIR=
-
-PHP_DEVEL_DIR=
-
-# path to eaccelerator source dir
-EA_DIR=
Index: /trunk/xcache.c
===================================================================
--- /trunk/xcache.c	(revision 997)
+++ /trunk/xcache.c	(revision 998)
@@ -45,5 +45,5 @@
 
 #include "xcache_globals.h"
-#include "xcache/xc_processor.h"
+#include "xc_processor.h"
 #include "xcache/xc_const_string.h"
 #include "xcache/xc_opcode_spec.h"
Index: /unk/make
===================================================================
--- /trunk/make	(revision 977)
+++ 	(revision )
@@ -1,2 +1,0 @@
-#!/bin/bash
-exec ./run make "$@"
Index: /unk/.cvsignore
===================================================================
--- /trunk/.cvsignore	(revision 605)
+++ 	(revision )
@@ -1,34 +1,0 @@
-acinclude.m4
-aclocal.m4
-build
-config.cache
-config.guess
-config.h
-config.h.in
-config.log
-config.nice
-config.status
-config.sub
-configure
-configure.in
-conftest
-conftest.c
-.deps
-include
-includes.i
-install-sh
-libtool
-ltmain.sh
-Makefile
-Makefile.fragments
-Makefile.global
-Makefile.objects
-missing
-mkinstalldirs
-modules
-processor.h
-processor.out
-processor_real.c
-run-tests.php
-structinfo.m4
-autom4te.cache
Index: /unk/run
===================================================================
--- /trunk/run	(revision 982)
+++ 	(revision )
@@ -1,2 +1,0 @@
-#!/bin/sh
-exec devel/run "$@"
