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

Add some checks on the model

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