Process Hacker
Main Page
Namespaces
Data Structures
Files
File List
Globals
mxml-private.c
Go to the documentation of this file.
1
/*
2
* "$Id: mxml-private.c 315 2007-11-22 18:01:52Z mike $"
3
*
4
* Private functions for Mini-XML, a small XML-like file parsing library.
5
*
6
* Copyright 2003-2007 by Michael Sweet.
7
*
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU Library General Public
10
* License as published by the Free Software Foundation; either
11
* version 2, or (at your option) any later version.
12
*
13
* This program 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 General Public License for more details.
17
*
18
* Contents:
19
*
20
* mxml_error() - Display an error message.
21
* mxml_integer_cb() - Default callback for integer values.
22
* mxml_opaque_cb() - Default callback for opaque values.
23
* mxml_real_cb() - Default callback for real number values.
24
* _mxml_global() - Get global data.
25
*/
26
27
/*
28
* Include necessary headers...
29
*/
30
31
#include <
phbase.h
>
32
#include "
mxml-private.h
"
33
34
35
/*
36
* 'mxml_error()' - Display an error message.
37
*/
38
39
void
40
mxml_error
(
const
char
*format,
/* I - Printf-style format string */
41
...)
/* I - Additional arguments as needed */
42
{
43
va_list ap;
/* Pointer to arguments */
44
char
s[1024];
/* Message string */
45
_mxml_global_t
*global =
_mxml_global
();
46
/* Global data */
47
48
49
/*
50
* Range check input...
51
*/
52
53
if
(!format)
54
return
;
55
56
/*
57
* Format the error message string...
58
*/
59
60
va_start(ap, format);
61
62
_vsnprintf(s,
sizeof
(s), format, ap);
63
64
va_end(ap);
65
66
/*
67
* And then display the error message...
68
*/
69
70
if
(global->
error_cb
)
71
(*global->
error_cb
)(s);
72
else
73
fprintf(stderr,
"mxml: %s\n"
, s);
74
}
75
76
77
/*
78
* 'mxml_ignore_cb()' - Default callback for ignored values.
79
*/
80
81
mxml_type_t
/* O - Node type */
82
mxml_ignore_cb
(
mxml_node_t
*node)
/* I - Current node */
83
{
84
(void)node;
85
86
return
(
MXML_IGNORE
);
87
}
88
89
90
/*
91
* 'mxml_integer_cb()' - Default callback for integer values.
92
*/
93
94
mxml_type_t
/* O - Node type */
95
mxml_integer_cb
(
mxml_node_t
*node)
/* I - Current node */
96
{
97
(void)node;
98
99
return
(
MXML_INTEGER
);
100
}
101
102
103
/*
104
* 'mxml_opaque_cb()' - Default callback for opaque values.
105
*/
106
107
mxml_type_t
/* O - Node type */
108
mxml_opaque_cb
(
mxml_node_t
*node)
/* I - Current node */
109
{
110
(void)node;
111
112
return
(
MXML_OPAQUE
);
113
}
114
115
116
/*
117
* 'mxml_real_cb()' - Default callback for real number values.
118
*/
119
120
mxml_type_t
/* O - Node type */
121
mxml_real_cb
(
mxml_node_t
*node)
/* I - Current node */
122
{
123
(void)node;
124
125
return
(
MXML_REAL
);
126
}
127
128
/*
129
* '_mxml_global()' - Get global data.
130
*/
131
132
_mxml_global_t
*
/* O - Global data */
133
_mxml_global
(
void
)
134
{
135
static
_mxml_global_t
global =
/* Global data */
136
{
137
NULL,
/* error_cb */
138
1,
/* num_entity_cbs */
139
{
_mxml_entity_cb
},
/* entity_cbs */
140
72,
/* wrap */
141
NULL,
/* custom_load_cb */
142
NULL
/* custom_save_cb */
143
};
144
145
146
return
(&global);
147
}
148
149
150
/*
151
* End of "$Id: mxml-private.c 315 2007-11-22 18:01:52Z mike $".
152
*/
ProcessHacker
mxml
mxml-private.c
Generated by
1.8.2