download parsecfg.h
Language: C
License: GPL
Copyright: (C) 1999-2001 Yuuki NINOMIYA */
LOC: 69
Project Info
grub.org - Distributed Internet Crawler(grub)
Server: SourceForge
Type: cvs
...ge\g\grub\grub\client\util\
   alt_ftw.c
   alt_ftw.h
   bin_test_util.dsp
   clog.cpp
   clog.h
   ConfigFileInfo.h
   crc.h
   crc_32.c
   crc_32.cpp
   crc_32.h
   crc_test.c
   crc_test.cpp
   crc32.c
   crc32.h
   dbl_list.c
   dbl_list.h
   delay.cpp
   delay.h
   diagnose.h
   fc32.c
   file_data.c
   file_data.h
   getopt.c
   getopt.h
   grubconf.c
   grubconf.h
   GrubExp.cpp
   GrubExp.h
   Gui.cpp
   Gui.h
   intl.h
   lib_util.dsp
   lockfile.cpp
   lockfile.h
   Makefile.am
   parsecfg.c
   parsecfg.h
   platform.h
   rmfiles.c
   rmfiles.h
   ServerSettings.cpp
   ServerSettings.h
   sniptype.h
   StatusInterface.cpp
   StatusInterface.h
   strip_url.c
   strip_url.h
   test_util.cpp

/**************************************************************************/
/*                                                                        */
/*  parsecfg - a library for parsing a configuration file                 */
/*  Copyright (C) 1999-2001 Yuuki NINOMIYA <gm@debian.or.jp>              */
/*                                                                        */
/*  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; either version 2, 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 General Public License for more details.                          */
/*                                                                        */
/*  You should have received a copy of the GNU 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.                                           */
/*                                                                        */
/**************************************************************************/

/* $Id: parsecfg.h,v 1.2 2001/05/15 19:14:33 ozra Exp $ */

#ifndef PARSECFG_H_INCLUDED
#define PARSECFG_H_INCLUDED


#undef PARSECFG_VERSION
#define PARSECFG_VERSION "3.6.6"

/* error code */
typedef enum {
	CFG_NO_ERROR,
	CFG_OPEN_FAIL,
	CFG_CREATE_FAIL,
	CFG_SYNTAX_ERROR,
	CFG_WRONG_PARAMETER,
	CFG_INTERNAL_ERROR,
	CFG_INVALID_NUMBER,
	CFG_OUT_OF_RANGE,
	CFG_MEM_ALLOC_FAIL,
	CFG_BOOL_ERROR,
	CFG_USED_SECTION,
	CFG_NO_CLOSING_BRACE,
	CFG_JUST_RETURN_WITHOUT_MSG
} cfgErrorCode;

/* type of the configuration file */
typedef enum {
	CFG_SIMPLE,
	CFG_INI
} cfgFileType;

/* constants for recognized value types */
typedef enum {
	CFG_END,
	CFG_BOOL,
	CFG_STRING,
	CFG_INT,
	CFG_UINT,
	CFG_LONG,
	CFG_ULONG,
	CFG_STRING_LIST,
	CFG_FLOAT,
	CFG_DOUBLE
} cfgValueType;

typedef enum {
	CFG_PARAMETER,
	CFG_VALUE,
	CFG_SECTION
} cfgKeywordValue;

typedef enum {
	CFG_NO_QUOTE,
	CFG_SINGLE_QUOTE,
	CFG_DOUBLE_QUOTE
} cfgQuote;


typedef struct {
	char *parameterName;
	cfgValueType type;
	void *value;
} cfgStruct;

typedef struct cfgList_tag {
	char *str;
	struct cfgList_tag *next;
} cfgList;


/* proto type declaration of public functions */

#ifdef __cplusplus
extern "C" {
#endif

void cfgSetFatalFunc(void (*f) (cfgErrorCode, const char *, int, const char *));
int cfgParse(const char *file, cfgStruct cfg[], cfgFileType type);
int cfgDump(const char *file, cfgStruct cfg[], cfgFileType type, int max_section);
int fetchVarFromCfgFile(const char *file, char *parameter_name, void *result_value, cfgValueType value_type, cfgFileType file_type, int section_num, const char *section_name);
int cfgSectionNameToNumber(const char *name);
char *cfgSectionNumberToName(int num);
int cfgAllocForNewSection(cfgStruct cfg[], const char *name);
int cfgStoreValue(cfgStruct cfg[], const char *parameter, const char *value, cfgFileType type, int section);

#ifdef __cplusplus
}
#endif

#endif /* PARSECFG_H_INCLUDED */

About Koders | Resources | Downloads | Support | Black Duck | Submit Project | Terms of Service | DMCA | Privacy Policy | Site Map| Contact Us