dde 0.2.9 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -5
- data/.gitignore +21 -22
- data/LICENSE +20 -20
- data/README.rdoc +19 -19
- data/Rakefile +60 -60
- data/VERSION +1 -1
- data/bin/dde_main +32 -32
- data/dde.gemspec +99 -99
- data/doc/ddeml.d.txt +374 -374
- data/doc/types.txt +159 -159
- data/exp/exp_client.rb +44 -44
- data/exp/exp_dde_monitor.rb +18 -18
- data/exp/exp_dde_server.rb +36 -36
- data/exp/exp_lib.rb +38 -38
- data/exp/exp_server.rb +44 -44
- data/features/dde.feature +9 -9
- data/features/support/env.rb +4 -4
- data/lib/dde.rb +9 -9
- data/lib/dde/app.rb +91 -91
- data/lib/dde/client.rb +102 -102
- data/lib/dde/dde_string.rb +32 -32
- data/lib/dde/monitor.rb +93 -93
- data/lib/dde/server.rb +40 -40
- data/lib/dde/xl_server.rb +89 -89
- data/lib/dde/xl_table.rb +190 -190
- data/spec/dde/app_shared.rb +84 -84
- data/spec/dde/app_spec.rb +7 -7
- data/spec/dde/client_spec.rb +199 -199
- data/spec/dde/dde_string_spec.rb +39 -39
- data/spec/dde/monitor_spec.rb +33 -33
- data/spec/dde/server_shared.rb +91 -91
- data/spec/dde/server_spec.rb +36 -36
- data/spec/dde/xl_server_spec.rb +63 -63
- data/spec/dde/xl_table_spec.rb +50 -50
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +21 -25
- metadata +35 -18
data/spec/dde/monitor_spec.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
describe
|
7
|
-
it_should_behave_like "DDE App"
|
8
|
-
end
|
9
|
-
|
10
|
-
describe
|
11
|
-
before(:each){ }
|
12
|
-
after(:each){ @monitor.stop_dde if @monitor.dde_active? }
|
13
|
-
# SEEMS LIKE IT DOESN'T stop system from sending :XTYP_MONITOR transactions to already dead callback :(
|
14
|
-
|
15
|
-
|
16
|
-
it 'starts without constructor parameters' do
|
17
|
-
@monitor =
|
18
|
-
|
19
|
-
@monitor.id.should be_an Integer
|
20
|
-
@monitor.id.should_not == 0
|
21
|
-
@monitor.dde_active?.should == true
|
22
|
-
|
23
|
-
@monitor.init_flags.should == APPCLASS_MONITOR | # this is monitor
|
24
|
-
MF_CALLBACKS | # monitor callback functions
|
25
|
-
MF_CONV | # monitor conversation data
|
26
|
-
MF_ERRORS | # monitor DDEML errors
|
27
|
-
MF_HSZ_INFO | # monitor data handle activity
|
28
|
-
MF_LINKS | # monitor advise loops
|
29
|
-
MF_POSTMSGS | # monitor posted DDE messages
|
30
|
-
MF_SENDMSGS # monitor sent DDE messages
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
3
|
+
|
4
|
+
module DdeTest
|
5
|
+
|
6
|
+
describe Dde::Monitor, " in general" do
|
7
|
+
it_should_behave_like "DDE App"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Dde::Monitor do
|
11
|
+
before(:each){ }
|
12
|
+
after(:each){ @monitor.stop_dde if @monitor.dde_active? }
|
13
|
+
# SEEMS LIKE IT DOESN'T stop system from sending :XTYP_MONITOR transactions to already dead callback :(
|
14
|
+
|
15
|
+
|
16
|
+
it 'starts without constructor parameters' do
|
17
|
+
@monitor = Dde::Monitor.new
|
18
|
+
|
19
|
+
@monitor.id.should be_an Integer
|
20
|
+
@monitor.id.should_not == 0
|
21
|
+
@monitor.dde_active?.should == true
|
22
|
+
|
23
|
+
@monitor.init_flags.should == APPCLASS_MONITOR | # this is monitor
|
24
|
+
MF_CALLBACKS | # monitor callback functions
|
25
|
+
MF_CONV | # monitor conversation data
|
26
|
+
MF_ERRORS | # monitor DDEML errors
|
27
|
+
MF_HSZ_INFO | # monitor data handle activity
|
28
|
+
MF_LINKS | # monitor advise loops
|
29
|
+
MF_POSTMSGS | # monitor posted DDE messages
|
30
|
+
MF_SENDMSGS # monitor sent DDE messages
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
34
|
end
|
data/spec/dde/server_shared.rb
CHANGED
@@ -1,92 +1,92 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
2
|
-
|
3
|
-
module
|
4
|
-
shared_examples_for "DDE Server" do
|
5
|
-
|
6
|
-
it_should_behave_like "DDE App"
|
7
|
-
|
8
|
-
context 'specific to Servers:' do
|
9
|
-
before(:each ){ @server = described_class.new {|*args|}}
|
10
|
-
after(:each ){ @server.stop_dde if @server.dde_active?}
|
11
|
-
|
12
|
-
it 'new with attached callback block creates Server and activates DDEML, but does not start service' do
|
13
|
-
@server = described_class.new {|*args|}
|
14
|
-
@server.id.should be_an Integer
|
15
|
-
@server.id.should_not == 0
|
16
|
-
@server.dde_active?.should == true
|
17
|
-
@server.service.should == nil
|
18
|
-
@server.service_active?.should == false
|
19
|
-
end
|
20
|
-
|
21
|
-
describe '#start_service' do
|
22
|
-
|
23
|
-
context 'with inactive (uninitialized) DDE:' do
|
24
|
-
it 'with attached block, initializes DDE and starts new service' do
|
25
|
-
@server.start_service('myservice') {|*args|}.should be_true
|
26
|
-
|
27
|
-
@server.service.should be_a
|
28
|
-
@server.service.should == 'myservice'
|
29
|
-
@server.service.name.should == 'myservice'
|
30
|
-
@server.service.handle.should be_an Integer
|
31
|
-
@server.service.handle.should_not == 0
|
32
|
-
@server.service_active?.should == true
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'returns self if success (allows method chain)' do
|
36
|
-
res = @server.start_service('myservice') {|*args|}
|
37
|
-
res.should == @server
|
38
|
-
end
|
39
|
-
end # context 'with inactive (uninitialized) DDE:'
|
40
|
-
|
41
|
-
context 'with active (initialized) DDE:' do
|
42
|
-
|
43
|
-
it 'starts new service with given name' do
|
44
|
-
res = @server.start_service 'myservice'
|
45
|
-
res.should be_true
|
46
|
-
|
47
|
-
@server.service.should be_a
|
48
|
-
@server.service.should == 'myservice'
|
49
|
-
@server.service.name.should == 'myservice'
|
50
|
-
@server.service.handle.should be_an Integer
|
51
|
-
@server.service.handle.should_not == 0
|
52
|
-
end
|
53
|
-
|
54
|
-
it 'fails to starts new service if name is not a String' do
|
55
|
-
lambda{@server.start_service(11)}.should raise_error
|
56
|
-
@server.service_active?.should == false
|
57
|
-
end
|
58
|
-
end # context 'with active (initialized) DDE:'
|
59
|
-
end # describe '#start_service'
|
60
|
-
|
61
|
-
describe '#stop_service' do
|
62
|
-
context 'with inactive (uninitialized) DDE:' do
|
63
|
-
it 'fails to stop service' do
|
64
|
-
lambda{@server.stop_service}.should raise_error
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'with active (initialized) DDE: and already registered DDE service: "myservice"' do
|
69
|
-
before(:each){ @server = described_class.new {|*args|}; @server.start_service('myservice')}
|
70
|
-
after(:each){ @server.stop_service if @server.service_active?}
|
71
|
-
|
72
|
-
it 'stops previously registered service' do
|
73
|
-
@server.stop_service.should be_true
|
74
|
-
|
75
|
-
@server.service.should == nil
|
76
|
-
@server.service_active?.should == false
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'does not stop DDE instance' do
|
80
|
-
@server.stop_service
|
81
|
-
@server.id.should_not == nil
|
82
|
-
@server.dde_active?.should == true
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'returns self if success (allows method chain)' do
|
86
|
-
@server.stop_service.should == @server
|
87
|
-
end
|
88
|
-
end # context 'with active (initialized) DDE: and already registered DDE service: "myservice"'
|
89
|
-
end # describe '#stop_service'
|
90
|
-
end # context 'specific to Servers:'
|
91
|
-
end # shared_examples_for "DDE Server"
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
2
|
+
|
3
|
+
module DdeTest
|
4
|
+
shared_examples_for "DDE Server" do
|
5
|
+
|
6
|
+
it_should_behave_like "DDE App"
|
7
|
+
|
8
|
+
context 'specific to Servers:' do
|
9
|
+
before(:each ){ @server = described_class.new {|*args|}}
|
10
|
+
after(:each ){ @server.stop_dde if @server.dde_active?}
|
11
|
+
|
12
|
+
it 'new with attached callback block creates Server and activates DDEML, but does not start service' do
|
13
|
+
@server = described_class.new {|*args|}
|
14
|
+
@server.id.should be_an Integer
|
15
|
+
@server.id.should_not == 0
|
16
|
+
@server.dde_active?.should == true
|
17
|
+
@server.service.should == nil
|
18
|
+
@server.service_active?.should == false
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#start_service' do
|
22
|
+
|
23
|
+
context 'with inactive (uninitialized) DDE:' do
|
24
|
+
it 'with attached block, initializes DDE and starts new service' do
|
25
|
+
@server.start_service('myservice') {|*args|}.should be_true
|
26
|
+
|
27
|
+
@server.service.should be_a Dde::DdeString
|
28
|
+
@server.service.should == 'myservice'
|
29
|
+
@server.service.name.should == 'myservice'
|
30
|
+
@server.service.handle.should be_an Integer
|
31
|
+
@server.service.handle.should_not == 0
|
32
|
+
@server.service_active?.should == true
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns self if success (allows method chain)' do
|
36
|
+
res = @server.start_service('myservice') {|*args|}
|
37
|
+
res.should == @server
|
38
|
+
end
|
39
|
+
end # context 'with inactive (uninitialized) DDE:'
|
40
|
+
|
41
|
+
context 'with active (initialized) DDE:' do
|
42
|
+
|
43
|
+
it 'starts new service with given name' do
|
44
|
+
res = @server.start_service 'myservice'
|
45
|
+
res.should be_true
|
46
|
+
|
47
|
+
@server.service.should be_a Dde::DdeString
|
48
|
+
@server.service.should == 'myservice'
|
49
|
+
@server.service.name.should == 'myservice'
|
50
|
+
@server.service.handle.should be_an Integer
|
51
|
+
@server.service.handle.should_not == 0
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'fails to starts new service if name is not a String' do
|
55
|
+
lambda{@server.start_service(11)}.should raise_error Dde::Errors::ServiceError
|
56
|
+
@server.service_active?.should == false
|
57
|
+
end
|
58
|
+
end # context 'with active (initialized) DDE:'
|
59
|
+
end # describe '#start_service'
|
60
|
+
|
61
|
+
describe '#stop_service' do
|
62
|
+
context 'with inactive (uninitialized) DDE:' do
|
63
|
+
it 'fails to stop service' do
|
64
|
+
lambda{@server.stop_service}.should raise_error Dde::Errors::ServiceError
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'with active (initialized) DDE: and already registered DDE service: "myservice"' do
|
69
|
+
before(:each){ @server = described_class.new {|*args|}; @server.start_service('myservice')}
|
70
|
+
after(:each){ @server.stop_service if @server.service_active?}
|
71
|
+
|
72
|
+
it 'stops previously registered service' do
|
73
|
+
@server.stop_service.should be_true
|
74
|
+
|
75
|
+
@server.service.should == nil
|
76
|
+
@server.service_active?.should == false
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'does not stop DDE instance' do
|
80
|
+
@server.stop_service
|
81
|
+
@server.id.should_not == nil
|
82
|
+
@server.dde_active?.should == true
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'returns self if success (allows method chain)' do
|
86
|
+
@server.stop_service.should == @server
|
87
|
+
end
|
88
|
+
end # context 'with active (initialized) DDE: and already registered DDE service: "myservice"'
|
89
|
+
end # describe '#stop_service'
|
90
|
+
end # context 'specific to Servers:'
|
91
|
+
end # shared_examples_for "DDE Server"
|
92
92
|
end
|
data/spec/dde/server_spec.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/server_shared')
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
describe
|
7
|
-
it_should_behave_like "DDE Server"
|
8
|
-
end
|
9
|
-
|
10
|
-
describe
|
11
|
-
before(:each ){ @server =
|
12
|
-
after(:each) do
|
13
|
-
@server.stop_service if @server.service_active?
|
14
|
-
@server.stop_dde if @server.dde_active?
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'new without parameters creates Server but does not activate DDEML or start service' do
|
18
|
-
@server.id.should == nil
|
19
|
-
@server.service.should == nil
|
20
|
-
@server.dde_active?.should == false
|
21
|
-
@server.service_active?.should == false
|
22
|
-
end
|
23
|
-
|
24
|
-
describe '#start_service' do
|
25
|
-
|
26
|
-
it 'service name should be given explicitly' do
|
27
|
-
expect{@server.start_dde{|*args|}.start_service}.to raise_error ArgumentError, /0 for 1/
|
28
|
-
expect{@server.start_service {|*args|}}.to raise_error ArgumentError, /0 for 1/
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'callback block should be given explicitly' do
|
32
|
-
lambda{@server.start_service('myservice')}.should raise_error
|
33
|
-
@server.service_active?.should == false
|
34
|
-
end
|
35
|
-
end #describe '#start_service'
|
36
|
-
end # describe
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/server_shared')
|
3
|
+
|
4
|
+
module DdeTest
|
5
|
+
|
6
|
+
describe Dde::Server, ' in general:' do
|
7
|
+
it_should_behave_like "DDE Server"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Dde::Server do
|
11
|
+
before(:each ){ @server = Dde::Server.new }
|
12
|
+
after(:each) do
|
13
|
+
@server.stop_service if @server.service_active?
|
14
|
+
@server.stop_dde if @server.dde_active?
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'new without parameters creates Server but does not activate DDEML or start service' do
|
18
|
+
@server.id.should == nil
|
19
|
+
@server.service.should == nil
|
20
|
+
@server.dde_active?.should == false
|
21
|
+
@server.service_active?.should == false
|
22
|
+
end
|
23
|
+
|
24
|
+
describe '#start_service' do
|
25
|
+
|
26
|
+
it 'service name should be given explicitly' do
|
27
|
+
expect{@server.start_dde{|*args|}.start_service}.to raise_error ArgumentError, /0 for 1/
|
28
|
+
expect{@server.start_service {|*args|}}.to raise_error ArgumentError, /0 for 1/
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'callback block should be given explicitly' do
|
32
|
+
lambda{@server.start_service('myservice')}.should raise_error Dde::Errors::ServiceError
|
33
|
+
@server.service_active?.should == false
|
34
|
+
end
|
35
|
+
end #describe '#start_service'
|
36
|
+
end # describe Dde::Server do
|
37
37
|
end
|
data/spec/dde/xl_server_spec.rb
CHANGED
@@ -1,63 +1,63 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/server_shared')
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
describe
|
7
|
-
it_should_behave_like "DDE Server"
|
8
|
-
end
|
9
|
-
|
10
|
-
describe
|
11
|
-
before(:each ){ @server =
|
12
|
-
after(:each) do
|
13
|
-
@server.stop_service if @server.service_active?
|
14
|
-
@server.stop_dde if @server.dde_active?
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'new without parameters has empty data attribute' do
|
18
|
-
@server.data.should be_an
|
19
|
-
@server.data.should be_empty
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'new with attached callback block has empty data attribute' do
|
23
|
-
server =
|
24
|
-
@server.data.should be_an
|
25
|
-
@server.data.should be_empty
|
26
|
-
end
|
27
|
-
|
28
|
-
describe '#start_service' do
|
29
|
-
context 'with inactive (uninitialized) DDE:' do
|
30
|
-
it 'service name defaults to "excel" if not given explicitly' do
|
31
|
-
@server.start_service {|*args|}.should be_true
|
32
|
-
|
33
|
-
@server.service.should be_a
|
34
|
-
@server.service.should == 'excel'
|
35
|
-
@server.service.name.should == 'excel'
|
36
|
-
@server.service.handle.should be_an Integer
|
37
|
-
@server.service.handle.should_not == 0
|
38
|
-
@server.service_active?.should == true
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'starts new service with default callback block' do
|
42
|
-
@server.start_service('myservice1')
|
43
|
-
@server.service_active?.should == true
|
44
|
-
@server.service.name.should == 'myservice1'
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
context 'with active (initialized) DDE:' do
|
49
|
-
before(:each ){ @server =
|
50
|
-
|
51
|
-
it 'service name defaults to "excel" if not given explicitly' do
|
52
|
-
@server.start_service.should be_true
|
53
|
-
|
54
|
-
@server.service.should be_a
|
55
|
-
@server.service.should == 'excel'
|
56
|
-
@server.service.name.should == 'excel'
|
57
|
-
@server.service.handle.should be_an Integer
|
58
|
-
@server.service.handle.should_not == 0
|
59
|
-
end
|
60
|
-
end # context 'with active (initialized) DDE:'
|
61
|
-
end # describe '#start_service'
|
62
|
-
end # describe
|
63
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/server_shared')
|
3
|
+
|
4
|
+
module DdeTest
|
5
|
+
|
6
|
+
describe Dde::XlServer, ' in general:' do
|
7
|
+
it_should_behave_like "DDE Server"
|
8
|
+
end
|
9
|
+
|
10
|
+
describe Dde::XlServer do
|
11
|
+
before(:each ){ @server = Dde::XlServer.new }
|
12
|
+
after(:each) do
|
13
|
+
@server.stop_service if @server.service_active?
|
14
|
+
@server.stop_dde if @server.dde_active?
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'new without parameters has empty data attribute' do
|
18
|
+
@server.data.should be_an Dde::XlTable
|
19
|
+
@server.data.should be_empty
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'new with attached callback block has empty data attribute' do
|
23
|
+
server = Dde::XlServer.new {|*args|}
|
24
|
+
@server.data.should be_an Dde::XlTable
|
25
|
+
@server.data.should be_empty
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#start_service' do
|
29
|
+
context 'with inactive (uninitialized) DDE:' do
|
30
|
+
it 'service name defaults to "excel" if not given explicitly' do
|
31
|
+
@server.start_service {|*args|}.should be_true
|
32
|
+
|
33
|
+
@server.service.should be_a Dde::DdeString
|
34
|
+
@server.service.should == 'excel'
|
35
|
+
@server.service.name.should == 'excel'
|
36
|
+
@server.service.handle.should be_an Integer
|
37
|
+
@server.service.handle.should_not == 0
|
38
|
+
@server.service_active?.should == true
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'starts new service with default callback block' do
|
42
|
+
@server.start_service('myservice1')
|
43
|
+
@server.service_active?.should == true
|
44
|
+
@server.service.name.should == 'myservice1'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with active (initialized) DDE:' do
|
49
|
+
before(:each ){ @server = Dde::XlServer.new {|*args|}}
|
50
|
+
|
51
|
+
it 'service name defaults to "excel" if not given explicitly' do
|
52
|
+
@server.start_service.should be_true
|
53
|
+
|
54
|
+
@server.service.should be_a Dde::DdeString
|
55
|
+
@server.service.should == 'excel'
|
56
|
+
@server.service.name.should == 'excel'
|
57
|
+
@server.service.handle.should be_an Integer
|
58
|
+
@server.service.handle.should_not == 0
|
59
|
+
end
|
60
|
+
end # context 'with active (initialized) DDE:'
|
61
|
+
end # describe '#start_service'
|
62
|
+
end # describe Dde::XlServer
|
63
|
+
end
|