libini_config  0.1.3
 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\n")
50 
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_ERROR_NAME "errname"
63 
64 /* Internal sizes. MAX_KEY is defined in config.h */
65 #define MAX_VALUE PATH_MAX
66 #define BUFFER_SIZE MAX_KEY + MAX_VALUE + 3
67 
68 /* Beffer length used for int to string conversions */
69 #define CONVERSION_BUFFER 80
70 
71 /* Different error string functions can be passed as callbacks */
72 typedef const char * (*error_fn)(int error);
73 
74 #endif