ocarina-backends-pn-iutils.adb 41 KB
Newer Older
1
2
3
4
5
6
7
8
------------------------------------------------------------------------------
--                                                                          --
--                           OCARINA COMPONENTS                             --
--                                                                          --
--           O C A R I N A . B A C K E N D S . P N . I U T I L S            --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
9
--       Copyright (C) 2009 Telecom ParisTech, 2010-2014 ESA & ISAE.        --
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--                                                                          --
-- Ocarina  is free software;  you  can  redistribute  it and/or  modify    --
-- it under terms of the GNU General Public License as published by the     --
-- Free Software Foundation; either version 2, or (at your option) any      --
-- later version. Ocarina is distributed  in  the  hope  that it will be    --
-- useful, but WITHOUT ANY WARRANTY;  without even the implied warranty of  --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received  a copy of the --
-- GNU General Public License distributed with Ocarina; see file COPYING.   --
-- If not, write to the Free Software Foundation, 51 Franklin Street, Fifth --
-- Floor, Boston, MA 02111-1301, USA.                                       --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable to be   --
-- covered  by the  GNU  General  Public  License. This exception does not  --
-- however invalidate  any other reasons why the executable file might be   --
-- covered by the GNU Public License.                                       --
--                                                                          --
jhugues's avatar
jhugues committed
29
30
--                 Ocarina is maintained by the TASTE project               --
--                      (taste-users@lists.tuxfamily.org)                   --
31
32
33
34
--                                                                          --
------------------------------------------------------------------------------

with Ocarina.AADL_Values;
35
with Ocarina.Namet;
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
with Ocarina.Instances.Queries;

with Ocarina.Backends.PN.Nodes;
with Ocarina.Backends.PN.Nutils;

with Ocarina.ME_AADL.AADL_Instances.Nodes;

with Ocarina.ME_AADL.AADL_Instances.Entities;
with Ocarina.ME_AADL;

with Ocarina.Backends.PN.Debug;
with Ocarina.Backends.Utils;

package body Ocarina.Backends.PN.Iutils is

   package AIN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
   package OPND renames Ocarina.Backends.PN.Debug;

   --------------------------
jhugues's avatar
jhugues committed
55
   -- PN_Init_PN_Generated --
56
57
   --------------------------

jhugues's avatar
jhugues committed
58
   procedure PN_Init_PN_Generated
59
60
     (G : Ocarina.Types.Node_Id;
      F : Ocarina.Types.Value_Id)
61
62
63
64
65
66
67
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

   begin

      --  init pn_box
jhugues's avatar
jhugues committed
68
69
70
      Set_PN_Box (G, New_Node (K_PN_Box));
      Set_PN_Subcomponents (PN_Box (G), New_List (K_List_Id));
      Set_PN_Interconnections (PN_Box (G), New_List (K_List_Id));
71
72
73

      case F is
         when 0 =>
jhugues's avatar
jhugues committed
74
            Set_PN_Formalism_Specific_Informations
75
76
77
              (G,
               New_Node (K_CPN_Specific_Informations));
         when 1 =>
jhugues's avatar
jhugues committed
78
            Set_PN_Formalism_Specific_Informations
79
80
81
82
83
84
85
              (G,
               New_Node (K_TPN_Specific_Informations));
         when others =>
            null;
      end case;
      Set_Formalism (G, F);

jhugues's avatar
jhugues committed
86
   end PN_Init_PN_Generated;
87
88

   -----------------------------
jhugues's avatar
jhugues committed
89
   -- PN_Get_New_PN_Generated --
90
91
   -----------------------------

jhugues's avatar
jhugues committed
92
   function PN_Get_New_PN_Generated
93
     return Ocarina.Types.Node_Id
94
95
96
97
98
   is
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;

jhugues's avatar
jhugues committed
99
      G : constant Node_Id := New_Node (K_PN_Generated);
100
101
   begin

jhugues's avatar
jhugues committed
102
103
      Set_PN_Box (G, No_Node);
      Set_PN_Formalism_Specific_Informations (G, No_Node);
104
105
106
      Set_Formalism (G, New_Integer_Value (0));

      return G;
jhugues's avatar
jhugues committed
107
   end PN_Get_New_PN_Generated;
108

jhugues's avatar
jhugues committed
109
110
111
   ---------------------------------
   -- PN_Get_New_TPN_Informations --
   ---------------------------------
112

jhugues's avatar
jhugues committed
113
   function PN_Get_New_TPN_Informations
114
     return Ocarina.Types.Node_Id
115
116
117
118
119
120
121
122
123
124
125
126
   is
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;

      I : constant Node_Id := New_Node (K_TPN_Specific_Informations);
   begin
      Set_Th_Number (I, New_Integer_Value (0));
      Set_Hyperperiod (I, New_Integer_Value (1));
      Set_Priorities (I, New_List (K_List_Id));

      return I;
jhugues's avatar
jhugues committed
127
   end PN_Get_New_TPN_Informations;
128

jhugues's avatar
jhugues committed
129
130
131
   -----------------------------------
   -- PN_Get_New_Processor_Priority --
   -----------------------------------
132

jhugues's avatar
jhugues committed
133
   function PN_Get_New_Processor_Priority
134
     return Ocarina.Types.Node_Id
135
136
137
138
139
140
141
   is
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Backends.PN.Nodes;

      PP : constant Node_Id := New_Node (K_TPN_Processor_Priority);
   begin
      return PP;
jhugues's avatar
jhugues committed
142
   end PN_Get_New_Processor_Priority;
143

jhugues's avatar
jhugues committed
144
145
146
   --------------------------------
   -- PN_Init_Processor_Priority --
   --------------------------------
147

jhugues's avatar
jhugues committed
148
   procedure PN_Init_Processor_Priority
149
150
     (PN_Proc : Ocarina.Types.Node_Id;
      Aadl_P : Ocarina.Types.Node_Id)
151
152
153
154
   is
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Backends.PN.Nodes;
   begin
jhugues's avatar
jhugues committed
155
156
157
      Set_P_Instance (PN_Proc, Aadl_P);
      Set_Bounded_Trans (PN_Proc, New_List (K_List_Id));
   end PN_Init_Processor_Priority;
158

jhugues's avatar
jhugues committed
159
160
161
   -------------------------------
   -- Append_Trans_To_Processor --
   -------------------------------
162
163

   procedure Append_Trans_To_Processor
164
165
     (PN_T : Ocarina.Types.Node_Id;
      PN_Proc : Ocarina.Types.Node_Id)
166
167
168
169
170
171
   is
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;

   begin
jhugues's avatar
jhugues committed
172
173
174
      if PN_T /= No_Node and then PN_Proc /= No_Node then
         if OPN.Kind (PN_T) = K_TPN_Transition
           and then OPN.Kind (PN_Proc)
175
176
177
178
179
180
           = K_TPN_Processor_Priority then
            declare
               Node_Iter : Node_Id;
               Current_Prio : Value_Type;
               Iter_Prio : Value_Type;
            begin
jhugues's avatar
jhugues committed
181
               if Is_Empty (Bounded_Trans (PN_Proc)) then
182
183
184
185
186
                  declare
                     --  new trans to avoid
                     --  melting next_node
                     New_Trans : Node_Id;
                  begin
jhugues's avatar
jhugues committed
187
188
                     New_Trans := PN_TPN_Get_New_Transition;
                     Set_Priority (New_Trans, Priority (PN_T));
189
                     Set_Identifier (New_Trans,
jhugues's avatar
jhugues committed
190
191
                                     Identifier (PN_T));
                     Append_Node_To_List (New_Trans, Bounded_Trans (PN_Proc));
192
193
                  end;
               else
jhugues's avatar
jhugues committed
194
195
                  Node_Iter := OPN.First_Node (Bounded_Trans (PN_Proc));
                  Current_Prio := Get_Value_Type (Priority (PN_T));
196
197
198
199
200
201
202
203
                  Iter_Prio := Get_Value_Type (Priority (Node_Iter));
                  if Current_Prio.Ival >= Iter_Prio.Ival then
                     --  push in
                     declare
                        --  new trans to avoid
                        --  melting next_node
                        New_Trans : Node_Id;
                     begin
jhugues's avatar
jhugues committed
204
205
                        New_Trans := PN_TPN_Get_New_Transition;
                        Set_Priority (New_Trans, Priority (PN_T));
206
                        Set_Identifier (New_Trans,
jhugues's avatar
jhugues committed
207
                                        Identifier (PN_T));
208
209
210

                        Push_Node_Into_List (New_Trans,
                                             Bounded_Trans
jhugues's avatar
jhugues committed
211
                                             (PN_Proc));
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
                     end;
                  else
                     --  need to run across others
                     while Present (Node_Iter) loop
                        if Current_Prio.Ival < Iter_Prio.Ival then
                           --  here, we will have to do another step
                           declare
                              Next_Iter : Node_Id;
                              Next_Iter_Prio : Value_Type;
                           begin
                              Next_Iter := OPN.Next_Node (Node_Iter);
                              if Next_Iter = No_Node then
                                 --  append here
                                 declare
                                    --  new trans to avoid
                                    --  melting next_node
                                    New_Trans : Node_Id;
                                 begin
jhugues's avatar
jhugues committed
230
231
                                    New_Trans := PN_TPN_Get_New_Transition;
                                    Set_Priority (New_Trans, Priority (PN_T));
232
                                    Set_Identifier (New_Trans,
jhugues's avatar
jhugues committed
233
                                                    Identifier (PN_T));
234
235
236

                                    Append_Node_To_List (New_Trans,
                                                         Bounded_Trans
jhugues's avatar
jhugues committed
237
                                                         (PN_Proc));
238
239
240
241
242
243
244
245
246
247
248
249
250
251
                                    --  leave loop
                                    exit;
                                 end;
                              else
                                 Next_Iter_Prio := Get_Value_Type
                                   (Priority (Next_Iter));
                                 if Current_Prio.Ival
                                   >= Next_Iter_Prio.Ival then
                                    --  insert in list
                                    declare
                                       --  new trans to avoid
                                       --  melting next_node
                                       New_Trans : Node_Id;
                                    begin
jhugues's avatar
jhugues committed
252
                                       New_Trans := PN_TPN_Get_New_Transition;
253
                                       Set_Priority (New_Trans,
jhugues's avatar
jhugues committed
254
                                                     Priority (PN_T));
255
                                       Set_Identifier (New_Trans,
jhugues's avatar
jhugues committed
256
                                                       Identifier (PN_T));
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

                                       Set_Next_Node (Node_Iter, New_Trans);
                                       Set_Next_Node (New_Trans, Next_Iter);
                                       --  leave loop
                                       exit;
                                    end;
                                 end if;
                              end if;
                           end;
                        end if;
                        --  next
                        Node_Iter := OPN.Next_Node (Node_Iter);
                     end loop;
                  end if;
               end if;
            end;

         end if;
      end if;
   end Append_Trans_To_Processor;

jhugues's avatar
jhugues committed
278
279
280
   ----------------------------------
   -- PN_Get_New_Processor_Pattern --
   ----------------------------------
281

jhugues's avatar
jhugues committed
282
   function PN_Get_New_Processor_Pattern
283
     return Ocarina.Types.Node_Id
284
285
286
287
288
289
290
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      P : constant Node_Id := New_Node (K_Processor_Pattern);
   begin
      return P;
jhugues's avatar
jhugues committed
291
   end PN_Get_New_Processor_Pattern;
292

jhugues's avatar
jhugues committed
293
294
295
   -------------------------------
   -- PN_Init_Processor_Pattern --
   -------------------------------
296

jhugues's avatar
jhugues committed
297
   procedure PN_Init_Processor_Pattern
298
299
     (PN_Proc : Ocarina.Types.Node_Id;
      Aadl_P : Ocarina.Types.Node_Id)
300
301
302
303
304
305
306
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Aadl_Values;

   begin

jhugues's avatar
jhugues committed
307
      if PN_Proc /= No_Node
308
        and then Aadl_P /= No_Node then
jhugues's avatar
jhugues committed
309
         PN_Init_PN_Component (PN_Proc, Aadl_P);
310

jhugues's avatar
jhugues committed
311
         Set_Proc_Instance (PN_Proc, Aadl_P);
312
      end if;
jhugues's avatar
jhugues committed
313
314
   end PN_Init_Processor_Pattern;

315
   -------------------------------
jhugues's avatar
jhugues committed
316
   -- PN_Get_New_Thread_Pattern --
317
318
   -------------------------------

jhugues's avatar
jhugues committed
319
   function PN_Get_New_Thread_Pattern
320
     return Ocarina.Types.Node_Id
321
322
323
324
325
326
327
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      T : constant Node_Id := New_Node (K_Thread_Pattern);
   begin
      return T;
jhugues's avatar
jhugues committed
328
   end PN_Get_New_Thread_Pattern;
329
330

   ----------------------------
jhugues's avatar
jhugues committed
331
   -- PN_Init_Thread_Pattern --
332
333
   ----------------------------

jhugues's avatar
jhugues committed
334
   procedure PN_Init_Thread_Pattern
335
336
     (PN_T : Ocarina.Types.Node_Id;
      Aadl_T : Ocarina.Types.Node_Id)
337
338
339
340
341
342
343
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Aadl_Values;

   begin

jhugues's avatar
jhugues committed
344
345
      if PN_T /= No_Node and then Aadl_T /= No_Node then
         PN_Init_PN_Component (PN_T, Aadl_T);
346

jhugues's avatar
jhugues committed
347
348
349
350
351
         Set_In_Ports (PN_T, New_List (K_List_Id));
         Set_Out_Ports (PN_T, New_List (K_List_Id));
         Set_Hyperperiod (PN_T, New_Integer_Value (0));
         Set_Call_Seq (PN_T, New_List (K_List_Id));
         Set_Th_Instance (PN_T, Aadl_T);
352
353
      end if;

jhugues's avatar
jhugues committed
354
   end PN_Init_Thread_Pattern;
355

jhugues's avatar
jhugues committed
356
357
358
   -----------------------------
   -- PN_Get_New_Port_Pattern --
   -----------------------------
359

jhugues's avatar
jhugues committed
360
   function PN_Get_New_Port_Pattern
361
     return Ocarina.Types.Node_Id
362
363
364
365
366
367
368
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      P : constant Node_Id := New_Node (K_Port_Pattern);
   begin
      return P;
jhugues's avatar
jhugues committed
369
   end PN_Get_New_Port_Pattern;
370

jhugues's avatar
jhugues committed
371
372
373
   --------------------------
   -- PN_Init_Port_Pattern --
   --------------------------
374

jhugues's avatar
jhugues committed
375
   procedure PN_Init_Port_Pattern
376
377
     (PN_P : Ocarina.Types.Node_Id;
      Aadl_P : Ocarina.Types.Node_Id)
378
379
380
381
382
383
384
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Aadl_Values;

   begin

jhugues's avatar
jhugues committed
385
386
      if PN_P /= No_Node and then Aadl_P /= No_Node then
         PN_Init_PN_Component (PN_P, Aadl_P);
387

jhugues's avatar
jhugues committed
388
389
390
         Set_Port_Instance (PN_P, Aadl_P);
         Set_Source_Instance (PN_P, No_Node);
         Set_Target_Instance (PN_P, No_Node);
391
392
      end if;

jhugues's avatar
jhugues committed
393
   end PN_Init_Port_Pattern;
394

jhugues's avatar
jhugues committed
395
396
397
   -------------------------------
   -- PN_Get_New_D_Port_Pattern --
   -------------------------------
398

jhugues's avatar
jhugues committed
399
   function PN_Get_New_D_Port_Pattern
400
     return Ocarina.Types.Node_Id
401
402
403
404
405
406
407
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      DP : constant Node_Id := New_Node (K_Data_Port_Pattern);
   begin
      return DP;
jhugues's avatar
jhugues committed
408
   end PN_Get_New_D_Port_Pattern;
409

jhugues's avatar
jhugues committed
410
411
412
   ----------------------------
   -- PN_Init_D_Port_Pattern --
   ----------------------------
413

jhugues's avatar
jhugues committed
414
   procedure PN_Init_D_Port_Pattern
415
416
     (PN_DP : Ocarina.Types.Node_Id;
      Aadl_DP : Ocarina.Types.Node_Id)
417
418
419
420
421
422
423
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Aadl_Values;

   begin

jhugues's avatar
jhugues committed
424
425
      if PN_DP /= No_Node and then Aadl_DP /= No_Node then
         PN_Init_Port_Pattern (PN_DP, Aadl_DP);
426
      end if;
jhugues's avatar
jhugues committed
427
   end PN_Init_D_Port_Pattern;
428

jhugues's avatar
jhugues committed
429
430
431
   --------------------------------
   -- PN_Get_New_ED_Port_Pattern --
   --------------------------------
432

jhugues's avatar
jhugues committed
433
   function PN_Get_New_ED_Port_Pattern
434
     return Ocarina.Types.Node_Id
435
436
437
438
439
440
441
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      DEP : constant Node_Id := New_Node (K_Data_Event_Port_Pattern);
   begin
      return DEP;
jhugues's avatar
jhugues committed
442
   end PN_Get_New_ED_Port_Pattern;
443

jhugues's avatar
jhugues committed
444
445
446
   -----------------------------
   -- PN_Init_ED_Port_Pattern --
   -----------------------------
447

jhugues's avatar
jhugues committed
448
   procedure PN_Init_ED_Port_Pattern
449
450
     (PN_DEP : Ocarina.Types.Node_Id;
      Aadl_DEP : Ocarina.Types.Node_Id)
451
452
453
454
455
456
457
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Aadl_Values;

   begin

jhugues's avatar
jhugues committed
458
459
      if PN_DEP /= No_Node and then Aadl_DEP /= No_Node then
         PN_Init_Port_Pattern (PN_DEP, Aadl_DEP);
460

jhugues's avatar
jhugues committed
461
462
463
         Set_Queue_Size (PN_DEP, New_Integer_Value (1));
         Set_Has_CEP (PN_DEP, False);
         Set_Dispatch_Port (PN_DEP, False);
464
      end if;
jhugues's avatar
jhugues committed
465
   end PN_Init_ED_Port_Pattern;
466
467
468
469
470

   ---------------------------------
   -- PN_Get_New_Call_Seq_Pattern --
   ---------------------------------

jhugues's avatar
jhugues committed
471
   function PN_Get_New_Call_Seq_Pattern
472
     return Ocarina.Types.Node_Id
473
474
475
476
477
478
479
480
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      CS : constant Node_Id := New_Node (K_Call_Sequence_Pattern);
   begin
      return CS;

jhugues's avatar
jhugues committed
481
   end PN_Get_New_Call_Seq_Pattern;
482
483

   ------------------------------
jhugues's avatar
jhugues committed
484
   -- PN_Init_Call_Seq_Pattern --
485
486
   ------------------------------

jhugues's avatar
jhugues committed
487
   procedure PN_Init_Call_Seq_Pattern
488
489
     (PN_CS : Ocarina.Types.Node_Id;
      Aadl_T : Ocarina.Types.Node_Id)
490
491
492
493
494
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
   begin

jhugues's avatar
jhugues committed
495
496
      if PN_CS /= No_Node and then Aadl_T /= No_Node then
         PN_Init_PN_Component (PN_CS, Aadl_T);
497

jhugues's avatar
jhugues committed
498
         Set_Spg_Call (PN_CS, New_List (K_List_Id));
499
500
      end if;

jhugues's avatar
jhugues committed
501
   end PN_Init_Call_Seq_Pattern;
502
503

   ----------------------------
jhugues's avatar
jhugues committed
504
   -- PN_Get_New_Spg_Pattern --
505
506
   ----------------------------

jhugues's avatar
jhugues committed
507
   function PN_Get_New_Spg_Pattern
508
     return Ocarina.Types.Node_Id
509
510
511
512
513
514
515
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      SPG : constant Node_Id := New_Node (K_Subprogram_Call_Pattern);
   begin
      return SPG;
jhugues's avatar
jhugues committed
516
   end PN_Get_New_Spg_Pattern;
517
518

   -------------------------
jhugues's avatar
jhugues committed
519
   -- PN_Init_Spg_Pattern --
520
521
   -------------------------

jhugues's avatar
jhugues committed
522
   procedure PN_Init_Spg_Pattern
523
524
     (PN_Spg : Ocarina.Types.Node_Id;
      Aadl_Spg : Ocarina.Types.Node_Id)
525
526
527
528
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
   begin
jhugues's avatar
jhugues committed
529
530
      if PN_Spg /= No_Node and then Aadl_Spg /= No_Node then
         PN_Init_PN_Component (PN_Spg, Aadl_Spg);
531

jhugues's avatar
jhugues committed
532
533
         Set_Param_In (PN_Spg, New_List (K_List_Id));
         Set_Param_Out (PN_Spg, New_List (K_List_Id));
534
      end if;
jhugues's avatar
jhugues committed
535
   end PN_Init_Spg_Pattern;
536
537

   --------------------------------
jhugues's avatar
jhugues committed
538
   -- PN_Get_New_Spg_Par_Pattern --
539
540
   --------------------------------

jhugues's avatar
jhugues committed
541
   function PN_Get_New_Spg_Par_Pattern
542
     return Ocarina.Types.Node_Id
543
544
545
546
547
548
549
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

      SPG_PAR : constant Node_Id := New_Node (K_Spg_Parameter_Pattern);
   begin
      return SPG_PAR;
jhugues's avatar
jhugues committed
550
   end PN_Get_New_Spg_Par_Pattern;
551
552

   -----------------------------
jhugues's avatar
jhugues committed
553
   -- PN_Init_Spg_Par_Pattern --
554
555
   -----------------------------

jhugues's avatar
jhugues committed
556
   procedure PN_Init_Spg_Par_Pattern
557
558
     (PN_Spg_Par : Ocarina.Types.Node_Id;
      Aadl_Spg_Par : Ocarina.Types.Node_Id)
559
560
561
562
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
   begin
jhugues's avatar
jhugues committed
563
564
      if PN_Spg_Par /= No_Node and then Aadl_Spg_Par /= No_Node then
         PN_Init_PN_Component (PN_Spg_Par, Aadl_Spg_Par);
565

jhugues's avatar
jhugues committed
566
         Set_Par_Instance (PN_Spg_Par, Aadl_Spg_Par);
567
      end if;
jhugues's avatar
jhugues committed
568
   end PN_Init_Spg_Par_Pattern;
569

jhugues's avatar
jhugues committed
570
571
572
   --------------------------
   -- PN_Init_PN_Component --
   --------------------------
573

jhugues's avatar
jhugues committed
574
   procedure PN_Init_PN_Component
575
576
     (PN_C : Ocarina.Types.Node_Id;
      Aadl_C : Ocarina.Types.Node_Id)
577
578
579
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
580
      use Ocarina.Namet;
581
582
583

   begin

jhugues's avatar
jhugues committed
584
      if PN_C /= No_Node and then Aadl_C /= No_Node then
585
         Set_Str_To_Name_Buffer ("::");
jhugues's avatar
jhugues committed
586
         PN_Init_PN_Node (PN_C, Aadl_C, Name_Find);
587

jhugues's avatar
jhugues committed
588
589
590
         Set_Public_Interfaces (PN_C, New_List (K_List_Id));
         Set_Internal_Transitions (PN_C, New_List (K_List_Id));
         Set_Internal_Places (PN_C, New_List (K_List_Id));
591
592
      end if;

jhugues's avatar
jhugues committed
593
   end PN_Init_PN_Component;
594
595

   ---------------------
jhugues's avatar
jhugues committed
596
   -- PN_Init_PN_Node --
597
598
   ---------------------

jhugues's avatar
jhugues committed
599
   procedure PN_Init_PN_Node
600
601
602
     (PN_N : Ocarina.Types.Node_Id;
      Aadl_N : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_id)
603
604
605
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
606
      use Ocarina.Namet;
607
608
609
      use Ocarina.Instances.Queries;

   begin
jhugues's avatar
jhugues committed
610
611
      if PN_N /= No_Node then
         PN_Init_Node (PN_N);
612
613
614
615
616
617
618
619
620
621
622
         if Aadl_N /= No_Node then
            Set_Str_To_Name_Buffer
              (Get_Name_String
               (Compute_Absolute_Name_Of_Entity
                (Aadl_N, Separator)));
            Add_Str_To_Name_Buffer (Get_Name_String (Name));
         else
            Set_Str_To_Name_Buffer (Get_Name_String (Name));
         end if;

         Set_Identifier
jhugues's avatar
jhugues committed
623
           (PN_N,
624
            Make_Identifier
jhugues's avatar
jhugues committed
625
            (PN_N,
626
627
628
             Name_Find));

      end if;
jhugues's avatar
jhugues committed
629
   end PN_Init_PN_Node;
630

jhugues's avatar
jhugues committed
631
632
633
   ------------------
   -- PN_Init_Node --
   ------------------
634

635
   procedure PN_Init_Node (N : Ocarina.Types.Node_Id) is
636
637
638
639
640
641
      use Ocarina.Backends.PN.Nodes;

   begin
      if N /= No_Node then
         Set_Next_Node (N, No_Node);
      end if;
jhugues's avatar
jhugues committed
642
   end PN_Init_Node;
643
644

   -------------------------
jhugues's avatar
jhugues committed
645
   --  PN_TPN_Init_Place  --
646
647
   -------------------------

jhugues's avatar
jhugues committed
648
   procedure PN_TPN_Init_Place
649
650
651
652
     (P : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id;
      PN_G : Ocarina.Types.Node_Id;
653
654
655
656
657
658
      M    : Unsigned_Long_Long)
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;

   begin
jhugues's avatar
jhugues committed
659
660
      if P /= No_Node and then PN_G /= No_Node then
         PN_Init_Place (P, Aadl, Name);
661
662
663
664

         Set_Tokens_Number (P, New_Integer_Value (0));
         --  compilation
         if M = 0 then
jhugues's avatar
jhugues committed
665
            null; --  XXX
666
667
         end if;
      end if;
jhugues's avatar
jhugues committed
668
   end PN_TPN_Init_Place;
669

jhugues's avatar
jhugues committed
670
671
672
   -------------------
   -- PN_Init_Place --
   -------------------
673

jhugues's avatar
jhugues committed
674
   procedure PN_Init_Place
675
676
677
     (P : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id)
678
679
680
   is
   begin
      if P /= No_Node then
jhugues's avatar
jhugues committed
681
         PN_Init_PN_Node (P, Aadl, Name);
682
      end if;
jhugues's avatar
jhugues committed
683
   end PN_Init_Place;
684

jhugues's avatar
jhugues committed
685
686
687
   --------------------------
   -- PN_TPN_Get_New_Place --
   --------------------------
688

jhugues's avatar
jhugues committed
689
   function PN_TPN_Get_New_Place
690
     return Ocarina.Types.Node_Id
691
692
693
694
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

695
      P : constant Ocarina.Types.Node_Id := New_Node (K_TPN_Place);
696
697
   begin
      return P;
jhugues's avatar
jhugues committed
698
   end PN_TPN_Get_New_Place;
699

jhugues's avatar
jhugues committed
700
701
702
   ----------------------------
   -- PN_TPN_Init_Transition --
   ----------------------------
703

jhugues's avatar
jhugues committed
704
   procedure PN_TPN_Init_Transition
705
706
707
708
     (T : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id;
      PN_G : Ocarina.Types.Node_Id;
709
710
711
712
713
714
715
      M    : Unsigned_Long_Long)
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;
      use Ocarina.Backends.PN.Nutils;

   begin
jhugues's avatar
jhugues committed
716
717
      if T /= No_Node and then PN_G /= No_Node then
         PN_Init_Transition (T, Aadl, Name);
718
719
720
721
722
723
724
725
726
727
728
729
730
731

         --  default : immediate transitions
         Set_Guard (T, New_Node (K_TPN_Guard));
         Set_Lower_Value (Guard (T), New_Integer_Value (0));
         Set_Higher_Value (Guard (T), New_Integer_Value (-1));
         Set_Braces_Mode (Guard (T), New_Integer_Value (2));

         Set_Priority (T, New_Integer_Value (0));

         --  compilation
         if M = 0 then
            null;
         end if;
      end if;
jhugues's avatar
jhugues committed
732
   end PN_TPN_Init_Transition;
733

jhugues's avatar
jhugues committed
734
735
736
   ------------------------
   -- PN_Init_Transition --
   ------------------------
737

jhugues's avatar
jhugues committed
738
   procedure PN_Init_Transition
739
740
741
     (T : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id)
742
   is
jhugues's avatar
jhugues committed
743
      pragma Assert (Present (T));
744
745
746
747
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

   begin
jhugues's avatar
jhugues committed
748
749
750
751
      PN_Init_PN_Node (T, Aadl, Name);
      Set_PN_Arcs_In (T, New_List (K_List_Id));
      Set_PN_Arcs_Out (T, New_List (K_List_Id));
   end PN_Init_Transition;
752

jhugues's avatar
jhugues committed
753
754
755
   -------------------------------
   -- PN_TPN_Get_New_Transition --
   -------------------------------
756

jhugues's avatar
jhugues committed
757
   function PN_TPN_Get_New_Transition
758
     return Ocarina.Types.Node_Id
759
760
761
762
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

763
      P : constant Ocarina.Types.Node_Id := New_Node (K_TPN_Transition);
764
765
   begin
      return P;
jhugues's avatar
jhugues committed
766
   end PN_TPN_Get_New_Transition;
767

jhugues's avatar
jhugues committed
768
769
770
   ----------------------
   -- PN_TPN_Set_Guard --
   ----------------------
771

jhugues's avatar
jhugues committed
772
   procedure PN_TPN_Set_Guard
773
774
775
776
     (T : Ocarina.Types.Node_Id;
      Low, Up : Ocarina.Types.Value_Id;
      Braces_Mode : Ocarina.Types.Value_Id;
      Priority : Ocarina.Types.Value_Id)
777
   is
jhugues's avatar
jhugues committed
778
      pragma Assert (Present (T));
779
780
781
782
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;

   begin
jhugues's avatar
jhugues committed
783
784
785
786
787
      Set_Lower_Value (Guard (T), Low);
      Set_Higher_Value (Guard (T), Up);
      Set_Braces_Mode (Guard (T), Braces_Mode);
      Set_Priority (T, Priority);
   end PN_TPN_Set_Guard;
788

jhugues's avatar
jhugues committed
789
790
791
   ------------------------
   -- PN_TPN_Get_New_Arc --
   ------------------------
792

jhugues's avatar
jhugues committed
793
   function PN_TPN_Get_New_Arc
794
     return Ocarina.Types.Node_Id
795
796
797
798
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

799
      A : constant Ocarina.Types.Node_Id := New_Node (K_TPN_Arc);
800
801
   begin
      return A;
jhugues's avatar
jhugues committed
802
   end PN_TPN_Get_New_Arc;
803

jhugues's avatar
jhugues committed
804
805
806
   --------------------------
   -- PN_TPN_Duplicate_Arc --
   --------------------------
807

jhugues's avatar
jhugues committed
808
   procedure PN_TPN_Duplicate_Arc
809
810
811
     (A : Ocarina.Types.Node_Id;
      A_Inst : Ocarina.Types.Node_Id;
      Endpoint : Ocarina.Types.Node_Id;
812
813
814
815
      From : Boolean := False)
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;
816
      use Ocarina.Namet;
817
818
819
      use Ocarina.Instances.Queries;
      use Ocarina.Backends.PN.Nutils;

820
      New_Arc : Ocarina.Types.Node_Id;
821
   begin
jhugues's avatar
jhugues committed
822
      New_Arc := PN_TPN_Get_New_Arc;
823
      if From then
jhugues's avatar
jhugues committed
824
         PN_TPN_Init_Arc (New_Arc,
825
826
                          A_Inst,
                          Endpoint,
jhugues's avatar
jhugues committed
827
                          PN_To (A));
828
         Append_Node_To_List (New_Arc,
jhugues's avatar
jhugues committed
829
                              PN_Arcs_Out (Endpoint));
830
      else
jhugues's avatar
jhugues committed
831
         PN_TPN_Init_Arc (New_Arc,
832
                          A_Inst,
jhugues's avatar
jhugues committed
833
                          PN_From (A),
834
835
                          Endpoint);
         Append_Node_To_List (New_Arc,
jhugues's avatar
jhugues committed
836
                              PN_Arcs_In (Endpoint));
837
      end if;
jhugues's avatar
jhugues committed
838
   end PN_TPN_Duplicate_Arc;
839

jhugues's avatar
jhugues committed
840
841
842
   ---------------------
   -- PN_TPN_Init_Arc --
   ---------------------
843

jhugues's avatar
jhugues committed
844
   procedure PN_TPN_Init_Arc
845
846
847
848
     (A : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      From : Ocarina.Types.Node_Id := No_Node;
      To : Ocarina.Types.Node_Id := No_Node;
849
850
851
852
      K : Unsigned_Long_Long := 0)
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;
853
      use Ocarina.Namet;
854
855
856
857
858
      use Ocarina.Instances.Queries;

   begin
      if A /= No_Node then
         Set_Str_To_Name_Buffer ("_a_");
jhugues's avatar
jhugues committed
859
         PN_Init_Arc (A, Aadl, From, To, Name_Find);
860
861
862
863

         Set_is_Priority (A, False);
         Set_Valuation (A, New_Integer_Value (K));
      end if;
jhugues's avatar
jhugues committed
864
   end PN_TPN_INit_Arc;
865

jhugues's avatar
jhugues committed
866
867
868
   -----------------
   -- PN_Init_Arc --
   -----------------
869

jhugues's avatar
jhugues committed
870
   procedure PN_Init_Arc
871
872
873
874
875
     (A : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      From : Ocarina.Types.Node_Id;
      To : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id)
876
877
878
879
880
881
   is
      use Ocarina.Backends.PN.Nodes;

   begin

      if A /= No_Node then
jhugues's avatar
jhugues committed
882
         PN_Init_PN_Node (A, Aadl, Name);
883

jhugues's avatar
jhugues committed
884
885
         Set_PN_From (A, From);
         Set_PN_To (A, To);
886
887
888

      end if;

jhugues's avatar
jhugues committed
889
   end PN_Init_Arc;
890

jhugues's avatar
jhugues committed
891
892
893
   ---------------------------------
   -- PN_Get_New_CPN_Informations --
   ---------------------------------
894

jhugues's avatar
jhugues committed
895
   function PN_Get_New_CPN_Informations
896
     return Ocarina.Types.Node_Id
897
898
899
900
   is
      use Ocarina.Backends.PN.Nutils;
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;
901
      use Ocarina.Namet;
902
903
904
905
906
907
908
909
910
911
912
913
914

      I : constant Node_Id := New_Node (K_CPN_Specific_Informations);
   begin

      Set_Classes (I, New_Node (K_CPN_Formalism_Classes));
      Set_Class_List (Classes (I), New_List (K_List_Id));
      --  two default classes : threads_id and messages
      declare
         Th_Ids : constant Node_Id
           := New_Node (K_CPN_Formalism_Class_Item_Range);
         Msg_T : constant Node_Id
           := New_Node (K_CPN_Formalism_Class_Item_Enum);
      begin
jhugues's avatar
jhugues committed
915
         PN_Init_PN_Node (Th_Ids,
916
917
918
919
920
                          No_Node,
                          Get_String_Name ("Threads_Ids"));
         Append_Node_To_List (Th_Ids,
                              Class_List (Classes (I)));

jhugues's avatar
jhugues committed
921
         PN_Init_PN_Node (Msg_T,
922
923
924
925
926
927
928
                          No_Node,
                          Get_String_Name ("Msg_Types"));
         Set_Enum (Msg_T, New_List (K_List_Id));
         declare
            Class_Iter : constant Node_Id
              := New_Node (K_CPN_Formalism_Class_Item_Enum_Item);
         begin
jhugues's avatar
jhugues committed
929
            PN_Init_PN_Node (Class_Iter,
930
931
932
933
934
935
936
937
938
939
940
941
942
943
                             No_Node,
                             Get_String_Name ("msg"));
            Append_Node_To_List (Class_Iter,
                                 Enum (Msg_T));
         end;

         Append_Node_To_List (Msg_T,
                              Class_List (Classes (I)));
      end;
      ----
      Set_Domains (I, New_List (K_List_Id));
      --  default domain messages = <th_id x msg_type>
      Append_Node_To_List (New_Node (K_CPN_Formalism_Domains),
                           Domains (I));
jhugues's avatar
jhugues committed
944
      PN_Init_PN_Node (OPN.First_Node (Domains (I)),
945
946
947
948
949
950
951
952
953
954
                       No_Node,
                       Get_String_Name ("mess"));
      Set_Domain_List (OPN.First_Node (Domains (I)), New_List (K_List_Id));

      declare
         Dom_Th_Id : constant Node_Id
           := New_Node (K_CPN_Formalism_Class_Item_Range);
         Dom_Msg : constant Node_Id
           := New_Node (K_CPN_Formalism_Class_Item_Enum_Item);
      begin
jhugues's avatar
jhugues committed
955
         PN_Init_PN_Node (Dom_Th_Id,
956
957
958
959
960
961
962
                          No_Node,
                          Name (Identifier (OPN.First_Node
                                            (Class_List
                                             (Classes (I))))));
         Append_Node_To_List (Dom_Th_Id,
                              Domain_List (OPN.First_Node (Domains (I))));

jhugues's avatar
jhugues committed
963
         PN_Init_PN_Node (Dom_Msg,
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
                          No_Node,
                          Name (Identifier (OPN.Next_Node
                                (OPN.First_Node (Class_List (Classes (I)))))));
         Append_Node_To_List (Dom_Msg,
                              Domain_List (OPN.First_Node (Domains (I))));
      end;
      ----
      Set_Variables (I, New_List (K_List_Id));
      --  init for default classes
      declare
         Class_Iter : Node_Id := OPN.First_Node (Class_List (Classes (I)));
         Var_Node : Node_Id;
      begin
         while Present (Class_Iter) loop
            Var_Node := New_Node (K_CPN_Formalism_Variables);
            Set_Class_Type (Var_Node, Class_Iter);
            Set_Variable_List (Var_Node, New_List (K_List_Id));

            Append_Node_To_List (Var_Node,
                                 Variables (I));
            --  next
            Class_Iter := OPN.Next_Node (Class_Iter);
         end loop;
      end;
      --  default variables are x and y in th_ids, and m in Msg
      declare
         X : constant Node_Id := New_Node (K_CPN_Formalism_Variable_Item);
         Y : constant Node_Id := New_Node (K_CPN_Formalism_Variable_Item);
         M : constant Node_Id := New_Node (K_CPN_Formalism_Variable_Item);
      begin
jhugues's avatar
jhugues committed
994
995
996
         PN_Init_PN_Node (X, No_Node, Get_String_Name ("x"));
         PN_Init_PN_Node (Y, No_Node, Get_String_Name ("y"));
         PN_Init_PN_Node (M, No_Node, Get_String_Name ("m"));
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013

         Append_Node_To_List (X,
                              Variable_List (OPN.First_Node (Variables (I))));
         Append_Node_To_List (Y,
                              Variable_List (OPN.First_Node (Variables (I))));
         Append_Node_To_List (M,
                              Variable_List
                              (OPN.Next_Node
                               (OPN.First_Node (Variables (I)))));
      end;

      ----
      Set_Threads_Count (I, New_Integer_Value (0));
      Set_Threads_Ids (I, New_List (K_List_Id));
      Set_Ports_Ids (I, New_List (K_List_Id));

      return I;
jhugues's avatar
jhugues committed
1014
   end PN_Get_New_CPN_Informations;
1015
1016

   ----------------------------
jhugues's avatar
jhugues committed
1017
   --  PN_CPN_Get_New_Place  --
1018
1019
   ----------------------------

jhugues's avatar
jhugues committed
1020
   function PN_CPN_Get_New_Place
1021
     return Ocarina.Types.Node_Id
1022
1023
1024
1025
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

1026
      P : constant Ocarina.Types.Node_Id := New_Node (K_CPN_Place);
1027
1028
   begin
      return P;
jhugues's avatar
jhugues committed
1029
   end PN_CPN_Get_New_Place;
1030
1031

   -------------------------
jhugues's avatar
jhugues committed
1032
   --  PN_CPN_Init_Place  --
1033
1034
   -------------------------

jhugues's avatar
jhugues committed
1035
   procedure PN_CPN_Init_Place
1036
1037
1038
1039
     (P : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id;
      PN_G : Ocarina.Types.Node_Id;
1040
1041
1042
1043
      M    : Unsigned_Long_Long)
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;
1044
      use Ocarina.Namet;
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
      use Ocarina.AADL_Values;
      use Ocarina.ME_AADL.AADL_Instances.Entities;
      use Ocarina.ME_AADL;

   begin
      --  when Aadl is a thread, then the place holds thread id
      --  when it is a port, then the place holds a message type

      --  0 : event -> mess || data -> mess -> data marking
      --  1 : event -> marked uncolored
jhugues's avatar
jhugues committed
1055
      PN_Init_Place (P, Aadl, Name);
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065

      Set_Marking (P, New_Node (K_CPN_Marking));
      Set_Tokens (Marking (P), New_List (K_List_Id));
      Set_Nb_T (P, New_Integer_Value (0));

      case AIN.Kind (Aadl) is
         when AIN.K_Port_Spec_Instance =>
            if M = 0 then
               --  mess domain
               Set_Domain (P, OPN.First_Node
jhugues's avatar
jhugues committed
1066
1067
                           (Domains (PN_Formalism_Specific_Informations
                                     (PN_G))));
1068
1069
1070
1071
1072
1073
1074
               if not AIN.Is_Event (Aadl)
                 and then AIN.Is_In (AAdl) then
                  --  data marking
                  declare
                     V_Node : Node_Id
                       := New_Node (K_CPN_Marking_Token);
                  begin
jhugues's avatar
jhugues committed
1075
                     PN_Init_PN_Node (V_Node,
1076
1077
1078
1079
1080
1081
                                      No_Node,
                                      Get_String_Name ("data"));
                     Append_Node_To_List (V_Node,
                                          Tokens (Marking (P)));

                     V_Node := New_Node (K_CPN_Marking_Token);
jhugues's avatar
jhugues committed
1082
                     PN_Init_PN_Node (V_Node,
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
                                      No_Node,
                                      Get_String_Name ("0")); --  no th_id
                     Append_Node_To_List (V_Node,
                                          Tokens (Marking (P)));

                  end;

               end if;
            else
               --  uncolored
               Set_Domain (P, No_Node);
               --  set marking to 1
               Set_Nb_T (P, New_Integer_Value (1));
            end if;

         when others =>
            --  test for threads
            if Get_Category_Of_Component (Aadl)
              = CC_Thread then
               --  th_ids class
               Set_Domain (P, OPN.First_Node
                           (Class_List (Classes
jhugues's avatar
jhugues committed
1105
1106
                                        (PN_Formalism_Specific_Informations
                                         (PN_G)))));
1107
1108
1109
            --  marking is set afterward
            end if;
      end case;
jhugues's avatar
jhugues committed
1110
   end PN_CPN_Init_Place;
1111

jhugues's avatar
jhugues committed
1112
1113
1114
   -------------------------------
   -- PN_CPN_Get_New_Transition --
   -------------------------------
1115

jhugues's avatar
jhugues committed
1116
   function PN_CPN_Get_New_Transition
1117
     return Ocarina.Types.Node_Id
1118
1119
1120
1121
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Backends.PN.Nutils;

1122
      T : constant Ocarina.Types.Node_Id := New_Node (K_CPN_Transition);
1123
1124
   begin
      return T;
jhugues's avatar
jhugues committed
1125
   end PN_CPN_Get_New_Transition;
1126

jhugues's avatar
jhugues committed
1127
1128
1129
   ----------------------------
   -- PN_CPN_Init_Transition --
   ----------------------------
1130

jhugues's avatar
jhugues committed
1131
   procedure PN_CPN_Init_Transition
1132
1133
1134
1135
     (T : Ocarina.Types.Node_Id;
      Aadl : Ocarina.Types.Node_Id;
      Name : Ocarina.Types.Name_Id;
      PN_G : Ocarina.Types.Node_Id;
1136
1137
1138
1139
1140
1141
1142
      M    : Unsigned_Long_Long)
   is
      use Ocarina.Backends.PN.Nodes;
      use Ocarina.Aadl_Values;
      use Ocarina.Backends.PN.Nutils;

   begin
jhugues's avatar
jhugues committed
1143
1144
      if T /= No_Node and then PN_G /= No_Node then
         PN_Init_Transition (T, Aadl, Name);
1145
1146
1147
1148
1149
1150
1151
1152
1153

         --  default : immediate transitions
         Set_Guards (T, New_List (K_List_Id));

         --  compilation
         if M = 0 then
            null;
         end if;
      end if;
jhugues's avatar
jhugues committed
1154
   end PN_CPN_Init_Transition;
1155

jhugues's avatar
jhugues committed
1156
1157