taste-aadl_parser.adb 20.9 KB
Newer Older
1
2
--  ************************ TASTE AADL Parser **************************  --
--  Based on Ocarina ****************************************************  --
3
--  (c) 2019 Maxime Perrotin / European Space Agency - maxime.perrotin@esa.int
4
5
--  LGPL license, see LICENSE file

6
with System.Assertions,
7
8
     Ada.Exceptions,
     Ada.Text_IO,
9
     Ada.Directories,
10
     Ada.Strings.Equal_Case_Insensitive,
11
     Ada.Containers,
12
     GNAT.Command_Line,
13
14
15
16
17
     Errors,
     Locations,
     Ocarina.Namet,
     Ocarina.Configuration,
     Ocarina.Files,
18
     Ocarina.Parser,
19
     Ocarina.FE_AADL.Parser,
Maxime Perrotin's avatar
Maxime Perrotin committed
20
     TASTE.Backend.Build_Script,
Maxime Perrotin's avatar
Maxime Perrotin committed
21
     TASTE.Backend.Code_Generators,
22
     TASTE.Semantic_Check;
23
24
25

use Ada.Text_IO,
    Ada.Exceptions,
26
    Ada.Directories,
27
    Ada.Containers,
28
29
30
31
32
33
34
    Locations,
    Ocarina.Namet,
    Ocarina;

package body TASTE.AADL_Parser is

   function Initialize return Taste_Configuration is
Maxime Perrotin's avatar
Maxime Perrotin committed
35
36
37
      File_Name  : Name_Id;
      File_Descr : Location;
      Cfg        : Taste_Configuration;
38
      use String_Holders;
39
40
41
42
   begin
      Banner;
      --  Parse arguments before initializing Ocarina, otherwise Ocarina eats
      --  some arguments (all file parameters).
Maxime Perrotin's avatar
Maxime Perrotin committed
43
      Parse_Command_Line (Cfg);
44
45
46
47
      Initialize_Ocarina;

      AADL_Language := Get_String_Name ("aadl");

48
      if Cfg.Interface_View.Is_Empty and not Cfg.Check_Data_View then
Maxime Perrotin's avatar
Maxime Perrotin committed
49
50
         --  Use "InterfaceView.aadl" by default, if nothing else is specified
         --  and if the tool is not only called to check the data view
51
52
         --  Cfg.Interface_View := Default_Interface_View'Access;
         Cfg.Interface_View := To_Holder (Default_Interface_View);
53
54
      end if;

Maxime Perrotin's avatar
Maxime Perrotin committed
55
      --  An interface view is expected, look for it and parse it
56
57
      if not Cfg.Interface_View.Is_Empty then
         Set_Str_To_Name_Buffer (Cfg.Interface_View.Element);
58

Maxime Perrotin's avatar
Maxime Perrotin committed
59
60
61
         File_Name := Ocarina.Files.Search_File (Name_Find);
         if File_Name = No_Name then
            raise AADL_Parser_Error
62
63
              with "Interface View file not found : "
              & Cfg.Interface_View.Element;
Maxime Perrotin's avatar
Maxime Perrotin committed
64
65
66
         end if;

         File_Descr := Ocarina.Files.Load_File (File_Name);
67

Maxime Perrotin's avatar
Maxime Perrotin committed
68
69
         Interface_Root := Ocarina.Parser.Parse
           (AADL_Language, Interface_Root, File_Descr);
70

Maxime Perrotin's avatar
Maxime Perrotin committed
71
72
73
74
75
76
77
         --  Parse TASTE_IV_Properties.aadl
         Set_Str_To_Name_Buffer ("TASTE_IV_Properties.aadl");
         File_Name  := Ocarina.Files.Search_File (Name_Find);
         File_Descr := Ocarina.Files.Load_File (File_Name);
         Interface_Root := Ocarina.Parser.Parse (AADL_Language,
                                                 Interface_Root, File_Descr);
      end if;
78

Maxime Perrotin's avatar
Maxime Perrotin committed
79
80
81
      if Cfg.Glue then
         --  Look for a deployment view (or DeploymentView.aadl by default)
         --  if the glue generation is requested. Not needed for skeletons.
82
83
         if Cfg.Deployment_View.Is_Empty then
            Cfg.Deployment_View := To_Holder (Default_Deployment_View);
84
85
         end if;

86
         Set_Str_To_Name_Buffer (Cfg.Deployment_View.Element);
87
88
89
90

         File_Name := Ocarina.Files.Search_File (Name_Find);
         if File_Name = No_Name then
            raise AADL_Parser_Error
91
92
              with "Deployment View file not found : "
              & Cfg.Deployment_View.Element;
93
94
95
96
97
98
99
100
101
102
103
         end if;

         File_Descr := Ocarina.Files.Load_File (File_Name);
         Deployment_Root := Ocarina.Parser.Parse
           (AADL_Language, Deployment_Root, File_Descr);

         if Deployment_Root = No_Node then
            raise AADL_Parser_Error with "Deployment View is incorrect";
         end if;
      end if;

Maxime Perrotin's avatar
Maxime Perrotin committed
104
105
106
      for Each of Cfg.Other_Files loop
         --  Add other files to the Interface and (if any) deployment roots
         --  (List of files specified in the command line)
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
         Set_Str_To_Name_Buffer (Each);
         File_Name := Ocarina.Files.Search_File (Name_Find);
         if File_Name = No_Name then
            raise AADL_Parser_Error with "File not found: " & Each;
         end if;
         File_Descr := Ocarina.Files.Load_File (File_Name);

         Interface_Root := Ocarina.Parser.Parse
           (AADL_Language, Interface_Root, File_Descr);
         if Deployment_Root /= No_Node then
            Deployment_Root := Ocarina.Parser.Parse
              (AADL_Language, Deployment_Root, File_Descr);
         end if;
      end loop;

122
123
      if not Cfg.Data_View.Is_Empty then
         Set_Str_To_Name_Buffer (Cfg.Data_View.Element);
124
125
         File_Name := Ocarina.Files.Search_File (Name_Find);
         if File_Name = No_Name then
126
127
            raise AADL_Parser_Error
              with "Could not find " & Cfg.Data_View.Element;
128
129
         end if;
      else
Maxime Perrotin's avatar
Maxime Perrotin committed
130
         --  Try with default name (DataView.aadl)
131
132
133
         Set_Str_To_Name_Buffer (Default_Data_View);
         File_Name := Ocarina.Files.Search_File (Name_Find);
         if File_Name /= No_Name then
134
            Cfg.Data_View := To_Holder (Default_Data_View);
Maxime Perrotin's avatar
Maxime Perrotin committed
135
136
137
         elsif Cfg.Check_Data_View then
            --  No dataview found, while user asked explicitly for a check
            raise AADL_Parser_Error with "Could not find DataView.aadl";
138
139
140
141
         end if;
      end if;

      if File_Name /= No_Name then
142
         Put_Info ("Parsing " & Cfg.Data_View.Element);
Maxime Perrotin's avatar
Maxime Perrotin committed
143

144
145
         File_Descr := Ocarina.Files.Load_File (File_Name);

Maxime Perrotin's avatar
Maxime Perrotin committed
146
147
148
149
150
         --  Add the Data View to the Interface View root, if any
         if Interface_Root /= No_Node then
            Interface_Root := Ocarina.Parser.Parse
              (AADL_Language, Interface_Root, File_Descr);
         end if;
151
152
153
154
155
156

         --  Add the Data View to the Deployment View root, if any
         if Deployment_Root /= No_Node then
            Deployment_Root := Ocarina.Parser.Parse
               (AADL_Language, Deployment_Root, File_Descr);
         end if;
157
         --  Also parse the data view as a root component
158
         Ocarina.FE_AADL.Parser.Add_Pre_Prop_Sets := False;
159
160
161
         Dataview_root := Ocarina.Parser.Parse
                            (AADL_Language, Dataview_root, File_Descr);
      end if;
Maxime Perrotin's avatar
Maxime Perrotin committed
162
      return Cfg;
163
164
165
166
167
168
169
   end Initialize;

   function Parse_Project return TASTE_Model is
      Result : TASTE_Model;
   begin
      Result.Configuration := Initialize;

Maxime Perrotin's avatar
Maxime Perrotin committed
170
171
172
173
174
175
176
177
      if Interface_Root /= No_Node then
         --  Parse Interface and Deployment View
         begin
            Result.Interface_View := Parse_Interface_View (Interface_Root);
         exception
            when System.Assertions.Assert_Failure =>
               raise AADL_Parser_Error with "Interface view parsing error";
         end;
178

179
180
         if not Result.Configuration.Deployment_View.Is_Empty then
            AADL_Lib.Append (Result.Configuration.Interface_View.Element);
Maxime Perrotin's avatar
Maxime Perrotin committed
181
182
            Result.Deployment_View := Parse_Deployment_View (Deployment_Root);
         end if;
183
184
      end if;

185
      if not Result.Configuration.Data_View.Is_Empty then
186
187
         begin
            Result.Data_View := Parse_Data_View (Dataview_root);
188
            Result.Data_View.Check_Files;
189
190
191
192
193
         exception
            when Constraint_Error =>
               raise Data_View_Error with "Update your data view!";
         end;
      end if;
194

195
196
197
      Ocarina.Configuration.Reset_Modules;
      Ocarina.Reset;

Maxime Perrotin's avatar
Maxime Perrotin committed
198
199
200
201
      if Result.Configuration.Check_Data_View then
         raise Quit_Taste;
      end if;

202
203
      Semantic_Check.Check_Model (Result);

204
205
206
207
208
209
210
      return Result;
   exception
      when Error : AADL_Parser_Error
         | Interface_Error
         | Function_Error
         | No_RCM_Error
         | Deployment_View_Error
211
         | Data_View_Error
212
         | Semantic_Check.Semantic_Error
213
         | Device_Driver_Error =>
214
         Put_Error (Exception_Message (Error));
215
216
217
         raise Quit_Taste;
      when GNAT.Command_Line.Exit_From_Command_Line =>
         New_Line;
218
219
         Put_Info ("For more information, visit " & Underline & White_Bold
                   & "https://taste.tools");
220
221
222
223
         raise Quit_Taste;
      when GNAT.Command_Line.Invalid_Switch
         | GNAT.Command_Line.Invalid_Parameter
         | GNAT.Command_Line.Invalid_Section =>
224
         Put_Error ("Invalid switch or parameter (try --help)" & No_Color);
225
         raise Quit_Taste;
Maxime Perrotin's avatar
Maxime Perrotin committed
226
227
      when Quit_Taste =>
         raise;
228
229
230
231
232
      when E : others =>
         Errors.Display_Bug_Box (E);
         raise Quit_Taste;
   end Parse_Project;

233
234
235
236
   function Find_Binding (Model : TASTE_Model;
                          F     : Unbounded_String)
                          return Option_Partition.Option is
      use Option_Partition;
237
238
      function Is_Equal (Left, Right : String) return Boolean
         renames Ada.Strings.Equal_Case_Insensitive;
239
240
241
242
243
      Function_Name : constant String := To_String (F);
   begin
      for Node of Model.Deployment_View.Nodes loop
         for Each of Node.Partitions loop
            for Binding of Each.Bound_Functions loop
244
               if Is_Equal (Binding, Function_Name) then
245
246
247
248
249
250
251
252
                  return Just (Each);
               end if;
            end loop;
         end loop;
      end loop;
      return Nothing;
   end Find_Binding;

Maxime Perrotin's avatar
Maxime Perrotin committed
253
   procedure Set_Calling_Threads (Partition : in out CV_Partition) is
Maxime Perrotin's avatar
Maxime Perrotin committed
254
      procedure Rec_Add_Calling_Thread (Thread_Id : String;
Maxime Perrotin's avatar
Maxime Perrotin committed
255
                                        Block_Id  : String) is
Maxime Perrotin's avatar
Maxime Perrotin committed
256
257
      begin
         --  First add thread to its corresponding protected function
Maxime Perrotin's avatar
Maxime Perrotin committed
258
259
         --  Stop recursion if thread is already there...
         if not String_Sets.To_Set (Thread_Id).Is_Subset
Maxime Perrotin's avatar
Maxime Perrotin committed
260
           (Of_Set => Partition.Blocks (Block_Id).Calling_Threads)
Maxime Perrotin's avatar
Maxime Perrotin committed
261
         then
Maxime Perrotin's avatar
Maxime Perrotin committed
262
            Partition.Blocks (Block_Id).Calling_Threads.Insert (Thread_Id);
Maxime Perrotin's avatar
Maxime Perrotin committed
263
264
265
266
         else
            return;
         end if;

Maxime Perrotin's avatar
Maxime Perrotin committed
267
         --  Then recurse on its (Un)protected RIs.
Maxime Perrotin's avatar
Maxime Perrotin committed
268
         for RI of Partition.Blocks (Block_Id).Required loop
Maxime Perrotin's avatar
Maxime Perrotin committed
269
270
271
272
273
            if RI.RCM = Protected_Operation or RI.RCM = Unprotected_Operation
            then
               for Remote of RI.Remote_Interfaces loop
                  Rec_Add_Calling_Thread
                    (Thread_Id => Thread_Id,
Maxime Perrotin's avatar
Maxime Perrotin committed
274
                     Block_Id  => To_String (Remote.Function_Name));
Maxime Perrotin's avatar
Maxime Perrotin committed
275
276
277
278
279
               end loop;
            end if;
         end loop;
      end Rec_Add_Calling_Thread;
   begin
Maxime Perrotin's avatar
Maxime Perrotin committed
280
      for Each of Partition.Threads loop
Maxime Perrotin's avatar
Maxime Perrotin committed
281
282
         Rec_Add_Calling_Thread (Thread_Id => To_String (Each.Name),
                                 Block_Id  => To_String
Maxime Perrotin's avatar
Maxime Perrotin committed
283
                                   (Each.Protected_Block_Name));
Maxime Perrotin's avatar
Maxime Perrotin committed
284
285
286
      end loop;
   end Set_Calling_Threads;

287
288
289
290
291
292
   --  Find the output ports of a thread by following the connections
   function Get_Output_Ports (Model : TASTE_Model;
                              F     : Taste_Terminal_Function) return Ports.Map
   is
      Result            : Ports.Map;
      Visited_Functions : String_Sets.Set;
293

294
295
296
297
298
299
300
301
302
303
304
305
306
307
      procedure Rec_Find_Thread (Ports_Map  : in out Ports.Map;
                                 Visited    : in out String_Sets.Set;
                                 Func       : Taste_Terminal_Function) is
         use String_Sets;
         Current_Function : constant String_Sets.Set :=
           String_Sets.To_Set (To_String (Func.Name));
      begin
         --  Recursively find distand threads by following (un)pro RI paths
         --  Ignore already visited nodes (system may have circular paths)
         if Current_Function.Is_Subset (Of_Set => Visited) then
            return;
         else
            Visited := Visited or Current_Function;
         end if;
Maxime Perrotin's avatar
Maxime Perrotin committed
308
309
310
311
         if Func.Is_Type then
            --  Ignore function types, only work with instances
            return;
         end if;
312
313

         for RI of Func.Required loop
Maxime Perrotin's avatar
Maxime Perrotin committed
314
315
316
317
            if RI.Remote_Interfaces.Is_Empty then
               goto Continue;
            end if;

318
319
320
321
322
323
324
325
326
327
328
329
            if RI.RCM = Unprotected_Operation or RI.RCM = Protected_Operation
            then
               Rec_Find_Thread (Ports_Map => Ports_Map,
                                Visited   => Visited,
                                Func      =>
                                  Model.Interface_View.Flat_Functions
                                  (To_String
                          (RI.Remote_Interfaces.First_Element.Function_Name)));
            else
               declare
                  --  Assume only one remote connection per RI
                  --  Have to iterate on Remote_Interfaces if that changes
330
331

                  Dist      : constant Remote_Entity :=
332
                    RI.Remote_Interfaces.First_Element;
333
334
335
336
337
338
339
                  Remote_Thread_Name : constant Unbounded_String :=
                    Dist.Function_Name & "_" & Dist.Interface_Name;
                  Port_Name : constant Unbounded_String :=
                    Remote_Thread_Name & "_" & Dist.Interface_Name;
                  New_P     : constant Port :=
                    (Name          => Port_Name,
                     Remote_Thread => Remote_Thread_Name,
340
341
                     Remote_PI     => Dist.Interface_Name);
               begin
342
343
                  Ports_Map.Include (Key      => To_String (Port_Name),
                                     New_Item => New_P);
344
345
               end;
            end if;
Maxime Perrotin's avatar
Maxime Perrotin committed
346
            <<Continue>>
347
348
349
350
351
352
353
354
355
         end loop;
      end Rec_Find_Thread;
   begin
      Rec_Find_Thread (Ports_Map => Result,
                       Visited   => Visited_Functions,
                       Func      => F);
      return Result;
   end Get_Output_Ports;

356
   procedure Add_Concurrency_View (Model : in out TASTE_Model) is
Maxime Perrotin's avatar
Maxime Perrotin committed
357
358
359
      CV : Taste_Concurrency_View :=
        (Base_Template_Path => Model.Configuration.Binary_Path,
         Base_Output_Path   => Model.Configuration.Output_Dir,
360
         Deployment         => Model.Deployment_View,
Maxime Perrotin's avatar
Maxime Perrotin committed
361
         others             => <>);
362
   begin
Maxime Perrotin's avatar
Maxime Perrotin committed
363
364
365
      --  Initialize the lists of nodes and partitions based on the DV
      for Node of Model.Deployment_View.Nodes loop
         declare
366
367
            New_Node : CV_Node :=
              (Deployment_Node => Node, others => <>);
Maxime Perrotin's avatar
Maxime Perrotin committed
368
369
370
         begin
            for Partition of Node.Partitions loop
               declare
371
372
                  New_Partition : constant CV_Partition :=
                    (Deployment_Partition => Partition, others => <>);
Maxime Perrotin's avatar
Maxime Perrotin committed
373
374
375
376
377
378
379
380
381
382
383
               begin
                  New_Node.Partitions.Insert
                    (Key      => To_String (Partition.Name),
                     New_Item => New_Partition);
               end;
            end loop;
            CV.Nodes.Insert (Key      => To_String (Node.Name),
                             New_Item => New_Node);
         end;
      end loop;

384
385
      --  Create one thread per Cyclic and Sporadic interface
      --  Create one protected block per application code
Maxime Perrotin's avatar
Maxime Perrotin committed
386
      --  and map them on the Concurrency View nodes/partitions
387
      for F of Model.Interface_View.Flat_Functions loop
388
389
390
         if F.Is_Type then
            goto Continue;
         end if;
391
         declare
Maxime Perrotin's avatar
Maxime Perrotin committed
392
393
394
395
396
397
398
399
400
401
402
403
404
            Function_Name : constant String := To_String (F.Name);
            Node : constant Option_Node.Option :=
              Model.Deployment_View.Find_Node (Function_Name);
            Node_Name : constant String :=
              (if Node.Has_Value
               then To_String (Node.Unsafe_Just.Name)
               else "");
            Partition_Name : constant String :=
              (if Node.Has_Value
               then To_String (Node.Unsafe_Just.Find_Partition
                 (Function_Name).Unsafe_Just.Name)
               else "");

405
            Block : Protected_Block :=
Maxime Perrotin's avatar
Maxime Perrotin committed
406
              (Name   => F.Name,
Maxime Perrotin's avatar
Maxime Perrotin committed
407
               Node   => Node,
Maxime Perrotin's avatar
Maxime Perrotin committed
408
               others => <>);
409
         begin
Maxime Perrotin's avatar
Maxime Perrotin committed
410
411
412
413
414
            if not Node.Has_Value then
               --  Ignore functions that are not mapped to a node/partition
               goto Continue;
            end if;

415
416
417
418
419
420
421
422
423
            for PI of F.Provided loop
               declare
                  New_PI : Protected_Block_PI := (Name   => PI.Name,
                                                  PI     => PI,
                                                  others => <>);
               begin
                  New_PI.PI.RCM := (if F.Provided.Length = 1
                                    then Unprotected_Operation
                                    else Protected_Operation);
Maxime Perrotin's avatar
Maxime Perrotin committed
424
                  --  Check in the DV if any caller is remote
425
426
427
428
429
430
                  for Remote of PI.Remote_Interfaces loop
                     declare
                        Remote_Node : constant Option_Node.Option :=
                          Model.Deployment_View.Find_Node
                            (To_String (Remote.Function_Name));
                     begin
Maxime Perrotin's avatar
Maxime Perrotin committed
431
432
433
                        if not Remote_Node.Has_Value
                          or not Block.Node.Has_Value
                        then
434
                           raise Concurrency_View_Error with
Maxime Perrotin's avatar
Maxime Perrotin committed
435
                             "Concurrency Generation Error (parser bug?)";
436
                        end if;
Maxime Perrotin's avatar
Maxime Perrotin committed
437

438
439
440
441
442
443
                        if Block.Node.Unsafe_Just /= Remote_Node.Unsafe_Just
                        then
                           --  At least one caller is on a different node
                           New_PI.Local_Caller := False;
                        end if;
                     end;
Maxime Perrotin's avatar
Maxime Perrotin committed
444
                  end loop;
445
                  Block.Provided.Insert (Key      => To_String (PI.Name),
Maxime Perrotin's avatar
Maxime Perrotin committed
446
                                         New_Item => New_PI);
447
               end;
Maxime Perrotin's avatar
Maxime Perrotin committed
448
449
               if PI.RCM = Cyclic_Operation or PI.RCM = Sporadic_Operation then
                  declare
450
                     Thread : constant AADL_Thread :=
Maxime Perrotin's avatar
Maxime Perrotin committed
451
                       (Name                 => F.Name & "_" & PI.Name,
452
                        RCM                  => US (PI.RCM'Img),
Maxime Perrotin's avatar
Maxime Perrotin committed
453
454
455
                        Entry_Port_Name      => PI.Name,
                        Protected_Block_name => Block.Name,
                        Node                 => Block.Node,
456
                        PI                   => PI,
457
                        Output_Ports         => Get_Output_Ports (Model, F));
Maxime Perrotin's avatar
Maxime Perrotin committed
458
                  begin
Maxime Perrotin's avatar
Maxime Perrotin committed
459
460
                     CV.Nodes
                       (Node_Name).Partitions (Partition_Name).Threads.Include
Maxime Perrotin's avatar
Maxime Perrotin committed
461
462
463
464
                       (Key      => To_String (Thread.Name),
                        New_Item => Thread);
                  end;
               end if;
465
            end loop;
466
            Block.Required := F.Required;
467
            --  Add the block to the Concurrency View
Maxime Perrotin's avatar
Maxime Perrotin committed
468
469
470
            CV.Nodes (Node_Name).Partitions (Partition_Name).Blocks.Insert
              (Key      => To_String (Block.Name),
               New_Item => Block);
471
         end;
472
         <<Continue>>
473
      end loop;
Maxime Perrotin's avatar
Maxime Perrotin committed
474
      --  Find and set protected blocks calling threads
Maxime Perrotin's avatar
Maxime Perrotin committed
475
476
477
478
479
      for Node of CV.Nodes loop
         for Partition of Node.Partitions loop
            Set_Calling_Threads (Partition);
         end loop;
      end loop;
480

Maxime Perrotin's avatar
Maxime Perrotin committed
481
      Model.Concurrency_View := CV;
482
483
   end Add_Concurrency_View;

484
   procedure Dump (Model : TASTE_Model) is
485
486
      Output_Path : constant String :=
        Model.Configuration.Output_Dir.Element & "/Debug";
487
      Output  : File_Type;
488
   begin
489
490
491
492
493
494
495
496
497
      if Model.Configuration.Debug_Flag then
         Create_Path (Output_Path);
         Create (File => Output,
                 Mode => Out_File,
                 Name => Output_Path & "/InterfaceView.dump");
         Put_Info ("Dump of the Interface View");
         Model.Interface_View.Debug_Dump (Output);
         Close (Output);

498
         if not Model.Configuration.Deployment_View.Is_Empty then
499
500
501
502
503
504
505
            Create (File => Output,
                    Mode => Out_File,
                    Name => Output_Path & "/DeploymentView.dump");
            Put_Info ("Dump of the Deployment View");
            Model.Deployment_View.Debug_Dump (Output);
            Close (Output);
         end if;
506
507
508
509
510
511
512
513
514
515

         if Model.Configuration.Glue then
            Create (File => Output,
                    Mode => Out_File,
                    Name => Output_Path & "/ConcurrencyView.dump");
            Put_Info ("Dump of the Concurrency View");
            Model.Concurrency_View.Debug_Dump (Output);
            Close (Output);
         end if;

516
517
518
519
         Create (File => Output,
                 Mode => Out_File,
                 Name => Output_Path & "/DataView.dump");
         Put_Info ("Dump of the Data View");
Maxime Perrotin's avatar
Maxime Perrotin committed
520
         Model.Data_View.Debug_Dump (Output);
521
         Close (Output);
522

523
524
525
526
         Create (File => Output,
                 Mode => Out_File,
                 Name => Output_Path & "/commandline.dump");
         Put_Info ("Dump of the Command Line");
Maxime Perrotin's avatar
Maxime Perrotin committed
527
         Model.Configuration.Debug_Dump (Output);
528
         Close (Output);
529
530
531
532

         Put_Info ("Make a local copy of ASN.1 files for export");
         Create_Path (Output_Path & "/Export");
         Model.Data_View.Export_ASN1_Files (Output_Path & "/Export/");
533
      end if;
534
535
536
537
   exception
      when Error : others =>
         Put_Error ("Debug Dump : " & Exception_Message (Error));
         raise Quit_Taste;
538
539
   end Dump;

540
541
542
543
544
   procedure Generate_Build_Script (Model : TASTE_Model) is
   begin
      TASTE.Backend.Build_Script.Generate (Model);
   end Generate_Build_Script;

Maxime Perrotin's avatar
Maxime Perrotin committed
545
   procedure Generate_Code (Model : TASTE_Model) is
Maxime Perrotin's avatar
Maxime Perrotin committed
546
   begin
Maxime Perrotin's avatar
Maxime Perrotin committed
547
      TASTE.Backend.Code_Generators.Generate (Model);
548
   exception
Maxime Perrotin's avatar
Maxime Perrotin committed
549
      when Error : TASTE.Backend.Code_Generators.ACG_Error =>
550
551
         Put_Error (Exception_Message (Error));
         raise Quit_Taste;
552
553
      when Error : others =>
         Errors.Display_Bug_Box (Error);
554
         raise Quit_Taste;
Maxime Perrotin's avatar
Maxime Perrotin committed
555
   end Generate_Code;
556
end TASTE.AADL_Parser;