tidy-ext 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +4 -0
  2. data/LICENSE +50 -0
  3. data/README +12 -0
  4. data/Rakefile +60 -0
  5. data/VERSION +1 -0
  6. data/ext/tidy/access.c +3310 -0
  7. data/ext/tidy/access.h +279 -0
  8. data/ext/tidy/alloc.c +107 -0
  9. data/ext/tidy/attrask.c +209 -0
  10. data/ext/tidy/attrdict.c +2398 -0
  11. data/ext/tidy/attrdict.h +122 -0
  12. data/ext/tidy/attrget.c +213 -0
  13. data/ext/tidy/attrs.c +1911 -0
  14. data/ext/tidy/attrs.h +374 -0
  15. data/ext/tidy/buffio.c +232 -0
  16. data/ext/tidy/buffio.h +118 -0
  17. data/ext/tidy/charsets.c +1032 -0
  18. data/ext/tidy/charsets.h +14 -0
  19. data/ext/tidy/clean.c +2674 -0
  20. data/ext/tidy/clean.h +87 -0
  21. data/ext/tidy/config.c +1746 -0
  22. data/ext/tidy/config.h +153 -0
  23. data/ext/tidy/entities.c +419 -0
  24. data/ext/tidy/entities.h +24 -0
  25. data/ext/tidy/extconf.rb +5 -0
  26. data/ext/tidy/fileio.c +106 -0
  27. data/ext/tidy/fileio.h +46 -0
  28. data/ext/tidy/forward.h +69 -0
  29. data/ext/tidy/iconvtc.c +105 -0
  30. data/ext/tidy/iconvtc.h +15 -0
  31. data/ext/tidy/istack.c +373 -0
  32. data/ext/tidy/lexer.c +3825 -0
  33. data/ext/tidy/lexer.h +617 -0
  34. data/ext/tidy/localize.c +1882 -0
  35. data/ext/tidy/mappedio.c +329 -0
  36. data/ext/tidy/mappedio.h +16 -0
  37. data/ext/tidy/message.h +207 -0
  38. data/ext/tidy/parser.c +4408 -0
  39. data/ext/tidy/parser.h +76 -0
  40. data/ext/tidy/platform.h +636 -0
  41. data/ext/tidy/pprint.c +2276 -0
  42. data/ext/tidy/pprint.h +93 -0
  43. data/ext/tidy/ruby-tidy.c +195 -0
  44. data/ext/tidy/streamio.c +1407 -0
  45. data/ext/tidy/streamio.h +222 -0
  46. data/ext/tidy/tagask.c +286 -0
  47. data/ext/tidy/tags.c +955 -0
  48. data/ext/tidy/tags.h +235 -0
  49. data/ext/tidy/tidy-int.h +129 -0
  50. data/ext/tidy/tidy.h +1097 -0
  51. data/ext/tidy/tidyenum.h +622 -0
  52. data/ext/tidy/tidylib.c +1751 -0
  53. data/ext/tidy/tmbstr.c +306 -0
  54. data/ext/tidy/tmbstr.h +92 -0
  55. data/ext/tidy/utf8.c +539 -0
  56. data/ext/tidy/utf8.h +52 -0
  57. data/ext/tidy/version.h +14 -0
  58. data/ext/tidy/win32tc.c +795 -0
  59. data/ext/tidy/win32tc.h +19 -0
  60. data/spec/spec_helper.rb +5 -0
  61. data/spec/tidy/compat_spec.rb +44 -0
  62. data/spec/tidy/remote_uri_spec.rb +14 -0
  63. data/spec/tidy/test1.html +5 -0
  64. data/spec/tidy/tidy_spec.rb +34 -0
  65. metadata +125 -0
@@ -0,0 +1,329 @@
1
+ /* Interface to mmap style I/O
2
+
3
+ (c) 2006-2008 (W3C) MIT, ERCIM, Keio University
4
+ See tidy.h for the copyright notice.
5
+
6
+ Originally contributed by Cory Nelson and Nuno Lopes
7
+
8
+ $Id: mappedio.c,v 1.14 2008/03/18 20:19:35 arnaud02 Exp $
9
+ */
10
+
11
+ /* keep these here to keep file non-empty */
12
+ #include "forward.h"
13
+ #include "mappedio.h"
14
+
15
+ #if SUPPORT_POSIX_MAPPED_FILES
16
+
17
+ #include "fileio.h"
18
+
19
+ #include <sys/types.h>
20
+ #include <sys/stat.h>
21
+ #include <unistd.h>
22
+ #include <stdio.h>
23
+
24
+ #include <sys/mman.h>
25
+
26
+
27
+ typedef struct
28
+ {
29
+ TidyAllocator *allocator;
30
+ const byte *base;
31
+ size_t pos, size;
32
+ } MappedFileSource;
33
+
34
+ static int TIDY_CALL mapped_getByte( void* sourceData )
35
+ {
36
+ MappedFileSource* fin = (MappedFileSource*) sourceData;
37
+ return fin->base[fin->pos++];
38
+ }
39
+
40
+ static Bool TIDY_CALL mapped_eof( void* sourceData )
41
+ {
42
+ MappedFileSource* fin = (MappedFileSource*) sourceData;
43
+ return (fin->pos >= fin->size);
44
+ }
45
+
46
+ static void TIDY_CALL mapped_ungetByte( void* sourceData, byte ARG_UNUSED(bv) )
47
+ {
48
+ MappedFileSource* fin = (MappedFileSource*) sourceData;
49
+ fin->pos--;
50
+ }
51
+
52
+ int TY_(initFileSource)( TidyAllocator *allocator, TidyInputSource* inp, FILE* fp )
53
+ {
54
+ MappedFileSource* fin;
55
+ struct stat sbuf;
56
+ int fd;
57
+
58
+ fin = (MappedFileSource*) TidyAlloc( allocator, sizeof(MappedFileSource) );
59
+ if ( !fin )
60
+ return -1;
61
+
62
+ fd = fileno(fp);
63
+ if ( fstat(fd, &sbuf) == -1
64
+ || sbuf.st_size == 0
65
+ || (fin->base = mmap(0, fin->size = sbuf.st_size, PROT_READ,
66
+ MAP_SHARED, fd, 0)) == MAP_FAILED)
67
+ {
68
+ TidyFree( allocator, fin );
69
+ /* Fallback on standard I/O */
70
+ return TY_(initStdIOFileSource)( allocator, inp, fp );
71
+ }
72
+
73
+ fin->pos = 0;
74
+ fin->allocator = allocator;
75
+ fclose(fp);
76
+
77
+ inp->getByte = mapped_getByte;
78
+ inp->eof = mapped_eof;
79
+ inp->ungetByte = mapped_ungetByte;
80
+ inp->sourceData = fin;
81
+
82
+ return 0;
83
+ }
84
+
85
+ void TY_(freeFileSource)( TidyInputSource* inp, Bool closeIt )
86
+ {
87
+ if ( inp->getByte == mapped_getByte )
88
+ {
89
+ MappedFileSource* fin = (MappedFileSource*) inp->sourceData;
90
+ munmap( (void*)fin->base, fin->size );
91
+ TidyFree( fin->allocator, fin );
92
+ }
93
+ else
94
+ TY_(freeStdIOFileSource)( inp, closeIt );
95
+ }
96
+
97
+ #endif
98
+
99
+
100
+ #if defined(_WIN32)
101
+ #include "streamio.h"
102
+ #include "tidy-int.h"
103
+ #include "message.h"
104
+
105
+ #include <errno.h>
106
+ #if _MSC_VER < 1300 /* less than msvc++ 7.0 */
107
+ #pragma warning(disable:4115) /* named type definition in parentheses in windows headers */
108
+ #endif
109
+ #include <windows.h>
110
+
111
+ typedef struct _fp_input_mapped_source
112
+ {
113
+ TidyAllocator *allocator;
114
+ LONGLONG size, pos;
115
+ HANDLE file, map;
116
+ byte *view, *iter, *end;
117
+ unsigned int gran;
118
+ } MappedFileSource;
119
+
120
+ static int mapped_openView( MappedFileSource *data )
121
+ {
122
+ DWORD numb = ( ( data->size - data->pos ) > data->gran ) ?
123
+ data->gran : (DWORD)( data->size - data->pos );
124
+
125
+ if ( data->view )
126
+ {
127
+ UnmapViewOfFile( data->view );
128
+ data->view = NULL;
129
+ }
130
+
131
+ data->view = MapViewOfFile( data->map, FILE_MAP_READ,
132
+ (DWORD)( data->pos >> 32 ),
133
+ (DWORD)data->pos, numb );
134
+
135
+ if ( !data->view ) return -1;
136
+
137
+ data->iter = data->view;
138
+ data->end = data->iter + numb;
139
+
140
+ return 0;
141
+ }
142
+
143
+ static int TIDY_CALL mapped_getByte( void *sourceData )
144
+ {
145
+ MappedFileSource *data = sourceData;
146
+
147
+ if ( !data->view || data->iter >= data->end )
148
+ {
149
+ data->pos += data->gran;
150
+
151
+ if ( data->pos >= data->size || mapped_openView(data) != 0 )
152
+ return EndOfStream;
153
+ }
154
+
155
+ return *( data->iter++ );
156
+ }
157
+
158
+ static Bool TIDY_CALL mapped_eof( void *sourceData )
159
+ {
160
+ MappedFileSource *data = sourceData;
161
+ return ( data->pos >= data->size );
162
+ }
163
+
164
+ static void TIDY_CALL mapped_ungetByte( void *sourceData, byte ARG_UNUSED(bt) )
165
+ {
166
+ MappedFileSource *data = sourceData;
167
+
168
+ if ( data->iter >= data->view )
169
+ {
170
+ --data->iter;
171
+ return;
172
+ }
173
+
174
+ if ( data->pos < data->gran )
175
+ {
176
+ assert(0);
177
+ return;
178
+ }
179
+
180
+ data->pos -= data->gran;
181
+ mapped_openView( data );
182
+ }
183
+
184
+ static int initMappedFileSource( TidyAllocator *allocator, TidyInputSource* inp, HANDLE fp )
185
+ {
186
+ MappedFileSource* fin = NULL;
187
+
188
+ inp->getByte = mapped_getByte;
189
+ inp->eof = mapped_eof;
190
+ inp->ungetByte = mapped_ungetByte;
191
+
192
+ fin = (MappedFileSource*) TidyAlloc( allocator, sizeof(MappedFileSource) );
193
+ if ( !fin )
194
+ return -1;
195
+
196
+ #if _MSC_VER < 1300 /* less than msvc++ 7.0 */
197
+ {
198
+ LARGE_INTEGER* pli = (LARGE_INTEGER *)&fin->size;
199
+ (DWORD)pli->LowPart = GetFileSize( fp, (DWORD *)&pli->HighPart );
200
+ if ( GetLastError() != NO_ERROR || fin->size <= 0 )
201
+ {
202
+ TidyFree(allocator, fin);
203
+ return -1;
204
+ }
205
+ }
206
+ #else
207
+ if ( !GetFileSizeEx( fp, (LARGE_INTEGER*)&fin->size )
208
+ || fin->size <= 0 )
209
+ {
210
+ TidyFree(allocator, fin);
211
+ return -1;
212
+ }
213
+ #endif
214
+
215
+ fin->map = CreateFileMapping( fp, NULL, PAGE_READONLY, 0, 0, NULL );
216
+
217
+ if ( !fin->map )
218
+ {
219
+ TidyFree(allocator, fin);
220
+ return -1;
221
+ }
222
+
223
+ {
224
+ SYSTEM_INFO info;
225
+ GetSystemInfo( &info );
226
+ fin->gran = info.dwAllocationGranularity;
227
+ }
228
+
229
+ fin->allocator = allocator;
230
+ fin->pos = 0;
231
+ fin->view = NULL;
232
+ fin->iter = NULL;
233
+ fin->end = NULL;
234
+
235
+ if ( mapped_openView( fin ) != 0 )
236
+ {
237
+ CloseHandle( fin->map );
238
+ TidyFree( allocator, fin );
239
+ return -1;
240
+ }
241
+
242
+ fin->file = fp;
243
+ inp->sourceData = fin;
244
+
245
+ return 0;
246
+ }
247
+
248
+ static void freeMappedFileSource( TidyInputSource* inp, Bool closeIt )
249
+ {
250
+ MappedFileSource* fin = (MappedFileSource*) inp->sourceData;
251
+ if ( closeIt && fin && fin->file != INVALID_HANDLE_VALUE )
252
+ {
253
+ if ( fin->view )
254
+ UnmapViewOfFile( fin->view );
255
+
256
+ CloseHandle( fin->map );
257
+ CloseHandle( fin->file );
258
+ }
259
+ TidyFree( fin->allocator, fin );
260
+ }
261
+
262
+ StreamIn* MappedFileInput ( TidyDocImpl* doc, HANDLE fp, int encoding )
263
+ {
264
+ StreamIn *in = TY_(initStreamIn)( doc, encoding );
265
+ if ( initMappedFileSource( doc->allocator, &in->source, fp ) != 0 )
266
+ {
267
+ TY_(freeStreamIn)( in );
268
+ return NULL;
269
+ }
270
+ in->iotype = FileIO;
271
+ return in;
272
+ }
273
+
274
+
275
+ int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam ) {
276
+ int status = -ENOENT;
277
+ HANDLE fin = CreateFileA( filnam, GENERIC_READ, FILE_SHARE_READ, NULL,
278
+ OPEN_EXISTING, 0, NULL );
279
+
280
+ #if PRESERVE_FILE_TIMES
281
+ LONGLONG actime, modtime;
282
+ TidyClearMemory( &doc->filetimes, sizeof(doc->filetimes) );
283
+
284
+ if ( fin != INVALID_HANDLE_VALUE && cfgBool(doc,TidyKeepFileTimes) &&
285
+ GetFileTime(fin, NULL, (FILETIME*)&actime, (FILETIME*)&modtime) )
286
+ {
287
+ #define TY_I64(str) TYDYAPPEND(str,LL)
288
+ #if _MSC_VER < 1300 && !defined(__GNUC__) /* less than msvc++ 7.0 */
289
+ # undef TY_I64
290
+ # define TY_I64(str) TYDYAPPEND(str,i64)
291
+ #endif
292
+ doc->filetimes.actime =
293
+ (time_t)( ( actime - TY_I64(116444736000000000)) / 10000000 );
294
+
295
+ doc->filetimes.modtime =
296
+ (time_t)( ( modtime - TY_I64(116444736000000000)) / 10000000 );
297
+ }
298
+ #endif
299
+
300
+ if ( fin != INVALID_HANDLE_VALUE )
301
+ {
302
+ StreamIn* in = MappedFileInput( doc, fin,
303
+ cfg( doc, TidyInCharEncoding ) );
304
+ if ( !in )
305
+ {
306
+ CloseHandle( fin );
307
+ return -ENOMEM;
308
+ }
309
+
310
+ status = TY_(DocParseStream)( doc, in );
311
+ freeMappedFileSource( &in->source, yes );
312
+ TY_(freeStreamIn)( in );
313
+ }
314
+ else /* Error message! */
315
+ TY_(FileError)( doc, filnam, TidyError );
316
+ return status;
317
+ }
318
+
319
+ #endif
320
+
321
+
322
+ /*
323
+ * local variables:
324
+ * mode: c
325
+ * indent-tabs-mode: nil
326
+ * c-basic-offset: 4
327
+ * eval: (c-set-offset 'substatement-open 0)
328
+ * end:
329
+ */
@@ -0,0 +1,16 @@
1
+ #ifndef __TIDY_MAPPED_IO_H__
2
+ #define __TIDY_MAPPED_IO_H__
3
+
4
+ /* Interface to mmap style I/O
5
+
6
+ (c) 2006 (W3C) MIT, ERCIM, Keio University
7
+ See tidy.h for the copyright notice.
8
+
9
+ $Id: mappedio.h,v 1.2 2006/09/15 16:50:37 arnaud02 Exp $
10
+ */
11
+
12
+ #if defined(_WIN32)
13
+ int TY_(DocParseFileWithMappedFile)( TidyDocImpl* doc, ctmbstr filnam );
14
+ #endif
15
+
16
+ #endif /* __TIDY_MAPPED_IO_H__ */
@@ -0,0 +1,207 @@
1
+ #ifndef __MESSAGE_H__
2
+ #define __MESSAGE_H__
3
+
4
+ /* message.h -- general message writing routines
5
+
6
+ (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
7
+ See tidy.h for the copyright notice.
8
+
9
+ CVS Info :
10
+
11
+ $Author: arnaud02 $
12
+ $Date: 2007/05/30 16:47:31 $
13
+ $Revision: 1.29 $
14
+
15
+ */
16
+
17
+ #include "forward.h"
18
+ #include "tidy.h" /* For TidyReportLevel */
19
+
20
+ /* General message writing routines.
21
+ ** Each message is a single warning, error, etc.
22
+ **
23
+ ** This routine will keep track of counts and,
24
+ ** if the caller has set a filter, it will be
25
+ ** called. The new preferred way of handling
26
+ ** Tidy diagnostics output is either a) define
27
+ ** a new output sink or b) install a message
28
+ ** filter routine.
29
+ **
30
+ ** Keeps track of ShowWarnings, ShowErrors, etc.
31
+ */
32
+
33
+ ctmbstr TY_(ReleaseDate)(void);
34
+
35
+ /* void TY_(ShowVersion)( TidyDocImpl* doc ); */
36
+ void TY_(ReportUnknownOption)( TidyDocImpl* doc, ctmbstr option );
37
+ void TY_(ReportBadArgument)( TidyDocImpl* doc, ctmbstr option );
38
+ void TY_(NeedsAuthorIntervention)( TidyDocImpl* doc );
39
+
40
+ /* void TY_(HelloMessage)( TidyDocImpl* doc, ctmbstr date, ctmbstr filename ); */
41
+ void TY_(ReportMarkupVersion)( TidyDocImpl* doc );
42
+ void TY_(ReportNumWarnings)( TidyDocImpl* doc );
43
+
44
+ void TY_(GeneralInfo)( TidyDocImpl* doc );
45
+ /* void TY_(UnknownOption)( TidyDocImpl* doc, char c ); */
46
+ /* void TY_(UnknownFile)( TidyDocImpl* doc, ctmbstr program, ctmbstr file ); */
47
+ void TY_(FileError)( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level );
48
+
49
+ void TY_(ErrorSummary)( TidyDocImpl* doc );
50
+
51
+ void TY_(ReportEncodingWarning)(TidyDocImpl* doc, uint code, uint encoding);
52
+ void TY_(ReportEncodingError)(TidyDocImpl* doc, uint code, uint c, Bool discarded);
53
+ void TY_(ReportEntityError)( TidyDocImpl* doc, uint code, ctmbstr entity, int c );
54
+ void TY_(ReportAttrError)( TidyDocImpl* doc, Node* node, AttVal* av, uint code );
55
+ void TY_(ReportMissingAttr)( TidyDocImpl* doc, Node* node, ctmbstr name );
56
+
57
+ #if SUPPORT_ACCESSIBILITY_CHECKS
58
+
59
+ void TY_(ReportAccessWarning)( TidyDocImpl* doc, Node* node, uint code );
60
+ void TY_(ReportAccessError)( TidyDocImpl* doc, Node* node, uint code );
61
+
62
+ #endif
63
+
64
+ void TY_(ReportNotice)(TidyDocImpl* doc, Node *element, Node *node, uint code);
65
+ void TY_(ReportWarning)(TidyDocImpl* doc, Node *element, Node *node, uint code);
66
+ void TY_(ReportError)(TidyDocImpl* doc, Node* element, Node* node, uint code);
67
+ void TY_(ReportFatal)(TidyDocImpl* doc, Node* element, Node* node, uint code);
68
+
69
+ /* error codes for entities/numeric character references */
70
+
71
+ #define MISSING_SEMICOLON 1
72
+ #define MISSING_SEMICOLON_NCR 2
73
+ #define UNKNOWN_ENTITY 3
74
+ #define UNESCAPED_AMPERSAND 4
75
+ #define APOS_UNDEFINED 5
76
+
77
+ /* error codes for element messages */
78
+
79
+ #define MISSING_ENDTAG_FOR 6
80
+ #define MISSING_ENDTAG_BEFORE 7
81
+ #define DISCARDING_UNEXPECTED 8
82
+ #define NESTED_EMPHASIS 9
83
+ #define NON_MATCHING_ENDTAG 10
84
+ #define TAG_NOT_ALLOWED_IN 11
85
+ #define MISSING_STARTTAG 12
86
+ #define UNEXPECTED_ENDTAG 13
87
+ #define USING_BR_INPLACE_OF 14
88
+ #define INSERTING_TAG 15
89
+ #define SUSPECTED_MISSING_QUOTE 16
90
+ #define MISSING_TITLE_ELEMENT 17
91
+ #define DUPLICATE_FRAMESET 18
92
+ #define CANT_BE_NESTED 19
93
+ #define OBSOLETE_ELEMENT 20
94
+ #define PROPRIETARY_ELEMENT 21
95
+ #define UNKNOWN_ELEMENT 22
96
+ #define TRIM_EMPTY_ELEMENT 23
97
+ #define COERCE_TO_ENDTAG 24
98
+ #define ILLEGAL_NESTING 25
99
+ #define NOFRAMES_CONTENT 26
100
+ #define CONTENT_AFTER_BODY 27
101
+ #define INCONSISTENT_VERSION 28
102
+ #define MALFORMED_COMMENT 29
103
+ #define BAD_COMMENT_CHARS 30
104
+ #define BAD_XML_COMMENT 31
105
+ #define BAD_CDATA_CONTENT 32
106
+ #define INCONSISTENT_NAMESPACE 33
107
+ #define DOCTYPE_AFTER_TAGS 34
108
+ #define MALFORMED_DOCTYPE 35
109
+ #define UNEXPECTED_END_OF_FILE 36
110
+ #define DTYPE_NOT_UPPER_CASE 37
111
+ #define TOO_MANY_ELEMENTS 38
112
+ #define UNESCAPED_ELEMENT 39
113
+ #define NESTED_QUOTATION 40
114
+ #define ELEMENT_NOT_EMPTY 41
115
+ #define ENCODING_IO_CONFLICT 42
116
+ #define MIXED_CONTENT_IN_BLOCK 43
117
+ #define MISSING_DOCTYPE 44
118
+ #define SPACE_PRECEDING_XMLDECL 45
119
+ #define TOO_MANY_ELEMENTS_IN 46
120
+ #define UNEXPECTED_ENDTAG_IN 47
121
+ #define REPLACING_ELEMENT 83
122
+ #define REPLACING_UNEX_ELEMENT 84
123
+ #define COERCE_TO_ENDTAG_WARN 85
124
+
125
+ /* error codes used for attribute messages */
126
+
127
+ #define UNKNOWN_ATTRIBUTE 48
128
+ #define INSERTING_ATTRIBUTE 49
129
+ #define MISSING_ATTR_VALUE 50
130
+ #define BAD_ATTRIBUTE_VALUE 51
131
+ #define UNEXPECTED_GT 52
132
+ #define PROPRIETARY_ATTRIBUTE 53
133
+ #define PROPRIETARY_ATTR_VALUE 54
134
+ #define REPEATED_ATTRIBUTE 55
135
+ #define MISSING_IMAGEMAP 56
136
+ #define XML_ATTRIBUTE_VALUE 57
137
+ #define UNEXPECTED_QUOTEMARK 58
138
+ #define MISSING_QUOTEMARK 59
139
+ #define ID_NAME_MISMATCH 60
140
+
141
+ #define BACKSLASH_IN_URI 61
142
+ #define FIXED_BACKSLASH 62
143
+ #define ILLEGAL_URI_REFERENCE 63
144
+ #define ESCAPED_ILLEGAL_URI 64
145
+
146
+ #define NEWLINE_IN_URI 65
147
+ #define ANCHOR_NOT_UNIQUE 66
148
+
149
+ #define JOINING_ATTRIBUTE 68
150
+ #define UNEXPECTED_EQUALSIGN 69
151
+ #define ATTR_VALUE_NOT_LCASE 70
152
+ #define XML_ID_SYNTAX 71
153
+
154
+ #define INVALID_ATTRIBUTE 72
155
+
156
+ #define BAD_ATTRIBUTE_VALUE_REPLACED 73
157
+
158
+ #define INVALID_XML_ID 74
159
+ #define UNEXPECTED_END_OF_FILE_ATTR 75
160
+ #define MISSING_ATTRIBUTE 86
161
+ #define WHITE_IN_URI 87
162
+
163
+ #define PREVIOUS_LOCATION 88 /* last */
164
+
165
+ /* character encoding errors */
166
+
167
+ #define VENDOR_SPECIFIC_CHARS 76
168
+ #define INVALID_SGML_CHARS 77
169
+ #define INVALID_UTF8 78
170
+ #define INVALID_UTF16 79
171
+ #define ENCODING_MISMATCH 80
172
+ #define INVALID_URI 81
173
+ #define INVALID_NCR 82
174
+
175
+ /* accessibility flaws */
176
+
177
+ #define BA_MISSING_IMAGE_ALT 1
178
+ #define BA_MISSING_LINK_ALT 2
179
+ #define BA_MISSING_SUMMARY 4
180
+ #define BA_MISSING_IMAGE_MAP 8
181
+ #define BA_USING_FRAMES 16
182
+ #define BA_USING_NOFRAMES 32
183
+ #define BA_INVALID_LINK_NOFRAMES 64 /* WAI [6.5.1.4] */
184
+ #define BA_WAI (1 << 31)
185
+
186
+ /* presentation flaws */
187
+
188
+ #define USING_SPACER 1
189
+ #define USING_LAYER 2
190
+ #define USING_NOBR 4
191
+ #define USING_FONT 8
192
+ #define USING_BODY 16
193
+
194
+ #define REPLACED_CHAR 0
195
+ #define DISCARDED_CHAR 1
196
+
197
+ /* badchar bit field */
198
+
199
+ #define BC_VENDOR_SPECIFIC_CHARS 1
200
+ #define BC_INVALID_SGML_CHARS 2
201
+ #define BC_INVALID_UTF8 4
202
+ #define BC_INVALID_UTF16 8
203
+ #define BC_ENCODING_MISMATCH 16 /* fatal error */
204
+ #define BC_INVALID_URI 32
205
+ #define BC_INVALID_NCR 64
206
+
207
+ #endif /* __MESSAGE_H__ */