cheri 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README +98 -0
  3. data/Rakefile +121 -0
  4. data/examples/hello_world_1.rb +28 -0
  5. data/examples/table_1.rb +44 -0
  6. data/lib/cheri/awt.rb +41 -0
  7. data/lib/cheri/builder.rb +31 -0
  8. data/lib/cheri/builder/awt/connecter.rb +63 -0
  9. data/lib/cheri/builder/awt/constants.rb +1003 -0
  10. data/lib/cheri/builder/awt/main.rb +191 -0
  11. data/lib/cheri/builder/awt/types.rb +220 -0
  12. data/lib/cheri/builder/base.rb +533 -0
  13. data/lib/cheri/builder/config.rb +187 -0
  14. data/lib/cheri/builder/connecter.rb +386 -0
  15. data/lib/cheri/builder/context.rb +655 -0
  16. data/lib/cheri/builder/generator.rb +425 -0
  17. data/lib/cheri/builder/html/charsets.rb +154 -0
  18. data/lib/cheri/builder/html/common.rb +32 -0
  19. data/lib/cheri/builder/html/connecter.rb +57 -0
  20. data/lib/cheri/builder/html/element.rb +156 -0
  21. data/lib/cheri/builder/html/main.rb +116 -0
  22. data/lib/cheri/builder/html/types.rb +123 -0
  23. data/lib/cheri/builder/main.rb +483 -0
  24. data/lib/cheri/builder/swing/connecter.rb +141 -0
  25. data/lib/cheri/builder/swing/constants.rb +420 -0
  26. data/lib/cheri/builder/swing/main.rb +446 -0
  27. data/lib/cheri/builder/swing/types.rb +270 -0
  28. data/lib/cheri/builder/xml/charsets.rb +154 -0
  29. data/lib/cheri/builder/xml/common.rb +32 -0
  30. data/lib/cheri/builder/xml/connecter.rb +42 -0
  31. data/lib/cheri/builder/xml/element.rb +189 -0
  32. data/lib/cheri/builder/xml/main.rb +130 -0
  33. data/lib/cheri/builder/xml/types.rb +36 -0
  34. data/lib/cheri/cheri.rb +70 -0
  35. data/lib/cheri/cjx.rb +3 -0
  36. data/lib/cheri/explorer.rb +32 -0
  37. data/lib/cheri/explorer/explorer.rb +560 -0
  38. data/lib/cheri/html.rb +31 -0
  39. data/lib/cheri/image/Delete24.gif +0 -0
  40. data/lib/cheri/image/Find24.gif +0 -0
  41. data/lib/cheri/image/FindAgain24.gif +0 -0
  42. data/lib/cheri/image/Refresh24.gif +0 -0
  43. data/lib/cheri/image/Search24.gif +0 -0
  44. data/lib/cheri/image/Thumbs.db +0 -0
  45. data/lib/cheri/image/cheri_icon_16x16.png +0 -0
  46. data/lib/cheri/image/cheri_icon_24x24.png +0 -0
  47. data/lib/cheri/image/cheri_logo_medium.png +0 -0
  48. data/lib/cheri/image/close_10x10.png +0 -0
  49. data/lib/cheri/image/close_10x10s.png +0 -0
  50. data/lib/cheri/image/close_12x12.png +0 -0
  51. data/lib/cheri/image/close_14x14.png +0 -0
  52. data/lib/cheri/image/close_24x24.png +0 -0
  53. data/lib/cheri/image/close_dim2_12x12.png +0 -0
  54. data/lib/cheri/image/close_dim_12x12.png +0 -0
  55. data/lib/cheri/image/cls_tree.png +0 -0
  56. data/lib/cheri/image/con_tree.png +0 -0
  57. data/lib/cheri/image/jruby_14x16.png +0 -0
  58. data/lib/cheri/image/jruby_logo.png +0 -0
  59. data/lib/cheri/image/mod_tree.png +0 -0
  60. data/lib/cheri/image/obj_tree.png +0 -0
  61. data/lib/cheri/image/ruby_16x16.png +0 -0
  62. data/lib/cheri/image/vars_tree.png +0 -0
  63. data/lib/cheri/java.rb +26 -0
  64. data/lib/cheri/java/builder.rb +28 -0
  65. data/lib/cheri/java/builder/main.rb +407 -0
  66. data/lib/cheri/java/builder/util.rb +480 -0
  67. data/lib/cheri/java/java.rb +56 -0
  68. data/lib/cheri/jruby.rb +32 -0
  69. data/lib/cheri/jruby/explorer.rb +43 -0
  70. data/lib/cheri/jruby/explorer/common.rb +38 -0
  71. data/lib/cheri/jruby/explorer/dialogs.rb +383 -0
  72. data/lib/cheri/jruby/explorer/explorer.rb +904 -0
  73. data/lib/cheri/jruby/explorer/splash.rb +80 -0
  74. data/lib/cheri/jruby/explorer/viewer.rb +619 -0
  75. data/lib/cheri/jruby/explorer/viewers.rb +1057 -0
  76. data/lib/cheri/jruby/jruby.rb +59 -0
  77. data/lib/cheri/swing.rb +41 -0
  78. data/lib/cheri/xml.rb +31 -0
  79. metadata +135 -0
@@ -0,0 +1,154 @@
1
+ #--
2
+ # Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ #
24
+
25
+ module Cheri
26
+ module Xml
27
+ module Charsets
28
+ SPECIAL = /[\000-\010\013\014\016-\037\046\074\076\200-\377]/
29
+ HIBYTES = /[\200-\377]/
30
+ class << self
31
+ def special?(str)
32
+ str =~ SPECIAL
33
+ end
34
+ # Returns a Charset if +str+ requires translation, else +nil+
35
+ def charset(str)
36
+ return nil unless str =~ SPECIAL
37
+ if str =~ HIBYTES
38
+ Utf8.detect?(str) ? Utf8 : Win1252
39
+ else
40
+ Iso8859
41
+ end
42
+ end
43
+ end #self
44
+ module Charset
45
+ def xlat(i,o)
46
+ m = @map
47
+ i.each_byte do |b| o << m[b]; end
48
+ end
49
+ def map
50
+ @map
51
+ end
52
+ end
53
+
54
+ module Win1252
55
+ extend Charset
56
+ @map = Array.new(256)
57
+ map = @map
58
+ 0.upto(31) do |i| map[i] = 32; end
59
+ map[9] = ?\t
60
+ map[10] = ?\n
61
+ map[13] = ?\r
62
+ 32.upto(127) do |i| map[i] = i; end
63
+ map[38] = '&amp;'
64
+ map[60] = '&lt;'
65
+ map[62] = '&gt;'
66
+ # windows-1252 mappings
67
+ map[128] = '&#x20AC;'
68
+ map[129] = '?' #undefined
69
+ map[130] = '&#x201A;'
70
+ map[131] = '&#x192;'
71
+ map[132] = '&#x201E;'
72
+ map[133] = '&#x2026;'
73
+ map[134] = '&#x2020;'
74
+ map[135] = '&#x2021;'
75
+ map[136] = '&#x2C6;'
76
+ map[137] = '&#x2030;'
77
+ map[138] = '&#x160;'
78
+ map[139] = '&#x2039;'
79
+ map[140] = '&#x152;'
80
+ map[141] = '?' #undefined
81
+ map[142] = '&#x17D;'
82
+ map[143] = '?' #undefined
83
+ map[144] = '?' #undefined
84
+ map[145] = '&#x2018;'
85
+ map[146] = '&#x2019;'
86
+ map[147] = '&#x201C;'
87
+ map[148] = '&#x201D;'
88
+ map[149] = '&#x2022;'
89
+ map[150] = '&#x2013;'
90
+ map[151] = '&#x2014;'
91
+ map[152] = '&#x2DC;'
92
+ map[153] = '&#x2122;'
93
+ map[154] = '&#x161;'
94
+ map[155] = '&#x203A;'
95
+ map[156] = '&#x153;'
96
+ map[157] = '?' #undefined
97
+ map[158] = '&#x17E;'
98
+ map[159] = '&#x178;'
99
+ # 160-255 same for windows-1252 & ISO 8859-1 (Latin-1)
100
+ 160.upto(255) do |i| map[i] = "&##{i};"; end
101
+ end
102
+
103
+ module Iso8859
104
+ extend Charset
105
+ # using same map for windows-1252 & ISO 8859-1, since the
106
+ # only detectable difference is use of 0x80-0x9f
107
+ @map = Win1252.map
108
+ end
109
+
110
+ module Utf8
111
+ extend Charset
112
+
113
+ # TODO: not quite correct for EO, F0, F4 ?
114
+ def self.detect?(str)
115
+ d = @detect
116
+ ct = 0
117
+ begin
118
+ str.each_byte do |b|
119
+ if b < 128
120
+ return false if ct > 0
121
+ elsif b < 192
122
+ return false if (ct -= 1) < 0
123
+ else
124
+ return false unless ct == 0
125
+ ct += d[b]
126
+ end
127
+ end #each_byte
128
+ ct == 0
129
+ rescue
130
+ false
131
+ end
132
+ end
133
+
134
+ @map = Array.new(256)
135
+ map = @map
136
+ 0.upto(31) do |i| map[i] = 32; end
137
+ map[9] = ?\t
138
+ map[10] = ?\n
139
+ map[13] = ?\r
140
+ 32.upto(255) do |i| map[i] = i; end
141
+ map[38] = '&amp;'
142
+ map[60] = '&lt;'
143
+ map[62] = '&gt;'
144
+
145
+ @detect = Array.new(256)
146
+ det = @detect
147
+ 0x80.upto(0xBF) do |i| det[i] = -1; end
148
+ 0xC2.upto(0xDF) do |i| det[i] = 1; end
149
+ 0xE0.upto(0xEF) do |i| det[i] = 2; end
150
+ 0xF0.upto(0xF4) do |i| det[i] = 3; end
151
+ end
152
+ end #Charsets
153
+ end #Xml
154
+ end #Cheri
@@ -0,0 +1,32 @@
1
+ #--
2
+ # Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ #
24
+
25
+
26
+ module Cheri
27
+ module Xml
28
+ VERSION = Cheri::VERSION
29
+ class XmlException < Cheri::CheriException; end
30
+ class BuilderException < Cheri::Builder::BuilderException; end
31
+ end #Xml
32
+ end #Cheri
@@ -0,0 +1,42 @@
1
+ #--
2
+ # Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ #
24
+
25
+ module Cheri
26
+ module Xml
27
+
28
+ XmlConnecter = Cheri::Builder::TypeConnecter.new do
29
+
30
+ type XmlElement do
31
+ connect XmlElement
32
+ connect Cheri::Builder::Content
33
+ end
34
+
35
+ type XmlRoot do
36
+ connect XmlElement
37
+ end
38
+
39
+ end #XmlConnecter
40
+
41
+ end #Xml
42
+ end #Cheri
@@ -0,0 +1,189 @@
1
+ #--
2
+ # Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ #
24
+
25
+
26
+ module Cheri
27
+ module Xml
28
+
29
+ # Marker 'interface' used by connecters.
30
+ module XmlElement
31
+ end #XmlElement
32
+
33
+ # Included by all Cheri::Xml builders
34
+ module XmlBuilder
35
+ CE = ' />'.freeze #:nodoc:
36
+
37
+ def empty_s(str='')
38
+ str << CE
39
+ end
40
+
41
+ def empty_io(ios)
42
+ ios << CE
43
+ end
44
+
45
+ def esc(inp,out=nil)
46
+ if @ctx[:xml_esc] && (cs = Charsets.charset(inp))
47
+ cs.xlat(inp,(out ||= ''))
48
+ out
49
+ elsif out
50
+ out << inp
51
+ else
52
+ inp
53
+ end
54
+ end
55
+ end #XmlBuilder
56
+
57
+ class Elem
58
+ include Cheri::Builder::MarkupBuilder
59
+ include XmlBuilder
60
+ include XmlElement
61
+
62
+ def mod
63
+ Cheri::Xml
64
+ end
65
+ end
66
+
67
+ class EmptyElem
68
+ include Cheri::Builder::EmptyMarkupBuilder
69
+ include XmlBuilder
70
+ include XmlElement
71
+
72
+ def mod
73
+ Cheri::Xml
74
+ end
75
+
76
+ def content?(value)
77
+ raise XmlException,"content not allowed for empty element #{@sym}: #{value}"
78
+ end
79
+ end
80
+
81
+
82
+ class TextElem
83
+ include Cheri::Builder::Builder
84
+ include Cheri::Builder::Content
85
+ include Cheri::Builder::ContentArgs
86
+ include XmlBuilder
87
+
88
+ def mod
89
+ Cheri::Xml
90
+ end
91
+
92
+ def object
93
+ self
94
+ end
95
+
96
+ def run
97
+ value = @ctx.call(self,&@blk) if @blk
98
+ add(value) if String === value
99
+ #add(value) if value && !(Appendable === value || BaseProxy === value)
100
+ self
101
+ end
102
+
103
+ # Appends content to +str+, or to an empty string if +str+ is omitted.
104
+ # Returns the result.
105
+ def to_s(str='')
106
+ @cont.each do |c|
107
+ if String === c
108
+ esc(c,str)
109
+ else
110
+ esc(c.to_s,str)
111
+ end
112
+ end if @cont
113
+ str
114
+ end
115
+
116
+ # Appends content to +ios+. Returns the result.
117
+ def to_io(ios)
118
+ @cont.each do |c|
119
+ if String === c
120
+ ios << esc(c)
121
+ else
122
+ ios << esc(c.to_s)
123
+ end
124
+ end if @cont
125
+ ios
126
+ end
127
+
128
+ end
129
+
130
+ class EscElem < TextElem
131
+
132
+ def esc(inp,out=nil)
133
+ if (cs = Charsets.charset(inp))
134
+ cs.xlat(inp,(out ||= ''))
135
+ out
136
+ elsif out
137
+ out << inp
138
+ else
139
+ inp
140
+ end
141
+ end
142
+
143
+ end
144
+
145
+ # TODO: special handling for these:
146
+
147
+ class XmlRoot
148
+ XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".freeze #:nodoc:
149
+ include Cheri::Builder::Builder
150
+ include Cheri::Builder::Content
151
+ include Cheri::Builder::ContentArgs
152
+ include XmlBuilder
153
+
154
+ def mod
155
+ Cheri::Xml
156
+ end
157
+
158
+ def object
159
+ self
160
+ end
161
+
162
+ def run
163
+ @ctx.call(self,&@blk) if @blk
164
+ self
165
+ end
166
+
167
+ # Appends content to +str+ (or new String if +str+ is omitted). Returns the result.
168
+ def to_s(str='')
169
+ return to_io(str) unless String === str
170
+ str << XML
171
+ cont_s(str)
172
+ str
173
+ end
174
+
175
+ # Appends content to +ios+. Returns the result.
176
+ def to_io(ios)
177
+ ios << XML
178
+ cont_io(ios)
179
+ ios
180
+ end
181
+
182
+ end
183
+
184
+
185
+ class ProcElem < Elem
186
+ end
187
+
188
+ end #Xml
189
+ end #Cheri
@@ -0,0 +1,130 @@
1
+ #--
2
+ # Copyright (C) 2007 William N Dortch <bill.dortch@gmail.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ #
24
+
25
+
26
+ module Cheri
27
+ module Xml
28
+
29
+ include Cheri::Builder
30
+
31
+ class << self
32
+ def append_features(clazz)
33
+ Cheri::Builder.module_included(self,clazz)
34
+ super
35
+ end
36
+ private :append_features
37
+
38
+ def factory
39
+ XmlFactory
40
+ end
41
+
42
+ def connecter
43
+ XmlConnecter
44
+ end
45
+
46
+ end #self
47
+
48
+ # Instance methods
49
+
50
+ # call-seq:
51
+ # xml([*args] [, &block]) -> XmlProxy if no block given, else result of block
52
+ #
53
+ def xml(*r,&k)
54
+ if (ctx = __cheri_ctx)
55
+ if k
56
+ if ctx.tos(XmlBuilder)
57
+ XmlFrame.new(ctx,*r,&k).run
58
+ else
59
+ ctx.msend(Cheri::Xml,:xml,*r,&k)
60
+ end
61
+ else
62
+ ctx[:xml_proxy] ||= XmlProxy.new(ctx,*r)
63
+ end
64
+ end
65
+ end
66
+ private :xml
67
+
68
+
69
+ module XmlFactory
70
+ def self.builder(ctx,sym,*r,&k)
71
+ if (clazz = Types[sym])
72
+ clazz.new(ctx,sym,*r,&k)
73
+ elsif ctx[:xml_any] || ((acc = ctx[:xml_accept]) && acc[sym])
74
+ Elem.new(ctx,sym,*r,&k)
75
+ else
76
+ nil
77
+ end
78
+ end
79
+ end #XmlFactory
80
+
81
+ class XmlProxy < Cheri::Builder::BaseProxy
82
+
83
+ impl(Types.keys)
84
+
85
+ def mod
86
+ Cheri::Xml
87
+ end
88
+ private :mod
89
+
90
+ def [](opts)
91
+ if Symbol === opts
92
+ case opts
93
+ when :any : @ctx[:xml_any] = true
94
+ when :esc : @ctx[:xml_esc] = true
95
+ else raise ArgumentError,"invalid simple xml option: :#{opts}"
96
+ end
97
+ elsif Hash === opts
98
+ @ctx[:xml_any] = opts[:any] != false if opts[:any] != nil
99
+ @ctx[:xml_esc] = opts[:esc] != false if opts[:esc] != nil
100
+ if (accept = opts[:accept])
101
+ raise Cheri.type_error(accept,Array) unless Array === accept
102
+ acc = {}
103
+ accept.each do |a|
104
+ raise Cheri.type_error(a,Symbol) unless Symbol === a
105
+ acc[a] = true
106
+ end
107
+ @ctx[:xml_accept] = acc
108
+ @ctx[:xml_any] = nil
109
+ end
110
+ else
111
+ raise Cheri.type_error(opts,Hash,Symbol)
112
+ end
113
+ nil
114
+ end
115
+
116
+ end #XmlProxy
117
+
118
+ class XmlFrame
119
+ include Cheri::Builder::Frame
120
+ def initialize(ctx,*r,&k)
121
+ super
122
+ @obj = ctx[:xml_proxy] ||= XmlProxy.new(ctx,*r)
123
+ end
124
+ def mod
125
+ Cheri::Xml
126
+ end
127
+ end #XmlFrame
128
+
129
+ end #Xml
130
+ end #Cheri