forked from xtuml/mc
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathq.val.translate.arc
820 lines (820 loc) · 30.1 KB
/
q.val.translate.arc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
.//====================================================================
.//
.// $RCSfile: q.val.translate.arc,v $
.//
.// (c) Copyright 1998-2013 Mentor Graphics Corporation All rights reserved.
.//
.//====================================================================
.//
.// These functions set up the implementation of the values (V_VAL on
.// model of OAL).
.//
.//====================================================================
.//
.//
.function val_translate
.// Translate "leaf" values first.
.invoke val_literal_boolean_values()
.invoke val_literal_integer_values()
.invoke val_literal_real_values()
.invoke val_literal_string_values()
.invoke val_literal_enumerations()
.invoke val_constant_values()
.invoke val_transient_values()
.invoke val_instance_reference_values()
.invoke val_inst_ref_set_values()
.invoke val_selection_test_values()
.invoke val_event_values()
.invoke val_parameter_values()
.// The following may be recursed.
.invoke val_attribute_values()
.invoke val_member_values()
.invoke val_array_element_references()
.invoke val_array_length_values()
.invoke val_unary_op_values()
.invoke val_binary_op_values()
.// V_PARs depend upon values being populated.
.invoke val_actual_parameters()
.// These use V_PARs.
.invoke val_message_values()
.invoke val_bridge_values()
.invoke val_transform_values()
.invoke val_synch_service_values()
.end function
.//
.//--------------------------------------------------------------------
.// Percolate the values from the "leaves" up into the combined
.// expressions by recursively drilling down.
.//--------------------------------------------------------------------
.function gen_value
.param inst_ref v_val
.select one v_mvl related by v_val->V_MVL[R801]
.if ( not_empty v_mvl )
.invoke val_member_value( v_mvl )
.else
.select one v_avl related by v_val->V_AVL[R801]
.if ( not_empty v_avl )
.invoke val_attribute_value( v_avl )
.else
.select one v_aer related by v_val->V_AER[R801]
.if ( not_empty v_aer )
.invoke val_array_element_reference( v_aer )
.else
.select one v_alv related by v_val->V_ALV[R801]
.if ( not_empty v_alv )
.invoke val_array_length_value( v_alv )
.else
.select one v_uny related by v_val->V_UNY[R801]
.if ( not_empty v_uny )
.invoke val_unary_op_value( v_uny )
.else
.select one v_bin related by v_val->V_BIN[R801]
.if ( not_empty v_bin )
.invoke val_binary_op_value( v_bin )
.else
.select one v_trv related by v_val->V_TRV[R801]
.if ( not_empty v_trv )
.invoke val_transform_value( v_trv, "TRV" )
.else
.select one v_msv related by v_val->V_MSV[R801]
.if ( not_empty v_msv )
.invoke val_message_value( v_msv, "MSV" )
.else
.select one v_brv related by v_val->V_BRV[R801]
.if ( not_empty v_brv )
.invoke val_bridge_value( v_brv, "BRV" )
.else
.select one v_fnv related by v_val->V_FNV[R801]
.if ( not_empty v_fnv )
.invoke val_synch_service_value( v_fnv, "FNV" )
.else
.print "ERROR: Recursive V_VAL resolution issue."
.end if
.end if
.end if
.end if
.end if
.end if
.end if
.end if
.end if
.end if
.end function
.//
.function val_literal_boolean_values
.select many v_lbos from instances of V_LBO
.for each v_lbo in v_lbos
.select one te_val related by v_lbo->V_VAL[R801]->TE_VAL[R2040]
.assign te_val.OAL = v_lbo.Value
.assign te_val.buffer = v_lbo.Value
.end for
.end function
.//
.function val_literal_string_values
.select any te_string from instances of TE_STRING
.select many v_lsts from instances of V_LST
.for each v_lst in v_lsts
.select one te_val related by v_lst->V_VAL[R801]->TE_VAL[R2040]
.// s = T::t( s:v_lst.Value );
.assign s = v_lst.Value
.// if ( strstr( s, "({" ) )
.if ( "({" == s )
.assign te_val.buffer = s
.else
.assign te_val.buffer = ( """" + v_lst.Value ) + """"
.end if
.assign te_val.OAL = ( "" + v_lst.Value ) + ""
.assign te_val.dimensions = 1
.assign te_val.array_spec = ( "[" + te_string.max_string_length ) + "]"
.//TODO assign dimension
.end for
.end function
.//
.function val_literal_integer_values
.select many v_lins from instances of V_LIN
.for each v_lin in v_lins
.select one te_val related by v_lin->V_VAL[R801]->TE_VAL[R2040]
.assign te_val.OAL = v_lin.Value
.assign te_val.buffer = v_lin.Value
.end for
.end function
.//
.function val_literal_real_values
.select many v_lrls from instances of V_LRL
.for each v_lrl in v_lrls
.select one te_val related by v_lrl->V_VAL[R801]->TE_VAL[R2040]
.assign te_val.OAL = v_lrl.Value
.assign te_val.buffer = v_lrl.Value
.end for
.end function
.//
.function val_literal_enumerations
.select many v_lens from instances of V_LEN
.for each v_len in v_lens
.select one te_val related by v_len->V_VAL[R801]->TE_VAL[R2040]
.select one te_enum related by v_len->S_ENUM[R824]->TE_ENUM[R2027]
.assign te_val.OAL = te_enum.Name
.assign te_val.buffer = te_enum.GeneratedName
.end for
.end function
.//
.function val_constant_values
.select many v_scvs from instances of V_SCV
.for each v_scv in v_scvs
.select one te_val related by v_scv->V_VAL[R801]->TE_VAL[R2040]
.select one cnst_syc related by v_scv->CNST_SYC[R850]
.select one cnst_lsc related by cnst_syc->CNST_LFSC[R1502]->CNST_LSC[R1503]
.select one te_dt related by cnst_syc->S_DT[R1500]->TE_DT[R2021]
.assign te_val.OAL = cnst_syc.Name
.assign te_val.buffer = cnst_lsc.Value
.if ( 4 == te_dt.Core_Typ )
.select any te_string from instances of TE_STRING
.assign te_val.buffer = ( """" + cnst_lsc.Value ) + """"
.assign te_val.dimensions = 1
.assign te_val.array_spec = ( "[" + te_string.max_string_length ) + "]"
.//TODO assign dimension
.end if
.end for
.end function
.//
.function val_transient_values
.select many v_tvls from instances of V_TVL
.for each v_tvl in v_tvls
.select one v_var related by v_tvl->V_VAR[R805]
.select one te_var related by v_var->TE_VAR[R2039]
.select one te_val related by v_tvl->V_VAL[R801]->TE_VAL[R2040]
.assign te_val.OAL = te_var.OAL
.assign te_val.buffer = te_var.buffer
.assign te_val.dimensions = te_var.dimensions
.assign te_val.array_spec = te_var.array_spec
.select one te_dim related by te_var->TE_DIM[R2057]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end for
.end function
.//
.function val_actual_parameters
.select many v_pars from instances of V_PAR
.for each v_par in v_pars
.select one te_par related by v_par->TE_PAR[R2063]
.select one v_val related by v_par->V_VAL[R800]
.select one te_val related by v_val->TE_VAL[R2040]
.select one te_dt related by v_val->S_DT[R820]->TE_DT[R2021]
.assign te_val.OAL = ( te_par.Name + ":" ) + te_val.OAL
.if ( 10 == te_dt.Core_Typ )
.// Cast event types to the base event type for passing (to timers).
.assign te_val.buffer = ( "(" + te_dt.ExtName ) + ( ")" + te_val.buffer )
.end if
.end for
.end function
.//
.function val_attribute_values
.select many v_avls from instances of V_AVL
.for each v_avl in v_avls
.invoke val_attribute_value( v_avl )
.end for
.end function
.//
.function val_attribute_value
.param inst_ref v_avl
.select one v_val related by v_avl->V_VAL[R801]
.select one te_val related by v_val->TE_VAL[R2040]
.if ( "" == te_val.buffer )
.select one root_v_val related by v_avl->V_VAL[R807]
.select one root_te_val related by root_v_val->TE_VAL[R2040]
.if ( "" == root_te_val.buffer )
.invoke gen_value( root_v_val )
.end if
.select one te_var related by v_avl->V_VAL[R807]->V_IRF[R801]->V_VAR[R808]->TE_VAR[R2039]
.select one o_attr related by v_avl->O_ATTR[R806]
.select one te_attr related by o_attr->TE_ATTR[R2033]
.if ( not_empty te_attr )
.assign root = ""
.if ( empty te_var )
.assign te_val.OAL = ( root_te_val.OAL + "." ) + te_attr.Name
.assign te_val.buffer = ( root_te_val.buffer + "->" ) + te_attr.GeneratedName
.assign root = root_te_val.buffer
.else
.assign te_val.OAL = ( te_var.OAL + "." ) + te_attr.Name
.assign te_val.buffer = ( te_var.buffer + "->" ) + te_attr.GeneratedName
.assign root = te_var.buffer
.end if
.assign te_val.dimensions = te_attr.dimensions
.assign te_val.array_spec = te_attr.array_spec
.select one te_dim related by te_attr->TE_DIM[R2055]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.// Maybe attribute value is actually derived.
.select one o_dbattr related by o_attr->O_BATTR[R106]->O_DBATTR[R107]
.if ( not_empty o_dbattr )
.select one act_ai related by v_val->ACT_AI[R689]
.if ( empty act_ai )
.// Only do this if we are not assigning inside the DAB OAL body.
.select one te_aba related by o_dbattr->TE_DBATTR[R2026]->TE_ABA[R2010]
.assign te_val.buffer = ( te_aba.GeneratedName + "( " ) + ( root + " )" )
.assign te_val.dimensions = te_aba.dimensions
.assign te_val.array_spec = te_aba.array_spec
.select one te_dim related by te_aba->TE_DIM[R2058]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end if
.end if
.end if
.end if
.end function
.//
.function val_member_values
.select many v_mvls from instances of V_MVL
.for each v_mvl in v_mvls
.invoke val_member_value( v_mvl )
.end for
.end function
.//
.function val_member_value
.param inst_ref v_mvl
.select one te_val related by v_mvl->V_VAL[R801]->TE_VAL[R2040]
.if ( "" == te_val.buffer )
.select one root_v_val related by v_mvl->V_VAL[R837]
.select one root_te_val related by root_v_val->TE_VAL[R2040]
.if ( "" == root_te_val.buffer )
.invoke gen_value( root_v_val )
.end if
.select one te_mbr related by v_mvl->S_MBR[R836]->TE_MBR[R2047]
.assign te_val.dimensions = te_mbr.dimensions
.assign te_val.array_spec = te_mbr.array_spec
.select one te_dim related by te_mbr->TE_DIM[R2059]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.assign te_val.OAL = ( root_te_val.OAL + "." ) + te_mbr.Name
.assign te_val.buffer = ( root_te_val.buffer + "." ) + te_mbr.GeneratedName
.end if
.end function
.//
.function val_instance_reference_values
.assign unique_num = 0
.select many v_irfs from instances of V_IRF
.for each v_irf in v_irfs
.select one te_val related by v_irf->V_VAL[R801]->TE_VAL[R2040]
.select one te_var related by v_irf->V_VAR[R808]->TE_VAR[R2039]
.if ( not_empty te_var )
.assign te_val.OAL = te_var.OAL
.assign te_val.buffer = te_var.buffer
.else
.print "CDS: Understand why we do not have V_VAR here."
.assign te_val.buffer = "v_irf_" + "$t{unique_num}"
.assign unique_num = unique_num + 1
.end if
.end for
.end function
.//
.function val_selection_test_values
.select many v_slrs from instances of V_SLR
.for each v_slr in v_slrs
.select one te_val related by v_slr->V_VAL[R801]->TE_VAL[R2040]
.assign te_val.buffer = "selected"
.assign te_val.OAL = "SELECTED"
.end for
.end function
.//
.function val_inst_ref_set_values
.select many v_isrs from instances of V_ISR
.for each v_isr in v_isrs
.select one te_var related by v_isr->V_VAR[R809]->TE_VAR[R2039]
.select one te_val related by v_isr->V_VAL[R801]->TE_VAL[R2040]
.assign te_val.OAL = te_var.OAL
.assign te_val.buffer = te_var.buffer
.end for
.end function
.//
.function val_event_values
.select many v_edvs from instances of V_EDV
.for each v_edv in v_edvs
.select one te_val related by v_edv->V_VAL[R801]->TE_VAL[R2040]
.// If there are more than one transition into the state, there
.// may be more than one event parameter reference. Select
.// any of them; they have the same names.
.select any te_parm related by v_edv->V_EPR[R834]->SM_EVTDI[R846]->TE_PARM[R2031]
.if ( empty te_parm )
.select any te_parm related by v_edv->V_EPR[R834]->C_PP[R847]->TE_PARM[R2048]
.else
.// Mark the event as used.
.select one te_evt related by te_parm->SM_EVTDI[R2031]->SM_EVT[R532]->TE_EVT[R2036]
.if ( not_empty te_evt )
.assign te_evt.UsedCount = te_evt.UsedCount + 1
.assign te_evt.Used = true
.end if
.end if
.assign te_val.OAL = "PARAM." + te_parm.Name
.assign te_val.buffer = "rcvd_evt->" + te_parm.GeneratedName
.assign te_val.dimensions = te_parm.dimensions
.assign te_val.array_spec = te_parm.array_spec
.select one te_dim related by te_parm->TE_DIM[R2056]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end for
.end function
.//
.function val_parameter_values
.select many v_pvls from instances of V_PVL
.for each v_pvl in v_pvls
.select one te_val related by v_pvl->V_VAL[R801]->TE_VAL[R2040]
.select one te_parm related by v_pvl->O_TPARM[R833]->TE_PARM[R2029]
.if ( empty te_parm )
.select one te_parm related by v_pvl->C_PP[R843]->TE_PARM[R2048]
.if ( empty te_parm )
.select one te_parm related by v_pvl->S_SPARM[R832]->TE_PARM[R2030]
.if ( empty te_parm )
.select one te_parm related by v_pvl->S_BPARM[R831]->TE_PARM[R2028]
.if ( empty te_parm )
.print "CDS: Understand why we do not have V_PVL related parameter here."
.end if
.end if
.end if
.end if
.assign te_val.OAL = "PARAM." + te_parm.Name
.assign te_val.buffer = te_parm.GeneratedName
.assign te_val.dimensions = te_parm.dimensions
.assign te_val.array_spec = te_parm.array_spec
.select one te_dim related by te_parm->TE_DIM[R2056]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.if ( 1 == te_parm.By_Ref )
.assign te_val.buffer = ( "(*" + te_parm.GeneratedName ) + ")"
.end if
.end for
.end function
.//
.function val_unary_op_values
.select many v_unys from instances of V_UNY
.for each v_uny in v_unys
.invoke val_unary_op_value( v_uny )
.end for
.end function
.//
.function val_unary_op_value
.param inst_ref v_uny
.select one te_val related by v_uny->V_VAL[R801]->TE_VAL[R2040]
.if ( "" == te_val.buffer )
.select one root_v_val related by v_uny->V_VAL[R804]
.select one root_te_val related by root_v_val->TE_VAL[R2040]
.if ( "" == root_te_val.buffer )
.invoke gen_value( root_v_val )
.end if
.// Remove blanks and make lower case.
.assign op = "$r{v_uny.Operator}"
.assign op = "$l{op}"
.select any te_set from instances of TE_SET
.select one v_irf related by root_v_val->V_IRF[R801]
.select one v_isr related by root_v_val->V_ISR[R801]
.if ( not_empty v_irf )
.if ( op == "not_empty" )
.assign te_val.buffer = ( "( 0 != " + root_te_val.buffer ) + " )"
.elif ( op == "empty" )
.assign te_val.buffer = ( "( 0 == " + root_te_val.buffer ) + " )"
.elif ( op == "cardinality" )
.assign te_val.buffer = ( "( 0 != " + root_te_val.buffer ) + " )"
.else
.print "ERROR: Unary set operator ${v_uny.Operator} is not supported."
.end if
.elif ( not_empty v_isr )
.if ( op == "not_empty" )
.assign te_val.buffer = ( ( "( ! " + te_set.emptiness ) + ( "( " + root_te_val.buffer ) ) + " ) )"
.elif ( op == "empty" )
.assign te_val.buffer = ( ( te_set.emptiness + "( " ) + ( root_te_val.buffer + " )" ) )
.elif ( op == "cardinality" )
.assign te_val.buffer = ( ( te_set.module + te_set.element_count ) + ( "( " + root_te_val.buffer ) ) + " )"
.else
.print "ERROR: Unary set operator ${v_uny.Operator} is not supported."
.end if
.else
.if ( op == "not" )
.assign te_val.buffer = "!" + root_te_val.buffer
.else
.assign te_val.buffer = op + root_te_val.buffer
.end if
.end if
.assign te_val.OAL = ( op + " " ) + root_te_val.OAL
.// future support for vector arithmetic goes here
.assign te_val.dimensions = root_te_val.dimensions
.assign te_val.array_spec = root_te_val.array_spec
.select one te_dim related by root_te_val->TE_DIM[R2079]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end if
.end function
.//
.function val_binary_op_values
.select many v_bins from instances of V_BIN
.for each v_bin in v_bins
.invoke val_binary_op_value( v_bin )
.end for
.end function
.//
.function val_binary_op_value
.param inst_ref v_bin
.select one te_val related by v_bin->V_VAL[R801]->TE_VAL[R2040]
.if ( "" == te_val.buffer )
.select one l_v_val related by v_bin->V_VAL[R802]
.select one l_te_val related by l_v_val->TE_VAL[R2040]
.if ( "" == l_te_val.buffer )
.invoke gen_value( l_v_val )
.end if
.select one r_v_val related by v_bin->V_VAL[R803]
.select one r_te_val related by r_v_val->TE_VAL[R2040]
.if ( "" == r_te_val.buffer )
.invoke gen_value( r_v_val )
.end if
.select one l_te_dt related by l_v_val->S_DT[R820]->TE_DT[R2021]
.select one r_te_dt related by r_v_val->S_DT[R820]->TE_DT[R2021]
.if ( ( 4 == l_te_dt.Core_Typ ) or ( 4 == r_te_dt.Core_Typ ) )
.// string
.select any te_string from instances of TE_STRING
.select any te_instance from instances of TE_INSTANCE
.if ( "+" == "$r{v_bin.Operator}" )
.assign te_val.buffer = ( ( ( te_instance.module + te_string.stradd ) + ( "( " + l_te_val.buffer ) ) + ( ", " + r_te_val.buffer ) ) + " )"
.else
.assign te_val.buffer = ( ( ( "( " + te_instance.module ) + ( te_string.strcmp + "( " ) ) + ( ( l_te_val.buffer + ", " ) + ( r_te_val.buffer + " ) " ) ) ) + ( v_bin.Operator + " 0 )" )
.end if
.else
.select any te_target from instances of TE_TARGET
.if ( "and" == "$r{v_bin.Operator}" )
.assign te_val.buffer = ( ( "( " + l_te_val.buffer ) + ( " && " + r_te_val.buffer ) ) + " )"
.elif ( "or" == "$r{v_bin.Operator}" )
.assign te_val.buffer = ( ( "( " + l_te_val.buffer ) + ( " || " + r_te_val.buffer ) ) + " )"
.elif ( ( ( ( "==" == "$r{v_bin.Operator}" ) or ( "!=" == "$r{v_bin.Operator}" ) ) and ( "C" == te_target.language ) ) and ( l_te_val.dimensions != 0 ) )
.assign element_count = 0
.select one r_te_dim related by r_te_val->TE_DIM[R2079]
.if ( not_empty r_te_dim )
.assign element_count = r_te_dim.elementCount
.end if
.assign te_val.buffer = ( ( ( "( memcmp( " + l_te_val.buffer ) + ( ", " + r_te_val.buffer ) ) + ( ( ", sizeof(" + l_te_val.buffer ) + ( "[0]) * " + "$t{element_count}" ) ) ) + ( ( ") " + v_bin.Operator ) + " 0 )" )
.else
.assign te_val.buffer = ( ( "( " + l_te_val.buffer ) + ( " " + v_bin.Operator ) ) + ( ( " " + r_te_val.buffer ) + " )" )
.end if
.end if
.// future support for vector arithmetic goes here
.assign te_val.dimensions = r_te_val.dimensions
.assign te_val.array_spec = r_te_val.array_spec
.select one te_dim related by r_te_val->TE_DIM[R2079]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.assign te_val.OAL = ( ( "( " + l_te_val.OAL ) + ( " " + v_bin.Operator ) ) + ( ( " " + r_te_val.OAL ) + " )" )
.end if
.end function
.//
.function val_message_values
.select many v_msvs from instances of V_MSV
.for each v_msv in v_msvs
.invoke val_message_value( v_msv, "msv" )
.end for
.end function
.//
.function val_message_value
.param inst_ref v_msv
.param string salt
.select one v_val related by v_msv->V_VAL[R801]
.select one te_val related by v_val->TE_VAL[R2040]
.select one te_mact related by v_msv->SPR_PEP[R841]->SPR_PO[R4503]->TE_MACT[R2050]
.if ( empty te_mact )
.select one te_mact related by v_msv->SPR_REP[R845]->SPR_RO[R4502]->TE_MACT[R2052]
.end if
.select many v_pars related by v_msv->V_PAR[R842]
.select one te_aba related by te_mact->TE_ABA[R2010]
.invoke r = q_render_msg( te_mact, v_pars, "", false, salt )
.assign te_val.buffer = r.body
.assign te_val.OAL = ( ( te_mact.PortName + "::" ) + ( te_mact.MessageName + "(" ) ) + ( te_mact.OALParamBuffer + ")" )
.assign te_val.dimensions = te_aba.dimensions
.assign te_val.array_spec = te_aba.array_spec
.select one te_dim related by te_aba->TE_DIM[R2058]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end function
.//
.function val_bridge_values
.select many v_brvs from instances of V_BRV
.for each v_brv in v_brvs
.invoke val_bridge_value( v_brv, "brv" )
.end for
.end function
.//
.function val_bridge_value
.param inst_ref v_brv
.param string salt
.select one te_brg related by v_brv->S_BRG[R828]->TE_BRG[R2025]
.if ( not_empty te_brg )
.select any te_target from instances of TE_TARGET
.select one v_val related by v_brv->V_VAL[R801]
.select one te_val related by v_val->TE_VAL[R2040]
.select many v_pars related by v_brv->V_PAR[R810]
.select one te_aba related by te_brg->TE_ABA[R2010]
.select one te_ee related by v_brv->S_BRG[R828]->S_EE[R19]->TE_EE[R2020]
.assign te_ee.Included = true
.invoke r = gen_parameter_list( v_pars, false, salt )
.assign te_parm = r.result
.assign parameters = te_parm.ParamBuffer
.assign params_OAL = te_parm.OALParamBuffer
.assign te_val.OAL = ( ( te_brg.EEkeyletters + "::" ) + ( te_brg.Name + "(" ) ) + ( params_OAL + ")" )
.if ( "C++" == te_target.language )
.if ( "TIM" == te_brg.EEkeyletters )
.assign te_val.buffer = ( "thismodule->tim->" + te_brg.GeneratedName ) + "("
.else
.select one te_c related by te_ee->TE_C[R2085]
.if ( not_empty te_c )
.if ( "" == parameters )
.assign parameters = "thismodule"
.else
.assign parameters = "thismodule, " + parameters
.end if
.end if
.end if
.else
.assign te_val.buffer = ( te_aba.scope + te_brg.GeneratedName ) + "("
.end if
.if ( "" != parameters )
.assign te_val.buffer = ( te_val.buffer + " " ) + ( parameters + " " )
.end if
.assign te_val.buffer = te_val.buffer + ")"
.assign te_val.dimensions = te_aba.dimensions
.assign te_val.array_spec = te_aba.array_spec
.select one te_dim related by te_aba->TE_DIM[R2058]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end if
.end function
.//
.function val_transform_values
.select many v_trvs from instances of V_TRV
.for each v_trv in v_trvs
.invoke val_transform_value( v_trv, "trv" )
.end for
.end function
.//
.function val_transform_value
.param inst_ref v_trv
.param string salt
.select one te_tfr related by v_trv->O_TFR[R829]->TE_TFR[R2024]
.if ( not_empty te_tfr )
.select any te_target from instances of TE_TARGET
.select one v_val related by v_trv->V_VAL[R801]
.select one te_val related by v_val->TE_VAL[R2040]
.select many v_pars related by v_trv->V_PAR[R811]
.select one te_aba related by te_tfr->TE_ABA[R2010]
.assign te_val.buffer = te_tfr.GeneratedName + "("
.if ( te_tfr.Instance_Based == 1 )
.select one te_var related by v_trv->V_VAR[R830]->TE_VAR[R2039]
.if ( not_empty te_var )
.if ( "C++" == te_target.language )
.assign te_val.buffer = ( te_var.buffer + "->" ) + te_val.buffer
.end if
.assign te_val.buffer = te_val.buffer + te_var.buffer
.assign te_val.OAL = te_var.OAL + "."
.else
.// no variable, must be selection (selected reference)
.if ( "C++" == te_target.language )
.assign te_val.buffer = "selected->" + te_val.buffer
.end if
.assign te_val.buffer = te_val.buffer + "selected"
.assign te_val.OAL = "SELECTED."
.end if
.else
.if ( "C++" == te_target.language )
.select one te_class related by v_trv->O_TFR[R829]->O_OBJ[R115]->TE_CLASS[R2019]
.assign te_val.buffer = ( te_class.GeneratedName + "::" ) + te_val.buffer
.end if
.assign te_val.OAL = te_tfr.Key_Lett + "::"
.end if
.invoke r = gen_parameter_list( v_pars, false, salt )
.assign te_parm = r.result
.assign parameters = te_parm.ParamBuffer
.assign params_OAL = te_parm.OALParamBuffer
.assign te_val.OAL = ( ( te_val.OAL + te_tfr.Name ) + ( "(" + params_OAL ) ) + ")"
.if ( te_tfr.Instance_Based == 1 )
.if ( ( "C++" == te_target.language ) or ( "" != parameters ) )
.assign te_val.buffer = te_val.buffer + ", "
.end if
.end if
.if ( "C++" == te_target.language )
.assign te_val.buffer = te_val.buffer + "thismodule"
.if ( "" != parameters )
.assign te_val.buffer = te_val.buffer + ", "
.end if
.end if
.assign te_val.buffer = ( te_val.buffer + parameters ) + ")"
.assign te_val.dimensions = te_aba.dimensions
.assign te_val.array_spec = te_aba.array_spec
.select one te_dim related by te_aba->TE_DIM[R2058]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end if
.end function
.//
.function val_synch_service_values
.select many v_fnvs from instances of V_FNV
.for each v_fnv in v_fnvs
.invoke val_synch_service_value( v_fnv, "fnv" )
.end for
.end function
.//
.function val_synch_service_value
.param inst_ref v_fnv
.param string salt
.select one te_sync related by v_fnv->S_SYNC[R827]->TE_SYNC[R2023]
.if ( not_empty te_sync )
.select any te_target from instances of TE_TARGET
.select one v_val related by v_fnv->V_VAL[R801]
.select one te_val related by v_val->TE_VAL[R2040]
.select many v_pars related by v_fnv->V_PAR[R817]
.select one te_aba related by te_sync->TE_ABA[R2010]
.invoke r = gen_parameter_list( v_pars, false, salt )
.assign te_parm = r.result
.assign parameters = te_parm.ParamBuffer
.assign params_OAL = te_parm.OALParamBuffer
.assign te_val.OAL = ( ( "::" + te_sync.Name ) + ( "(" + params_OAL ) ) + ")"
.assign name = te_sync.intraface_method
.if ( "C++" == te_target.language )
.assign name = "thismodule->" + name
.end if
.assign te_val.buffer = name + "("
.if ( "" != parameters )
.assign te_val.buffer = ( te_val.buffer + " " ) + ( parameters + " " )
.end if
.assign te_val.buffer = te_val.buffer + ")"
.assign te_val.dimensions = te_aba.dimensions
.assign te_val.array_spec = te_aba.array_spec
.select one te_dim related by te_aba->TE_DIM[R2058]
.if ( not_empty te_dim )
.// relate te_val to te_dim across R2079;
.assign te_val.te_dimID = te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end if
.end function
.//
.function val_array_element_references
.select many v_aers from instances of V_AER
.for each v_aer in v_aers
.invoke val_array_element_reference( v_aer )
.end for
.end function
.//
.function val_array_element_reference
.param inst_ref v_aer
.select one te_val related by v_aer->V_VAL[R801]->TE_VAL[R2040]
.if ( "" == te_val.buffer )
.select one root_v_val related by v_aer->V_VAL[R838]
.select one root_te_val related by root_v_val->TE_VAL[R2040]
.if ( "" == root_te_val.buffer )
.invoke gen_value( root_v_val )
.end if
.select one index_v_val related by v_aer->V_VAL[R839]
.select one index_te_val related by index_v_val->TE_VAL[R2040]
.if ( "" == index_te_val.buffer )
.invoke gen_value( index_v_val )
.end if
.assign te_val.OAL = ( root_te_val.OAL + "[" ) + ( index_te_val.buffer + "]" )
.assign te_val.buffer = ( root_te_val.buffer + "[" ) + ( index_te_val.buffer + "]" )
.// Peel off outer layer of dimensions.
.// CDS: do not know how to do this with array_spec
.assign te_val.array_spec = root_te_val.array_spec
.assign te_val.dimensions = root_te_val.dimensions - 1
.select one next_te_dim related by root_te_val->TE_DIM[R2079]->TE_DIM[R2060.'succeeds']
.if ( not_empty next_te_dim )
.// relate te_val to next_te_dim across R2079;
.assign te_val.te_dimID = next_te_dim.te_dimID
.// end relate
.else
.assign te_val.te_dimID = 00
.end if
.end if
.end function
.//
.function val_array_length_values
.select many v_alvs from instances of V_ALV
.for each v_alv in v_alvs
.invoke val_array_length_value( v_alv )
.end for
.end function
.//
.function val_array_length_value
.param inst_ref v_alv
.select one te_val related by v_alv->V_VAL[R801]->TE_VAL[R2040]
.if ( "" == te_val.buffer )
.select one root_v_val related by v_alv->V_VAL[R840]
.select one root_te_val related by root_v_val->TE_VAL[R2040]
.if ( "" == root_te_val.buffer )
.invoke gen_value( root_v_val )
.end if
.assign te_val.OAL = root_te_val.OAL + ".length"
.select any te_target from instances of TE_TARGET
.if ( "C" == te_target.language )
.select one te_dim related by root_te_val->TE_DIM[R2079]
.if ( not_empty te_dim )
.assign te_val.buffer = ( ( ( "$t{te_dim.elementCount}" + " /" ) + ( "* " + te_val.OAL ) ) + ( " *" + "/" ) )
.else
.assign te_val.buffer = root_te_val.buffer + ".ARRAY_LENGTH_NOT_FOUND()"
.print "ERROR: C model compiler does not support length operator for OAL value: ${te_val.OAL}"
.exit 101
.end if
.else
.assign te_val.buffer = root_te_val.buffer + ".length"
.end if
.end if
.end function
.//