/*

                                   _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-2005
       "Ian (Larry) Latter" <ian dot latter at midnightcode dot org>

    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-config.h :: Midnight Code config file library		*/


#ifndef __MIDNIGHTCODE_CONFIG_H
#define __MIDNIGHTCODE_CONFIG_H


enum midnightcode_config_option_t
{
  MIDNIGHTCODE_CONFIG_OPTION_NONE = 0,
  MIDNIGHTCODE_CONFIG_OPTION_MERGEARGS = 1,
  MIDNIGHTCODE_CONFIG_OPTION_AUTONEW = 2,
  MIDNIGHTCODE_CONFIG_OPTION_SILENT = 4,
  MIDNIGHTCODE_CONFIG_OPTION_ALL = 255
};

enum midnightcode_config_type_t
{
  MIDNIGHTCODE_CONFIG_TYPE_NONE = 0,
  MIDNIGHTCODE_CONFIG_TYPE_NEWSET,
  MIDNIGHTCODE_CONFIG_TYPE_INI
};

enum midnightcode_config_element_type_t
{
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_NONE = 1,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_STRING,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_INT,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_LONG,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_VAL,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_FLOAT,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_DOUBLE,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_HOST,
  MIDNIGHTCODE_CONFIG_ELEMENT_TYPE_IP
};

enum midnightcode_config_error_t
{
  MIDNIGHTCODE_CONFIG_ERROR_NONE = 0,
  MIDNIGHTCODE_CONFIG_ERROR_SYNTAX = -1,
  MIDNIGHTCODE_CONFIG_ERROR_NONEW = -2,
  MIDNIGHTCODE_CONFIG_ERROR_EXISTS = -3,
  MIDNIGHTCODE_CONFIG_ERROR_WRONGTYPE = -4
};

struct midnightcode_config_element_t
{
  char command[256];
  char structure[256];
  char section[256];
  char variable[256];
  char * value;
  int value_size;
  midnightcode_list_entry(midnightcode_config_element_t)
};

midnightcode_list_head(midnightcode_config_head_t,
                       midnightcode_config_element_t)

int midnightcode_config_parseline(char *config_buf, int config_buf_max,
                             struct midnightcode_config_head_t * elements,
                             int type, int options);
int midnightcode_config_read(char *config_file,
                             struct midnightcode_config_head_t * elements,
                             int type, int options);



#endif
