/usr/include/gutenprint/mxml.h is in libgutenprint-dev 5.2.13-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | /*
* Header file for mini-XML, a small XML-like file parsing library.
*
* Copyright 2003 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.
*/
/**
* @file gutenprint/mxml.h
* @brief Mini-XML XML parsing functions.
*/
/*
* Prevent multiple inclusion...
*/
#ifndef GUTENPRINT_MXML_H
# define GUTENPRINT_MXML_H
/*
* Include necessary headers...
*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <ctype.h>
# include <errno.h>
/*
* Constants...
*/
# define STP_MXML_WRAP 70 /* Wrap XML output at this column position */
# define STP_MXML_TAB 8 /* Tabs every N columns */
# define STP_MXML_NO_CALLBACK 0 /* Don't use a type callback */
# define STP_MXML_NO_PARENT 0 /* No parent for the node */
# define STP_MXML_DESCEND 1 /* Descend when finding/walking */
# define STP_MXML_NO_DESCEND 0 /* Don't descend when finding/walking */
# define STP_MXML_DESCEND_FIRST -1 /* Descend for first find */
# define STP_MXML_WS_BEFORE_OPEN 0 /* Callback for before open tag */
# define STP_MXML_WS_AFTER_OPEN 1 /* Callback for after open tag */
# define STP_MXML_WS_BEFORE_CLOSE 2 /* Callback for before close tag */
# define STP_MXML_WS_AFTER_CLOSE 3 /* Callback for after close tag */
# define STP_MXML_ADD_BEFORE 0 /* Add node before specified node */
# define STP_MXML_ADD_AFTER 1 /* Add node after specified node */
# define STP_MXML_ADD_TO_PARENT NULL /* Add node relative to parent */
/*
* Data types...
*/
typedef enum stp_mxml_type_e /**** The XML node type. ****/
{
STP_MXML_ELEMENT, /* XML element with attributes */
STP_MXML_INTEGER, /* Integer value */
STP_MXML_OPAQUE, /* Opaque string */
STP_MXML_REAL, /* Real value */
STP_MXML_TEXT /* Text fragment */
} stp_mxml_type_t;
typedef struct stp_mxml_attr_s /**** An XML element attribute value. ****/
{
char *name; /* Attribute name */
char *value; /* Attribute value */
} stp_mxml_attr_t;
typedef struct stp_mxml_value_s /**** An XML element value. ****/
{
char *name; /* Name of element */
int num_attrs; /* Number of attributes */
stp_mxml_attr_t *attrs; /* Attributes */
} stp_mxml_element_t;
typedef struct stp_mxml_text_s /**** An XML text value. ****/
{
int whitespace; /* Leading whitespace? */
char *string; /* Fragment string */
} stp_mxml_text_t;
typedef union stp_mxml_value_u /**** An XML node value. ****/
{
stp_mxml_element_t element; /* Element */
int integer; /* Integer number */
char *opaque; /* Opaque string */
double real; /* Real number */
stp_mxml_text_t text; /* Text fragment */
} stp_mxml_value_t;
typedef struct stp_mxml_node_s stp_mxml_node_t; /**** An XML node. ****/
struct stp_mxml_node_s /**** An XML node. ****/
{
stp_mxml_type_t type; /* Node type */
stp_mxml_node_t *next; /* Next node under same parent */
stp_mxml_node_t *prev; /* Previous node under same parent */
stp_mxml_node_t *parent; /* Parent node */
stp_mxml_node_t *child; /* First child node */
stp_mxml_node_t *last_child; /* Last child node */
stp_mxml_value_t value; /* Node value */
};
/*
* C++ support...
*/
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
/*
* Prototypes...
*/
extern void stp_mxmlAdd(stp_mxml_node_t *parent, int where,
stp_mxml_node_t *child, stp_mxml_node_t *node);
extern void stp_mxmlDelete(stp_mxml_node_t *node);
extern const char *stp_mxmlElementGetAttr(stp_mxml_node_t *node, const char *name);
extern void stp_mxmlElementSetAttr(stp_mxml_node_t *node, const char *name,
const char *value);
extern stp_mxml_node_t *stp_mxmlFindElement(stp_mxml_node_t *node, stp_mxml_node_t *top,
const char *name, const char *attr,
const char *value, int descend);
extern stp_mxml_node_t *stp_mxmlLoadFile(stp_mxml_node_t *top, FILE *fp,
stp_mxml_type_t (*cb)(stp_mxml_node_t *));
extern stp_mxml_node_t *stp_mxmlLoadFromFile(stp_mxml_node_t *top, const char *file,
stp_mxml_type_t (*cb)(stp_mxml_node_t *));
extern stp_mxml_node_t *stp_mxmlLoadString(stp_mxml_node_t *top, const char *s,
stp_mxml_type_t (*cb)(stp_mxml_node_t *));
extern stp_mxml_node_t *stp_mxmlNewElement(stp_mxml_node_t *parent, const char *name);
extern stp_mxml_node_t *stp_mxmlNewInteger(stp_mxml_node_t *parent, int integer);
extern stp_mxml_node_t *stp_mxmlNewOpaque(stp_mxml_node_t *parent, const char *opaque);
extern stp_mxml_node_t *stp_mxmlNewReal(stp_mxml_node_t *parent, double real);
extern stp_mxml_node_t *stp_mxmlNewText(stp_mxml_node_t *parent, int whitespace,
const char *string);
extern void stp_mxmlRemove(stp_mxml_node_t *node);
extern char *stp_mxmlSaveAllocString(stp_mxml_node_t *node,
int (*cb)(stp_mxml_node_t *, int));
extern int stp_mxmlSaveFile(stp_mxml_node_t *node, FILE *fp,
int (*cb)(stp_mxml_node_t *, int));
extern int stp_mxmlSaveToFile(stp_mxml_node_t *node, const char *fp,
int (*cb)(stp_mxml_node_t *, int));
extern int stp_mxmlSaveString(stp_mxml_node_t *node, char *buffer,
int bufsize,
int (*cb)(stp_mxml_node_t *, int));
extern stp_mxml_node_t *stp_mxmlWalkNext(stp_mxml_node_t *node, stp_mxml_node_t *top,
int descend);
extern stp_mxml_node_t *stp_mxmlWalkPrev(stp_mxml_node_t *node, stp_mxml_node_t *top,
int descend);
/*
* C++ support...
*/
# ifdef __cplusplus
}
# endif /* __cplusplus */
#endif /* !GUTENPRINT_MXML_H */
|