tidy-ext 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/LICENSE +50 -0
- data/README +12 -0
- data/Rakefile +60 -0
- data/VERSION +1 -0
- data/ext/tidy/access.c +3310 -0
- data/ext/tidy/access.h +279 -0
- data/ext/tidy/alloc.c +107 -0
- data/ext/tidy/attrask.c +209 -0
- data/ext/tidy/attrdict.c +2398 -0
- data/ext/tidy/attrdict.h +122 -0
- data/ext/tidy/attrget.c +213 -0
- data/ext/tidy/attrs.c +1911 -0
- data/ext/tidy/attrs.h +374 -0
- data/ext/tidy/buffio.c +232 -0
- data/ext/tidy/buffio.h +118 -0
- data/ext/tidy/charsets.c +1032 -0
- data/ext/tidy/charsets.h +14 -0
- data/ext/tidy/clean.c +2674 -0
- data/ext/tidy/clean.h +87 -0
- data/ext/tidy/config.c +1746 -0
- data/ext/tidy/config.h +153 -0
- data/ext/tidy/entities.c +419 -0
- data/ext/tidy/entities.h +24 -0
- data/ext/tidy/extconf.rb +5 -0
- data/ext/tidy/fileio.c +106 -0
- data/ext/tidy/fileio.h +46 -0
- data/ext/tidy/forward.h +69 -0
- data/ext/tidy/iconvtc.c +105 -0
- data/ext/tidy/iconvtc.h +15 -0
- data/ext/tidy/istack.c +373 -0
- data/ext/tidy/lexer.c +3825 -0
- data/ext/tidy/lexer.h +617 -0
- data/ext/tidy/localize.c +1882 -0
- data/ext/tidy/mappedio.c +329 -0
- data/ext/tidy/mappedio.h +16 -0
- data/ext/tidy/message.h +207 -0
- data/ext/tidy/parser.c +4408 -0
- data/ext/tidy/parser.h +76 -0
- data/ext/tidy/platform.h +636 -0
- data/ext/tidy/pprint.c +2276 -0
- data/ext/tidy/pprint.h +93 -0
- data/ext/tidy/ruby-tidy.c +195 -0
- data/ext/tidy/streamio.c +1407 -0
- data/ext/tidy/streamio.h +222 -0
- data/ext/tidy/tagask.c +286 -0
- data/ext/tidy/tags.c +955 -0
- data/ext/tidy/tags.h +235 -0
- data/ext/tidy/tidy-int.h +129 -0
- data/ext/tidy/tidy.h +1097 -0
- data/ext/tidy/tidyenum.h +622 -0
- data/ext/tidy/tidylib.c +1751 -0
- data/ext/tidy/tmbstr.c +306 -0
- data/ext/tidy/tmbstr.h +92 -0
- data/ext/tidy/utf8.c +539 -0
- data/ext/tidy/utf8.h +52 -0
- data/ext/tidy/version.h +14 -0
- data/ext/tidy/win32tc.c +795 -0
- data/ext/tidy/win32tc.h +19 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/tidy/compat_spec.rb +44 -0
- data/spec/tidy/remote_uri_spec.rb +14 -0
- data/spec/tidy/test1.html +5 -0
- data/spec/tidy/tidy_spec.rb +34 -0
- metadata +125 -0
data/ext/tidy/access.h
ADDED
@@ -0,0 +1,279 @@
|
|
1
|
+
#ifndef __ACCESS_H__
|
2
|
+
#define __ACCESS_H__
|
3
|
+
|
4
|
+
/* access.h -- carry out accessibility checks
|
5
|
+
|
6
|
+
Copyright University of Toronto
|
7
|
+
Portions (c) 1998-2006 (W3C) MIT, ERCIM, Keio University
|
8
|
+
See tidy.h for the copyright notice.
|
9
|
+
|
10
|
+
CVS Info :
|
11
|
+
|
12
|
+
$Author: arnaud02 $
|
13
|
+
$Date: 2006/09/12 15:14:44 $
|
14
|
+
$Revision: 1.7 $
|
15
|
+
|
16
|
+
*/
|
17
|
+
|
18
|
+
/*********************************************************************
|
19
|
+
* AccessibilityChecks
|
20
|
+
*
|
21
|
+
* Carries out processes for all accessibility checks. Traverses
|
22
|
+
* through all the content within the tree and evaluates the tags for
|
23
|
+
* accessibility.
|
24
|
+
*
|
25
|
+
* To perform the following checks, 'AccessibilityChecks' must be
|
26
|
+
* called AFTER the tree structure has been formed.
|
27
|
+
*
|
28
|
+
* If, in the command prompt, there is no specification of which
|
29
|
+
* accessibility priorities to check, no accessibility checks will be
|
30
|
+
* performed. (ie. '1' for priority 1, '2' for priorities 1 and 2,
|
31
|
+
* and '3') for priorities 1, 2 and 3.)
|
32
|
+
*
|
33
|
+
* Copyright University of Toronto
|
34
|
+
* Programmed by: Mike Lam and Chris Ridpath
|
35
|
+
* Modifications by : Terry Teague (TRT)
|
36
|
+
*
|
37
|
+
*********************************************************************/
|
38
|
+
|
39
|
+
|
40
|
+
#include "forward.h"
|
41
|
+
|
42
|
+
#if SUPPORT_ACCESSIBILITY_CHECKS
|
43
|
+
|
44
|
+
/* The accessibility checks to perform depending on user's desire.
|
45
|
+
|
46
|
+
1. priority 1
|
47
|
+
2. priority 1 & 2
|
48
|
+
3. priority 1, 2, & 3
|
49
|
+
*/
|
50
|
+
|
51
|
+
/* Determines if the client-side text link is found within the document
|
52
|
+
typedef struct AreaLinks
|
53
|
+
{
|
54
|
+
struct AreaLinks* next;
|
55
|
+
char* link;
|
56
|
+
Bool HasBeenFound;
|
57
|
+
} AreaLinks;
|
58
|
+
*/
|
59
|
+
|
60
|
+
enum {
|
61
|
+
TEXTBUF_SIZE=128u
|
62
|
+
};
|
63
|
+
|
64
|
+
struct _TidyAccessImpl;
|
65
|
+
typedef struct _TidyAccessImpl TidyAccessImpl;
|
66
|
+
|
67
|
+
struct _TidyAccessImpl
|
68
|
+
{
|
69
|
+
/* gets set from Tidy variable AccessibilityCheckLevel */
|
70
|
+
int PRIORITYCHK;
|
71
|
+
|
72
|
+
/* Number of characters that are found within the concatenated text */
|
73
|
+
int counter;
|
74
|
+
|
75
|
+
/* list of characters in the text nodes found within a container element */
|
76
|
+
tmbchar textNode[ TEXTBUF_SIZE ];
|
77
|
+
|
78
|
+
/* The list of characters found within one text node */
|
79
|
+
tmbchar text[ TEXTBUF_SIZE ];
|
80
|
+
|
81
|
+
/* Number of frame elements found within a frameset */
|
82
|
+
int numFrames;
|
83
|
+
|
84
|
+
/* Number of 'longdesc' attributes found within a frameset */
|
85
|
+
int HasCheckedLongDesc;
|
86
|
+
|
87
|
+
int CheckedHeaders;
|
88
|
+
int ListElements;
|
89
|
+
int OtherListElements;
|
90
|
+
|
91
|
+
/* For 'USEMAP' identifier */
|
92
|
+
Bool HasUseMap;
|
93
|
+
Bool HasName;
|
94
|
+
Bool HasMap;
|
95
|
+
|
96
|
+
/* For tracking nodes that are deleted from the original parse tree - TRT */
|
97
|
+
/* Node *access_tree; */
|
98
|
+
|
99
|
+
Bool HasTH;
|
100
|
+
Bool HasValidFor;
|
101
|
+
Bool HasValidId;
|
102
|
+
Bool HasValidRowHeaders;
|
103
|
+
Bool HasValidColumnHeaders;
|
104
|
+
Bool HasInvalidRowHeader;
|
105
|
+
Bool HasInvalidColumnHeader;
|
106
|
+
int ForID;
|
107
|
+
|
108
|
+
/* List containing map-links
|
109
|
+
AreaLinks* links;
|
110
|
+
AreaLinks* start;
|
111
|
+
AreaLinks* current;
|
112
|
+
*/
|
113
|
+
|
114
|
+
};
|
115
|
+
|
116
|
+
|
117
|
+
/*
|
118
|
+
Determines which error/warning message should be displayed,
|
119
|
+
depending on the error code that was called.
|
120
|
+
|
121
|
+
Offset accessibility error codes by FIRST_ACCESS_ERR to avoid conflict with
|
122
|
+
other error codes defined in message.h and used in localize.c.
|
123
|
+
*/
|
124
|
+
enum accessErrorCodes
|
125
|
+
{
|
126
|
+
FIRST_ACCESS_ERR = 1000, /* must be first */
|
127
|
+
|
128
|
+
/* [1.1.1.1] */ IMG_MISSING_ALT,
|
129
|
+
/* [1.1.1.2] */ IMG_ALT_SUSPICIOUS_FILENAME,
|
130
|
+
/* [1.1.1.3] */ IMG_ALT_SUSPICIOUS_FILE_SIZE,
|
131
|
+
/* [1.1.1.4] */ IMG_ALT_SUSPICIOUS_PLACEHOLDER,
|
132
|
+
/* [1.1.1.10] */ IMG_ALT_SUSPICIOUS_TOO_LONG,
|
133
|
+
/* [1.1.1.11] */ IMG_MISSING_ALT_BULLET,
|
134
|
+
/* [1.1.1.12] */ IMG_MISSING_ALT_H_RULE,
|
135
|
+
/* [1.1.2.1] */ IMG_MISSING_LONGDESC_DLINK,
|
136
|
+
/* [1.1.2.2] */ IMG_MISSING_DLINK,
|
137
|
+
/* [1.1.2.3] */ IMG_MISSING_LONGDESC,
|
138
|
+
/* [1.1.2.5] */ LONGDESC_NOT_REQUIRED,
|
139
|
+
/* [1.1.3.1] */ IMG_BUTTON_MISSING_ALT,
|
140
|
+
/* [1.1.4.1] */ APPLET_MISSING_ALT,
|
141
|
+
/* [1.1.5.1] */ OBJECT_MISSING_ALT,
|
142
|
+
/* [1.1.6.1] */ AUDIO_MISSING_TEXT_WAV,
|
143
|
+
/* [1.1.6.2] */ AUDIO_MISSING_TEXT_AU,
|
144
|
+
/* [1.1.6.3] */ AUDIO_MISSING_TEXT_AIFF,
|
145
|
+
/* [1.1.6.4] */ AUDIO_MISSING_TEXT_SND,
|
146
|
+
/* [1.1.6.5] */ AUDIO_MISSING_TEXT_RA,
|
147
|
+
/* [1.1.6.6] */ AUDIO_MISSING_TEXT_RM,
|
148
|
+
/* [1.1.8.1] */ FRAME_MISSING_LONGDESC,
|
149
|
+
/* [1.1.9.1] */ AREA_MISSING_ALT,
|
150
|
+
/* [1.1.10.1] */ SCRIPT_MISSING_NOSCRIPT,
|
151
|
+
/* [1.1.12.1] */ ASCII_REQUIRES_DESCRIPTION,
|
152
|
+
/* [1.2.1.1] */ IMG_MAP_SERVER_REQUIRES_TEXT_LINKS,
|
153
|
+
/* [1.4.1.1] */ MULTIMEDIA_REQUIRES_TEXT,
|
154
|
+
/* [1.5.1.1] */ IMG_MAP_CLIENT_MISSING_TEXT_LINKS,
|
155
|
+
/* [2.1.1.1] */ INFORMATION_NOT_CONVEYED_IMAGE,
|
156
|
+
/* [2.1.1.2] */ INFORMATION_NOT_CONVEYED_APPLET,
|
157
|
+
/* [2.1.1.3] */ INFORMATION_NOT_CONVEYED_OBJECT,
|
158
|
+
/* [2.1.1.4] */ INFORMATION_NOT_CONVEYED_SCRIPT,
|
159
|
+
/* [2.1.1.5] */ INFORMATION_NOT_CONVEYED_INPUT,
|
160
|
+
/* [2.2.1.1] */ COLOR_CONTRAST_TEXT,
|
161
|
+
/* [2.2.1.2] */ COLOR_CONTRAST_LINK,
|
162
|
+
/* [2.2.1.3] */ COLOR_CONTRAST_ACTIVE_LINK,
|
163
|
+
/* [2.2.1.4] */ COLOR_CONTRAST_VISITED_LINK,
|
164
|
+
/* [3.2.1.1] */ DOCTYPE_MISSING,
|
165
|
+
/* [3.3.1.1] */ STYLE_SHEET_CONTROL_PRESENTATION,
|
166
|
+
/* [3.5.1.1] */ HEADERS_IMPROPERLY_NESTED,
|
167
|
+
/* [3.5.2.1] */ POTENTIAL_HEADER_BOLD,
|
168
|
+
/* [3.5.2.2] */ POTENTIAL_HEADER_ITALICS,
|
169
|
+
/* [3.5.2.3] */ POTENTIAL_HEADER_UNDERLINE,
|
170
|
+
/* [3.5.3.1] */ HEADER_USED_FORMAT_TEXT,
|
171
|
+
/* [3.6.1.1] */ LIST_USAGE_INVALID_UL,
|
172
|
+
/* [3.6.1.2] */ LIST_USAGE_INVALID_OL,
|
173
|
+
/* [3.6.1.4] */ LIST_USAGE_INVALID_LI,
|
174
|
+
/* [4.1.1.1] */ INDICATE_CHANGES_IN_LANGUAGE,
|
175
|
+
/* [4.3.1.1] */ LANGUAGE_NOT_IDENTIFIED,
|
176
|
+
/* [4.3.1.1] */ LANGUAGE_INVALID,
|
177
|
+
/* [5.1.2.1] */ DATA_TABLE_MISSING_HEADERS,
|
178
|
+
/* [5.1.2.2] */ DATA_TABLE_MISSING_HEADERS_COLUMN,
|
179
|
+
/* [5.1.2.3] */ DATA_TABLE_MISSING_HEADERS_ROW,
|
180
|
+
/* [5.2.1.1] */ DATA_TABLE_REQUIRE_MARKUP_COLUMN_HEADERS,
|
181
|
+
/* [5.2.1.2] */ DATA_TABLE_REQUIRE_MARKUP_ROW_HEADERS,
|
182
|
+
/* [5.3.1.1] */ LAYOUT_TABLES_LINEARIZE_PROPERLY,
|
183
|
+
/* [5.4.1.1] */ LAYOUT_TABLE_INVALID_MARKUP,
|
184
|
+
/* [5.5.1.1] */ TABLE_MISSING_SUMMARY,
|
185
|
+
/* [5.5.1.2] */ TABLE_SUMMARY_INVALID_NULL,
|
186
|
+
/* [5.5.1.3] */ TABLE_SUMMARY_INVALID_SPACES,
|
187
|
+
/* [5.5.1.6] */ TABLE_SUMMARY_INVALID_PLACEHOLDER,
|
188
|
+
/* [5.5.2.1] */ TABLE_MISSING_CAPTION,
|
189
|
+
/* [5.6.1.1] */ TABLE_MAY_REQUIRE_HEADER_ABBR,
|
190
|
+
/* [5.6.1.2] */ TABLE_MAY_REQUIRE_HEADER_ABBR_NULL,
|
191
|
+
/* [5.6.1.3] */ TABLE_MAY_REQUIRE_HEADER_ABBR_SPACES,
|
192
|
+
/* [6.1.1.1] */ STYLESHEETS_REQUIRE_TESTING_LINK,
|
193
|
+
/* [6.1.1.2] */ STYLESHEETS_REQUIRE_TESTING_STYLE_ELEMENT,
|
194
|
+
/* [6.1.1.3] */ STYLESHEETS_REQUIRE_TESTING_STYLE_ATTR,
|
195
|
+
/* [6.2.1.1] */ FRAME_SRC_INVALID,
|
196
|
+
/* [6.2.2.1] */ TEXT_EQUIVALENTS_REQUIRE_UPDATING_APPLET,
|
197
|
+
/* [6.2.2.2] */ TEXT_EQUIVALENTS_REQUIRE_UPDATING_SCRIPT,
|
198
|
+
/* [6.2.2.3] */ TEXT_EQUIVALENTS_REQUIRE_UPDATING_OBJECT,
|
199
|
+
/* [6.3.1.1] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_SCRIPT,
|
200
|
+
/* [6.3.1.2] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_OBJECT,
|
201
|
+
/* [6.3.1.3] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_EMBED,
|
202
|
+
/* [6.3.1.4] */ PROGRAMMATIC_OBJECTS_REQUIRE_TESTING_APPLET,
|
203
|
+
/* [6.5.1.1] */ FRAME_MISSING_NOFRAMES,
|
204
|
+
/* [6.5.1.2] */ NOFRAMES_INVALID_NO_VALUE,
|
205
|
+
/* [6.5.1.3] */ NOFRAMES_INVALID_CONTENT,
|
206
|
+
/* [6.5.1.4] */ NOFRAMES_INVALID_LINK,
|
207
|
+
/* [7.1.1.1] */ REMOVE_FLICKER_SCRIPT,
|
208
|
+
/* [7.1.1.2] */ REMOVE_FLICKER_OBJECT,
|
209
|
+
/* [7.1.1.3] */ REMOVE_FLICKER_EMBED,
|
210
|
+
/* [7.1.1.4] */ REMOVE_FLICKER_APPLET,
|
211
|
+
/* [7.1.1.5] */ REMOVE_FLICKER_ANIMATED_GIF,
|
212
|
+
/* [7.2.1.1] */ REMOVE_BLINK_MARQUEE,
|
213
|
+
/* [7.4.1.1] */ REMOVE_AUTO_REFRESH,
|
214
|
+
/* [7.5.1.1] */ REMOVE_AUTO_REDIRECT,
|
215
|
+
/* [8.1.1.1] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_SCRIPT,
|
216
|
+
/* [8.1.1.2] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_OBJECT,
|
217
|
+
/* [8.1.1.3] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_APPLET,
|
218
|
+
/* [8.1.1.4] */ ENSURE_PROGRAMMATIC_OBJECTS_ACCESSIBLE_EMBED,
|
219
|
+
/* [9.1.1.1] */ IMAGE_MAP_SERVER_SIDE_REQUIRES_CONVERSION,
|
220
|
+
/* [9.3.1.1] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_DOWN,
|
221
|
+
/* [9.3.1.2] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_UP,
|
222
|
+
/* [9.3.1.3] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_CLICK,
|
223
|
+
/* [9.3.1.4] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OVER,
|
224
|
+
/* [9.3.1.5] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_OUT,
|
225
|
+
/* [9.3.1.6] */ SCRIPT_NOT_KEYBOARD_ACCESSIBLE_ON_MOUSE_MOVE,
|
226
|
+
/* [10.1.1.1] */ NEW_WINDOWS_REQUIRE_WARNING_NEW,
|
227
|
+
/* [10.1.1.2] */ NEW_WINDOWS_REQUIRE_WARNING_BLANK,
|
228
|
+
/* [10.2.1.1] */ LABEL_NEEDS_REPOSITIONING_BEFORE_INPUT,
|
229
|
+
/* [10.2.1.2] */ LABEL_NEEDS_REPOSITIONING_AFTER_INPUT,
|
230
|
+
/* [10.4.1.1] */ FORM_CONTROL_REQUIRES_DEFAULT_TEXT,
|
231
|
+
/* [10.4.1.2] */ FORM_CONTROL_DEFAULT_TEXT_INVALID_NULL,
|
232
|
+
/* [10.4.1.3] */ FORM_CONTROL_DEFAULT_TEXT_INVALID_SPACES,
|
233
|
+
/* [11.2.1.1] */ REPLACE_DEPRECATED_HTML_APPLET,
|
234
|
+
/* [11.2.1.2] */ REPLACE_DEPRECATED_HTML_BASEFONT,
|
235
|
+
/* [11.2.1.3] */ REPLACE_DEPRECATED_HTML_CENTER,
|
236
|
+
/* [11.2.1.4] */ REPLACE_DEPRECATED_HTML_DIR,
|
237
|
+
/* [11.2.1.5] */ REPLACE_DEPRECATED_HTML_FONT,
|
238
|
+
/* [11.2.1.6] */ REPLACE_DEPRECATED_HTML_ISINDEX,
|
239
|
+
/* [11.2.1.7] */ REPLACE_DEPRECATED_HTML_MENU,
|
240
|
+
/* [11.2.1.8] */ REPLACE_DEPRECATED_HTML_S,
|
241
|
+
/* [11.2.1.9] */ REPLACE_DEPRECATED_HTML_STRIKE,
|
242
|
+
/* [11.2.1.10] */ REPLACE_DEPRECATED_HTML_U,
|
243
|
+
/* [12.1.1.1] */ FRAME_MISSING_TITLE,
|
244
|
+
/* [12.1.1.2] */ FRAME_TITLE_INVALID_NULL,
|
245
|
+
/* [12.1.1.3] */ FRAME_TITLE_INVALID_SPACES,
|
246
|
+
/* [12.4.1.1] */ ASSOCIATE_LABELS_EXPLICITLY,
|
247
|
+
/* [12.4.1.2] */ ASSOCIATE_LABELS_EXPLICITLY_FOR,
|
248
|
+
/* [12.4.1.3] */ ASSOCIATE_LABELS_EXPLICITLY_ID,
|
249
|
+
/* [13.1.1.1] */ LINK_TEXT_NOT_MEANINGFUL,
|
250
|
+
/* [13.1.1.2] */ LINK_TEXT_MISSING,
|
251
|
+
/* [13.1.1.3] */ LINK_TEXT_TOO_LONG,
|
252
|
+
/* [13.1.1.4] */ LINK_TEXT_NOT_MEANINGFUL_CLICK_HERE,
|
253
|
+
/* [13.1.1.5] */ LINK_TEXT_NOT_MEANINGFUL_MORE,
|
254
|
+
/* [13.1.1.6] */ LINK_TEXT_NOT_MEANINGFUL_FOLLOW_THIS,
|
255
|
+
/* [13.2.1.1] */ METADATA_MISSING,
|
256
|
+
/* [13.2.1.2] */ METADATA_MISSING_LINK,
|
257
|
+
/* [13.2.1.3] */ METADATA_MISSING_REDIRECT_AUTOREFRESH,
|
258
|
+
/* [13.10.1.1] */ SKIPOVER_ASCII_ART,
|
259
|
+
|
260
|
+
LAST_ACCESS_ERR /* must be last */
|
261
|
+
};
|
262
|
+
|
263
|
+
|
264
|
+
void TY_(AccessibilityHelloMessage)( TidyDocImpl* doc );
|
265
|
+
void TY_(DisplayHTMLTableAlgorithm)( TidyDocImpl* doc );
|
266
|
+
|
267
|
+
/************************************************************
|
268
|
+
* AccessibilityChecks
|
269
|
+
*
|
270
|
+
* Traverses through the individual nodes of the tree
|
271
|
+
* and checks attributes and elements for accessibility.
|
272
|
+
* after the tree structure has been formed.
|
273
|
+
************************************************************/
|
274
|
+
|
275
|
+
void TY_(AccessibilityChecks)( TidyDocImpl* doc );
|
276
|
+
|
277
|
+
|
278
|
+
#endif /* SUPPORT_ACCESSIBILITY_CHECKS */
|
279
|
+
#endif /* __ACCESS_H__ */
|
data/ext/tidy/alloc.c
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
/* alloc.c -- Default memory allocation routines.
|
2
|
+
|
3
|
+
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University
|
4
|
+
See tidy.h for the copyright notice.
|
5
|
+
|
6
|
+
CVS Info :
|
7
|
+
|
8
|
+
$Author: arnaud02 $
|
9
|
+
$Date: 2006/12/29 16:31:07 $
|
10
|
+
$Revision: 1.7 $
|
11
|
+
|
12
|
+
*/
|
13
|
+
|
14
|
+
#include "tidy.h"
|
15
|
+
#include "forward.h"
|
16
|
+
|
17
|
+
static TidyMalloc g_malloc = NULL;
|
18
|
+
static TidyRealloc g_realloc = NULL;
|
19
|
+
static TidyFree g_free = NULL;
|
20
|
+
static TidyPanic g_panic = NULL;
|
21
|
+
|
22
|
+
Bool TIDY_CALL tidySetMallocCall( TidyMalloc fmalloc )
|
23
|
+
{
|
24
|
+
g_malloc = fmalloc;
|
25
|
+
return yes;
|
26
|
+
}
|
27
|
+
Bool TIDY_CALL tidySetReallocCall( TidyRealloc frealloc )
|
28
|
+
{
|
29
|
+
g_realloc = frealloc;
|
30
|
+
return yes;
|
31
|
+
}
|
32
|
+
Bool TIDY_CALL tidySetFreeCall( TidyFree ffree )
|
33
|
+
{
|
34
|
+
g_free = ffree;
|
35
|
+
return yes;
|
36
|
+
}
|
37
|
+
Bool TIDY_CALL tidySetPanicCall( TidyPanic fpanic )
|
38
|
+
{
|
39
|
+
g_panic = fpanic;
|
40
|
+
return yes;
|
41
|
+
}
|
42
|
+
|
43
|
+
static void TIDY_CALL defaultPanic( TidyAllocator* ARG_UNUSED(allocator), ctmbstr msg )
|
44
|
+
{
|
45
|
+
if ( g_panic )
|
46
|
+
g_panic( msg );
|
47
|
+
else
|
48
|
+
{
|
49
|
+
/* 2 signifies a serious error */
|
50
|
+
fprintf( stderr, "Fatal error: %s\n", msg );
|
51
|
+
#ifdef _DEBUG
|
52
|
+
assert(0);
|
53
|
+
#endif
|
54
|
+
exit(2);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
static void* TIDY_CALL defaultAlloc( TidyAllocator* allocator, size_t size )
|
59
|
+
{
|
60
|
+
void *p = ( g_malloc ? g_malloc(size) : malloc(size) );
|
61
|
+
if ( !p )
|
62
|
+
defaultPanic( allocator,"Out of memory!");
|
63
|
+
return p;
|
64
|
+
}
|
65
|
+
|
66
|
+
static void* TIDY_CALL defaultRealloc( TidyAllocator* allocator, void* mem, size_t newsize )
|
67
|
+
{
|
68
|
+
void *p;
|
69
|
+
if ( mem == NULL )
|
70
|
+
return defaultAlloc( allocator, newsize );
|
71
|
+
|
72
|
+
p = ( g_realloc ? g_realloc(mem, newsize) : realloc(mem, newsize) );
|
73
|
+
if (!p)
|
74
|
+
defaultPanic( allocator, "Out of memory!");
|
75
|
+
return p;
|
76
|
+
}
|
77
|
+
|
78
|
+
static void TIDY_CALL defaultFree( TidyAllocator* ARG_UNUSED(allocator), void* mem )
|
79
|
+
{
|
80
|
+
if ( mem )
|
81
|
+
{
|
82
|
+
if ( g_free )
|
83
|
+
g_free( mem );
|
84
|
+
else
|
85
|
+
free( mem );
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
static const TidyAllocatorVtbl defaultVtbl = {
|
90
|
+
defaultAlloc,
|
91
|
+
defaultRealloc,
|
92
|
+
defaultFree,
|
93
|
+
defaultPanic
|
94
|
+
};
|
95
|
+
|
96
|
+
TidyAllocator TY_(g_default_allocator) = {
|
97
|
+
&defaultVtbl
|
98
|
+
};
|
99
|
+
|
100
|
+
/*
|
101
|
+
* local variables:
|
102
|
+
* mode: c
|
103
|
+
* indent-tabs-mode: nil
|
104
|
+
* c-basic-offset: 4
|
105
|
+
* eval: (c-set-offset 'substatement-open 0)
|
106
|
+
* end:
|
107
|
+
*/
|
data/ext/tidy/attrask.c
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
/* attrask.c -- Interrogate attribute type
|
2
|
+
|
3
|
+
(c) 1998-2006 (W3C) MIT, ERCIM, Keio University
|
4
|
+
See tidy.h for the copyright notice.
|
5
|
+
|
6
|
+
CVS Info:
|
7
|
+
$Author: arnaud02 $
|
8
|
+
$Date: 2006/09/12 15:14:44 $
|
9
|
+
$Revision: 1.5 $
|
10
|
+
|
11
|
+
*/
|
12
|
+
|
13
|
+
#include "tidy-int.h"
|
14
|
+
#include "tidy.h"
|
15
|
+
#include "attrs.h"
|
16
|
+
|
17
|
+
Bool TIDY_CALL tidyAttrIsHREF( TidyAttr tattr )
|
18
|
+
{
|
19
|
+
return attrIsHREF( tidyAttrToImpl(tattr) );
|
20
|
+
}
|
21
|
+
Bool TIDY_CALL tidyAttrIsSRC( TidyAttr tattr )
|
22
|
+
{
|
23
|
+
return attrIsSRC( tidyAttrToImpl(tattr) );
|
24
|
+
}
|
25
|
+
Bool TIDY_CALL tidyAttrIsID( TidyAttr tattr )
|
26
|
+
{
|
27
|
+
return attrIsID( tidyAttrToImpl(tattr) );
|
28
|
+
}
|
29
|
+
Bool TIDY_CALL tidyAttrIsNAME( TidyAttr tattr )
|
30
|
+
{
|
31
|
+
return attrIsNAME( tidyAttrToImpl(tattr) );
|
32
|
+
}
|
33
|
+
Bool TIDY_CALL tidyAttrIsSUMMARY( TidyAttr tattr )
|
34
|
+
{
|
35
|
+
return attrIsSUMMARY( tidyAttrToImpl(tattr) );
|
36
|
+
}
|
37
|
+
Bool TIDY_CALL tidyAttrIsALT( TidyAttr tattr )
|
38
|
+
{
|
39
|
+
return attrIsALT( tidyAttrToImpl(tattr) );
|
40
|
+
}
|
41
|
+
Bool TIDY_CALL tidyAttrIsLONGDESC( TidyAttr tattr )
|
42
|
+
{
|
43
|
+
return attrIsLONGDESC( tidyAttrToImpl(tattr) );
|
44
|
+
}
|
45
|
+
Bool TIDY_CALL tidyAttrIsUSEMAP( TidyAttr tattr )
|
46
|
+
{
|
47
|
+
return attrIsUSEMAP( tidyAttrToImpl(tattr) );
|
48
|
+
}
|
49
|
+
Bool TIDY_CALL tidyAttrIsISMAP( TidyAttr tattr )
|
50
|
+
{
|
51
|
+
return attrIsISMAP( tidyAttrToImpl(tattr) );
|
52
|
+
}
|
53
|
+
Bool TIDY_CALL tidyAttrIsLANGUAGE( TidyAttr tattr )
|
54
|
+
{
|
55
|
+
return attrIsLANGUAGE( tidyAttrToImpl(tattr) );
|
56
|
+
}
|
57
|
+
Bool TIDY_CALL tidyAttrIsTYPE( TidyAttr tattr )
|
58
|
+
{
|
59
|
+
return attrIsTYPE( tidyAttrToImpl(tattr) );
|
60
|
+
}
|
61
|
+
Bool TIDY_CALL tidyAttrIsVALUE( TidyAttr tattr )
|
62
|
+
{
|
63
|
+
return attrIsVALUE( tidyAttrToImpl(tattr) );
|
64
|
+
}
|
65
|
+
Bool TIDY_CALL tidyAttrIsCONTENT( TidyAttr tattr )
|
66
|
+
{
|
67
|
+
return attrIsCONTENT( tidyAttrToImpl(tattr) );
|
68
|
+
}
|
69
|
+
Bool TIDY_CALL tidyAttrIsTITLE( TidyAttr tattr )
|
70
|
+
{
|
71
|
+
return attrIsTITLE( tidyAttrToImpl(tattr) );
|
72
|
+
}
|
73
|
+
Bool TIDY_CALL tidyAttrIsXMLNS( TidyAttr tattr )
|
74
|
+
{
|
75
|
+
return attrIsXMLNS( tidyAttrToImpl(tattr) );
|
76
|
+
}
|
77
|
+
Bool TIDY_CALL tidyAttrIsDATAFLD( TidyAttr tattr )
|
78
|
+
{
|
79
|
+
return attrIsDATAFLD( tidyAttrToImpl(tattr) );
|
80
|
+
}
|
81
|
+
Bool TIDY_CALL tidyAttrIsWIDTH( TidyAttr tattr )
|
82
|
+
{
|
83
|
+
return attrIsWIDTH( tidyAttrToImpl(tattr) );
|
84
|
+
}
|
85
|
+
Bool TIDY_CALL tidyAttrIsHEIGHT( TidyAttr tattr )
|
86
|
+
{
|
87
|
+
return attrIsHEIGHT( tidyAttrToImpl(tattr) );
|
88
|
+
}
|
89
|
+
Bool TIDY_CALL tidyAttrIsFOR( TidyAttr tattr )
|
90
|
+
{
|
91
|
+
return attrIsFOR( tidyAttrToImpl(tattr) );
|
92
|
+
}
|
93
|
+
Bool TIDY_CALL tidyAttrIsSELECTED( TidyAttr tattr )
|
94
|
+
{
|
95
|
+
return attrIsSELECTED( tidyAttrToImpl(tattr) );
|
96
|
+
}
|
97
|
+
Bool TIDY_CALL tidyAttrIsCHECKED( TidyAttr tattr )
|
98
|
+
{
|
99
|
+
return attrIsCHECKED( tidyAttrToImpl(tattr) );
|
100
|
+
}
|
101
|
+
Bool TIDY_CALL tidyAttrIsLANG( TidyAttr tattr )
|
102
|
+
{
|
103
|
+
return attrIsLANG( tidyAttrToImpl(tattr) );
|
104
|
+
}
|
105
|
+
Bool TIDY_CALL tidyAttrIsTARGET( TidyAttr tattr )
|
106
|
+
{
|
107
|
+
return attrIsTARGET( tidyAttrToImpl(tattr) );
|
108
|
+
}
|
109
|
+
Bool TIDY_CALL tidyAttrIsHTTP_EQUIV( TidyAttr tattr )
|
110
|
+
{
|
111
|
+
return attrIsHTTP_EQUIV( tidyAttrToImpl(tattr) );
|
112
|
+
}
|
113
|
+
Bool TIDY_CALL tidyAttrIsREL( TidyAttr tattr )
|
114
|
+
{
|
115
|
+
return attrIsREL( tidyAttrToImpl(tattr) );
|
116
|
+
}
|
117
|
+
Bool TIDY_CALL tidyAttrIsEvent( TidyAttr tattr )
|
118
|
+
{
|
119
|
+
return TY_(attrIsEvent)( tidyAttrToImpl(tattr) );
|
120
|
+
}
|
121
|
+
Bool TIDY_CALL tidyAttrIsOnMOUSEMOVE( TidyAttr tattr )
|
122
|
+
{
|
123
|
+
return attrIsOnMOUSEMOVE( tidyAttrToImpl(tattr) );
|
124
|
+
}
|
125
|
+
Bool TIDY_CALL tidyAttrIsOnMOUSEDOWN( TidyAttr tattr )
|
126
|
+
{
|
127
|
+
return attrIsOnMOUSEDOWN( tidyAttrToImpl(tattr) );
|
128
|
+
}
|
129
|
+
Bool TIDY_CALL tidyAttrIsOnMOUSEUP( TidyAttr tattr )
|
130
|
+
{
|
131
|
+
return attrIsOnMOUSEUP( tidyAttrToImpl(tattr) );
|
132
|
+
}
|
133
|
+
Bool TIDY_CALL tidyAttrIsOnCLICK( TidyAttr tattr )
|
134
|
+
{
|
135
|
+
return attrIsOnCLICK( tidyAttrToImpl(tattr) );
|
136
|
+
}
|
137
|
+
Bool TIDY_CALL tidyAttrIsOnMOUSEOVER( TidyAttr tattr )
|
138
|
+
{
|
139
|
+
return attrIsOnMOUSEOVER( tidyAttrToImpl(tattr) );
|
140
|
+
}
|
141
|
+
Bool TIDY_CALL tidyAttrIsOnMOUSEOUT( TidyAttr tattr )
|
142
|
+
{
|
143
|
+
return attrIsOnMOUSEOUT( tidyAttrToImpl(tattr) );
|
144
|
+
}
|
145
|
+
Bool TIDY_CALL tidyAttrIsOnKEYDOWN( TidyAttr tattr )
|
146
|
+
{
|
147
|
+
return attrIsOnKEYDOWN( tidyAttrToImpl(tattr) );
|
148
|
+
}
|
149
|
+
Bool TIDY_CALL tidyAttrIsOnKEYUP( TidyAttr tattr )
|
150
|
+
{
|
151
|
+
return attrIsOnKEYUP( tidyAttrToImpl(tattr) );
|
152
|
+
}
|
153
|
+
Bool TIDY_CALL tidyAttrIsOnKEYPRESS( TidyAttr tattr )
|
154
|
+
{
|
155
|
+
return attrIsOnKEYPRESS( tidyAttrToImpl(tattr) );
|
156
|
+
}
|
157
|
+
Bool TIDY_CALL tidyAttrIsOnFOCUS( TidyAttr tattr )
|
158
|
+
{
|
159
|
+
return attrIsOnFOCUS( tidyAttrToImpl(tattr) );
|
160
|
+
}
|
161
|
+
Bool TIDY_CALL tidyAttrIsOnBLUR( TidyAttr tattr )
|
162
|
+
{
|
163
|
+
return attrIsOnBLUR( tidyAttrToImpl(tattr) );
|
164
|
+
}
|
165
|
+
Bool TIDY_CALL tidyAttrIsBGCOLOR( TidyAttr tattr )
|
166
|
+
{
|
167
|
+
return attrIsBGCOLOR( tidyAttrToImpl(tattr) );
|
168
|
+
}
|
169
|
+
Bool TIDY_CALL tidyAttrIsLINK( TidyAttr tattr )
|
170
|
+
{
|
171
|
+
return attrIsLINK( tidyAttrToImpl(tattr) );
|
172
|
+
}
|
173
|
+
Bool TIDY_CALL tidyAttrIsALINK( TidyAttr tattr )
|
174
|
+
{
|
175
|
+
return attrIsALINK( tidyAttrToImpl(tattr) );
|
176
|
+
}
|
177
|
+
Bool TIDY_CALL tidyAttrIsVLINK( TidyAttr tattr )
|
178
|
+
{
|
179
|
+
return attrIsVLINK( tidyAttrToImpl(tattr) );
|
180
|
+
}
|
181
|
+
Bool TIDY_CALL tidyAttrIsTEXT( TidyAttr tattr )
|
182
|
+
{
|
183
|
+
return attrIsTEXT( tidyAttrToImpl(tattr) );
|
184
|
+
}
|
185
|
+
Bool TIDY_CALL tidyAttrIsSTYLE( TidyAttr tattr )
|
186
|
+
{
|
187
|
+
return attrIsSTYLE( tidyAttrToImpl(tattr) );
|
188
|
+
}
|
189
|
+
Bool TIDY_CALL tidyAttrIsABBR( TidyAttr tattr )
|
190
|
+
{
|
191
|
+
return attrIsABBR( tidyAttrToImpl(tattr) );
|
192
|
+
}
|
193
|
+
Bool TIDY_CALL tidyAttrIsCOLSPAN( TidyAttr tattr )
|
194
|
+
{
|
195
|
+
return attrIsCOLSPAN( tidyAttrToImpl(tattr) );
|
196
|
+
}
|
197
|
+
Bool TIDY_CALL tidyAttrIsROWSPAN( TidyAttr tattr )
|
198
|
+
{
|
199
|
+
return attrIsROWSPAN( tidyAttrToImpl(tattr) );
|
200
|
+
}
|
201
|
+
|
202
|
+
/*
|
203
|
+
* local variables:
|
204
|
+
* mode: c
|
205
|
+
* indent-tabs-mode: nil
|
206
|
+
* c-basic-offset: 4
|
207
|
+
* eval: (c-set-offset 'substatement-open 0)
|
208
|
+
* end:
|
209
|
+
*/
|