Commit bdbd5f42 authored by yoogx's avatar yoogx

* Introduce Node_Array, and conversion functions from List_Id

          to Node_Array

          For openaadl/ocarina#128
parent 46ebb07d
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2018 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -222,6 +222,28 @@ package body Ocarina.ME_AADL.AADL_Instances.Nutils is
return C;
end Length;
-------------------
-- To_Node_Array --
-------------------
function To_Node_Array (L : List_Id) return Node_Array is
N : Node_Id;
J : Natural := 1;
Result : Node_Array (1 .. Length (L));
begin
if not Is_Empty (L) then
N := First_Node (L);
while Present (N) loop
Result (J) := N;
J := J + 1;
N := Next_Node (N);
end loop;
end if;
return Result;
end To_Node_Array;
--------------------
-- Make_Container --
--------------------
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2018 ESA & ISAE. --
-- --
-- Ocarina is free software; you can redistribute it and/or modify under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -77,6 +77,13 @@ package Ocarina.ME_AADL.AADL_Instances.Nutils is
-- Return true when L is empty
function Length (L : List_Id) return Natural;
-- Return the length of list L
type Node_Array is array (Natural range <>) of Node_Id;
No_Nodes : constant Node_Array (1 .. 0) := (others => No_Node);
function To_Node_Array (L : List_Id) return Node_Array;
-- Conver List_Id L into a Node_Array
function New_Node (Kind : Node_Kind; Loc : Location) return Node_Id;
-- Create a new node
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment