This file is indexed.

/usr/include/speech_tools/rxp/XML_Parser.h is in libestools2.1-dev 1:2.1~release-8.

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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
 /************************************************************************/
 /*                                                                      */
 /*                Centre for Speech Technology Research                 */
 /*                     University of Edinburgh, UK                      */
 /*                       Copyright (c) 1996,1997                        */
 /*                        All Rights Reserved.                          */
 /*                                                                      */
 /*  Permission is hereby granted, free of charge, to use and distribute */
 /*  this software and its documentation without restriction, including  */
 /*  without limitation the rights to use, copy, modify, merge, publish, */
 /*  distribute, sublicense, and/or sell copies of this work, and to     */
 /*  permit persons to whom this work is furnished to do so, subject to  */
 /*  the following conditions:                                           */
 /*   1. The code must retain the above copyright notice, this list of   */
 /*      conditions and the following disclaimer.                        */
 /*   2. Any modifications must be clearly marked as such.               */
 /*   3. Original authors' names are not deleted.                        */
 /*   4. The authors' names are not used to endorse or promote products  */
 /*      derived from this software without specific prior written       */
 /*      permission.                                                     */
 /*                                                                      */
 /*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK       */
 /*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING     */
 /*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT  */
 /*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE    */
 /*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   */
 /*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN  */
 /*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,         */
 /*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF      */
 /*  THIS SOFTWARE.                                                      */
 /*                                                                      */
 /*************************************************************************/


#ifndef __XML_PARSER_H__
#define __XML_PARSER_H__

#if !defined(CHAR_SIZE)
#    define CHAR_SIZE 8
#endif

#if (CHAR_SIZE!=8)
#   error EST can only handle 8 bit characters
#endif

#include "EST_String.h"
#include "EST_Regex.h"
#include "EST_TKVL.h"
#include "EST_THash.h"
#include "EST_TDeque.h"
#include "EST_TList.h"
#include "rxp/rxp.h"

// We only use types and functions from rxp.h, so we can throw away
// some of the macros which cause problems.

#undef get


/**@name XML Parser
  * Recursive descent parsing skeleton with hooks for processing.
  * A C++ wrapper around the rxp parser.
  * 
  * @author Richard Caley <rjc@cstr.ed.ac.uk>
  * @version $Id: XML_Parser.h,v 1.3 2004/05/04 00:00:17 awb Exp $
  */
//@{

class XML_Parser;
class XML_Parser_Class;

/// Nice name for list of attribute-value pairs.
typedef EST_TStringHash<EST_String> XML_Attribute_List;

/** A Class of parsers, All parsers share callbacks and a
  * list of known public IDs.
  */
class XML_Parser_Class {

private:

  /** Map PUBLIC and SYSTEM IDs to places on the local system.
    */
  EST_TKVL<EST_Regex, EST_String> known_ids;

protected:
  /** Do any necessary remappings and open a stream which reads the given
    * entity.
    */
  static InputSource open_entity(Entity ent, void *arg);
  

  /**@name The callbacks.
    * 
    * These methods can be overridden in a subclass to create a class
    * of parsers to do whatever you want.
    */
  //@{

  /** Called when starting a document.
    */
  virtual void document_open(XML_Parser_Class &c,
			XML_Parser &p,
			void *data);

  /** Called at the end of a document.
    */
  virtual void document_close(XML_Parser_Class &c,
			 XML_Parser &p,
			 void *data);
  
  /** Called when an element starts.
    */
  virtual void element_open(XML_Parser_Class &c,
		       XML_Parser &p,
		       void *data,
		       const char *name,
		       XML_Attribute_List &attributes);

  /** Called when an element ends.
    */
  virtual void element_close(XML_Parser_Class &c,
			XML_Parser &p,
			void *data,
			const char *name);

  /** Called for empty elements.
    *
    * Defaults to element_open(...) followed by element_closed(...).
    */
  virtual void element(XML_Parser_Class &c,
		  XML_Parser &p,
		  void *data,
		  const char *name,
		  XML_Attribute_List &attributes);

  /** Called for parsed character data sequences.
    */
  virtual void pcdata(XML_Parser_Class &c,
		 XML_Parser &p,
		 void *data,
		 const char *chars);
  /** Called for unparsed character data sequences.
    */
  virtual void cdata(XML_Parser_Class &c,
		XML_Parser &p,
		void *data,
		const char *chars);

  /** Called for processing directives.
    */
  virtual void processing(XML_Parser_Class &c,
		     XML_Parser &p,
		     void *data,
		     const char *instruction);

  /** Called when there is an error in parsing.
    */
  virtual void error(XML_Parser_Class &c,
		XML_Parser &p,
		void *data);
  //@}

  /** This can be called from any of the callbacks to present "message"
    * as an error through the error callback, thus getting filename and
    * line information into the message.
    */
  void error(XML_Parser_Class &c,
	     XML_Parser &p,
	     void *data,
	     EST_String message);

  /// Get the error message for the last error.
  const char *get_error(XML_Parser &p);

public:

  /** Create an object representing the class of parsers. 
    */
  XML_Parser_Class();

  virtual ~XML_Parser_Class() { }

  /** Add a mapping from entity ID (SYSTEM or PUBLIC) to filename.
    * 
    * The string can contain escapes like \2 which are replaced by
    * the text matching the Nth bracketed part of the regular expression.
    */
  void register_id(EST_Regex id_pattern, EST_String directory);

  /** Fill in the list with the known entity ID mappings.
    */

  void registered_ids(EST_TList<EST_String> &list);

  /**@name Creating a parser
    * 
    * Each of these methods creates a one-shot parser which will run over the
    * indicated text.
    */
  //@{

  /// Create a parser for the RXP InputSource.
  XML_Parser *make_parser(InputSource source, void *data);

  /// Create a parser for the RXP InputSource.
  XML_Parser *make_parser(InputSource source, Entity initial_entity, void *data);

  /// Create a parser for a stdio input stream.
  XML_Parser *make_parser(FILE *input, void *data);

  /** Create a parser for a stdio input stream, giving  a description for
    * use in errors.
    */
  XML_Parser *make_parser(FILE *input, const EST_String desc, void *data);

  // Create a parser for the named file.
  XML_Parser *make_parser(const EST_String filename, void *data);

  //@}

  /** Utility which tries to open an entity called ID at places
    * specified in the mapping of this parser class.
    */

  InputSource try_and_open(Entity ent);
  
  /** XML_Parser defines the behaviour of an individual one-shot
    * parser.
    */
  friend class XML_Parser;
};

/** An actual parser. Each such instance parses just one stream which is
  * given when the parser is created. 
  *
  * The behaviour of the parser is given by the class to which it belongs.
  */

class XML_Parser {

private:
  /// Last error message from the parser.
  EST_String p_error_message;

  /// Set true when context is being remembered.
  bool p_track_context;

  /// Set true when contents is being remembered. (not yet implemented)
  bool p_track_contents;

protected:
  /** The class to which this parser belongs. Defines the behaviour of
    * the parser.
    */
  XML_Parser_Class *pclass;

  /// The piece of markup being processed.
  XBit current_bit;

  /// Where we are reading from.
  InputSource source;

  /** The entity we started from. May need to be freed at the end of the
    * parse.
    */
  Entity initial_entity;

  /// Arbitrary data which can be used by callbacks.
  void *data;

  /// The RXP parser object.
  Parser p;

  /// If context is being tracked, this is a stack of element names.
  EST_TDeque<EST_String> p_context;


  /// Creator used by XML_Parser_Class::make_parser()
  XML_Parser(XML_Parser_Class &parent, 
	     InputSource source, 
	     Entity initial_entity,
	     void *data);

  /// Open. Asks the parser class to do the work.
  InputSource open(Entity ent);

  /// Get the error message for the last error.
  const char *get_error();

public:

  /// Destructor, may close input if required.
  ~XML_Parser();

  /** Request that parser keep track of the currently open elements.
    * 
    * These are recorded on a atsck. Use context() to access the information.
    */
  void track_context(bool flag);
  /** Keep track of the content of open elements.
    *
    * Not yet implemented.
    */
  void track_contents(bool flag);

  /** Get the name of the nth enclosing element.
    * 
    * context(0) is the element we are directly inside.
    */
  EST_String context(int n);

  /// Run the parser. 
  void go();

  friend class XML_Parser_Class;
};

//@}

#endif