Commit 51ce21a7 authored by Maxime Perrotin's avatar Maxime Perrotin

No more concurrency view converter needed

Removed from externaltools
parent 10c786c3
package provide concurrencyview 0.1
lappend auto_path .
namespace eval concurrencyview {
# Graphical name of the operation
proc getLabel {} {
return "Build Concurrency View"
}
# Name of the application this script can be used with
# shall be either InterfaceView or DeploymentView
proc getApplication {} {
return "DeploymentView"
}
# Names of the object this script can be used on
# FIXME - it should be active all the time
proc getApplyTo {} {
return [list "alwayson" ]
}
# List of way to manage output in the Framework
# Could be an empty list or one or both of 'dialogBox' and 'statusBar'
proc getOutputManagement {} {
## Ticket mantis 0000625
return [list dialogBoxOnError ]
}
proc concurrencyview { args } {
if { [Object::getAttribute "concurrencyview" state] == "deprecated" } {
Context::setAttribute "concurrencyview" state "normal"
if { [ string match win32*64 [::platform::identify]] || [ string match win32* [::platform::identify]] } {
return [concurrencyviewWindows_internal ]
} else {
return [concurrencyview_internal ]
}
}
}
# the line "exec {*}[auto_execok $::installationPath/config/externalTools/test.bat]"
# ask the current OS which software is to be used to open the file test.bat
# to launch using the absolute path, read the template2.tcl_
# synchronous call
proc concurrencyviewWindows_internal { } {
set ivFilename [lindex [Object::getAttribute "interfaceview" "filenames" ] 0 ]
set dvFilename [lindex [Object::getAttribute "deploymentview" "filenames" ] 0 ]
set dtFilename [lindex [Object::getAttribute "dataview" "filenames" ] 0 ]
set hwFilenames [Object::getAttribute "hwlibrary" "filenames" ]
if { [file exists $ivFilename ] && [file exists $dvFilename ] && [file exists $dtFilename ] } {
set concatFilename "[LogManager::getLogDirectory]/concatenatedFile.aadl"
set concatFilenamePredicates "[LogManager::getLogDirectory]/concatenatedFile.sbp"
set cvFilename "[LogManager::getLogDirectory]/concurrencyview.aadl"
set fout [ open $concatFilename w ]
fconfigure $fout -translation lf
set fin [ open $ivFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
puts $fout "\n\n"
set fin [ open $dvFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
puts $fout "\n\n"
if { [file exists $dtFilename ] } {
set fin [ open $dtFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
puts $fout "\n\n"
}
foreach hwFilename $hwFilenames {
if { [file exists $hwFilename ] } {
set fin [ open $hwFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
puts $fout "\n\n"
}
}
close $fout
if { [ ::AADLInspectorTools::getFactsFromAADL $concatFilename $concatFilenamePredicates ] != 0 } {
return [list -1 "error in aadlrev" ]
}
if { [lindex [ ::AADLInspectorTools::generateAadlFromFacts $concatFilenamePredicates "$::commonPluginPath/TasteVT.sbp" $cvFilename ] 0 ] != 0 } {
return [list -1 "error in aadlrev" ]
}
::API::HMI::loadUI "$cvFilename" "concurrencyview"
return [list 0 ""]
} else {
return [ list -1 "IV Dataview and DV shall be loaded." ]
}
}
# the line "exec {*}[auto_execok $::installationPath/config/externalTools/test.bat]"
# ask the current OS which software is to be used to open the file test.bat
# to launch using the absolute path, read the template2.tcl_
# synchronous call
proc concurrencyview_internal { } {
set generationDir "[LogManager::getLogDirectory]/buildCV"
set ivFilename "$generationDir/interfaceview.aadl"
set dvFilename "$generationDir/deployment.aadl"
set dtFilename [lindex [Object::getAttribute "dataview" "filenames" ] 0 ]
#~ set hwFilenames [Object::getAttribute "hwlibrary" "filenames" ]
file delete -force "$generationDir"
file mkdir $generationDir
::API::Taste::exportIV [list "backend" "1_3" "dirname" $generationDir "selection" "all" ]
::API::Taste::exportDV [list "backend" "1_3" "dirname" $generationDir]
if { [file exists $ivFilename ] && [file exists $dvFilename ] && [file exists $dtFilename ] } {
#~ taste-edit-concurrency-view "$dtFilename" "$ivFilename" "$dvFilename"
set concatFilename "[LogManager::getLogDirectory]/concatenatedFile.aadl"
set cvFilename "[LogManager::getLogDirectory]/concurrencyview.aadl"
set fout [ open $concatFilename w ]
fconfigure $fout -translation lf
set fin [ open $ivFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
puts $fout "\n\n"
set fin [ open $dvFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
puts $fout "\n\n"
if { [file exists $dtFilename ] } {
set fin [ open $dtFilename r ]
set content [read -nonewline $fin]
close $fin
puts $fout $content
#~ puts $fout "\n\n"
}
#~ foreach hwFilename $hwFilenames {
#~ if { [file exists $hwFilename ] } {
#~ set fin [ open $hwFilename r ]
#~ set content [read -nonewline $fin]
#~ close $fin
#~ puts $fout $content
#~ puts $fout "\n\n"
#~ }
#~ }
close $fout
set res [catch { exec taste-config --prefix } tasteConfigDir ]
if { $res != 0 } {
#~ an error happend
return [list 1 [list "taste-config error: $tasteConfigDir"] ]
} else {
set AADL_IV_PROPERTIES "$tasteConfigDir/share/config_ellidiss/TASTE_IV_Properties.aadl"
set AADL_DV_PROPERTIES "$tasteConfigDir/share/config_ellidiss/TASTE_DV_Properties.aadl"
set OCARINA_COMPONENTS "$tasteConfigDir/share/ocarina/AADLv2/ocarina_components.aadl"
set tempdir "$generationDir/tmpConcu"
file delete -force $tempdir
file mkdir $tempdir
set res [ catch { exec buildsupport -i ${ivFilename} -c ${dvFilename} -d ${dtFilename} ${AADL_IV_PROPERTIES} ${AADL_DV_PROPERTIES} ${OCARINA_COMPONENTS} -glue -gw -o ${tempdir} 2>@1 } errMsg ]
if { [file exists "$tempdir/ConcurrencyView/process.aadl" ] } {
file delete -force "$cvFilename"
file copy -force "$tempdir/ConcurrencyView/process.aadl" "$cvFilename"
set chan [open "$cvFilename" a+ ]
fconfigure $chan -translation lf
foreach threadFile [glob -nocomplain -type f -directory "$tempdir/ConcurrencyView" *_Thread.aadl ] {
set fin [ open $threadFile r ]
set content [read -nonewline $fin]
close $fin
puts $chan $content
puts $chan "\n\n"
}
set fin [ open $OCARINA_COMPONENTS r ]
set content [read -nonewline $fin]
close $fin
puts $chan $content
close $chan
} else {
return [list 1 [list "buildsupport error:\n$errMsg" ] ]
}
::API::HMI::loadUI "$cvFilename" "concurrencyview"
}
return [list 0 ""]
} else {
return [ list -1 [list "Dataview, Interfaceview and Deploymentview shall be loaded." ] ]
}
}
}
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