Index: /pjproject/branches/projects/jni/configure-android
===================================================================
--- /pjproject/branches/projects/jni/configure-android	(revision 4568)
+++ /pjproject/branches/projects/jni/configure-android	(revision 4569)
@@ -66,12 +66,6 @@
 fi
 
-HOST_OS=$(uname -s)
-case $HOST_OS in
-  Darwin) BUILD_MACHINE="darwin-x86";;
-  Linux) BUILD_MACHINE="linux-x86";;
-  CYGWIN*|*_NT-*) BUILD_MACHINE="windows";;
-esac
-
-ANDROID_TC="${ANDROID_NDK_ROOT}/toolchains/${TC_DIR}-4.4.3/prebuilt/${BUILD_MACHINE}"
+ANDROID_TC_VER=`ls -d ${ANDROID_NDK_ROOT}/toolchains/${TC_DIR}-* | sed 's/clang/0/' | sort -gr | head -1`
+ANDROID_TC=`ls -d ${ANDROID_TC_VER}/prebuilt/*`
 if test ! -d ${ANDROID_TC}; then
   echo "$F error: unable to find directory ${ANDROID_TC} in Android NDK"
Index: /pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile	(revision 4569)
+++ /pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile	(revision 4569)
@@ -0,0 +1,1 @@
+link jni/Android.mk
Index: project/branches/projects/jni/pjsip-apps/src/jni/my_typemaps.i
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/my_typemaps.i	(revision 4568)
+++ 	(revision )
@@ -1,312 +1,0 @@
-# $Id$
-
-%include "arrays_java.i"
-%include "typemaps.i"
-
-/* Auto destroy JNI object, useful for director */
-%header %{
-class LocalRefGuard {
-    JNIEnv* jenv;
-    jobject jobj;
-public:
-    LocalRefGuard(JNIEnv* jenv_, jobject jobj_) : jenv(jenv_), jobj(jobj_) {}
-    ~LocalRefGuard() { if (jobj) jenv->DeleteLocalRef(jobj); }
-};
-%}
-
-/*
- * Add director typemaps for "int *INOUT"
- */
-%typemap(javadirectorin) int *INOUT "$jniinput"
-%typemap(directorin, descriptor="[I") int *INOUT %{
-  $input = jenv->NewIntArray(1);
-  LocalRefGuard g_$input(jenv, $input);
-  jenv->SetIntArrayRegion($input, 0, 1, (jint*)$1);
-%}
-%typemap(directorout) int *INOUT %{
-  jint tmp$result;
-  jenv->GetIntArrayRegion($input, 0, 1, &tmp$result);
-  *$result = ($*1_ltype)tmp$result;
-%}
-%typemap(directorargout) int *INOUT %{
-  jint tmp$1;
-  jenv->GetIntArrayRegion($input, 0, 1, &tmp$1);
-  *$1 = ($*1_ltype)tmp$1;
-%}
-
-/*
- * Add director typemaps for "unsigned *INOUT"
- */
-%typemap(javadirectorin) unsigned *INOUT "$jniinput"
-%typemap(directorin, descriptor="[I") unsigned *INOUT %{
-  $input = jenv->NewLongArray(1);
-  LocalRefGuard g_$input(jenv, $input);
-  jenv->SetLongArrayRegion($input, 0, 1, (jlong*)$1);
-%}
-%typemap(directorout) unsigned *INOUT %{
-  jlong tmp$result;
-  jenv->GetLongArrayRegion($input, 0, 1, &tmp$result);
-  *$result = ($*1_ltype)tmp$result;
-%}
-%typemap(directorargout) unsigned *INOUT %{
-  jlong tmp$1;
-  jenv->GetLongArrayRegion($input, 0, 1, &tmp$1);
-  *$1 = ($*1_ltype)tmp$1;
-%}
-
-/*
- * Map pj_str_t to java String
- */
-%ignore pj_str_t;
-%typemap(jni)             pj_str_t* "jstring"
-%typemap(jtype)           pj_str_t* "String"
-%typemap(jstype)          pj_str_t* "String"
-%typemap(javain)          pj_str_t* "$javainput"
-%typemap(javaout)         pj_str_t* { return $jnicall; }
-%typemap(javadirectorin)  pj_str_t* "$jniinput"
-%typemap(javadirectorout) pj_str_t* "$javacall"
-
-%typemap(in)              pj_str_t* (pj_str_t str_tmp, char* str_ptr=NULL) %{
-  $1 = &str_tmp;
-  if(!$input) pj_strset($1, NULL, 0);
-  else {
-    str_ptr = (char*)jenv->GetStringUTFChars($input, 0);
-    pj_size_t str_len = jenv->GetStringUTFLength($input);
-    if (!str_ptr || !str_len) pj_strset($1, NULL, 0);
-    else pj_strset($1, str_ptr, str_len);
-  }
-%}
-
-%typemap(freearg)         pj_str_t* %{
-  if ($input)
-    jenv->ReleaseStringUTFChars($input, str_ptr$argnum);
-%}
-
-%typemap(memberin)        pj_str_t %{
-  if ($1.ptr) free($1.ptr);
-  if ($input->ptr) {
-    $1.ptr = (char*)malloc($input->slen);				/* <-- will leak! */
-    memcpy($1.ptr, $input->ptr, $input->slen);
-    $1.slen = $input->slen;
-  }
-%}
-
-%typemap(out)             pj_str_t* %{
-  char *$1_ptr = (char*)malloc($1->slen+1);
-  memcpy($1_ptr, $1->ptr, $1->slen);
-  $1_ptr[$1->slen] = '\0';
-  $result = jenv->NewStringUTF($1_ptr);
-  free($1_ptr);
-%}
-
-%typemap(directorin,descriptor="Ljava/lang/String;") pj_str_t* %{
-  char *$input_ptr = (char*)malloc($1->slen+1);
-  memcpy($input_ptr, $1->ptr, $1->slen);
-  $input_ptr[$1->slen] = '\0';
-  $input = jenv->NewStringUTF($input_ptr);
-  LocalRefGuard g_$input(jenv, $input);
-  free($input_ptr);
-%}
-
-/*
- * Map pj_str_t[ANY] to java String[]
- */
-%typemap(jni)     pj_str_t[ANY] "jobjectArray"
-%typemap(jtype)	  pj_str_t[ANY] "String[]"
-%typemap(jstype)  pj_str_t[ANY] "String[]"
-%typemap(javain)  pj_str_t[ANY] "$javainput"
-%typemap(javaout) pj_str_t[ANY] { return $jnicall; }
-%typemap(in)      pj_str_t[ANY] %{
-  int $1_len = jenv->GetArrayLength($input);
-  char** $1_tmpstr = new char*[$1_len];
-  jstring* $1_tmp = new jstring[$1_len];
-  $1 = new pj_str_t[$1_len];
-  int $1_ii;
-  for ($1_ii = 0; $1_ii<$1_len; $1_ii++) {
-    $1_tmp[$1_ii] = (jstring)jenv->GetObjectArrayElement($input, $1_ii);
-    if ($1_tmp[$1_ii]) {
-      $1[$1_ii].ptr = $1_tmpstr[$1_ii] = (char*)jenv->GetStringUTFChars($1_tmp[$1_ii], 0);
-      $1[$1_ii].slen = jenv->GetStringUTFLength($1_tmp[$1_ii]);
-    } else {
-      pj_strset(&$1[$1_ii], NULL, 0);
-    }
-    jenv->DeleteLocalRef($1_tmp[$1_ii]); /* is this ok here? */
-  }
-%}
-
-%typemap(freearg) pj_str_t[ANY] %{
-  for ($1_ii=0; $1_ii<$1_len; $1_ii++)
-    if ($1_tmp[$1_ii]) jenv->ReleaseStringUTFChars($1_tmp[$1_ii], $1_tmpstr[$1_ii]);
-  delete [] $1;
-  delete [] $1_tmp;
-  delete [] $1_tmpstr;
-%}
-
-/* 
- * Handle setter/getter of a struct member with type of 'array of pj_str_t'.
- */
-%define MY_JAVA_MEMBER_ARRAY_OF_STR(CLASS_NAME, NAME, COUNT_NAME)
-
-%ignore CLASS_NAME::COUNT_NAME;
-
-%typemap(memberin)	pj_str_t NAME[ANY], pj_str_t NAME[] {
-  int i;
-  for (i=0; i<arg1->COUNT_NAME; ++i)
-    if ($1[i].ptr) free($1[i].ptr);
-  
-  arg1->COUNT_NAME = $input_len;
-  for (i=0; i<arg1->COUNT_NAME; ++i) {
-    if ($input->ptr) {
-      $1[i].ptr = (char*)malloc($input->slen);				/* <-- will leak! */
-      memcpy($1[i].ptr, $input->ptr, $input->slen);
-      $1[i].slen = $input->slen;
-    }
-  }
-}
-
-%typemap(out) 		pj_str_t NAME[ANY] {
-  int i;
-  jstring temp_string;
-  const jclass clazz = jenv->FindClass("java/lang/String");
-
-  $result = jenv->NewObjectArray(arg1->COUNT_NAME, clazz, NULL);
-  for (i=0; i<arg1->COUNT_NAME; i++) {
-    temp_string = jenv->NewStringUTF($1[i].ptr);
-    jenv->SetObjectArrayElement($result, i, temp_string);
-    jenv->DeleteLocalRef(temp_string);
-  }
-}
-
-%enddef
-
-/*
- * pj_str_t *INOUT, string as input and output param, handled as single element array.
- */
-%apply pj_str_t[ANY] { pj_str_t *INOUT };
-
-%typemap(argout) pj_str_t *INOUT {
-  char *$1_ptr = new char[$1[0].slen+1];
-  memcpy($1_ptr, $1[0].ptr, $1[0].slen);
-  $1_ptr[$1[0].slen] = '\0';
-  jstring temp_string = jenv->NewStringUTF($1_ptr);
-  jenv->SetObjectArrayElement($input, 0, temp_string);
-  delete [] $1_ptr;
-}
-
-%typemap(directorin,descriptor="[Ljava/lang/String;") pj_str_t *INOUT %{
-  jstring tmp_$input;
-  $input = jenv->NewObjectArray(1, jenv->FindClass("java/lang/String"), NULL);
-  LocalRefGuard g_$input(jenv, $input);
-  tmp_$input = jenv->NewStringUTF($1[0].ptr);
-  LocalRefGuard g_temp_$input(jenv, tmp_$input);
-  jenv->SetObjectArrayElement($input, 0, tmp_$input);
-%}
-
-%typemap(directorargout)  pj_str_t *INOUT {
-  if(!$input) pj_strset($1, NULL, 0);
-  else {
-    str_ptr = (char*)jenv->GetStringUTFChars($input, 0);
-    pj_size_t str_len = jenv->GetStringUTFLength($input);
-    if (!str_ptr || !str_len) pj_strset($1, NULL, 0);
-    else {
-      $1->ptr = (char*)malloc(str_len);					/* <-- will leak! */
-      memcpy($1->ptr, str_ptr, str_len);
-      $1->slen = str_len;
-    }
-    jenv->ReleaseStringUTFChars($input, str_ptr);
-  }
-}
-
-
-/* 
- * Object input & output (with double pointers).
- */
-%define MY_JAVA_CLASS_INOUT(TYPE, NAME)
-%typemap(jni) 	 TYPE **NAME "jlong"
-%typemap(jtype)  TYPE **NAME "long"
-%typemap(jstype) TYPE **NAME "TYPE"
-%typemap(in) 	 TYPE **NAME (TYPE *temp = NULL) "temp = (TYPE*)$input; $1 = &temp;"
-%typemap(argout) TYPE **NAME "$input = (jlong)*$1;"
-%typemap(directorin,descriptor="L$packagepath/TYPE;") TYPE **NAME "$input = (jlong)*$1;"
-%typemap(directorargout)  TYPE **NAME " *$1 = (TYPE*)$input; "
-%typemap(javain)	  TYPE **NAME "TYPE.getCPtr($javainput)"
-%typemap(javadirectorin)  TYPE **NAME "($jniinput == 0) ? null : new TYPE($jniinput, false)"
-%typemap(javadirectorout) TYPE **NAME "TYPE.getCPtr($javacall)"
-%enddef
-
-
-/* 
- * Generate setter/getter of a struct member typed of 'array of enum' with variable length.
- */
-%define MY_JAVA_MEMBER_ARRAY_OF_ENUM(CLASS_NAME, TYPE, NAME, COUNT_NAME)
-
-%ignore CLASS_NAME::COUNT_NAME;
-%apply ARRAYSOFENUMS[] { TYPE* NAME };
-
-%typemap(in)       TYPE* NAME (jint *jarr) %{
-  int size$1 = jenv->GetArrayLength($input);
-  if (!SWIG_JavaArrayInInt(jenv, &jarr, (int **)&$1, $input)) return $null;
-%}
-
-%typemap(memberin) TYPE* NAME %{
-  if ($1) free($1);
-  arg1->COUNT_NAME = size$input;
-  $1 = (TYPE*)calloc(arg1->COUNT_NAME, sizeof(TYPE));			/* <-- will leak! */
-  for (size_t i = 0; i < (size_t)arg1->COUNT_NAME; i++)
-    $1[i] = $input[i];
-%}
-
-%typemap(out)      TYPE* NAME %{
-  $result = SWIG_JavaArrayOutInt(jenv, (int*)$1, arg1->COUNT_NAME);
-%}
-
-// Hack for avoiding leak, may not work when another macro defines class destructor too
-%extend CLASS_NAME { ~CLASS_NAME() { if ($self->NAME) free($self->NAME); } };
-
-%enddef
-
-
-/* 
- * Handle setter/getter of a struct member with type of 'array of pointer to struct/class'.
- */
-%define MY_JAVA_MEMBER_ARRAY_OF_POINTER(CLASS_NAME, TYPE, NAME, COUNT_NAME)
-
-%ignore CLASS_NAME::COUNT_NAME;
-%typemap(jni) 	   TYPE* NAME[ANY] "jlongArray"
-%typemap(jtype)    TYPE* NAME[ANY] "long[]"
-%typemap(jstype)   TYPE* NAME[ANY] "TYPE[]"
-%typemap(javain)   TYPE* NAME[ANY] "TYPE.cArrayUnwrap($javainput)"
-%typemap(javaout)  TYPE* NAME[ANY] {return TYPE.cArrayWrap($jnicall, $owner);}
-
-%typemap(in)       TYPE* NAME[ANY] (jlong *jarr) %{
-  if (!SWIG_JavaArrayInUlong(jenv, &jarr, (unsigned long**)&$1, $input))
-    return $null;
-  arg1->COUNT_NAME = jenv->GetArrayLength($input);
-%}
-
-%typemap(freearg)  TYPE* NAME[ANY] %{ if ($1) delete [] $1; %}
-
-%typemap(memberin) TYPE* NAME[ANY] %{
-  for (size_t i = 0; i < (size_t)arg1->COUNT_NAME; i++) $1[i] = $input[i];
-%}
-
-%typemap(out)      TYPE* NAME[ANY] %{
-  $result = SWIG_JavaArrayOutUlong(jenv, (unsigned long*)$1, arg1->COUNT_NAME);
-%}
-
-%typemap(javacode) TYPE %{
-  protected static long[] cArrayUnwrap($javaclassname[] arrayWrapper) {
-    long[] cArray = new long[arrayWrapper.length];
-    for (int i=0; i<arrayWrapper.length; i++)
-      cArray[i] = $javaclassname.getCPtr(arrayWrapper[i]);
-    return cArray;
-  }
-  protected static $javaclassname[] cArrayWrap(long[] cArray, boolean cMemoryOwn) {
-    $javaclassname[] arrayWrapper = new $javaclassname[cArray.length];
-    for (int i=0; i<cArray.length; i++)
-      arrayWrapper[i] = new $javaclassname(cArray[i], cMemoryOwn);
-    return arrayWrapper;
-  }
-%}
-
-%enddef
Index: project/branches/projects/jni/pjsip-apps/src/jni/swig_gen.py
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/swig_gen.py	(revision 4568)
+++ 	(revision )
@@ -1,304 +1,0 @@
-# $Id$
-
-#!/usr/bin/python
-
-import re
-import sys, os #, traceback
-from collections import OrderedDict
-from pycparser import parse_file, c_ast, c_generator
-
-# Settings.
-PJ_ROOT_PATH = "../../../"
-SOURCE_PATH  = PJ_ROOT_PATH + "pjsip/include/pjsua-lib/pjsua.h"
-#SOURCE_PATH  = PJ_ROOT_PATH + "pjlib-util/include/pjlib-util/scanner.h"
-#SOURCE_PATH  = PJ_ROOT_PATH + "pjlib/include/pj/types.h"
-OUTDIR = "output" if len(sys.argv)<=1 else sys.argv[1]
-
-
-# CPP is needed by pycparser.
-if sys.platform == 'win32':
-	PYCPARSER_DIR="C:/devs/tools/pycparser"
-	CPP_PATH='C:/devs/bin/cpp.exe'
-else:
-	PYCPARSER_DIR="/home/bennylp/Desktop/opt/src/pycparser-master"
-	CPP_PATH='cpp'
-
-# CPP (C preprocessor) settings
-CPP_CFLAGS   = [
-	'-DPJ_AUTOCONF',
-	'-DCC_DUMMY',
-	'-U__GNUC__',
-	'-Djmp_buf=int',
-	'-I' + PYCPARSER_DIR + '/utils/fake_libc_include',
-	"-I" + PJ_ROOT_PATH + "pjlib/include",
-	"-I" + PJ_ROOT_PATH + "pjlib-util/include",
-	"-I" + PJ_ROOT_PATH + "pjnath/include",
-	"-I" + PJ_ROOT_PATH + "pjmedia/include",
-	"-I" + PJ_ROOT_PATH + "pjsip/include"
-	]
-
-# Any type/func names without this prefix will be excluded from the generated SWIG interface,
-# e.g: int, void.
-BASE_PREFIX = 'pj'
-
-# Any type/func names with this prefix will be treated as part of main module, i.e: they will
-# always be included in the generated SWIG interface, and will be used as starting point in
-# tracing dependencies (e.g: as struct pjsua_acc_config is part of main module, any types used
-# in its struct member, such as pj_str_t, pjsip_hdr, pj_bool_t, etc, will be included too).
-MODULE_PREFIX = 'pjsua_'
-#MODULE_PREFIX = 'pj'
-
-# If true, video related declarations (anything has '_vid_') will be removed, as long as not
-# used by main module (e.g: pjmedia_vid_dev_index type is used by pjsua_acc_config, so it won't
-# be removed).
-NO_VIDEO = True
-
-FORCE_STRUCT_AS_OPAQUE = [
-	'pj_pool_t',
-	'pj_stun_msg',
-	'pj_pool_factory',
-	'pjsip_hdr_vptr',
-	'pjsip_tpfactory',
-	'pjsip_transport',
-	'pjsip_tx_data_op_key',
-	'pjsip_rx_data_op_key',
-	'pjsip_module',
-	'pjsip_uri',
-	'pjsip_uri_vptr',
-	'pjmedia_port',
-	'pjmedia_transport',
-	'pjsua_media_transport'
-]
-
-FORCE_EXPORT = [
-	'pj_pool_release'
-]
-
-class MyGen(c_generator.CGenerator):
-
-	def __init__(self, ast):
-		super(MyGen, self).__init__()
-		self.ast = ast
-		self.nodes = OrderedDict()
-		self.deps = list()
-		self.deps_pending = list()
-		self.deps_frozen = False
-
-		# Generate nodes map (name -> node instances)
-		for ext in self.ast.ext:
-			name = self._get_node_name(ext)
-			if name and not name.startswith(BASE_PREFIX):
-				continue
-
-			if name in self.nodes:
-				self.nodes[name].append(ext)
-				# always put typedef later, swig issue
-				if isinstance(self.nodes[name][0], c_ast.Typedef):
-					self.nodes[name].reverse()
-			else:
-				self.nodes[name] = [ext]
-
-		# Generate dependencies, they are all APIs to be exported
-		for name in self.nodes.keys():
-			if (not name) or \
-				((name in FORCE_EXPORT or name.startswith(MODULE_PREFIX)) \
-					  and self._check_video(name)):
-				self._add_dep(name)
-		self.deps_frozen = True
-
-	# Override visit_IdentifierType() to collect "node name" and generate dependencies
-	# from this node's children
-	def visit_IdentifierType(self, n):
-		if not self.deps_frozen:
-			for name in n.names: self._add_dep(name)
-		return super(MyGen, self).visit_IdentifierType(n)
-
-	def _check_video(self, name):
-		if NO_VIDEO and name and ((name.find('_vid_') > 0) or (name.find('_video_') > 0)):
-			return False
-		return True
-
-	def _get_node_name(self, node):
-		s = getattr(node, 'name', None)
-		if s:
-			return s
-		if isinstance(node, c_ast.FuncDef):
-			return self._get_node_name(node.decl)
-		ss = getattr(node, 'names', None)
-		if ss:
-			s = ' '.join(ss)
-			return s
-		if getattr(node, 'type', None):
-			return self._get_node_name(node.type)
-		return s
-
-	# Trace node dependencies by recursively inspecting its children.
-	# The node itself and all its children will be listed in 'deps'.
-	def _add_dep(self, name):
-		if (name and not name.startswith(BASE_PREFIX)) or \
-			name in self.deps or name in self.deps_pending:
-			return
-
-		if name in FORCE_STRUCT_AS_OPAQUE:
-			self.deps.append(name)
-			return
-
-		self.deps_pending.append(name)
-		for node in self.nodes[name]:
-			self.visit(node)
-		if not self.deps_pending.pop() == name:
-			print 'Error initializing dep!'
-			sys.exit(1)
-		self.deps.append(name)
-
-	# Opaque struct is identified by empty struct member declaration.
-	def _is_struct_opaque(self, node):
-		if isinstance(node, c_ast.Typedef) and isinstance(node.type, c_ast.TypeDecl) and \
-		   isinstance(node.type.type, c_ast.Struct) and node.type.type.decls == None:
-			return True
-		elif isinstance(node, c_ast.Decl) and isinstance(node.type, c_ast.Struct) and \
-			 node.type.decls == None:
-			return True
-		return False
-
-	# Check if the specified struct name is opaque. If it is, declare as zero member and
-	# tell SWIG to omit ctor/dtor.
-	def _process_opaque_struct(self, name, code):
-		opaque = True
-		if not (name in FORCE_STRUCT_AS_OPAQUE):
-			for n in self.nodes[name]:
-				if not self._is_struct_opaque(n):
-					opaque = False
-					break
-		if opaque:
-			s = '%nodefaultctor ' + name + '; %nodefaultdtor ' + name + ';\n'
-			s += 'struct ' + name + ' {};\n'
-			return s
-
-		# Remove "typedef struct/enum ..." without member decl (optional)
-		if name:
-			code = code.replace('typedef struct '+name+' '+name+';\n', '', 1)
-			code = code.replace('typedef enum '+name+' '+name+';\n', '', 1)
-		return code
-
-	def _gen_pjsua_callback(self, code):
-		# init
-		cbclass  = ''
-		cbproxy = ''
-		cbdef = []
-
-		raw_lines = code.splitlines()
-		for idx, line in enumerate(raw_lines):
-			if idx in [0, 1, len(raw_lines)-1]: continue
-			fstrs = []
-			# pointer to function type format
-			m = re.match('\s+(.*)\(\*(.*)\)(\(.*\));', line)
-			if m:
-				fstrs = [m.group(1).strip(), m.group(2), m.group(3)]
-			else:
-				# typedef'd format
-				m = re.match('\s+(.*)\s+(.*);', line)
-				if (not m) or (not self.nodes.has_key(m.group(1))):
-					cbdef.append('  NULL')
-					continue
-				fstrs = ['', m.group(2), '']
-				n = self.nodes[m.group(1)][0]
-				raw = self._print_node(n)
-				m = re.match('typedef\s+(.*)\(\*(.*)\)(\(.*\));', raw)
-				if not m:
-					cbdef.append('  NULL')
-					continue
-				fstrs[0] = m.group(1).strip()
-				fstrs[2] = m.group(3)
-
-			cbclass += '  virtual ' + ' '.join(fstrs)
-			if fstrs[0] == 'void':
-				cbclass += ' {}\n'
-			elif fstrs[1] == 'on_create_media_transport':
-				cbclass += ' { return base_tp; }\n'
-			elif fstrs[1] == 'on_call_redirected':
-				cbclass += ' { return PJSIP_REDIRECT_STOP; }\n'
-			else:
-				cbclass += ' { return 0; }\n'
-
-			cbproxy += 'static ' + ' '.join(fstrs)
-			params = re.findall('(\w+)[,\)]', fstrs[2])
-			if fstrs[0] == 'void':
-				cbproxy += ' { cb->'+fstrs[1]+'('+','.join(params)+'); }\n'
-			else:
-				cbproxy += ' { return cb->'+fstrs[1]+'('+','.join(params)+'); }\n'
-
-			cbdef.append('  &' + fstrs[1])
-
-		return [cbclass, cbproxy, ',\n'.join(cbdef)+'\n']
-
-	def _process_pjsua_callback(self, name, code):
-		if name != 'pjsua_callback':
-			return code
-
-		cb = self._gen_pjsua_callback(code)
-
-		fout = open(OUTDIR+'/callbacks.h', 'w+')
-		fin  = open('callbacks.h.template', 'r')
-		for line in fin:
-			if line.find(r'$PJSUA_CALLBACK_CLASS$') >= 0:
-				fout.write(cb[0])
-			else:
-				fout.write(line)
-		fin.close()
-		fout.close()
-
-		fout = open(OUTDIR+'/callbacks.c', 'w+')
-		fin  = open('callbacks.c.template', 'r')
-		for line in fin:
-			if line.find(r'$PJSUA_CALLBACK_PROXY$') >= 0:
-				fout.write(cb[1])
-			elif line.find(r'$PJSUA_CALLBACK_DEF$') >= 0:
-				fout.write(cb[2])
-			else:
-				fout.write(line)
-		fin.close()
-		fout.close()
-		return ''
-
-	# Generate code from the specified node.
-	def _print_node(self, node):
-		s = ''
-		if isinstance(node, c_ast.FuncDef):
-			s = self.visit(node)
-		else:
-			s = self.visit(node)
-			if s: s += ';\n'
-		return s
-
-	def go(self):
-		s = ''
-		for name in self.deps:
-			ss = ''
-			for node in self.nodes[name]:
-				ss += self._print_node(node)
-
-			ss = self._process_opaque_struct(name, ss)
-			ss = self._process_pjsua_callback(name, ss)
-			s += ss
-		return s
-
-
-# MAIN			
-ast = parse_file(SOURCE_PATH, use_cpp=True, cpp_path=CPP_PATH, cpp_args=CPP_CFLAGS)
-#ast.show(attrnames=True, nodenames=True)
-#exit(0)
-
-mygen = MyGen(ast)
-
-#print 'Found ' + str(len(mygen.nodes)) + ' nodes:'
-#for a, b in mygen.nodes.items():
-#   print a + ':' + str(len(b))
-
-#print '\n\nFound ' + str(len(mygen.deps)) + ' dependencies:'
-#for d in mygen.deps:
-#   print d
-
-s = mygen.go()
-print s
-
