OSDN Git Service

設定変更。
[wordring-tm/wordring-tm.git] / third_party / tidy-html5-master / src / pprint.h
1 #ifndef __PPRINT_H__
2 #define __PPRINT_H__
3
4 /* pprint.h -- pretty print parse tree  
5   
6    (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
7    See tidy.h for the copyright notice.
8   
9 */
10
11 #include "forward.h"
12
13 /*
14   Block-level and unknown elements are printed on
15   new lines and their contents indented 2 spaces
16
17   Inline elements are printed inline.
18
19   Inline content is wrapped on spaces (except in
20   attribute values or preformatted text, after
21   start tags and before end tags
22 */
23
24 #define NORMAL        0u
25 #define PREFORMATTED  1u
26 #define COMMENT       2u
27 #define ATTRIBVALUE   4u
28 #define NOWRAP        8u
29 #define CDATA         16u
30
31
32 /* The pretty printer keeps at most two lines of text in the
33 ** buffer before flushing output.  We need to capture the
34 ** indent state (indent level) at the _beginning_ of _each_
35 ** line, not the end of just the second line.
36 **
37 ** We must also keep track "In Attribute" and "In String"
38 ** states at the _end_ of each line, 
39 */
40
41 typedef struct _TidyIndent
42 {
43     int spaces;
44     int attrValStart;
45     int attrStringStart;
46 } TidyIndent;
47
48 typedef struct _TidyPrintImpl
49 {
50     TidyAllocator *allocator; /* Allocator */
51
52     uint *linebuf;
53     uint lbufsize;
54     uint linelen;
55     uint wraphere;
56   
57     uint ixInd;
58     TidyIndent indent[2];  /* Two lines worth of indent state */
59 } TidyPrintImpl;
60
61
62 #if 0 && SUPPORT_ASIAN_ENCODINGS
63 /* #431953 - start RJ Wraplen adjusted for smooth international ride */
64 uint CWrapLen( TidyDocImpl* doc, uint ind );
65 #endif
66
67 void TY_(InitPrintBuf)( TidyDocImpl* doc );
68 void TY_(FreePrintBuf)( TidyDocImpl* doc );
69
70 void TY_(PFlushLine)( TidyDocImpl* doc, uint indent );
71
72
73 /* print just the content of the body element.
74 ** useful when you want to reuse material from
75 ** other documents.
76 ** 
77 ** -- Sebastiano Vigna <vigna@dsi.unimi.it>
78 */
79
80 void TY_(PrintBody)( TidyDocImpl* doc );       /* you can print an entire document */
81                                           /* node as body using PPrintTree() */
82
83 void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node );
84
85 void TY_(PPrintXMLTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node );
86
87
88 #endif /* __PPRINT_H__ */