oniguruma 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/History.txt +5 -0
  2. data/Manifest.txt +2 -0
  3. data/Rakefile +29 -6
  4. data/ext/oregexp.c +6 -6
  5. metadata +5 -3
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.1 / 2007-03-28
2
+ * Minimal recommended version of oniglib changed to be compatible with Ruby 1.9, now is 4.6 or higher.
3
+ * Restore check for onig version to build with 4.6
4
+ * In getting replacement do not create temp string object, but directly add to resulting buffer (performance impr.)
5
+
1
6
  == 1.0.0 / 2007-03-27
2
7
  * Added documentation for MatchData.
3
8
  * Added ogsub, ogsub!, sub and sub! to ::String.
data/Manifest.txt CHANGED
@@ -5,4 +5,6 @@ Syntax.txt
5
5
  Rakefile
6
6
  lib/oniguruma.rb
7
7
  ext/oregexp.c
8
+ ext/extconf.rb
8
9
  test/test_oniguruma.rb
10
+ win/oregexp.so
data/Rakefile CHANGED
@@ -1,18 +1,41 @@
1
1
  require 'rubygems'
2
2
  require 'hoe'
3
3
 
4
- class Hoe; def extra_deps; @extra_deps.reject { |x| Array(x).first == 'hoe' }; end end
4
+ class Hoe
5
+ # Dirty hack to eliminate Hoe from gem dependencies
6
+ def extra_deps
7
+ @extra_deps.reject { |x| Array(x).first == 'hoe' }
8
+ end
9
+
10
+ # Dirty hack to package only the required files per platform
11
+ def spec= s
12
+ if ENV['PLATFORM'] =~ /win32/
13
+ s.files = s.files.reject! {|f| f =~ /ext\//}
14
+ else
15
+ s.files = s.files.reject! {|f| f =~ /win\//}
16
+ end
17
+ @spec = s
18
+ end
19
+ end
20
+
21
+ version = /^== *(\d+\.\d+\.\d+)/.match( File.read( 'History.txt' ) )[1]
5
22
 
6
- Hoe.new('oniguruma', '1.0.0') do |p|
23
+ Hoe.new('oniguruma', version) do |p|
7
24
  p.rubyforge_name = 'oniguruma'
8
- p.author = 'Dizan Vasquez'
9
- p.email = 'dix_ans@yahoo.com'
25
+ p.author = ['Dizan Vasquez', 'Nikolai Lugovoi']
26
+ p.email = 'dichodaemon@gmail.com'
10
27
  p.summary = 'Bindings for the oniguruma regular expression library'
11
28
  p.description = p.paragraphs_of('README.txt', 1 ).join('\n\n')
12
29
  p.url = 'http://oniguruma.rubyforge.org'
13
- p.spec_extras[:extensions] = ["ext/extconf.rb"]
30
+ if ENV['PLATFORM'] =~ /win32/
31
+ p.lib_files = ["win/oregexp.so"]
32
+ p.spec_extras[:require_paths] = ["win", "lib", "ext" ]
33
+ p.spec_extras[:platform] = Gem::Platform::WIN32
34
+ else
35
+ p.spec_extras[:extensions] = ["ext/extconf.rb"]
36
+ end
14
37
  p.rdoc_pattern = /^(lib|bin|ext)|txt$/
15
- p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
38
+ p.changes = p.paragraphs_of('History.txt', 0).join("\n\n")
16
39
  end
17
40
 
18
41
 
data/ext/oregexp.c CHANGED
@@ -58,7 +58,9 @@ static OnigEncodingType * int2encoding( VALUE v_index ) {
58
58
  case 26: return ONIG_ENCODING_SJIS;
59
59
  /*case 27: return ONIG_ENCODING_KOI8;*/
60
60
  case 28: return ONIG_ENCODING_KOI8_R;
61
+ #if ONIGURUMA_VERSION_MAJOR == 5
61
62
  case 29: return ONIG_ENCODING_CP1251;
63
+ #endif
62
64
  case 30: return ONIG_ENCODING_BIG5;
63
65
  case 31: return ONIG_ENCODING_GB18030;
64
66
  case 32: return ONIG_ENCODING_UNDEF;
@@ -224,14 +226,14 @@ backslash). */
224
226
 
225
227
  /* scan the replacement text, looking for substitutions (\n) and \escapes. */
226
228
  static VALUE
227
- oregexp_get_replacement(pat, src_text, repl_text, region)
229
+ oregexp_append_replacement(pat, src_text, repl_text, region, ret)
228
230
  VALUE pat,
229
231
  src_text,
230
232
  repl_text;
231
233
  OnigRegion * region;
234
+ VALUE ret;
232
235
  {
233
236
  ORegexp *oregexp;
234
- VALUE ret;
235
237
  int32_t replIdx = 0, name_pos, name_start, name_end ;
236
238
  int32_t replacementLength = RSTRING(repl_text)->len;
237
239
  UChar *replacementText = RSTRING(repl_text)->ptr;
@@ -248,8 +250,6 @@ oregexp_get_replacement(pat, src_text, repl_text, region)
248
250
  Data_Get_Struct( pat, ORegexp, oregexp );
249
251
  enc = onig_get_encoding( oregexp->reg );
250
252
 
251
- ret = rb_str_buf_new(RSTRING(repl_text)->len);
252
-
253
253
  while (replIdx < replacementLength) {
254
254
  OnigCodePoint c = ONIGENC_MBC_TO_CODE(enc, replacementText+replIdx, replacementEnd);
255
255
  int c_len =ONIGENC_MBC_ENC_LEN(enc, replacementText+replIdx) ;
@@ -438,10 +438,10 @@ oregexp_gsub(self, argc, argv, bang, once, region)
438
438
  block_res = rb_yield( match_data );
439
439
  str_mod_check( string_str, str_ptr, str_len);
440
440
  curr_repl = rb_obj_as_string(block_res);
441
+ rb_str_append(buf, curr_repl);
441
442
  } else {
442
- curr_repl = oregexp_get_replacement(self, string_str, repl, region);
443
+ oregexp_append_replacement(self, string_str, repl, region, buf);
443
444
  }
444
- rb_str_append(buf, curr_repl);
445
445
  if( once ) break;
446
446
  // find next match
447
447
  if( end == beg) {
metadata CHANGED
@@ -3,13 +3,13 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: oniguruma
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.0.0
7
- date: 2007-03-27 00:00:00 +02:00
6
+ version: 1.0.1
7
+ date: 2007-03-28 00:00:00 +02:00
8
8
  summary: Bindings for the oniguruma regular expression library
9
9
  require_paths:
10
10
  - lib
11
11
  - ext
12
- email: dix_ans@yahoo.com
12
+ email: dichodaemon@gmail.com
13
13
  homepage: http://oniguruma.rubyforge.org
14
14
  rubyforge_project: oniguruma
15
15
  description: Ruby bindings to the Oniguruma[http://www.geocities.jp/kosako3/oniguruma/] regular expression library (no need to recompile Ruby).
@@ -29,6 +29,7 @@ cert_chain:
29
29
  post_install_message:
30
30
  authors:
31
31
  - Dizan Vasquez
32
+ - Nikolai Lugovoi
32
33
  files:
33
34
  - History.txt
34
35
  - Manifest.txt
@@ -37,6 +38,7 @@ files:
37
38
  - Rakefile
38
39
  - lib/oniguruma.rb
39
40
  - ext/oregexp.c
41
+ - ext/extconf.rb
40
42
  - test/test_oniguruma.rb
41
43
  test_files:
42
44
  - test/test_oniguruma.rb