~ubuntu-branches/ubuntu/gutsy/tidy/gutsy

« back to all changes in this revision

Viewing changes to src/message.h

  • Committer: Bazaar Package Importer
  • Author(s): Jason Thomas
  • Date: 2005-04-20 11:22:49 UTC
  • mfrom: (0.2.1 upstream) (1.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050420112249-mygnr5vcrutwsen3
Tags: 20050415-1
New upstream release 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __MESSAGE_H__
 
2
#define __MESSAGE_H__
 
3
 
 
4
/* message.h -- general message writing routines
 
5
 
 
6
  (c) 1998-2005 (W3C) MIT, ERCIM, Keio University
 
7
  See tidy.h for the copyright notice.
 
8
  
 
9
  CVS Info :
 
10
 
 
11
    $Author: arnaud02 $ 
 
12
    $Date: 2005/01/18 11:10:15 $ 
 
13
    $Revision: 1.23 $ 
 
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 ReleaseDate(void);
 
34
 
 
35
/* Reports error at current Lexer line/column. */ 
 
36
void message( TidyDocImpl* doc, TidyReportLevel level, ctmbstr msg, ... )
 
37
#ifdef __GNUC__
 
38
__attribute__((format(printf, 3, 4)))
 
39
#endif
 
40
;
 
41
 
 
42
/* Reports error at node line/column. */ 
 
43
void messageNode( TidyDocImpl* doc, TidyReportLevel level,
 
44
                  Node* node, ctmbstr msg, ... )
 
45
#ifdef __GNUC__
 
46
__attribute__((format(printf, 4, 5)))
 
47
#endif
 
48
;
 
49
 
 
50
/* Reports error at given line/column. */ 
 
51
void messageLexer( TidyDocImpl* doc, TidyReportLevel level, 
 
52
                   ctmbstr msg, ... )
 
53
#ifdef __GNUC__
 
54
__attribute__((format(printf, 3, 4)))
 
55
#endif
 
56
;
 
57
 
 
58
/* For general reporting.  Emits nothing if --quiet yes */
 
59
void tidy_out( TidyDocImpl* doc, ctmbstr msg, ... )
 
60
#ifdef __GNUC__
 
61
__attribute__((format(printf, 2, 3)))
 
62
#endif
 
63
;
 
64
 
 
65
 
 
66
void ShowVersion( TidyDocImpl* doc );
 
67
void ReportUnknownOption( TidyDocImpl* doc, ctmbstr option );
 
68
void ReportBadArgument( TidyDocImpl* doc, ctmbstr option );
 
69
void NeedsAuthorIntervention( TidyDocImpl* doc );
 
70
 
 
71
void HelloMessage( TidyDocImpl* doc, ctmbstr date, ctmbstr filename );
 
72
void ReportMarkupVersion( TidyDocImpl* doc );
 
73
void ReportNumWarnings( TidyDocImpl* doc );
 
74
 
 
75
void GeneralInfo( TidyDocImpl* doc );
 
76
void UnknownOption( TidyDocImpl* doc, char c );
 
77
void UnknownFile( TidyDocImpl* doc, ctmbstr program, ctmbstr file );
 
78
void FileError( TidyDocImpl* doc, ctmbstr file, TidyReportLevel level );
 
79
 
 
80
void ErrorSummary( TidyDocImpl* doc );
 
81
 
 
82
void ReportEncodingWarning(TidyDocImpl* doc, uint code, uint encoding);
 
83
void ReportEncodingError(TidyDocImpl* doc, uint code, uint c, Bool discarded);
 
84
void ReportEntityError( TidyDocImpl* doc, uint code, ctmbstr entity, int c );
 
85
void ReportAttrError( TidyDocImpl* doc, Node* node, AttVal* av, uint code );
 
86
void ReportMissingAttr( TidyDocImpl* doc, Node* node, ctmbstr name );
 
87
 
 
88
#if SUPPORT_ACCESSIBILITY_CHECKS
 
89
 
 
90
void ReportAccessWarning( TidyDocImpl* doc, Node* node, uint code );
 
91
void ReportAccessError( TidyDocImpl* doc, Node* node, uint code );
 
92
 
 
93
#endif
 
94
 
 
95
void ReportNotice(TidyDocImpl* doc, Node *element, Node *node, uint code);
 
96
void ReportWarning(TidyDocImpl* doc, Node *element, Node *node, uint code);
 
97
void ReportError(TidyDocImpl* doc, Node* element, Node* node, uint code);
 
98
void ReportFatal(TidyDocImpl* doc, Node* element, Node* node, uint code);
 
99
 
 
100
/* error codes for entities/numeric character references */
 
101
 
 
102
#define MISSING_SEMICOLON            1
 
103
#define MISSING_SEMICOLON_NCR        2
 
104
#define UNKNOWN_ENTITY               3
 
105
#define UNESCAPED_AMPERSAND          4
 
106
#define APOS_UNDEFINED               5
 
107
 
 
108
/* error codes for element messages */
 
109
 
 
110
#define MISSING_ENDTAG_FOR           6
 
111
#define MISSING_ENDTAG_BEFORE        7
 
112
#define DISCARDING_UNEXPECTED        8
 
113
#define NESTED_EMPHASIS              9
 
114
#define NON_MATCHING_ENDTAG          10
 
115
#define TAG_NOT_ALLOWED_IN           11
 
116
#define MISSING_STARTTAG             12
 
117
#define UNEXPECTED_ENDTAG            13
 
118
#define USING_BR_INPLACE_OF          14
 
119
#define INSERTING_TAG                15
 
120
#define SUSPECTED_MISSING_QUOTE      16
 
121
#define MISSING_TITLE_ELEMENT        17
 
122
#define DUPLICATE_FRAMESET           18
 
123
#define CANT_BE_NESTED               19
 
124
#define OBSOLETE_ELEMENT             20
 
125
#define PROPRIETARY_ELEMENT          21
 
126
#define UNKNOWN_ELEMENT              22
 
127
#define TRIM_EMPTY_ELEMENT           23
 
128
#define COERCE_TO_ENDTAG             24
 
129
#define ILLEGAL_NESTING              25
 
130
#define NOFRAMES_CONTENT             26
 
131
#define CONTENT_AFTER_BODY           27
 
132
#define INCONSISTENT_VERSION         28
 
133
#define MALFORMED_COMMENT            29
 
134
#define BAD_COMMENT_CHARS            30
 
135
#define BAD_XML_COMMENT              31
 
136
#define BAD_CDATA_CONTENT            32
 
137
#define INCONSISTENT_NAMESPACE       33
 
138
#define DOCTYPE_AFTER_TAGS           34
 
139
#define MALFORMED_DOCTYPE            35
 
140
#define UNEXPECTED_END_OF_FILE       36
 
141
#define DTYPE_NOT_UPPER_CASE         37
 
142
#define TOO_MANY_ELEMENTS            38
 
143
#define UNESCAPED_ELEMENT            39
 
144
#define NESTED_QUOTATION             40
 
145
#define ELEMENT_NOT_EMPTY            41
 
146
#define ENCODING_IO_CONFLICT         42
 
147
#define MIXED_CONTENT_IN_BLOCK       43
 
148
#define MISSING_DOCTYPE              44
 
149
#define SPACE_PRECEDING_XMLDECL      45
 
150
#define TOO_MANY_ELEMENTS_IN         46
 
151
#define UNEXPECTED_ENDTAG_IN         47
 
152
#define REPLACING_ELEMENT            83
 
153
#define REPLACING_UNEX_ELEMENT       84
 
154
#define COERCE_TO_ENDTAG_WARN        85
 
155
 
 
156
/* error codes used for attribute messages */
 
157
 
 
158
#define UNKNOWN_ATTRIBUTE            48
 
159
#define INSERTING_ATTRIBUTE          49
 
160
#define MISSING_ATTR_VALUE           50
 
161
#define BAD_ATTRIBUTE_VALUE          51
 
162
#define UNEXPECTED_GT                52
 
163
#define PROPRIETARY_ATTRIBUTE        53
 
164
#define PROPRIETARY_ATTR_VALUE       54
 
165
#define REPEATED_ATTRIBUTE           55
 
166
#define MISSING_IMAGEMAP             56
 
167
#define XML_ATTRIBUTE_VALUE          57
 
168
#define UNEXPECTED_QUOTEMARK         58
 
169
#define MISSING_QUOTEMARK            59
 
170
#define ID_NAME_MISMATCH             60
 
171
 
 
172
#define BACKSLASH_IN_URI             61
 
173
#define FIXED_BACKSLASH              62
 
174
#define ILLEGAL_URI_REFERENCE        63
 
175
#define ESCAPED_ILLEGAL_URI          64
 
176
 
 
177
#define NEWLINE_IN_URI               65
 
178
#define ANCHOR_NOT_UNIQUE            66
 
179
 
 
180
#define JOINING_ATTRIBUTE            68
 
181
#define UNEXPECTED_EQUALSIGN         69
 
182
#define ATTR_VALUE_NOT_LCASE         70
 
183
#define XML_ID_SYNTAX                71
 
184
 
 
185
#define INVALID_ATTRIBUTE            72
 
186
 
 
187
#define BAD_ATTRIBUTE_VALUE_REPLACED 73
 
188
 
 
189
#define INVALID_XML_ID               74
 
190
#define UNEXPECTED_END_OF_FILE_ATTR  75
 
191
#define MISSING_ATTRIBUTE            86 /* last */
 
192
 
 
193
 
 
194
/* character encoding errors */
 
195
 
 
196
#define VENDOR_SPECIFIC_CHARS        76
 
197
#define INVALID_SGML_CHARS           77
 
198
#define INVALID_UTF8                 78
 
199
#define INVALID_UTF16                79
 
200
#define ENCODING_MISMATCH            80
 
201
#define INVALID_URI                  81
 
202
#define INVALID_NCR                  82
 
203
 
 
204
/* accessibility flaws */
 
205
 
 
206
#define MISSING_IMAGE_ALT       1
 
207
#define MISSING_LINK_ALT        2
 
208
#define MISSING_SUMMARY         4
 
209
#define MISSING_IMAGE_MAP       8
 
210
#define USING_FRAMES            16
 
211
#define USING_NOFRAMES          32
 
212
 
 
213
/* presentation flaws */
 
214
 
 
215
#define USING_SPACER            1
 
216
#define USING_LAYER             2
 
217
#define USING_NOBR              4
 
218
#define USING_FONT              8
 
219
#define USING_BODY              16
 
220
 
 
221
#define REPLACED_CHAR           0
 
222
#define DISCARDED_CHAR          1
 
223
 
 
224
/* badchar bit field */
 
225
 
 
226
#define BC_VENDOR_SPECIFIC_CHARS   1
 
227
#define BC_INVALID_SGML_CHARS      2
 
228
#define BC_INVALID_UTF8            4
 
229
#define BC_INVALID_UTF16           8
 
230
#define BC_ENCODING_MISMATCH       16 /* fatal error */
 
231
#define BC_INVALID_URI             32
 
232
#define BC_INVALID_NCR             64
 
233
 
 
234
#endif /* __MESSAGE_H__ */