ox 1.9.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ox might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/README.md +21 -17
- data/ext/ox/cache.c +1 -2
- data/ext/ox/dump.c +11 -11
- data/ext/ox/extconf.rb +4 -2
- data/ext/ox/obj_load.c +1 -10
- data/ext/ox/ox.c +26 -11
- data/ext/ox/ox.h +1 -2
- data/ext/ox/sax.c +713 -1087
- data/ext/ox/sax.h +116 -0
- data/ext/ox/sax_as.c +254 -0
- data/ext/ox/sax_buf.c +262 -0
- data/ext/ox/sax_buf.h +198 -0
- data/ext/ox/sax_has.h +85 -0
- data/ext/ox/sax_hint.c +217 -0
- data/ext/ox/sax_hint.h +50 -0
- data/ext/ox/sax_stack.h +108 -0
- data/lib/ox/version.rb +1 -1
- metadata +19 -14
data/ext/ox/sax_hint.h
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
/* hint.h
|
2
|
+
* Copyright (c) 2011, Peter Ohler
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
7
|
+
*
|
8
|
+
* - Redistributions of source code must retain the above copyright notice, this
|
9
|
+
* list of conditions and the following disclaimer.
|
10
|
+
*
|
11
|
+
* - Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
* this list of conditions and the following disclaimer in the documentation
|
13
|
+
* and/or other materials provided with the distribution.
|
14
|
+
*
|
15
|
+
* - Neither the name of Peter Ohler nor the names of its contributors may be
|
16
|
+
* used to endorse or promote products derived from this software without
|
17
|
+
* specific prior written permission.
|
18
|
+
*
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
23
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
*/
|
30
|
+
|
31
|
+
#ifndef __OX_HINT_H__
|
32
|
+
#define __OX_HINT_H__
|
33
|
+
|
34
|
+
typedef struct _Hint {
|
35
|
+
const char *name;
|
36
|
+
char empty; // must be closed or close auto it, not error
|
37
|
+
char nest; // nesting allowed
|
38
|
+
const char **parents;
|
39
|
+
} *Hint;
|
40
|
+
|
41
|
+
typedef struct _Hints {
|
42
|
+
const char *name;
|
43
|
+
Hint hints; // array of hints
|
44
|
+
int size;
|
45
|
+
} *Hints;
|
46
|
+
|
47
|
+
extern Hints ox_hints_html(void);
|
48
|
+
extern Hint ox_hint_find(Hints hints, const char *name);
|
49
|
+
|
50
|
+
#endif /* __OX_HINT_H__ */
|
data/ext/ox/sax_stack.h
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
/* sax_stack.h
|
2
|
+
* Copyright (c) 2011, Peter Ohler
|
3
|
+
* All rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions are met:
|
7
|
+
*
|
8
|
+
* - Redistributions of source code must retain the above copyright notice, this
|
9
|
+
* list of conditions and the following disclaimer.
|
10
|
+
*
|
11
|
+
* - Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
* this list of conditions and the following disclaimer in the documentation
|
13
|
+
* and/or other materials provided with the distribution.
|
14
|
+
*
|
15
|
+
* - Neither the name of Peter Ohler nor the names of its contributors may be
|
16
|
+
* used to endorse or promote products derived from this software without
|
17
|
+
* specific prior written permission.
|
18
|
+
*
|
19
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
20
|
+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
21
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
22
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
23
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
24
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
25
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
26
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
27
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
*/
|
30
|
+
|
31
|
+
#ifndef __OX_SAX_STACK_H__
|
32
|
+
#define __OX_SAX_STACK_H__
|
33
|
+
|
34
|
+
#include "sax_hint.h"
|
35
|
+
|
36
|
+
#define STACK_INC 100
|
37
|
+
|
38
|
+
typedef struct _Nv {
|
39
|
+
const char *name;
|
40
|
+
VALUE val;
|
41
|
+
Hint hint;
|
42
|
+
} *Nv;
|
43
|
+
|
44
|
+
typedef struct _NStack {
|
45
|
+
struct _Nv base[STACK_INC];
|
46
|
+
Nv head; /* current stack */
|
47
|
+
Nv end; /* stack end */
|
48
|
+
Nv tail; /* pointer to one past last element name on stack */
|
49
|
+
} *NStack;
|
50
|
+
|
51
|
+
inline static void
|
52
|
+
stack_init(NStack stack) {
|
53
|
+
stack->head = stack->base;
|
54
|
+
stack->end = stack->base + sizeof(stack->base) / sizeof(struct _Nv);
|
55
|
+
stack->tail = stack->head;
|
56
|
+
}
|
57
|
+
|
58
|
+
inline static int
|
59
|
+
stack_empty(NStack stack) {
|
60
|
+
return (stack->head == stack->base);
|
61
|
+
}
|
62
|
+
|
63
|
+
inline static void
|
64
|
+
stack_cleanup(NStack stack) {
|
65
|
+
if (stack->base != stack->head) {
|
66
|
+
xfree(stack->head);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
inline static void
|
71
|
+
stack_push(NStack stack, const char *name, VALUE val, Hint hint) {
|
72
|
+
if (stack->end <= stack->tail) {
|
73
|
+
size_t len = stack->end - stack->head;
|
74
|
+
size_t toff = stack->tail - stack->head;
|
75
|
+
|
76
|
+
if (stack->base == stack->head) {
|
77
|
+
stack->head = ALLOC_N(struct _Nv, len + STACK_INC);
|
78
|
+
memcpy(stack->head, stack->base, sizeof(struct _Nv) * len);
|
79
|
+
} else {
|
80
|
+
stack->head = REALLOC_N(stack->head, struct _Nv, len + STACK_INC);
|
81
|
+
}
|
82
|
+
stack->tail = stack->head + toff;
|
83
|
+
stack->end = stack->head + len + STACK_INC;
|
84
|
+
}
|
85
|
+
stack->tail->name = name;
|
86
|
+
stack->tail->val = val;
|
87
|
+
stack->tail->hint = hint;
|
88
|
+
stack->tail++;
|
89
|
+
}
|
90
|
+
|
91
|
+
inline static Nv
|
92
|
+
stack_peek(NStack stack) {
|
93
|
+
if (stack->head < stack->tail) {
|
94
|
+
return stack->tail - 1;
|
95
|
+
}
|
96
|
+
return 0;
|
97
|
+
}
|
98
|
+
|
99
|
+
inline static Nv
|
100
|
+
stack_pop(NStack stack) {
|
101
|
+
if (stack->head < stack->tail) {
|
102
|
+
stack->tail--;
|
103
|
+
return stack->tail;
|
104
|
+
}
|
105
|
+
return 0;
|
106
|
+
}
|
107
|
+
|
108
|
+
#endif /* __OX_SAX_STACK_H__ */
|
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Peter Ohler
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
for Object\nserialization. "
|
13
|
+
description: "A fast XML parser and object serializer that uses only standard C lib.\n
|
14
|
+
\ \nOptimized XML (Ox), as the name implies was written to provide speed
|
15
|
+
optimized\nXML handling. It was designed to be an alternative to Nokogiri and other
|
16
|
+
Ruby\nXML parsers for generic XML parsing and as an alternative to Marshal for Object\nserialization. "
|
19
17
|
email: peter@ohler.com
|
20
18
|
executables: []
|
21
19
|
extensions:
|
@@ -41,6 +39,11 @@ files:
|
|
41
39
|
- ext/ox/cache.h
|
42
40
|
- ext/ox/cache8.h
|
43
41
|
- ext/ox/ox.h
|
42
|
+
- ext/ox/sax.h
|
43
|
+
- ext/ox/sax_buf.h
|
44
|
+
- ext/ox/sax_has.h
|
45
|
+
- ext/ox/sax_hint.h
|
46
|
+
- ext/ox/sax_stack.h
|
44
47
|
- ext/ox/base64.c
|
45
48
|
- ext/ox/cache.c
|
46
49
|
- ext/ox/cache8.c
|
@@ -52,10 +55,14 @@ files:
|
|
52
55
|
- ext/ox/ox.c
|
53
56
|
- ext/ox/parse.c
|
54
57
|
- ext/ox/sax.c
|
58
|
+
- ext/ox/sax_as.c
|
59
|
+
- ext/ox/sax_buf.c
|
60
|
+
- ext/ox/sax_hint.c
|
55
61
|
- LICENSE
|
56
62
|
- README.md
|
57
63
|
homepage: http://www.ohler.com/ox
|
58
64
|
licenses: []
|
65
|
+
metadata: {}
|
59
66
|
post_install_message:
|
60
67
|
rdoc_options:
|
61
68
|
- --main
|
@@ -64,22 +71,20 @@ require_paths:
|
|
64
71
|
- lib
|
65
72
|
- ext
|
66
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
74
|
requirements:
|
69
|
-
- -
|
75
|
+
- - '>='
|
70
76
|
- !ruby/object:Gem::Version
|
71
77
|
version: '0'
|
72
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- -
|
80
|
+
- - '>='
|
76
81
|
- !ruby/object:Gem::Version
|
77
82
|
version: '0'
|
78
83
|
requirements: []
|
79
84
|
rubyforge_project: ox
|
80
|
-
rubygems_version:
|
85
|
+
rubygems_version: 2.0.0
|
81
86
|
signing_key:
|
82
|
-
specification_version:
|
87
|
+
specification_version: 4
|
83
88
|
summary: A fast XML parser and object serializer.
|
84
89
|
test_files: []
|
85
90
|
has_rdoc: true
|