libdebian-installer
parser.h
1 /*
2  * parser.h
3  *
4  * Copyright (C) 2003 Bastian Blank <waldi@debian.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DEBIAN_INSTALLER__PARSER_H
21 #define DEBIAN_INSTALLER__PARSER_H
22 
23 #include <debian-installer/hash.h>
24 #include <debian-installer/slist.h>
25 #include <debian-installer/string.h>
26 
27 #include <stdbool.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 
32 typedef struct di_parser_info di_parser_info;
34 
49 typedef void di_parser_fields_function_read (void **data, const di_parser_fieldinfo *fip, di_rstring *field_modifier, di_rstring *value, void *user_data);
50 
58 typedef void di_parser_fields_function_write_callback (const di_rstring *field, const di_rstring *value, void *data);
59 
70 typedef void di_parser_fields_function_write (void **data, const di_parser_fieldinfo *fip, di_parser_fields_function_write_callback callback, void *callback_data, void *user_data);
71 
76 typedef void *di_parser_read_entry_new (void *user_data);
77 
82 typedef int di_parser_read_entry_finish (void *data, void *user_data);
83 
88 typedef void *di_parser_write_entry_next (void **state_data, void *user_data);
89 
94 {
97  bool modifier;
98  bool wildcard;
99 };
100 
105 {
109  unsigned int integer;
111 };
112 
116 #define DI_PARSER_FIELDINFO(name, read, write, integer) \
117  { { name, sizeof (name) - 1 }, read, write, integer }
118 
136 
154 
155 di_parser_info *di_parser_info_alloc (void);
156 void di_parser_info_free (di_parser_info *info);
157 
158 void di_parser_info_add (di_parser_info *info, const di_parser_fieldinfo *fieldinfo[]);
159 
161 #endif