tidy-ext 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. data/.gitignore +4 -0
  2. data/LICENSE +50 -0
  3. data/README +12 -0
  4. data/Rakefile +60 -0
  5. data/VERSION +1 -0
  6. data/ext/tidy/access.c +3310 -0
  7. data/ext/tidy/access.h +279 -0
  8. data/ext/tidy/alloc.c +107 -0
  9. data/ext/tidy/attrask.c +209 -0
  10. data/ext/tidy/attrdict.c +2398 -0
  11. data/ext/tidy/attrdict.h +122 -0
  12. data/ext/tidy/attrget.c +213 -0
  13. data/ext/tidy/attrs.c +1911 -0
  14. data/ext/tidy/attrs.h +374 -0
  15. data/ext/tidy/buffio.c +232 -0
  16. data/ext/tidy/buffio.h +118 -0
  17. data/ext/tidy/charsets.c +1032 -0
  18. data/ext/tidy/charsets.h +14 -0
  19. data/ext/tidy/clean.c +2674 -0
  20. data/ext/tidy/clean.h +87 -0
  21. data/ext/tidy/config.c +1746 -0
  22. data/ext/tidy/config.h +153 -0
  23. data/ext/tidy/entities.c +419 -0
  24. data/ext/tidy/entities.h +24 -0
  25. data/ext/tidy/extconf.rb +5 -0
  26. data/ext/tidy/fileio.c +106 -0
  27. data/ext/tidy/fileio.h +46 -0
  28. data/ext/tidy/forward.h +69 -0
  29. data/ext/tidy/iconvtc.c +105 -0
  30. data/ext/tidy/iconvtc.h +15 -0
  31. data/ext/tidy/istack.c +373 -0
  32. data/ext/tidy/lexer.c +3825 -0
  33. data/ext/tidy/lexer.h +617 -0
  34. data/ext/tidy/localize.c +1882 -0
  35. data/ext/tidy/mappedio.c +329 -0
  36. data/ext/tidy/mappedio.h +16 -0
  37. data/ext/tidy/message.h +207 -0
  38. data/ext/tidy/parser.c +4408 -0
  39. data/ext/tidy/parser.h +76 -0
  40. data/ext/tidy/platform.h +636 -0
  41. data/ext/tidy/pprint.c +2276 -0
  42. data/ext/tidy/pprint.h +93 -0
  43. data/ext/tidy/ruby-tidy.c +195 -0
  44. data/ext/tidy/streamio.c +1407 -0
  45. data/ext/tidy/streamio.h +222 -0
  46. data/ext/tidy/tagask.c +286 -0
  47. data/ext/tidy/tags.c +955 -0
  48. data/ext/tidy/tags.h +235 -0
  49. data/ext/tidy/tidy-int.h +129 -0
  50. data/ext/tidy/tidy.h +1097 -0
  51. data/ext/tidy/tidyenum.h +622 -0
  52. data/ext/tidy/tidylib.c +1751 -0
  53. data/ext/tidy/tmbstr.c +306 -0
  54. data/ext/tidy/tmbstr.h +92 -0
  55. data/ext/tidy/utf8.c +539 -0
  56. data/ext/tidy/utf8.h +52 -0
  57. data/ext/tidy/version.h +14 -0
  58. data/ext/tidy/win32tc.c +795 -0
  59. data/ext/tidy/win32tc.h +19 -0
  60. data/spec/spec_helper.rb +5 -0
  61. data/spec/tidy/compat_spec.rb +44 -0
  62. data/spec/tidy/remote_uri_spec.rb +14 -0
  63. data/spec/tidy/test1.html +5 -0
  64. data/spec/tidy/tidy_spec.rb +34 -0
  65. metadata +125 -0
data/ext/tidy/buffio.h ADDED
@@ -0,0 +1,118 @@
1
+ #ifndef __TIDY_BUFFIO_H__
2
+ #define __TIDY_BUFFIO_H__
3
+
4
+ /** @file buffio.h - Treat buffer as an I/O stream.
5
+
6
+ (c) 1998-2007 (W3C) MIT, ERCIM, Keio University
7
+ See tidy.h for the copyright notice.
8
+
9
+ CVS Info :
10
+
11
+ $Author: arnaud02 $
12
+ $Date: 2007/01/23 11:17:45 $
13
+ $Revision: 1.9 $
14
+
15
+ Requires buffer to automatically grow as bytes are added.
16
+ Must keep track of current read and write points.
17
+
18
+ */
19
+
20
+ #include "platform.h"
21
+ #include "tidy.h"
22
+
23
+ #ifdef __cplusplus
24
+ extern "C" {
25
+ #endif
26
+
27
+ /** TidyBuffer - A chunk of memory */
28
+ TIDY_STRUCT
29
+ struct _TidyBuffer
30
+ {
31
+ TidyAllocator* allocator; /**< Memory allocator */
32
+ byte* bp; /**< Pointer to bytes */
33
+ uint size; /**< # bytes currently in use */
34
+ uint allocated; /**< # bytes allocated */
35
+ uint next; /**< Offset of current input position */
36
+ };
37
+
38
+ /** Initialize data structure using the default allocator */
39
+ TIDY_EXPORT void TIDY_CALL tidyBufInit( TidyBuffer* buf );
40
+
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 */
46
+ TIDY_EXPORT void TIDY_CALL tidyBufAlloc( TidyBuffer* buf, uint allocSize );
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
+
54
+ /** Expand buffer to given size.
55
+ ** Chunk size is minimum growth. Pass 0 for default of 256 bytes.
56
+ */
57
+ TIDY_EXPORT void TIDY_CALL tidyBufCheckAlloc( TidyBuffer* buf,
58
+ uint allocSize, uint chunkSize );
59
+
60
+ /** Free current contents and zero out */
61
+ TIDY_EXPORT void TIDY_CALL tidyBufFree( TidyBuffer* buf );
62
+
63
+ /** Set buffer bytes to 0 */
64
+ TIDY_EXPORT void TIDY_CALL tidyBufClear( TidyBuffer* buf );
65
+
66
+ /** Attach to existing buffer */
67
+ TIDY_EXPORT void TIDY_CALL tidyBufAttach( TidyBuffer* buf, byte* bp, uint size );
68
+
69
+ /** Detach from buffer. Caller must free. */
70
+ TIDY_EXPORT void TIDY_CALL tidyBufDetach( TidyBuffer* buf );
71
+
72
+
73
+ /** Append bytes to buffer. Expand if necessary. */
74
+ TIDY_EXPORT void TIDY_CALL tidyBufAppend( TidyBuffer* buf, void* vp, uint size );
75
+
76
+ /** Append one byte to buffer. Expand if necessary. */
77
+ TIDY_EXPORT void TIDY_CALL tidyBufPutByte( TidyBuffer* buf, byte bv );
78
+
79
+ /** Get byte from end of buffer */
80
+ TIDY_EXPORT int TIDY_CALL tidyBufPopByte( TidyBuffer* buf );
81
+
82
+
83
+ /** Get byte from front of buffer. Increment input offset. */
84
+ TIDY_EXPORT int TIDY_CALL tidyBufGetByte( TidyBuffer* buf );
85
+
86
+ /** At end of buffer? */
87
+ TIDY_EXPORT Bool TIDY_CALL tidyBufEndOfInput( TidyBuffer* buf );
88
+
89
+ /** Put a byte back into the buffer. Decrement input offset. */
90
+ TIDY_EXPORT void TIDY_CALL tidyBufUngetByte( TidyBuffer* buf, byte bv );
91
+
92
+
93
+ /**************
94
+ TIDY
95
+ **************/
96
+
97
+ /* Forward declarations
98
+ */
99
+
100
+ /** Initialize a buffer input source */
101
+ TIDY_EXPORT void TIDY_CALL tidyInitInputBuffer( TidyInputSource* inp, TidyBuffer* buf );
102
+
103
+ /** Initialize a buffer output sink */
104
+ TIDY_EXPORT void TIDY_CALL tidyInitOutputBuffer( TidyOutputSink* outp, TidyBuffer* buf );
105
+
106
+ #ifdef __cplusplus
107
+ }
108
+ #endif
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
+ */