1
------------------------------------------------------------------------------
2
--                                                                          --
3
--                           OCARINA COMPONENTS                             --
4
--                                                                          --
5
--             O C A R I N A . B A C K E N D S . P O _ H I _ C              --
6
--                                                                          --
7
--                                 B o d y                                  --
8
--                                                                          --
9
--               Copyright (C) 2008-2009 Telecom ParisTech,                 --
10
--                 2010-2019 ESA & ISAE, 2019-2020 OpenAADL                 --
11
--                                                                          --
12
-- Ocarina  is free software; you can redistribute it and/or modify under   --
13
-- terms of the  GNU General Public License as published  by the Free Soft- --
14
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
15
-- sion. Ocarina is distributed in the hope that it will be useful, but     --
16
-- WITHOUT ANY WARRANTY; without even the implied warranty of               --
17
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     --
18
--                                                                          --
19
-- As a special exception under Section 7 of GPL version 3, you are granted --
20
-- additional permissions described in the GCC Runtime Library Exception,   --
21
-- version 3.1, as published by the Free Software Foundation.               --
22
--                                                                          --
23
-- You should have received a copy of the GNU General Public License and    --
24
-- a copy of the GCC Runtime Library Exception along with this program;     --
25
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
26
-- <http://www.gnu.org/licenses/>.                                          --
27
--                                                                          --
28
--                    Ocarina is maintained by OpenAADL team                --
29
--                              (info@openaadl.org)                         --
30
--                                                                          --
31
------------------------------------------------------------------------------
32

33
with GNAT.OS_Lib;
34
with Ocarina.Output;
35

36
with GNAT.Directory_Operations;
37

38
with Ocarina.Instances;
39
with Ocarina.Backends.Expander;
40
with Ocarina.Backends.Messages;
41
with Ocarina.ME_AADL;
42
with Ocarina.ME_AADL.AADL_Instances.Nutils;
43
with Ocarina.ME_AADL.AADL_Instances.Nodes;
44
with Ocarina.ME_AADL.AADL_Instances.Entities;
45
with Ocarina.Backends.C_Tree.Generator;
46
with Ocarina.Backends.C_Tree.Nodes;
47
with Ocarina.Backends.PO_HI_C.Activity;
48
with Ocarina.Backends.PO_HI_C.Main;
49
with Ocarina.Backends.PO_HI_C.Naming;
50
with Ocarina.Backends.PO_HI_C.Runtime;
51
with Ocarina.Backends.PO_HI_C.Deployment;
52
with Ocarina.Backends.PO_HI_C.Request;
53
with Ocarina.Backends.C_Common.Types;
54
with Ocarina.Backends.C_Common.Subprograms;
55
with Ocarina.Backends.PO_HI_C.Marshallers;
56
with Ocarina.Backends.Utils;
57
with Ocarina.Backends.Build_Utils;
58
with Ocarina.Backends.Execution_Utils;
59
with Ocarina.Backends.Execution_Tests;
60
with Ocarina.Backends.Properties;
61
with Ocarina.Backends.ASN1;
62

63
with Ocarina.Namet;
64

65
package body Ocarina.Backends.PO_HI_C is
66

67
   use GNAT.OS_Lib;
68

69
   use Ocarina.Namet;
70
   use Ocarina.Output;
71

72
   use GNAT.Directory_Operations;
73

74
   use Ocarina.Backends.Properties;
75
   use Ocarina.ME_AADL;
76
   use Ocarina.ME_AADL.AADL_Instances.Nodes;
77
   use Ocarina.ME_AADL.AADL_Instances.Entities;
78
   use Ocarina.Backends.Messages;
79
   use Ocarina.Backends.Utils;
80
   use Ocarina.Backends.Expander;
81
   use Ocarina.Instances;
82
   use Ocarina.Backends.Build_Utils;
83
   use Ocarina.Backends.Execution_Tests;
84

85
   package AAN renames Ocarina.ME_AADL.AADL_Instances.Nodes;
86
   package AAU renames Ocarina.ME_AADL.AADL_Instances.Nutils;
87
   package CTN renames Ocarina.Backends.C_Tree.Nodes;
88

89
   procedure Visit_Architecture_Instance (E : Node_Id);
90
   --  Most top level visitor routine. E is the root of the AADL
91
   --  instance tree. The procedure does a traversal for each
92
   --  compilation unit to be generated.
93

94
   procedure PolyORB_HI_C_Makefile
95
     (Appli_Name              : Name_Id;
96
      Node_Name               : Name_Id;
97
      Execution_Platform      : Supported_Execution_Platform := Platform_None;
98
      Execution_Platform_Name : Name_Id;
99
      USER_CFLAGS             : Name_Id;
100
      USER_LDFLAGS            : Name_Id;
101
      Transport_API           : Supported_Transport_APIs;
102
      Ada_Sources             : Name_Tables.Instance;
103
      Asn_Sources             : Name_Tables.Instance;
104
      C_Sources               : Name_Tables.Instance;
105
      C_Libraries             : Name_Tables.Instance;
106
      User_Source_Dirs        : Name_Tables.Instance;
107
      Use_Transport           : Boolean;
108
      Use_Simulink            : Boolean;
109
      Simulink_Directory      : Name_Id;
110
      Simulink_Node           : Name_Id;
111
      Use_Scade               : Boolean;
112
      Scade_Directory         : Name_Id);
113

114
   ---------------------------
115
   -- PolyORB_HI_C_Makefile --
116
   ---------------------------
117

118 1
   procedure PolyORB_HI_C_Makefile
119
     (Appli_Name              : Name_Id;
120
      Node_Name               : Name_Id;
121
      Execution_Platform      : Supported_Execution_Platform := Platform_None;
122
      Execution_Platform_Name : Name_Id;
123
      USER_CFLAGS             : Name_Id;
124
      USER_LDFLAGS            : Name_Id;
125
      Transport_API           : Supported_Transport_APIs;
126
      Ada_Sources             : Name_Tables.Instance;
127
      Asn_Sources             : Name_Tables.Instance;
128
      C_Sources               : Name_Tables.Instance;
129
      C_Libraries             : Name_Tables.Instance;
130
      User_Source_Dirs        : Name_Tables.Instance;
131
      Use_Transport           : Boolean;
132
      Use_Simulink            : Boolean;
133
      Simulink_Directory      : Name_Id;
134
      Simulink_Node           : Name_Id;
135
      Use_Scade               : Boolean;
136
      Scade_Directory         : Name_Id)
137
   is
138
      pragma Unreferenced (Transport_API, C_Sources, Ada_Sources, C_Libraries);
139 1
      O_File : Name_Id;
140
   begin
141 1
      if Use_ASN1_Deployment then
142 0
         Write_Str ("ASN_OBJS += asn1_deployment.o ");
143 0
         if Length (Asn_Sources) > 0 then
144 0
            for J in Name_Tables.First .. Name_Tables.Last (Asn_Sources) loop
145

146 0
               Get_Name_String (Asn_Sources.Table (J));
147 0
               Name_Buffer (Name_Len - 2) := 'o';
148

149 0
               Set_Str_To_Name_Buffer
150 0
                 (Base_Name (Name_Buffer (1 .. Name_Len - 2)));
151 0
               O_File := Name_Find;
152

153 0
               Write_Str ("");
154 0
               Write_Name (O_File);
155

156 0
               exit when J = Name_Tables.Last (Asn_Sources);
157

158 0
               Write_Space;
159 0
            end loop;
160
         end if;
161 0
         Write_Eol;
162
      end if;
163

164 1
      if Appli_Name /= No_Name then
165 1
         Write_Str ("MAINAPP = ");
166 1
         Write_Name (Appli_Name);
167 1
         Write_Eol;
168
      end if;
169

170 1
      if USER_CFLAGS /= No_Name then
171 0
         Write_Str ("USER_CFLAGS = ");
172 0
         Write_Name (USER_CFLAGS);
173 0
         Write_Eol;
174
      end if;
175

176 1
      if USER_LDFLAGS /= No_Name then
177 0
         Write_Str ("USER_LDFLAGS = ");
178 0
         Write_Name (USER_LDFLAGS);
179 0
         Write_Eol;
180
      end if;
181

182 1
      Write_Str ("BINARY = ");
183 1
      Write_Name (Node_Name);
184 1
      Write_Eol;
185

186 1
      Write_Str ("TARGET = ");
187

188
      case Execution_Platform is
189 1
         when Platform_Native =>
190 1
            Write_Str ("native");
191

192 1
         when Platform_None =>
193 1
            if Execution_Platform_Name /= No_Name then
194 1
               Write_Name (Execution_Platform_Name);
195
            else
196 0
               Write_Str ("native");
197
            end if;
198

199 1
         when Platform_Native_Compcert =>
200 1
            Write_Str ("compcert");
201

202 0
         when Platform_Bench =>
203 0
            Write_Str ("bench");
204

205 1
         when Platform_LEON_RTEMS =>
206 1
            Write_Str ("leon.rtems");
207

208 1
         when Platform_LEON_RTEMS_POSIX =>
209 1
            Write_Str ("leon.rtems_posix");
210

211 0
         when Platform_X86_LINUXTASTE =>
212 0
            Write_Str ("x86.linuxtaste");
213

214 0
         when Platform_LINUX64 =>
215 0
            Write_Str ("linux64");
216

217 0
         when Platform_LINUX32 =>
218 0
            Write_Str ("linux32");
219

220 0
         when Platform_LINUX_DLL =>
221 0
            Write_Str ("linux_dll");
222

223 0
         when Platform_WIN32 =>
224 0
            Write_Str ("win32");
225

226 1
         when Platform_LEON3_XM3 =>
227 1
            Write_Str ("leon3-xm3");
228

229 0
         when Platform_LEON3_SCOC3 =>
230 0
            Write_Str ("leon3-scoc3");
231

232 1
         when Platform_LINUX32_XENOMAI_NATIVE =>
233 1
            Write_Str ("linux32-xenomai-native");
234

235 1
         when Platform_LINUX32_XENOMAI_POSIX =>
236 1
            Write_Str ("linux32-xenomai-posix");
237

238 1
         when Platform_AIR =>
239 1
            Write_Str ("air");
240

241 0
         when Platform_AIR_IOP =>
242 0
            Write_Str ("air_iop");
243

244 0
         when Platform_MSP430_FREERTOS =>
245 0
            Write_Str ("msp430_freertos");
246

247 0
         when others =>
248 0
            Display_Error
249 0
              ("Unsupported platform " & Execution_Platform'Img,
250
               Fatal => True);
251
      end case;
252

253 1
      Write_Eol;
254 1
      Write_Str ("NEED_TRANSPORT = ");
255 1
      if Use_Transport then
256 1
         Write_Line ("yes");
257
      else
258 1
         Write_Line ("no");
259
      end if;
260

261 1
      if Add_Performance_Analysis then
262 0
         Write_Str ("USE_GPROF = yes");
263 0
         Write_Eol;
264
      end if;
265

266 1
      if Generate_ASN1_Deployment then
267 0
         Write_Str ("USE_ASN1_DEPLOYMENT = yes");
268 0
         Write_Eol;
269
      end if;
270

271 1
      if Use_Simulink then
272 0
         Write_Str ("SIMULINK_DIR = ");
273 0
         Write_Name (Simulink_Directory);
274 0
         Write_Eol;
275

276 0
         Write_Str ("SIMULINK_NODE = ");
277 0
         Write_Name (Simulink_Node);
278 0
         Write_Eol;
279
      end if;
280

281 1
      if Use_Scade then
282 0
         Write_Str ("SCADE_DIR = ");
283 0
         Write_Name (Scade_Directory);
284 0
         Write_Eol;
285
      end if;
286

287
      --  The following syntax escapes whitespace in the path
288

289
      --      Write_Line ("RUNTIME_PATH=$(shell echo """
290
      --      & Get_Runtime_Path ("polyorb-hi-c")
291
      --                    & """ | sed 's/ /\\ /g')");
292

293 1
      Write_Line
294
        ("BUILD_DIR:=$(shell dirname " &
295
           "$(abspath $(lastword $(MAKEFILE_LIST))))");
296 1
      Write_Line ("RUNTIME_PATH=$(BUILD_DIR)/../polyorb-hi-c");
297

298 1
      Write_Str ("USER_SOURCES_DIRS=");
299

300 1
      if Scenario_Dir /= null then
301 1
         Write_Space;
302
         Write_Str ("""-I" & Remove_Directory_Separator (Scenario_Dir.all)
303
                      & """");
304
      end if;
305

306 1
      if Length (User_Source_Dirs) > 0 then
307
         for J in Name_Tables.First .. Name_Tables.Last (User_Source_Dirs) loop
308 1
            Write_Space;
309 1
            Write_Str ("""-I");
310 1
            Write_Name
311
              (Remove_Directory_Separator (User_Source_Dirs.Table (J)));
312 1
            Write_Str ("""");
313 1
            exit when J = Name_Tables.Last (User_Source_Dirs);
314

315 1
            Write_Space;
316 1
         end loop;
317 1
         Write_Eol;
318
      else
319 0
         Write_Str (".");
320 0
         Write_Eol;
321
      end if;
322

323 1
      Write_Str ("ASN_SOURCES=");
324

325 1
      if Generate_ASN1_Deployment then
326 0
         Write_Str ("../asn1_deployment.asn ");
327
      end if;
328

329 1
      if Length (Asn_Sources) > 0 then
330 0
         for J in Name_Tables.First .. Name_Tables.Last (Asn_Sources) loop
331 0
            Write_Str ("");
332 0
            Write_Name (Asn_Sources.Table (J));
333

334 0
            exit when J = Name_Tables.Last (Asn_Sources);
335

336 0
            Write_Space;
337 0
         end loop;
338

339 0
         Write_Eol;
340
      else
341 1
         Write_Eol;
342
      end if;
343

344 1
      Write_Line ("include $(RUNTIME_PATH)/make/Makefile.common");
345 1
   end PolyORB_HI_C_Makefile;
346

347
   ------------------------------------
348
   -- Generate_Doxygen_Configuration --
349
   ------------------------------------
350

351 1
   procedure Generate_Doxygen_Configuration (My_System : Node_Id) is
352
      procedure Visit_Architecture_Instance (E : Node_Id);
353
      procedure Visit_Component_Instance (E : Node_Id);
354
      procedure Visit_System_Instance (E : Node_Id);
355
      procedure Visit_Process_Instance (E : Node_Id);
356

357
      -----------
358
      -- Visit --
359
      -----------
360

361 1
      procedure Visit (E : Node_Id) is
362
      begin
363
         case AAN.Kind (E) is
364 1
            when AAN.K_Architecture_Instance =>
365 1
               Visit_Architecture_Instance (E);
366

367 1
            when AAN.K_Component_Instance =>
368 1
               Visit_Component_Instance (E);
369

370 0
            when others =>
371 0
               null;
372
         end case;
373 1
      end Visit;
374

375
      ---------------------------------
376
      -- Visit_Architecture_Instance --
377
      ---------------------------------
378

379 1
      procedure Visit_Architecture_Instance (E : Node_Id) is
380
      begin
381 1
         Visit (AAN.Root_System (E));
382 1
      end Visit_Architecture_Instance;
383

384
      ------------------------------
385
      -- Visit_Component_Instance --
386
      ------------------------------
387

388 1
      procedure Visit_Component_Instance (E : Node_Id) is
389
         Category : constant Component_Category :=
390 1
           Get_Category_Of_Component (E);
391
      begin
392
         case Category is
393 1
            when CC_System =>
394 1
               Visit_System_Instance (E);
395

396 1
            when CC_Process =>
397 1
               Visit_Process_Instance (E);
398

399 1
            when others =>
400 1
               null;
401 1
         end case;
402 1
      end Visit_Component_Instance;
403

404
      ----------------------------
405
      -- Visit_Process_Instance --
406
      ----------------------------
407

408 1
      procedure Visit_Process_Instance (E : Node_Id) is
409 1
         S     : constant Node_Id := AAN.Parent_Subcomponent (E);
410 1
         Fd    : File_Descriptor;
411
         Rpath : constant String  := Get_Runtime_Path ("polyorb-hi-c");
412
      begin
413 1
         Enter_Directory (Normalize_Name (AAN.Name (AAN.Identifier (S))));
414

415 1
         Fd := Create_File ("doxygen.cfg", Text);
416 1
         if Fd = Invalid_FD then
417 0
            raise Program_Error;
418
         end if;
419

420 1
         Set_Output (Fd);
421

422 1
         Write_Str ("PROJECT_NAME           = ");
423 1
         Write_Name (Normalize_Name (AAN.Name (AAN.Identifier (S))));
424 1
         Write_Eol;
425 1
         Write_Line ("OUTPUT_DIRECTORY       = generated-documentation");
426 1
         Write_Line ("GENERATE_LATEX         = YES");
427 1
         Write_Line ("GENERATE_MAN           = YES");
428 1
         Write_Line ("GENERATE_RTF           = YES");
429 1
         Write_Line ("CASE_SENSE_NAMES       = NO");
430 1
         Write_Str ("INPUT                  = . ");
431 1
         Write_Str (Rpath);
432 1
         Write_Eol;
433 1
         Write_Line ("SOURCE_BROWSER         = YES");
434 1
         Write_Line ("OPTIMIZE_OUTPUT_FOR_C  = YES");
435 1
         Write_Line ("GENERATE_TREEVIEW      = YES");
436 1
         Write_Line ("QUIET                  = YES");
437 1
         Write_Line ("HAVE_DOT               = YES");
438 1
         Write_Line ("JAVADOC_AUTOBRIEF      = YES");
439 1
         Write_Line ("EXTRACT_ALL            = YES");
440 1
         Write_Line ("EXTRACT_PRIVATE        = YES");
441 1
         Write_Line ("EXTRACT_STATIC         = YES");
442 1
         Write_Line ("TYPEDEF_HIDES_STRUCT   = YES");
443 1
         Write_Line ("INLINE_SOURCES         = YES");
444 1
         Write_Line ("REFERENCED_BY_RELATION = YES");
445 1
         Write_Line ("REFERENCES_RELATION    = YES");
446 1
         Write_Line ("SEARCHENGINE           = YES");
447 1
         Write_Line ("SERVER_BASED_SEARCH    = NO");
448 1
         Write_Line ("SEARCH_INCLUDES        = YES");
449 1
         Write_Line ("INCLUDED_BY_GRAPH      = YES");
450 1
         Write_Line ("ENABLE_PREPROCESSING   = YES");
451 1
         Write_Line ("OUTPUT_LANGUAGE        = English");
452 1
         Write_Line ("BRIEF_MEMBER_DESC      = YES");
453 1
         Write_Line ("REPEAT_BRIEF           = YES");
454 1
         Write_Line ("RECURSIVE              = YES");
455 1
         Write_Line ("EXAMPLE_RECURSIVE      = NO");
456 1
         Write_Line ("DIRECTORY_GRAPH        = YES");
457 1
         Write_Line ("CLASS_GRAPH            = YES");
458 1
         Write_Line ("COLLABORATION_GRAPH    = YES");
459 1
         Write_Line ("GROUP_GRAPHS           = YES");
460 1
         Write_Line ("INCLUDE_GRAPH          = YES");
461 1
         Write_Line ("INCLUDED_BY_GRAPH      = YES");
462 1
         Write_Line ("CALL_GRAPH             = YES");
463 1
         Write_Line ("CALLER_GRAPH           = YES");
464 1
         Write_Line ("GRAPHICAL_HIERARCHY    = YES");
465 1
         Write_Line ("DIRECTORY_GRAPH        = YES");
466 1
         Write_Line ("DOT_GRAPH_MAX_NODES    = 50");
467 1
         Write_Line ("MAX_DOT_GRAPH_DEPTH    = 0");
468 1
         Write_Eol;
469

470 1
         Close (Fd);
471 1
         Set_Standard_Output;
472

473 1
         Leave_Directory;
474 1
      end Visit_Process_Instance;
475

476
      ---------------------------
477
      -- Visit_System_Instance --
478
      ---------------------------
479

480 1
      procedure Visit_System_Instance (E : Node_Id) is
481 1
         S : Node_Id;
482
      begin
483 1
         if not Present (AAN.Parent_Subcomponent (E)) then
484
            --  We jump one directory iff the current system denotes
485
            --  the root system, other systems do not lead to
486
            --  generated code, they are silent.
487 1
            Enter_Directory (Normalize_Name (AAN.Name (AAN.Identifier (E))));
488
         end if;
489

490
         --  Visit all the subcomponents of the system
491

492 1
         if not AAU.Is_Empty (AAN.Subcomponents (E)) then
493 1
            S := AAN.First_Node (AAN.Subcomponents (E));
494 1
            while Present (S) loop
495
               --  Visit the component instance corresponding to the
496
               --  subcomponent S.
497

498 1
               Visit (Corresponding_Instance (S));
499 1
               S := AAN.Next_Node (S);
500 1
            end loop;
501
         end if;
502

503 1
         if not Present (AAN.Parent_Subcomponent (E)) then
504 1
            Leave_Directory;
505
         end if;
506 1
      end Visit_System_Instance;
507

508
   begin
509 1
      Visit (My_System);
510 1
   end Generate_Doxygen_Configuration;
511

512
   --------------
513
   -- Generate --
514
   --------------
515

516 1
   procedure Generate (AADL_Root : Node_Id) is
517 1
      Instance_Root : Node_Id;
518 1
      Success       : Boolean := True;
519

520
      procedure Generate_PolyORB_HI_C_Makefile is new Build_Utils.Makefiles
521
        .Generate
522
        (PolyORB_HI_C_Makefile);
523

524
   begin
525
      --  Instantiate the AADL tree
526

527 1
      Instance_Root := Instantiate_Model (AADL_Root);
528

529
      --  Expand the AADL instance
530

531 1
      Expand (Instance_Root);
532

533 1
      Visit_Architecture_Instance (Instance_Root);
534
      --  Abort if the construction of the C tree failed
535

536 1
      if No (C_Root) then
537 0
         Display_Error ("Code generation failed", Fatal => True);
538
      end if;
539

540
      --  At this point, we have a valid C tree, we can begin the
541
      --  generation of C source files.
542

543
      --  Enter the output directory
544

545 1
      Enter_Directory (Generated_Sources_Directory);
546

547 1
      if Remove_Generated_Sources then
548 0
         Build_Utils.Makefiles.Clean (Instance_Root);
549

550
      else
551
         --  Create the source files
552

553 1
         C_Tree.Generator.Generate (C_Root);
554

555
         --  Create doxygen configuration files
556

557 1
         Generate_Doxygen_Configuration (Instance_Root);
558

559
         --  Generate the Makefiles
560

561 1
         Generate_PolyORB_HI_C_Makefile (Instance_Root);
562

563
         --  If we have to generate the ASN1 deployment file, then
564
         --  we enter the directory that contains the generated
565
         --  code and invoke directly the ASN1 generator with the
566
         --  instance root. It should automatically create an .asn1
567
         --  file that contains deployment/messages informations.
568

569 1
         if Generate_ASN1_Deployment then
570 0
            Enter_Directory (CTN.Name (C_Root));
571 0
            ASN1.Generate (Instance_Root);
572 0
            Leave_Directory;
573
         end if;
574

575
         --  If the user requested to build the applications then we
576
         --  build it.
577

578 1
         if Compile_Generated_Sources then
579 1
            Build_Utils.Makefiles.Build (Instance_Root);
580
         end if;
581
      end if;
582

583
      --  If the user requested to test the applications then we
584
      --  test it.
585

586 1
      if Do_Regression_Test or else Do_Coverage_Test then
587

588
         --  Execution_Utils package initialization
589

590 0
         Execution_Utils.Init;
591 0
         Execution_Utils.Visit (Instance_Root);
592 0
         Execution_Tests.Init;
593

594 0
         if Do_Regression_Test then
595 0
            Success :=
596 0
              Execute_Regression_Test
597 0
                (Scenario_Dir.all,
598
                 Ref_Map,
599 0
                 Integer (Timeout))
600 0
              and then Success;
601

602 0
            if not Create_Referencial then
603 0
               Write_Eol;
604 0
               if Success then
605 0
                  Write_Line ("--- All regression tests PASSED ---");
606
               else
607 0
                  Write_Line ("--- Regression tests FAILED ---");
608
               end if;
609
            end if;
610
         end if;
611

612 0
         if Do_Coverage_Test then
613 0
            Success :=
614 0
              Execute_Coverage_Test (Integer (Timeout)) and then Success;
615
         end if;
616

617
         --  Free memory
618 0
         Execution_Utils.Reset;
619 0
         Execution_Tests.Reset;
620 0
         Free (Scenario_Dir);
621

622
         --  Exit if one of the tests failed
623

624 0
         if not Success then
625 0
            OS_Exit (1);
626
         end if;
627
      end if;
628

629
      --  Leave the output directory
630 1
      Leave_Directory;
631 1
   end Generate;
632

633
   ----------
634
   -- Init --
635
   ----------
636

637 1
   procedure Init is
638
   begin
639 1
      Register_Backend ("polyorb_hi_c", Generate'Access, PolyORB_HI_C);
640 1
      Ocarina.Backends.PO_HI_C.Runtime.Initialize;
641 1
   end Init;
642

643
   -----------
644
   -- Reset --
645
   -----------
646

647 1
   procedure Reset is
648
   begin
649 1
      Ocarina.Backends.PO_HI_C.Runtime.Reset;
650 1
   end Reset;
651

652
   ------------------------------
653
   -- Use_Performance_Analysis --
654
   ------------------------------
655

656 1
   function Use_Performance_Analysis return Boolean is
657
   begin
658 1
      return Add_Performance_Analysis;
659
   end Use_Performance_Analysis;
660

661
   -------------------------
662
   -- Use_ASN1_Deployment --
663
   -------------------------
664

665 1
   function Use_ASN1_Deployment return Boolean is
666
   begin
667 1
      return Generate_ASN1_Deployment;
668
   end Use_ASN1_Deployment;
669

670
   --------------------------
671
   --  Set_ASN1_Deployment --
672
   --------------------------
673

674 0
   procedure Set_ASN1_Deployment (Use_It : Boolean) is
675
   begin
676 0
      Generate_ASN1_Deployment := Use_It;
677 0
   end Set_ASN1_Deployment;
678

679
   -------------------------------
680
   --  Set_Performance_Analysis --
681
   -------------------------------
682

683 0
   procedure Set_Performance_Analysis (Use_It : Boolean) is
684
   begin
685 0
      Add_Performance_Analysis := Use_It;
686 0
   end Set_Performance_Analysis;
687

688
   ---------------------------------
689
   -- Visit_Architecture_Instance --
690
   ---------------------------------
691

692 1
   procedure Visit_Architecture_Instance (E : Node_Id) is
693
   begin
694
      --  Generate header files
695

696 1
      Naming.Header_File.Visit (E);
697 1
      C_Common.Types.Header_File.Visit (E, C_Root);
698 1
      Deployment.Header_File.Visit (E);
699 1
      Request.Header_File.Visit (E);
700 1
      Marshallers.Header_File.Visit (E);
701 1
      C_Common.Subprograms.Header_File.Visit (E, C_Root);
702 1
      Activity.Header_File.Visit (E);
703

704
      --  Generate source files
705

706 1
      C_Common.Types.Source_File.Visit (E, C_Root);
707 1
      Request.Source_File.Visit (E);
708 1
      Marshallers.Source_File.Visit (E);
709 1
      Deployment.Source_File.Visit (E);
710 1
      Activity.Source_File.Visit (E);
711 1
      C_Common.Subprograms.Source_File.Visit (E);
712 1
      Naming.Source_File.Visit (E);
713 1
      Main.Source_File.Visit (E);
714

715
      --  Generate a Makefile for each node
716

717 1
      Build_Utils.Makefiles.Visit (E);
718

719 1
   end Visit_Architecture_Instance;
720

721
end Ocarina.Backends.PO_HI_C;

Read our documentation on viewing source code .

Loading