Version:
~ [ 1.0 ] ~
1 #ifndef __TIDY_INT_H__
2 #define __TIDY_INT_H__
3
4 /* tidy-int.h -- internal library declarations
5
6 (c) 1998-2003 (W3C) MIT, ERCIM, Keio University
7 See tidy.h for the copyright notice.
8
9 CVS Info :
10
11 $Author: hoehrmann $
12 $Date: 2004/03/06 17:07:02 $
13 $Revision: 1.8 $
14
15 */
16
17 #include "tidy.h"
18 #include "config.h"
19 #include "tags.h"
20 #include "attrs.h"
21 #include "lexer.h"
22 #include "pprint.h"
23 #include "access.h"
24
25 #ifndef MAX
26 #define MAX(a,b) (((a) > (b))?(a):(b))
27 #endif
28 #ifndef MIN
29 #define MIN(a,b) (((a) < (b))?(a):(b))
30 #endif
31
32 struct _TidyDocImpl
33 {
34 /* The Document Tree (and backing store buffer) */
35 Node root; /* This MUST remain the first declared
36 variable in this structure */
37 Lexer* lexer;
38
39 /* Config + Markup Declarations */
40 TidyConfigImpl config;
41 TidyTagImpl tags;
42 TidyAttribImpl attribs;
43
44 #if SUPPORT_ACCESSIBILITY_CHECKS
45 /* Accessibility Checks state */
46 TidyAccessImpl access;
47 #endif
48
49 /* The Pretty Print buffer */
50 TidyPrintImpl pprint;
51
52 /* I/O */
53 StreamIn* docIn;
54 StreamOut* docOut;
55 StreamOut* errout;
56 TidyReportFilter mssgFilt;
57 TidyOptCallback pOptCallback;
58
59 /* Parse + Repair Results */
60 uint optionErrors;
61 uint errors;
62 uint warnings;
63 uint accessErrors;
64 uint infoMessages;
65 uint docErrors;
66 int parseStatus;
67
68 uint badAccess; /* for accessibility errors */
69 uint badLayout; /* for bad style errors */
70 uint badChars; /* for bad char encodings */
71 uint badForm; /* for badly placed form tags */
72
73 /* Miscellaneous */
74 ulong appData;
75 uint nClassId;
76 Bool inputHadBOM;
77
78 #ifdef TIDY_STORE_ORIGINAL_TEXT
79 Bool storeText;
80 #endif
81
82 #if PRESERVE_FILE_TIMES
83 struct utimbuf filetimes;
84 #endif
85 tmbstr givenDoctype;
86 };
87
88
89 /* Twizzle internal/external types */
90 #ifdef NEVER
91 TidyDocImpl* tidyDocToImpl( TidyDoc tdoc );
92 TidyDoc tidyImplToDoc( TidyDocImpl* impl );
93
94 Node* tidyNodeToImpl( TidyNode tnod );
95 TidyNode tidyImplToNode( Node* node );
96
97 AttVal* tidyAttrToImpl( TidyAttr tattr );
98 TidyAttr tidyImplToAttr( AttVal* attval );
99
100 const TidyOptionImpl* tidyOptionToImpl( TidyOption topt );
101 TidyOption tidyImplToOption( const TidyOptionImpl* option );
102 #else
103
104 #define tidyDocToImpl( tdoc ) ((TidyDocImpl*)(tdoc))
105 #define tidyImplToDoc( doc ) ((TidyDoc)(doc))
106
107 #define tidyNodeToImpl( tnod ) ((Node*)(tnod))
108 #define tidyImplToNode( node ) ((TidyNode)(node))
109
110 #define tidyAttrToImpl( tattr ) ((AttVal*)(tattr))
111 #define tidyImplToAttr( attval ) ((TidyAttr)(attval))
112
113 #define tidyOptionToImpl( topt ) ((const TidyOptionImpl*)(topt))
114 #define tidyImplToOption( option ) ((TidyOption)(option))
115
116 #endif
117
118 /* Create/Destroy a Tidy "document" object */
119 TidyDocImpl* tidyDocCreate(void);
120 void tidyDocRelease( TidyDocImpl* impl );
121
122 int tidyDocStatus( TidyDocImpl* impl );
123
124 /* Parse Markup */
125 int tidyDocParseFile( TidyDocImpl* impl, ctmbstr htmlfil );
126 int tidyDocParseStdin( TidyDocImpl* impl );
127 int tidyDocParseString( TidyDocImpl* impl, ctmbstr content );
128 int tidyDocParseBuffer( TidyDocImpl* impl, TidyBuffer* inbuf );
129 int tidyDocParseSource( TidyDocImpl* impl, TidyInputSource* docIn );
130 int tidyDocParseStream( TidyDocImpl* impl, StreamIn* in );
131
132
133 /* Execute post-parse diagnostics and cleanup.
134 ** Note, the order is important. You will get different
135 ** results from the diagnostics depending on if they are run
136 ** pre-or-post repair.
137 */
138 int tidyDocRunDiagnostics( TidyDocImpl* doc );
139 int tidyDocCleanAndRepair( TidyDocImpl* doc );
140
141
142 /* Save cleaned up file to file/buffer/sink */
143 int tidyDocSaveFile( TidyDocImpl* impl, ctmbstr htmlfil );
144 int tidyDocSaveStdout( TidyDocImpl* impl );
145 int tidyDocSaveString( TidyDocImpl* impl, tmbstr buffer, uint* buflen );
146 int tidyDocSaveBuffer( TidyDocImpl* impl, TidyBuffer* outbuf );
147 int tidyDocSaveSink( TidyDocImpl* impl, TidyOutputSink* docOut );
148 int tidyDocSaveStream( TidyDocImpl* impl, StreamOut* out );
149
150 #endif /* __TIDY_INT_H__ */
151
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.