Clarify licensing, and packaging of runtime only files :
- moved and split targets/typemapping.py into runtime/typemapping.py and runtime/loglevels.py
- added runtime_files.list pointing to files necessary for runtime, and referring to runtime license
--- a/ProjectController.py Thu Jan 11 15:41:20 2018 +0100
+++ b/ProjectController.py Mon Jan 15 14:43:53 2018 +0100
@@ -59,7 +59,7 @@
from PLCControler import PLCControler
from plcopen.structures import IEC_KEYWORDS
-from targets.typemapping import DebugTypesSize, UnpackDebugBuffer
+from runtime.typemapping import DebugTypesSize, UnpackDebugBuffer from ConfigTreeNode import ConfigTreeNode, XSDSchemaErrorMessage
base_folder = paths.AbsParentDir(__file__)
--- a/controls/LogViewer.py Thu Jan 11 15:41:20 2018 +0100
+++ b/controls/LogViewer.py Mon Jan 15 14:43:53 2018 +0100
@@ -33,7 +33,7 @@
from controls.CustomToolTip import CustomToolTip, TOOLTIP_WAIT_PERIOD
from editors.DebugViewer import DebugViewer, REFRESH_PERIOD
-from targets.typemapping import LogLevelsCount, LogLevels
+from runtime.loglevels import LogLevelsCount, LogLevels from util.BitmapLibrary import GetBitmap
--- a/py_ext/PythonFileCTNMixin.py Thu Jan 11 15:41:20 2018 +0100
+++ b/py_ext/PythonFileCTNMixin.py Mon Jan 15 14:43:53 2018 +0100
@@ -171,7 +171,7 @@
## Code for PLC global variable access
-from targets.typemapping import TypeTranslator
+from runtime.typemapping import TypeTranslator _%(pyextname)sGlobalsDesc = []
__ext_name__ = "%(pyextname)s"
--- a/runtime/PLCObject.py Thu Jan 11 15:41:20 2018 +0100
+++ b/runtime/PLCObject.py Mon Jan 15 14:43:53 2018 +0100
@@ -32,7 +32,8 @@
-from targets.typemapping import LogLevelsDefault, LogLevelsCount, TypeTranslator
+from runtime.typemapping import TypeTranslator +from runtime.loglevels import LogLevelsDefault, LogLevelsCount if os.name in ("nt", "ce"):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/loglevels.py Mon Jan 15 14:43:53 2018 +0100
@@ -0,0 +1,9 @@
+# See COPYING.Runtime file for copyrights details. +LogLevels = ["CRITICAL", "WARNING", "INFO", "DEBUG"] +LogLevelsCount = len(LogLevels) +LogLevelsDict = dict(zip(LogLevels, range(LogLevelsCount))) +LogLevelsDefault = LogLevelsDict["DEBUG"] --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/typemapping.py Mon Jan 15 14:43:53 2018 +0100
@@ -0,0 +1,98 @@
+# See COPYING.Runtime file for copyrights details. +from __future__ import absolute_import +from datetime import timedelta as td +ctypes.pythonapi.PyString_AsString.argtypes = (ctypes.c_void_p,) +ctypes.pythonapi.PyString_AsString.restype = ctypes.POINTER(ctypes.c_char) +class IEC_STRING(Structure): + Must be changed according to changes in iec_types.h + _fields_ = [("len", c_uint8), + ("body", c_char * 126)] +class IEC_TIME(Structure): + Must be changed according to changes in iec_types.h + _fields_ = [("s", c_long), # tv_sec + ("ns", c_long)] # tv_nsec +def _t(t, u=lambda x: x.value, p=lambda t, x: t(x)): + lambda x: td(0, x.s, x.ns/1000), + lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000)) +SameEndianessTypeTranslator = { + "BOOL": _t(c_uint8, lambda x: x.value != 0), + "TRANSITION": _t(c_uint8), + lambda x: x.body[:x.len], + lambda t, x: t(len(x), x)), +SwapedEndianessTypeTranslator = { +TypeTranslator = SameEndianessTypeTranslator +# Construct debugger natively supported types +DebugTypesSize = dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None]) +def UnpackDebugBuffer(buff, indexes): + buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value + for iectype in indexes: + c_type, unpack_func, _pack_func = \ + TypeTranslator.get(iectype, (None, None, None)) + if c_type is not None and buffoffset < buffsize: + cursor = c_void_p(buffptr + buffoffset) + value = unpack_func(cast(cursor, + POINTER(c_type)).contents) + buffoffset += sizeof(c_type) if iectype != "STRING" else len(value)+1 + if buffoffset and buffoffset == buffsize: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime_files.list Mon Jan 15 14:43:53 2018 +0100
@@ -0,0 +1,17 @@
+# those files are used in runtime +# licensed according to LGPL, see COPYING.runtime +runtime/ServicePublisher.py --- a/targets/typemapping.py Thu Jan 11 15:41:20 2018 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-# This file is part of Beremiz, runtime and an Integrated Development Environment for
-# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
-# Copyright (C) 2011: Edouard TISSERANT and Laurent BESSARD
-# See COPYING.Runtime file for copyrights details.
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-# This library 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
-# Lesser General Public License for more details.
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-from __future__ import absolute_import
-from datetime import timedelta as td
-ctypes.pythonapi.PyString_AsString.argtypes = (ctypes.c_void_p,)
-ctypes.pythonapi.PyString_AsString.restype = ctypes.POINTER(ctypes.c_char)
-class IEC_STRING(Structure):
- Must be changed according to changes in iec_types.h
- _fields_ = [("len", c_uint8),
- ("body", c_char * 126)]
-class IEC_TIME(Structure):
- Must be changed according to changes in iec_types.h
- _fields_ = [("s", c_long), # tv_sec
- ("ns", c_long)] # tv_nsec
-def _t(t, u=lambda x: x.value, p=lambda t, x: t(x)):
- lambda x: td(0, x.s, x.ns/1000),
- lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
-SameEndianessTypeTranslator = {
- "BOOL": _t(c_uint8, lambda x: x.value != 0),
- "TRANSITION": _t(c_uint8),
- lambda x: x.body[:x.len],
- lambda t, x: t(len(x), x)),
-SwapedEndianessTypeTranslator = {
-TypeTranslator = SameEndianessTypeTranslator
-# Construct debugger natively supported types
-DebugTypesSize = dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None])
-def UnpackDebugBuffer(buff, indexes):
- buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value
- for iectype in indexes:
- c_type, unpack_func, _pack_func = \
- TypeTranslator.get(iectype, (None, None, None))
- if c_type is not None and buffoffset < buffsize:
- cursor = c_void_p(buffptr + buffoffset)
- value = unpack_func(cast(cursor,
- POINTER(c_type)).contents)
- buffoffset += sizeof(c_type) if iectype != "STRING" else len(value)+1
- if buffoffset and buffoffset == buffsize:
-LogLevels = ["CRITICAL", "WARNING", "INFO", "DEBUG"]
-LogLevelsCount = len(LogLevels)
-LogLevelsDict = dict(zip(LogLevels, range(LogLevelsCount)))
-LogLevelsDefault = LogLevelsDict["DEBUG"]