ridl 2.5.6 → 2.8.1

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.
data/lib/ridl/type.rb CHANGED
@@ -8,7 +8,6 @@
8
8
  # included with this program.
9
9
  #
10
10
  # Copyright (c) Remedy IT Expertise BV
11
- # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
11
  #--------------------------------------------------------------------
13
12
  module IDL
14
13
  class Type
@@ -16,7 +15,7 @@ module IDL
16
15
  self.class.name
17
16
  end
18
17
  def typeerror(val)
19
- raise RuntimeError, "#{val.inspect} cannot narrow to #{self.typename}"
18
+ raise "#{val.inspect} cannot narrow to #{self.typename}"
20
19
  end
21
20
  def narrow(obj)
22
21
  obj
@@ -42,14 +41,17 @@ module IDL
42
41
  def is_template?
43
42
  false
44
43
  end
44
+ def matches?(idltype)
45
+ self.class == idltype.class
46
+ end
45
47
 
46
- def instantiate(_context)
48
+ def instantiate(_)
47
49
  self
48
50
  end
49
51
 
50
52
  class UndefinedType
51
53
  def initialize(*args)
52
- raise RuntimeError, "#{self.class.name}'s not implemented yet."
54
+ raise "#{self.class.name}'s not implemented yet."
53
55
  end
54
56
  end
55
57
 
@@ -63,6 +65,7 @@ module IDL
63
65
  class NodeType < Type
64
66
  attr_reader :node
65
67
  def initialize(node)
68
+ raise node.inspect if node && !node.is_a?(IDL::AST::Leaf)
66
69
  @node = node
67
70
  end
68
71
  def is_local?(recurstk = nil)
@@ -74,6 +77,9 @@ module IDL
74
77
  def resolved_node
75
78
  @node
76
79
  end
80
+ def matches?(idltype)
81
+ super && self.resolved_node == idltype.resolved_node
82
+ end
77
83
  end
78
84
 
79
85
  class ScopedName < NodeType
@@ -101,9 +107,9 @@ module IDL
101
107
  def is_template?
102
108
  @node.is_template?
103
109
  end
104
- def instantiate(_context)
110
+ def instantiate(instantiation_context)
105
111
  if self.is_template?
106
- cp = IDL::AST::TemplateParam.concrete_param(_context, @node)
112
+ cp = IDL::AST::TemplateParam.concrete_param(instantiation_context, @node)
107
113
  cp.is_a?(Type) ? cp : ScopedName.new(cp)
108
114
  else
109
115
  self
@@ -217,7 +223,7 @@ module IDL
217
223
  class Fixed < Type
218
224
  attr_reader :digits, :scale
219
225
  def initialize(digits=nil, scale=nil)
220
- raise RuntimeError, "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i
226
+ raise "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i
221
227
  @digits = digits.nil? ? digits : digits.to_i
222
228
  @scale = scale.nil? ? scale : scale.to_i
223
229
  end
@@ -231,8 +237,8 @@ module IDL
231
237
  def is_template?
232
238
  (@size && @size.is_a?(IDL::Expression) && @size.is_template?)
233
239
  end
234
- def instantiate(_context)
235
- self.is_template? ? (Type::Fixed.new(@size.instantiate(_context).value)) : self
240
+ def instantiate(instantiation_context)
241
+ self.is_template? ? (Type::Fixed.new(@size.instantiate(instantiation_context).value)) : self
236
242
  end
237
243
  end
238
244
 
@@ -259,8 +265,11 @@ module IDL
259
265
  def is_template?
260
266
  (@size && @size.is_a?(IDL::Expression) && @size.is_template?)
261
267
  end
262
- def instantiate(_context)
263
- self.is_template? ? (Type::String.new(@size.instantiate(_context).value)) : self
268
+ def matches?(idltype)
269
+ super && self.size == idltype.size
270
+ end
271
+ def instantiate(instantiation_context)
272
+ self.is_template? ? (Type::String.new(@size.instantiate(instantiation_context).value)) : self
264
273
  end
265
274
  end
266
275
 
@@ -269,7 +278,7 @@ module IDL
269
278
  attr_accessor :recursive
270
279
  def length; @size; end
271
280
  def initialize(t, size)
272
- raise RuntimeError, "Anonymous type definitions are not allowed!" if t.is_anonymous?
281
+ raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
273
282
  @basetype = t
274
283
  @size = size
275
284
  @typename = format("sequence<%s%s>", t.typename,
@@ -301,8 +310,15 @@ module IDL
301
310
  def is_template?
302
311
  (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam)) || @basetype.is_template?
303
312
  end
304
- def instantiate(_context)
305
- self.is_template? ? Type::Sequence.new(@basetype.instantiate(_context), @size.instantiate(_context).value) : self
313
+ def matches?(idltype)
314
+ super && self.size == idltype.size && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
315
+ end
316
+ def instantiate(instantiation_context)
317
+ if self.is_template?
318
+ Type::Sequence.new(@basetype.instantiate(instantiation_context), @size ? @size.instantiate(instantiation_context).value : nil)
319
+ else
320
+ self
321
+ end
306
322
  end
307
323
  end
308
324
 
@@ -310,7 +326,7 @@ module IDL
310
326
  attr_reader :basetype
311
327
  attr_reader :sizes
312
328
  def initialize(t, sizes)
313
- raise RuntimeError, "Anonymous type definitions are not allowed!" if t.is_anonymous?
329
+ raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
314
330
  @basetype = t
315
331
  if sizes.nil?
316
332
  @sizes = []
@@ -338,8 +354,11 @@ module IDL
338
354
  def is_template?
339
355
  @sizes.any? { |sz| (sz.is_a?(IDL::Expression::ScopedName) && sz.node.is_a?(IDL::AST::TemplateParam)) } || @basetype.is_template?
340
356
  end
341
- def instantiate(_context)
342
- self.is_template? ? Type::Array.new(@basetype.instantiate(_context), @sizes.collect { |sz| sz.instantiate(_context).value }) : self
357
+ def matches?(idltype)
358
+ super && self.sizes == idltype.sizes && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
359
+ end
360
+ def instantiate(instantiation_context)
361
+ self.is_template? ? Type::Array.new(@basetype.instantiate(instantiation_context), @sizes.collect { |sz| sz.instantiate(instantiation_context).value }) : self
343
362
  end
344
363
  end
345
364
 
@@ -366,8 +385,11 @@ module IDL
366
385
  def is_template?
367
386
  (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam))
368
387
  end
369
- def instantiate(_context)
370
- self.is_template? ? Type::WString.new(@size.instantiate(_context).value) : self
388
+ def matches?(idltype)
389
+ super && self.size == idltype.size
390
+ end
391
+ def instantiate(instantiation_context)
392
+ self.is_template? ? Type::WString.new(@size.instantiate(instantiation_context).value) : self
371
393
  end
372
394
  end
373
395
 
@@ -458,7 +480,7 @@ module IDL
458
480
  0
459
481
  end
460
482
  def max
461
- @node.enumerators.length-1
483
+ @node.enumerators.length - 1
462
484
  end
463
485
  def in_range?(val)
464
486
  val >= self.min && val <= self.max
@@ -492,8 +514,8 @@ module IDL
492
514
  def is_template?
493
515
  @type.is_template?
494
516
  end
495
- def instantiate(_context)
496
- self.is_template? ? Type::Const.new(@type.instantiate(_context)) : self
517
+ def instantiate(instantiation_context)
518
+ self.is_template? ? Type::Const.new(@type.instantiate(instantiation_context)) : self
497
519
  end
498
520
  def is_node?(node_class)
499
521
  @type.is_node?(node_class)
@@ -501,6 +523,9 @@ module IDL
501
523
  def resolved_node
502
524
  @type.resolved_node
503
525
  end
526
+ def matches?(idltype)
527
+ super && self.type.resolved_type.matches?(idltype.type.resolved_type)
528
+ end
504
529
  end
505
530
 
506
531
  end
data/lib/ridl/version.rb CHANGED
@@ -8,14 +8,13 @@
8
8
  # included with this program.
9
9
  #
10
10
  # Copyright (c) Remedy IT Expertise BV
11
- # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
11
  #--------------------------------------------------------------------
13
12
 
14
13
  module IDL
15
14
 
16
- RIDL_VERSION_MAJOR = 2.freeze
17
- RIDL_VERSION_MINOR = 5.freeze
18
- RIDL_VERSION_RELEASE = 6.freeze
15
+ RIDL_VERSION_MAJOR = 2
16
+ RIDL_VERSION_MINOR = 8
17
+ RIDL_VERSION_RELEASE = 1
19
18
  RIDL_VERSION = "#{RIDL_VERSION_MAJOR}.#{RIDL_VERSION_MINOR}.#{RIDL_VERSION_RELEASE}"
20
19
  RIDL_COPYRIGHT = "Copyright (c) 2007-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
21
20
 
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ridl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.6
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
+ - Johnny Willemsen
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
12
+ date: 2021-08-11 00:00:00.000000000 Z
12
13
  dependencies: []
13
- description: OMG v. 3.3 compliant native Ruby IDL compiler frontend with support for
14
+ description: OMG v3.3 compliant native Ruby IDL compiler frontend with support for
14
15
  pluggable (and stackable) backends.
15
16
  email: mcorino@remedy.nl
16
17
  executables: []
@@ -21,18 +22,12 @@ extra_rdoc_files:
21
22
  files:
22
23
  - LICENSE
23
24
  - README.rdoc
24
- - lib/idl/BiDirPolicy.pidl
25
- - lib/idl/CosNaming.idl
26
- - lib/idl/IOP.pidl
27
- - lib/idl/Messaging.pidl
28
- - lib/idl/PortableServer.pidl
29
- - lib/idl/TimeBase.pidl
30
- - lib/idl/orb.idl
31
25
  - lib/ridl/backend.rb
32
26
  - lib/ridl/delegate.rb
33
27
  - lib/ridl/expression.rb
34
28
  - lib/ridl/genfile.rb
35
29
  - lib/ridl/node.rb
30
+ - lib/ridl/options.rb
36
31
  - lib/ridl/optparse_ext.rb
37
32
  - lib/ridl/parser.diff
38
33
  - lib/ridl/parser.rb
@@ -43,31 +38,32 @@ files:
43
38
  - lib/ridl/scanner.rb
44
39
  - lib/ridl/type.rb
45
40
  - lib/ridl/version.rb
46
- homepage: https://osportal.remedy.nl/projects/ridl
41
+ homepage: https://www.remedy.nl/opensource/ridl.html
47
42
  licenses:
48
- - RIDL
49
- metadata: {}
43
+ - MIT
44
+ metadata:
45
+ bug_tracker_uri: https://github.com/RemedyIT/ridl/issues
46
+ source_code_uri: https://github.com/RemedyIT/ridl
50
47
  post_install_message:
51
48
  rdoc_options:
52
- - --main
49
+ - "--main"
53
50
  - README.rdoc
54
- - --exclude
55
- - \.(idl|pidl|diff|ry)
51
+ - "--exclude"
52
+ - "\\.(idl|pidl|diff|ry)"
56
53
  require_paths:
57
54
  - lib
58
55
  required_ruby_version: !ruby/object:Gem::Requirement
59
56
  requirements:
60
- - - '>='
57
+ - - ">="
61
58
  - !ruby/object:Gem::Version
62
- version: '0'
59
+ version: '2.0'
63
60
  required_rubygems_version: !ruby/object:Gem::Requirement
64
61
  requirements:
65
- - - '>='
62
+ - - ">="
66
63
  - !ruby/object:Gem::Version
67
64
  version: '0'
68
65
  requirements: []
69
- rubyforge_project:
70
- rubygems_version: 2.4.2
66
+ rubygems_version: 3.1.6
71
67
  signing_key:
72
68
  specification_version: 4
73
69
  summary: Ruby OMG IDL compiler
@@ -1,28 +0,0 @@
1
- /* This file contains OMG IDL from CORBA V2.3.1
2
- * $Id$
3
- */
4
-
5
- #ifndef __BiDirPolicy_IDL
6
- #define __BiDirPolicy_IDL
7
-
8
- #include <orb.idl>
9
-
10
- #pragma prefix "omg.org"
11
-
12
- // Self contained module for Bi-directional GIOP policy
13
-
14
- module BiDirPolicy {
15
-
16
- typedef unsigned short BidirectionalPolicyValue;
17
-
18
- const BidirectionalPolicyValue NORMAL = 0;
19
- const BidirectionalPolicyValue BOTH = 1;
20
-
21
- const CORBA::PolicyType BIDIRECTIONAL_POLICY_TYPE = 37;
22
-
23
- interface BidirectionalPolicy : CORBA::Policy {
24
- readonly attribute BidirectionalPolicyValue value;
25
- };
26
- };
27
-
28
- #endif /* __BiDirPolicy_IDL */
@@ -1,260 +0,0 @@
1
- // $Id$
2
-
3
- #ifndef COS_NAMING_IDL
4
- #define COS_NAMING_IDL
5
-
6
- #pragma prefix "omg.org"
7
-
8
- /**
9
- * This module provides interface for using COS Naming Service.
10
- */
11
- module CosNaming
12
- {
13
- /// Define a typedef for String. Maybe at some point, <Istring> will
14
- /// be different to support Internationalization.
15
- typedef string Istring;
16
-
17
- /*
18
- * This is a 'simple' name.
19
- *
20
- * Both id and kind fields are used in resolving names.
21
- */
22
- struct NameComponent
23
- {
24
- /// This is the name that is used to identify object references.
25
- Istring id;
26
-
27
- /// Stores any additional info about the object reference.
28
- Istring kind;
29
- };
30
-
31
- /// This is a compound name: <c1; c2; c3; cn> where c1 to cn-1 are
32
- /// the names of the nested contexts, and cn is the name of the
33
- /// object bound in cn-1.
34
- typedef sequence <NameComponent> Name;
35
-
36
- enum BindingType
37
- {
38
- /// object binding.
39
- nobject,
40
-
41
- /// Naming context binding.
42
- ncontext
43
- };
44
-
45
- struct Binding
46
- {
47
- /// Simple name, under which an object is bound in a given context.
48
- Name binding_name;
49
-
50
- /// Indicates whether the binding_name identifies a context, and, therefore, can
51
- /// participate in name resolution.
52
- BindingType binding_type;
53
- };
54
-
55
- typedef sequence <Binding> BindingList;
56
-
57
- // Forward declaration.
58
- interface BindingIterator;
59
-
60
- /// Interface for managing name bindings and naming contexts.
61
- interface NamingContext
62
- {
63
- // = Exceptions.
64
-
65
- enum NotFoundReason
66
- {
67
- missing_node,
68
- not_context,
69
- not_object
70
- };
71
-
72
- /// Indicates that the name does not identify a binding.
73
- exception NotFound
74
- {
75
-
76
- NotFoundReason why;
77
- Name rest_of_name;
78
- };
79
-
80
- /// Implementation may throw this exception if some reason it cannot
81
- /// complete the operation. This is currently not used in TAO.
82
- exception CannotProceed
83
- {
84
-
85
- NamingContext cxt;
86
- Name rest_of_name;
87
- };
88
-
89
- /// A name of length 0 is invalid. Implementations may place
90
- /// further restrictions.
91
- exception InvalidName
92
- {
93
- };
94
-
95
- /// Indicates that the specified name is already bound to
96
- /// some object. Only one object can be bound to a
97
- /// particular name in an context. To change the binding,
98
- /// <rebind> and <rebind_context> can be used.
99
- exception AlreadyBound
100
- {
101
- };
102
-
103
- /// Indicates that the context is not empty.
104
- exception NotEmpty
105
- {
106
- };
107
-
108
- // = Binding operations.
109
-
110
- /// Create a binding for name <n> and object <obj> in the naming
111
- /// context. Compound names are treated as follows: ctx->bind
112
- /// (<c1; c2; c3; cn>, obj) = (ctx->resolve (<c1; c2;
113
- /// cn-1>))->bind (<cn>, obj) if the there already exists a
114
- /// binding for the specified name, <AlreadyBound> exception is
115
- /// thrown. Naming contexts should be bound using <bind_context>
116
- /// and <rebind_context> in order to participate in name
117
- /// resolution later.
118
- void bind (in Name n, in Object obj)
119
- raises (NotFound, CannotProceed, InvalidName, AlreadyBound);
120
-
121
- /// This is similar to <bind> operation above, except for when
122
- /// the binding for the specified name already exists in the
123
- /// specified context. In that case, the existing binding is
124
- /// replaced with the new one.
125
- void rebind (in Name n, in Object obj)
126
- raises (NotFound, CannotProceed, InvalidName);
127
-
128
- /// This is the version of <bind> specifically for binding naming
129
- /// contexts, so that they will participate in name resolution
130
- /// when compound names are passed to be resolved.
131
- void bind_context (in Name n, in NamingContext nc)
132
- raises(NotFound, CannotProceed, InvalidName, AlreadyBound);
133
-
134
- /// This is a version of <rebind> specifically for naming
135
- /// contexts, so that they can participate in name resolution
136
- /// when compound names are passed.
137
- void rebind_context (in Name n, in NamingContext nc)
138
- raises (NotFound, CannotProceed, InvalidName);
139
-
140
- // = Resolving names.
141
-
142
- /// Return object reference that is bound to the name. Compound
143
- /// name resolve is defined as follows: ctx->resolve (<c1; c2;
144
- /// cn>) = ctx->resolve (<c1; c2 cn-1>)->resolve (<cn>) The
145
- /// naming service does not return the type of the object.
146
- /// Clients are responsible for "narrowing" the object to the
147
- /// appropriate type.
148
- Object resolve (in Name n)
149
- raises (NotFound, CannotProceed, InvalidName);
150
-
151
- // = Unbinding names.
152
-
153
- /// Remove the name binding from the context. When compound
154
- /// names are used, unbind is defined as follows: ctx->unbind
155
- /// (<c1; c2; cn>) = (ctx->resolve (<c1; c2; cn-1>))->unbind
156
- /// (<cn>)
157
- void unbind (in Name n)
158
- raises (NotFound, CannotProceed, InvalidName);
159
-
160
- // = Creating Naming Contexts.
161
-
162
- /// This operation returns a new naming context implemented by
163
- /// the same naming server in which the operation was invoked.
164
- /// The context is not bound.
165
- NamingContext new_context ();
166
-
167
- /// This operation creates a new context and binds it to the name
168
- /// supplied as an argument. The newly-created context is
169
- /// implemented by the same server as the context in which it was
170
- /// bound (the name argument excluding the last component).
171
- NamingContext bind_new_context (in Name n)
172
- raises (NotFound, AlreadyBound, CannotProceed, InvalidName);
173
-
174
- // = Deleting contexts.
175
-
176
- /// Delete the naming context. @note the user should <unbind>
177
- /// any bindings in which the given context is bound to some
178
- /// names before invoking <destroy> operation on it.
179
- void destroy ()
180
- raises (NotEmpty);
181
-
182
-
183
- // = Listing the naming context.
184
-
185
- /// Returns at most the requested number of bindings @a how_many
186
- /// in @a bl. If the naming context contains additional bindings,
187
- /// they are returned with a BindingIterator. In the naming
188
- /// context does not contain any additional bindings @a bi
189
- /// returned as null.
190
- void list (in unsigned long how_many,
191
- out BindingList bl,
192
- out BindingIterator bi);
193
- };
194
-
195
- /// Interface for iterating over Bindings returned with the
196
- /// <list> operation.
197
- interface BindingIterator
198
- {
199
- /// This operation returns the next binding. If there are no
200
- /// more bindings false is returned.
201
- boolean next_one (out Binding b);
202
-
203
- /// This operation returns at most the requested number of
204
- /// bindings.
205
- boolean next_n (in unsigned long how_many,
206
- out BindingList bl);
207
-
208
- /// This operation destroys the iterator.
209
- void destroy ();
210
- };
211
-
212
- /// Interface for providing operations required to use URLs and
213
- /// stringified names.
214
- ///
215
- /// Reference to: Document orbos/98-10-11 (Interoperable Naming Joint Revised Submission)
216
- /// Joint Submission by BEA Systems, DSTC, IONA, and Inprise
217
- interface NamingContextExt : NamingContext
218
- {
219
- /// Stringified form of a Name.
220
- typedef string StringName;
221
-
222
- /// URL address such as myhost.xyz.com.
223
- typedef string Address;
224
-
225
- /// Stringified form of a URL address componoent.
226
- typedef string URLString;
227
-
228
- /// This operation accepts a Name and returns a stringified
229
- /// name. If the name is invalid, an InvalidName exception is
230
- /// raised.
231
- StringName to_string (in Name n)
232
- raises (InvalidName);
233
-
234
- /// This operation returns a Name. If the input stringified
235
- /// name is syntactically malformed or violates an
236
- /// implementation limit, an InvalidName exception is
237
- /// raised.
238
- Name to_name (in StringName sn)
239
- raises (InvalidName);
240
-
241
- /// Indicates that the URL address is invalid.
242
- exception InvalidAddress {
243
- };
244
-
245
- /// It performs any escapes necessary on the stringified name
246
- /// and returns a fully formed URL string. An exception is
247
- /// raised if either the protocol or name parameters are invalid.
248
- URLString to_url (in Address addr,
249
- in StringName sn)
250
- raises (InvalidAddress, InvalidName);
251
-
252
- /// This is similar to @c resolve as in the
253
- /// CosNaming::NamingContext interface, except that it accepts
254
- /// a stringified name as an argument instead of a Name.
255
- Object resolve_str (in StringName n)
256
- raises (NotFound, CannotProceed, InvalidName);
257
- };
258
- };
259
-
260
- #endif /* COS_NAMING_IDL */