libini_config  0.2.91
 All Data Structures Functions Groups Pages
ini_defines.h
1 /*
2  INI LIBRARY
3 
4  Header file for the internal constants for the INI interface.
5 
6  Copyright (C) Dmitri Pal <dpal@redhat.com> 2010
7 
8  INI Library is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  INI Library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License
19  along with INI Library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef INI_DEFINES_H
23 #define INI_DEFINES_H
24 
25 #define NAME_OVERHEAD 10
26 
27 #define SLASH "/"
28 
29 
30 /* Name of the special collection used to store parsing errors */
31 #define FILE_ERROR_SET "ini_file_error_set"
32 
33 /* Text error strings used when errors are printed out */
34 #define WARNING_TXT _("Warning")
35 #define ERROR_TXT _("Error")
36 /* For parse errors */
37 #define WRONG_COLLECTION _("Passed in list is not a list of parse errors.\n")
38 #define FAILED_TO_PROCCESS _("Internal Error. Failed to process error list.\n")
39 #define ERROR_HEADER _("Parsing errors and warnings in file: %s\n")
40 /* For grammar errors */
41 #define WRONG_GRAMMAR _("Passed in list is not a list of grammar errors.\n")
42 #define FAILED_TO_PROC_G _("Internal Error. Failed to process list of grammar errors.\n")
43 #define ERROR_HEADER_G _("Logical errors and warnings in file: %s\n")
44 /* For validation errors */
45 #define WRONG_VALIDATION _("Passed in list is not a list of validation errors.\n")
46 #define FAILED_TO_PROC_V _("Internal Error. Failed to process list of validation errors.\n")
47 #define ERROR_HEADER_V _("Validation errors and warnings in file: %s\n")
48 
49 #define LINE_FORMAT _("%s (%d) on line %d: %s")
50 #define MAX_ERROR_LINE 120
51 
52 /* Codes that parsing function can return */
53 #define RET_PAIR 0
54 #define RET_COMMENT 1
55 #define RET_SECTION 2
56 #define RET_INVALID 3
57 #define RET_EMPTY 4
58 #define RET_EOF 5
59 #define RET_ERROR 6
60 
61 #define INI_ERROR "errors"
62 #define INI_METADATA "meta"
63 #define INI_ERROR_NAME "errname"
64 #define INI_CONFIG_NAME "INI"
65 
66 #define INI_SPECIAL_KEY "="
67 #define INI_SECTION_KEY "["
68 
69 /* Internal sizes. MAX_KEY is defined in config.h */
70 #define MAX_VALUE PATH_MAX
71 #define BUFFER_SIZE MAX_KEY + MAX_VALUE + 3
72 
73 /* Beffer length used for int to string conversions */
74 #define CONVERSION_BUFFER 80
75 
76 /* Size of the block for a value */
77 #define INI_VALUE_BLOCK 100
78 
79 /* Default boundary */
80 #define INI_WRAP_BOUNDARY 80
81 
82 /* This constant belongs here. */
83 #define COL_CLASS_INI_BASE 20000
84 
89 #define COL_CLASS_INI_PERROR COL_CLASS_INI_BASE + 2
90 
96 #define COL_CLASS_INI_META COL_CLASS_INI_BASE + 4
97 
98 /* Family of errors */
99 #define INI_FAMILY_PARSING 0
100 #define INI_FAMILY_VALIDATION 1
101 #define INI_FAMILY_GRAMMAR 2
102 
103 #define INI_MV1S_MASK 0x000F /* Merge values options mask
104  * for one section */
105 #define INI_MV2S_MASK 0x00F0 /* Merge values options mask
106  * for two sections. */
107 #define INI_MS_MASK 0x0F00 /* Merge section options mask */
108 
109 
110 /* Different error string functions can be passed as callbacks */
111 typedef const char * (*error_fn)(int error);
112 
113 #endif