mmap2 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bfc0c4712a435e770b3bd57fbfd958a93b0a7551
4
+ data.tar.gz: 55ae9104e0068bff1b272c90185be0cb1a412100
5
+ SHA512:
6
+ metadata.gz: 9a9733202cdb8e45b272979835c9d76b7bff98a91e706d58b0ea98cee98599b909ef19aa2680c56dec26717a326bd69f44b17f7edd5a9600e712185b4a643cb7
7
+ data.tar.gz: e271a48e4db8127d6bb8cd8a0bc3f1451e6badacbb7e987db938381feebbbb40207a76238067f79db2bfbd7e34888283c95332ac1636cb5b376f7cbc7b573ff9
data/Changes ADDED
@@ -0,0 +1,55 @@
1
+
2
+ -- 0.1.2
3
+
4
+ * fixed some bugs (options & new) (Thanks Joseph McDonald <joe@vpop.net>)
5
+ * added anonymous map
6
+ * added mlock, munlock, etc
7
+
8
+ -- 0.1.3
9
+
10
+ * added #count, #slice, #slice!
11
+ * added #insert, #casecmp (>= 171)
12
+ * corrected NEW2LONG
13
+
14
+ -- 0.1.4
15
+
16
+ * added #lstrip!, #rstrip! for 1.7.1
17
+ * corrected strip!
18
+ * corrected mm_bang_i (reverse!, etc)
19
+ * added a small test (make test)
20
+
21
+ -- 0.1.5
22
+
23
+ * added str[/a(a)/, 1] for 1.7.1
24
+ * corrected mm_aset (mm_update(str, ...))
25
+ * corrected ==, ===, eql?
26
+ * corrected mm_sub_bang, mm_gsub_bang (to_str)
27
+
28
+ -- 0.1.6
29
+
30
+ * adapted for 1.7.2 (mm_str)
31
+ * corrected real for mm_sub_bang
32
+ * protected against old class
33
+
34
+ -- 0.1.7
35
+
36
+ * 1.7.2 (::allocate, #initialize)
37
+ * added "a" for ::new
38
+ * experimental EXP_INCR_SIZE (4096) ("increment" => 4096)
39
+ * tests for RUNIT/Test::Unit
40
+
41
+ -- 0.1.8
42
+
43
+ * test for madvise(2)
44
+ * don't test size for MAP_ANON
45
+ * added syntax Mmap(nil, length)
46
+ * documentation : make rd2; make rdoc
47
+
48
+ -- 0.1.9
49
+
50
+ * String#slice! was modified in 1.6.8
51
+ * added ::new(IO)
52
+
53
+ --- 0.2.0
54
+
55
+ * adapted for 1.8.0
data/README.rdoc ADDED
@@ -0,0 +1,36 @@
1
+ = Mmap
2
+
3
+ * http://rubyforge.org/frs/?group_id=8350
4
+
5
+ == DESCRIPTION
6
+
7
+ The Mmap class implement memory-mapped file objects
8
+
9
+ == SYNOPSIS
10
+
11
+ require 'mmap'
12
+
13
+ mmap = Mmap.new(__FILE__)
14
+ mmap.advise(Mmap::MADV_SEQUENTIAL)
15
+
16
+ mmap.each do |line|
17
+ puts line
18
+ end
19
+
20
+ == Installation
21
+
22
+ gem install mmap
23
+
24
+ == Documentation
25
+
26
+ rake docs
27
+
28
+ == Copying
29
+
30
+ This extension module is copyrighted free software by Guy Decoux
31
+
32
+ You can redistribute it and/or modify it under the same term as
33
+ Ruby.
34
+
35
+
36
+ Guy Decoux <ts@moulon.inra.fr>
data/b.rb ADDED
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/ruby
2
+ $LOAD_PATH.unshift "."
3
+ require "mmap"
4
+ PAGESIZE = 4096
5
+ f = File.open("aa", "w")
6
+ f.write("\0" * PAGESIZE)
7
+ f.write("b.rb")
8
+ f.write("\0" * PAGESIZE)
9
+ f.close
10
+ m = Mmap.new("aa", "w", "offset" => 0)
11
+ p m.size == "b.rb".size + 2 * PAGESIZE
12
+ p m.scan(/[a-z.]+/) == ["b.rb"]
13
+ p m.index("b.rb") == PAGESIZE
14
+ p m.rindex("b.rb") == PAGESIZE
15
+ p m.sub!(/[a-z.]+/, "toto") == m
16
+ p m.scan(/[a-z.]+/) == ["toto"]
17
+ begin
18
+ m.sub!(/[a-z.]+/, "alpha")
19
+ puts "not OK must give an error"
20
+ rescue
21
+ puts "OK : #$!"
22
+ end
23
+ m.munmap
24
+ m = Mmap.new("aa", "rw")
25
+ p m.index("toto") == PAGESIZE
26
+ p m.sub!(/([a-z.]+)/, "alpha") == m
27
+ p $& == "toto"
28
+ p $1 == "toto"
29
+ p m.index("toto") == nil
30
+ p m.index("alpha") == PAGESIZE
31
+ p m.size == 5 + 2 * PAGESIZE
32
+ m.gsub!(/\0/, "X")
33
+ p m.size == 5 + 2 * PAGESIZE
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby
2
+ ARGV.collect! {|x| x.sub(/^--with-mmap-prefix=/, "--with-mmap-dir=") }
3
+
4
+ require 'mkmf'
5
+
6
+ dir_config("mmap")
7
+
8
+ ["lstrip", "match", "insert", "casecmp"].each do |func|
9
+ if "aa".respond_to?(func)
10
+ $CFLAGS += " -DHAVE_RB_STR_#{func.upcase}"
11
+ end
12
+ end
13
+
14
+ have_func 'rb_fstring_new'
15
+
16
+ if enable_config("ipc")
17
+ unless have_func("semctl") && have_func("shmctl")
18
+ $stderr.puts "\tIPC will not be available"
19
+ end
20
+ end
21
+
22
+ create_makefile "mmap/mmap"