Commit 5bcaae76 authored by yoogx's avatar yoogx

Merge branch 'master' of https://github.com/OpenAADL/ocarina

parents 1503bc62 3cb309df
......@@ -285,4 +285,3 @@ def getRoot ():
'''
return runOcarinaFunction (libocarina_python.getRoot)
......@@ -88,7 +88,7 @@ def set_real_theorem (theorem_name):
def add_real_library (libraryname):
'''
:param libraryname: name of the theorem
:param libraryname: name of the REAL library file to include
:type libraryname: string
'''
......
-- This AADL model illustrates how to conduct schedulability analysis
-- using Cheddar, and then code generation of periodic tasks.
--
-- Two periodic tasks run in parallel, without interaction. Tasks
-- parameters allows RMA analysis
package RMAAadl
public
-----------------
-- Subprograms --
-----------------
subprogram Hello_Spg_1
properties
source_language => (C);
source_name => "user_hello_spg_1";
source_text => ("hello.c");
end Hello_Spg_1;
subprogram Hello_Spg_2
properties
source_language => (C);
source_name => "user_hello_spg_2";
source_text => ("hello.c");
end Hello_Spg_2;
-------------
-- Threads --
-------------
thread Task
end Task;
thread implementation Task.impl_1
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_1;
};
properties
Dispatch_Protocol => Periodic;
Priority => 1;
Period => 1000 ms;
Compute_Execution_time => 0 ms .. 3 ms;
Deadline => 1000 ms;
end Task.impl_1;
thread implementation Task.impl_2
calls
Mycalls: {
P_Spg : subprogram Hello_Spg_2;
};
properties
Dispatch_Protocol => Periodic;
Priority => 2;
Period => 500 ms;
Compute_Execution_time => 0 ms .. 5 ms;
Deadline => 500 ms;
end Task.impl_2;
---------------
-- Processor --
---------------
processor cpu
end cpu;
processor implementation cpu.impl
properties
Scheduling_Protocol => (POSIX_1003_HIGHEST_PRIORITY_FIRST_PROTOCOL);
end cpu.impl;
---------------
-- Processes --
---------------
process node_a
end node_a;
process implementation node_a.impl
subcomponents
Task1 : thread Task.impl_1;
Task2 : thread Task.impl_2;
end node_a.impl;
------------
-- System --
------------
system rma
end rma;
system implementation rma.impl
subcomponents
node_a : process node_a.impl;
cpu : processor cpu.impl;
properties
Actual_Processor_Binding => (reference (cpu)) applies to node_a;
end rma.impl;
end RMAAadl;
theorem check_scheduling
foreach e in system_set do
check(1=1);
end check_scheduling;
......@@ -7,45 +7,25 @@ def main ():
'''Test function'''
err=ocarina.load("rma.aadl"); # load a file
print 'load("rma.aadl")'
print err
if err[1] != None:
print 'info message: ', err[1]
if err[2]!=[]:
print 'warning message: ', err[2]
if err[3]!=[]:
print 'error message: ', err[3]
sys.exit(2)
print 'load("rma.aadl"),:', err
err=ocarina.load("deployment.aadl"); # load a file
print 'load("deployment.aadl")'
if err[1] != None:
print 'info message: ', err[1]
if err[2]!=[]:
print 'warning message: ', err[2]
if err[3]!=[]:
print 'error message: ', err[3]
sys.exit(2)
print 'load("deployment.aadl"):', err
err=ocarina.analyze(); # analyze models
print 'ocarina.analyze()'
if err[1] != None:
print 'info message: ', err[1]
if err[2]!=[]:
print 'warning message: ', err[2]
if err[3]!=[]:
print 'error message: ', err[3]
sys.exit(2)
print 'ocarina.analyze():', err
err=ocarina.instantiate("rma.impl"); # instantiate system
print 'ocarina.instantiate("rma.impl")'
if err[1] != None:
print 'info message: ', err[1]
if err[2]!=[]:
print 'warning message: ', err[2]
if err[3]!=[]:
print 'error message: ', err[3]
sys.exit(2)
print 'ocarina.instantiate("rma.impl"):', err
err=ocarina.add_real_library("rma.real");
print err;
err=ocarina.set_real_theorem("check_scheduling");
print err;
err=ocarina.generate (ocarina.Backends.real_theorem);
print err;
if __name__ == "__main__":
main ()
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 2005-2009 Telecom ParisTech, 2010-2015 ESA & ISAE. --
-- Copyright (C) 2005-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- --
......@@ -2723,56 +2723,12 @@ package body Parser is
Output.Write_Str (" (N):");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("info = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("error = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("raisedError = []");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("res = ''");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("with std_redirector(info,error):");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("try:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("res = libocarina_python.");
Output.Write_Str ("return runOcarinaFunction (libocarina_python.");
Output.Write_Str (Ada.Directories.Base_Name
(Namet.Get_Name_String (Output_Name)));
Output.Write_Str ("_");
Output.Write_Str (A);
Output.Write_Str (" (");
Output.Write_Eol;
W_Indentation (4);
Output.Write_Str ("N)");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("except:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("raisedError.append(getErrorMessage())");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("stderrMsg = sortStderrMessages(error");
Output.Write_Str (".getvalue().decode('utf-8'))");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("if stderrMsg[1]!=[]:");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError.append(stderrMsg[1])");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("return [ res , info.getvalue().");
Output.Write_Str ("decode('utf-8'), stderrMsg[0] , ");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError ]");
Output.Write_Str (", N)");
Output.Write_Eol;
Output.Write_Eol;
......@@ -2784,56 +2740,12 @@ package body Parser is
Output.Write_Str (" (N, V):");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("info = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("error = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("raisedError = []");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("res = ''");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("with std_redirector(info,error):");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("try:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("libocarina_python.");
Output.Write_Str ("return runOcarinaFunction (libocarina_python.");
Output.Write_Str (Ada.Directories.Base_Name
(Namet.Get_Name_String (Output_Name)));
Output.Write_Str ("_");
Output.Write_Str (WS (A));
Output.Write_Str (" (");
Output.Write_Eol;
W_Indentation (4);
Output.Write_Str ("N, V)");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("except:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("raisedError.append(getErrorMessage())");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("stderrMsg = sortStderrMessages(error.");
Output.Write_Str ("getvalue().decode('utf-8'))");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("if stderrMsg[1]!=[]:");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError.append(stderrMsg[1])");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("return [ res , info.getvalue().");
Output.Write_Str ("decode('utf-8'), stderrMsg[0] , ");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError ]");
Output.Write_Str (", N, V)");
Output.Write_Eol;
Output.Write_Eol;
......@@ -2859,56 +2771,12 @@ package body Parser is
Output.Write_Str (" (N):");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("info = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("error = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("raisedError = []");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("res = ''");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("with std_redirector(info,error):");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("try:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("res = libocarina_python.");
Output.Write_Str ("return runOcarinaFunction (libocarina_python.");
Output.Write_Str (Ada.Directories.Base_Name
(Namet.Get_Name_String (Output_Name)) & "_python");
Output.Write_Str ("_");
Output.Write_Str (GNS (Identifier (A)));
Output.Write_Str (" (");
Output.Write_Eol;
W_Indentation (4);
Output.Write_Str ("N)");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("except:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("raisedError.append(getErrorMessage())");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("stderrMsg = sortStderrMessages(error.");
Output.Write_Str ("getvalue().decode('utf-8'))");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("if stderrMsg[1]!=[]:");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError.append(stderrMsg[1])");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("return [ res , info.getvalue().");
Output.Write_Str ("decode('utf-8'), stderrMsg[0] , ");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError ]");
Output.Write_Str (", N)");
Output.Write_Eol;
Output.Write_Eol;
......@@ -2920,56 +2788,12 @@ package body Parser is
Output.Write_Str (" (N, V):");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("info = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("error = io.BytesIO()");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("raisedError = []");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("res = ''");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("with std_redirector(info,error):");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("try:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("libocarina_python.");
Output.Write_Str ("return runOcarinaFunction (libocarina_python.");
Output.Write_Str (Ada.Directories.Base_Name
(Namet.Get_Name_String (Output_Name)) & "_python");
Output.Write_Str ("_");
Output.Write_Str (WS (GNS (Identifier (A))));
Output.Write_Str (" (");
Output.Write_Eol;
W_Indentation (4);
Output.Write_Str ("N, V)");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("except:");
Output.Write_Eol;
W_Indentation (3);
Output.Write_Str ("raisedError.append(getErrorMessage())");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("stderrMsg = sortStderrMessages(error.");
Output.Write_Str ("getvalue().decode('utf-8'))");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("if stderrMsg[1]!=[]:");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError.append(stderrMsg[1])");
Output.Write_Eol;
W_Indentation (1);
Output.Write_Str ("return [ res , info.getvalue().");
Output.Write_Str ("decode('utf-8'), stderrMsg[0] , ");
Output.Write_Eol;
W_Indentation (2);
Output.Write_Str ("raisedError ]");
Output.Write_Str (", N, V)");
Output.Write_Eol;
Output.Write_Eol;
......
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