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__ */
208