sbuilder-al 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/meta/meta.rb ADDED
@@ -0,0 +1,106 @@
1
+ module Sbuilder
2
+
3
+ module Al
4
+ module Meta
5
+
6
+ # For patter to create use modules to define class methods
7
+ # https://stackoverflow.com/questions/10692961/inheriting-class-methods-from-modules-mixins-in-ruby
8
+
9
+ def self.included( base)
10
+ base.extend( Sbuilder::Al::Meta::MetaClassMethods )
11
+ base.send( :include, Sbuilder::Al::Meta::MetaInstanceMethods )
12
+ end
13
+
14
+
15
+ module MetaInstanceMethods
16
+ end
17
+
18
+ module MetaClassMethods
19
+
20
+ # For implementing descendants
21
+ # http://www.eq8.eu/blogs/13-ruby-ancestors-descendants-and-other-annoying-relatives update 1
22
+ def inherited(klass)
23
+ @descendants ||= []
24
+ @descendants << klass
25
+ end
26
+
27
+ def descendants
28
+ @descendants || []
29
+ end
30
+
31
+ def descendants?
32
+ descendants.any?
33
+ end
34
+
35
+ def demodulize
36
+ self.class_name.split("::").last
37
+ end
38
+ def class_name
39
+ self.to_s
40
+ end
41
+
42
+ # Ancestor in meta hierarchy
43
+ #
44
+ # @return [Array<Class>] classe in superclass hierarchy
45
+ # implementing module Sbuilder::Al::Meta, ordered from
46
+ # top-most class
47
+ def metaAncestors( hierarchy = [] )
48
+ hierarchy = self.superclass.metaAncestors(hierarchy) if ( self.superclass.respond_to?( :metaAncestors) )
49
+ hierarchy << self
50
+ hierarchy
51
+ end
52
+
53
+
54
+ # @return [Array<Symbol>] services symbols added using addService
55
+ def services
56
+ @services || []
57
+ end
58
+
59
+ # Define method +op+ implemented by +proc+ and +block+
60
+ #
61
+ # @param op [Symbol] instance method to define
62
+ #
63
+ # @param proc [Proc, lambda] method implementation, if nil
64
+ # use +&blok+ for method implementation
65
+ #
66
+ # @param args [Object] arguments curryed to +proc+ or
67
+ # +&block+
68
+ #
69
+ # @param block [Bloc] method implementation, used unless
70
+ # +proc+ given
71
+ def addService( op, proc=nil, *args, &block )
72
+ proc = proc || block
73
+ if args.count > 0 then
74
+ proc = proc.curry[*args]
75
+ end
76
+ define_method( op, proc )
77
+ @services = (@services || []) << op
78
+ end
79
+
80
+ # @return [Array<Symbol>] attribute names added by +addAttribute+
81
+ def attributes
82
+ @attributes||[]
83
+ end
84
+
85
+ # Add attribute +attr+ and 'attr_reader'
86
+ def attribute_reader( attr )
87
+ attr_reader( attr )
88
+ @attributes = ((@attributes || []) << attr).uniq
89
+ end
90
+ # Add attribute +attr+ and 'attr_writer'
91
+ def attribute_writer( attr )
92
+ attr_writer( attr )
93
+ @attributes = ((@attributes || []) << attr).uniq
94
+ end
95
+ # Add attribute +attr+ and 'attribute_reader' and 'attribute_writer'
96
+ def attribute_accessor( attr )
97
+ attribute_reader( attr )
98
+ attribute_writer( attr )
99
+ # @attributes = ((@attributes || []) << attr).uniq
100
+ end
101
+
102
+
103
+ end
104
+ end
105
+ end # Al
106
+ end # Sbuilder
data/lib/model/api.rb ADDED
@@ -0,0 +1,678 @@
1
+ require 'docile'
2
+
3
+ module Sbuilder
4
+ module Al
5
+ module Model
6
+
7
+ ##
8
+ # Api module to include into API object to add privitives to
9
+ # construct {Sbuilder::Al::Model} application model
10
+ # objects. Implementation uses docile -Gem and builders classess
11
+ # in {Sbuilder::Al::Model::Builder}
12
+ #
13
+ # Api object primitives includes a configuration, which allows
14
+ # mapping one "appName" (=name in application namespace) to
15
+ # several application model elements, each corresponding to a #
16
+ # unique "specName" (=name in tla- model name space).
17
+ #
18
+ #
19
+ # Primitives included into an API object fall into the following
20
+ # categories:
21
+ #
22
+ # * class methods to construct an Api object for building
23
+ # {Sbuilder::Al::Model} application model objects
24
+ #
25
+ # * instance attribute to manage appName/specName mapping
26
+ #
27
+ # * instance methods to construct building application model
28
+ # objects (using Ruby domain specific language (DSL) implmented
29
+ # using Docile GEM.
30
+ #
31
+ #
32
+ module Api
33
+
34
+ # not catched
35
+ class ApiException < Sbuilder::Al::Util::AlException; end
36
+ # to be catched
37
+ class ApiError < Sbuilder::Al::Util::AlError; end
38
+
39
+
40
+ # @!group Class methods
41
+
42
+ # For the pattern to use modules in defining class methods
43
+ # https://stackoverflow.com/questions/10692961/inheriting-class-methods-from-modules-mixins-in-ruby
44
+
45
+ def self.included( base)
46
+ base.extend( ClassMethods )
47
+ # base.send( :include, Sbuilder::Al::Meta::MetaInstanceMethods )
48
+ end
49
+
50
+ module ClassMethods
51
+
52
+
53
+
54
+ def create( metaDefs={} )
55
+ warn "Sbuilder::Al::Model.create depracted - use Sbuilder::Al::Model.start, instead"
56
+ start( metaDefs )
57
+ # o = self.new
58
+ # o.metaDefs = metaDefs
59
+ # o
60
+ end
61
+
62
+ # Construct an api object with and initialize 'metaDefs' attribute
63
+ #
64
+ # @param metaDefs [Hash] see {Sbuilder::Al::Model::Api#metaDefs} meta
65
+ # definition configuration to set
66
+ #
67
+
68
+ def start( metaDefs )
69
+ o = self.new
70
+ o.metaDefs = metaDefs
71
+ o
72
+ end
73
+
74
+ end
75
+
76
+ # @!endgroup
77
+
78
+ # ------------------------------------------------------------------
79
+ # @!group Attributes
80
+
81
+ # @!attribute metaDefs [Hash]
82
+ #
83
+ # Allow mapping "appName" in application namespace to several
84
+ # "specNames" in tla-model namespace. Application build
85
+ # methods 'meta' -attribute to be a key in 'metaDefs' hash.
86
+ #
87
+ # * key [String] application build method 'meta' attribute
88
+ # must be a valid key in 'metaDefs'
89
+ #
90
+ # * value [Hash] metatype definition
91
+ # * :description [String] a short summary of the metatype
92
+ #
93
+ # * :prefix [String] optional, allow fixed string to be
94
+ # prefixed to 'appName' to create an
95
+ # unique 'specName', normally nil/not
96
+ # defined to allow sbuilder facade to
97
+ # choose prefix
98
+ attr_writer :metaDefs
99
+
100
+ def metaDefs
101
+ return @metaDefs || {}
102
+ end
103
+
104
+ # @!endgroup
105
+
106
+ # ------------------------------------------------------------------
107
+ # @!group Private methods
108
+ def lookupMeta( meta )
109
+ return meta if Sbuilder::Al::Plugin::Plugin.sbuilderMetatype?( meta )
110
+ raise ApiError, "Unknown meta '#{meta}', valid metas=#{metaDefs.keys.join(',')}" unless metaDefs.key?( meta )
111
+ meta
112
+ end
113
+
114
+ # @!endgroup
115
+
116
+ # ------------------------------------------------------------------
117
+ # @!group defines & parameter sets
118
+
119
+
120
+ def domain( &block )
121
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::DomainBuilder.new, &block ).build
122
+ end
123
+
124
+ def definition( &block )
125
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::DefinitionBuilder.new, &block ).build
126
+ end
127
+ def functionDefinition( &block )
128
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::FunctionDefinitionBuilder.new, &block ).build
129
+ end
130
+ def property( &block )
131
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::PropertyBuilder.new, &block ).build
132
+ end
133
+ module_function :property
134
+ public :property
135
+
136
+ def request( &block )
137
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::RequestBuilder.new, &block ).build
138
+ end
139
+
140
+ def response( &block )
141
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::ResponseBuilder.new, &block ).build
142
+ end
143
+
144
+ # @!endgroup
145
+
146
+
147
+ # ------------------------------------------------------------------
148
+ # @!group tx, macro function, operator
149
+
150
+
151
+
152
+ def transaction( meta, &block )
153
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::TransactionBuilder.new, &block ).build(lookupMeta(meta))
154
+ end
155
+
156
+ def snippet( meta, &block)
157
+ # block = Proc.new{
158
+ # expression msg
159
+ # } if block.nil?
160
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::SnippetBuilder.new, &block ).build(lookupMeta(meta))
161
+ end
162
+
163
+ # def function( meta, &block )
164
+ # Docile.dsl_eval( Sbuilder::Al::Model::Builders::FunctionBuilder.new, &block ).build(lookupMeta(meta))
165
+ # end
166
+
167
+ def operator( meta, &block )
168
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::OperatorBuilder.new, &block ).build(lookupMeta(meta))
169
+ end
170
+
171
+ def macro( meta, &block )
172
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::MacroBuilder.new, &block ).build(lookupMeta(meta))
173
+ end
174
+
175
+ def aliased( meta, &block )
176
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::AliasBuilder.new, &block ).build(lookupMeta(meta))
177
+ end
178
+ # storage
179
+
180
+ def local( meta, &block )
181
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::LocalBuilder.new, &block ).build( lookupMeta(meta) )
182
+ end
183
+
184
+ def variable( meta, &block )
185
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::VariableBuilder.new, &block ).build( lookupMeta(meta) )
186
+ end
187
+
188
+ def parameter( meta, &block )
189
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::ParameterBuilder.new, &block ).build( lookupMeta(meta) )
190
+ end
191
+
192
+
193
+ # @!endgroup
194
+
195
+
196
+ # ------------------------------------------------------------------
197
+ # @!group expression
198
+
199
+
200
+
201
+
202
+ #
203
+
204
+ def expression( e )
205
+ if ( e.is_a?(Symbol) && Constants::CONSTANT_EXPRESSIONS[e] )
206
+ constantExpression do
207
+ value e
208
+ end
209
+ else
210
+ case e
211
+ when String, Numeric, TrueClass, FalseClass
212
+ constantExpression do
213
+ value e
214
+ end
215
+ when Array
216
+ e.map{ |arrayElement| expression(arrayElement) }
217
+ when Sbuilder::Al::Model::Expression
218
+ e
219
+ when Sbuilder::Al::Model::Reference
220
+ referenceExpression do
221
+ reference e
222
+ end
223
+ else
224
+ raise raise ApiError, "Missing implementation for #{e.class}: #{e}"
225
+ end
226
+ end
227
+ end
228
+ module_function :expression
229
+ public :expression
230
+
231
+ def constantExpression(val=nil, &block )
232
+ block = Proc.new{
233
+ value val
234
+ } if block.nil? || !val.nil?
235
+
236
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::ConstantExpressionBuilder.new, &block ).build
237
+ end
238
+ module_function :constantExpression
239
+ public :constantExpression
240
+
241
+ def referenceExpression( &block )
242
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::ReferenceExpressionBuilder.new, &block ).build
243
+ end
244
+ module_function :referenceExpression
245
+ public :referenceExpression
246
+
247
+
248
+ def binaryExpression( &block )
249
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::BinaryExpressionBuilder.new, &block ).build
250
+ end
251
+ module_function :binaryExpression
252
+ public :binaryExpression
253
+
254
+ def unaryExpression( &block )
255
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::UnaryExpressionBuilder.new, &block ).build
256
+ end
257
+ module_function :unaryExpression
258
+ public :unaryExpression
259
+
260
+ def not( exprission, &block )
261
+ block = Proc.new{
262
+ op :not
263
+ expr exprission
264
+ } if block.nil? || !val.nil?
265
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::UnaryExpressionBuilder.new, &block ).build
266
+ end
267
+ module_function :not
268
+ public :not
269
+
270
+ def plus( l, r )
271
+ binaryExpression do
272
+ op :plus
273
+ lval expression(l)
274
+ rval expression(r)
275
+ end
276
+ end
277
+ module_function :plus
278
+ public :plus
279
+
280
+ def and( l, r )
281
+ binaryExpression do
282
+ op :and
283
+ lval expression(l)
284
+ rval expression(r)
285
+ end
286
+ end
287
+ module_function :and
288
+ public :and
289
+
290
+ def or( l, r )
291
+ binaryExpression do
292
+ op :or
293
+ lval expression(l)
294
+ rval expression(r)
295
+ end
296
+ end
297
+ module_function :or
298
+ public :or
299
+
300
+ def minus( l, r )
301
+ binaryExpression do
302
+ op :minus
303
+ lval expression(l)
304
+ rval expression(r)
305
+ end
306
+ end
307
+ module_function :minus
308
+ public :minus
309
+
310
+ def equal( l, r )
311
+ binaryExpression do
312
+ op :equal
313
+ lval expression(l)
314
+ rval expression(r)
315
+ end
316
+ end
317
+ module_function :equal
318
+ public :equal
319
+
320
+ def unequal( l, r )
321
+ binaryExpression do
322
+ op :unequal
323
+ lval expression(l)
324
+ rval expression(r)
325
+ end
326
+ end
327
+ module_function :unequal
328
+ public :unequal
329
+
330
+
331
+ def tlaExpression( &block )
332
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::TlaExpressionBuilder.new, &block ).build
333
+ end
334
+ module_function :tlaExpression
335
+ public :tlaExpression
336
+
337
+ def tlaSet( *args, &block )
338
+ args = args.map{ |a| expression(a) } unless args.nil?
339
+ tlaExpression do
340
+ template :set
341
+ args args
342
+ end
343
+ end
344
+ module_function :tlaSet
345
+ public :tlaSet
346
+
347
+ def tlaNil
348
+ tlaExpression do
349
+ template :nil
350
+ end
351
+ end
352
+ module_function :tlaNil
353
+ public :tlaNil
354
+
355
+ def tlaPlainname( name )
356
+ tlaExpression do
357
+ template :plainname
358
+ args name
359
+ end
360
+ end
361
+ module_function :tlaPlainname
362
+ public :tlaPlainname
363
+
364
+ def tlaParenthesis( expr )
365
+ tlaExpression do
366
+ template :parenthesis
367
+ args expression(expr)
368
+ end
369
+ end
370
+ module_function :tlaParenthesis
371
+ public :tlaParenthesis
372
+
373
+ # @param map [tlaExpressio] expression generatin the set
374
+ # @param variable [String] to iterate
375
+ # @param set [String] base set used to generate in map expression
376
+ def tlaSetGenerate( map, variable, set )
377
+ tlaExpression do
378
+ template :set_generate
379
+ args( expression(map) )
380
+ args( variable )
381
+ args( set )
382
+ end
383
+ end
384
+ module_function :tlaSetGenerate
385
+ public :tlaSetGenerate
386
+
387
+ # @param variable [String] used to iterate
388
+ # @param set [String] to iterate
389
+ def tlaSetIterate( variable, set )
390
+ tlaExpression do
391
+ template :set_iterate
392
+ args( variable )
393
+ args( set )
394
+ end
395
+ end
396
+ module_function :tlaSetIterate
397
+ public :tlaSetIterate
398
+
399
+
400
+
401
+ def tlaSetSelect( variable, set, select )
402
+ tlaExpression do
403
+ template :set_select
404
+ args( variable )
405
+ args( set )
406
+ args( select )
407
+ end
408
+ end
409
+ module_function :tlaSetSelect
410
+ public :tlaSetSelect
411
+
412
+
413
+ def tlaIF( condition, thenExpr, elseExpr )
414
+ tlaExpression do
415
+ template :IF_expression
416
+ args( condition )
417
+ args( thenExpr )
418
+ args( elseExpr )
419
+ end
420
+ end
421
+ module_function :tlaIF
422
+ public :tlaIF
423
+
424
+
425
+ def tlaEXCEPT( variable, excepts )
426
+ tlaExpression do
427
+ template :EXCEPT_expression
428
+ args( variable )
429
+ args( excepts )
430
+ end
431
+ end
432
+ module_function :tlaEXCEPT
433
+ public :tlaEXCEPT
434
+
435
+ def tlaRecordField( record, field )
436
+ tlaExpression do
437
+ template :record_field
438
+ args( record )
439
+ args( field )
440
+ end
441
+ end
442
+ module_function :tlaRecordField
443
+ public :tlaRecordField
444
+
445
+
446
+ def tlaRecordIndex( record, index )
447
+ tlaExpression do
448
+ template :record_index
449
+ args( record )
450
+ args( index )
451
+ end
452
+ end
453
+ module_function :tlaRecordIndex
454
+ public :tlaRecordIndex
455
+
456
+
457
+ def tlaRecord( fields )
458
+ tlaExpression do
459
+ template :record
460
+ args( fields )
461
+ end
462
+ end
463
+ module_function :tlaRecord
464
+ public :tlaRecord
465
+
466
+ def tlaRecordFieldDef( name, value )
467
+ tlaExpression do
468
+ template :record_field_definition
469
+ args( name )
470
+ args( value )
471
+ end
472
+ end
473
+ module_function :tlaRecordFieldDef
474
+ public :tlaRecordFieldDef
475
+
476
+ def tlaOperatorCall( operator, arguments )
477
+ tlaExpression do
478
+ template :operator_call
479
+ args( operator )
480
+ args( arguments )
481
+ end
482
+ end
483
+ module_function :tlaOperatorCall
484
+ public :tlaOperatorCall
485
+
486
+
487
+ def tlaSequence( *args, &block )
488
+ args = args.map{ |a| expression(a) } unless args.nil?
489
+ tlaExpression do
490
+ template :sequence
491
+ args args
492
+ end
493
+ end
494
+ module_function :tlaSequence
495
+ public :tlaSequence
496
+
497
+ # @!endgroup
498
+
499
+
500
+ # ------------------------------------------------------------------
501
+ # @!group references
502
+
503
+
504
+
505
+
506
+ def reference( v1, v2=nil )
507
+ if v1.is_a?(Sbuilder::Al::Model::Reference )
508
+ return v1
509
+ elsif v1.is_a?(String)
510
+ simpleReference(v1, v2)
511
+ elsif v1.is_a?(Array) && v1.length == 1
512
+ simpleReference( *v1, v2)
513
+ elsif v1.is_a?(Array) && v1.length == 2
514
+ variableReference( *v1, v2 )
515
+ elsif v1.is_a?(Array) && v1.length == 3
516
+ txParameterReference( *v1, v2 )
517
+ else
518
+ raise raise ApiError, "Missing implementation for #{v1.class}: #{v1} and #{v2.class}: #{v2}"
519
+ end
520
+ end
521
+ module_function :reference
522
+ public :reference
523
+
524
+ # refering named 'parameter'
525
+ def simpleReference( parameterName, fldArray=nil )
526
+ fldArray = [ fldArray ] unless fldArray.nil? || fldArray.is_a?(Array)
527
+ # define block for builder
528
+ block = Proc.new{
529
+ name parameterName
530
+ fldArray && fldArray.each do |fld|
531
+ fields fld
532
+ end
533
+ }
534
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::SimpleReferenceBuilder.new, &block ).build
535
+ end
536
+ module_function :simpleReference
537
+ public :simpleReference
538
+
539
+ # refering to a state 'variable' in namespace 'meta'
540
+ def variableReference( meta, variable, fldArray=nil )
541
+ fldArray = [ fldArray ] unless fldArray.nil? || fldArray.is_a?(Array)
542
+ # define block for builder
543
+ block = Proc.new{
544
+ meta meta
545
+ name variable
546
+ fldArray && fldArray.each do |fld|
547
+ fields fld
548
+ end
549
+ }
550
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::VariableReferenceBuilder.new, &block ).build
551
+ end
552
+ module_function :variableReference
553
+ public :variableReference
554
+
555
+ # refering to a state 'variable' in namespace 'meta'
556
+ def txParameterReference( meta, variable, op, fldArray=nil )
557
+ fldArray = [ fldArray ] unless fldArray.nil? || fldArray.is_a?(Array)
558
+ # define block for builder
559
+ block = Proc.new{
560
+ meta meta
561
+ name variable
562
+ operation op
563
+ fldArray && fldArray.each do |fld|
564
+ fields fld
565
+ end
566
+ }
567
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::TxParameterReferenceBuilder.new, &block ).build
568
+ end
569
+ module_function :txParameterReference
570
+ public :txParameterReference
571
+
572
+ # @!endgroup
573
+
574
+ # ------------------------------------------------------------------
575
+ # @!group statements
576
+
577
+
578
+
579
+
580
+
581
+ def block( &block )
582
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::BlockBuilder.new, &block ).build
583
+ end
584
+ module_function :block
585
+ public :block
586
+
587
+ def outputStatement( msg="", &block )
588
+ # allow skip without block
589
+ block = Proc.new{
590
+ expression msg
591
+ } if block.nil?
592
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::OutputStatementBuilder.new, &block ).build
593
+ end
594
+ module_function :outputStatement
595
+ public :outputStatement
596
+
597
+ def returnStatement( &block )
598
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::ReturnStatementBuilder.new, &block ).build
599
+ end
600
+ module_function :returnStatement
601
+ public :returnStatement
602
+
603
+ def jumpStatement( lab, &block )
604
+ block = Proc.new{ label lab } if block.nil?
605
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::JumpStatementBuilder.new, &block ).build
606
+ end
607
+ module_function :jumpStatement
608
+ public :jumpStatement
609
+
610
+ def assignStatement( &block )
611
+ # allow skip without block
612
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::AssignStatementBuilder.new, &block ).build
613
+ end
614
+ module_function :assignStatement
615
+ public :assignStatement
616
+
617
+ def callStatement( &block )
618
+ # allow skip without block
619
+ block = Proc.new{} if block.nil?
620
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::CallStatementBuilder.new, &block ).build
621
+ end
622
+ module_function :callStatement
623
+ public :callStatement
624
+
625
+ def conditionalStatement( &block )
626
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::ConditionalStatementBuilder.new, &block ).build
627
+ end
628
+ module_function :conditionalStatement
629
+ public :conditionalStatement
630
+
631
+ def skipStatement( &block )
632
+ # allow skip without block
633
+ block = Proc.new{} if block.nil?
634
+ Docile.dsl_eval( Sbuilder::Al::Model::Builders::SkipStatementBuilder.new, &block ).build
635
+ end
636
+ module_function :skipStatement
637
+ public :skipStatement
638
+ alias_method :skip, :skipStatement
639
+
640
+ # @!endgroup
641
+
642
+ # ------------------------------------------------------------------
643
+ # @!group str constants
644
+
645
+ def self.strLabelEnd( interfaceOperation )
646
+ "#{interfaceOperation}#{Sbuilder::Al::Translator::TlaGenerator::TLA_LABEL_END}"
647
+ end
648
+ def self.strLabelAbort( interfaceOperation )
649
+ "#{interfaceOperation}#{Sbuilder::Al::Translator::TlaGenerator::TLA_LABEL_ABORT}"
650
+ end
651
+ def self.strLabelFail( interfaceOperation )
652
+ "#{interfaceOperation}#{Sbuilder::Al::Translator::TlaGenerator::TLA_LABEL_FAIL}"
653
+ end
654
+
655
+ # @return [String] name of i-th input parameter to FunctionDefinition
656
+ def self.inputParameterName(i=1)
657
+ "p#{i}"
658
+ end
659
+ def inputParameterName(i=1)
660
+ Api.inputParameterName( i )
661
+ end
662
+
663
+
664
+ # @return [String] name of i-th output parameter to FunctionDefinition
665
+ def self.outputParameterName(i=1)
666
+ "ret#{i}"
667
+ end
668
+ def outputParameterName(i=1)
669
+ Api.outputParameterName( i )
670
+ end
671
+
672
+ # @!endgroup
673
+
674
+
675
+ end
676
+ end
677
+ end
678
+ end