ferocia-rubywmq 1.1.3 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +0 -4
- data/LICENSE.txt +201 -0
- data/README.md +408 -0
- data/Rakefile +91 -0
- data/examples/each_a.rb +1 -17
- data/examples/each_b.rb +1 -17
- data/examples/each_header.rb +3 -19
- data/examples/files_to_q.rb +1 -17
- data/examples/get_a.rb +1 -17
- data/examples/get_client.rb +5 -21
- data/examples/put1_a.rb +1 -17
- data/examples/put1_b.rb +1 -17
- data/examples/put1_c.rb +3 -19
- data/examples/put_a.rb +1 -17
- data/examples/put_b.rb +1 -17
- data/examples/put_dlh.rb +4 -20
- data/examples/put_dynamic_q.rb +1 -17
- data/examples/put_group_a.rb +1 -17
- data/examples/put_group_b.rb +1 -17
- data/examples/put_rfh.rb +12 -28
- data/examples/put_rfh2_a.rb +5 -21
- data/examples/put_rfh2_b.rb +5 -21
- data/examples/put_xmit_q.rb +2 -18
- data/examples/q_to_files.rb +1 -17
- data/examples/request.rb +7 -23
- data/examples/server.rb +10 -26
- data/ext/extconf.rb +26 -46
- data/ext/extconf_client.rb +3 -19
- data/ext/generate/generate_const.rb +16 -43
- data/ext/generate/generate_reason.rb +23 -36
- data/ext/generate/generate_structs.rb +7 -22
- data/ext/generate/wmq_structs.erb +28 -58
- data/ext/wmq.c +1 -4
- data/ext/wmq.h +5 -1
- data/ext/wmq_message.c +1 -1
- data/ext/wmq_mq_load.c +1 -1
- data/ext/wmq_queue.c +1 -1
- data/ext/wmq_queue_manager.c +3 -3
- data/lib/rubywmq.rb +1 -0
- data/lib/wmq.rb +13 -26
- data/lib/wmq/message.rb +70 -0
- data/{ext/lib/wmq_temp.rb → lib/wmq/queue_manager.rb} +11 -98
- data/lib/wmq/version.rb +3 -0
- data/tests/test.rb +30 -40
- metadata +10 -20
- data/LICENSE +0 -13
- data/Manifest.txt +0 -20
- data/README +0 -73
- data/ext/build.bat +0 -3
- data/ext/build.sh +0 -6
- data/rubywmq.binary.gemspec +0 -32
- data/rubywmq.gemspec +0 -33
data/ext/extconf.rb
CHANGED
@@ -1,52 +1,32 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
################################################################################
|
1
|
+
require 'mkmf'
|
2
|
+
generate_sources_path = File.join(File.dirname(__FILE__), 'generate')
|
3
|
+
$LOAD_PATH.unshift generate_sources_path
|
4
|
+
require 'generate_reason'
|
5
|
+
require 'generate_const'
|
6
|
+
require 'generate_structs'
|
16
7
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# create a blank Makefile to satisfy extension install requirements
|
22
|
-
File.open("Makefile", "w") { |f| f << 'install:' }
|
8
|
+
include_path = ''
|
9
|
+
if RUBY_PLATFORM =~ /win|mingw/i
|
10
|
+
include_path = 'C:\Program Files\IBM\WebSphere MQ\tools\c\include'
|
11
|
+
dir_config('mqm', include_path, '.')
|
23
12
|
else
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
include_path = ''
|
30
|
-
if RUBY_PLATFORM =~ /mswin32/
|
31
|
-
include_path = 'C:\Program Files\IBM\WebSphere MQ\Tools\c\include'
|
32
|
-
dir_config('mqm', include_path, '.')
|
33
|
-
else
|
34
|
-
include_path = '/opt/mqm/inc'
|
35
|
-
#dir_config('mqm', include_path, '/opt/mqm/lib')
|
36
|
-
end
|
13
|
+
include_path = '/opt/mqm/inc'
|
14
|
+
lib64_path = '/opt/mqm/lib64'
|
15
|
+
lib_path = File.directory?(lib64_path) ? lib64_path : '/opt/mqm/lib'
|
16
|
+
dir_config('mqm', include_path, lib_path)
|
17
|
+
end
|
37
18
|
|
38
|
-
|
19
|
+
have_header('cmqc.h')
|
39
20
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
21
|
+
# Check for WebSphere MQ Server library
|
22
|
+
unless (RUBY_PLATFORM =~ /win/i) || (RUBY_PLATFORM =~ /solaris/i) || (RUBY_PLATFORM =~ /linux/i)
|
23
|
+
have_library('mqm')
|
24
|
+
end
|
44
25
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
26
|
+
# Generate Source Files
|
27
|
+
GenerateReason.generate(include_path+'/')
|
28
|
+
GenerateConst.generate(include_path+'/', File.dirname(__FILE__) + '/../lib/wmq')
|
29
|
+
GenerateStructs.new(include_path+'/', generate_sources_path).generate
|
49
30
|
|
50
|
-
|
51
|
-
|
52
|
-
end
|
31
|
+
# Generate Makefile
|
32
|
+
create_makefile('wmq/wmq')
|
data/ext/extconf_client.rb
CHANGED
@@ -1,21 +1,5 @@
|
|
1
|
-
################################################################################
|
2
|
-
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
3
1
|
#
|
4
|
-
#
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
################################################################################
|
16
|
-
|
17
|
-
#
|
18
|
-
# NOTE: Do NOT use this file unless the platform being requested is not supported
|
2
|
+
# NOTE: Do NOT use this file unless the platform being used is not supported
|
19
3
|
# directly by Ruby WMQ. Ruby WMQ already supports automatic dynamic loading on
|
20
4
|
# Windows, Solaris and Linux
|
21
5
|
#
|
@@ -29,12 +13,12 @@ unless (RUBY_PLATFORM =~ /win/i) || (RUBY_PLATFORM =~ /solaris/i) || (RUBY_PLATF
|
|
29
13
|
include_path = '/opt/mqm/inc'
|
30
14
|
dir_config('mqm', include_path, '/opt/mqm/lib')
|
31
15
|
have_library('mqic')
|
32
|
-
|
16
|
+
|
33
17
|
# Generate Source Files # Could check if not already present
|
34
18
|
GenerateReason.generate(include_path+'/')
|
35
19
|
GenerateConst.generate(include_path+'/', '../../lib/wmq')
|
36
20
|
GenerateStructs.new(include_path+'/', '../../generate').generate
|
37
|
-
|
21
|
+
|
38
22
|
have_header('cmqc.h')
|
39
23
|
create_makefile('wmq_client')
|
40
24
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# Extract Constants from the WebSphere MQ header files
|
1
2
|
class GenerateConst
|
2
|
-
|
3
|
-
#Extract Constants from Header files
|
3
|
+
|
4
|
+
# Extract Constants from Header files
|
4
5
|
def GenerateConst.extract_const(filename, const_prefix, start_exp=nil, end_exp=nil)
|
5
6
|
@constants = []
|
6
7
|
active = if start_exp then false else true end # Sure there is a better way
|
@@ -23,8 +24,8 @@ class GenerateConst
|
|
23
24
|
end
|
24
25
|
@constants
|
25
26
|
end
|
26
|
-
|
27
|
-
#Extract MQ Constants from Header files
|
27
|
+
|
28
|
+
# Extract MQ Constants from Header files
|
28
29
|
def GenerateConst.rb_const(filename, const_prefix, exclude_exp=nil)
|
29
30
|
str = ''
|
30
31
|
GenerateConst.extract_const(filename, const_prefix).each do |item|
|
@@ -42,7 +43,7 @@ class GenerateConst
|
|
42
43
|
end
|
43
44
|
str
|
44
45
|
end
|
45
|
-
|
46
|
+
|
46
47
|
def GenerateConst.config(filename, prefix)
|
47
48
|
str = "# WMQ::QueueManager execute commands\n"
|
48
49
|
str << "execute_commands:\n"
|
@@ -55,24 +56,10 @@ class GenerateConst
|
|
55
56
|
end
|
56
57
|
str
|
57
58
|
end
|
58
|
-
|
59
|
+
|
59
60
|
def GenerateConst.wmq_const(path)
|
60
61
|
str = <<END_OF_STRING
|
61
62
|
################################################################################
|
62
|
-
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
63
|
-
#
|
64
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
65
|
-
# you may not use this file except in compliance with the License.
|
66
|
-
# You may obtain a copy of the License at
|
67
|
-
#
|
68
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
69
|
-
#
|
70
|
-
# Unless required by applicable law or agreed to in writing, software
|
71
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
72
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
73
|
-
# See the License for the specific language governing permissions and
|
74
|
-
# limitations under the License.
|
75
|
-
################################################################################
|
76
63
|
#
|
77
64
|
# WARNING: DO NOT MODIFY THIS FILE
|
78
65
|
#
|
@@ -81,18 +68,18 @@ class GenerateConst
|
|
81
68
|
################################################################################
|
82
69
|
module WMQ
|
83
70
|
END_OF_STRING
|
84
|
-
[ ['Connect Options','cmqc.h','MQCNO_',/(VERSION)|(CONN_TAG)|(HANDLE_SHARE)/],
|
71
|
+
[ ['Connect Options','cmqc.h','MQCNO_',/(VERSION)|(CONN_TAG)|(HANDLE_SHARE)|(_LENGTH)/],
|
85
72
|
['Open Options', 'cmqc.h','MQOO_' ],
|
86
73
|
['Close Options', 'cmqc.h','MQCO_'],
|
87
74
|
['Match Options', 'cmqc.h','MQMO_'],
|
88
75
|
['Message Format Options', 'cmqc.h','MQFMT_',/(_ARRAY)/],
|
89
|
-
['Get Message Options', 'cmqc.h','MQGMO_',/(VERSION)/],
|
76
|
+
['Get Message Options', 'cmqc.h','MQGMO_',/(VERSION)|(LENGTH)|(MQGMO_BROWSE_HANDLE)|(MQGMO_BROWSE_CO_OP)/],
|
90
77
|
['Transport Types', 'cmqxc.h','MQXPT_'] ,
|
91
78
|
['Report Options', 'cmqc.h', 'MQRO_'],
|
92
79
|
['Message Types', 'cmqc.h', 'MQMT_'],
|
93
80
|
['Expiry', 'cmqc.h', 'MQEI_'],
|
94
81
|
['Feedback Values', 'cmqc.h', 'MQFB_'],
|
95
|
-
['Encoding Values', 'cmqc.h', 'MQENC_'],
|
82
|
+
['Encoding Values', 'cmqc.h', 'MQENC_',/(MQENC_NORMAL)|(MQENC_REVERSED)|(MQENC_S390)|(MQENC_TNS)/],
|
96
83
|
['Coded Character Set Identifiers', 'cmqc.h', 'MQCCSI_'],
|
97
84
|
['Priority', 'cmqc.h', 'MQPRI_'],
|
98
85
|
['Persistence', 'cmqc.h', 'MQPER_'],
|
@@ -108,24 +95,10 @@ END_OF_STRING
|
|
108
95
|
end
|
109
96
|
str << "end\n"
|
110
97
|
end
|
111
|
-
|
98
|
+
|
112
99
|
def GenerateConst.admin_consts(path)
|
113
100
|
str = <<END_OF_STRING
|
114
101
|
################################################################################
|
115
|
-
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
116
|
-
#
|
117
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
118
|
-
# you may not use this file except in compliance with the License.
|
119
|
-
# You may obtain a copy of the License at
|
120
|
-
#
|
121
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
122
|
-
#
|
123
|
-
# Unless required by applicable law or agreed to in writing, software
|
124
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
125
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
126
|
-
# See the License for the specific language governing permissions and
|
127
|
-
# limitations under the License.
|
128
|
-
################################################################################
|
129
102
|
#
|
130
103
|
# WARNING: DO NOT MODIFY THIS FILE
|
131
104
|
#
|
@@ -142,7 +115,7 @@ END_OF_STRING
|
|
142
115
|
str << "\n# #{item[0]}\n"
|
143
116
|
str << GenerateConst.rb_const("#{path}/#{item[1]}", item[2], item[3])
|
144
117
|
end
|
145
|
-
GenerateConst.extract_const(path+'cmqc.h', 'MQ', /Queue\
|
118
|
+
GenerateConst.extract_const(path+'cmqc.h', 'MQ', /Queue\s+Attributes/, /General\s+Constants/).each do |item|
|
146
119
|
str << " %-30s = #{item[1]}\n" % item[0]
|
147
120
|
end
|
148
121
|
str << "# Admin constants from cmqcfc.h\n"
|
@@ -151,14 +124,14 @@ END_OF_STRING
|
|
151
124
|
end
|
152
125
|
str << "end\n"
|
153
126
|
end
|
154
|
-
|
127
|
+
|
155
128
|
def self.generate(path, target_path='')
|
156
|
-
File.open(File.join(target_path,'
|
129
|
+
File.open(File.join(target_path,'constants_admin.rb'), 'w') {|file| file.write(GenerateConst.admin_consts(path))}
|
157
130
|
puts 'Generated wmq_const_admin.rb'
|
158
|
-
File.open(File.join(target_path,'
|
131
|
+
File.open(File.join(target_path,'constants.rb'), 'w') {|file| file.write(GenerateConst.wmq_const(path))}
|
159
132
|
puts 'Generated wmq_const.rb'
|
160
133
|
end
|
161
|
-
end
|
134
|
+
end
|
162
135
|
|
163
136
|
if $0 == __FILE__
|
164
137
|
path = ARGV[0] || raise("Mandatory parameter: 'WebSphere MQ Include path' is missing")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class GenerateReason
|
2
2
|
|
3
|
-
#Extract Error Code Constants from Header files
|
3
|
+
# Extract Error Code Constants from Header files
|
4
4
|
def GenerateReason.extract_const(filename, const_prefix)
|
5
5
|
@constants = []
|
6
6
|
File.open(filename) do |file|
|
@@ -16,8 +16,8 @@ class GenerateReason
|
|
16
16
|
end
|
17
17
|
@constants
|
18
18
|
end
|
19
|
-
|
20
|
-
#Extract Error Code Constants from Header files
|
19
|
+
|
20
|
+
# Extract Error Code Constants from Header files
|
21
21
|
# Uses lazy print to collect duplicate values
|
22
22
|
def GenerateReason.reason_case(filename, prefix)
|
23
23
|
last_rc = nil
|
@@ -36,8 +36,8 @@ class GenerateReason
|
|
36
36
|
end
|
37
37
|
str
|
38
38
|
end
|
39
|
-
|
40
|
-
# The WebSphere MQ header files have several duplicate values,
|
39
|
+
|
40
|
+
# The WebSphere MQ header files have several duplicate values,
|
41
41
|
# so need to exclude duplicates.
|
42
42
|
def GenerateReason.selector_case(filename, prefix, excludes=nil, &block)
|
43
43
|
GenerateReason.extract_const(filename,prefix).each do |item|
|
@@ -46,24 +46,10 @@ class GenerateReason
|
|
46
46
|
block.call item
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
def GenerateReason.wmq_reason(path)
|
51
51
|
str = <<END_OF_STRING
|
52
52
|
/* --------------------------------------------------------------------------
|
53
|
-
* Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
54
|
-
*
|
55
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
56
|
-
* you may not use this file except in compliance with the License.
|
57
|
-
* You may obtain a copy of the License at
|
58
|
-
*
|
59
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
60
|
-
*
|
61
|
-
* Unless required by applicable law or agreed to in writing, software
|
62
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
63
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
64
|
-
* See the License for the specific language governing permissions and
|
65
|
-
* limitations under the License.
|
66
|
-
* --------------------------------------------------------------------------
|
67
53
|
*
|
68
54
|
* WARNING: DO NOT MODIFY THIS FILE
|
69
55
|
*
|
@@ -97,9 +83,10 @@ END_OF_STRING
|
|
97
83
|
[['cmqc.h', 'MQIA_'],
|
98
84
|
['cmqcfc.h', 'MQIACF_', ['MQIACF_ERROR_ID',
|
99
85
|
'MQIACF_QUIESCE']],
|
100
|
-
['cmqcfc.h', 'MQIACH_', ['MQIACH_CURRENT_SEQ_NUMBER',
|
101
|
-
'MQIACH_BYTES_RCVD',
|
102
|
-
'MQIACH_BUFFERS_RCVD'
|
86
|
+
['cmqcfc.h', 'MQIACH_', ['MQIACH_CURRENT_SEQ_NUMBER',
|
87
|
+
'MQIACH_BYTES_RCVD',
|
88
|
+
'MQIACH_BUFFERS_RCVD',
|
89
|
+
'MQIACH_MSGS_RCVD']],
|
103
90
|
['cmqcfc.h', 'MQIAMO_'],
|
104
91
|
['cmqcfc.h', 'MQIAMO64_', ['MQIAMO64_AVG_Q_TIME',
|
105
92
|
'MQIAMO64_Q_TIME_AVG',
|
@@ -125,7 +112,7 @@ END_OF_STRING
|
|
125
112
|
str_switch << " case %-30s: return ID_#{id};\n" % const[0]
|
126
113
|
str_id_init << " ID_%-25s = rb_intern(\"#{id}\");\n" % id
|
127
114
|
str << "static ID ID_#{id};\n"
|
128
|
-
end
|
115
|
+
end
|
129
116
|
end
|
130
117
|
|
131
118
|
str << <<END_OF_STRING
|
@@ -156,8 +143,8 @@ END_OF_STRING
|
|
156
143
|
[['cmqc.h', 'MQIA_'],
|
157
144
|
['cmqcfc.h', 'MQIACF_', ['MQIACF_ERROR_ID',
|
158
145
|
'MQIACF_QUIESCE']],
|
159
|
-
['cmqcfc.h', 'MQIACH_', ['MQIACH_CURRENT_SEQ_NUMBER',
|
160
|
-
'MQIACH_BYTES_RCVD',
|
146
|
+
['cmqcfc.h', 'MQIACH_', ['MQIACH_CURRENT_SEQ_NUMBER',
|
147
|
+
'MQIACH_BYTES_RCVD',
|
161
148
|
'MQIACH_BUFFERS_RCVD']],
|
162
149
|
['cmqcfc.h', 'MQIAMO_'],
|
163
150
|
['cmqcfc.h', 'MQIAMO64_', ['MQIAMO64_AVG_Q_TIME',
|
@@ -169,8 +156,8 @@ END_OF_STRING
|
|
169
156
|
].each do |item|
|
170
157
|
str << " /* Consteants #{item[1]}* from #{item[0]} */\n"
|
171
158
|
GenerateReason.selector_case(path+item[0], item[1], item[2]) do |const|
|
172
|
-
str << " if(selector_id == %-32s{ *selector = #{const[0]}; return;}\n" % "ID_#{const[0].gsub(item[1],'').downcase})"
|
173
|
-
end
|
159
|
+
str << " if(selector_id == %-32s{ *selector = #{const[0]}; return;}\n" % "ID_#{const[0].gsub(item[1],'').downcase})"
|
160
|
+
end
|
174
161
|
end
|
175
162
|
str << "\n *selector_type = MQIT_STRING;\n\n"
|
176
163
|
# Character Selectors for Object Attributes
|
@@ -182,16 +169,16 @@ END_OF_STRING
|
|
182
169
|
# ['cmqc.h', 'MQBA_'],
|
183
170
|
# ['cmqcfc.h', 'MQBACF_'],
|
184
171
|
# Group Selectors for Object Attributes
|
185
|
-
# ['cmqcfc.h', 'MQGACF_']
|
172
|
+
# ['cmqcfc.h', 'MQGACF_']
|
186
173
|
].each do |item|
|
187
174
|
str << " /* Constants #{item[1]}* from #{item[0]} */\n"
|
188
175
|
GenerateReason.selector_case(path+item[0], item[1], item[2]) do |const|
|
189
|
-
str << " if(selector_id == %-32s{ *selector = #{const[0]}; return;}\n" % "ID_#{const[0].gsub(item[1],'').downcase})"
|
190
|
-
end
|
176
|
+
str << " if(selector_id == %-32s{ *selector = #{const[0]}; return;}\n" % "ID_#{const[0].gsub(item[1],'').downcase})"
|
177
|
+
end
|
191
178
|
end
|
192
179
|
|
193
180
|
str << <<END_OF_STRING
|
194
|
-
|
181
|
+
|
195
182
|
rb_raise(rb_eArgError, "WMQ::QueueManager#execute [wmq_selector] Unknown selector supplied");
|
196
183
|
}
|
197
184
|
|
@@ -208,9 +195,9 @@ END_OF_STRING
|
|
208
195
|
end
|
209
196
|
id = const[0].gsub('MQCMD_','').downcase
|
210
197
|
str_id_init << " ID_%-25s = rb_intern(\"#{id}\");\n" % id
|
211
|
-
str_if << "if(command_id == %-28s{ command = #{const[0]}; }\n" % "ID_#{const[0].gsub('MQCMD_','').downcase})"
|
198
|
+
str_if << "if(command_id == %-28s{ command = #{const[0]}; }\n" % "ID_#{const[0].gsub('MQCMD_','').downcase})"
|
212
199
|
str << "static ID ID_#{id};\n"
|
213
|
-
end
|
200
|
+
end
|
214
201
|
str << <<END_OF_STRING
|
215
202
|
|
216
203
|
void QueueManager_command_id_init()
|
@@ -221,7 +208,7 @@ void QueueManager_command_id_init()
|
|
221
208
|
MQLONG wmq_command_lookup(ID command_id)
|
222
209
|
{
|
223
210
|
MQLONG command = 0;
|
224
|
-
#{str_if}
|
211
|
+
#{str_if}
|
225
212
|
else
|
226
213
|
{
|
227
214
|
rb_raise(rb_eArgError, "WMQ::QueueManager#execute [wmq_command_lookup] Unknown command supplied");
|
@@ -232,7 +219,7 @@ MQLONG wmq_command_lookup(ID command_id)
|
|
232
219
|
END_OF_STRING
|
233
220
|
str
|
234
221
|
end
|
235
|
-
|
222
|
+
|
236
223
|
def self.generate(path)
|
237
224
|
File.open('wmq_reason.c', 'w') {|file| file.write(GenerateReason.wmq_reason(path))}
|
238
225
|
puts 'Generated wmq_reason.c'
|
@@ -1,30 +1,15 @@
|
|
1
|
-
################################################################################
|
2
|
-
# Copyright 2006 J. Reid Morrison. Dimension Solutions, Inc.
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
################################################################################
|
16
1
|
require 'erb'
|
17
2
|
|
18
3
|
class GenerateStructs
|
19
|
-
|
4
|
+
|
20
5
|
@@field_ignore_list = [ 'StrucId', 'Version' , 'StrucLength']
|
21
|
-
|
6
|
+
|
22
7
|
# Store path to WebSphere MQ Structures
|
23
8
|
def initialize(wmq_includepath, templates_path='.')
|
24
9
|
@path = wmq_includepath
|
25
10
|
@templates_path = templates_path
|
26
11
|
end
|
27
|
-
|
12
|
+
|
28
13
|
def extract_struct (filename, struct_name)
|
29
14
|
properties_list = []
|
30
15
|
line_number = 0
|
@@ -51,7 +36,7 @@ class GenerateStructs
|
|
51
36
|
end
|
52
37
|
properties_list
|
53
38
|
end
|
54
|
-
|
39
|
+
|
55
40
|
def rubyize_name(name)
|
56
41
|
name.gsub(/::/, '/').
|
57
42
|
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
@@ -59,7 +44,7 @@ class GenerateStructs
|
|
59
44
|
tr("-", "_").
|
60
45
|
downcase
|
61
46
|
end
|
62
|
-
|
47
|
+
|
63
48
|
def self.test_rubyize_name
|
64
49
|
test = self.new
|
65
50
|
[['a', 'a'],
|
@@ -75,11 +60,11 @@ class GenerateStructs
|
|
75
60
|
raise("rubyize_name('#{item[0]}') == #{str} != '#{item[1]})") if str != item[1]
|
76
61
|
end
|
77
62
|
end
|
78
|
-
|
63
|
+
|
79
64
|
def generate_structs(erb)
|
80
65
|
erb.result(binding)
|
81
66
|
end
|
82
|
-
|
67
|
+
|
83
68
|
def generate(target_filename = 'wmq_structs.c')
|
84
69
|
erb = nil
|
85
70
|
File.open(@templates_path+'/wmq_structs.erb') { |file| erb = ERB.new(file.read) }
|