//header for root stuff

//StdHeader.h
%ignore CLDebugBreak;
%ignore _lucene_run_objectcheck;
%ignore _lucene_counter_break;
%ignore _lucene_shutdown;
%ignore lucenestrdup;
%ignore lucenewcsdup;
%ignore lucenestrthrow;
%ignore LUCENE_BLANK_STRING;
%ignore LUCENE_BLANK_ASTRING;
%ignore _LUCENE_BLANK_STRING;
%ignore _LUCENE_BLANK_ASTRING;
%ignore DELETE_TYPE_NONE;
%ignore DELETE_TYPE_DELETE;
%ignore DELETE_TYPE_DELETE_ARRAY;
%ignore DEFINE_MUTEX;

//debug/mem.h
%ignore LuceneBase;
%ignore LuceneVoidBase;


////////////////////////////////////////////////////////////////////////
// Binding macros. Override these in local_stdheader as necessary
////////////////////////////////////////////////////////////////////////
#ifndef TCHAR
 #define TCHAR wchar_t //todo: currently wchar_t is not very well done in csharp
#endif

//a function definition
//obj: object
//func: function
//alt1: alternative name for function (if func=addDocument, alt1=AddDocument)
//typ: NO=new object,
//#CL_FUNCTION(obj,func,typ,alt1)

//
////////////////////////////////////////////////////////////////////////



//this is a hack, we override the exception of the function
//when we want to add an reference to an input or output
#define LUCENE_ADDINREF1(func,argplus1,arg0) %exception func { \
  try { \
    arg##arg0##->__cl_addref(); \
	$function \
  }_CATCHALL($null,); \
 }
//the same thing, except when used in a constructor... differnet because of naming
#define LUCENE_ADDINREF1_CONSTRUCTOR(func,argplus1,arg0) LUCENE_ADDINREF1(func,argplus1,argplus1)

#define LUCENE_ADDINREFOBJARR1(func,argplus1,arg0,type) %exception func { \
  try{ int i=0; \
  	int32_t arg##arg0##plen=0; \
  	while(arg##arg0##[arg##arg0##plen]!=NULL) arg##arg0##plen++; \
  	type* arg##arg0##p = _CL_NEWARRAY(type,arg##arg0##plen+1); \
  	for ( int i=0;i<arg##arg0##plen;i++ )arg##arg0##p[i]=_CL_POINTER(arg##arg0##p[i]);\
  	arg##arg0##p[arg##arg0##plen]=NULL; arg##arg0##=arg##arg0##p; \
	  $function \
  }_CATCHALL($null,); \
 }
//the same thing, except when used in a constructor... differnet because of naming
#define LUCENE_ADDINREFOBJARR1_CONSTRUCTOR(func,argplus1,arg0,type) LUCENE_ADDINREFOBJARR1(func,argplus1,argplus1,type)
  
#define LUCENE_ADDINTCS1(func,argplus1,arg0) %exception func { \
  try { \
    arg##arg0## = STRDUP_TtoT(arg##arg0##); \
	  $function \
  }_CATCHALL($null,); \
 }
//the same thing, except when used in a constructor... differnet because of naming
#define LUCENE_ADDINTCS1_CONSTRUCTOR(func,argplus1,arg0) LUCENE_ADDINTCS1(func,argplus1,argplus1)

//now include local definition
%include "local_stdheader.i"

//now include the clucene headers
%include "CLucene/StdHeader.h"
%include "CLucene/debug/mem.h"
