Commit 9c0c9903 authored by Maxime Perrotin's avatar Maxime Perrotin

Add some checks on the model

parent 4c39e52d
with GNAT.OS_Lib,
with Ada.Exceptions,
GNAT.OS_Lib,
TASTE,
TASTE.AADL_Parser,
TASTE.Parser_Utils,
TASTE.Model_Transformations,
TASTE.Dump;
use TASTE.AADL_Parser,
TASTE.Parser_Utils,
TASTE.Model_Transformations;
procedure Kazoo is
......@@ -28,4 +31,7 @@ begin
exception
when TASTE.Quit_TASTE =>
GNAT.OS_Lib.OS_Exit (1);
when Error : others =>
Put_Error (Ada.Exceptions.Exception_Message (Error));
GNAT.OS_Lib.OS_Exit (1);
end Kazoo;
......@@ -494,6 +494,15 @@ package body TASTE.AADL_Parser is
-- Find and set protected blocks calling threads
Set_Calling_Threads (Partition);
-- Check that all blocks have a calling thread, otherwise
-- they will never run
for B of Partition.Blocks loop
if B.Calling_Threads.Length = 0 then
raise Concurrency_View_Error with
"Function " & To_String (B.Name) & " has no active caller";
end if;
end loop;
-- Define ports at partition (process) level
-- (ports are for all interfaces of a function not located
-- in the same partition of the system)
......
......@@ -72,9 +72,19 @@ package body TASTE.Semantic_Check is
-- 1) interfaces must all have a parameter
-- 2) interfaces must all be sporadic (TODO)
if Each.Language = "gui" and then
((for all I of Each.Provided => I.Params.Length /= 1) or else
(for all I of Each.Required => I.Params.Length /= 1))
((Each.Provided.Length > 0 and then
(for all I of Each.Provided => I.Params.Length /= 1))
or else (Each.Required.Length > 0 and then
(for all I of Each.Required => I.Params.Length /= 1)))
then
for I of Each.Provided loop
Put_Error ("PI " & To_String (I.Name) & " has "
& I.Params.Length'Img & " parameters");
end loop;
for I of Each.Required loop
Put_Error ("RI " & To_String (I.Name) & " has "
& I.Params.Length'Img & " parameters");
end loop;
raise Semantic_Error with
"Function " & To_String (Each.Name) & "'s interfaces"
& " must all have exactly one parameter";
......
......@@ -32,6 +32,7 @@
*/
#pragma once
@@IF@@ @_List_Of_ASync_PIs'Length_@ > 1 @@-- include "Poll"
typedef enum {
@@INLINE( )(,\n )()@@
@@TABLE@@
......@@ -41,7 +42,9 @@ typedef enum {
@@END_TABLE@@
@@END_INLINE@@
} T_@_Name_@_PI_list;
@@END_IF@@
@@IF@@ @_List_Of_ASync_RIs'Length_@ > 0
typedef enum {
@@INLINE( )(,\n )()@@
@@TABLE@@
......@@ -49,3 +52,4 @@ typedef enum {
@@END_TABLE@@
@@END_INLINE@@
} T_@_Name_@_RI_list;
@@END_IF@@
KAZOO=../../kazoo
all: test-parse
$(MAKE) -C output
test-parse: clean
$(KAZOO) --gw \
-o output \
-p \
--glue \
--no-stdlib \
--debug \
../common/libhw.aadl
../common/libhw.aadl \
2>&1 | tail -1 | diff expected -
gdb: clean
gdb --args $(KAZOO) --gw \
-o output \
--glue \
-o output \
--glue \
-p \
--no-stdlib \
../common/libhw.aadl \
--debug
--debug
clean:
rm -rf output
......
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