/home/dko/projects/mobilec/trunk/src/mxml-2.2.2/mxml-private.c

Go to the documentation of this file.
00001 /* SVN FILE INFO
00002  * $Revision: 174 $ : Last Committed Revision
00003  * $Date: 2008年06月24日 10:50:29 -0700 (2008年6月24日) $ : Last Committed Date */
00004 /*
00005  * "$Id: mxml-private.c,v 1.1 2007年05月23日 20:43:27 david_ko Exp $"
00006  *
00007  * Private functions for Mini-XML, a small XML-like file parsing library.
00008  *
00009  * Copyright 2003-2005 by Michael Sweet.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Library General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019  * GNU General Public License for more details.
00020  *
00021  * Contents:
00022  *
00023  * mxml_error() - Display an error message.
00024  * mxml_integer_cb() - Default callback for integer values.
00025  * mxml_opaque_cb() - Default callback for opaque values.
00026  * mxml_real_cb() - Default callback for real number values.
00027  */
00028 
00029 /*
00030  * Include necessary headers...
00031  */
00032 
00033 #include "config.h"
00034 #include "mxml.h"
00035 
00036 
00037 /*
00038  * Error callback function...
00039  */
00040 
00041 void (*mxml_error_cb)(const char *) = NULL;
00042 
00043 
00044 /*
00045  * 'mxml_error()' - Display an error message.
00046  */
00047 
00048 void
00049 mxml_error(const char *format, /* I - Printf-style format string */
00050 ...) /* I - Additional arguments as needed */
00051 {
00052 va_list ap; /* Pointer to arguments */
00053 char *s; /* Message string */
00054 
00055 
00056 /*
00057  * Range check input...
00058  */
00059 
00060 if (!format)
00061 return;
00062 
00063 /*
00064  * Format the error message string...
00065  */
00066 
00067 va_start(ap, format);
00068 
00069 s = mxml_strdupf(format, ap);
00070 
00071 va_end(ap);
00072 
00073 /*
00074  * And then display the error message...
00075  */
00076 
00077 if (mxml_error_cb)
00078 (*mxml_error_cb)(s);
00079 else
00080 fprintf(stderr, "mxml: %s\n", s);
00081 
00082 /*
00083  * Free the string...
00084  */
00085 
00086 free(s);
00087 }
00088 
00089 
00090 /*
00091  * 'mxml_integer_cb()' - Default callback for integer values.
00092  */
00093 
00094 mxml_type_t /* O - Node type */
00095 mxml_integer_cb(mxml_node_t *node) /* I - Current node */
00096 {
00097 (void)node;
00098 
00099 return (MXML_INTEGER);
00100 }
00101 
00102 
00103 /*
00104  * 'mxml_opaque_cb()' - Default callback for opaque values.
00105  */
00106 
00107 mxml_type_t /* O - Node type */
00108 mxml_opaque_cb(mxml_node_t *node) /* I - Current node */
00109 {
00110 (void)node;
00111 
00112 return (MXML_OPAQUE);
00113 }
00114 
00115 
00116 /*
00117  * 'mxml_real_cb()' - Default callback for real number values.
00118  */
00119 
00120 mxml_type_t /* O - Node type */
00121 mxml_real_cb(mxml_node_t *node) /* I - Current node */
00122 {
00123 (void)node;
00124 
00125 return (MXML_REAL);
00126 }
00127 
00128 
00129 /*
00130  * End of "$Id: mxml-private.c,v 1.1 2007年05月23日 20:43:27 david_ko Exp $".
00131  */

Generated on Tue Oct 28 17:03:22 2008 for Mobile-C by doxygen 1.5.5

AltStyle によって変換されたページ (->オリジナル) /