Commit b4721732 authored by yoogx's avatar yoogx

* Add support for 'static' keyword for the C backend

parent f4f0b0ea
......@@ -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-2016 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- --
......@@ -1198,6 +1198,10 @@ package body Ocarina.Backends.C_Tree.Generator is
procedure Generate_Variable_Declaration (N : Node_Id) is
begin
Generate (Used_Type (N));
if Is_Static (N) then
Write_Space;
Write (Tok_Static);
end if;
Write_Space;
Generate (Defining_Identifier (N));
end Generate_Variable_Declaration;
......
......@@ -372,6 +372,7 @@ module Ocarina::Backends::C_Tree::Nodes {
*/
interface Variable_Declaration : Definition {
Node_Id Used_Type;
boolean Is_Static;
};
/*
......
......@@ -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-2016 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- --
......@@ -735,13 +735,15 @@ package body Ocarina.Backends.C_Tree.Nutils is
function Make_Variable_Declaration
(Defining_Identifier : Node_Id;
Used_Type : Node_Id) return Node_Id
Used_Type : Node_Id;
Is_Static : Boolean := False) return Node_Id
is
P : Node_Id;
begin
P := New_Node (K_Variable_Declaration);
Set_Defining_Identifier (P, Defining_Identifier);
Set_Used_Type (P, Used_Type);
Set_Is_Static (P, Is_Static);
return P;
end Make_Variable_Declaration;
......
......@@ -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-2016 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- --
......@@ -70,6 +70,7 @@ package Ocarina.Backends.C_Tree.Nutils is
Tok_Until, -- UNTIL
Tok_For, -- FOR
Tok_While, -- WHILE
Tok_Static, -- STATIC
Tok_Switch, -- SWITCH
Tok_Typedef, -- TYPEDEF
......@@ -354,7 +355,8 @@ package Ocarina.Backends.C_Tree.Nutils is
function Make_Variable_Declaration
(Defining_Identifier : Node_Id;
Used_Type : Node_Id) return Node_Id;
Used_Type : Node_Id;
Is_Static : Boolean := False) return Node_Id;
function Make_Member_Declaration
(Defining_Identifier : Node_Id;
......
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