webtranslateit-hpricot 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/CHANGELOG +122 -0
- data/COPYING +18 -0
- data/README.md +295 -0
- data/Rakefile +237 -0
- data/ext/fast_xs/FastXsService.java +1123 -0
- data/ext/fast_xs/extconf.rb +4 -0
- data/ext/fast_xs/fast_xs.c +210 -0
- data/ext/hpricot_scan/HpricotCss.java +850 -0
- data/ext/hpricot_scan/HpricotScanService.java +2085 -0
- data/ext/hpricot_scan/MANIFEST +0 -0
- data/ext/hpricot_scan/extconf.rb +9 -0
- data/ext/hpricot_scan/hpricot_common.rl +76 -0
- data/ext/hpricot_scan/hpricot_css.c +3511 -0
- data/ext/hpricot_scan/hpricot_css.java.rl +155 -0
- data/ext/hpricot_scan/hpricot_css.rl +120 -0
- data/ext/hpricot_scan/hpricot_scan.c +6848 -0
- data/ext/hpricot_scan/hpricot_scan.h +79 -0
- data/ext/hpricot_scan/hpricot_scan.java.rl +1173 -0
- data/ext/hpricot_scan/hpricot_scan.rl +911 -0
- data/extras/hpricot.png +0 -0
- data/hpricot.gemspec +18 -0
- data/lib/hpricot/blankslate.rb +63 -0
- data/lib/hpricot/builder.rb +217 -0
- data/lib/hpricot/elements.rb +514 -0
- data/lib/hpricot/htmlinfo.rb +691 -0
- data/lib/hpricot/inspect.rb +103 -0
- data/lib/hpricot/modules.rb +40 -0
- data/lib/hpricot/parse.rb +38 -0
- data/lib/hpricot/tag.rb +219 -0
- data/lib/hpricot/tags.rb +164 -0
- data/lib/hpricot/traverse.rb +839 -0
- data/lib/hpricot/xchar.rb +95 -0
- data/lib/hpricot.rb +26 -0
- data/setup.rb +1585 -0
- data/test/files/basic.xhtml +17 -0
- data/test/files/boingboing.html +2266 -0
- data/test/files/cy0.html +3653 -0
- data/test/files/immob.html +400 -0
- data/test/files/pace_application.html +1320 -0
- data/test/files/tenderlove.html +16 -0
- data/test/files/uswebgen.html +220 -0
- data/test/files/utf8.html +1054 -0
- data/test/files/week9.html +1723 -0
- data/test/files/why.xml +19 -0
- data/test/load_files.rb +7 -0
- data/test/nokogiri-bench.rb +64 -0
- data/test/test_alter.rb +96 -0
- data/test/test_builder.rb +37 -0
- data/test/test_parser.rb +496 -0
- data/test/test_paths.rb +25 -0
- data/test/test_preserved.rb +88 -0
- data/test/test_xml.rb +28 -0
- metadata +106 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
/*
|
2
|
+
* hpricot_scan.h
|
3
|
+
*
|
4
|
+
* $Author: why $
|
5
|
+
* $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $
|
6
|
+
*
|
7
|
+
* Copyright (C) 2006 why the lucky stiff
|
8
|
+
* You can redistribute it and/or modify it under the same terms as Ruby.
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef hpricot_scan_h
|
12
|
+
#define hpricot_scan_h
|
13
|
+
|
14
|
+
#include <sys/types.h>
|
15
|
+
|
16
|
+
#if defined(_WIN32)
|
17
|
+
#include <stddef.h>
|
18
|
+
#endif
|
19
|
+
|
20
|
+
/*
|
21
|
+
* Memory Allocation
|
22
|
+
*/
|
23
|
+
#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
|
24
|
+
#include <alloca.h>
|
25
|
+
#endif
|
26
|
+
|
27
|
+
#ifndef NULL
|
28
|
+
# define NULL (void *)0
|
29
|
+
#endif
|
30
|
+
|
31
|
+
#define BUFSIZE 16384
|
32
|
+
|
33
|
+
#define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
|
34
|
+
#define S_ALLOC(type) (type*)malloc(sizeof(type))
|
35
|
+
#define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
|
36
|
+
#define S_FREE(n) free(n); n = NULL;
|
37
|
+
|
38
|
+
#define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
|
39
|
+
|
40
|
+
#define S_MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
|
41
|
+
#define S_MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
|
42
|
+
#define S_MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
|
43
|
+
#define S_MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
|
44
|
+
|
45
|
+
typedef struct {
|
46
|
+
void *name;
|
47
|
+
void *attributes;
|
48
|
+
} hpricot_element;
|
49
|
+
|
50
|
+
typedef void (*hpricot_element_cb)(void *data, hpricot_element *token);
|
51
|
+
|
52
|
+
typedef struct hpricot_scan {
|
53
|
+
int lineno;
|
54
|
+
int cs;
|
55
|
+
size_t nread;
|
56
|
+
size_t mark;
|
57
|
+
|
58
|
+
void *data;
|
59
|
+
|
60
|
+
hpricot_element_cb xmldecl;
|
61
|
+
hpricot_element_cb doctype;
|
62
|
+
hpricot_element_cb xmlprocins;
|
63
|
+
hpricot_element_cb starttag;
|
64
|
+
hpricot_element_cb endtag;
|
65
|
+
hpricot_element_cb emptytag;
|
66
|
+
hpricot_element_cb comment;
|
67
|
+
hpricot_element_cb cdata;
|
68
|
+
|
69
|
+
} http_scan;
|
70
|
+
|
71
|
+
// int hpricot_scan_init(hpricot_scan *scan);
|
72
|
+
// int hpricot_scan_finish(hpricot_scan *scan);
|
73
|
+
// size_t hpricot_scan_execute(hpricot_scan *scan, const char *data, size_t len, size_t off);
|
74
|
+
// int hpricot_scan_has_error(hpricot_scan *scan);
|
75
|
+
// int hpricot_scan_is_finished(hpricot_scan *scan);
|
76
|
+
//
|
77
|
+
// #define hpricot_scan_nread(scan) (scan)->nread
|
78
|
+
|
79
|
+
#endif
|