/*

                                   _JNJ`                        
                               .JNMH`                           
                              JMMF`       `;.                   
                            .NMM)          `MN.                 
                            MMM)            (MML                
                           (MMM`             MMML               
                     M  I  D  N  I  G  H  T    C  o  D  E       
                           (NMMF             MHNH               
                            NMML            .MMM                
                             NMML          .NMH                 
                              4MMNL       .#F                   
                               `4HNNL_   `                      
                                   `"""`                        

                          Copyright (C) 2004-2006
       "Ian (Larry) Latter" <ian dot latter at midnightcode dot org>

    Midnight Code is a registered trademark of Ian Latter.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, and mirrored at the Midnight Code web
    site; as at version 2 of the License only.
  
    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
    General Public License for more details.
  
    You should have received a copy of the GNU General Public License
    (version 2) along with this program; if not, write to the Free
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA, or see http://midnightcode.org/gplv2.txt

*/


/* midnightcode-parse.h :: Midnight Code parse library			*/


#ifndef __MIDNIGHTCODE_PARSE_H
#define __MIDNIGHTCODE_PARSE_H 1


enum midnightcode_parse_charset_t
{
  MIDNIGHTCODE_PARSE_CHARSET_NONE = 0,
  MIDNIGHTCODE_PARSE_CHARSET_ALPHA = 1,
  MIDNIGHTCODE_PARSE_CHARSET_NUMERIC = 2,
  MIDNIGHTCODE_PARSE_CHARSET_ALPHANUMERIC = 3,
  MIDNIGHTCODE_PARSE_CHARSET_ABNFVCHAR = 4,
  MIDNIGHTCODE_PARSE_CHARSET_PRINTABLE = 5
};

enum midnightcode_parse_type_t
{
  MIDNIGHTCODE_PARSE_TYPE_NONE = 1,
  MIDNIGHTCODE_PARSE_TYPE_STRING,
  MIDNIGHTCODE_PARSE_TYPE_INT,
  MIDNIGHTCODE_PARSE_TYPE_LONG,
  MIDNIGHTCODE_PARSE_TYPE_VAL,
  MIDNIGHTCODE_PARSE_TYPE_FLOAT,
  MIDNIGHTCODE_PARSE_TYPE_DOUBLE,
  MIDNIGHTCODE_PARSE_TYPE_LONGDOUBLE,
  MIDNIGHTCODE_PARSE_TYPE_HWADDR,
  MIDNIGHTCODE_PARSE_TYPE_HOST,
  MIDNIGHTCODE_PARSE_TYPE_IP
};

enum midnightcode_parse_ext_type_t
{
  MIDNIGHTCODE_PARSE_EXT_TYPE_NONE = 0,
  MIDNIGHTCODE_PARSE_EXT_TYPE_HTML = 1,
  MIDNIGHTCODE_PARSE_EXT_TYPE_DOCUMENT = 2,
  MIDNIGHTCODE_PARSE_EXT_TYPE_PICTURE = 3,
  MIDNIGHTCODE_PARSE_EXT_TYPE_VIDEO = 4,
  MIDNIGHTCODE_PARSE_EXT_TYPE_AUDIO = 5,
  MIDNIGHTCODE_PARSE_EXT_TYPE_ARCHIVE = 6
};

struct midnightcode_parse_extension_t
{
  const char * ext;
};

int midnightcode_parse_any(char *haystack, char *needle);
int midnightcode_parse_any_offset(char *haystack, char *needle);
int midnightcode_parse_any_len(char *haystack, char *needle,
                            int haystack_len, int needle_len);
int midnightcode_parse_strstr(char *haystack, char *needle,
                            int haystack_len, int needle_len);
int midnightcode_parse_ascii(char *haystack, int charset);
int midnightcode_parse_yesno(char *string_buf, int default_return);
int midnightcode_parse_size(long double * capacity, char * scale,
                            int scale_len);
int midnightcode_parse_trim(char *string_buf, int string_buf_max);
int midnightcode_parse_toupper(char *string_buf);
int midnightcode_parse_tolower(char *string_buf);
int midnightcode_parse_replace_char(char * string_buf, char * find_buf,
                            char * replace_buf);
int midnightcode_parse_extmatch(struct midnightcode_parse_extension_t * exts,
                            char * url, int url_len);
int midnightcode_parse_exttype(char *url, int url_len, int type);
int midnightcode_parse_strtourl(char *string_dst, char *parse_src,
                            int string_dst_max);
int midnightcode_parse_strtoarg(char *string_buf, int string_buf_max,
                            char **args, int args_max);
int midnightcode_parse_strtovar(void * variable, char * buffer,
                            int length, int value, int type);
int midnightcode_parse_vartostr(char * buffer, void * variable,
                            int length, int value, int type);
int midnightcode_parse_unserialize(void * variable, char * buffer,
                            int length, int value, int type);
int midnightcode_parse_serialize(char * buffer, void * variable,
                            int length, int value, int type);
int midnightcode_hex_dump(char * buffer, int length, int type);



#endif
