3
* Copyright © 2009 Scott James Remnant <scott@netsplit.com>.
4
* Copyright © 2009 Canonical Ltd.
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2, as
8
* published by the Free Software Foundation.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License along
16
* with this program; if not, write to the Free Software Foundation, Inc.,
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
#ifndef NIH_DBUS_TOOL_PARSE_H
21
#define NIH_DBUS_TOOL_PARSE_H
23
#include <nih/macros.h>
27
#include "interface.h"
37
* Type of parsed object on the stack.
39
typedef enum parse_stack_type {
52
* @entry: list header,
53
* @type: type of object parsed,
54
* @data: object pointer.
56
* This structure represents an object parsed from the XML file and is used
57
* as a stack. @type indicates which type of object is being parsed, and
58
* the @data pointer is part of a union of the different types of pointer.
60
typedef struct parse_stack {
77
* @parent: parent for node,
78
* @stack: parse stack,
79
* @filename: filename being parsed,
80
* @node: top-level node.
82
* This structure is used as the user data for the XML parser, it tracks the
83
* stack of objects being parsed and returns the top-level node object which
84
* has all of the interfaces, etc.
86
typedef struct parse_context {
96
ParseStack *parse_stack_push (const void *parent, NihList *stack,
97
ParseStackType type, void *data)
98
__attribute__ ((warn_unused_result, malloc));
99
ParseStack *parse_stack_top (NihList *stack);
101
void parse_start_tag (XML_Parser xmlp, const char *tag,
103
void parse_end_tag (XML_Parser xmlp, const char *tag);
105
Node * parse_xml (const void *parent, int fd, const char *filename)
106
__attribute__ ((warn_unused_result, malloc));
110
#endif /* NIH_DBUS_TOOL_PARSE_H */