~ubuntu-branches/ubuntu/oneiric/apache2/oneiric-updates

« back to all changes in this revision

Viewing changes to srclib/apr-util/xml/expat/lib/xmltok.h

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-02-22 13:02:08 UTC
  • mfrom: (14.3.23 sid)
  • Revision ID: james.westby@ubuntu.com-20110222130208-5hrxnun6a8uygfhv
Tags: 2.2.17-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/{control, rules}: Enable PIE hardening.
  - debian/{control, rules, apache2.2-common.ufw.profile}: Add ufw profiles.
  - debian/control: Add bzr tag and point it to our tree
  - debain/apache2.py, debian/apache2.2-common.isntall: Add apport hook.
  - debian/control, debian/ask-for-passphrase, debian/config-dir/mods-available/ssl.conf:
    Plymouth aware passphrase dialog program ask-for-passphrase. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
3
 
See the file COPYING for copying permission.
 
1
/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
 
2
   See the file COPYING for copying permission.
4
3
*/
5
4
 
6
5
#ifndef XmlTok_INCLUDED
11
10
#endif
12
11
 
13
12
/* The following token may be returned by XmlContentTok */
14
 
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of
15
 
                                    illegal ]]> sequence */
16
 
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
17
 
#define XML_TOK_NONE -4    /* The string to be scanned is empty */
18
 
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
19
 
                                  might be part of CRLF sequence */ 
20
 
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
21
 
#define XML_TOK_PARTIAL -1 /* only part of a token */
 
13
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be
 
14
                                    start of illegal ]]> sequence */
 
15
/* The following tokens may be returned by both XmlPrologTok and
 
16
   XmlContentTok.
 
17
*/
 
18
#define XML_TOK_NONE -4          /* The string to be scanned is empty */
 
19
#define XML_TOK_TRAILING_CR -3   /* A CR at the end of the scan;
 
20
                                    might be part of CRLF sequence */
 
21
#define XML_TOK_PARTIAL_CHAR -2  /* only part of a multibyte sequence */
 
22
#define XML_TOK_PARTIAL -1       /* only part of a token */
22
23
#define XML_TOK_INVALID 0
23
24
 
24
25
/* The following tokens are returned by XmlContentTok; some are also
25
 
  returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */
26
 
 
 
26
   returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok.
 
27
*/
27
28
#define XML_TOK_START_TAG_WITH_ATTS 1
28
29
#define XML_TOK_START_TAG_NO_ATTS 2
29
30
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
33
34
#define XML_TOK_DATA_NEWLINE 7
34
35
#define XML_TOK_CDATA_SECT_OPEN 8
35
36
#define XML_TOK_ENTITY_REF 9
36
 
#define XML_TOK_CHAR_REF 10     /* numeric character reference */
 
37
#define XML_TOK_CHAR_REF 10               /* numeric character reference */
37
38
 
38
 
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
39
 
#define XML_TOK_PI 11      /* processing instruction */
40
 
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
 
39
/* The following tokens may be returned by both XmlPrologTok and
 
40
   XmlContentTok.
 
41
*/
 
42
#define XML_TOK_PI 11                     /* processing instruction */
 
43
#define XML_TOK_XML_DECL 12               /* XML decl or text decl */
41
44
#define XML_TOK_COMMENT 13
42
 
#define XML_TOK_BOM 14     /* Byte order mark */
 
45
#define XML_TOK_BOM 14                    /* Byte order mark */
43
46
 
44
47
/* The following tokens are returned only by XmlPrologTok */
45
48
#define XML_TOK_PROLOG_S 15
46
 
#define XML_TOK_DECL_OPEN 16 /* <!foo */
47
 
#define XML_TOK_DECL_CLOSE 17 /* > */
 
49
#define XML_TOK_DECL_OPEN 16              /* <!foo */
 
50
#define XML_TOK_DECL_CLOSE 17             /* > */
48
51
#define XML_TOK_NAME 18
49
52
#define XML_TOK_NMTOKEN 19
50
 
#define XML_TOK_POUND_NAME 20 /* #name */
51
 
#define XML_TOK_OR 21 /* | */
 
53
#define XML_TOK_POUND_NAME 20             /* #name */
 
54
#define XML_TOK_OR 21                     /* | */
52
55
#define XML_TOK_PERCENT 22
53
56
#define XML_TOK_OPEN_PAREN 23
54
57
#define XML_TOK_CLOSE_PAREN 24
59
62
#define XML_TOK_INSTANCE_START 29
60
63
 
61
64
/* The following occur only in element type declarations */
62
 
#define XML_TOK_NAME_QUESTION 30 /* name? */
63
 
#define XML_TOK_NAME_ASTERISK 31 /* name* */
64
 
#define XML_TOK_NAME_PLUS 32 /* name+ */
65
 
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
66
 
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
67
 
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
68
 
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
69
 
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
 
65
#define XML_TOK_NAME_QUESTION 30          /* name? */
 
66
#define XML_TOK_NAME_ASTERISK 31          /* name* */
 
67
#define XML_TOK_NAME_PLUS 32              /* name+ */
 
68
#define XML_TOK_COND_SECT_OPEN 33         /* <![ */
 
69
#define XML_TOK_COND_SECT_CLOSE 34        /* ]]> */
 
70
#define XML_TOK_CLOSE_PAREN_QUESTION 35   /* )? */
 
71
#define XML_TOK_CLOSE_PAREN_ASTERISK 36   /* )* */
 
72
#define XML_TOK_CLOSE_PAREN_PLUS 37       /* )+ */
70
73
#define XML_TOK_COMMA 38
71
74
 
72
75
/* The following token is returned only by XmlAttributeValueTok */
75
78
/* The following token is returned only by XmlCdataSectionTok */
76
79
#define XML_TOK_CDATA_SECT_CLOSE 40
77
80
 
78
 
/* With namespace processing this is returned by XmlPrologTok
79
 
   for a name with a colon. */
 
81
/* With namespace processing this is returned by XmlPrologTok for a
 
82
   name with a colon.
 
83
*/
80
84
#define XML_TOK_PREFIXED_NAME 41
81
85
 
82
86
#ifdef XML_DTD
121
125
struct encoding;
122
126
typedef struct encoding ENCODING;
123
127
 
 
128
typedef int (PTRCALL *SCANNER)(const ENCODING *,
 
129
                               const char *,
 
130
                               const char *,
 
131
                               const char **);
 
132
 
124
133
struct encoding {
125
 
  int (*scanners[XML_N_STATES])(const ENCODING *,
126
 
                                const char *,
127
 
                                const char *,
128
 
                                const char **);
129
 
  int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
130
 
                                              const char *,
131
 
                                              const char *,
132
 
                                              const char **);
133
 
  int (*sameName)(const ENCODING *,
134
 
                  const char *, const char *);
135
 
  int (*nameMatchesAscii)(const ENCODING *,
136
 
                          const char *, const char *, const char *);
137
 
  int (*nameLength)(const ENCODING *, const char *);
138
 
  const char *(*skipS)(const ENCODING *, const char *);
139
 
  int (*getAtts)(const ENCODING *enc, const char *ptr,
140
 
                 int attsMax, ATTRIBUTE *atts);
141
 
  int (*charRefNumber)(const ENCODING *enc, const char *ptr);
142
 
  int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
143
 
  void (*updatePosition)(const ENCODING *,
144
 
                         const char *ptr,
145
 
                         const char *end,
146
 
                         POSITION *);
147
 
  int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
148
 
                    const char **badPtr);
149
 
  void (*utf8Convert)(const ENCODING *enc,
150
 
                      const char **fromP,
151
 
                      const char *fromLim,
152
 
                      char **toP,
153
 
                      const char *toLim);
154
 
  void (*utf16Convert)(const ENCODING *enc,
155
 
                       const char **fromP,
156
 
                       const char *fromLim,
157
 
                       unsigned short **toP,
158
 
                       const unsigned short *toLim);
 
134
  SCANNER scanners[XML_N_STATES];
 
135
  SCANNER literalScanners[XML_N_LITERAL_TYPES];
 
136
  int (PTRCALL *sameName)(const ENCODING *,
 
137
                          const char *,
 
138
                          const char *);
 
139
  int (PTRCALL *nameMatchesAscii)(const ENCODING *,
 
140
                                  const char *,
 
141
                                  const char *,
 
142
                                  const char *);
 
143
  int (PTRFASTCALL *nameLength)(const ENCODING *, const char *);
 
144
  const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *);
 
145
  int (PTRCALL *getAtts)(const ENCODING *enc,
 
146
                         const char *ptr,
 
147
                         int attsMax,
 
148
                         ATTRIBUTE *atts);
 
149
  int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr);
 
150
  int (PTRCALL *predefinedEntityName)(const ENCODING *,
 
151
                                      const char *,
 
152
                                      const char *);
 
153
  void (PTRCALL *updatePosition)(const ENCODING *,
 
154
                                 const char *ptr,
 
155
                                 const char *end,
 
156
                                 POSITION *);
 
157
  int (PTRCALL *isPublicId)(const ENCODING *enc,
 
158
                            const char *ptr,
 
159
                            const char *end,
 
160
                            const char **badPtr);
 
161
  void (PTRCALL *utf8Convert)(const ENCODING *enc,
 
162
                              const char **fromP,
 
163
                              const char *fromLim,
 
164
                              char **toP,
 
165
                              const char *toLim);
 
166
  void (PTRCALL *utf16Convert)(const ENCODING *enc,
 
167
                               const char **fromP,
 
168
                               const char *fromLim,
 
169
                               unsigned short **toP,
 
170
                               const unsigned short *toLim);
159
171
  int minBytesPerChar;
160
172
  char isUtf8;
161
173
  char isUtf16;
162
174
};
163
175
 
164
 
/*
165
 
Scan the string starting at ptr until the end of the next complete token,
166
 
but do not scan past eptr.  Return an integer giving the type of token.
167
 
 
168
 
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
169
 
 
170
 
Return XML_TOK_PARTIAL when the string does not contain a complete token;
171
 
nextTokPtr will not be set.
172
 
 
173
 
Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
174
 
will be set to point to the character which made the token invalid.
175
 
 
176
 
Otherwise the string starts with a valid token; nextTokPtr will be set to point
177
 
to the character following the end of that token.
178
 
 
179
 
Each data character counts as a single token, but adjacent data characters
180
 
may be returned together.  Similarly for characters in the prolog outside
181
 
literals, comments and processing instructions.
 
176
/* Scan the string starting at ptr until the end of the next complete
 
177
   token, but do not scan past eptr.  Return an integer giving the
 
178
   type of token.
 
179
 
 
180
   Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
 
181
 
 
182
   Return XML_TOK_PARTIAL when the string does not contain a complete
 
183
   token; nextTokPtr will not be set.
 
184
 
 
185
   Return XML_TOK_INVALID when the string does not start a valid
 
186
   token; nextTokPtr will be set to point to the character which made
 
187
   the token invalid.
 
188
 
 
189
   Otherwise the string starts with a valid token; nextTokPtr will be
 
190
   set to point to the character following the end of that token.
 
191
 
 
192
   Each data character counts as a single token, but adjacent data
 
193
   characters may be returned together.  Similarly for characters in
 
194
   the prolog outside literals, comments and processing instructions.
182
195
*/
183
196
 
184
197
 
201
214
 
202
215
#endif /* XML_DTD */
203
216
 
204
 
/* This is used for performing a 2nd-level tokenization on
205
 
the content of a literal that has already been returned by XmlTok. */ 
206
 
 
 
217
/* This is used for performing a 2nd-level tokenization on the content
 
218
   of a literal that has already been returned by XmlTok.
 
219
*/
207
220
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
208
221
  (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
209
222
 
250
263
  const ENCODING **encPtr;
251
264
} INIT_ENCODING;
252
265
 
253
 
int  XmlParseXmlDecl(int isGeneralTextEntity,
254
 
                              const ENCODING *enc,
255
 
                              const char *ptr,
256
 
                              const char *end,
257
 
                              const char **badPtr,
258
 
                              const char **versionPtr,
259
 
                              const char **versionEndPtr,
260
 
                              const char **encodingNamePtr,
261
 
                              const ENCODING **namedEncodingPtr,
262
 
                              int *standalonePtr);
263
 
 
264
 
int  XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
265
 
const ENCODING  *XmlGetUtf8InternalEncoding(void);
266
 
const ENCODING  *XmlGetUtf16InternalEncoding(void);
267
 
int  XmlUtf8Encode(int charNumber, char *buf);
268
 
int  XmlUtf16Encode(int charNumber, unsigned short *buf);
269
 
 
270
 
int  XmlSizeOfUnknownEncoding(void);
271
 
ENCODING  *
 
266
int XmlParseXmlDecl(int isGeneralTextEntity,
 
267
                    const ENCODING *enc,
 
268
                    const char *ptr,
 
269
                    const char *end,
 
270
                    const char **badPtr,
 
271
                    const char **versionPtr,
 
272
                    const char **versionEndPtr,
 
273
                    const char **encodingNamePtr,
 
274
                    const ENCODING **namedEncodingPtr,
 
275
                    int *standalonePtr);
 
276
 
 
277
int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
 
278
const ENCODING *XmlGetUtf8InternalEncoding(void);
 
279
const ENCODING *XmlGetUtf16InternalEncoding(void);
 
280
int FASTCALL XmlUtf8Encode(int charNumber, char *buf);
 
281
int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf);
 
282
int XmlSizeOfUnknownEncoding(void);
 
283
 
 
284
typedef int (*CONVERTER)(void *userData, const char *p);
 
285
 
 
286
ENCODING *
272
287
XmlInitUnknownEncoding(void *mem,
273
 
                       int *table,
274
 
                       int (*conv)(void *userData, const char *p),
275
 
                       void *userData);
276
 
 
277
 
int  XmlParseXmlDeclNS(int isGeneralTextEntity,
278
 
                                const ENCODING *enc,
279
 
                                const char *ptr,
280
 
                                const char *end,
281
 
                                const char **badPtr,
282
 
                                const char **versionPtr,
283
 
                                const char **versionEndPtr,
284
 
                                const char **encodingNamePtr,
285
 
                                const ENCODING **namedEncodingPtr,
286
 
                                int *standalonePtr);
287
 
int  XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
288
 
const ENCODING  *XmlGetUtf8InternalEncodingNS(void);
289
 
const ENCODING  *XmlGetUtf16InternalEncodingNS(void);
290
 
ENCODING  *
 
288
                       int *table,
 
289
                       CONVERTER convert,
 
290
                       void *userData);
 
291
 
 
292
int XmlParseXmlDeclNS(int isGeneralTextEntity,
 
293
                      const ENCODING *enc,
 
294
                      const char *ptr,
 
295
                      const char *end,
 
296
                      const char **badPtr,
 
297
                      const char **versionPtr,
 
298
                      const char **versionEndPtr,
 
299
                      const char **encodingNamePtr,
 
300
                      const ENCODING **namedEncodingPtr,
 
301
                      int *standalonePtr);
 
302
 
 
303
int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
 
304
const ENCODING *XmlGetUtf8InternalEncodingNS(void);
 
305
const ENCODING *XmlGetUtf16InternalEncodingNS(void);
 
306
ENCODING *
291
307
XmlInitUnknownEncodingNS(void *mem,
292
 
                         int *table,
293
 
                         int (*conv)(void *userData, const char *p),
294
 
                         void *userData);
 
308
                         int *table,
 
309
                         CONVERTER convert,
 
310
                         void *userData);
295
311
#ifdef __cplusplus
296
312
}
297
313
#endif