Skip to content
Snippets Groups Projects
Commit fb5ef3bb authored by al.schwinn's avatar al.schwinn
Browse files

initial commit of all silecs-gsi projects

parent d1039eaa
No related branches found
Tags gsi-1.0.0
No related merge requests found
Showing
with 2222 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>silecs-codegen</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
This diff is collapsed.
# silecs-codegen
This component of the SILECS PLC-framework generates FESA and stand-alone C++ code from an existing silecs-project in order to ease the usage of the package silecs-communication-cpp
## Getting Started
Please check the lab-specific SILECS-Wikis for more information:
[CERN SILECS Wiki Page][CERN_Wiki]
[GSI SILECS Wiki Page][GSI_Wiki]
## License
Licensed under the GNU GENERAL PUBLIC LICENSE Version 3. See the [LICENSE file][license] for details.
[license]: LICENSE
[CERN_Wiki]: https://wikis.cern.ch/display/SIL/SILECs+Home
[GSI_Wiki]: https://www-acc.gsi.de/wiki/Frontend/SILECS
\ No newline at end of file
#!/bin/sh
set -e
INSTALL_DIR=$1
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT") # path where this script is located in
mkdir -p ${INSTALL_DIR}
cp -r ${SCRIPTPATH}/src/xml ${INSTALL_DIR}
\ No newline at end of file
File moved
File moved
File added
File added
File added
This diff is collapsed.
File added
#!/usr/bin/python
# Copyright 2016 CERN and GSI
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import libxml2
import iecommon
import fesa.fillFesaDeployUnitBase
class FESADeployUnitGenerator3_0_0(object):
def fillXML(self,fesaDeployParsed,silecsDeployParsed,deployName, deployUnitSchemaPath, fesaVersion,logTopics={'errorlog': True} ):
fesaRoot = fesaDeployParsed.xpathEval("/*")[0]
fesaRoot.setProp("xsi:noNamespaceSchemaLocation",deployUnitSchemaPath)
fesaVersionNode = fesaDeployParsed.xpathEval("/deploy-unit/information/fesa-version")[0]
fesaVersionNode.setContent(fesaVersion)
fesaDUNameNode = fesaDeployParsed.xpathEval("/deploy-unit/information/deploy-unit-name")[0]
fesaDUNameNode.setContent(deployName)
fesaOwnershipNode = fesaDeployParsed.xpathEval("/deploy-unit/ownership")[0]
defaultClassTemplate = fesaDeployParsed.xpathEval('/deploy-unit/class[class-name/text()="class-name"]')
if len(defaultClassTemplate) > 0:
defaultClassTemplate[0].unlinkNode()
silecsClasses = silecsDeployParsed.xpathEval("/SILECS-Deploy/Controller/SilecsDesign")
for silecsClass in silecsClasses:
existingClassEntry = fesaDeployParsed.xpathEval('/deploy-unit/class/class-name[text()="' + silecsClass.prop('silecs-design-name') + '"]')
if len(existingClassEntry) > 0:
continue # dont overwrite existing entrys
iecommon.logDebug("Adding class '" + silecsClass.prop('silecs-design-name') + "' to DeployUnit document", {'debuglog': True})
fesaClassNode = libxml2.newNode("class")
fesaClassName = libxml2.newNode("class-name")
fesaClassName.setContent(silecsClass.prop('silecs-design-name'))
fesaClassNode.addChild(fesaClassName)
fesaClassMajorVersion = libxml2.newNode("class-major-version")
fesaClassMajorVersion.setContent('0')
fesaClassNode.addChild(fesaClassMajorVersion)
fesaClassMinorVersion = libxml2.newNode("class-minor-version")
fesaClassMinorVersion.setContent('1')
fesaClassNode.addChild(fesaClassMinorVersion)
fesaClassTinyVersion = libxml2.newNode("class-tiny-version")
fesaClassTinyVersion.setContent('0')
fesaClassNode.addChild(fesaClassTinyVersion)
fesaClassDeviceInstance = libxml2.newNode("device-instance")
fesaClassDeviceInstance.setContent('required')
fesaClassNode.addChild(fesaClassDeviceInstance)
fesaOwnershipNode.addNextSibling(fesaClassNode)
def fillDeployUnit(fesaVersion, className, workspacePath,fesaDesignXSDPath,logTopics={'errorlog': True}):
generator = FESADeployUnitGenerator3_0_0()
fesa.fillFesaDeployUnitBase.fillFesaDeployUnitBase(generator,fesaVersion, className, workspacePath,fesaDesignXSDPath,logTopics)
File added
File added
#!/usr/bin/python
# Copyright 2016 CERN and GSI
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import time
import zlib
import glob
import re
import datetime
import socket
import iecommon
import fesaTemplates
import iefiles
from iecommon import *
#-------------------------------------------------------------------------
# Generates two Makefile.specific, one for the class design
# and another for the deploy unit
#-------------------------------------------------------------------------
def genMakefileClass(projectPath, centralMakefilePath, logTopics={'errorlog': True} ):
# Generate makefile for class design
source = fesaTemplates.genMakeDesign(centralMakefilePath)
makefile = projectPath + "/" + "Makefile.specific"
if os.path.isfile(makefile): #dont overwrite
return
fdesc = open(makefile, "w")
iecommon.logInfo("Generate makefile.specific for class design: " + makefile, logTopics)
fdesc.write(source)
fdesc.close()
def genMakefileDU(projectPath, silecsBasePath, snap7BasePath, logTopics={'errorlog': True}):
# Generate makefile for class design
source = fesaTemplates.genMakeDeploy(silecsBasePath,snap7BasePath)
# Write file and save
makefile = projectPath + "/" + "Makefile.specific"
if os.path.isfile(makefile): #dont overwrite
return
fdesc = open(makefile, "w")
iecommon.logInfo("Generate makefile.specific for deploy unit: " + makefile, logTopics)
fdesc.write(source)
fdesc.close()
def genCProjectFile(projectPath, logTopics={'errorlog': True}):
# Generate makefile for class design
source = fesaTemplates.genCProject()
# Write file and save
newFile = projectPath + "/" + ".cproject"
if os.path.isfile(newFile): #dont overwrite
return
fdesc = open(newFile, "w")
iecommon.logInfo("Generate .cproject", logTopics)
fdesc.write(source)
fdesc.close()
File added
File added
This diff is collapsed.
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment