Commit 36397eb3 authored by Jerome Hugues's avatar Jerome Hugues
Browse files

* Clean-up

parent 73f0aedf
...@@ -9,7 +9,7 @@ def printError(source, messages): ...@@ -9,7 +9,7 @@ def printError(source, messages):
for message in messages: for message in messages:
print message print message
def main(argv):ne def main(argv):
'''Test function''' '''Test function'''
import ocarina; import ocarina;
import lmp; import lmp;
......
#! /usr/bin/python #! /usr/bin/python
import OcarinaPython as ocarina; import ocarina
import lmp
def visitor (component,level) :
subcomponents=ocarina.AIN.Subcomponents(component);
if subcomponents is not None :
prefix=''
while ( len(prefix)<level ) :
prefix=prefix+'.'
for child in subcomponents :
print prefix,ocarina.getInstanceName(child)[0]
visitor(str(ocarina.AIN.Corresponding_Instance(child)),level+1)
def main (): def main ():
'''Test function''' '''Test function'''
err=ocarina.load("rma.aadl"); # load a file err=ocarina.load("rma.aadl"); # load a file
print 'load("rma.aadl")' print 'load("rma.aadl")'
if err[1].strip()!='': print err
print 'info message: \n', err[1] if err[1] != None:
print 'info message: ', err[1]
if err[2]!=[]: if err[2]!=[]:
print 'warning message: \n', err[2] print 'warning message: ', err[2]
if err[3]!=[]: if err[3]!=[]:
print 'error message: \n', err[3] print 'error message: ', err[3]
sys.exit(2) sys.exit(2)
err=ocarina.load("deployment.aadl"); # load a file err=ocarina.load("deployment.aadl"); # load a file
print 'load("deployment.aadl")' print 'load("deployment.aadl")'
if err[1].strip()!='': if err[1] != None:
print 'info message: \n', err[1] print 'info message: ', err[1]
if err[2]!=[]: if err[2]!=[]:
print 'warning message: \n', err[2] print 'warning message: ', err[2]
if err[3]!=[]: if err[3]!=[]:
print 'error message: \n', err[3] print 'error message: ', err[3]
sys.exit(2) sys.exit(2)
err=ocarina.analyze(); # analyze models err=ocarina.analyze(); # analyze models
print 'ocarina.analyze()' print 'ocarina.analyze()'
if err[1].strip()!='': if err[1] != None:
print 'info message: \n', err[1] print 'info message: ', err[1]
if err[2]!=[]: if err[2]!=[]:
print 'warning message: \n', err[2] print 'warning message: ', err[2]
if err[3]!=[]: if err[3]!=[]:
print 'error message: \n', err[3] print 'error message: ', err[3]
sys.exit(2) sys.exit(2)
err=ocarina.instantiate("rma.erc32"); # instantiate system err=ocarina.instantiate("rma.impl"); # instantiate system
print 'ocarina.instantiate("rma.erc32")' print 'ocarina.instantiate("rma.impl")'
if err[1].strip()!='': if err[1] != None:
print 'info message: \n', err[1] print 'info message: ', err[1]
if err[2]!=[]: if err[2]!=[]:
print 'warning message: \n', err[2] print 'warning message: ', err[2]
if err[3]!=[]: if err[3]!=[]:
print 'error message: \n', err[3] print 'error message: ', err[3]
sys.exit(2) sys.exit(2)
print '----------------------------------------------------'
print 'Number of Component Instances:'
print '----------------------------------------------------'
root=ocarina.getInstances('all')[0][0]
# root=ocarina.getRoot()
print ocarina.getInstanceName(root)[0]
visitor(root,1)
if __name__ == "__main__": if __name__ == "__main__":
main () main ()
......
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