HTML Tidy  5.8.0
The HTACG Tidy HTML Project
pprint.h
Go to the documentation of this file.
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;
46 } TidyIndent;
47 
48 typedef struct _TidyPrintImpl
49 {
50  TidyAllocator *allocator; /* Allocator */
51 
57 
59  TidyIndent indent[2]; /* Two lines worth of indent state */
61 
62 
63 TY_PRIVATE void TY_(InitPrintBuf)( TidyDocImpl* doc );
64 TY_PRIVATE void TY_(FreePrintBuf)( TidyDocImpl* doc );
65 
66 TY_PRIVATE void TY_(PFlushLine)( TidyDocImpl* doc, uint indent );
67 
68 
69 /* print just the content of the body element.
70 ** useful when you want to reuse material from
71 ** other documents.
72 **
73 ** -- Sebastiano Vigna <vigna@dsi.unimi.it>
74 */
75 
76 TY_PRIVATE void TY_(PrintBody)( TidyDocImpl* doc ); /* you can print an entire document */
77  /* node as body using PPrintTree() */
78 
79 TY_PRIVATE void TY_(PPrintTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node );
80 
81 TY_PRIVATE void TY_(PPrintXMLTree)( TidyDocImpl* doc, uint mode, uint indent, Node *node );
82 
83 /*\
84  * 20150515 - support using tabs instead of spaces
85 \*/
86 TY_PRIVATE void TY_(PPrintTabs)(void);
87 TY_PRIVATE void TY_(PPrintSpaces)(void);
88 
89 #endif /* __PPRINT_H__ */
#define TY_PRIVATE
Definition: forward.h:29
#define TY_(str)
Definition: forward.h:23
uint * linebuf
Definition: pprint.h:52
int spaces
Definition: pprint.h:43
uint ixInd
Definition: pprint.h:58
int attrStringStart
Definition: pprint.h:45
TidyAllocator * allocator
Definition: pprint.h:50
uint wraphere
Definition: pprint.h:55
uint linelen
Definition: pprint.h:54
uint lbufsize
Definition: pprint.h:53
int attrValStart
Definition: pprint.h:44
uint line
Definition: pprint.h:56
Definition: pprint.h:42
Definition: pprint.h:49
unsigned int uint
Definition: tidyplatform.h:569