/*
This source file is part of Scol
For the latest info, see http://www.scolring.org

Copyright (c) 2010 Stephane Bisaro, aka Iri <iri@irizone.net>

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/copyleft/lesser.txt

For others informations, please contact us from http://www.scolring.org/
*/

#ifndef __SCOL_GLIB_PREGEX_H__
#define __SCOL_GLIB_PREGEX_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <libgen.h>
#include <glib.h>

#if ((defined __WIN32__) || (defined WIN32))
#include <windows.h>
#include "scol_plugin_win.h"
#else
#include "scol_plugin_lin.h"
#endif

#include "macros.h"



#define bullshit int (__cdecl *)(struct Mmachine *)

#define GLIB_PCRE_PKG_NB         31
#define DEFAULT_STRING   "Untitle"


#define MATCH_STANDARD     1
#define MATCH_DFA          2

#define MATCH_ANCHORED       1<<4
#define MATCH_NOTBOL         1<<7
#define MATCH_NOTEOL         1<<8
#define MATCH_NOTEMPTY       1<<10
#define MATCH_PARTIAL        1<<15
#define MATCH_NEWLINE_CR     1<<20
#define MATCH_NEWLINE_LF     1<<21
#define MATCH_NEWLINE_CRLF   MATCH_NEWLINE_CR | MATCH_NEWLINE_LF
#define MATCH_NEWLINE_ANY    1<<22

#define REGEX_CASELESS          1 << 0
#define REGEX_MULTILINE         1 << 1
#define REGEX_DOTALL            1 << 2
#define REGEX_EXTENDED          1 << 3
#define REGEX_ANCHORED          1 << 4
#define REGEX_DOLLAR_ENDONLY    1 << 5
#define REGEX_UNGREEDY          1 << 9
#define REGEX_RAW               1 << 11
#define REGEX_NO_AUTO_CAPTURE   1 << 12
#define REGEX_OPTIMIZE          1 << 13
#define REGEX_DUPNAMES          1 << 19
#define REGEX_NEWLINE_CR        1 << 20
#define REGEX_NEWLINE_LF        1 << 21
#define REGEX_NEWLINE_CRLF      REGEX_NEWLINE_CR | REGEX_NEWLINE_LF






int PcreRelease ();
int SCOLinitPcreClass (mmachine m);
int SCOL_pcreEasyMatch (mmachine m);
int SCOL_pcreEasySplit (mmachine m);
int SCOL_pcreEasyReplace (mmachine m);
int SCOL_pcreNormalMatch (mmachine m);
int SCOL_pcreNormalSplit (mmachine m);
int SCOL_pcreNormalReplace (mmachine m);

GRegex * scol_pcre_regex_new (const gchar * pattern, GRegexCompileFlags compile, GRegexMatchFlags match);
void scol_pcre_match_standard (mmachine m, const gchar *pattern, const gchar *string, GRegexCompileFlags compile, GRegexMatchFlags match, gint start);
void scol_pcre_match_DFA (mmachine m, const gchar *pattern, const gchar *string, GRegexCompileFlags compile, GRegexMatchFlags match, gint start);


#if ((defined _WIN32) || (defined __WIN32__))
__declspec (dllexport) int SCOLloadPCRE (mmachine m, cbmachine w);
__declspec (dllexport) int SCOLfreePCRE ();
#else
int SCOLloadPCRE (mmachine m);
int SCOLfreePCRE ();
#endif

#endif  /* __SCOL_GLIB_PREGEX_H__ */
