~ubuntu-branches/ubuntu/vivid/tidy/vivid-updates

« back to all changes in this revision

Viewing changes to include/buffio.h

  • Committer: Bazaar Package Importer
  • Author(s): Jason Thomas
  • Date: 2008-01-20 21:46:03 UTC
  • mfrom: (0.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080120214603-oqicq5jwr1exrm55
Tags: 20080116cvs-2
* debian/control: build depends on xsltproc
  (closes: #461608)
* debian/tidy.preinst,postinst: add code to move old config file
  (closes: #461623)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __BUFFIO_H__
2
 
#define __BUFFIO_H__
 
1
#ifndef __TIDY_BUFFIO_H__
 
2
#define __TIDY_BUFFIO_H__
3
3
 
4
4
/** @file buffio.h - Treat buffer as an I/O stream.
5
5
 
6
 
  (c) 1998-2005 (W3C) MIT, ERCIM, Keio University
 
6
  (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
7
7
  See tidy.h for the copyright notice.
8
8
 
9
9
  CVS Info :
10
10
 
11
11
    $Author: arnaud02 $ 
12
 
    $Date: 2005/04/08 09:11:12 $ 
13
 
    $Revision: 1.5 $ 
 
12
    $Date: 2007/01/23 11:17:45 $ 
 
13
    $Revision: 1.9 $ 
14
14
 
15
15
  Requires buffer to automatically grow as bytes are added.
16
16
  Must keep track of current read and write points.
28
28
TIDY_STRUCT
29
29
struct _TidyBuffer 
30
30
{
 
31
    TidyAllocator* allocator;  /**< Memory allocator */
31
32
    byte* bp;           /**< Pointer to bytes */
32
33
    uint  size;         /**< # bytes currently in use */
33
34
    uint  allocated;    /**< # bytes allocated */ 
34
35
    uint  next;         /**< Offset of current input position */
35
36
};
36
37
 
37
 
/** Zero out data structure */
 
38
/** Initialize data structure using the default allocator */
38
39
TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf );
39
40
 
40
 
/** Free current buffer, allocate given amount, reset input pointer */
 
41
/** Initialize data structure using the given custom allocator */
 
42
TIDY_EXPORT void TIDY_CALL tidyBufInitWithAllocator( TidyBuffer* buf, TidyAllocator* allocator );
 
43
 
 
44
/** Free current buffer, allocate given amount, reset input pointer,
 
45
    use the default allocator */
41
46
TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize );
42
47
 
 
48
/** Free current buffer, allocate given amount, reset input pointer,
 
49
    use the given custom allocator */
 
50
TIDY_EXPORT void TIDY_CALL tidyBufAllocWithAllocator( TidyBuffer* buf,
 
51
                                                      TidyAllocator* allocator,
 
52
                                                      uint allocSize );
 
53
 
43
54
/** Expand buffer to given size. 
44
55
**  Chunk size is minimum growth. Pass 0 for default of 256 bytes.
45
56
*/
46
57
TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf,
47
 
                                             uint allocSize, uint chunkSize );
 
58
                                              uint allocSize, uint chunkSize );
48
59
 
49
60
/** Free current contents and zero out */
50
61
TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf );
87
98
*/
88
99
 
89
100
/** Initialize a buffer input source */
90
 
TIDY_EXPORT void TIDY_CALL initInputBuffer( TidyInputSource* inp, TidyBuffer* buf );
 
101
TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf );
91
102
 
92
103
/** Initialize a buffer output sink */
93
 
TIDY_EXPORT void TIDY_CALL initOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf );
 
104
TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf );
94
105
 
95
106
#ifdef __cplusplus
96
107
}
97
108
#endif
98
 
#endif /* __BUFFIO_H__ */
 
109
#endif /* __TIDY_BUFFIO_H__ */
 
110
 
 
111
/*
 
112
 * local variables:
 
113
 * mode: c
 
114
 * indent-tabs-mode: nil
 
115
 * c-basic-offset: 4
 
116
 * eval: (c-set-offset 'substatement-open 0)
 
117
 * end:
 
118
 */