#ifdef __cplusplus
extern "C"
{
#endif

#ifndef ajpat_h
#define ajpat_h

/* @data AjPPattern ***********************************************************
**
** Ajax Pattern object.
**
** Holds definition of feature pattern. Regular expression patterns ignore
** mismatch value.
**
** @new ajPatternNew Default constructor
** @delete ajReportDel Default destructor
** @@
******************************************************************************/

typedef struct AjSPattern {
  AjPStr Name;
  AjPStr Pattern;
  void* Compiled;
  ajint Type;
  ajint Mismatch;
} AjOPattern;

#define AjPPattern AjOPattern*

// type can 1: regex, 2: prosite (protein) 3: prosite like (nucleotide)
#define PAT_TYPE_REGEXP 1
#define PAT_TYPE_PRO 2
#define PAT_TYPE_NUCL 3

/* @data AjPPatlist ***********************************************************
**
** Ajax Pattern List object.
**
** Holds list of feature patterns and general information of them.
**
** @new ajPatlistNew Default constructor
** @delete ajPatlistDel Default destructor
** @@
******************************************************************************/

typedef struct AjSPatlist {
  AjPList Patlist;
  AjIList Iter;
} AjOPatlist;

#define AjPPatlist AjOPatlist*

// Pattern handling functions
AjPPattern ajPatternNew (AjPStr name, AjPStr pat, int type, int mismatch);
void ajPatternDel (AjPPattern* pthys);
AjPStr ajPatternGetName (AjPPattern thys);
AjPStr ajPatternGetPattern (AjPPattern thys);
void* ajPatternGetCompiledPattern (AjPPattern thys);
ajint ajPatternGetType (AjPPattern thys);
ajint ajPatternGetMismatch (AjPPattern thys);

// Patlist handling functions
AjPPatlist ajPatlistNew (void);
void ajPatlistDel (AjPPatlist* pthys);
void ajPatlistParsePatternFile (AjPPatlist thys, AjPStr inf, ajint type);
AjBool ajPatlistGetNext (AjPPatlist thys, AjPPattern* pattern);
void ajPatlistRewind (AjPPatlist thys);
void ajPatlistAdd (AjPPatlist thys, AjPPattern pat);

#endif

#ifdef __cplusplus
}
#endif
