win32-mmap 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.2.3 - 12-Aug-2009
2
+ * Changed license to Artistic 2.0.
3
+ * The MMap.open method now properly handles a block.
4
+ * Some gemspec updates, including the license and description.
5
+ * Changed test and example file names.
6
+ * Some Rakefile updates, including tasks for running example programs.
7
+
1
8
  == 0.2.2 - 16-May-2007
2
9
  * Fixed a bug where marshalled data that happened to end with a "\0" would
3
10
  cause the getter to fail.
data/MANIFEST CHANGED
@@ -3,9 +3,8 @@
3
3
  * README
4
4
  * Rakefile
5
5
  * win32-mmap.gemspec
6
- * doc/mmap.rdoc
7
- * examples/mmap_test.rb
8
- * examples/test_client.rb
9
- * examples/test_server.rb
6
+ * examples/example_mmap.rb
7
+ * examples/example_mmap_client.rb
8
+ * examples/example_mmap_server.rb
10
9
  * lib/win32/mmap.rb
11
- * test/tc_mmap.rb
10
+ * test/test_win32_mmap.rb
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
  This package provides a Ruby interface for memory mapped I/O on MS Windows.
3
3
 
4
4
  = Prerequisites
5
- Ruby 1.8.0 or later.
5
+ Ruby 1.8.2 or later.
6
6
  windows-pr, 0.5.5 or later.
7
7
 
8
8
  = Installation
@@ -30,15 +30,15 @@
30
30
 
31
31
  = About Memory Mapped Files under Windows
32
32
  Under Windows, code and data are both repesented by pages of memory backed
33
- by files on disk - code by executable image an data by system pagefile
34
- (swapfile). These are called memory mapped files. Memory mapped files can be
35
- used to provide a mechanism for shared memory between processes. Different
36
- processes are able to share data backed by the same swapfile, whether it's
37
- the system pagefile or a user-defined swapfile.
33
+ by files on disk, code by executable image and data by system pagefile
34
+ (i.e. swapfile). These are called memory mapped files. Memory mapped files
35
+ can be used to provide a mechanism for shared memory between processes.
36
+ Different processes are able to share data backed by the same swapfile,
37
+ whether it's the system pagefile or a user-defined swapfile.
38
38
 
39
39
  Windows has a tight security system that prevents processes from directly
40
40
  sharing information among each other, but mapped memory files provide a
41
- mechanism that works with the Windows security system - by using a name that
41
+ mechanism that works with the Windows security system by using a name that
42
42
  all processes use to open the swapfile.
43
43
 
44
44
  A shared section of the swapfile is translated into pages of memory that are
@@ -47,7 +47,7 @@
47
47
  the same physical page of memory, thus multiple process can share the same
48
48
  data without violating the Windows system security.
49
49
 
50
- In short, MMF's provide shared memory under Windows.
50
+ In short, memory mapped files provide shared memory under Windows.
51
51
 
52
52
  (This explanation was largely borrowed from Roger Lee's Win32::MMF Perl
53
53
  module.)
@@ -56,10 +56,10 @@
56
56
  Suggestions welcome.
57
57
 
58
58
  = License
59
- Ruby's
59
+ Artistic 2.0
60
60
 
61
61
  = Copyright
62
- (C) 2003-2007 Daniel J. Berger, All Rights Reserved
62
+ (C) 2003-2009 Daniel J. Berger, All Rights Reserved
63
63
 
64
64
  = Warranty
65
65
  This package is provided "as is" and without any express or
data/Rakefile CHANGED
@@ -13,9 +13,19 @@ task :install do
13
13
  FileUtils.cp(file, installdir, :verbose => true)
14
14
  end
15
15
 
16
+ desc 'Run the example mmap file program'
17
+ task :example_file do
18
+ ruby '-Ilib examples/example_mmap_file.rb'
19
+
20
+ desc 'Run the example mmap server'
21
+ task :example_server do
22
+ ruby '-Ilib examples/example_mmap_server.rb'
23
+
24
+ desc 'Run the example mmap client'
25
+ task :example_client do
26
+ ruby '-Ilib examples/example_mmap_client.rb'
27
+
16
28
  Rake::TestTask.new do |t|
17
- t.libs << 'test'
18
29
  t.verbose = true
19
30
  t.warning = true
20
- t.test_files = FileList['test/tc_mmap.rb']
21
31
  end
@@ -0,0 +1,20 @@
1
+ #######################################################################
2
+ # example_mmap_client.rb
3
+ #
4
+ # This program demonstrates a simple mmap client. You should run this
5
+ # program *after* you have run the example server program in a
6
+ # separate terminal.
7
+ #
8
+ # You can run this program via the 'rake example_client' task.
9
+ #
10
+ # Modify this program as you see fit.
11
+ #######################################################################
12
+ require 'win32/mmap'
13
+ include Win32
14
+
15
+ mmap = MMap.open('alpha')
16
+
17
+ p mmap.foo
18
+ p mmap.bar
19
+
20
+ mmap.close
@@ -0,0 +1,25 @@
1
+ #######################################################################
2
+ # example_mmap_file.rb
3
+ #
4
+ # This sample script demonstrates creating a memory mapped file, then
5
+ # later reading from it. You can run this example via the
6
+ # 'rake example_file' task.
7
+ #
8
+ # Modify this program as you see fit.
9
+ #######################################################################
10
+ require 'win32/mmap'
11
+ include Win32
12
+
13
+ map1 = MMap.new(:file => "C:\\mmap.test", :size => 1024)
14
+
15
+ map1.foo = 'hello'
16
+ map1.bar = 77
17
+
18
+ map1.close
19
+
20
+ map2 = MMap.new(:file => "C:\\mmap.test")
21
+
22
+ p map2.foo
23
+ p map2.bar
24
+
25
+ map2.close
@@ -0,0 +1,20 @@
1
+ #######################################################################
2
+ # example_mmap_server.rb
3
+ #
4
+ # A test script for general futzing. Run this in its own terminal
5
+ # then run the example_mmap_client.rb program in a separate terminal.
6
+ # You can run this program via the 'rake example_server' task.
7
+ #
8
+ # Modify as you see fit.
9
+ #######################################################################
10
+ require 'win32/mmap'
11
+ include Win32
12
+
13
+ mmap = MMap.new(:name => 'alpha', :size => 2000)
14
+
15
+ mmap.foo = 'hello'
16
+ mmap.bar = 27
17
+
18
+ sleep 100
19
+
20
+ mmap.close
data/lib/win32/mmap.rb CHANGED
@@ -6,14 +6,18 @@ require 'windows/msvcrt/buffer'
6
6
  require 'windows/synchronize'
7
7
  require 'windows/memory'
8
8
 
9
+ # The Win32 module serves as a namespace only.
10
+ #
9
11
  module Win32
10
12
 
11
- # Memory mapped files for MS Windows.
13
+ # The MMap class encapsulates functions for memory mapped files.
12
14
  #
13
15
  class MMap
14
- VERSION = '0.2.2'
16
+
17
+ # The version of the win32-mmap library.
18
+ VERSION = '0.2.3'
15
19
 
16
- # All errors generated by Win32::MMap are of type MMap::Error.
20
+ # Error typically raised in any method of Win32::MMap should fail.
17
21
  #
18
22
  class Error < StandardError; end
19
23
 
@@ -242,10 +246,10 @@ module Win32
242
246
  #--
243
247
  # This forces MMap.new to use OpenFileMapping() behind the scenes.
244
248
  #
245
- def self.open(name, opts={})
249
+ def self.open(name, opts={}, &block)
246
250
  opts[:name] = name
247
251
  opts[:open] = true
248
- self.new(opts)
252
+ self.new(opts, &block)
249
253
  end
250
254
 
251
255
  # Sets whether or not the mapping handle can be inherited
@@ -300,6 +304,8 @@ module Win32
300
304
  end
301
305
 
302
306
  private
307
+
308
+ # :stopdoc:
303
309
 
304
310
  # This is used to allow dynamic getters and setters between memory
305
311
  # mapped objects.
@@ -1,5 +1,5 @@
1
1
  #####################################################################
2
- # tc_mmap.rb
2
+ # test_win32_mmap.rb
3
3
  #
4
4
  # Test suite for the win32-mmap package. This should be run via the
5
5
  # 'rake test' task.
@@ -8,13 +8,13 @@ require 'test/unit'
8
8
  require 'win32/mmap'
9
9
  include Win32
10
10
 
11
- class TC_Mmap < Test::Unit::TestCase
11
+ class TC_Win32_Mmap < Test::Unit::TestCase
12
12
  def setup
13
13
  @mmap = MMap.new(:name => 'test', :size => 100)
14
14
  end
15
15
 
16
16
  def test_version
17
- assert_equal('0.2.2', MMap::VERSION)
17
+ assert_equal('0.2.3', MMap::VERSION)
18
18
  end
19
19
 
20
20
  def test_dynamic_string_value
data/win32-mmap.gemspec CHANGED
@@ -1,24 +1,27 @@
1
- require "rubygems"
1
+ require 'rubygems'
2
2
 
3
3
  spec = Gem::Specification.new do |gem|
4
- gem.name = "win32-mmap"
5
- gem.version = "0.2.2"
6
- gem.author = "Daniel J. Berger"
7
- gem.email = "djberg96@gmail.com"
8
- gem.homepage = "http://www.rubyforge.org/projects/win32utils"
9
- gem.platform = Gem::Platform::RUBY
10
- gem.summary = "Memory mapped IO for Windows."
11
- gem.description = "Memory mapped IO for Windows."
12
- gem.test_file = "test/tc_mmap.rb"
13
- gem.has_rdoc = true
14
- gem.files = Dir["lib/win32/*.rb"] + Dir["test/*"] + Dir["[A-Z]*"]
15
- gem.files.reject! { |fn| fn.include? "CVS" }
16
- gem.require_path = "lib"
17
- gem.extra_rdoc_files = ["MANIFEST", "README", "CHANGES"]
18
- gem.add_dependency("windows-pr", ">= 0.5.6")
19
- end
4
+ gem.name = 'win32-mmap'
5
+ gem.version = '0.2.3'
6
+ gem.author = 'Daniel J. Berger'
7
+ gem.license = 'Artistic 2.0'
8
+ gem.email = 'djberg96@gmail.com'
9
+ gem.homepage = 'http://www.rubyforge.org/projects/win32utils'
10
+ gem.platform = Gem::Platform::RUBY
11
+ gem.summary = 'Memory mapped IO for Windows.'
12
+ gem.test_file = 'test/test_win32_mmap.rb'
13
+ gem.has_rdoc = true
14
+ gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
15
+
16
+ gem.rubyforge_project = 'win32utils'
17
+ gem.extra_rdoc_files = ['MANIFEST', 'README', 'CHANGES']
20
18
 
21
- if $0 == __FILE__
22
- Gem.manage_gems
23
- Gem::Builder.new(spec).build
19
+ gem.add_dependency('windows-pr')
20
+
21
+ gem.description = <<-EOF
22
+ The win32-mmap library provides an interface for memory mapped IO on
23
+ MS Windows.
24
+ EOF
24
25
  end
26
+
27
+ Gem::Builder.new(spec).build
metadata CHANGED
@@ -1,68 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.3
3
- specification_version: 1
4
2
  name: win32-mmap
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.2.2
7
- date: 2007-05-16 00:00:00 -06:00
8
- summary: Memory mapped IO for Windows.
9
- require_paths:
10
- - lib
11
- email: djberg96@gmail.com
12
- homepage: http://www.rubyforge.org/projects/win32utils
13
- rubyforge_project:
14
- description: Memory mapped IO for Windows.
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.2.3
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Daniel J. Berger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-12 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: windows-pr
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: " The win32-mmap library provides an interface for memory mapped IO on\n MS Windows.\n"
26
+ email: djberg96@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - MANIFEST
33
+ - README
34
+ - CHANGES
31
35
  files:
32
- - lib/win32/mmap.rb
33
- - test/CVS
34
- - test/tc_mmap.rb
35
36
  - CHANGES
36
- - CVS
37
- - doc
38
- - examples
39
- - lib
37
+ - examples/example_mmap_client.rb
38
+ - examples/example_mmap_file.rb
39
+ - examples/example_mmap_server.rb
40
+ - lib/win32/mmap.rb
40
41
  - MANIFEST
41
42
  - Rakefile
42
43
  - README
43
- - test
44
+ - test/test_win32_mmap.rb
44
45
  - win32-mmap.gemspec
45
- test_files:
46
- - test/tc_mmap.rb
46
+ has_rdoc: true
47
+ homepage: http://www.rubyforge.org/projects/win32utils
48
+ licenses:
49
+ - Artistic 2.0
50
+ post_install_message:
47
51
  rdoc_options: []
48
52
 
49
- extra_rdoc_files:
50
- - MANIFEST
51
- - README
52
- - CHANGES
53
- executables: []
54
-
55
- extensions: []
56
-
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: "0"
66
+ version:
57
67
  requirements: []
58
68
 
59
- dependencies:
60
- - !ruby/object:Gem::Dependency
61
- name: windows-pr
62
- version_requirement:
63
- version_requirements: !ruby/object:Gem::Version::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: 0.5.6
68
- version:
69
+ rubyforge_project: win32utils
70
+ rubygems_version: 1.3.5
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Memory mapped IO for Windows.
74
+ test_files:
75
+ - test/test_win32_mmap.rb