From 4c669c6ae628324738118445f49a53313f57d6f9 Mon Sep 17 00:00:00 2001 From: Jean Henry Date: Tue, 2 Sep 2025 16:17:38 +0200 Subject: [PATCH 1/3] fix: remove Scade One related code, doc and tests --- doc/source/index.rst | 23 +- doc/source/usage/index.rst | 3 +- doc/source/usage/proxy.rst | 3 - doc/source/usage/swancg.rst | 88 - doc/source/usage/{kcg.rst => wrapper.rst} | 4 +- .../scade/python_wrapper/swan_data_parser.py | 394 --- src/ansys/scade/python_wrapper/swanpython.py | 368 --- tests/Types/SOne/Model/Model.sproj | 6 - tests/Types/SOne/Model/Model.sproj.editor | 5 - tests/Types/SOne/Model/assets/P.swan | 2151 ----------------- tests/Types/SOne/Model/assets/P.swani | 121 - .../SOne/Model/jobs/codegen_8ad36ba/.sjob | 22 - .../Model/jobs/codegen_8ad36ba/config.json | 21 - tests/Types/SOne/Proxy/types_.json | 12 - tests/conftest.py | 69 - tests/test_int_types.py | 34 +- 16 files changed, 13 insertions(+), 3311 deletions(-) delete mode 100644 doc/source/usage/swancg.rst rename doc/source/usage/{kcg.rst => wrapper.rst} (96%) delete mode 100644 src/ansys/scade/python_wrapper/swan_data_parser.py delete mode 100644 src/ansys/scade/python_wrapper/swanpython.py delete mode 100644 tests/Types/SOne/Model/Model.sproj delete mode 100644 tests/Types/SOne/Model/Model.sproj.editor delete mode 100644 tests/Types/SOne/Model/assets/P.swan delete mode 100644 tests/Types/SOne/Model/assets/P.swani delete mode 100644 tests/Types/SOne/Model/jobs/codegen_8ad36ba/.sjob delete mode 100644 tests/Types/SOne/Model/jobs/codegen_8ad36ba/config.json delete mode 100644 tests/Types/SOne/Proxy/types_.json diff --git a/doc/source/index.rst b/doc/source/index.rst index bf06c0b..13ca9f1 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -1,25 +1,20 @@ Ansys SCADE Python Wrapper ========================== -This tool provides a Python proxy to a SCADE Suite or Scade One application. +This tool provides a Python proxy to a SCADE Suite application. It allows running the application in regular batch mode, or using SCADE Suite white box co-simulation, through ``SsmSlaveLib.c`` services. -The package is made of the following components: +The package supports SCADE Suite 2021 R2 and greater, and is made of the +following components: -* SCADE Suite (2021 R2 and greater) +* SCADE Suite Code Generator extension +* SCADE Suite Custom Extension: Settings page for the wrapper - * SCADE Suite Code Generator extension - * SCADE Suite Custom Extension: Settings page for the wrapper - - Refer to the section *Generating Integration Code from SCADE Suite*, in the - document *SCADE Python API Guide* of the SCADE Suite documentation, - for a complete reference of SCADE Code Generator extensions, also known as - wrappers. - -* Scade One (2024 R2) - - * Command-line tool +Refer to the section *Generating Integration Code from SCADE Suite*, in the +document *SCADE Python API Guide* of the SCADE Suite documentation, +for a complete reference of SCADE Code Generator extensions, also known as +wrappers. Contents -------- diff --git a/doc/source/usage/index.rst b/doc/source/usage/index.rst index 64439e1..e2a36aa 100644 --- a/doc/source/usage/index.rst +++ b/doc/source/usage/index.rst @@ -4,8 +4,7 @@ Usage .. toctree:: :maxdepth: 1 - kcg - swancg + wrapper proxy cosim display diff --git a/doc/source/usage/proxy.rst b/doc/source/usage/proxy.rst index 48db672..6e51546 100644 --- a/doc/source/usage/proxy.rst +++ b/doc/source/usage/proxy.rst @@ -1,9 +1,6 @@ Python proxy ============ -The structure of the Python proxy is identical for both SCADE Suite -and Scade One models. - The Python module defines: * A class per structure used in the interfaces of the root operators. diff --git a/doc/source/usage/swancg.rst b/doc/source/usage/swancg.rst deleted file mode 100644 index 5196996..0000000 --- a/doc/source/usage/swancg.rst +++ /dev/null @@ -1,88 +0,0 @@ -Usage with Scade One -==================== - -The tool, run through the Command Line Interface, launches ``swan-cg`` with a -configuration, builds the corresponding DLL, and generates the Python proxy -for the DLL. - -Configuration -------------- - -The syntax of the configuration file is provided in the -*JSON Schema Syntax of Code Generator Configuration File* -section of the user documentation. - -However, it is easier to derive the configuration file from a template, -``config.json``, you obtain with a Code Generator job: - -.. image:: /_static/sone.png - :width: 90% - -Create your configuration file from the template and edit it with -respect to your model. For example: - -.. code:: json - - { - "files": [ - "../PyBox/assets/P.swan", - "../PyBox/assets/P.swani", - "../stdlib/assets/stdlib.swan" - ], - "roots": [ - "P::Root" - ], - "target_dir": ".", - "target": "C", - "name_length": 200, - "significance_length": 31 - } - -Command Line Interface ----------------------- - -The tool has the following parameters: - -.. code:: bash - - usage: swanpython.py [-h] [-v] -n [-p ] [-a] [--size ] [--false ] - [--true ] [--no_cg] - cmdjson - - Scade One Python Proxy - - positional arguments: - cmdjson swan code gen settings file - - options: - -h, --help show this help message and exit - -v, --version display the version - -n , --name - name of the output python module - -p , --project - Swan project file (*.sproj) - -a, --all force rebuild - --size type of swan_size - --false value of swan_false - --true value of swan_true - --no_cg do not run swan_cg - -* You must set the ``S_ONE_HOME`` environment variable to the Scade One installation - to consider, for example: - - ``set S_ONE_HOME=C:\Program Files\ANSYS Inc\v242\Scade One`` -* The Scade One project is only used to access the resources for imported code. - For now, the wrapper supports only header files, for imported types and macros. - -Once the package is installed in a Python 3.10 environment, that can be -virtual, the tool can be run using three different modes. - -For example: - -.. code:: bash - - > python .../lib/site_packages/ansys/scade/python_wrapper/swanpython.py -n my_module cmd.json - > python -m ansys.scade.python_wrapper.swanpython -n my_module cmd.json - > ansys_scade_python_wrapper_swanpython.exe -n my_module cmd.json - -This produces ``my_module.dll`` and ``my_module.py``. diff --git a/doc/source/usage/kcg.rst b/doc/source/usage/wrapper.rst similarity index 96% rename from doc/source/usage/kcg.rst rename to doc/source/usage/wrapper.rst index fad3b45..42ad2b2 100644 --- a/doc/source/usage/kcg.rst +++ b/doc/source/usage/wrapper.rst @@ -1,5 +1,5 @@ -Usage with SCADE Suite -====================== +Wrapper +======= Settings -------- diff --git a/src/ansys/scade/python_wrapper/swan_data_parser.py b/src/ansys/scade/python_wrapper/swan_data_parser.py deleted file mode 100644 index ec3a6c9..0000000 --- a/src/ansys/scade/python_wrapper/swan_data_parser.py +++ /dev/null @@ -1,394 +0,0 @@ -# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -"""Intermediate model for Python proxy for Scade One standalone DLL.""" - -from enum import Enum -import json -from pathlib import Path -import re -from typing import List, Optional, Tuple - -import ansys.scade.python_wrapper.pydata as data - - -# classes -class EK(Enum): - """Sections of the KCG mapping file.""" - - PREDEFINED = 'predefined_type' - ARRAY = 'array' - ENUM = 'enum' - ENUM_VALUE = 'enum_value' - STRUCT = 'struct' - FIELD = 'field' - OPERATOR = 'operator' - INPUTS = 'inputs' - OUTPUTS = 'outputs' - SENSOR = 'sensor' - GLOBAL = 'global' - FUNCTION = 'function' - - -# mapping code to model -# * key: or (, ) -# * value: -_links = {} - - -# C source files -swan_files = [] - -# type indexes in the json file, for model and code sections -_m_id_j = {} -_c_id_j = {} - - -def _get_model(model: data.Model, c_id: int, role: str) -> data.Entity: - m_id = _links.get((c_id, role), c_id) - return model.get_mapped_entity(m_id) - - -def _get_model_decl(id: int): - # a declaration is a tuple - # - # model counterpart, if any... - # the structure of the mapping file is not regular, some types have - # the same ids w/o link, such as structs, and other have different ids - # and links, like predefined operators - m_decl = _m_id_j.get(id) - if not m_decl: - # try using the links - m_decl = _m_id_j.get(_links.get(id)) - return m_decl - - -def parse_from_swan_mapping(mf: Path) -> tuple[data.Model, list]: - """Build the intermediate model from the KCG mapping file.""" - model = data.Model(prefix='swan') - with mf.open() as f: - j = json.load(f) - - # index the declarations - _index_mapping(model, j) - - # build place-holders for root operators - _build_model(model, j['model']) - - # mapping - global _links - - for m in j.get('mapping', []): - role = m.get('role', None) - key = (m['code_id'], role) if role else m['code_id'] - _links[key] = m['model_id'] - - _build_code(model, j['code']) - - # add additional generated files - swan_files.append('../cg_map.json') - swan_files.append('../cg_log.json') - - return model, swan_files - - -def _index_mapping(model: data.Model, j): - global _c_id_j, _m_id_j - - # index the used model json records - for decl in j['model']: - cls, atts = decl - try: - ek = EK(cls) - except ValueError: - continue - if ek == EK.PREDEFINED: - _m_id_j[atts['id']] = [ek, atts] - elif ek == EK.ARRAY: - _m_id_j[atts['id']] = [ek, atts] - elif cls == EK.ENUM: - _m_id_j[atts['id']] = [ek, atts] - for v in atts.get('values', []): - _m_id_j[v['id']] = [EK.ENUM_VALUE, v] - elif ek == EK.STRUCT: - _m_id_j[atts['id']] = [ek, atts] - for f in atts.get('fields', []): - _m_id_j[f['id']] = [EK.FIELD, f] - elif ek == EK.OPERATOR: - _m_id_j[atts['id']] = [ek, atts] - for io in atts.get('inputs', []): - _m_id_j[io['id']] = [EK.INPUTS, io] - for io in atts.get('outputs', []): - _m_id_j[io['id']] = [EK.OUTPUTS, io] - elif ek == EK.SENSOR: - _m_id_j[atts['id']] = [ek, atts] - - # index the type json records of the code - for file in j['code']: - for decl in file['declarations']: - cls, atts = decl - try: - ek = EK(cls) - except ValueError: - continue - if ek in {EK.PREDEFINED, EK.ARRAY, EK.ENUM, EK.STRUCT, EK.GLOBAL}: - _c_id_j[atts['id']] = [ek, atts] - - -def _build_typed(model, typed: data.Typed, id: int): - _, atts = _c_id_j[id] - typed.c_type = atts['name'] - if isinstance(typed, data.Context): - _, type_ = _build_type(model, id) - # The context's type must be a structure - assert isinstance(type_, data.Structure) # nosec B101 # addresses linter - typed.link_type(type_) - else: - assert isinstance(typed, data.Feature) # nosec B101 # addresses linter - typed.sizes, typed.type = _build_type(model, id) - - -def _build_type(model: data.Model, id: int) -> Tuple[List[int], Optional[data.Type]]: - """Return a tuple list, .""" - if not id: - return [], None - - # retrieve the corresponding json record - c_ek, c_atts = _c_id_j[id] - if c_ek == EK.ARRAY: - sizes, type_ = _build_type(model, c_atts['base_type']) - return sizes + [c_atts['size']], type_ - - type_ = model.get_mapped_entity(id) - if type_: - # type already built - assert isinstance(type_, data.Type) # nosec B101 # addresses linter - return [], type_ - - # model counterpart, if any... - # the structure of the mapping file is not regular, some types have - # the same ids w/o link, such as structs, and other have different ids - # and links, like predefined operators - m_type_decl = _get_model_decl(id) - # assert not m_type_decl or m_type_decl[0] == c_ek - - m_atts = m_type_decl[1] if m_type_decl else {} - - if c_ek == EK.PREDEFINED: - type_ = data.Scalar(m_name=m_atts.get('name', ''), c_name=c_atts['name']) - elif c_ek == EK.STRUCT: - type_ = data.Structure(c_name=c_atts['name']) - # model types are unnamed, get the code name if a model exist - if m_atts: - type_.m_name = type_.c_name - for c_field_atts in c_atts['fields']: - # either field or io - m_field_decl = _get_model_decl(c_field_atts['id']) - if not m_field_decl: - # consider only fields with a counterpart in the model - continue - _, m_field_atts = m_field_decl - field = data.Feature( - m_name=_get_projected_name(m_field_atts), - c_name=c_field_atts['name'], - ) - _build_typed(model, field, c_field_atts['type']) - type_.add_field(field) - model.map_item(c_field_atts['id'], field) - else: - assert c_ek == EK.ENUM # nosec B101 # last enumeration's values for types - type_ = data.Scalar( - # no name/path for enums - m_name=m_atts.get('name', 'int32'), - # need a size for ctypes - # c_name=c_atts['name'], - c_name='swan_int32', - path=m_atts.get('path'), - ) - - model.add_type(type_) - model.map_item(id, type_) - - return [], type_ - - -def _get_projected_name(atts) -> str: - name = atts['name'] - projection = atts.get('projection') - if not projection: - return name - - # TODO: support all the syntax - # for now: support one level of groups only, - # 2024 R1 --> .().(1) - # 2024 R2 --> [] - if isinstance(projection, list): - # assume 2024 R2 - return projection[0] - # assume 2024 R1 - m = re.match(r'\.\((.*)\)\.\(1\)', projection) - if not m: - print(projection, 'analysis failure') - return name - return m.groups()[0] - - -def _build_model(model: data.Model, j): - # read a few declarations from the model part of the mapping: - # -> only root operators - for cls, atts in j: - if cls == 'operator': - if not atts['root']: - continue - path = atts['path'] - op = data.Operator( - m_name=path.split('::')[-1], - path=path, - ) - model.add_operator(op) - model.map_item(atts['id'], op) - for input in atts.get('inputs', []): - m_name = _get_projected_name(input) - io = data.IO(m_name=m_name, input=True) - op.add_io(io) - model.map_item(input['id'], io) - for output in atts.get('outputs', []): - m_name = _get_projected_name(output) - io = data.IO(m_name=m_name, input=False) - op.add_io(io) - model.map_item(output['id'], io) - - -def _build_sensor(model: data.Model, c_atts) -> Optional[data.Feature]: - m_decl = _m_id_j.get(c_atts['id']) - if not m_decl: - return None - # avoid usage of assert and unreferenced local variables - # m_ek, m_atts = m_decl - # assert m_ek == EK.SENSOR - _, m_atts = m_decl - sensor = data.Global( - m_name=m_atts['path'].split('::')[-1], - path=m_atts['path'], - c_name=c_atts['name'], - ) - _build_typed(model, sensor, c_atts['type']) - - model.add_sensor(sensor) - model.map_item(c_atts['id'], sensor) - return sensor - - -def _build_function(model: data.Model, file, atts): - for role in 'CycleMethod', 'ResetMethod', 'InitMethod': - op = _get_model(model, atts['id'], role) - if op: - break - else: - # not a root operator or unexpected role - return - assert isinstance(op, data.Operator) # nosec B101 # addresses linter - - function = data.Function(c_name=atts['name']) - # link the function to the operator - if role == 'CycleMethod': - op.set_cycle(function) - # get the c_name from the cycle function to ensure uniqueness - op.c_name = function.c_name - # opportunity to set this property - op.header = file['interface_file'] - elif role == 'ResetMethod': - op.set_reset(function) - else: - # assert role == 'InitMethod' - op.set_init(function) - - for parameter in atts.get('parameters', []): - typed = model.get_mapped_entity(parameter['id']) - if not typed: - # might be a context: retrieve it from the type's id - # * verify it is the context of the operator - # * create a context instance - if _get_model(model, parameter['type'], 'ContextType') == op: - if not op.context: - typed = data.Context() - op.set_context(typed) - model.map_item(parameter['id'], typed) - else: - typed = op.context - if not typed: - print('%s/%s: parameter not found' % (op.path, parameter['name'])) - else: - # typed must be either an IO or a context - assert isinstance(typed, data.IO) or isinstance(typed, data.Context) # nosec B101 # addresses linter - typed.c_name = parameter['name'] - typed.pointer = parameter['pointer'] - if not typed.type: - _build_typed(model, typed, parameter['type']) - function.add_parameter(typed) - - type_id = atts.get('return_type') - if type_id: - # must be a single (scalar) output - # and function must be the cycle function - io = op.ios[-1] - # assert not io.input - io.return_ = True - _build_typed(model, io, type_id) - # assert function == op.cycle - function.link_return(io) - - if role == 'CycleMethod' and op.context: - # bind the context to optional ios - ios = {_.m_name: _ for _ in op.ios} - assert isinstance(op.context.type, data.Structure) # nosec B101 # addresses linter - for field in op.context.type.fields: - io = ios.get(field.m_name) - if io: - op.context.add_io(io) - io.sizes = field.sizes - io.type = field.type - io.c_name = field.c_name - - -def _build_code(model: data.Model, j): - # read the declarations from the code part of the mapping - for file in j: - c = file.get('implementation_file') - if c: - swan_files.append(c) - if c == 'swan_elaboration.c': - model.elaboration = 'swan_elaboration' - - h = file.get('interface_file') - if h: - swan_files.append(h) - - for cls, atts in file.get('declarations', []): - try: - ek = EK(cls) - except ValueError: - continue - if ek == EK.GLOBAL: - _build_sensor(model, atts) - elif ek == EK.FUNCTION: - _build_function(model, file, atts) diff --git a/src/ansys/scade/python_wrapper/swanpython.py b/src/ansys/scade/python_wrapper/swanpython.py deleted file mode 100644 index f0da60d..0000000 --- a/src/ansys/scade/python_wrapper/swanpython.py +++ /dev/null @@ -1,368 +0,0 @@ -# Copyright (C) 2023 - 2025 ANSYS, Inc. and/or its affiliates. -# SPDX-License-Identifier: MIT -# -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - - -"""Python proxy for Scade One standalone DLL.""" - -import argparse -import json -import os -from os.path import abspath, relpath -from pathlib import Path -import re -from shutil import copy -import string -import subprocess # nosec B404 # used to call Scade One and make command line tools - -from ansys.scade.python_wrapper.rd.c_gen import generate_c -from ansys.scade.python_wrapper.rd.def_gen import generate_def -from ansys.scade.python_wrapper.rd.python_gen import ( - PredefInfo, - generate_python, - predefs_ctypes, - predefs_values, -) -from ansys.scade.python_wrapper.swan_data_parser import parse_from_swan_mapping - - -class SwanPython: - """Implementation of the tool.""" - - # identification - tool = 'Scade One Python Proxy' - version = '1.7.1' - - def __init__( - self, - cmdjson: Path, - name: str, - project: str, - # pep8: bool, - swan_size: str, - swan_false: str, - swan_true: str, - no_cg: bool = False, - all: bool = False, - ): - self.banner = '{0} {1}'.format(self.tool, self.version) - self.cmdjson = cmdjson - if project != '': - self.project = Path(project).absolute() - else: - self.project = None - with self.cmdjson.open() as f: - j = json.load(f) - self.target_dir = self.cmdjson.parent / j.get('target_dir', '.') / 'code' - self.assets = [cmdjson.parent / _ for _ in j.get('files', [])] - self.mf = self.target_dir.parent / 'cg_map.json' - - self.module = name - - self.swan_files = self.target_dir / 'swan_files.txt' - self.swanpython_files = self.target_dir / 'swanpython_files.txt' - self.pep8 = False # pep8 - self.swan_size = swan_size - self.swan_false = swan_false - self.swan_true = swan_true - self.CREATE_NO_WINDOW = 0x08000000 - # generated C files, for makefile - self.sources = [] - self.defs = [] - self.lib_dir = Path(__file__).parent / 'lib' - self.include_dir = Path(__file__).parent / 'include' - self.no_cg = no_cg - self.all = all - - # dictionary of project and dependencies as json trees, indexed by path - # empty when the parameter project is not provided - self.projects = {} - - def main(self): - """Run the tool for the given parameters.""" - print(self.banner) - - # get the list of involved projects - self.load_projects() - - # generate swan code - ok = self.generate_code() - if not ok: - return - - # options - predefs_ctypes['size'] = PredefInfo('ctypes.c_%s' % self.swan_size, '0') - predefs_values['false'] = self.swan_false - predefs_values['true'] = self.swan_true - - # generate wrappers - ok = self.generate_wrappers() - if not ok: - return - - # build - ok = self.build() - if not ok: - return - - def load_projects(self): - """Retrieve all projects with their dependencies.""" - if self.project: - self.load_project(self.project) - - def load_project(self, path: Path): - """Load a project with its dependencies.""" - if path in self.projects: - # dependency already loaded - return - if path.is_file(): - with path.open() as f: - project = json.load(f) - # add the project to the list - self.projects[path] = project - for dependency in project.get('Dependencies', []): - if dependency != '': - # use variable posix syntax $(...) -> ${...} - pattern = r'\$(\()(.+?)(\))' - dependency = re.sub(pattern, r'${\2}', dependency) - # add the built-in variable for libraries - kw = { - 'SCADE_ONE_LIBRARIES_DIR': Path( - os.environ['S_ONE_HOME'], 'Libraries' - ).as_posix() - } - dependency = string.Template(dependency).safe_substitute(os.environ, **kw) - # restore $() for unexpanded variables - pattern = r'\$(\{)(.+?)(\})' - dependency = re.sub(pattern, r'$(\2)', dependency) - new_project = path.parent.joinpath(dependency).resolve() - self.load_project(new_project) - - # ----------------------------------------------------------------------- - # generation - # ----------------------------------------------------------------------- - - def is_obsolete(self) -> bool: - """Return whether the DLL is obsolete with respect to the model.""" - dll = self.target_dir / ('%s.dll' % self.module) - if not dll.exists(): - return True - ns = dll.stat().st_mtime_ns - for path in self.assets: - if not path.exists() or path.stat().st_mtime_ns > ns: - return True - return False - - def generate_code(self) -> bool: - """Run ``swan_cg``.""" - # S_ONE_HOME must exist even if no code is generated - if 'S_ONE_HOME' in os.environ: - if self.no_cg: - return True - if not self.is_obsolete() and not self.all: - return True - cmd = [ - os.path.join(os.environ['S_ONE_HOME'], 'tools', 'swan_cg.exe'), - str(self.cmdjson), - ] - gencode = subprocess.run( # nosec B603 # inputs checked - cmd, - capture_output=True, - text=True, - creationflags=self.CREATE_NO_WINDOW, - ) - if gencode.stdout: - print(gencode.stdout) - if gencode.stderr: - print(gencode.stderr) - return gencode.returncode == 0 - else: - print( - 'Error, set the S_ONE_HOME environment variable to the Scade One installation path' - ) - return False - - def generate_wrappers(self): - """Generate the files.""" - self.target_dir.mkdir(exist_ok=True) - files = [] - - model, swan_files_list = parse_from_swan_mapping(self.mf) - if not model: - # something went wrong, do not continue - return False - - # generate swan_files.txt for files generated by KCG swan - start = abspath(self.swan_files.parent) - with self.swan_files.open('w') as f: - # add files generated by Swan - for file in swan_files_list: - f.write(relpath(abspath(self.target_dir / file), start).replace('\\', '/') + '\n') - - # definition file: can't be generated in the target directory - pathname = self.target_dir / ('%s.def' % self.module) - files.append(pathname) - self.defs.append(pathname.as_posix()) - generate_def(model, pathname, False, self.banner) - - pathname = self.target_dir / ('%s.py' % self.module) - files.append(pathname) - generate_python(model, pathname, cosim=False, pep8=self.pep8, banner=self.banner) - - pathname = self.target_dir / ('%s.c' % self.module) - files.append(pathname) - generate_c(model, pathname, self.banner) - - # copy Makefile - pathname = self.lib_dir / 'Makefile' - copy(pathname, self.target_dir) - files.append(self.target_dir / 'Makefile') - - # generate swan_config.h - pathname = self.target_dir / 'swan_config.h' - files.append(pathname) - self.generate_swan_config(pathname) - - print('generated Python wrapper:') - - start = abspath(self.swanpython_files.parent) - with self.swanpython_files.open('w') as f: - # add files generated by swanpython.py - for file in files: - f.write(relpath(abspath(file), start) + '\n') - print(' {}'.format(file)) - print('') - return True - - def build(self): - """Build the DLL.""" - if 'S_ONE_HOME' in os.environ: - new_env = os.environ.copy() - new_env['PATH'] = ( - os.path.join(new_env['S_ONE_HOME'], 'contrib', 'mingw64', 'bin') - + ';' - + new_env['PATH'] - ) - new_env['INCLUDE'] = r'%S_ONE_HOME%\contrib\mingw64\include' - new_env['LIB'] = r'%S_ONE_HOME%\contrib\mingw64\lib' - cmd = [ - 'mingw32-make.exe', - '-j', - '4', - '-C', - str(self.target_dir), - '-f', - 'Makefile', - 'MODULE={}'.format(self.module), - ] - build = subprocess.run( # nosec B602 # inputs checked - cmd, - capture_output=True, - text=True, - creationflags=self.CREATE_NO_WINDOW, - env=new_env, - shell=True, - ) - if build.returncode == 0: - print(build.stdout) - return True - else: - print(build.stderr) - return False - else: - print( - 'Error, set the S_ONE_HOME environment variable to the Scade One installation path' - ) - return False - - def generate_swan_config(self, swan_config_pathname: Path): - """Generate the configuration file.""" - includes = '' - resources = [] - for path, project in self.projects.items(): - for resource in project.get('Resources', ''): - resource_kind = resource.get('Kind', '') - resource_path = resource['Path'] - if resource_kind == 'ImportedTypes' or resource_kind == 'HeaderFile': - new_resource = path.parent.joinpath(resource_path).resolve() - if new_resource not in resources: - resources.append(new_resource) - for resource in resources: - includes = includes + '\n' + '#include "{}"'.format(str(resource)) - - # create swan_config.h - swan_config_default_file = self.include_dir / 'swan_config_default.h' - with swan_config_default_file.open() as f: - swan_config_default = f.read() - swan_config = swan_config_default.replace( - '#include ', '#include ' + includes - ) - with swan_config_pathname.open(mode='w') as f: - f.write(swan_config) - - -def main(): - """Analyze the command line and call the main function.""" - parser = argparse.ArgumentParser(description=SwanPython.tool) - parser.add_argument('cmdjson', help='swan code gen settings file') - parser.add_argument('-v', '--version', action='store_true', help='display the version') - parser.add_argument( - '-n', '--name', metavar='', help='name of the output python module', required=True - ) - parser.add_argument( - '-p', '--project', metavar='', help='Swan project file (*.sproj)', default='' - ) - parser.add_argument('-a', '--all', action='store_true', help='force rebuild') - # option not completed - # parser.add_argument('-8', '--pep8', action='store_true', help='apply PEP8 naming rules') - parser.add_argument( - '--size', metavar='', help='type of swan_size', default='swan_int32' - ) - parser.add_argument('--false', metavar='', help='value of swan_false', default='0') - parser.add_argument('--true', metavar='', help='value of swan_true', default='1') - # ease debug - parser.add_argument('--no_cg', action='store_true', help='do not run swan_cg') - - options = parser.parse_args() - - cmdjson = Path(options.cmdjson) - if cmdjson.is_file(): - cls = SwanPython( - cmdjson, - options.name, - options.project, - # options.pep8, - options.size, - options.false, - options.true, - options.no_cg, - options.all, - ) - if options.version: - print('tool version %s %s' % (cls.tool, cls.version)) - - cls.main() - else: - print("Error, {} file doesn't exist".format(str(cmdjson))) - - -if __name__ == '__main__': - main() diff --git a/tests/Types/SOne/Model/Model.sproj b/tests/Types/SOne/Model/Model.sproj deleted file mode 100644 index 6c66d71..0000000 --- a/tests/Types/SOne/Model/Model.sproj +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Version": "1.0", - "Name": "Model", - "Dependencies": [], - "Resources": [] -} \ No newline at end of file diff --git a/tests/Types/SOne/Model/Model.sproj.editor b/tests/Types/SOne/Model/Model.sproj.editor deleted file mode 100644 index 8ae0dad..0000000 --- a/tests/Types/SOne/Model/Model.sproj.editor +++ /dev/null @@ -1,5 +0,0 @@ -{ - "JobsOrder": [ - "jobs\\codegen_8ad36ba\\.sjob" - ] -} \ No newline at end of file diff --git a/tests/Types/SOne/Model/assets/P.swan b/tests/Types/SOne/Model/assets/P.swan deleted file mode 100644 index f0920c2..0000000 --- a/tests/Types/SOne/Model/assets/P.swan +++ /dev/null @@ -1,2151 +0,0 @@ --- version: 2024.0 -function Function (inBits: Bits; - inBool: bool; - inInt: int32; - inReal: float64; - inChar: char; - inByte: Byte; - inEnum: Enum; - inLine: Line; - inPoint: Point; - inSpeed: Speed; - inSpeeds: Speeds; - inArrays: Arrays;) - returns (outBits: Bits; - outBool: bool; - outInt: int32; - outReal: float64; - outChar: char; - outByte: Byte; - outEnum: Enum; - outLine: Line; - outPoint: Point; - outSpeed: Speed; - outSpeeds: Speeds; - outSensor0: bool; - outArrays: Arrays; - outArraysConst: Arrays;) -{ - diagram - (#1 expr inChar) - (#2 expr inReal) - (#3 expr inInt) - (#4 def outChar) - (#5 def outReal) - (#6 def outInt) - (#7 expr inBool) - (#8 def outBool) - (#9 def outArraysConst) - (#10 expr A) - (#11 def outArrays) - (#12 expr inArrays) - (#14 expr #13[0] - where - (#13 group)) - (#15 def outSensor0) - (#16 expr faults) - (#17 expr inSpeeds) - (#18 expr inSpeed) - (#19 expr inPoint) - (#20 expr inLine) - (#21 expr inEnum) - (#22 expr inByte) - (#23 expr inBits) - (#24 def outSpeeds) - (#25 def outSpeed) - (#26 def outPoint) - (#27 def outLine) - (#28 def outEnum) - (#29 def outByte) - (#30 def outBits) - - (#31 wire #21 => #28) - (#32 wire #22 => #29) - (#33 wire #23 => #30) - (#34 wire #10 => #9) - (#35 wire #7 => #8) - (#36 wire #3 => #6) - (#37 wire #17 => #24) - (#38 wire #19 => #26) - (#39 wire #12 => #11) - (#40 wire #18 => #25) - (#41 wire #20 => #27) - (#42 wire #16 => #13) - (#43 wire #1 => #4) - (#44 wire #2 => #5) - (#45 wire #14 => #15) -} - -node Node (inBits: Bits; - inBool: bool; - inInt: int32; - inReal: float64; - inChar: char; - inByte: Byte; - inEnum: Enum; - inLine: Line; - inPoint: Point; - inSpeed: Speed; - inSpeeds: Speeds; - inArrays: Arrays;) - returns (outBits: Bits; - outBool: bool; - outInt: int32; - outReal: float64; - outChar: char; - outByte: Byte; - outEnum: Enum; - outLine: Line; - outPoint: Point; - outSpeed: Speed; - outSpeeds: Speeds; - outSensor0: bool; - outArrays: Arrays; - outArraysConst: Arrays;) -{ - diagram - (#1 expr inChar) - (#2 expr inReal) - (#3 expr inInt) - (#4 def outChar) - (#5 def outReal) - (#6 def outInt) - (#7 def outBool) - (#8 expr inBool) - (#9 expr A) - (#10 def outArraysConst) - (#11 expr inArrays) - (#12 def outArrays) - (#14 expr #13[0] - where - (#13 group)) - (#15 def outSensor0) - (#16 expr faults) - (#19 expr #18 pre #17 - where - (#18 group) - (#17 group)) - (#20 expr inSpeeds) - (#21 expr inSpeed) - (#22 expr inPoint) - (#23 expr inLine) - (#24 expr inEnum) - (#25 expr inByte) - (#26 expr inBits) - (#27 def outSpeeds) - (#28 def outSpeed) - (#29 def outPoint) - (#30 def outLine) - (#31 def outEnum) - (#32 def outByte) - (#33 def outBits) - - (#34 wire #2 => #5) - (#35 wire #11 => #12) - (#36 wire #9 => #10) - (#37 wire #8 => #7) - (#38 wire #21 => #28) - (#39 wire #20 => #27) - (#40 wire #24 => #17, #18) - (#41 wire #26 => #33) - (#42 wire #25 => #32) - (#43 wire #1 => #4) - (#44 wire #3 => #6) - (#45 wire #16 => #13) - (#46 wire #14 => #15) - (#47 wire #19 => #31) - (#48 wire #22 => #29) - (#49 wire #23 => #30) -} - -__END__ -{ - "ModelTree": { - "Children": { - "body[0]": { - "Children": { - "operator[0]": { - "Children": { - "input[0]": {}, - "input[1]": {}, - "input[10]": {}, - "input[11]": {}, - "input[2]": {}, - "input[3]": {}, - "input[4]": {}, - "input[5]": {}, - "input[6]": {}, - "input[7]": {}, - "input[8]": {}, - "input[9]": {}, - "output[0]": {}, - "output[1]": {}, - "output[10]": {}, - "output[11]": {}, - "output[12]": {}, - "output[13]": {}, - "output[2]": {}, - "output[3]": {}, - "output[4]": {}, - "output[5]": {}, - "output[6]": {}, - "output[7]": {}, - "output[8]": {}, - "output[9]": {}, - "scope[0]": { - "Children": { - "diagram[0]": { - "Children": { - "block_def[10]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1133.1, - "Y": 1234.1999999999998 - }, - "Size": { - "Width": 140.0, - "Height": 32.0 - } - } - } - }, - "block_def[13]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1138.6, - "Y": 1337.4499999999998 - }, - "Size": { - "Width": 140.0, - "Height": 32.0 - } - } - } - }, - "block_def[22]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1133.1, - "Y": 1131.15 - }, - "Size": { - "Width": 140.0, - "Height": 32.0 - } - } - } - }, - "block_def[23]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1127.6, - "Y": 1027.9499999999998 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[24]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1127.6, - "Y": 924.7 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[25]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 821.5 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[26]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 718.35 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[27]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 615.15 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[28]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 99.25 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[3]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 408.75 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[4]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 305.65 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[5]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1116.6, - "Y": 202.45000000000002 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_def[7]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 511.95000000000005 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[8]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1160.6, - "Y": 1440.6 - }, - "Size": { - "Width": 180.0, - "Height": 32.0 - } - } - } - }, - "block_expr[0]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 408.75 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[1]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 305.6 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[11]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 163.6, - "Y": 1234.25 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[12]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 647.8, - "Y": 1338.85 - }, - "Size": { - "Width": 120.0, - "Height": 70.0 - } - } - } - }, - "block_expr[14]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 1337.4499999999998 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[15]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 163.5, - "Y": 1131.1 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[16]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 169.0, - "Y": 1027.9499999999998 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[17]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 169.0, - "Y": 924.75 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[18]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 821.55 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[19]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 718.35 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[2]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 180.1, - "Y": 202.4 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[20]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 615.15 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[21]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 99.25 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[6]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 511.95000000000005 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[9]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 190.1, - "Y": 1441.9499999999998 - }, - "Size": { - "Width": 80.0, - "Height": 32.0 - } - } - } - }, - "wire[29]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 718.35 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 718.35 - } - } - } - } - } - }, - "wire[30]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 615.15 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 615.15 - } - } - } - } - } - }, - "wire[31]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 99.25 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 99.25 - } - } - } - } - } - }, - "wire[32]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 215.1, - "Y": 1441.9499999999998 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 889.1999999999999, - "Y": 1441.9499999999998 - }, - { - "X": 889.1999999999999, - "Y": 1440.6 - } - ], - "Coordinates": { - "X": 1085.6, - "Y": 1440.6 - } - } - } - } - } - }, - "wire[33]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 511.95000000000005 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 511.95000000000005 - } - } - } - } - } - }, - "wire[34]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 215.1, - "Y": 202.4 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 1044.35, - "Y": 202.4 - }, - { - "X": 1044.35, - "Y": 202.45000000000002 - } - ], - "Coordinates": { - "X": 1081.6, - "Y": 202.45000000000002 - } - } - } - } - } - }, - "wire[35]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 208.5, - "Y": 1131.1 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 885.4499999999999, - "Y": 1131.1 - }, - { - "X": 885.4499999999999, - "Y": 1131.15 - } - ], - "Coordinates": { - "X": 1078.1, - "Y": 1131.15 - } - } - } - } - } - }, - "wire[36]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 214.0, - "Y": 924.75 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 887.6999999999999, - "Y": 924.75 - }, - { - "X": 887.6999999999999, - "Y": 924.7 - } - ], - "Coordinates": { - "X": 1082.6, - "Y": 924.7 - } - } - } - } - } - }, - "wire[37]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 208.6, - "Y": 1234.25 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 885.4499999999999, - "Y": 1234.25 - }, - { - "X": 885.4499999999999, - "Y": 1234.1999999999998 - } - ], - "Coordinates": { - "X": 1078.1, - "Y": 1234.1999999999998 - } - } - } - } - } - }, - "wire[38]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 214.0, - "Y": 1027.9499999999998 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1082.6, - "Y": 1027.9499999999998 - } - } - } - } - } - }, - "wire[39]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 821.55 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 884.9499999999999, - "Y": 821.55 - }, - { - "X": 884.9499999999999, - "Y": 821.5 - } - ], - "Coordinates": { - "X": 1077.1, - "Y": 821.5 - } - } - } - } - } - }, - "wire[40]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 1337.4499999999998 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 408.94999999999993, - "Y": 1337.4499999999998 - }, - { - "X": 408.94999999999993, - "Y": 1338.85 - } - ], - "Coordinates": { - "X": 602.8, - "Y": 1338.85 - } - } - } - } - } - }, - "wire[41]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 408.75 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 408.75 - } - } - } - } - } - }, - "wire[42]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 305.6 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 643.3499999999999, - "Y": 305.6 - }, - { - "X": 643.3499999999999, - "Y": 305.65 - } - ], - "Coordinates": { - "X": 1077.1, - "Y": 305.65 - } - } - } - } - } - }, - "wire[43]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 692.8, - "Y": 1338.85 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 888.1999999999999, - "Y": 1338.85 - }, - { - "X": 888.1999999999999, - "Y": 1337.4499999999998 - } - ], - "Coordinates": { - "X": 1083.6, - "Y": 1337.4499999999998 - } - } - } - } - } - } - } - } - } - } - } - }, - "operator[1]": { - "Children": { - "input[0]": {}, - "input[1]": {}, - "input[10]": {}, - "input[11]": {}, - "input[2]": {}, - "input[3]": {}, - "input[4]": {}, - "input[5]": {}, - "input[6]": {}, - "input[7]": {}, - "input[8]": {}, - "input[9]": {}, - "output[0]": {}, - "output[1]": {}, - "output[10]": {}, - "output[11]": {}, - "output[12]": {}, - "output[13]": {}, - "output[2]": {}, - "output[3]": {}, - "output[4]": {}, - "output[5]": {}, - "output[6]": {}, - "output[7]": {}, - "output[8]": {}, - "output[9]": {}, - "scope[0]": { - "Children": { - "diagram[0]": { - "Children": { - "block_def[11]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1133.1, - "Y": 1234.25 - }, - "Size": { - "Width": 140.0, - "Height": 32.0 - } - } - } - }, - "block_def[13]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1138.6, - "Y": 1337.4499999999998 - }, - "Size": { - "Width": 140.0, - "Height": 32.0 - } - } - } - }, - "block_def[23]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1133.1, - "Y": 1131.15 - }, - "Size": { - "Width": 140.0, - "Height": 32.0 - } - } - } - }, - "block_def[24]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1127.6, - "Y": 1027.9499999999998 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[25]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1127.6, - "Y": 924.7 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[26]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 821.5 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[27]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 718.35 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[28]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 615.15 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[29]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 99.25 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[3]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 511.95000000000005 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[4]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 408.75 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[5]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1116.6, - "Y": 305.65 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_def[6]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1122.1, - "Y": 202.45000000000002 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_def[9]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 1160.6, - "Y": 1440.65 - }, - "Size": { - "Width": 180.0, - "Height": 32.0 - } - } - } - }, - "block_expr[0]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 511.95000000000005 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[1]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 408.75 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[10]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 163.6, - "Y": 1234.25 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[12]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 647.8, - "Y": 1338.8000000000002 - }, - "Size": { - "Width": 120.0, - "Height": 70.0 - } - } - } - }, - "block_expr[14]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 1337.4499999999998 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[15]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 640.4, - "Y": 719.7 - }, - "Size": { - "Width": 120.0, - "Height": 70.0 - } - } - } - }, - "block_expr[16]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 163.5, - "Y": 1131.1 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[17]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 169.0, - "Y": 1027.9499999999998 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[18]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 169.0, - "Y": 924.75 - }, - "Size": { - "Width": 120.0, - "Height": 32.0 - } - } - } - }, - "block_expr[19]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 821.55 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[2]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 180.1, - "Y": 305.6 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[20]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 718.35 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[21]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 615.15 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[22]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.5, - "Y": 99.25 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[7]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 174.6, - "Y": 202.45000000000002 - }, - "Size": { - "Width": 100.0, - "Height": 32.0 - } - } - } - }, - "block_expr[8]": { - "Properties": { - "Graph": { - "DisplayedDirection": "NorthEast", - "ContentOrientation": "None", - "Coordinates": { - "X": 190.1, - "Y": 1442.0 - }, - "Size": { - "Width": 80.0, - "Height": 32.0 - } - } - } - }, - "wire[30]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 408.75 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 408.75 - } - } - } - } - } - }, - "wire[31]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 208.6, - "Y": 1234.25 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1078.1, - "Y": 1234.25 - } - } - } - } - } - }, - "wire[32]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 215.1, - "Y": 1442.0 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 889.1999999999999, - "Y": 1442.0 - }, - { - "X": 889.1999999999999, - "Y": 1440.65 - } - ], - "Coordinates": { - "X": 1085.6, - "Y": 1440.65 - } - } - } - } - } - }, - "wire[33]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 202.45000000000002 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 202.45000000000002 - } - } - } - } - } - }, - "wire[34]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 214.0, - "Y": 1027.9499999999998 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1082.6, - "Y": 1027.9499999999998 - } - } - } - } - } - }, - "wire[35]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 208.5, - "Y": 1131.1 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 885.4499999999999, - "Y": 1131.1 - }, - { - "X": 885.4499999999999, - "Y": 1131.15 - } - ], - "Coordinates": { - "X": 1078.1, - "Y": 1131.15 - } - } - } - } - } - }, - "wire[36]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 718.35 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 329.0, - "Y": 718.35 - }, - { - "X": 329.0, - "Y": 738.7 - } - ], - "Coordinates": { - "X": 595.4, - "Y": 738.7 - } - } - } - }, - "target[1]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 329.0, - "Y": 718.35 - }, - { - "X": 329.0, - "Y": 728.35 - }, - { - "X": 483.26666666666665, - "Y": 728.35 - }, - { - "X": 483.26666666666665, - "Y": 700.7 - } - ], - "Coordinates": { - "X": 595.4, - "Y": 700.7 - } - } - } - } - } - }, - "wire[37]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 99.25 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 99.25 - } - } - } - } - } - }, - "wire[38]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 615.15 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 615.15 - } - } - } - } - } - }, - "wire[39]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.6, - "Y": 511.95000000000005 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 1077.1, - "Y": 511.95000000000005 - } - } - } - } - } - }, - "wire[40]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 215.1, - "Y": 305.6 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 803.5, - "Y": 305.6 - }, - { - "X": 803.5, - "Y": 305.65 - } - ], - "Coordinates": { - "X": 1081.6, - "Y": 305.65 - } - } - } - } - } - }, - "wire[41]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 1337.4499999999998 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 408.94999999999993, - "Y": 1337.4499999999998 - }, - { - "X": 408.94999999999993, - "Y": 1338.8000000000002 - } - ], - "Coordinates": { - "X": 602.8, - "Y": 1338.8000000000002 - } - } - } - } - } - }, - "wire[42]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 692.8, - "Y": 1338.8000000000002 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 888.1999999999999, - "Y": 1338.8000000000002 - }, - { - "X": 888.1999999999999, - "Y": 1337.4499999999998 - } - ], - "Coordinates": { - "X": 1083.6, - "Y": 1337.4499999999998 - } - } - } - } - } - }, - "wire[43]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 685.4, - "Y": 719.7 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 881.25, - "Y": 719.7 - }, - { - "X": 881.25, - "Y": 718.35 - } - ], - "Coordinates": { - "X": 1077.1, - "Y": 718.35 - } - } - } - } - } - }, - "wire[44]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 214.0, - "Y": 924.75 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 887.6999999999999, - "Y": 924.75 - }, - { - "X": 887.6999999999999, - "Y": 924.7 - } - ], - "Coordinates": { - "X": 1082.6, - "Y": 924.7 - } - } - } - } - } - }, - "wire[45]": { - "Children": { - "source[0]": { - "Properties": { - "Graph": { - "Coordinates": { - "X": 209.5, - "Y": 821.55 - } - } - } - }, - "target[0]": { - "Properties": { - "Graph": { - "Points": [ - { - "X": 884.9499999999999, - "Y": 821.55 - }, - { - "X": 884.9499999999999, - "Y": 821.5 - } - ], - "Coordinates": { - "X": 1077.1, - "Y": 821.5 - } - } - } - } - } - } - } - } - } - } - } - } - }, - "Properties": { - "Graph": { - "Order": 0 - } - } - } - }, - "Properties": { - "version": "1.0" - } - } -} \ No newline at end of file diff --git a/tests/Types/SOne/Model/assets/P.swani b/tests/Types/SOne/Model/assets/P.swani deleted file mode 100644 index 5f0b2c5..0000000 --- a/tests/Types/SOne/Model/assets/P.swani +++ /dev/null @@ -1,121 +0,0 @@ --- version: 2024.0 -function Function( - inBits: Bits; - inBool: bool; - inInt: int32; - inReal: float64; - inChar: char; - inByte: Byte; - inEnum: Enum; - inLine: Line; - inPoint: Point; - inSpeed: Speed; - inSpeeds: Speeds; - inArrays: Arrays) - returns ( - outBits: Bits; - outBool: bool; - outInt: int32; - outReal: float64; - outChar: char; - outByte: Byte; - outEnum: Enum; - outLine: Line; - outPoint: Point; - outSpeed: Speed; - outSpeeds: Speeds; - outSensor0: bool; - outArrays: Arrays; - outArraysConst: Arrays); - -node Node( - inBits: Bits; - inBool: bool; - inInt: int32; - inReal: float64; - inChar: char; - inByte: Byte; - inEnum: Enum; - inLine: Line; - inPoint: Point; - inSpeed: Speed; - inSpeeds: Speeds; - inArrays: Arrays) - returns ( - outBits: Bits; - outBool: bool; - outInt: int32; - outReal: float64; - outChar: char; - outByte: Byte; - outEnum: Enum; - outLine: Line; - outPoint: Point; - outSpeed: Speed; - outSpeeds: Speeds; - outSensor0: bool; - outArrays: Arrays; - outArraysConst: Arrays); - -type Array = float32^4; - -type Arrays = Array^3; - -type Bits = bool^8; - -type Byte = unsigned<<8>>; - -type Enum = enum { - V1, - V2, - V3 - }; - -type Line = Point^2; - -type Point = { x : float32, y : float32 }; - -type Speed = float64; - -type Speeds = Speed^N; - -const A : float32^4^3 = - [[0.0, 0.0, 0.0, 0.0], [1.0, 2.0, 3.0, 4.0], [2.0, 4.0, 8.0, 16.0]]; - -const N : int16 = 2; - -sensor faults : bool^4; - -__END__ -{ - "ModelTree": { - "Children": { - "interface[0]": { - "Children": { - "constant[11]": {}, - "constant[12]": {}, - "operator[0]": {}, - "operator[1]": {}, - "sensor[13]": {}, - "type[10]": {}, - "type[2]": {}, - "type[3]": {}, - "type[4]": {}, - "type[5]": {}, - "type[6]": {}, - "type[7]": {}, - "type[8]": {}, - "type[9]": {} - }, - "Properties": { - "Graph": { - "Order": 1 - } - } - } - }, - "Properties": { - "version": "1.0" - } - } -} \ No newline at end of file diff --git a/tests/Types/SOne/Model/jobs/codegen_8ad36ba/.sjob b/tests/Types/SOne/Model/jobs/codegen_8ad36ba/.sjob deleted file mode 100644 index 789bc9e..0000000 --- a/tests/Types/SOne/Model/jobs/codegen_8ad36ba/.sjob +++ /dev/null @@ -1,22 +0,0 @@ -{ - "Version": "1.0", - "Kind": "CodeGeneration", - "Properties": { - "RootOperator": "P::Node", - "Name": "CG", - "CustomArguments": "", - "Expansion": "None", - "ExpansionExp": "", - "ExpansionNoExp": "", - "ShortCircuitOperators": "False", - "NameLength": "200", - "SignificanceLength": "31", - "KeepAssume": "False", - "GlobalsPrefix": "", - "UseMacros": "False", - "StaticLocals": "False" - }, - "InputPaths": [ - "assets/P.swan" - ] -} \ No newline at end of file diff --git a/tests/Types/SOne/Model/jobs/codegen_8ad36ba/config.json b/tests/Types/SOne/Model/jobs/codegen_8ad36ba/config.json deleted file mode 100644 index 1656b25..0000000 --- a/tests/Types/SOne/Model/jobs/codegen_8ad36ba/config.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "files": [ - "D:\\AnsysDev\\Nobackup\\PyAnsys\\python-wrapper\\tests\\Types\\SOne\\Model\\assets\\P.swan", - "D:\\AnsysDev\\Nobackup\\PyAnsys\\python-wrapper\\tests\\Types\\SOne\\Model\\assets\\P.swani" - ], - "roots": [ - "P::Node" - ], - "target_dir": "D:\\AnsysDev\\Nobackup\\PyAnsys\\python-wrapper\\tests\\Types\\SOne\\Model\\jobs\\codegen_8ad36ba\\out", - "target": "C", - "keep_asserts": false, - "short_circuit": false, - "wrap_c_ops": false, - "name_length": 200, - "significance_length": 31, - "static_locals": false, - "globals_prefix": "", - "metadata": { - "date": "2024-10-05T12:20:06.1312627Z" - } -} \ No newline at end of file diff --git a/tests/Types/SOne/Proxy/types_.json b/tests/Types/SOne/Proxy/types_.json deleted file mode 100644 index 539a14d..0000000 --- a/tests/Types/SOne/Proxy/types_.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "files": [ - "..\\Model\\assets\\P.swan", - "..\\Model\\assets\\P.swani" - ], - "roots": [ - "P::Node", - "P::Function" - ], - "target_dir": ".", - "target": "C" -} diff --git a/tests/conftest.py b/tests/conftest.py index 0803fbc..621edaf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,12 +22,8 @@ """Unit tests utils.""" -import os from pathlib import Path -import platform from subprocess import run -import sys -import winreg as reg # note: importing apitools modifies sys.path to access SCADE APIs from ansys.scade.apitools.info import get_scade_home @@ -40,34 +36,11 @@ import scade.model.suite.displaycoupling as dc from ansys.scade.python_wrapper.kcgpython import get_module_name -from ansys.scade.python_wrapper.swanpython import SwanPython # stub the proxy's entries import ansys.scade.wux.test.sctoc_stub # noqa: F401 -def _get_scade_one_homes(min='v241', max='v999'): - """Get the list of Scade One installation directories.""" - if platform.system() != 'Windows': - return [] - names = [] - try: - hklm = reg.OpenKey(reg.HKEY_LOCAL_MACHINE, r'SOFTWARE\Ansys Inc') - except OSError: - return [] - for i in range(reg.QueryInfoKey(hklm)[0]): - name = reg.EnumKey(hklm, i) - if name < min or name >= max: - continue - try: - dir, _ = reg.QueryValueEx(reg.OpenKey(hklm, r'%s\Ansys Scade One' % name), 'Path') - names.append((name, dir)) - except FileNotFoundError: - pass - dirs = [dir for _, dir in sorted(names, key=lambda x: x[0])] - return dirs - - def load_session(*paths: Path) -> suite.Session: """ Create an instance of Session instance and load the requested models. @@ -150,45 +123,3 @@ def build_kcg_proxy(path: Path, configuration: str) -> Path | None: if cp.stderr: print(cp.stderr) return dll if dll.exists() else None - - -def build_swancg_proxy(project_dir: Path, configuration: Path) -> Path | None: - """Build the Python proxy if obsolete or not present.""" - s_one_home = 'S_ONE_HOME' - home = None - if not os.environ.get(s_one_home): - homes = _get_scade_one_homes() - home = homes[-1] if homes else None - if home: - os.environ[s_one_home] = home - print('set S_ONE_HOME to', os.environ.get(s_one_home)) - else: - print('using S_ONE_HOME =', os.environ.get(s_one_home)) - # the name of the module is the basename of the configuration file - module = configuration.stem - # target directory: expected to be the the configuration file's directory - target_dir = configuration.parent / 'code' - # the name of the project must be the name of its directory - project = project_dir / (project_dir.stem + '.sproj') - cls = SwanPython( - configuration, - configuration.stem, - str(project), - # options.pep8, - swan_size='swan_int32', - swan_false='0', - swan_true='1', - # code generation required - no_cg=False, - # generate only if the dll is obsolete with respect to the Scade One model files - all=False, - ) - cls.main() - # add the target directory to sys.path - if str(target_dir) not in sys.path: - sys.path.append(str(target_dir)) - dll = target_dir / ('%s.dll' % module) - if home: - # remove the added variable - os.environ.pop(s_one_home) - return dll if dll.exists() else None diff --git a/tests/test_int_types.py b/tests/test_int_types.py index cbec711..5845dd5 100644 --- a/tests/test_int_types.py +++ b/tests/test_int_types.py @@ -37,7 +37,7 @@ import pytest -from conftest import build_kcg_proxy, build_swancg_proxy +from conftest import build_kcg_proxy # fixtures test_dir = Path(__file__).parent @@ -57,14 +57,6 @@ def proxy_kcg_types_io() -> Path | None: return build_kcg_proxy(path, 'Python IO') -@pytest.fixture(scope='session') -def proxy_swancg_types() -> Path | None: - """Ensure the proxy is built and up-to-date.""" - path = test_dir / 'Types' / 'SOne' / 'Model' - configuration = test_dir / 'Types' / 'SOne' / 'Proxy' / 'types_.json' - return build_swancg_proxy(path, configuration) - - def set_inputs(root, t): for i in range(4): t.sensors.faults[i] = i % 2 @@ -172,27 +164,3 @@ def test_int_kcg_types_io(proxy_kcg_types_io): set_inputs(root, t) root.call_cycle() check_outputs(root, t) - - -def test_int_swancg_types(proxy_swancg_types): - assert proxy_swancg_types - - # update sys.path to access the generated files - old_path = sys.path.copy() - sys.path.append(str(proxy_swancg_types.parent)) - try: - # types_ has been produced by proxy_swancg_types - import types_ as t # type: ignore - - import_error = '' - except BaseException as e: - import_error = str(e) - # restore the path - sys.path = old_path - assert import_error == '' - - for root in t.Function(cosim=False), t.Node(cosim=False): - root.call_reset() - set_inputs(root, t) - root.call_cycle() - check_outputs(root, t) From f55a8f81cf21b7e3e8aa45480abe480ad88a6628 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Tue, 2 Sep 2025 14:20:42 +0000 Subject: [PATCH 2/3] chore: adding changelog file 44.documentation.md [dependabot-skip] --- doc/changelog.d/44.documentation.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/44.documentation.md diff --git a/doc/changelog.d/44.documentation.md b/doc/changelog.d/44.documentation.md new file mode 100644 index 0000000..c95365b --- /dev/null +++ b/doc/changelog.d/44.documentation.md @@ -0,0 +1 @@ +Fix: Remove Scade One integration as it is now part of the product. From 116e312c239ed5ad91f5ac482a3067fbd15dc6ce Mon Sep 17 00:00:00 2001 From: Jean Henry Date: Tue, 2 Sep 2025 17:17:26 +0200 Subject: [PATCH 3/3] fix: remove obsolete header file --- .../include/swan_config_default.h | 430 ------------------ 1 file changed, 430 deletions(-) delete mode 100644 src/ansys/scade/python_wrapper/include/swan_config_default.h diff --git a/src/ansys/scade/python_wrapper/include/swan_config_default.h b/src/ansys/scade/python_wrapper/include/swan_config_default.h deleted file mode 100644 index 8f3fa15..0000000 --- a/src/ansys/scade/python_wrapper/include/swan_config_default.h +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright(C) 2020 - 2024 ANSYS, Inc. and /or its affiliates. - * SPDX - License - Identifier: MIT - * - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files(the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and /or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions : - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef SWAN_CONFIG_H_ -#define SWAN_CONFIG_H_ - -#include -#include - -#define swan_assign(swan_D, swan_S, swan_sz) (memcpy((swan_D), (swan_S), (swan_sz))) -#define swan_assign_struct swan_assign -#define swan_assign_array swan_assign -#define swan_assign_union swan_assign - -#define swan_assume(A) (A) -#define swan_guarantee(A) (A) - -#if defined(__STDC_VERSION__) && __STDC_VERSION >= 199901L -# define HAVE_STDINT_H -#elif defined(__GNUC__) -# define HAVE_STDINT_H -#endif - -#ifdef HAVE_STDINT_H -# include - -typedef uint_least8_t swan_uint8; -typedef int_least8_t swan_int8; -typedef uint_least16_t swan_uint16; -typedef int_least16_t swan_int16; -typedef uint_least32_t swan_uint32; -typedef int_least32_t swan_int32; -typedef uint_least64_t swan_uint64; -typedef int_least64_t swan_int64; - -# define swan_lit_int64 INT64_C -# define swan_lit_uint64 UINT64_C - -#elif defined(_MSC_VER) - -typedef unsigned __int8 swan_uint8; -typedef __int8 swan_int8; -typedef unsigned __int16 swan_uint16; -typedef __int16 swan_int16; -typedef unsigned __int32 swan_uint32; -typedef __int32 swan_int32; -typedef unsigned __int64 swan_uint64; -typedef __int64 swan_int64; - -# define swan_lit_int64(v) (v ## i64) -# define swan_lit_uint64(v) (v ## ui64) - -#else -# error unsupported compiler, edit swan_config.h -#endif -#undef HAVE_STDINT_H - - -typedef unsigned char swan_bool; - -typedef float swan_float32; -typedef double swan_float64; - -typedef ptrdiff_t swan_size; - -typedef char swan_char; -typedef swan_uint32 swan_char32; -typedef swan_uint16 swan_char16; - -#define swan_false ((swan_bool) 0) -#define swan_true ((swan_bool) 1) - -#define swan_lit_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_lit_float64(swan_C1) ((swan_float64) (swan_C1)) - -#define swan_lit_size(swan_C1) ((swan_size) (swan_C1)) - -#define swan_lit_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_lit_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_lit_uint8(swan_C1) ((swan_uint8) (swan_C1)) - -#define swan_lit_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_lit_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_lit_int8(swan_C1) ((swan_int8) (swan_C1)) - -#define swan_lit_char(swan_C1) ((swan_char) (swan_C1)) -#define swan_lit_char16(swan_C1) ((swan_char16) (swan_C1)) -#define swan_lit_char32(swan_C1) ((swan_char32) (swan_C1)) - - - -#define swan_lsl_uint64(swan_C1, swan_C2) \ - ((swan_uint64) ((swan_C1) << (swan_C2)) & 0xffffffffffffffffU) -#define swan_lsl_uint32(swan_C1, swan_C2) \ - ((swan_uint32) ((swan_C1) << (swan_C2)) & 0xffffffffU) -#define swan_lsl_uint16(swan_C1, swan_C2) \ - ((swan_uint16) ((swan_C1) << (swan_C2)) & 0xffffU) -#define swan_lsl_uint8(swan_C1, swan_C2) \ - ((swan_uint8) ((swan_C1) << (swan_C2)) & 0xffU) - -#define swan_lnot_uint64(swan_C1) ((swan_C1) ^ 0xffffffffffffffffU) -#define swan_lnot_uint32(swan_C1) ((swan_C1) ^ 0xffffffffU) -#define swan_lnot_uint16(swan_C1) ((swan_C1) ^ 0xffffU) -#define swan_lnot_uint8(swan_C1) ((swan_C1) ^ 0xffU) - - - - -#ifdef SWAN_WRAP_C_OPS - -#define swan_float64_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_size_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_uint64_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_uint32_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_uint16_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_uint8_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_int64_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_int32_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_int16_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_int8_to_float32(swan_C1) ((swan_float32) (swan_C1)) -#define swan_float32_to_float64(swan_C1) ((swan_float64) (swan_C1)) - -#define swan_size_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_uint64_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_uint32_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_uint16_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_uint8_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_int64_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_int32_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_int16_to_float64(swan_C1) ((swan_float64) (swan_C1)) -#define swan_int8_to_float64(swan_C1) ((swan_float64) (swan_C1)) - -#define swan_float32_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_float64_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_uint64_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_uint32_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_uint16_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_uint8_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_int64_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_int32_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_int16_to_size(swan_C1) ((swan_size) (swan_C1)) -#define swan_int8_to_size(swan_C1) ((swan_size) (swan_C1)) - -#define swan_float32_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_float64_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_size_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_uint32_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_uint16_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_uint8_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_int64_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_int32_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_int16_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) -#define swan_int8_to_uint64(swan_C1) ((swan_uint64) (swan_C1)) - -#define swan_float32_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_float64_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_size_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_uint64_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_uint16_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_uint8_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_int64_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_int32_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_int16_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) -#define swan_int8_to_uint32(swan_C1) ((swan_uint32) (swan_C1)) - -#define swan_float32_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_float64_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_size_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_uint64_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_uint32_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_uint8_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_int64_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_int32_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_int16_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) -#define swan_int8_to_uint16(swan_C1) ((swan_uint16) (swan_C1)) - -#define swan_float32_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_float64_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_size_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_uint64_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_uint32_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_uint16_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_int64_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_int32_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_int16_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) -#define swan_int8_to_uint8(swan_C1) ((swan_uint8) (swan_C1)) - -#define swan_float32_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_float64_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_size_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_uint64_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_uint32_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_uint16_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_uint8_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_int32_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_int16_to_int64(swan_C1) ((swan_int64) (swan_C1)) -#define swan_int8_to_int64(swan_C1) ((swan_int64) (swan_C1)) - -#define swan_float32_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_float64_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_size_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_uint64_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_uint32_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_uint16_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_uint8_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_int64_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_int16_to_int32(swan_C1) ((swan_int32) (swan_C1)) -#define swan_int8_to_int32(swan_C1) ((swan_int32) (swan_C1)) - -#define swan_float32_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_float64_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_size_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_uint64_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_uint32_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_uint16_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_uint8_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_int64_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_int32_to_int16(swan_C1) ((swan_int16) (swan_C1)) -#define swan_int8_to_int16(swan_C1) ((swan_int16) (swan_C1)) - -#define swan_float32_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_float64_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_size_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_uint64_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_uint32_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_uint16_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_uint8_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_int64_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_int32_to_int8(swan_C1) ((swan_int8) (swan_C1)) -#define swan_int16_to_int8(swan_C1) ((swan_int8) (swan_C1)) - -#define swan_ge_float32(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_float32(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_float32(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_float32(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_float32(swan_C1) (- (swan_C1)) -#define swan_div_float32(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_float32(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_float32(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_float32(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_float32(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_float32(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_ge_float64(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_float64(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_float64(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_float64(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_float64(swan_C1) (- (swan_C1)) -#define swan_div_float64(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_float64(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_float64(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_float64(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_float64(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_float64(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_size(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_gt_size(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_size(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_size(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_size(swan_C1) (- (swan_C1)) -#define swan_minus_size(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_size(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_eq_size(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_uint64(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_uint64(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_uint64(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_uint64(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_uint64(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_uint64(swan_C1) (- (swan_C1)) -#define swan_lsr_uint64(swan_C1, swan_C2) ((swan_C1) >> (swan_C2)) -#define swan_lxor_uint64(swan_C1, swan_C2) ((swan_C1) ^ (swan_C2)) -#define swan_lor_uint64(swan_C1, swan_C2) ((swan_C1) | (swan_C2)) -#define swan_land_uint64(swan_C1, swan_C2) ((swan_C1) & (swan_C2)) -#define swan_div_uint64(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_uint64(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_uint64(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_uint64(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_uint64(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_uint64(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_uint32(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_uint32(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_uint32(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_uint32(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_uint32(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_uint32(swan_C1) (- (swan_C1)) -#define swan_lsr_uint32(swan_C1, swan_C2) ((swan_C1) >> (swan_C2)) -#define swan_lxor_uint32(swan_C1, swan_C2) ((swan_C1) ^ (swan_C2)) -#define swan_lor_uint32(swan_C1, swan_C2) ((swan_C1) | (swan_C2)) -#define swan_land_uint32(swan_C1, swan_C2) ((swan_C1) & (swan_C2)) -#define swan_div_uint32(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_uint32(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_uint32(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_uint32(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_uint32(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_uint32(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_uint16(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_uint16(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_uint16(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_uint16(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_uint16(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_uint16(swan_C1) (- (swan_C1)) -#define swan_lsr_uint16(swan_C1, swan_C2) ((swan_C1) >> (swan_C2)) -#define swan_lxor_uint16(swan_C1, swan_C2) ((swan_C1) ^ (swan_C2)) -#define swan_lor_uint16(swan_C1, swan_C2) ((swan_C1) | (swan_C2)) -#define swan_land_uint16(swan_C1, swan_C2) ((swan_C1) & (swan_C2)) -#define swan_div_uint16(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_uint16(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_uint16(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_uint16(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_uint16(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_uint16(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_uint8(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_uint8(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_uint8(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_uint8(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_uint8(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_uint8(swan_C1) (- (swan_C1)) -#define swan_lsr_uint8(swan_C1, swan_C2) ((swan_C1) >> (swan_C2)) -#define swan_lxor_uint8(swan_C1, swan_C2) ((swan_C1) ^ (swan_C2)) -#define swan_lor_uint8(swan_C1, swan_C2) ((swan_C1) | (swan_C2)) -#define swan_land_uint8(swan_C1, swan_C2) ((swan_C1) & (swan_C2)) -#define swan_div_uint8(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_uint8(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_uint8(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_uint8(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_uint8(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_uint8(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_int64(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_int64(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_int64(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_int64(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_int64(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_int64(swan_C1) (- (swan_C1)) -#define swan_div_int64(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_int64(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_int64(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_int64(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_int64(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_int64(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_int32(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_int32(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_int32(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_int32(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_int32(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_int32(swan_C1) (- (swan_C1)) -#define swan_div_int32(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_int32(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_int32(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_int32(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_int32(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_int32(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_int16(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_int16(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_int16(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_int16(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_int16(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_int16(swan_C1) (- (swan_C1)) -#define swan_div_int16(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_int16(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_int16(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_int16(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_int16(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_int16(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_mod_int8(swan_C1, swan_C2) ((swan_C1) % (swan_C2)) -#define swan_ge_int8(swan_C1, swan_C2) ((swan_C1) >= (swan_C2)) -#define swan_gt_int8(swan_C1, swan_C2) ((swan_C1) > (swan_C2)) -#define swan_le_int8(swan_C1, swan_C2) ((swan_C1) <= (swan_C2)) -#define swan_lt_int8(swan_C1, swan_C2) ((swan_C1) < (swan_C2)) -#define swan_uminus_int8(swan_C1) (- (swan_C1)) -#define swan_div_int8(swan_C1, swan_C2) ((swan_C1) / (swan_C2)) -#define swan_mult_int8(swan_C1, swan_C2) ((swan_C1) * (swan_C2)) -#define swan_minus_int8(swan_C1, swan_C2) ((swan_C1) - (swan_C2)) -#define swan_plus_int8(swan_C1, swan_C2) ((swan_C1) + (swan_C2)) -#define swan_diff_int8(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_int8(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_diff_char(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_char(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) -#define swan_diff_char16(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_char16(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) -#define swan_diff_char32(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_char32(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) - -#define swan_diff_bool(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq_bool(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) -#define swan_or(swan_C1, swan_C2) ((swan_C1) | (swan_C2)) -#define swan_and(swan_C1, swan_C2) ((swan_C1) & (swan_C2)) -#define swan_xor(swan_C1, swan_C2) ((swan_C1) ^ (swan_C2)) -#define swan_not(swan_C1) (swan_true ^ (swan_C1)) -#define swan_cond(swan_C1) (swan_C1) - -#define swan_diff(swan_C1, swan_C2) ((swan_C1) != (swan_C2)) -#define swan_eq(swan_C1, swan_C2) ((swan_C1) == (swan_C2)) -#define swan_incr(swan_C1) ((swan_C1)++) -#define swan_index(swan_C1, swan_C2) ((swan_C1)[(swan_C2)]) - -#endif /* SWAN_WRAP_C_OPS */ - - - -#endif /* SWAN_CONFIG_H_ */