Lines Matching defs:parser
2 /* config-parser-trivial.c XML-library-agnostic configuration file parser
26 #include "config-parser-common.h"
27 #include "config-parser-trivial.h"
34 * TRIVIAL parser for bus configuration file.
85 BusConfigParser *parser;
87 parser = dbus_new0 (BusConfigParser, 1);
88 if (parser == NULL)
91 parser->type = ELEMENT_NONE;
94 parser->service_dirs = NULL;
97 if (!_dbus_string_init (&parser->user))
99 if (!_dbus_string_init (&parser->bus_type))
101 if (!_dbus_string_init (&parser->service_helper))
105 return parser;
109 _dbus_string_free (&parser->bus_type);
111 _dbus_string_free (&parser->user);
113 dbus_free (parser);
119 bus_config_parser_unref (BusConfigParser *parser)
121 _dbus_string_free (&parser->user);
122 _dbus_string_free (&parser->service_helper);
123 _dbus_string_free (&parser->bus_type);
125 _dbus_list_foreach (&parser->service_dirs,
129 _dbus_list_clear (&parser->service_dirs);
131 dbus_free (parser);
135 bus_config_parser_check_doctype (BusConfigParser *parser,
154 bus_config_parser_start_element (BusConfigParser *parser,
161 parser->type = bus_config_parser_element_name_to_type (element_name);
163 switch (parser->type)
184 service_dirs_append_link_unique_or_free (&parser->service_dirs, link);
191 _dbus_verbose (" START We dont care about '%s' type '%i'\n", element_name, parser->type);
199 bus_config_parser_end_element (BusConfigParser *parser,
208 bus_config_parser_content (BusConfigParser *parser,
237 switch (parser->type)
251 if (!_dbus_list_append (&parser->service_dirs, cpath))
262 if (!_dbus_string_copy (&content_sane, 0, &parser->service_helper, 0))
272 if (!_dbus_string_copy (&content_sane, 0, &parser->user, 0))
282 if (!_dbus_string_copy (&content_sane, 0, &parser->bus_type, 0))
292 _dbus_verbose (" CONTENTS We dont care '%s' type '%i'\n", _dbus_string_get_const_data (&content_sane), parser->type);
307 bus_config_parser_finished (BusConfigParser *parser,
316 bus_config_parser_get_user (BusConfigParser *parser)
318 return _dbus_string_get_const_data (&parser->user);
322 bus_config_parser_get_type (BusConfigParser *parser)
324 return _dbus_string_get_const_data (&parser->bus_type);
328 bus_config_parser_get_service_dirs (BusConfigParser *parser)
330 return &parser->service_dirs;
347 BusConfigParser *parser;
359 parser = bus_config_load (full_path, TRUE, NULL, &error);
360 if (parser == NULL)
370 user = bus_config_parser_get_user (parser);
387 type = bus_config_parser_get_type (parser);
401 dirs = bus_config_parser_get_service_dirs (parser);
408 /* NOTE: We tested the specific return values in the config-parser tests */
413 if (parser != NULL)
414 bus_config_parser_unref (parser);
424 BusConfigParser *parser;
429 parser = bus_config_load (full_path, TRUE, NULL, &error);
430 if (parser == NULL)
459 bus_config_parser_unref (parser);
687 /* we don't process all the invalid files, as the trivial parser can't hope
701 /* check to see if we got the correct values from the parser */