//%module(directors="0") 
%{
/* clucene.i: the CLucene scripting interface. */

 //include clucene header
 #include "CLucene.h"

 //we need to fool the swig preprocessor, otherwise it expands these directives
 #define ___FILE___ __FILE__
 #define ___LINE___ __LINE__
 //#pragma SWIG nowarn=501,505,401
 
 #define _CATCHALL(null_value,dummy) catch (CLuceneError& e) { \
		char buf[250]; \
		_snprintf(buf,250,"%s in %s at %d",e.what(),___FILE___,___LINE___); \
		SWIG_exception(null_value,SWIG_RuntimeError,buf); \
		return null_value; \
    } catch (...) { \
		char buf[250]; \
		_snprintf(buf,250,"UNKNOWN exception in %s at %d",___FILE___,___LINE___); \
		SWIG_exception(null_value,SWIG_RuntimeError,buf); \
		return null_value; \
    }
%}
// end of c header stuff
////////////////////////////////////////////////////////////////////////////////

#define DEFINE_MUTEX(x) //ignore mutex's
#define LUCENE_HIDE_INTERNAL //makes clucene hide its internal functions

//todo: do these options

%include clucene_options.i

//take some local options
%include local_options.i

#ifdef _SUMO
  /* Make the C++ preprocessor (as opposed to only the SWIG preprocessor) aware
  ** that _SUMO is defined. */
  %{ #define _SUMO %}
#endif


//capabilities: (define in locals_options)
//#define SWIGCAP_NOOVERLOADING
//#define SWIGCAP__ALTNAMING - rename names to AddDocument, instead of addDocument (for example)
////////////////////////////////////////////////////////////////////////////////


//see #define %newobject - need this to tell swig that a function returns a new object
//include the necessary type maps and helper code
%include typemaps.i
%include exception.i
%include clucene_typemaps.i

////////////////////////////////////////////////////////////////////////////////
//Exception handling
////////////////////////////////////////////////////////////////////////////////
%exception {
  try {
		$function
  }_CATCHALL($null,);
}

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


//we can say that tostring values can always be deleted...
%feature("new","1") *::toString;
#ifdef SWIGCAP_NOOVERLOADING
	%rename (toString_ex) *::toString(const TCHAR*);
#endif

////////////////////////////////////////////////////////////////////////////////
//now include the actual functions:
////////////////////////////////////////////////////////////////////////////////
%include "local_arrays.i"; //language specific stuff
%include "clucene_stdheader.i";
%include "clucene_debug.i";
%include "clucene_util.i";
%include "clucene_document.i";
%include "clucene_store.i";
%include "clucene_analysis.i";
%include "clucene_index.i";
%include "clucene_search.i";
%include "clucene_queryParser.i";
