walters 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,43 @@
1
+ #ifndef WALTERS_H
2
+ #define WALTERS_H 1
3
+
4
+ #include <xni.h>
5
+
6
+ struct Walters_Buffer;
7
+ #ifdef __GNUC__
8
+ #pragma GCC visibility push(hidden)
9
+ #endif
10
+ XNI_EXPORT int walters_sizeof_buffer(void);
11
+ XNI_EXPORT void walters_buffer_finalize(RubyEnv *, struct Walters_Buffer *);
12
+ XNI_EXPORT void walters_buffer_initialize(RubyEnv *, struct Walters_Buffer *, unsigned int);
13
+ XNI_EXPORT const char * walters_buffer_cstring(RubyEnv *, struct Walters_Buffer *);
14
+ XNI_EXPORT bool walters_buffer_escape_html(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
15
+ XNI_EXPORT bool walters_buffer_escape_html0(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int, bool);
16
+ XNI_EXPORT bool walters_buffer_unescape_html(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
17
+ XNI_EXPORT bool walters_buffer_escape_xml(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
18
+ XNI_EXPORT bool walters_buffer_escape_uri(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
19
+ XNI_EXPORT bool walters_buffer_escape_url(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
20
+ XNI_EXPORT bool walters_buffer_escape_href(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
21
+ XNI_EXPORT bool walters_buffer_unescape_uri(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
22
+ XNI_EXPORT bool walters_buffer_unescape_url(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
23
+ XNI_EXPORT bool walters_buffer_escape_js(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
24
+ XNI_EXPORT bool walters_buffer_unescape_js(RubyEnv *, struct Walters_Buffer *, const char *, unsigned int);
25
+ XNI_EXPORT void walters_free_cstring(RubyEnv *, void *);
26
+ XNI_EXPORT const char * walters_read_cstring(RubyEnv *, void *);
27
+ XNI_EXPORT void * walters__escape_html(RubyEnv *, const char *, unsigned int, bool);
28
+ XNI_EXPORT void * walters__unescape_html(RubyEnv *, const char *, unsigned int);
29
+ XNI_EXPORT void * walters__escape_xml(RubyEnv *, const char *, unsigned int);
30
+ XNI_EXPORT void * walters__escape_uri(RubyEnv *, const char *, unsigned int);
31
+ XNI_EXPORT void * walters__escape_url(RubyEnv *, const char *, unsigned int);
32
+ XNI_EXPORT void * walters__escape_href(RubyEnv *, const char *, unsigned int);
33
+ XNI_EXPORT void * walters__unescape_uri(RubyEnv *, const char *, unsigned int);
34
+ XNI_EXPORT void * walters__unescape_url(RubyEnv *, const char *, unsigned int);
35
+ XNI_EXPORT void * walters__escape_js(RubyEnv *, const char *, unsigned int);
36
+ XNI_EXPORT void * walters__unescape_js(RubyEnv *, const char *, unsigned int);
37
+ #ifdef __GNUC__
38
+ #pragma GCC visibility pop
39
+ #endif
40
+ XNI_EXPORT int xni_walters_load(RubyVM *,void **);
41
+ XNI_EXPORT void xni_walters_unload(RubyVM *, void *);
42
+
43
+ #endif /* WALTERS_H */
@@ -0,0 +1,2 @@
1
+ require_relative 'walters/walters'
2
+ require_relative 'walters/version'
@@ -0,0 +1,3 @@
1
+ module Walters
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,87 @@
1
+ require 'xni'
2
+
3
+ module Walters
4
+ extend XNI::Extension
5
+ extension 'walters'
6
+
7
+ class Buffer < XNI::DataObject
8
+ custom_finalizer
9
+
10
+ native :initialize, [ :uint ], :void
11
+ native :cstring, [], :cstring
12
+
13
+ native :escape_html, [ :cstring, :uint], :bool
14
+ native :escape_html0, [ :cstring, :uint, :bool ], :bool
15
+ native :unescape_html, [ :cstring, :uint], :bool
16
+ native :escape_xml, [ :cstring, :uint], :bool
17
+ native :escape_uri, [ :cstring, :uint], :bool
18
+ native :escape_url, [ :cstring, :uint], :bool
19
+ native :escape_href, [ :cstring, :uint], :bool
20
+ native :unescape_uri, [ :cstring, :uint], :bool
21
+ native :unescape_url, [ :cstring, :uint], :bool
22
+ native :escape_js, [ :cstring, :uint], :bool
23
+ native :unescape_js, [ :cstring, :uint], :bool
24
+ end
25
+
26
+ native :free_cstring, [ :pointer ], :void
27
+ native :read_cstring, [ :pointer ], :cstring
28
+ native :_escape_html, [ :cstring, :uint, :bool], :pointer
29
+ native :_unescape_html, [ :cstring, :uint], :pointer
30
+ native :_escape_xml, [ :cstring, :uint], :pointer
31
+ native :_escape_uri, [ :cstring, :uint], :pointer
32
+ native :_escape_url, [ :cstring, :uint], :pointer
33
+ native :_escape_href, [ :cstring, :uint], :pointer
34
+ native :_unescape_uri, [ :cstring, :uint], :pointer
35
+ native :_unescape_url, [ :cstring, :uint], :pointer
36
+ native :_escape_js, [ :cstring, :uint], :pointer
37
+ native :_unescape_js, [ :cstring, :uint], :pointer
38
+
39
+ class << self
40
+ private
41
+ def cstring(ptr, str)
42
+ ptr ? read_cstring(ptr) : str
43
+ ensure
44
+ free_cstring(ptr) if ptr
45
+ end
46
+ end
47
+
48
+ def self.escape_html(src, secure = true)
49
+ cstring _escape_html(src, src.length, secure), src
50
+ end
51
+
52
+ def self.unescape_html(src)
53
+ cstring _unescape_html(src, src.length), src
54
+ end
55
+
56
+ def self.escape_xml(src)
57
+ cstring _escape_xml(src, src.length, secure), src
58
+ end
59
+
60
+ def self.escape_uri(src)
61
+ cstring _escape_uri(src, src.length, secure), src
62
+ end
63
+
64
+ def self.escape_url(src)
65
+ cstring _escape_url(src, src.length, secure), src
66
+ end
67
+
68
+ def self.escape_href(src)
69
+ cstring _escape_href(src, src.length, secure), src
70
+ end
71
+
72
+ def self.unescape_uri(src)
73
+ cstring _unescape_uri(src, src.length), src
74
+ end
75
+
76
+ def self.unescape_url(src)
77
+ cstring _unescape_url(src, src.length), src
78
+ end
79
+
80
+ def self.escape_js(src)
81
+ cstring _escape_js(src, src.length, secure), src
82
+ end
83
+
84
+ def self.unescape_js(src)
85
+ cstring _unescape_js(src, src.length), src
86
+ end
87
+ end
@@ -0,0 +1,21 @@
1
+ require File.expand_path("../lib/#{File.basename(__FILE__, '.gemspec')}/version", __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'walters'
5
+ s.version = Walters::VERSION
6
+ s.author = 'Wayne Meissner'
7
+ s.email = 'wmeissner@gmail.com'
8
+ s.homepage = 'http://wiki.github.com/wmeissner/walters'
9
+ s.summary = 'JRuby wrapper for Houdini'
10
+ s.description = 'JRuby wrapper for Houdini html escaping library'
11
+ s.files = %w(walters.gemspec LICENSE README.md Rakefile)
12
+ s.files += Dir['lib/**/*.rb', 'ext/**/*.{c,cpp,h}', '{spec,libtest}/**/*.{c,cpp,h,rb}']
13
+ s.has_rdoc = false
14
+ s.license = 'Apache 2.0'
15
+ s.required_ruby_version = '>= 1.9.3'
16
+ s.add_dependency 'rake', '>= 10.0.0'
17
+ s.add_dependency 'xni', '>= 0.1.0'
18
+ s.add_development_dependency 'rspec'
19
+ s.add_development_dependency 'rubygems-tasks'
20
+ s.extensions = ['ext/Rakefile']
21
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: walters
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Wayne Meissner
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 10.0.0
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 10.0.0
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ - !ruby/object:Gem::Dependency
31
+ name: xni
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - '>='
35
+ - !ruby/object:Gem::Version
36
+ version: 0.1.0
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '>='
41
+ - !ruby/object:Gem::Version
42
+ version: 0.1.0
43
+ none: false
44
+ prerelease: false
45
+ type: :runtime
46
+ - !ruby/object:Gem::Dependency
47
+ name: rspec
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ none: false
60
+ prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubygems-tasks
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ none: false
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ none: false
76
+ prerelease: false
77
+ type: :development
78
+ description: JRuby wrapper for Houdini html escaping library
79
+ email: wmeissner@gmail.com
80
+ executables: []
81
+ extensions:
82
+ - ext/Rakefile
83
+ extra_rdoc_files: []
84
+ files:
85
+ - walters.gemspec
86
+ - LICENSE
87
+ - README.md
88
+ - Rakefile
89
+ - lib/walters.rb
90
+ - lib/walters/version.rb
91
+ - lib/walters/walters.rb
92
+ - ext/houdini/buffer.c
93
+ - ext/houdini/houdini_href_e.c
94
+ - ext/houdini/houdini_html_e.c
95
+ - ext/houdini/houdini_html_u.c
96
+ - ext/houdini/houdini_js_e.c
97
+ - ext/houdini/houdini_js_u.c
98
+ - ext/houdini/houdini_uri_e.c
99
+ - ext/houdini/houdini_uri_u.c
100
+ - ext/houdini/houdini_xml_e.c
101
+ - ext/walters.cpp
102
+ - ext/walters_buffer.cpp
103
+ - ext/x86_64-darwin/__xni_walters.cpp
104
+ - ext/houdini/buffer.h
105
+ - ext/houdini/houdini.h
106
+ - ext/houdini/html_unescape.h
107
+ - ext/x86_64-darwin/walters.h
108
+ - ext/Rakefile
109
+ homepage: http://wiki.github.com/wmeissner/walters
110
+ licenses:
111
+ - Apache 2.0
112
+ post_install_message:
113
+ rdoc_options: []
114
+ require_paths:
115
+ - lib
116
+ required_ruby_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - '>='
119
+ - !ruby/object:Gem::Version
120
+ version: 1.9.3
121
+ none: false
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ none: false
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 1.8.24
131
+ signing_key:
132
+ specification_version: 3
133
+ summary: JRuby wrapper for Houdini
134
+ test_files: []