java_bin 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.3.4 (2010/02/06)
2
+ * remove dependence on glibc byteswap.h
3
+ * a little performance improve
4
+
1
5
  0.3.3 (2010/02/01)
2
6
  * fix iterator false bug
3
7
  * performance improve
data/README.rdoc CHANGED
@@ -74,6 +74,7 @@ This is an Apache Solr JavaBin format (binary format) implementation for Ruby.
74
74
 
75
75
  == TODO
76
76
 
77
+ * max os x supoort
77
78
  * more parse speed
78
79
  * license
79
80
  * shared string over parsing
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -0,0 +1,17 @@
1
+ // http://koders.com/c/fidB93B34CD44F0ECF724F1A4EAE3854BA2FE692F59.aspx
2
+ #ifndef _BYTESWAP_H
3
+ #define _BYTESWAP_H
4
+
5
+ static inline unsigned short bswap_16(unsigned short x) {
6
+ return (x>>8) | (x<<8);
7
+ }
8
+
9
+ static inline unsigned int bswap_32(unsigned int x) {
10
+ return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16));
11
+ }
12
+
13
+ static inline unsigned long long bswap_64(unsigned long long x) {
14
+ return (((unsigned long long)bswap_32(x&0xffffffffull))<<32) | (bswap_32(x>>32));
15
+ }
16
+
17
+ #endif
@@ -9,7 +9,6 @@ unless RUBY_PLATFORM =~ /mswin32/ # Linux
9
9
  if CONFIG['CC'] =~ /gcc/
10
10
  $CFLAGS << ' -Wall'
11
11
  end
12
- have_header("byteswap.h")
13
12
  have_header("sys/types.h")
14
13
  else # Windows
15
14
  $CFLAGS.gsub!(/-O2b2xg-/, '/O2b2x')
@@ -183,7 +183,7 @@ static inline VALUE JavaBinParser_read_date(JAVA_BIN_PARSER* ptr) {
183
183
  u_int64_t c;
184
184
  _readnumeric(ptr, c);
185
185
  c = _swap_64(c);
186
- return rb_funcall(rb_cTime, i_At, 1, ULL2NUM(*((int64_t*)&c) / 1000));
186
+ return rb_funcall(rb_cTime, i_At, 1, ULL2NUM(c / 1000));
187
187
  }
188
188
 
189
189
  static inline VALUE JavaBinParser_read_float(JAVA_BIN_PARSER* ptr) {
@@ -2,10 +2,7 @@
2
2
  #define _PARSER_H_
3
3
 
4
4
  #include "ruby.h"
5
-
6
- #if HAVE_BYTESWAP_H
7
- #include <byteswap.h>
8
- #endif /* HAVE_BYTESWAP_H */
5
+ #include "byteswap.h"
9
6
 
10
7
  #if HAVE_SYS_TYPES_H
11
8
  #include <sys/types.h>
@@ -114,29 +111,6 @@ typedef struct java_bin_parser {
114
111
  typedef unsigned __int64 u_int64_t;
115
112
  #endif
116
113
 
117
- //static void JavaBinParser_extend_cache(JAVA_BIN_PARSER* ptr);
118
-
119
- //static int32_t JavaBinParser_read_v_int(JAVA_BIN_PARSER* ptr);
120
- //static int64_t JavaBinParser_read_v_long(JAVA_BIN_PARSER* ptr);
121
- //static int JavaBinParser_read_size(JAVA_BIN_PARSER* ptr);
122
- //static VALUE JavaBinParser_read_small_int(JAVA_BIN_PARSER* ptr);
123
- //static VALUE JavaBinParser_read_small_long(JAVA_BIN_PARSER* ptr);
124
- //static VALUE JavaBinParser_read_string(JAVA_BIN_PARSER* ptr);
125
- //static VALUE JavaBinParser_read_array(JAVA_BIN_PARSER* ptr);
126
- //static VALUE JavaBinParser_read_extern_string(JAVA_BIN_PARSER* ptr);
127
- //static VALUE JavaBinParser_read_ordered_map(JAVA_BIN_PARSER* ptr);
128
- //static VALUE JavaBinParser_read_byte(JAVA_BIN_PARSER* ptr);
129
- //static VALUE JavaBinParser_read_short(JAVA_BIN_PARSER* ptr);
130
- //static VALUE JavaBinParser_read_int(JAVA_BIN_PARSER* ptr);
131
- //static VALUE JavaBinParser_read_long(JAVA_BIN_PARSER* ptr);
132
- //static VALUE JavaBinParser_read_date(JAVA_BIN_PARSER* ptr);
133
- //static VALUE JavaBinParser_read_float(JAVA_BIN_PARSER* ptr);
134
- //static VALUE JavaBinParser_read_double(JAVA_BIN_PARSER* ptr);
135
- //static VALUE JavaBinParser_read_byte_array(JAVA_BIN_PARSER* ptr);
136
- //static VALUE JavaBinParser_read_map(JAVA_BIN_PARSER* ptr);
137
- //static VALUE JavaBinParser_read_iterator(JAVA_BIN_PARSER* ptr);
138
- //static VALUE JavaBinParser_read_solr_doc_list(JAVA_BIN_PARSER* ptr);
139
-
140
114
  static VALUE JavaBinParser_read_val(JAVA_BIN_PARSER* ptr);
141
115
 
142
116
  static void JavaBinParser_free(JAVA_BIN_PARSER* ptr);
data/java_bin.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{java_bin}
8
- s.version = "0.3.3"
8
+ s.version = "0.3.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kennyj"]
12
- s.date = %q{2010-02-02}
12
+ s.date = %q{2010-02-06}
13
13
  s.description = %q{Apache Solr JavaBin format (binary format) implementation for Ruby.}
14
14
  s.email = %q{kennyj@gmail.com}
15
15
  s.extensions = ["ext/java_bin/ext/extconf.rb"]
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "README.rdoc",
26
26
  "Rakefile",
27
27
  "VERSION",
28
+ "ext/java_bin/ext/byteswap.h",
28
29
  "ext/java_bin/ext/extconf.rb",
29
30
  "ext/java_bin/ext/parser.c",
30
31
  "ext/java_bin/ext/parser.h",
@@ -1,7 +1,7 @@
1
1
  # vim:fileencoding=utf-8
2
2
  module JavaBin
3
3
  # JavaBin version
4
- VERSION = '0.1.0'
4
+ VERSION = '0.3.4'
5
5
  VERSION_ARRAY = VERSION.split(/\./).map { |x| x.to_i } # :nodoc:
6
6
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
7
7
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: java_bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - kennyj
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-02 00:00:00 +09:00
12
+ date: 2010-02-06 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -30,6 +30,7 @@ files:
30
30
  - README.rdoc
31
31
  - Rakefile
32
32
  - VERSION
33
+ - ext/java_bin/ext/byteswap.h
33
34
  - ext/java_bin/ext/extconf.rb
34
35
  - ext/java_bin/ext/parser.c
35
36
  - ext/java_bin/ext/parser.h