Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
Ocarina
Commits
3c4aec84
Commit
3c4aec84
authored
Apr 12, 2014
by
yoogx
Browse files
* Update documentation
parent
980cfc98
Changes
1
Hide whitespace changes
Inline
Side-by-side
resources/runtime/python/ocarina.py
View file @
3c4aec84
...
...
@@ -4,6 +4,8 @@
################################################################################
import
libocarina_python
;
# Ocarina bindings
class
Enum
(
tuple
):
__getattr__
=
tuple
.
index
################################################################################
def
version
():
'''Print Ocarina version'''
...
...
@@ -16,7 +18,16 @@ def status ():
################################################################################
def
load
(
filename
):
'''Load a file'''
'''Load a file
:param filename: name of the file to be loaded, following Ocarina search path
:type filename: string
E.g. to load "foo.aadl":
>>> load("foo.aadl");
'''
libocarina_python
.
load
(
filename
);
################################################################################
...
...
@@ -30,22 +41,19 @@ def instantiate (root_system):
libocarina_python
.
instantiate
(
root_system
);
################################################################################
Backends
=
Enum
([
"polyorb_hi_ada"
,
"polyorb_hi_c"
]);
'''Supported backends'''
def
generate
(
generator
):
'''Generate code'''
libocarina_python
.
generate
(
generator
);
'''Generate code
################################################################################
def
main
():
'''Test function'''
load
(
"rma.aadl"
);
# load a file
load
(
"deployment.aadl"
);
# load a file
analyze
();
# analyze models
instantiate
(
"rma.erc32"
);
# instantiate
generate
(
"polyorb_hi_ada"
);
# generate code
:param generator: one supported backends, from :data:`Backends`
For instance, to use the PolyORB-HI/Ada backend, you may use the following
if
__name__
==
"__main__"
:
main
()
sys
.
exit
(
0
);
# exit
>>> generate (Backends.polyorb_hi_ada);
'''
libocarina_python
.
generate
(
Backends
[
generator
]);
################################################################################
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment