libini_config 0.1.3
ini_defines.h
00001 /*
00002     INI LIBRARY
00003 
00004     Header file for the internal constants for the INI interface.
00005 
00006     Copyright (C) Dmitri Pal <dpal@redhat.com> 2010
00007 
00008     INI Library is free software: you can redistribute it and/or modify
00009     it under the terms of the GNU Lesser General Public License as published by
00010     the Free Software Foundation, either version 3 of the License, or
00011     (at your option) any later version.
00012 
00013     INI Library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU Lesser General Public License for more details.
00017 
00018     You should have received a copy of the GNU Lesser General Public License
00019     along with INI Library.  If not, see <http://www.gnu.org/licenses/>.
00020 */
00021 
00022 #ifndef INI_DEFINES_H
00023 #define INI_DEFINES_H
00024 
00025 #define NAME_OVERHEAD   10
00026 
00027 #define SLASH           "/"
00028 
00029 
00030 /* Name of the special collection used to store parsing errors */
00031 #define FILE_ERROR_SET  "ini_file_error_set"
00032 
00033 /* Text error strings used when errors are printed out */
00034 #define WARNING_TXT         _("Warning")
00035 #define ERROR_TXT           _("Error")
00036 /* For parse errors */
00037 #define WRONG_COLLECTION    _("Passed in list is not a list of parse errors.\n")
00038 #define FAILED_TO_PROCCESS  _("Internal Error. Failed to process error list.\n")
00039 #define ERROR_HEADER        _("Parsing errors and warnings in file: %s\n")
00040 /* For grammar errors */
00041 #define WRONG_GRAMMAR       _("Passed in list is not a list of grammar errors.\n")
00042 #define FAILED_TO_PROC_G    _("Internal Error. Failed to process list of grammar errors.\n")
00043 #define ERROR_HEADER_G      _("Logical errors and warnings in file: %s\n")
00044 /* For validation errors */
00045 #define WRONG_VALIDATION    _("Passed in list is not a list of validation errors.\n")
00046 #define FAILED_TO_PROC_V    _("Internal Error. Failed to process list of validation errors.\n")
00047 #define ERROR_HEADER_V      _("Validation errors and warnings in file: %s\n")
00048 
00049 #define LINE_FORMAT         _("%s (%d) on line %d: %s\n")
00050 
00051 
00052 /* Codes that parsing function can return */
00053 #define RET_PAIR        0
00054 #define RET_COMMENT     1
00055 #define RET_SECTION     2
00056 #define RET_INVALID     3
00057 #define RET_EMPTY       4
00058 #define RET_EOF         5
00059 #define RET_ERROR       6
00060 
00061 #define INI_ERROR       "errors"
00062 #define INI_ERROR_NAME  "errname"
00063 
00064 /* Internal sizes. MAX_KEY is defined in config.h */
00065 #define MAX_VALUE       PATH_MAX
00066 #define BUFFER_SIZE     MAX_KEY + MAX_VALUE + 3
00067 
00068 /* Beffer length used for int to string conversions */
00069 #define CONVERSION_BUFFER 80
00070 
00071 /* Different error string functions can be passed as callbacks */
00072 typedef const char * (*error_fn)(int error);
00073 
00074 #endif
 All Data Structures