mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
b94b7890b8
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@3802 21ef857c-d57f-4fe0-8362-d861dc6d29cd
153 lines
3.0 KiB
C
153 lines
3.0 KiB
C
/*
|
|
* "$Id: mxml-private.c 315 2007-11-22 18:01:52Z mike $"
|
|
*
|
|
* Private functions for Mini-XML, a small XML-like file parsing library.
|
|
*
|
|
* Copyright 2003-2007 by Michael Sweet.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* Contents:
|
|
*
|
|
* mxml_error() - Display an error message.
|
|
* mxml_integer_cb() - Default callback for integer values.
|
|
* mxml_opaque_cb() - Default callback for opaque values.
|
|
* mxml_real_cb() - Default callback for real number values.
|
|
* _mxml_global() - Get global data.
|
|
*/
|
|
|
|
/*
|
|
* Include necessary headers...
|
|
*/
|
|
|
|
#include <phbase.h>
|
|
#include "mxml-private.h"
|
|
|
|
|
|
/*
|
|
* 'mxml_error()' - Display an error message.
|
|
*/
|
|
|
|
void
|
|
mxml_error(const char *format, /* I - Printf-style format string */
|
|
...) /* I - Additional arguments as needed */
|
|
{
|
|
va_list ap; /* Pointer to arguments */
|
|
char s[1024]; /* Message string */
|
|
_mxml_global_t *global = _mxml_global();
|
|
/* Global data */
|
|
|
|
|
|
/*
|
|
* Range check input...
|
|
*/
|
|
|
|
if (!format)
|
|
return;
|
|
|
|
/*
|
|
* Format the error message string...
|
|
*/
|
|
|
|
va_start(ap, format);
|
|
|
|
_vsnprintf(s, sizeof(s), format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
/*
|
|
* And then display the error message...
|
|
*/
|
|
|
|
if (global->error_cb)
|
|
(*global->error_cb)(s);
|
|
else
|
|
fprintf(stderr, "mxml: %s\n", s);
|
|
}
|
|
|
|
|
|
/*
|
|
* 'mxml_ignore_cb()' - Default callback for ignored values.
|
|
*/
|
|
|
|
mxml_type_t /* O - Node type */
|
|
mxml_ignore_cb(mxml_node_t *node) /* I - Current node */
|
|
{
|
|
(void)node;
|
|
|
|
return (MXML_IGNORE);
|
|
}
|
|
|
|
|
|
/*
|
|
* 'mxml_integer_cb()' - Default callback for integer values.
|
|
*/
|
|
|
|
mxml_type_t /* O - Node type */
|
|
mxml_integer_cb(mxml_node_t *node) /* I - Current node */
|
|
{
|
|
(void)node;
|
|
|
|
return (MXML_INTEGER);
|
|
}
|
|
|
|
|
|
/*
|
|
* 'mxml_opaque_cb()' - Default callback for opaque values.
|
|
*/
|
|
|
|
mxml_type_t /* O - Node type */
|
|
mxml_opaque_cb(mxml_node_t *node) /* I - Current node */
|
|
{
|
|
(void)node;
|
|
|
|
return (MXML_OPAQUE);
|
|
}
|
|
|
|
|
|
/*
|
|
* 'mxml_real_cb()' - Default callback for real number values.
|
|
*/
|
|
|
|
mxml_type_t /* O - Node type */
|
|
mxml_real_cb(mxml_node_t *node) /* I - Current node */
|
|
{
|
|
(void)node;
|
|
|
|
return (MXML_REAL);
|
|
}
|
|
|
|
/*
|
|
* '_mxml_global()' - Get global data.
|
|
*/
|
|
|
|
_mxml_global_t * /* O - Global data */
|
|
_mxml_global(void)
|
|
{
|
|
static _mxml_global_t global = /* Global data */
|
|
{
|
|
NULL, /* error_cb */
|
|
1, /* num_entity_cbs */
|
|
{ _mxml_entity_cb }, /* entity_cbs */
|
|
72, /* wrap */
|
|
NULL, /* custom_load_cb */
|
|
NULL /* custom_save_cb */
|
|
};
|
|
|
|
|
|
return (&global);
|
|
}
|
|
|
|
|
|
/*
|
|
* End of "$Id: mxml-private.c 315 2007-11-22 18:01:52Z mike $".
|
|
*/
|