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