HTML Tidy
0.1
|
00001 #ifndef __TIDY_INT_H__ 00002 #define __TIDY_INT_H__ 00003 00004 /* tidy-int.h -- internal library declarations 00005 00006 (c) 1998-2007 (W3C) MIT, ERCIM, Keio University 00007 See tidy.h for the copyright notice. 00008 00009 CVS Info : 00010 00011 $Author: arnaud02 $ 00012 $Date: 2007/02/11 09:45:52 $ 00013 $Revision: 1.13 $ 00014 00015 */ 00016 00017 #include "tidy.h" 00018 #include "config.h" 00019 #include "lexer.h" 00020 #include "tags.h" 00021 #include "attrs.h" 00022 #include "pprint.h" 00023 #include "access.h" 00024 00025 #ifndef MAX 00026 #define MAX(a,b) (((a) > (b))?(a):(b)) 00027 #endif 00028 #ifndef MIN 00029 #define MIN(a,b) (((a) < (b))?(a):(b)) 00030 #endif 00031 00032 struct _TidyDocImpl 00033 { 00034 /* The Document Tree (and backing store buffer) */ 00035 Node root; /* This MUST remain the first declared 00036 variable in this structure */ 00037 Lexer* lexer; 00038 00039 /* Config + Markup Declarations */ 00040 TidyConfigImpl config; 00041 TidyTagImpl tags; 00042 TidyAttribImpl attribs; 00043 00044 #if SUPPORT_ACCESSIBILITY_CHECKS 00045 /* Accessibility Checks state */ 00046 TidyAccessImpl access; 00047 #endif 00048 00049 /* The Pretty Print buffer */ 00050 TidyPrintImpl pprint; 00051 00052 /* I/O */ 00053 StreamIn* docIn; 00054 StreamOut* docOut; 00055 StreamOut* errout; 00056 TidyReportFilter mssgFilt; 00057 TidyOptCallback pOptCallback; 00058 00059 /* Parse + Repair Results */ 00060 uint optionErrors; 00061 uint errors; 00062 uint warnings; 00063 uint accessErrors; 00064 uint infoMessages; 00065 uint docErrors; 00066 int parseStatus; 00067 00068 uint badAccess; /* for accessibility errors */ 00069 uint badLayout; /* for bad style errors */ 00070 uint badChars; /* for bad char encodings */ 00071 uint badForm; /* for badly placed form tags */ 00072 00073 /* Memory allocator */ 00074 TidyAllocator* allocator; 00075 00076 /* Miscellaneous */ 00077 void* appData; 00078 uint nClassId; 00079 Bool inputHadBOM; 00080 00081 #ifdef TIDY_STORE_ORIGINAL_TEXT 00082 Bool storeText; 00083 #endif 00084 00085 #if PRESERVE_FILE_TIMES 00086 struct utimbuf filetimes; 00087 #endif 00088 tmbstr givenDoctype; 00089 }; 00090 00091 00092 /* Twizzle internal/external types */ 00093 #ifdef NEVER 00094 TidyDocImpl* tidyDocToImpl( TidyDoc tdoc ); 00095 TidyDoc tidyImplToDoc( TidyDocImpl* impl ); 00096 00097 Node* tidyNodeToImpl( TidyNode tnod ); 00098 TidyNode tidyImplToNode( Node* node ); 00099 00100 AttVal* tidyAttrToImpl( TidyAttr tattr ); 00101 TidyAttr tidyImplToAttr( AttVal* attval ); 00102 00103 const TidyOptionImpl* tidyOptionToImpl( TidyOption topt ); 00104 TidyOption tidyImplToOption( const TidyOptionImpl* option ); 00105 #else 00106 00107 #define tidyDocToImpl( tdoc ) ((TidyDocImpl*)(tdoc)) 00108 #define tidyImplToDoc( doc ) ((TidyDoc)(doc)) 00109 00110 #define tidyNodeToImpl( tnod ) ((Node*)(tnod)) 00111 #define tidyImplToNode( node ) ((TidyNode)(node)) 00112 00113 #define tidyAttrToImpl( tattr ) ((AttVal*)(tattr)) 00114 #define tidyImplToAttr( attval ) ((TidyAttr)(attval)) 00115 00116 #define tidyOptionToImpl( topt ) ((const TidyOptionImpl*)(topt)) 00117 #define tidyImplToOption( option ) ((TidyOption)(option)) 00118 00119 #endif 00120 00121 /** Wrappers for easy memory allocation using the document's allocator */ 00122 #define TidyDocAlloc(doc, size) TidyAlloc((doc)->allocator, size) 00123 #define TidyDocRealloc(doc, block, size) TidyRealloc((doc)->allocator, block, size) 00124 #define TidyDocFree(doc, block) TidyFree((doc)->allocator, block) 00125 #define TidyDocPanic(doc, msg) TidyPanic((doc)->allocator, msg) 00126 00127 int TY_(DocParseStream)( TidyDocImpl* impl, StreamIn* in ); 00128 00129 #endif /* __TIDY_INT_H__ */