Commit 5218ebb4 authored by Jerome Legrand's avatar Jerome Legrand

finalize final version of the documentation tools : libraries, exemples and api doc

parent 30305be5
......@@ -5,10 +5,11 @@ import taste
import lmp
def main ():
mainAADLFile = 'DemoDV.aadl'
aadlFiles = [mainAADLFile, 'TASTE_DV_Properties.aadl', 'DemoIV.aadl', 'TASTE-Dataview.aadl', \
'TASTE_IV_Properties.aadl', 'taste_properties.aadl', 'data_model.aadl', 'base_types.aadl', 'deployment.aadl', \
'Cheddar_Properties.aadl', 'arinc653.aadl', 'TestLibHW.aadl']
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
......
......@@ -5,9 +5,10 @@ import taste
import lmp
def main ():
mainAADLFile = 'DemoIV2.aadl'
aadlFiles = [mainAADLFile, 'TASTE-Dataview.aadl', 'TASTE_IV_Properties.aadl', 'taste_properties.aadl', 'data_model.aadl', \
'base_types.aadl', 'deployment.aadl']
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
......
......@@ -14,6 +14,16 @@ def main ():
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'
......@@ -42,23 +52,35 @@ def main ():
text = 'The iv ' + bold(label) + ' has the following attributes : '
rawText(text)
attributesList = []
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
attributes = taste.getComponentAttributes (iv)
for name, value in attributes.items():
#~ text += indent + '* ' + name + ' = ' + value + '\n'
attributesList.append(italic(name) + ' = ' + value)
attributesTable.append([name , value])
listBlock (attributesList)
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 != '':
......@@ -72,12 +94,15 @@ def main ():
text = 'The function ' + bold(label) + ' has the following attributes : '
rawText(text)
attributesList = []
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
attributes = taste.getComponentAttributes (function)
for name, value in attributes.items():
attributesList.append(italic(name) + ' = ' + value)
attributesTable.append([name , value])
listBlock (attributesList)
table(attributesTable, bold(label) + ' attributes')
## functions CP
contParams = taste.getFunctionCP (function)
......@@ -91,7 +116,7 @@ def main ():
cpLabel = taste.getLabel(contParam)
contParamList.append(cpLabel)
listBlock (attributesList)
listBlock (contParamList)
## PI/RI
pis = taste.getFunctionFeatures (function, 'provided')
......@@ -114,9 +139,9 @@ def main ():
#~ printDocument ()
#~ serialize ('ivDoc.md')
serialize ('ivDoc.md')
#~ convert('test.latex', 'latex')
convert('test.pdf', 'latex')
#~ convert('test.pdf', 'latex')
def addPIRIInfo(features):
for feature in features:
......@@ -137,12 +162,15 @@ def addPIRIInfo(features):
text = 'The ' + featureCategory + ' ' + bold(featureLabel) + ' has the following attributes : '
rawText(text)
attributesList = []
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
attributes = taste.getFeatureAttributes (feature)
for name, value in attributes.items():
attributesList.append(italic(name) + ' = ' + value)
attributesTable.append([name , value])
listBlock (attributesList)
table(attributesTable, bold(featureLabel) + ' attributes')
## parameters
parameters = taste.getParameters (feature)
......@@ -151,26 +179,33 @@ def addPIRIInfo(features):
text = 'The ' + featureCategory + ' ' + bold(featureLabel) + ' has the following parameters : '
rawText(text)
parameterList = []
for parameter in parameters:
parameterList = []
parameterLabel = taste.getParameterLabel(parameter)
parameterList.append(parameterLabel)
listBlock (parameterList)
attributesTable = [ \
[['name', 'center'],['value', 'center']], \
]
## attributes
paramAttList = []
attributes = taste.getFeatureAttributes (parameter)
for name, value in attributes.items():
paramAttList.append(italic(name) + ' = ' + value)
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)
paramAttList.append(italic('direction') + ' = ' + direction)
if paramAttList != []:
parameterList.append(paramAttList)
attributesTable.append(['direction' , direction])
listBlock (parameterList)
table(attributesTable, bold(parameterLabel) + ' attributes', tableType='grid')
if __name__ == "__main__":
main ()
......
%% 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
......@@ -11,8 +11,8 @@ def main ():
header ('Test quote Block', 1, '#header1')
quoteBlock (['text 1', ['text 2', ['text 3'], 'text 4'], 'text 5'])
#~ text ('test header reference [header1]')
text ('"blabla"')
#~ rawText ('test header reference [header1]')
rawText ('"blabla"')
pageBreak()
header ('Test code Block')
......@@ -241,12 +241,12 @@ def main ():
header ('internal link', 2)
headerLink = reference('#introduction', 'Introduction')
text ('See the ' + headerLink)
rawText ('See the ' + headerLink)
newLine()
text ('Or')
rawText ('Or')
newLine()
headerLink = reference('Introduction')
text ('See the ' + headerLink)
rawText ('See the ' + headerLink)
newLine()
header ('images', 2)
......@@ -259,6 +259,9 @@ def main ():
imageRef = image('Blade Runner')
rawText('An image : ' + imageRef)
newLine()
imageRef = image('logo.png', 'SVG Logo', 'SVG Logo', width = '50%')
rawText('An image : ' + imageRef)
newLine()
header ('definition', 2)
definedReference('http://fsf.org', 'FSF', 'click here for a good time!')
......
......@@ -287,7 +287,7 @@ def table (tableList, caption='', colSep=' ', tableType=''):
:param tableList: The table is given in a 2 dimensions list : each row of the list is a row of the table. The first one is the header and the header description. Each element of the header list is a list containing 3 data : the text header, the alignment and the size of the column (this last information can be omitted).
:param caption: caption of the table
:param colSep:
:param tableType: table type : '' for simple and multiline table, 'grid' dor grid table and 'pipe' for pipe table.
:param tableType: table type : '' for simple and multiline table, 'grid' for grid table and 'pipe' for pipe table.
>>> table ([['tt1', 'right', 10],['title2', 'left', 1],['t3', 'center', 10], ['t4', 'default', 40]], \
['12', '12', '123', '12'], \
......@@ -987,3 +987,31 @@ def convert(destination, toFormat, source = ''):
except :
print 'convertion impossible : pandoc is not found'
def svgToPdf (source):
''' Call the inkscape command in order to convert the source svg file into pdf format.
param source: svg source file. The destination pdf filename is generated based on the source filename.
>>> convert('test.pdf', 'latex')
'''
destination = ''
convert = False
if source != '':
if os.path.isfile(source) == True:
convert = True
if convert == True:
## get the destination filename base on the source filename
destination = os.path.splitext(source)[0] ## get the filename without the extension
destination += '.pdf' ## add the extension
## inkscape -D -z --file=ex.svg --export-pdf=ex.pdf
command = ['inkscape', '-D', '-z', '--file=' + source, '--export-pdf=' + destination]
try:
subprocess.call(command)
except :
print 'pdf convertion impossible'
return destination
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