Commit b171ff06 authored by jerome's avatar jerome

some clean up

parent 6fa7aa1f
#! /usr/bin/python
import ocarina
import taste
import lmp
def main ():
aadlFiles = ['../projects/DemoIV.aadl', '../projects/TASTE-Dataview.aadl', '../projects/TASTE_IV_Properties.aadl', \
'../projects/taste_properties.aadl', '../projects/data_model.aadl', '../projects/base_types.aadl', '../projects/deployment.aadl']
ret = taste.load (aadlFiles, "interfaceview::IV::interfaceview.others")
print 'load', ret
print '\nROOT'
iv = taste.getTasteRoot()
taste.visitIV(iv, False)
functionNames = taste.getFunctions (resType = 'names')
print '\nFUNCTIONS', functionNames
functions = taste.getFunctions ()
for function in functions:
taste.visitFunction(function, 1, False)
features = taste.getPIRIs('name')
print '\nFEATURES', features
features = taste.getPIRIs()
for feature in features:
taste.printPIRI(feature, 1)
pis = taste.getPIs('name')
print '\nPIS', pis
pis = taste.getPIs()
for pi in pis:
taste.printPIRI(pi,1)
ris = taste.getRIs('name')
print '\nRIS', ris
ris = taste.getRIs()
for ri in ris:
taste.printPIRI(ri, 1)
connections = taste.getConnections(resType = 'name')
print '\nCONNECTIONS', connections
connections = taste.getConnections()
for connection in connections:
taste.printConnection(connection, 1)
if __name__ == "__main__":
main ()
#~ sys.exit (0); # exit
#! /usr/bin/python
import ocarina
import taste
import lmp
def main ():
mainAADLFile = '../projects/DemoDV.aadl'
aadlFiles = [mainAADLFile, '../projects/TASTE_DV_Properties.aadl', '../projects/DemoIV.aadl', '../projects/TASTE-Dataview.aadl', \
'../projects/TASTE_IV_Properties.aadl', '../projects/taste_properties.aadl', '../projects/data_model.aadl', \
'../projects/base_types.aadl', '../projects/deployment.aadl', '../projects/Cheddar_Properties.aadl', \
'../projects/arinc653.aadl', '../projects/TestLibHW.aadl']
ret = taste.load (aadlFiles, "deploymentview::DV::deploymentview.others")
print 'load', ret
dv = taste.getTasteRoot()
taste.visitDV(dv)
if __name__ == "__main__":
main ()
#~ sys.exit (0); # exit
#! /usr/bin/python
import ocarina
import taste
import lmp
def main ():
mainAADLFile = '../projects/DemoIV2.aadl'
aadlFiles = [mainAADLFile, '../projects/TASTE-Dataview.aadl', '../projects/TASTE_IV_Properties.aadl', \
'../projects/taste_properties.aadl', '../projects/data_model.aadl', \
'../projects/base_types.aadl', '../projects/deployment.aadl']
ret = taste.load (aadlFiles, "interfaceview::IV::interfaceview.others")
print 'load', ret
iv = taste.getTasteRoot()
taste.visitIV(iv)
if __name__ == "__main__":
main ()
#~ sys.exit (0); # exit
#! /usr/bin/python
import ocarina
import lmp
import taste
#~ from taste import *
from pandoc import *
def main ():
## load iv files
aadlFiles = ['../projects/DemoIV.aadl', '../projects/TASTE-Dataview.aadl', '../projects/TASTE_IV_Properties.aadl', \
'../projects/taste_properties.aadl', '../projects/data_model.aadl', '../projects/base_types.aadl', '../projects/deployment.aadl']
ret = taste.load (aadlFiles, "interfaceview::IV::interfaceview.others")
print 'load', ret
imgDir = '../tmp'
tasteCmd = ['/home/ocarina/Documentation/TASTE/bin/TASTE', '--edit-aadl ' + '../projects/DemoIV.aadl', \
'--export-all-svg ' + imgDir]
try:
print 'generating images'
subprocess.call(tasteCmd)
except :
print 'error in svg generation'
#~ indent = '\t'
indent = ''
indent2 = '\t'
## start the pandoc document
newDocument('Demo IV Documentation ', ['Jerome Legrand'], 'July the 24th 2017')
addTOC()
newPage()
## ROOT
iv = taste.getTasteRoot()
label = taste.getComponentLabel(iv)
headerText = 'IV ' + label
header (headerText)
comment = taste.getComment (iv)
if comment != '':
header('Description', 2)
comment = removeFormatting(comment)
paragraph(comment)
## root attributes
header('Attributes', 2)
text = 'The iv ' + bold(label) + ' has the following attributes : '
rawText(text)
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
attributes = taste.getComponentAttributes (iv)
for name, value in attributes.items():
attributesTable.append([name , value])
table(attributesTable, label + ' attributes')
## FUNCTIONS
newPage()
functions = taste.getFunctions()
for function in functions:
## get the image filename and convert the svg to pdf file
svgFile = lmp.getInstanceName(function)[0]
svgFile = imgDir + '/' + svgFile + '.svg'
pdfFile = svgToPdf(svgFile)
## function header
label = taste.getComponentLabel(function)
headerText = 'Function ' + label
header(headerText)
## image
if pdfFile != '':
imageRef = image(pdfFile, label, label)
rawText(label + ' ' + imageRef)
## Description
description = taste.getDescription (function)
if description != '':
header('Description', 2)
description = removeFormatting(description)
paragraph(description)
## attributes
header('Attributes', 2)
text = 'The function ' + bold(label) + ' has the following attributes : '
rawText(text)
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
attributes = taste.getComponentAttributes (function)
for name, value in attributes.items():
attributesTable.append([name , value])
table(attributesTable, bold(label) + ' attributes')
## functions CP
contParams = taste.getFunctionCP (function)
if contParams != []:
header('Context Parameters', 2)
text = 'The function' + bold(label) + ' has the following context parameters : '
rawText(text)
contParamList = []
for contParam in contParams:
cpLabel = taste.getLabel(contParam)
contParamList.append(cpLabel)
listBlock (contParamList)
## PI/RI
pis = taste.getFunctionFeatures (function, 'provided')
if pis != []:
header('Provided Interfaces', 2)
text = 'The function ' + bold(label) + ' has the following pis.'
rawText(text)
addPIRIInfo(pis)
ris = taste.getFunctionFeatures (function, 'required')
if ris != []:
header('Required Interfaces', 2)
text = 'The function ' + bold(label) + ' has the following ris.'
rawText(text)
addPIRIInfo(ris)
finalizeDocument()
#~ printDocument ()
#serialize ('ivDoc.md')
#~ convert('test.latex', 'latex')
convert('test.pdf', 'latex')
def addPIRIInfo(features):
for feature in features:
featureLabel = taste.getFeatureLabel(feature)
featureCategory = taste.getCategory(feature)
headerText = featureCategory + ' ' + featureLabel
header(headerText, 3)
description = taste.getDescription (feature)
if description != '':
#~ header('Description', 3)
description = removeFormatting(description)
paragraph(description)
## attributes
text = 'The ' + featureCategory + ' ' + bold(featureLabel) + ' has the following attributes : '
rawText(text)
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
attributes = taste.getFeatureAttributes (feature)
for name, value in attributes.items():
attributesTable.append([name , value])
table(attributesTable, bold(featureLabel) + ' attributes')
## parameters
parameters = taste.getParameters (feature)
if parameters != []:
header('Parameters', 4)
text = 'The ' + featureCategory + ' ' + bold(featureLabel) + ' has the following parameters : '
rawText(text)
for parameter in parameters:
parameterList = []
parameterLabel = taste.getParameterLabel(parameter)
parameterList.append(parameterLabel)
listBlock (parameterList)
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
## attributes
attributes = taste.getFeatureAttributes (parameter)
for name, value in attributes.items():
if name == 'source_text':
value = url('http://path/to/asn/file', value)
if name == 'type_source_name':
value = url('http://path', value)
attributesTable.append([name , value])
## other
direction = taste.getDirection(parameter)
attributesTable.append(['direction' , direction])
table(attributesTable, bold(parameterLabel) + ' attributes', tableType='grid')
if __name__ == "__main__":
main ()
#~ sys.exit (0); # exit
This image diff could not be displayed because it is too large. You can view the blob instead.
%% Creator: Inkscape inkscape 0.48.5, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'logo.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{291.16640625bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.18676215)%
\put(0,0){\includegraphics[width=\unitlength]{logo.pdf}}%
\put(-0.00566686,0.00944087){\makebox(0,0)[lb]{\smash{W3C}}}%
\put(0.48889569,0.00944087){\makebox(0,0)[lb]{\smash{SVG}}}%
\end{picture}%
\endgroup%
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 195 82">
<title>SVG logo combined with the W3C logo, set horizontally</title>
<desc>The logo combines three entities displayed horizontally: the W3C logo with the text 'W3C'; the drawing of a flower or star shape with eight arms; and the text 'SVG'. These three entities are set horizontally.</desc>
<metadata>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:cc="http://creativecommons.org/ns#" xmlns:xhtml="http://www.w3.org/1999/xhtml/vocab#" xmlns:dc="http://purl.org/dc/elements/1.1/">
<cc:Work rdf:about="">
<dc:title>SVG logo combined with the W3C logo</dc:title>
<dc:format>image/svg+xml</dc:format>
<rdfs:seeAlso rdf:resource="http://www.w3.org/2007/10/sw-logos.html"/>
<dc:date>2007-11-01</dc:date>
<xhtml:license rdf:resource="http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231"/>
<cc:morePermissions rdf:resource="http://www.w3.org/2007/10/sw-logos.html#LogoWithW3C"/>
<cc:attributionURL rdf:reource="http://www.w3.org/2001/sw/"/>
<dc:description>The logo combines three entities displayed horizontally: the W3C logo with the text 'W3C'; the drawing of a flower or star shape with eight arms; and the text 'SVG'. These three entities are set horizontally.
</dc:description>
</cc:Work>
</rdf:RDF>
</metadata>
<text x="0" y="75" font-size="83" fill-opacity="0" font-family="Trebuchet" letter-spacing="-12">W3C</text>
<text x="180" y="75" font-size="83" fill-opacity="0" font-family="Trebuchet" font-weight="bold">SVG</text>
<defs>
<g id="SVG" fill="#005A9C">
<path id="S" d="M 5.482,31.319 C2.163,28.001 0.109,23.419 0.109,18.358 C0.109,8.232 8.322,0.024 18.443,0.024 C28.569,0.024 36.782,8.232 36.782,18.358 L26.042,18.358 C26.042,14.164 22.638,10.765 18.443,10.765 C14.249,10.765 10.850,14.164 10.850,18.358 C10.850,20.453 11.701,22.351 13.070,23.721 L13.075,23.721 C14.450,25.101 15.595,25.500 18.443,25.952 L18.443,25.952 C23.509,26.479 28.091,28.006 31.409,31.324 L31.409,31.324 C34.728,34.643 36.782,39.225 36.782,44.286 C36.782,54.412 28.569,62.625 18.443,62.625 C8.322,62.625 0.109,54.412 0.109,44.286 L10.850,44.286 C10.850,48.480 14.249,51.884 18.443,51.884 C22.638,51.884 26.042,48.480 26.042,44.286 C26.042,42.191 25.191,40.298 23.821,38.923 L23.816,38.923 C22.441,37.548 20.468,37.074 18.443,36.697 L18.443,36.692 C13.533,35.939 8.800,34.638 5.482,31.319 L5.482,31.319 L5.482,31.319 Z"/>
<path id="V" d="M 73.452,0.024 L60.482,62.625 L49.742,62.625 L36.782,0.024 L47.522,0.024 L55.122,36.687 L62.712,0.024 L73.452,0.024 Z"/>
<path id="G" d="M 91.792,25.952 L110.126,25.952 L110.126,44.286 L110.131,44.286 C110.131,54.413 101.918,62.626 91.792,62.626 C81.665,62.626 73.458,54.413 73.458,44.286 L73.458,44.286 L73.458,18.359 L73.453,18.359 C73.453,8.233 81.665,0.025 91.792,0.025 C101.913,0.025 110.126,8.233 110.126,18.359 L99.385,18.359 C99.385,14.169 95.981,10.765 91.792,10.765 C87.597,10.765 84.198,14.169 84.198,18.359 L84.198,44.286 L84.198,44.286 C84.198,48.481 87.597,51.880 91.792,51.880 C95.981,51.880 99.380,48.481 99.385,44.291 L99.385,44.286 L99.385,36.698 L91.792,36.698 L91.792,25.952 L91.792,25.952 Z"/>
</g>
</defs>
<g shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality">
<g>
<g id="logo" transform="scale(0.24) translate(0, 35)">
<g stroke-width="38.0086" stroke="#000">
<g id="svgstar" transform="translate(150, 150)">
<path id="svgbar" fill="#EDA921" d="M-84.1487,-15.8513 a22.4171,22.4171 0 1 0 0,31.7026 h168.2974 a22.4171,22.4171 0 1 0 0,-31.7026 Z"/>
<use xlink:href="#svgbar" transform="rotate(45)"/>
<use xlink:href="#svgbar" transform="rotate(90)"/>
<use xlink:href="#svgbar" transform="rotate(135)"/>
</g>
</g>
<use xlink:href="#svgstar"/>
</g>
<g id="SVG-label">
<use xlink:href="#SVG" transform="scale(1.08) translate(65,10)"/>
</g>
</g>
</g>
</svg>
\ No newline at end of file
export PATH=/home/ocarina/local/bin:$PATH
export LD_LIBRARY_PATH=/home/ocarina/local/lib:$LD_LIBRARY_PATH
export PATH=`ocarina-config --prefix`/bin:$PATH
export OCARINA_PATH=`ocarina-config --prefix`
export LD_LIBRARY_PATH=$OCARINA_PATH/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$OCARINA_PATH/include/ocarina/runtime/python:$OCARINA_PATH/lib:$PYTHONPATH
export PYTHONPATH=$PYTHONPATH:/home/ocarina/Documentation/Libraries
<
#! /usr/bin/python
#~ import pandoc
from pandoc import *
def main ():
newDocument('title\nof the document', ['author1', 'author2'], '25 june\n2017')
addTOC()
newPage()
header ('Test quote Block', 1, '#header1')
quoteBlock (['text 1', ['text 2', ['text 3'], 'text 4'], 'text 5'])
#~ rawText ('test header reference [header1]')
rawText ('"blabla"')
pageBreak()
header ('Test code Block')
header ('with string', 2)
code1 = 'if (a > 3) { \n moveShip(5 * gravity, DOWN); \n}'
codeBlock (code1)
header ('with list', 2)
code2 = ['if (a > 3) {', ' moveShip(5 * gravity, DOWN);', '}']
codeBlock (code2)
header ('fenced with string', 2)
codeBlockFenced (code1)
newPage()
header ('Test line Block')
header ('with string', 2)
lineBlock1 = 'line 1 \nline 2 \nline 3'
lineBlock (lineBlock1)
header ('with list', 2)
lineBlock2 = ['line 1', 'line 2', 'line 3']
lineBlock (lineBlock2)
newPage()
header ('Test list Block')
header ('bullet list', 2)
testList1 = ['ab', ['a', ['a', 'b'], 'b', 'c'], 'b', 'c']
listBlock(testList1)
header ('ordered list', 2)
testList2 = ['ab', 'bc', 'cd']
orderedlistBlock(testList2)
newPage()
header ('horizontal rules')
horizontalRule ()
horizontalRule ('*', 4)
horizontalRule ('_', 20)
newPage()
header ('tables')
header ('simple table', 2)
header ('with header', 3)
table1_1 = [ \
[['t1', 'right'],['title2', 'left'],['t3', 'center'], ['t4', 'default']], \
['12', '12', '123', '12'], \
['123', '123', '1234', '1234'], \
['1', '1', '1', '1'] \
]
table1_2 = [ \
[['tt1', 'right', 10],['title2', 'left', 1],['t3', 'center', 10], ['t4', 'default', 40]], \
['12', '12', '123', '12'], \
['123', '123', '1234', '1234'], \
['1', '1', '1', '1'] \
]
table(table1_1, 'table 1_1 caption')
newLine()
table(table1_2, 'table 1_2 caption')
newLine()
header ('without header', 3)
table2 = [ \
[['', 'right', 10],['', 'left', 5],['', 'center', 2], ['', 'default', 20]], \
['12', '12', '123', '12'], \
['123', '123', '1234', '1234'], \
['1', '1', '1', '1'] \
]
table(table2, 'test', ' ')
newPage()
header ('multiline table', 2)
header ('with header', 3)
table3_1 = [ \
[['Centered\nHeader', 'center'],['Default\nAligned', 'default'],['Right\nAligned\ntest', 'right'], ['Left\nAligned', 'left']], \
['First', 'rowbidule', '12.0', 'Example of a row that\nspans multiple lines.'], \
['Second', 'row', '5.0', 'Here\'s another one. Note\nthe blank line between\nrows.'], \
]
table(table3_1)
header ('without header', 3)
table3_2 = [ \
[['', 'center'],['', 'default'],['', 'right', 20], ['', 'left', 50]], \
['First', 'row', '12.0', 'Example of a row that\nspans multiple lines.'], \
['Second', 'row', '5.0', 'Here\'s another one. Note\nthe blank line between\nrows.'], \
]
table(table3_2)
header ('grid table', 2)
header ('with header', 3)
table4_1 = [ \
[['Fruit', 'default'],['Price', 'default'],['Advantages', 'default']], \
['Bananas', '$1.34', '- built-in wrapper\n- bright color'], \
['Oranges', '$2.10', '- cures scurvy\n- tasty'], \
]
table(table4_1, '', ' ', 'grid')
table4_2 = [ \
[['Fruit', 'left', 20],['Price', 'center'],['Advantages', 'right', 30]], \
['Bananas', '$1.34', '- built-in wrapper\n- bright color'], \
['Oranges', '$2.10', '- cures scurvy\n- tasty'], \
]
table(table4_2, '', ' ', 'grid')
header ('without header', 3)
table4_3 = [ \
[['', 'left'],['', 'center'],['', 'right']], \
['Bananas', '$1.34', '- built-in wrapper\n- bright color'], \
['Oranges', '$2.10', '- cures scurvy\n- tasty'], \
]
#~ table4_3 = [ \
#~ [['', 'left', 20],['', 'center'],['', 'right', 30]], \
#~ ['Bananas', '$1.34', '- built-in wrapper\n- bright color'], \
#~ ['Oranges', '$2.10', '- cures scurvy\n- tasty'], \
#~ ]
table(table4_3, '', ' ', 'grid')
header ('pipe table', 2)
header ('with header', 3)
table5_1 = [ \
[['Right', 'right'],['Left', 'left'],['Default', 'default'], ['Center', 'center']], \
['12', '12', '123', '12'], \
['123', '123', '123', '123'], \
['1', '1', '1', '1'] \
]
table(table5_1, '', ' ', 'pipe')
table5_2 = [ \
[['Right\ntruc', 'right'],['Left', 'left', 30],['Default', 'default'], ['Center', 'center']], \
['12', '12', '123', '12'], \
['123', '123', '123', '123'], \
['1', '1', '1', '1'] \
]
table(table5_2, '', ' ', 'pipe')
header ('without header', 3)
table5_3 = [ \
[['', 'right'],['', 'left'],['', 'default'], ['', 'center']], \
['12', '12', '123', '12'], \
['123', '123', '123', '123'], \
['1', '1', '1', '1'] \
]
table(table5_3, '', ' ', 'pipe')
newPage()
header ('text formatting')
header ('emphase', 2)
rawText('this is an ' + italic('italic') + ' emphase')
newLine()
rawText('this is a ' + bold('bold') + ' emphase')
newLine()
header ('strikeout', 2)
rawText('this is a ' + strikeout('strike out'))
newLine()
header ('power and indice', 2)
rawText('power : 2' + power('10'))
newLine()
rawText('indice : H' + indice('2') + '0')
newLine()
header ('verbatim', 2)
rawText('verbatim text : ' + verbatim('this is a verbatim text') + '\n')
rawText('verbatim text : ' + verbatim('this is a `verbatim` text'))
newLine()
header ('small caps', 2)
rawText('small caps text : ' + smallCaps('this is a smallcaps text'))
header ('math', 2)
## tex math format shall be used with \\ for special char
formula = '\\sqrt{\\frac{x^2}{3}}'
rawText('math formula : ' + math(formula))
newLine()
newPage()
header ('references')
header ('automatic link', 2)
urlLink = url('http://google.com')
emailLink = email('sam@green.eggs.ham')
rawText('url : ' + urlLink)
rawText('email : ' + emailLink)
newLine()
header ('inline link', 2)
header ('url', 3)
inlineLink = url('http://fsf.org', 'inline link', 'click here for a good time!')
rawText('This is an ' + inlineLink)