~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

TidyLib
tidy/src/pprint.h

Version: ~ [ 1.0 ] ~

  1 #ifndef __PPRINT_H__
  2 #define __PPRINT_H__
  3 
  4 /* pprint.h -- pretty print parse tree  
  5   
  6    (c) 1998-2003 (W3C) MIT, ERCIM, Keio University
  7    See tidy.h for the copyright notice.
  8   
  9    CVS Info:
 10      $Author: hoehrmann $ 
 11      $Date: 2003/05/24 15:55:02 $ 
 12      $Revision: 1.4 $ 
 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        0
 30 #define PREFORMATTED  1
 31 #define COMMENT       2
 32 #define ATTRIBVALUE   4
 33 #define NOWRAP        8
 34 #define CDATA         16
 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 
 46 typedef struct _TidyIndent
 47 {
 48     int spaces;
 49     int attrValStart;
 50     int attrStringStart;
 51 } TidyIndent;
 52 
 53 typedef 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 void PPrintDocument( TidyDocImpl* doc );
 67 
 68 
 69 #if SUPPORT_ASIAN_ENCODINGS
 70 /* #431953 - start RJ Wraplen adjusted for smooth international ride */
 71 uint CWrapLen( TidyDocImpl* doc, uint ind );
 72 #endif
 73 
 74 void InitPrintBuf( TidyDocImpl* doc );
 75 void FreePrintBuf( TidyDocImpl* doc );
 76 
 77 void PFlushLine( TidyDocImpl* doc, uint indent );
 78 void PCondFlushLine( TidyDocImpl* doc, uint indent );
 79 
 80 void PPrintScriptStyle( TidyDocImpl* doc, uint mode, uint indent, Node* node );
 81 
 82 /* print just the content of the body element.
 83 ** useful when you want to reuse material from
 84 ** other documents.
 85 ** 
 86 ** -- Sebastiano Vigna <vigna@dsi.unimi.it>
 87 */
 88 
 89 void PrintPreamble( TidyDocImpl* doc );   /* Between these 3, */
 90 void PrintBody( TidyDocImpl* doc );       /* you can print an entire document */
 91 void PrintPostamble( TidyDocImpl* doc );  /* or you can substitute another */
 92                                           /* node as body using PPrintTree() */
 93 
 94 void PPrintTree( TidyDocImpl* doc, uint mode, uint indent, Node *node );
 95 
 96 void PPrintXMLTree( TidyDocImpl* doc, uint mode, uint indent, Node *node );
 97 
 98 
 99 #endif /* __PPRINT_H__ */
100 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.