Compare commits
70
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
520e7a3789 | ||
|
|
af637a28d8 | ||
|
|
0cefcae153 | ||
|
|
b42a909e65 | ||
|
|
dace0f70ef | ||
|
|
43329f557f | ||
|
|
3e8b836b3e | ||
|
|
ead7c6c8c3 | ||
|
|
fc3bcf0578 | ||
|
|
68cca0e222 | ||
|
|
bfe5219dc2 | ||
|
|
ae6f9d9310 | ||
|
|
f8b786ac40 | ||
|
|
53a2bcdd8b | ||
|
|
f11d325641 | ||
|
|
aa6cbe2d72 | ||
|
|
50e2cdb527 | ||
|
|
1f184eae8c | ||
|
|
90f3c5ce26 | ||
|
|
aa85c396bf | ||
|
|
f19cfecebe | ||
|
|
2a50010e6f | ||
|
|
bf14461dae | ||
|
|
ec12b1ce7c | ||
|
|
de375f8cea | ||
|
|
30534dbf0e | ||
|
|
5fddadb1e4 | ||
|
|
20c6d4c800 | ||
|
|
125820c84c | ||
|
|
6984cf6a46 | ||
|
|
322018c6db | ||
|
|
d5f60d72e0 | ||
|
|
aa5b0e3fa2 | ||
|
|
c81d05cff6 | ||
|
|
799a51f340 | ||
|
|
89b00f1596 | ||
|
|
ccb6728efa | ||
|
|
75af3df51c | ||
|
|
0f1196ef94 | ||
|
|
e4277656ef | ||
|
|
8dc5dceb59 | ||
|
|
093e59e5a7 | ||
|
|
177eef8acf | ||
|
|
211bc660da | ||
|
|
0b6853f5a7 | ||
|
|
b158a79f6c | ||
|
|
1f1965beae | ||
|
|
9f35265f75 | ||
|
|
345bcd8174 | ||
|
|
f05ce582ac | ||
|
|
5e1ad8f1c8 | ||
|
|
dcb156f1eb | ||
|
|
1bf945d60b | ||
|
|
380618fa7e | ||
|
|
55d36377c3 | ||
|
|
62be4c90c6 | ||
|
|
c2fddd8a7a | ||
|
|
8adb5e638d | ||
|
|
fceb57390c | ||
|
|
ae18190f69 | ||
|
|
8c9b3471fb | ||
|
|
22c437d45e | ||
|
|
5ea56aac02 | ||
|
|
14c5476537 | ||
|
|
f7e929fe6a | ||
|
|
736d637d63 | ||
|
|
6cf5d1e860 | ||
|
|
faadf26cdf | ||
|
|
e617808be1 | ||
|
|
97de8f9069 |
@@ -1,65 +0,0 @@
|
||||
version: '{build}'
|
||||
|
||||
# for Appveyor CI (windows)
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
os: Windows Server 2012 R2
|
||||
|
||||
clone_folder: c:\projects\STEPcode
|
||||
|
||||
#grab zip instead of git clone
|
||||
shallow_clone: true
|
||||
platform: x64
|
||||
configuration: Debug
|
||||
|
||||
# errors or couldn't be found by cmake
|
||||
# - GENERATOR: "Visual Studio 9 2008"
|
||||
# ARCH: 32
|
||||
# - GENERATOR: "Visual Studio 10"
|
||||
# ARCH: 32
|
||||
|
||||
#no point in these without artifact support...
|
||||
# - GENERATOR: "Visual Studio 11"
|
||||
#ARCH: 32
|
||||
#- GENERATOR: "Visual Studio 12"
|
||||
#ARCH: 32
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- GENERATOR: "Visual Studio 12 Win64"
|
||||
ARCH: 64
|
||||
|
||||
# build:
|
||||
# parallel: true
|
||||
# project: ALL_BUILD.vcxproj
|
||||
|
||||
#appveyor limits compile/test to 30 minutes
|
||||
# to reduce time, only test schemas with files: ifc2x3, ap214e3, ap209
|
||||
|
||||
build_script:
|
||||
- ps: |
|
||||
cd c:\projects\STEPcode
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -version
|
||||
grep --version
|
||||
cmake .. -DSC_ENABLE_TESTING=ON -G"$env:GENERATOR" -DSC_BUILD_SCHEMAS="ifc2x3;ap214e3;ap209"
|
||||
echo "filtering build output with grep"
|
||||
cmake --build . --config Debug | grep -ve "CMake does not need to re-run because" -e "ZERO_CHECK.ZERO_CHECK" -e "^ Creating directory"
|
||||
|
||||
#msbuld seems to provide no benefits, and I can't filter its output...
|
||||
#msbuild SC.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /p:Configuration=Debug /p:Platform=x64
|
||||
# /toolsversion:14.0 /p:PlatformToolset=v140
|
||||
|
||||
test_script:
|
||||
- cmd: echo Running CTest...
|
||||
- cmd: cd c:\projects\STEPcode\build
|
||||
- cmd: echo excluding test_inverse_attr3, which hangs
|
||||
- cmd: ctest -j1 . -C Debug --output-on-failure
|
||||
|
||||
# - cmd: grep -niB20 "Test Failed" Testing/Temporary/LastTest.log
|
||||
|
||||
# we could upload a compiled zip somewhere (see Appveyor artifact documentation)
|
||||
@@ -0,0 +1,277 @@
|
||||
name: STEPCODE
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
windows:
|
||||
name: Windows Latest MSVC
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - Ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Add github workspace to path
|
||||
# https://github.community/t/deprecated-add-path/136621
|
||||
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
|
||||
- name: Add cl.exe to PATH
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DSC_ENABLE_TESTING=ON
|
||||
# We do the following in order to help ensure files are "flushed"
|
||||
# to disk before compilation is attempted
|
||||
# https://superuser.com/a/1553374/1286142
|
||||
powershell Write-VolumeCache C
|
||||
powershell Write-VolumeCache D
|
||||
|
||||
- name: Build
|
||||
run: cd build && ninja -j1 -v
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build && ctest -j1 .
|
||||
|
||||
linux:
|
||||
name: Ubuntu Latest GCC
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - Ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
|
||||
# TODO - we will want this when the new parser work comes in,
|
||||
# as we won't need perplex and the system tools should suffice
|
||||
# to exercise the generator logic:
|
||||
#
|
||||
# - name: Setup - System
|
||||
# env:
|
||||
# DEBIAN_FRONTEND: noninteractive
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# # Install dev tools
|
||||
# sudo apt-get install re2c lemon
|
||||
# sudo apt-get clean
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D CMAKE_BUILD_TYPE=Release -DSC_ENABLE_TESTING=ON
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cmake --build build --config Release
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build && ctest -j1 . -C Release
|
||||
|
||||
linux_clang:
|
||||
name: Ubuntu Latest Clang
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - Ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
|
||||
# TODO - we will want this when the new parser work comes in,
|
||||
# as we won't need perplex and the system tools should suffice
|
||||
# to exercise the generator logic:
|
||||
#
|
||||
# - name: Setup - System
|
||||
# env:
|
||||
# DEBIAN_FRONTEND: noninteractive
|
||||
# run: |
|
||||
# sudo apt-get update
|
||||
# # Install dev tools
|
||||
# sudo apt-get install re2c lemon
|
||||
# sudo apt-get clean
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
CC=clang CXX=clang++ cmake -S . -G Ninja -B build -D ENABLE_ALL=ON -D CMAKE_BUILD_TYPE=Release -DSC_ENABLE_TESTING=ON
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
CC=clang CXX=clang++ cmake --build build --config Release
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build && ctest -j1 . -C Release
|
||||
|
||||
|
||||
osx:
|
||||
name: macOS Latest Clang
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - Ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
export CC=clang
|
||||
export CXX=clang++
|
||||
cmake -S . -G Ninja -B build -D CMAKE_BUILD_TYPE=Release -DSC_ENABLE_TESTING=ON
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cd build && ninja -j1
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd build && ctest -j1 . -C Release
|
||||
|
||||
brlcad_linux:
|
||||
name: BRL-CAD Linux step-g Test
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - Ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
|
||||
- name: Setup - System
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
run: |
|
||||
sudo apt-get update
|
||||
# Install dev tools
|
||||
sudo apt-get install re2c lemon
|
||||
sudo apt-get clean
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/BRL-CAD/brlcad.git -b main
|
||||
cd brlcad/src/other/ext && rm -rf stepcode
|
||||
git clone --depth 1 https://github.com/stepcode/stepcode.git -b develop
|
||||
# Ordinarily BRL-CAD keeps track of what files are supposed to be
|
||||
# present in the repository. In this case we're not interested in
|
||||
# updating the list to the working stepcode filelist, so use an empty
|
||||
# list instead
|
||||
echo "set(stepcode_ignore_files)" > stepcode.dist
|
||||
cd ../../../../
|
||||
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cd brlcad
|
||||
cmake -S . -G Ninja -B build -DENABLE_ALL=ON -DCMAKE_BUILD_TYPE=Release -DEXT_BUILD_VERBOSE=ON
|
||||
cd ..
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cd brlcad
|
||||
cmake --build build --config Release --target step-g
|
||||
cd ..
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
export PATH=$ENV{GITHUB_WORKSPACE}:$PATH
|
||||
cd brlcad/build
|
||||
./bin/step-g ../db/nist/NIST_MBE_PMI_3.stp -o nist3.g
|
||||
cd ../..
|
||||
|
||||
|
||||
brlcad_windows:
|
||||
name: BRL-CAD Windows step-g Test
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
steps:
|
||||
- name: Setup - CMake
|
||||
uses: lukka/get-cmake@latest
|
||||
|
||||
- name: Setup - Ninja
|
||||
uses: seanmiddleditch/gha-setup-ninja@master
|
||||
|
||||
- name: Add github workspace to path
|
||||
# https://github.community/t/deprecated-add-path/136621
|
||||
run: echo "$ENV{GITHUB_WORKSPACE}" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.2
|
||||
|
||||
- name: Add cl.exe to PATH
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
|
||||
- name: Checkout
|
||||
run: |
|
||||
git clone --depth 1 https://github.com/BRL-CAD/brlcad.git -b main
|
||||
cd brlcad/src/other/ext
|
||||
cmake -E rm -r stepcode
|
||||
git clone --depth 1 https://github.com/stepcode/stepcode.git -b develop
|
||||
# Ordinarily BRL-CAD keeps track of what files are supposed to be
|
||||
# present in the repository. In this case we're not interested in
|
||||
# updating the list to the working stepcode filelist, so use an empty
|
||||
# list instead
|
||||
echo "set(stepcode_ignore_files)" > stepcode.dist
|
||||
cd ../../../../
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cd brlcad && cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" -DSC_ENABLE_TESTING=ON
|
||||
cd ..
|
||||
# We do the following in order to help ensure files are "flushed"
|
||||
# to disk before compilation is attempted
|
||||
# https://superuser.com/a/1553374/1286142
|
||||
powershell Write-VolumeCache C
|
||||
powershell Write-VolumeCache D
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd brlcad/build
|
||||
ninja -j1 -v step-g
|
||||
cd ../..
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
cd brlcad/build
|
||||
./bin/step-g.exe ../db/nist/NIST_MBE_PMI_3.stp -o nist3.g
|
||||
cd ../..
|
||||
|
||||
+17
@@ -1,3 +1,20 @@
|
||||
# Common build directories used in the source tree
|
||||
/build
|
||||
/.build
|
||||
|
||||
# Temporary files
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
||||
[._]*.s[a-v][a-z]
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-v][a-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# OS specific files
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
|
||||
# Tool specific patterns
|
||||
*.kdev4
|
||||
.kdev_include_paths
|
||||
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
sudo: false
|
||||
language: cpp
|
||||
compiler:
|
||||
- clang
|
||||
script: mkdir build && cd build && cmake .. -DSC_ENABLE_TESTING=ON && make -j3 && ctest -j2 --output-on-failure
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
notifications:
|
||||
irc: "chat.freenode.net#stepcode"
|
||||
email: scl-dev@groups.google.com
|
||||
on_success: change
|
||||
on_failure: always
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
@@ -19,6 +19,7 @@ Paviot, Thomas (tpaviot)
|
||||
Pictor, Mark (mpictor)
|
||||
Reed, Nick (nickreed)
|
||||
Shah, Kesha (kesha, keshashah)
|
||||
Sparks, Devon (devonsparks)
|
||||
Thomas, Dawn (homovulgaris, madant)
|
||||
Wouters, Dave (davyw)
|
||||
Yapp, Clifford (starseeker)
|
||||
|
||||
+121
-45
@@ -40,57 +40,132 @@
|
||||
|
||||
project(SC)
|
||||
|
||||
# Minimum required version of CMake
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
if (POLICY CMP0077)
|
||||
cmake_policy(SET CMP0077 OLD)
|
||||
endif (POLICY CMP0077)
|
||||
|
||||
# SC version
|
||||
set(SC_VERSION_MAJOR 0)
|
||||
set(SC_VERSION_MINOR 8-dev)
|
||||
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
|
||||
set(SC_VERSION_MINOR 9)
|
||||
set(SC_VERSION_PATCH 1)
|
||||
set(SC_VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR}.${SC_VERSION_PATCH})
|
||||
|
||||
# SC ABI version. SC_ABI_SOVERSION should be incremented
|
||||
# for each release introducing API incompatibilities
|
||||
set(SC_ABI_SOVERSION 2)
|
||||
set(SC_ABI_VERSION ${SC_ABI_SOVERSION}.0.0)
|
||||
|
||||
# Minimum required version of CMake
|
||||
cmake_minimum_required(VERSION 3.6.3)
|
||||
cmake_policy(SET CMP0003 NEW)
|
||||
cmake_policy(SET CMP0026 NEW)
|
||||
cmake_policy(SET CMP0057 NEW)
|
||||
# Set language standards
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# CMake derives much of its functionality from modules, typically
|
||||
# stored in one directory - let CMake know where to find them.
|
||||
set(SC_CMAKE_DIR "${SC_SOURCE_DIR}/cmake")
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
|
||||
else(NOT SC_IS_SUBBUILD)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
list(APPEND CMAKE_MODULE_PATH "${SC_CMAKE_DIR}")
|
||||
|
||||
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
|
||||
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
|
||||
# OpenBSD has its own naming conventions. Set a platform variable based on
|
||||
# the OS name so we can test for it succinctly.
|
||||
if ("${CMAKE_SYSTEM}" MATCHES ".*OpenBSD.*")
|
||||
set(OPENBSD ON)
|
||||
endif ("${CMAKE_SYSTEM}" MATCHES ".*OpenBSD.*")
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Set up various relative path variables and build output directories
|
||||
include(Path_Setup)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# The following logic is what allows binaries to run successfully in
|
||||
# the build directory AND install directory. Thanks to plplot for
|
||||
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
|
||||
# Documentation of these options is available at
|
||||
# http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||
|
||||
# use, i.e. don't skip the full RPATH for the build tree
|
||||
if(NOT DEFINED CMAKE_SKIP_BUILD_RPATH)
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
endif()
|
||||
|
||||
# when building, don't use the install RPATH already
|
||||
# (but later on when installing)
|
||||
if(NOT DEFINED CMAKE_BUILD_WITH_INSTALL_RPATH)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
endif()
|
||||
|
||||
# the RPATH/INSTALL_NAME_DIR to be used when installing
|
||||
if (NOT APPLE)
|
||||
if(NOT DEFINED CMAKE_INSTALL_RPATH)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
|
||||
endif()
|
||||
endif(NOT APPLE)
|
||||
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
|
||||
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
|
||||
if(NOT DEFINED CMAKE_INSTALL_NAME_DIR)
|
||||
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
endif()
|
||||
|
||||
# add the automatically determined parts of the RPATH which point to
|
||||
# directories outside the build tree to the install RPATH
|
||||
if(NOT DEFINED CMAKE_INSTALL_RPATH_USE_LINK_PATH)
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
endif()
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Build options
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
option(BUILD_STATIC_LIBS "Build static libraries" OFF)
|
||||
|
||||
option(SC_PYTHON_GENERATOR "Compile exp2python" ON)
|
||||
option(SC_CPP_GENERATOR "Compile exp2cxx" ON)
|
||||
|
||||
option(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
|
||||
option(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
|
||||
|
||||
option(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
|
||||
if (SC_ENABLE_COVERAGE AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage" CACHE STRING "Extra linker flags required by code coverage" FORCE)
|
||||
endif (SC_ENABLE_COVERAGE AND ${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
||||
|
||||
option(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
|
||||
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
|
||||
|
||||
option(SC_ENABLE_TESTING "Enable unittesting framework" OFF)
|
||||
if(SC_ENABLE_TESTING)
|
||||
if(NOT "${SC_BUILD_EXPRESS_ONLY}" AND NOT DEFINED SC_BUILD_SCHEMAS)
|
||||
set(SC_BUILD_SCHEMAS "ALL") #test all schemas, unless otherwise specified
|
||||
endif()
|
||||
include(CTest)
|
||||
endif(SC_ENABLE_TESTING)
|
||||
|
||||
# SC_ADDEXEC and SC_ADDLIB macros, dllimport/export, etc
|
||||
include(${SC_CMAKE_DIR}/SC_Targets.cmake)
|
||||
include(SC_Targets)
|
||||
|
||||
# Macros related to paths
|
||||
include(${SC_CMAKE_DIR}/SC_Paths.cmake)
|
||||
include(SC_Paths)
|
||||
|
||||
# locale stuff
|
||||
include(${SC_CMAKE_DIR}/SC_Locale.cmake)
|
||||
include(SC_Locale)
|
||||
|
||||
# logic related to regenerating the lexer and parser source code
|
||||
include(${SC_CMAKE_DIR}/SC_Regenerate.cmake)
|
||||
include(SC_Regenerate)
|
||||
|
||||
# create config header sc_cf.h
|
||||
include(SC_Config_Headers)
|
||||
|
||||
if(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS)
|
||||
set(SC_SDAI_ADDITIONAL_EXES_SRCS "" CACHE STRING "Source files for additional executables to be linked with SDAI libs")
|
||||
endif(NOT DEFINED SC_SDAI_ADDITIONAL_EXES_SRCS)
|
||||
|
||||
if(NOT DEFINED SC_BUILD_SCHEMAS)
|
||||
if(NOT "${SC_BUILD_EXPRESS_ONLY}" AND NOT DEFINED SC_BUILD_SCHEMAS)
|
||||
list(APPEND CONFIG_END_MESSAGES
|
||||
"** CMake variable SC_BUILD_SCHEMAS was not set. Defaults to building ALL schemas, which will take a"
|
||||
" while; see http://stepcode.org/mw/index.php?title=STEPcode_CMake_variables#SC_BUILD_SCHEMAS")
|
||||
#this makes SC_BUILD_SCHEMAS show up in cmake-gui
|
||||
set(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built")
|
||||
endif(NOT DEFINED SC_BUILD_SCHEMAS)
|
||||
"** Note: CMake variable SC_BUILD_SCHEMAS was not set - defaults to building ALL schemas")
|
||||
# this makes SC_BUILD_SCHEMAS show up in cmake-gui
|
||||
set(SC_BUILD_SCHEMAS "ALL" CACHE STRING "Semicolon-separated list of paths to EXPRESS schemas to be built")
|
||||
endif()
|
||||
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
list(APPEND CONFIG_END_MESSAGES
|
||||
@@ -99,23 +174,18 @@ if(NOT SC_IS_SUBBUILD)
|
||||
".. Generating step can take a while if you are building several schemas.")
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
|
||||
# create config headers sc_cf.h and sc_version_string.h
|
||||
include(${SC_CMAKE_DIR}/SC_Config_Headers.cmake)
|
||||
# create config headers sc_cf.h
|
||||
include(SC_Config_Headers)
|
||||
|
||||
|
||||
################
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
if(MSVC)
|
||||
# Disable warning for preferred usage of secure functions (example strcpy should be strcpy_s, ...)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS)
|
||||
else()
|
||||
endif()
|
||||
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
||||
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
|
||||
if(HAVE_NULLPTR)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif(HAVE_NULLPTR)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
@@ -140,13 +210,19 @@ if(SC_ENABLE_TESTING)
|
||||
endif(SC_ENABLE_TESTING)
|
||||
add_subdirectory(doc)
|
||||
|
||||
# 'make core' builds everything that isn't generated. for devs.
|
||||
add_custom_target(core)
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
add_dependencies(core stepdai stepeditor exp2cxx check-express)
|
||||
else()
|
||||
add_dependencies(core stepdai-static stepeditor-static exp2cxx check-express)
|
||||
endif()
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
#-----------------------------------------------------------------------------
|
||||
# SC Packaging
|
||||
# $make package
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
|
||||
set(CPACK_SET_DESTDIR "ON")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_NAME SC)
|
||||
set(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
|
||||
include(CPack)
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
|
||||
|
||||
# CONFIG_END_MESSAGES - list of messages to be printed after everything else is done.
|
||||
# THIS MUST BE LAST to ensure that they are visible to the user without scrolling.
|
||||
|
||||
+4
-1
@@ -11,9 +11,12 @@ We love contributions!
|
||||
* Encouraged but not enforced: each commit should stand alone, in the sense that the code should compile and run at that point.
|
||||
* One major topic per pull request. Commits that fix small things (typos, formatting) are perfectly acceptable in a PR fixing a bug or adding a feature.
|
||||
* Tests are good. Tests are required unless you're fixing something simple or that was obviously broken.
|
||||
* Do not change EXPRESS schema definition without reference to an upstream change.
|
||||
* Make your changes and push them to your GitHub repo
|
||||
* Once your branch is pushed, submit a pull request.
|
||||
* We'll look at the PR and either merge or add feedback. If there isn't any activity within several days, send a message to the mailing list - `scl-dev` AT `groups.google.com`.
|
||||
- enable github option on each PR 'Allow edits from maintainers', refer to github help if necessary
|
||||
* We'll look at the PR and either merge (possibly after rebase) or add feedback.
|
||||
- If there isn't any activity within several days send a message to the mailing list - `scl-dev` AT `groups.google.com`.
|
||||
|
||||
## Coding Standards
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
STEPcode -- http://github.com/stepcode/stepcode -- http://stepcode.org
|
||||
************************************************************************
|
||||
STEPcode
|
||||
http://github.com/stepcode/stepcode
|
||||
************************************************************************
|
||||
|
||||
Release 0.8 (December, 2014)
|
||||
|
||||
New since v0.7:
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
Travis-CI | AppVeyor CI
|
||||
:-------------:|:---------------:
|
||||
Linux, OSX (LLVM) | Windows (MSVC)
|
||||
[](https://travis-ci.org/stepcode/stepcode) | [](https://ci.appveyor.com/project/mpictor/stepcode)
|
||||

|
||||
|
||||
***********************************************************************
|
||||
STEPcode v0.8 -- stepcode.org, github.com/stepcode/stepcode
|
||||
STEPcode v0.8 -- github.com/stepcode/stepcode
|
||||
|
||||
* What is STEPcode? SC reads ISO10303-11 EXPRESS schemas and generates
|
||||
C++ source code that can read and write Part 21 files conforming
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
0.8
|
||||
+125
-147
@@ -47,158 +47,136 @@
|
||||
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
|
||||
mark_as_advanced(LEMON_EXECUTABLE)
|
||||
|
||||
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# look for the template in share
|
||||
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
|
||||
set (LEMON_TEMPLATE "${DATA_DIR}/lemon/lempar.c")
|
||||
elseif (EXISTS "share/lemon/lempar.c")
|
||||
set (LEMON_TEMPLATE "share/lemon/lempar.c")
|
||||
elseif (EXISTS "/usr/share/lemon/lempar.c")
|
||||
set (LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
|
||||
endif (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
|
||||
endif (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
if (LEMON_EXECUTABLE)
|
||||
if(NOT LEMON_TEMPLATE)
|
||||
# look for the template, if we've not already been told where it is
|
||||
if (DATA_DIR AND EXISTS "${DATA_DIR}/lemon/lempar.c")
|
||||
find_file(LEMON_TEMPLATE lempar.c
|
||||
PATHS "${DATA_DIR}/lemon/lempar.c"
|
||||
NO_DEFAULT_PATH)
|
||||
endif ()
|
||||
|
||||
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# look for the template in bin dir
|
||||
get_filename_component(lemon_path ${LEMON_EXECUTABLE} PATH)
|
||||
if (lemon_path)
|
||||
if (EXISTS ${lemon_path}/lempar.c)
|
||||
set (LEMON_TEMPLATE "${lemon_path}/lempar.c")
|
||||
endif (EXISTS ${lemon_path}/lempar.c)
|
||||
if (EXISTS /usr/share/lemon/lempar.c)
|
||||
set (LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
|
||||
endif (EXISTS /usr/share/lemon/lempar.c)
|
||||
endif (lemon_path)
|
||||
endif(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# If the above did not succeed, check standard locations
|
||||
get_filename_component(lemon_dir ${LEMON_EXECUTABLE} DIRECTORY)
|
||||
find_file(LEMON_TEMPLATE lempar.c
|
||||
PATHS "${lemon_dir}" "/usr/share/lemon"
|
||||
NO_DEFAULT_PATH)
|
||||
mark_as_advanced(LEMON_TEMPLATE)
|
||||
endif()
|
||||
|
||||
if (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# fallback
|
||||
set (LEMON_TEMPLATE "lempar.c")
|
||||
if (NOT EXISTS ${LEMON_TEMPLATE})
|
||||
message(WARNING "Lemon's lempar.c template file could not be found automatically, set LEMON_TEMPLATE")
|
||||
endif (NOT EXISTS ${LEMON_TEMPLATE})
|
||||
endif (LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||
# We need a template to be able to use lemon correctly
|
||||
if(NOT LEMON_TEMPLATE)
|
||||
message(FATAL_ERROR "Failed to find lemon template file (lempar.c) - need to set LEMON_TEMPLATE")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LEMON_TEMPLATE)
|
||||
# Define the function
|
||||
# LEMON_TARGET(<Name> <LemonInput> <LemonSource> <LemonHeader>
|
||||
# [<ArgString>])
|
||||
# which will create a custom rule to generate a parser. <LemonInput> is
|
||||
# the path to a lemon file. <LemonSource> is the desired name for the
|
||||
# generated source file. <LemonHeader> is the desired name for the
|
||||
# generated header which contains the token list. Anything in the optional
|
||||
# <ArgString> parameter is appended to the lemon command line.
|
||||
#
|
||||
# ====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# LEMON_TARGET(MyParser parser.y parser.c parser.h)
|
||||
# add_executable(Foo main.cpp ${LEMON_MyParser_OUTPUTS})
|
||||
# ====================================================================
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
if(NOT COMMAND LEMON_TARGET)
|
||||
function(LEMON_TARGET Name LemonInput LemonOutput)
|
||||
set(LT_ARGS DEFINES_FILE COMPILE_FLAGS)
|
||||
cmake_parse_arguments(LEMON_TARGET_ARG "" "${LT_ARGS}" "" ${ARGN})
|
||||
|
||||
if(NOT "${LEMON_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
|
||||
set(LEMON_EXECUTABLE_opts "${LEMON_TARGET_ARG_COMPILE_FLAGS}")
|
||||
separate_arguments(LEMON_EXECUTABLE_opts)
|
||||
else()
|
||||
set(LEMON_EXECUTABLE_opts "")
|
||||
endif()
|
||||
|
||||
# check for LemonOutput
|
||||
get_filename_component(_basename ${LemonOutput} NAME_WE)
|
||||
get_filename_component(_out_src_file ${LemonOutput} NAME)
|
||||
get_filename_component(_out_dir ${LemonOutput} PATH)
|
||||
if(NOT "${_out_dir}" STREQUAL "")
|
||||
message(WARNING "Full path specified for LemonOutput - should be filename only")
|
||||
endif()
|
||||
|
||||
# set report file
|
||||
set(_out_rpt_file "${_basename}.out")
|
||||
|
||||
# check for DEFINES_FILE
|
||||
if ("${LEMON_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
|
||||
set(_out_hdr_file "${_basename}.h")
|
||||
else()
|
||||
get_filename_component(_out_dir ${LEMON_TARGET_ARG_DEFINES_FILE} PATH)
|
||||
get_filename_component(_out_hdr_file ${LEMON_TARGET_ARG_DEFINES_FILE} NAME)
|
||||
if(NOT "${_out_dir}" STREQUAL "")
|
||||
message(WARNING "Full path specified for DEFINES_FILE - should be filename only")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# input file
|
||||
get_filename_component(_in_y_path ${LemonInput} ABSOLUTE)
|
||||
get_filename_component(_in_y_file ${LemonInput} NAME)
|
||||
|
||||
# Stage the source file in the binary directory for lemon. We need to make
|
||||
# sure it's fully copied, so use a sentinel guard
|
||||
add_custom_command(
|
||||
OUTPUT ${_in_y_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${_in_y_path} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}.sentinel
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}.sentinel
|
||||
DEPENDS ${_in_y_file}
|
||||
)
|
||||
add_custom_target(${Name}_input_cpy DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}.sentinel)
|
||||
|
||||
# execute lemon
|
||||
add_custom_command(
|
||||
OUTPUT ${_out_src_file}
|
||||
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_opts} ${_in_y_file}
|
||||
DEPENDS ${Name}_input_cpy
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
|
||||
)
|
||||
|
||||
# rename the header
|
||||
add_custom_command(
|
||||
OUTPUT ${_out_hdr_file}
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E rename ${_basename}.h ${_out_hdr_file}
|
||||
DEPENDS ${_out_src_file}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# set the return values
|
||||
# TODO: for generated sources even headers should be target dependencies
|
||||
set(LEMON_${Name}_DEFINED TRUE PARENT_SCOPE)
|
||||
set(LEMON_${Name}_OUTPUT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${_out_hdr_file}" PARENT_SCOPE)
|
||||
set(LEMON_${Name}_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE)
|
||||
set(LEMON_${Name}_OUTPUTS "${_out_src_file}" PARENT_SCOPE)
|
||||
|
||||
# TODO - remove once perplex goes away...
|
||||
add_custom_target(${Name} DEPENDS ${_out_hdr_file})
|
||||
|
||||
# make sure we clean up generated output and copied input
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_out_src_file}")
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/${_in_y_file}")
|
||||
|
||||
endfunction(LEMON_TARGET)
|
||||
endif(NOT COMMAND LEMON_TARGET)
|
||||
|
||||
endif(LEMON_EXECUTABLE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
|
||||
|
||||
# Define the macro
|
||||
# LEMON_TARGET(<Name> <LemonInput> <LemonSource> <LemonHeader>
|
||||
# [<ArgString>])
|
||||
# which will create a custom rule to generate a parser. <LemonInput> is
|
||||
# the path to a lemon file. <LemonSource> is the desired name for the
|
||||
# generated source file. <LemonHeader> is the desired name for the
|
||||
# generated header which contains the token list. Anything in the optional
|
||||
# <ArgString> parameter is appended to the lemon command line.
|
||||
#
|
||||
# ====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# LEMON_TARGET(MyParser parser.y parser.c parser.h)
|
||||
# add_executable(Foo main.cpp ${LEMON_MyParser_OUTPUTS})
|
||||
# ====================================================================
|
||||
|
||||
include(CMakeParseArguments)
|
||||
|
||||
if(NOT COMMAND LEMON_TARGET)
|
||||
macro(LEMON_TARGET Name Input)
|
||||
|
||||
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
|
||||
set(LVAR_PREFIX ${Name}_${IN_FILE_WE})
|
||||
|
||||
if(${ARGC} GREATER 3)
|
||||
CMAKE_PARSE_ARGUMENTS(${LVAR_PREFIX} "" "OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR;EXTRA_ARGS" "" ${ARGN})
|
||||
endif(${ARGC} GREATER 3)
|
||||
|
||||
# Need a working directory
|
||||
if("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${LVAR_PREFIX}")
|
||||
endif("${${LVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||
file(MAKE_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR})
|
||||
|
||||
# Output source file
|
||||
if ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_SRC_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
|
||||
else ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
get_filename_component(specified_out_dir ${${LVAR_PREFIX}_OUT_SRC_FILE} PATH)
|
||||
if(NOT "${specified_out_dir}" STREQUAL "")
|
||||
message(FATAL_ERROR "\nFull path specified for OUT_SRC_FILE - should be filename only.\n")
|
||||
endif(NOT "${specified_out_dir}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_SRC_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${${LVAR_PREFIX}_OUT_SRC_FILE})
|
||||
endif ("${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||
|
||||
# Output header file
|
||||
if ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_HDR_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
|
||||
else ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
get_filename_component(specified_out_dir ${${LVAR_PREFIX}_OUT_HDR_FILE} PATH)
|
||||
if(NOT "${specified_out_dir}" STREQUAL "")
|
||||
message(FATAL_ERROR "\nFull path specified for OUT_HDR_FILE - should be filename only.\n")
|
||||
endif(NOT "${specified_out_dir}" STREQUAL "")
|
||||
set(${LVAR_PREFIX}_OUT_HDR_FILE ${${LVAR_PREFIX}_WORKING_DIR}/${${LVAR_PREFIX}_OUT_HDR_FILE})
|
||||
endif ("${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||
|
||||
# input file
|
||||
get_filename_component(in_full ${Input} ABSOLUTE)
|
||||
if("${in_full}" STREQUAL "${Input}")
|
||||
set(lemon_in_file ${Input})
|
||||
else("${in_full}" STREQUAL "${Input}")
|
||||
set(lemon_in_file "${CMAKE_CURRENT_SOURCE_DIR}/${Input}")
|
||||
endif("${in_full}" STREQUAL "${Input}")
|
||||
|
||||
|
||||
# names of lemon output files will be based on the name of the input file
|
||||
set(LEMON_GEN_SOURCE ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
|
||||
set(LEMON_GEN_HEADER ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
|
||||
set(LEMON_GEN_OUT ${${LVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.out)
|
||||
|
||||
# copy input to bin directory and run lemon
|
||||
get_filename_component(INPUT_NAME ${Input} NAME)
|
||||
add_custom_command(
|
||||
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${lemon_in_file} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}
|
||||
COMMAND ${LEMON_EXECUTABLE} -T${LEMON_TEMPLATE} ${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME} ${${LVAR_PREFIX}__EXTRA_ARGS}
|
||||
DEPENDS ${Input} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
|
||||
WORKING_DIRECTORY ${${LVAR_PREFIX}_WORKING_DIR}
|
||||
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
|
||||
)
|
||||
|
||||
# rename generated outputs
|
||||
if(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
|
||||
add_custom_command(
|
||||
OUTPUT ${${LVAR_PREFIX}_OUT_SRC_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${${LVAR_PREFIX}_OUT_SRC_FILE}
|
||||
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
|
||||
)
|
||||
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_SRC_FILE} ${LEMON_${Name}_OUTPUTS})
|
||||
endif(NOT "${${LVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "${LEMON_GEN_SOURCE}")
|
||||
if(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
|
||||
add_custom_command(
|
||||
OUTPUT ${${LVAR_PREFIX}_OUT_HDR_FILE}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${${LVAR_PREFIX}_OUT_HDR_FILE}
|
||||
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
|
||||
)
|
||||
set(LEMON_${Name}_OUTPUTS ${${LVAR_PREFIX}_OUT_HDR_FILE} ${LEMON_${Name}_OUTPUTS})
|
||||
endif(NOT "${${LVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "${LEMON_GEN_HEADER}")
|
||||
|
||||
set(LEMON_${Name}_OUTPUTS ${LEMON_${Name}_OUTPUTS} ${LEMON_GEN_OUT})
|
||||
|
||||
# make sure we clean up generated output and copied input
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${${LVAR_PREFIX}_WORKING_DIR}/${INPUT_NAME}")
|
||||
|
||||
# macro ran successfully
|
||||
set(LEMON_${Name}_DEFINED TRUE)
|
||||
|
||||
set(LEMON_${Name}_SRC ${${LVAR_PREFIX}_OUT_SRC_FILE})
|
||||
set(LEMON_${Name}_HDR ${${LVAR_PREFIX}_OUT_HDR_FILE})
|
||||
set(LEMON_${Name}_INCLUDE_DIR ${${LVAR_PREFIX}_WORKING_DIR})
|
||||
|
||||
endmacro(LEMON_TARGET)
|
||||
endif(NOT COMMAND LEMON_TARGET)
|
||||
find_package_handle_standard_args(LEMON REQUIRED_VARS LEMON_EXECUTABLE LEMON_TEMPLATE)
|
||||
|
||||
#============================================================
|
||||
# FindLEMON.cmake ends here
|
||||
|
||||
+10
-2
@@ -227,6 +227,14 @@ if(NOT COMMAND PERPLEX_TARGET)
|
||||
set(PERPLEX_${Name}_SRC ${${PVAR_PREFIX}_OUT_SRC_FILE})
|
||||
set(PERPLEX_${Name}_HDR ${${PVAR_PREFIX}_OUT_HDR_FILE})
|
||||
set(PERPLEX_${Name}_INCLUDE_DIR ${${PVAR_PREFIX}_WORKING_DIR})
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${${PVAR_PREFIX}_WORKING_DIR}/${Name}.sentinel
|
||||
COMMAND ${CMAKE_COMMAND} -E touch ${${PVAR_PREFIX}_WORKING_DIR}/${Name}.sentinel
|
||||
DEPENDS ${${PVAR_PREFIX}_OUT_SRC_FILE} ${${PVAR_PREFIX}_OUT_HDR_FILE}
|
||||
)
|
||||
add_custom_target(${Name} DEPENDS ${${PVAR_PREFIX}_WORKING_DIR}/${Name}.sentinel)
|
||||
|
||||
endmacro(PERPLEX_TARGET)
|
||||
endif(NOT COMMAND PERPLEX_TARGET)
|
||||
|
||||
@@ -240,12 +248,12 @@ if(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
if(NOT LEMON_${LemonTarget}_HDR)
|
||||
if(NOT TARGET ${LemonTarget})
|
||||
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_SRC}
|
||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
|
||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
|
||||
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||
endif(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||
|
||||
|
||||
+145
-116
@@ -6,134 +6,163 @@
|
||||
find_program(RE2C_EXECUTABLE re2c DOC "path to the re2c executable")
|
||||
mark_as_advanced(RE2C_EXECUTABLE)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
|
||||
if(RE2C_EXECUTABLE)
|
||||
|
||||
# Provide a macro to generate custom build rules:
|
||||
execute_process(COMMAND ${RE2C_EXECUTABLE} -v
|
||||
OUTPUT_VARIABLE RE2C_version_output
|
||||
ERROR_VARIABLE RE2C_version_error
|
||||
RESULT_VARIABLE RE2C_version_result
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# RE2C_TARGET(Name RE2CInput RE2COutput [COMPILE_FLAGS <string>])
|
||||
# which creates a custom command to generate the <RE2COutput> file from
|
||||
# the <RE2CInput> file. If COMPILE_FLAGS option is specified, the next
|
||||
# parameter is added to the re2c command line. Name is an alias used to
|
||||
# get details of this custom command.
|
||||
if(NOT ${RE2C_version_result} EQUAL 0)
|
||||
message(SEND_ERROR
|
||||
"Command \"${RE2C_EXECUTABLE} -v\" failed with output:\n${RE2C_version_output}\n${RE2C_version_error}")
|
||||
else()
|
||||
string(REGEX REPLACE "^re2c ([0-9]+[^ ]*)( .*)?$" "\\1" RE2C_VERSION "${RE2C_version_output}")
|
||||
endif()
|
||||
|
||||
# This module also defines a macro:
|
||||
# ADD_RE2C_LEMON_DEPENDENCY(RE2CTarget LemonTarget)
|
||||
# which adds the required dependency between a scanner and a parser
|
||||
# where <RE2CTarget> and <LemonTarget> are the first parameters of
|
||||
# respectively RE2C_TARGET and LEMON_TARGET macros.
|
||||
#
|
||||
# ====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# find_package(RE2C)
|
||||
#
|
||||
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
|
||||
# RE2C_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp")
|
||||
# ADD_RE2C_LEMON_DEPENDENCY(MyScanner MyParser)
|
||||
#
|
||||
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# add_executable(Foo
|
||||
# Foo.cc
|
||||
# ${LEMON_MyParser_OUTPUTS}
|
||||
# ${RE2C_MyScanner_OUTPUTS}
|
||||
# )
|
||||
# ====================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright (c) 2010-2016 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2006 Tristan Carel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
# Provide a macro to generate custom build rules:
|
||||
|
||||
#============================================================
|
||||
# RE2C_TARGET (public macro)
|
||||
#============================================================
|
||||
#
|
||||
# TODO - rework this macro to make use of CMakeParseArguments, see
|
||||
# http://www.cmake.org/pipermail/cmake/2012-July/051309.html
|
||||
if(NOT COMMAND RE2C_TARGET)
|
||||
macro(RE2C_TARGET Name Input Output)
|
||||
set(RE2C_TARGET_usage "RE2C_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
|
||||
if(${ARGC} GREATER 3)
|
||||
if(${ARGC} EQUAL 5)
|
||||
if("${ARGV3}" STREQUAL "COMPILE_FLAGS")
|
||||
set(RE2C_EXECUTABLE_opts "${ARGV4}")
|
||||
SEPARATE_ARGUMENTS(RE2C_EXECUTABLE_opts)
|
||||
else()
|
||||
message(SEND_ERROR ${RE2C_TARGET_usage})
|
||||
endif()
|
||||
# RE2C_TARGET(Name RE2CInput RE2COutput [COMPILE_FLAGS <string>])
|
||||
# which creates a custom command to generate the <RE2COutput> file from
|
||||
# the <RE2CInput> file. If COMPILE_FLAGS option is specified, the next
|
||||
# parameter is added to the re2c command line. Name is an alias used to
|
||||
# get details of this custom command.
|
||||
|
||||
# This module also defines a macro:
|
||||
# ADD_RE2C_LEMON_DEPENDENCY(RE2CTarget LemonTarget)
|
||||
# which adds the required dependency between a scanner and a parser
|
||||
# where <RE2CTarget> and <LemonTarget> are the first parameters of
|
||||
# respectively RE2C_TARGET and LEMON_TARGET macros.
|
||||
#
|
||||
# ====================================================================
|
||||
# Example:
|
||||
#
|
||||
# find_package(LEMON)
|
||||
# find_package(RE2C)
|
||||
#
|
||||
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
|
||||
# RE2C_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp")
|
||||
# ADD_RE2C_LEMON_DEPENDENCY(MyScanner MyParser)
|
||||
#
|
||||
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||
# add_executable(Foo
|
||||
# Foo.cc
|
||||
# ${LEMON_MyParser_OUTPUTS}
|
||||
# ${RE2C_MyScanner_OUTPUTS}
|
||||
# )
|
||||
# ====================================================================
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright (c) 2010-2016 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
# Copyright 2009 Kitware, Inc.
|
||||
# Copyright 2006 Tristan Carel
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * The names of the authors may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
#============================================================
|
||||
# RE2C_TARGET (public macro)
|
||||
#============================================================
|
||||
#
|
||||
if(NOT COMMAND RE2C_TARGET)
|
||||
function(RE2C_TARGET Name RE2CInput RE2COutput)
|
||||
set(_re2c_args COMPILE_FLAGS DEFINES_FILE)
|
||||
cmake_parse_arguments(RE2C_TARGET_ARG "" "${_re2c_args}" "" ${ARGN})
|
||||
|
||||
if(NOT "${RE2C_TARGET_ARG_UNPARSED_ARGUMENTS}" STREQUAL "")
|
||||
message(SEND_ERROR "RE2C_TARGET(<Name> <RE2CInput> <RE2COutput>
|
||||
[COMPILE_FLAGS <string>]
|
||||
[DEFINES_FILE <string>])")
|
||||
else()
|
||||
message(SEND_ERROR ${RE2C_TARGET_usage})
|
||||
if(NOT "${RE2C_TARGET_ARG_COMPILE_FLAGS}" STREQUAL "")
|
||||
set(RE2C_EXECUTABLE_opts "${RE2C_TARGET_ARG_COMPILE_FLAGS}")
|
||||
separate_arguments(RE2C_EXECUTABLE_opts)
|
||||
else()
|
||||
set(RE2C_EXECUTABLE_opts "")
|
||||
endif()
|
||||
|
||||
if(NOT "${RE2C_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
|
||||
list(APPEND RE2C_EXECUTABLE_opts -t ${RE2C_TARGET_ARG_DEFINES_FILE})
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RE2COutput}
|
||||
COMMAND ${RE2C_EXECUTABLE}
|
||||
ARGS ${RE2C_EXECUTABLE_opts} -o ${RE2COutput} ${CMAKE_CURRENT_SOURCE_DIR}/${RE2CInput}
|
||||
DEPENDS ${RE2CInput}
|
||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
# TODO: check, for generated sources headers should be included in outputs
|
||||
set(RE2C_${Name}_DEFINED TRUE PARENT_SCOPE)
|
||||
set(RE2C_${Name}_OUTPUTS ${RE2COutput} PARENT_SCOPE)
|
||||
if("${RE2C_TARGET_ARG_DEFINES_FILE}" STREQUAL "")
|
||||
set(RE2C_${Name}_OUTPUT_HEADER "" PARENT_SCOPE)
|
||||
else()
|
||||
set(RE2C_${Name}_OUTPUT_HEADER "${RE2C_TARGET_ARG_DEFINES_FILE}" PARENT_SCOPE)
|
||||
endif()
|
||||
set(RE2C_${Name}_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}" PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_custom_command(OUTPUT ${Output}
|
||||
COMMAND ${RE2C_EXECUTABLE}
|
||||
ARGS ${RE2C_EXECUTABLE_opts} -o${Output} ${Input}
|
||||
DEPENDS ${Input} ${RE2C_EXECUTABLE_TARGET}
|
||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
endfunction(RE2C_TARGET)
|
||||
endif(NOT COMMAND RE2C_TARGET)
|
||||
#============================================================
|
||||
|
||||
set(RE2C_${Name}_DEFINED TRUE)
|
||||
set(RE2C_${Name}_OUTPUTS ${Output})
|
||||
set(RE2C_${Name}_INPUT ${Input})
|
||||
set(RE2C_${Name}_COMPILE_FLAGS ${RE2C_EXECUTABLE_opts})
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${Output}")
|
||||
endmacro(RE2C_TARGET)
|
||||
endif(NOT COMMAND RE2C_TARGET)
|
||||
#============================================================
|
||||
#============================================================
|
||||
# ADD_RE2C_LEMON_DEPENDENCY (public macro)
|
||||
#============================================================
|
||||
#
|
||||
if(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||
function(ADD_RE2C_LEMON_DEPENDENCY RE2CTarget LemonTarget)
|
||||
|
||||
#============================================================
|
||||
# ADD_RE2C_LEMON_DEPENDENCY (public macro)
|
||||
#============================================================
|
||||
#
|
||||
if(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||
macro(ADD_RE2C_LEMON_DEPENDENCY RE2CTarget LemonTarget)
|
||||
if(NOT RE2C_${RE2CTarget}_OUTPUTS)
|
||||
message(SEND_ERROR "RE2C target `${RE2CTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
if(NOT RE2C_${RE2CTarget}_OUTPUTS)
|
||||
message(SEND_ERROR "RE2C target `${RE2CTarget}' does not exists.")
|
||||
endif()
|
||||
if(NOT LEMON_${LemonTarget}_OUTPUT_HEADER)
|
||||
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
||||
endif()
|
||||
|
||||
if(NOT LEMON_${LemonTarget}_HDR)
|
||||
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
||||
endif()
|
||||
set_source_files_properties(${RE2C_${RE2CTarget}_OUTPUTS}
|
||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
|
||||
endfunction(ADD_RE2C_LEMON_DEPENDENCY)
|
||||
endif(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||
#============================================================
|
||||
|
||||
set_source_files_properties(${RE2C_${RE2CTarget}_OUTPUTS}
|
||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
|
||||
endmacro(ADD_RE2C_LEMON_DEPENDENCY)
|
||||
endif(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||
#============================================================
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(RE2C REQUIRED_VARS RE2C_EXECUTABLE
|
||||
VERSION_VAR RE2C_VERSION)
|
||||
|
||||
# RE2C_Util.cmake ends here
|
||||
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
# Utility routines for managing generated files with CMake
|
||||
|
||||
macro(MD5 filename md5sum)
|
||||
file(READ "${filename}" RAW_MD5_FILE)
|
||||
string(REGEX REPLACE "\r" "" STRIPPED_MD5_FILE "${RAW_MD5_FILE}")
|
||||
string(MD5 ${md5sum} "${STRIPPED_MD5_FILE}")
|
||||
endmacro(MD5)
|
||||
|
||||
macro(FILEVAR filename var)
|
||||
string(REGEX REPLACE "[^a-zA-Z0-9]" "_" ${var} ${filename})
|
||||
endmacro(FILEVAR)
|
||||
|
||||
macro(VERIFY_FILES filelist warn resultvar)
|
||||
set(${resultvar} 1)
|
||||
foreach(fileitem ${filelist})
|
||||
# Deal with absolute and relative paths a bit differently
|
||||
get_filename_component(ITEM_ABS_PATH "${fileitem}" ABSOLUTE)
|
||||
if("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
|
||||
set(filefullname "${fileitem}")
|
||||
else("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
|
||||
set(filefullname "${CURRENT_SOURCE_DIR}/${fileitem}")
|
||||
endif("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
|
||||
get_filename_component(filename "${fileitem}" NAME)
|
||||
# Got filename components sorted - proceed
|
||||
if(NOT EXISTS ${filefullname})
|
||||
message(FATAL_ERROR "Attempted to verify non-existant file ${filefullname}")
|
||||
endif(NOT EXISTS ${filefullname})
|
||||
FILEVAR(${filename} filevar)
|
||||
if(NOT baseline_${filevar}_md5)
|
||||
message(FATAL_ERROR "No baseline MD5 available for ${filename} - baseline_${filevar}_md5 is not defined")
|
||||
endif(NOT baseline_${filevar}_md5)
|
||||
MD5(${filefullname} ${filevar}_md5)
|
||||
if(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
|
||||
if("${warn}" STREQUAL "1")
|
||||
message("\n${filename} differs from baseline: baseline md5 hash is ${baseline_${filevar}_md5} and current hash is ${${filevar}_md5}\n")
|
||||
endif("${warn}" STREQUAL "1")
|
||||
set(${resultvar} 0)
|
||||
endif(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
|
||||
endforeach(fileitem ${filelist})
|
||||
endmacro(VERIFY_FILES filelist resultvar)
|
||||
|
||||
macro(WRITE_MD5_SUMS filelist outfile)
|
||||
foreach(fileitem ${filelist})
|
||||
# Deal with absolute and relative paths a bit differently
|
||||
get_filename_component(ITEM_ABS_PATH "${fileitem}" ABSOLUTE)
|
||||
if("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
|
||||
set(filefullname "${fileitem}")
|
||||
else("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
|
||||
set(filefullname "${CURRENT_SOURCE_DIR}/${fileitem}")
|
||||
endif("${fileitem}" STREQUAL "${ITEM_ABS_PATH}")
|
||||
get_filename_component(filename "${fileitem}" NAME)
|
||||
# Got filename components sorted - proceed
|
||||
if(NOT EXISTS ${filefullname})
|
||||
message(FATAL_ERROR "Attempted to get MD5 sum of non-existant file ${filefullname}")
|
||||
endif(NOT EXISTS ${filefullname})
|
||||
FILEVAR(${filename} filevar)
|
||||
MD5(${filefullname} ${filevar}_md5)
|
||||
file(APPEND ${outfile} "set(baseline_${filevar}_md5 ${${filevar}_md5})\n")
|
||||
endforeach(fileitem ${filelist})
|
||||
endmacro(WRITE_MD5_SUMS)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -0,0 +1,164 @@
|
||||
# Copyright (c) 2010-2020 United States Government as represented by
|
||||
# the U.S. Army Research Laboratory.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
#
|
||||
# 3. The name of the author may not be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
||||
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
||||
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Define relative install locations. Don't set these if they have already
|
||||
# been set by some other means (like a higher level CMakeLists.txt file
|
||||
# including this one).
|
||||
|
||||
# The location in which to install BRL-CAD executables.
|
||||
if(NOT BIN_DIR)
|
||||
set(BIN_DIR bin)
|
||||
endif(NOT BIN_DIR)
|
||||
|
||||
# Define a relative path that will "reset" a path back to
|
||||
# the point before BIN_DIR was appended. This is primarily
|
||||
# useful when working with generator expressions
|
||||
unset(RBIN_DIR CACHE)
|
||||
set(LBIN_DIR "${BIN_DIR}")
|
||||
while (NOT "${LBIN_DIR}" STREQUAL "")
|
||||
get_filename_component(LBDIR "${LBIN_DIR}" DIRECTORY)
|
||||
set(LBIN_DIR "${LBDIR}")
|
||||
if ("${RBIN_DIR}" STREQUAL "")
|
||||
set(RBIN_DIR "..")
|
||||
else ("${RBIN_DIR}" STREQUAL "")
|
||||
set(RBIN_DIR "../${RBIN_DIR}")
|
||||
endif ("${RBIN_DIR}" STREQUAL "")
|
||||
endwhile (NOT "${LBIN_DIR}" STREQUAL "")
|
||||
|
||||
# The location in which to install BRL-CAD libraries.
|
||||
if(NOT LIB_DIR)
|
||||
set(LIB_DIR lib)
|
||||
endif(NOT LIB_DIR)
|
||||
if(NOT LIBEXEC_DIR)
|
||||
set(LIBEXEC_DIR libexec)
|
||||
endif(NOT LIBEXEC_DIR)
|
||||
|
||||
# The location in which to install BRL-CAD header files.
|
||||
if(NOT INCLUDE_DIR)
|
||||
set(INCLUDE_DIR include)
|
||||
endif(NOT INCLUDE_DIR)
|
||||
|
||||
# The location in which to install BRL-CAD data files
|
||||
if(NOT DATA_DIR)
|
||||
set(DATA_DIR share)
|
||||
endif(NOT DATA_DIR)
|
||||
|
||||
# The location in which to install BRL-CAD documentation files
|
||||
if(NOT DOC_DIR)
|
||||
set(DOC_DIR ${DATA_DIR}/doc)
|
||||
endif(NOT DOC_DIR)
|
||||
|
||||
# The location in which to install BRL-CAD Manual pages
|
||||
if(NOT MAN_DIR)
|
||||
set(MAN_DIR ${DATA_DIR}/man)
|
||||
endif(NOT MAN_DIR)
|
||||
|
||||
# Make sure no absolute paths have been supplied to these variables
|
||||
set(INSTALL_DIRS BIN INCLUDE LIB LIBEXEC DATA MAN DOC)
|
||||
foreach(instdir ${INSTALL_DIRS})
|
||||
get_filename_component(instdir_full ${${instdir}_DIR} ABSOLUTE)
|
||||
if("${${instdir}_DIR}" STREQUAL "${instdir_full}")
|
||||
message(FATAL_ERROR "Error - absolute path supplied for ${instdir}_DIR. This path must be relative - e.g. \"bin\" instead of \"/usr/bin\"")
|
||||
set(HAVE_INSTALL_DIR_FULL_PATH 1)
|
||||
endif("${${instdir}_DIR}" STREQUAL "${instdir_full}")
|
||||
endforeach(instdir ${INSTALL_DIRS})
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Output directories - this is where built library and executable
|
||||
# files will be placed after building but prior to install. The
|
||||
# necessary variables change between single and multi configuration
|
||||
# build systems, so it is necessary to handle both cases on a
|
||||
# conditional basis.
|
||||
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
# If we're not doing multi-configuration, just set the three main
|
||||
# variables to the correct values.
|
||||
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}/${LIB_DIR} CACHE INTERNAL "Single output directory for building all libraries.")
|
||||
endif(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY)
|
||||
if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}/${LIB_DIR} CACHE INTERNAL "Single output directory for building all archives.")
|
||||
endif(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
|
||||
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}/${BIN_DIR} CACHE INTERNAL "Single output directory for building all executables.")
|
||||
endif(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
else(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
# Multi-configuration is more difficult. Not only do we need to
|
||||
# properly set the output directories, but we also need to
|
||||
# identify the "toplevel" directory for each configuration so
|
||||
# we can place files, documentation, etc. in the correct
|
||||
# relative positions. Because files may be placed by CMake
|
||||
# without a build target to put them in their proper relative build
|
||||
# directory position using these paths, we must fully qualify them
|
||||
# without using CMAKE_CFG_INTDIR.
|
||||
#
|
||||
# We define directories that may not be quite "standard"
|
||||
# for a particular build tool - for example, native VS2010 projects use
|
||||
# another directory to denote CPU type being compiled for - but CMake only
|
||||
# supports multi-configuration setups having multiple configurations,
|
||||
# not multiple compilers.
|
||||
#
|
||||
# One additional wrinkle we must watch for here is the case where
|
||||
# a multi-configuration setup uses "." for its internal directory -
|
||||
# if that's the case, we need to just set the various config output
|
||||
# directories to the same value.
|
||||
set(CFG_ROOT ${${PROJECT_NAME}_BINARY_DIR})
|
||||
foreach(CFG_TYPE ${CMAKE_CONFIGURATION_TYPES})
|
||||
if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
|
||||
set(CFG_ROOT ${${PROJECT_NAME}_BINARY_DIR}/${CFG_TYPE})
|
||||
endif(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
|
||||
string(TOUPPER "${CFG_TYPE}" CFG_TYPE_UPPER)
|
||||
if(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
|
||||
set("CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${LIB_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} libraries.")
|
||||
endif(NOT DEFINED CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
|
||||
if(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
|
||||
set("CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${LIB_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} archives.")
|
||||
endif(NOT DEFINED CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
|
||||
if(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
|
||||
set("CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER}" ${CFG_ROOT}/${BIN_DIR} CACHE INTERNAL "Single output directory for building ${CFG_TYPE} executables.")
|
||||
endif(NOT DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFG_TYPE_UPPER})
|
||||
if(NOT DEFINED CMAKE_BINARY_DIR_${CFG_TYPE_UPPER})
|
||||
set("CMAKE_BINARY_DIR_${CFG_TYPE_UPPER}" ${CFG_ROOT} CACHE INTERNAL "Toplevel binary dir for ${CFG_TYPE} building.")
|
||||
endif(NOT DEFINED CMAKE_BINARY_DIR_${CFG_TYPE_UPPER})
|
||||
if(NOT DEFINED ${PROJECT_NAME}_BINARY_DIR_${CFG_TYPE_UPPER})
|
||||
set("${PROJECT_NAME}_BINARY_DIR_${CFG_TYPE_UPPER}" ${CFG_ROOT} CACHE INTERNAL "Toplevel binary dir for ${CFG_TYPE} building.")
|
||||
endif(NOT DEFINED ${PROJECT_NAME}_BINARY_DIR_${CFG_TYPE_UPPER})
|
||||
endforeach()
|
||||
endif(NOT CMAKE_CONFIGURATION_TYPES)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,176 +0,0 @@
|
||||
# BIN and LIB directories
|
||||
if(NOT DEFINED BIN_DIR)
|
||||
set(BIN_DIR bin)
|
||||
endif(NOT DEFINED BIN_DIR)
|
||||
|
||||
if(NOT DEFINED LIB_DIR)
|
||||
set(LIB_DIR lib)
|
||||
endif(NOT DEFINED LIB_DIR)
|
||||
|
||||
# testing and compilation options, build output dirs, install dirs, etc
|
||||
# included by root CMakeLists
|
||||
|
||||
if(NOT DEFINED INCLUDE_INSTALL_DIR)
|
||||
set(INCLUDE_INSTALL_DIR include)
|
||||
endif(NOT DEFINED INCLUDE_INSTALL_DIR)
|
||||
|
||||
if(NOT DEFINED LIB_INSTALL_DIR)
|
||||
set(LIB_INSTALL_DIR lib)
|
||||
endif(NOT DEFINED LIB_INSTALL_DIR)
|
||||
|
||||
if(NOT DEFINED BIN_INSTALL_DIR)
|
||||
set(BIN_INSTALL_DIR bin)
|
||||
endif(NOT DEFINED BIN_INSTALL_DIR)
|
||||
|
||||
if(NOT DEFINED SC_BUILD_TYPE)
|
||||
set(SC_BUILD_TYPE "Debug" CACHE STRING "Build type") # By default set debug build
|
||||
endif(NOT DEFINED SC_BUILD_TYPE)
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
set(CMAKE_BUILD_TYPE ${SC_BUILD_TYPE} CACHE INTERNAL "Build type, immutable" FORCE)
|
||||
else(NOT SC_IS_SUBBUILD)
|
||||
set(CMAKE_BUILD_TYPE ${SC_BUILD_TYPE})
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
|
||||
# Define helper macro OPTION_WITH_DEFAULT
|
||||
macro(OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT)
|
||||
if(NOT DEFINED ${OPTION_NAME})
|
||||
set(${OPTION_NAME} ${OPTION_DEFAULT})
|
||||
endif(NOT DEFINED ${OPTION_NAME})
|
||||
option(${OPTION_NAME} "${OPTION_STRING}" ${${OPTION_NAME}})
|
||||
endmacro(OPTION_WITH_DEFAULT OPTION_NAME OPTION_STRING OPTION_DEFAULT)
|
||||
|
||||
# build shared libs by default
|
||||
OPTION_WITH_DEFAULT(SC_BUILD_SHARED_LIBS "Build shared libs" ON)
|
||||
|
||||
# don't build static libs by default
|
||||
OPTION_WITH_DEFAULT(SC_BUILD_STATIC_LIBS "Build static libs" OFF)
|
||||
|
||||
OPTION_WITH_DEFAULT(SC_PYTHON_GENERATOR "Compile exp2python" ON)
|
||||
OPTION_WITH_DEFAULT(SC_CPP_GENERATOR "Compile exp2cxx" ON)
|
||||
|
||||
OPTION_WITH_DEFAULT(SC_MEMMGR_ENABLE_CHECKS "Enable sc_memmgr's memory leak detection" OFF)
|
||||
OPTION_WITH_DEFAULT(SC_TRACE_FPRINTF "Enable extra comments in generated code so the code's source in exp2cxx may be located" OFF)
|
||||
|
||||
# Should we use C++11?
|
||||
OPTION_WITH_DEFAULT(SC_ENABLE_CXX11 "Build with C++ 11 features" ON)
|
||||
|
||||
# Get version from git
|
||||
OPTION_WITH_DEFAULT(SC_GIT_VERSION "Build using version from git" ON)
|
||||
|
||||
option(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
|
||||
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
|
||||
|
||||
option(DEBUGGING_GENERATED_SOURCES "disable md5 verification of generated sources" OFF)
|
||||
mark_as_advanced(DEBUGGING_GENERATED_SOURCES)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Coverage option
|
||||
OPTION_WITH_DEFAULT(SC_ENABLE_COVERAGE "Enable code coverage test" OFF)
|
||||
if(SC_ENABLE_COVERAGE)
|
||||
set(SC_ENABLE_TESTING ON CACHE BOOL "Testing enabled by coverage option" FORCE)
|
||||
# build static libs, better coverage report
|
||||
set(SC_BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libs" FORCE)
|
||||
set(SC_BUILD_STATIC_LIBS ON CACHE BOOL "Build static libs" FORCE)
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-O0 -g -fprofile-arcs -ftest-coverage" CACHE STRING "Extra compile flags required by code coverage" FORCE)
|
||||
set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage" CACHE STRING "Extra linker flags required by code coverage" FORCE)
|
||||
set(SC_BUILD_TYPE "Debug" CACHE STRING "Build type required by testing framework" FORCE)
|
||||
set(SC_PYTHON_GENERATOR OFF) #won't build with static libs
|
||||
endif(SC_ENABLE_COVERAGE)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Testing option
|
||||
OPTION_WITH_DEFAULT(SC_ENABLE_TESTING "Enable unittesting framework" OFF)
|
||||
if(SC_ENABLE_TESTING)
|
||||
if(NOT ${SC_BUILD_EXPRESS_ONLY} AND NOT DEFINED SC_BUILD_SCHEMAS)
|
||||
set(SC_BUILD_SCHEMAS "ALL") #test all schemas, unless otherwise specified
|
||||
endif()
|
||||
include(CTest)
|
||||
endif(SC_ENABLE_TESTING)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# Executable install option
|
||||
OPTION_WITH_DEFAULT(SC_SKIP_EXEC_INSTALL "Skip installing executables" OFF)
|
||||
if(SC_SKIP_EXEC_INSTALL)
|
||||
set(SC_EXEC_NOINSTALL "NO_INSTALL")
|
||||
endif(SC_SKIP_EXEC_INSTALL)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# The following logic is what allows binaries to run successfully in
|
||||
# the build directory AND install directory. Thanks to plplot for
|
||||
# identifying the necessity of setting CMAKE_INSTALL_NAME_DIR on OSX.
|
||||
# Documentation of these options is available at
|
||||
# http://www.cmake.org/Wiki/CMake_RPATH_handling
|
||||
|
||||
# use, i.e. don't skip the full RPATH for the build tree
|
||||
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
||||
|
||||
# when building, don't use the install RPATH already
|
||||
# (but later on when installing)
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
|
||||
|
||||
# the RPATH/INSTALL_NAME_DIR to be used when installing
|
||||
if (NOT APPLE)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:\$ORIGIN/../lib")
|
||||
endif(NOT APPLE)
|
||||
# On OSX, we need to set INSTALL_NAME_DIR instead of RPATH
|
||||
# http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_INSTALL_NAME_DIR
|
||||
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
# add the automatically determined parts of the RPATH which point to
|
||||
# directories outside the build tree to the install RPATH
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
# When this is a subbuild, assume that the parent project controls all of the following
|
||||
#======================================================================================
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
|
||||
# Output directories. In a separate file so it can be used by the schema scanner CMake as well.
|
||||
include(${SC_CMAKE_DIR}/SC_Outdirs.cmake)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure install locations. Only do this if CMAKE_INSTALL_PREFIX hasn't
|
||||
# been set already, to try and allow parent builds (if any) some control.
|
||||
#
|
||||
# Need a good Debug location for Windows.
|
||||
if(NOT WIN32)
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
|
||||
set(SC_INSTALL_PREFIX "${SC_SOURCE_DIR}/../sc-install")
|
||||
else()
|
||||
set(SC_INSTALL_PREFIX "/usr/local")
|
||||
endif()
|
||||
endif(NOT WIN32)
|
||||
set(SC_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE
|
||||
PATH "Install prefix prepended to target to create install location")
|
||||
set(CMAKE_INSTALL_PREFIX ${SC_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories if target destination is not absolute, immutable" FORCE)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# SC Packaging
|
||||
# $make package
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "STEPcode")
|
||||
set(CPACK_SET_DESTDIR "ON")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR ${SC_VERSION_MAJOR})
|
||||
set(CPACK_PACKAGE_VERSION_MINOR ${SC_VERSION_MINOR})
|
||||
set(CPACK_PACKAGE_NAME SC)
|
||||
set(CPACK_PACKAGE_CONTACT "SC Developers <scl-dev@googlegroups.com>")
|
||||
include(CPack)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Uninstall target
|
||||
# From http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
|
||||
@@ -28,10 +28,8 @@ endmacro(P21_TESTS sfile)
|
||||
macro(SCHEMA_EXES)
|
||||
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
|
||||
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
|
||||
#add_dependencies(p21read_${PROJECT_NAME} version_string)
|
||||
if(NOT WIN32)
|
||||
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils base TESTABLE)
|
||||
#add_dependencies(lazy_${PROJECT_NAME} version_string)
|
||||
endif(NOT WIN32)
|
||||
|
||||
#add user-defined executables
|
||||
@@ -39,7 +37,6 @@ macro(SCHEMA_EXES)
|
||||
get_filename_component(name ${src} NAME_WE)
|
||||
get_filename_component(path ${src} ABSOLUTE)
|
||||
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils base TESTABLE)
|
||||
add_dependencies(${name}_${PROJECT_NAME} version_string)
|
||||
#set_target_properties(${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}")
|
||||
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
|
||||
ENDMACRO(SCHEMA_EXES)
|
||||
@@ -96,7 +93,7 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
|
||||
${SC_SOURCE_DIR}/src/base/judy/src
|
||||
)
|
||||
# if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils base TESTABLE)
|
||||
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
|
||||
if(WIN32)
|
||||
@@ -105,6 +102,12 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
|
||||
target_compile_options("${PROJECT_NAME}" PRIVATE "/bigobj")
|
||||
endif()
|
||||
endif()
|
||||
# TODO - ideally we would avoid generating code that triggers this warning, but figuring out
|
||||
# how to do so is a non-trivial exercise. In the meantime, suppress the (very verbose) warnings
|
||||
# we get due to this issue so it doesn't mask other problems.
|
||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
|
||||
target_compile_options("${PROJECT_NAME}" PRIVATE "-Wno-ignored-qualifiers")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
|
||||
@@ -1,23 +1,4 @@
|
||||
# create sc_cf.h and sc_version_string.h
|
||||
|
||||
# Take the sc config file template as the starting point for
|
||||
# sc_cf.h.in - scripts may need to append to the template, so
|
||||
# it is read into memory initially.
|
||||
set(CONFIG_H_FILE ${SC_BINARY_DIR}/include/sc_cf.h.in)
|
||||
set_source_files_properties(${CONFIG_H_FILE} PROPERTIES GENERATED TRUE)
|
||||
set(CMAKE_CURRENT_PROJECT SC)
|
||||
define_property(GLOBAL PROPERTY SC_CONFIG_H_CONTENTS BRIEF_DOCS "config.h.in contents" FULL_DOCS "config.h.in contents for SC project")
|
||||
if(NOT COMMAND CONFIG_H_APPEND)
|
||||
macro(CONFIG_H_APPEND PROJECT_NAME NEW_CONTENTS)
|
||||
if(PROJECT_NAME)
|
||||
get_property(${PROJECT_NAME}_CONFIG_H_CONTENTS GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS)
|
||||
set(${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS "${${PROJECT_NAME}_CONFIG_H_CONTENTS}${NEW_CONTENTS}")
|
||||
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_CONFIG_H_CONTENTS "${${PROJECT_NAME}_CONFIG_H_FILE_CONTENTS}")
|
||||
endif(PROJECT_NAME)
|
||||
endmacro(CONFIG_H_APPEND NEW_CONTENTS)
|
||||
endif(NOT COMMAND CONFIG_H_APPEND)
|
||||
file(READ ${SC_SOURCE_DIR}/include/sc_cf_cmake.h.in CONFIG_H_FILE_CONTENTS)
|
||||
CONFIG_H_APPEND(SC "${CONFIG_H_FILE_CONTENTS}")
|
||||
# create sc_cf.h
|
||||
|
||||
include(CheckLibraryExists)
|
||||
include(CheckIncludeFile)
|
||||
@@ -97,36 +78,8 @@ int main() {return !(f() == f());}
|
||||
endif(SC_ENABLE_CXX11)
|
||||
|
||||
# Now that all the tests are done, configure the sc_cf.h file:
|
||||
get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SC_CONFIG_H_CONTENTS)
|
||||
file(WRITE ${CONFIG_H_FILE} "${CONFIG_H_FILE_CONTENTS}")
|
||||
configure_file(${CONFIG_H_FILE} ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h)
|
||||
|
||||
# ------------------------
|
||||
|
||||
# create sc_version_string.h, http://stackoverflow.com/questions/3780667
|
||||
# Using 'ver_string' instead of 'sc_version_string.h' is a trick to force the
|
||||
# command to always execute when the custom target is built. It works because
|
||||
# a file by that name never exists.
|
||||
if(SC_GIT_VERSION)
|
||||
configure_file(${SC_CMAKE_DIR}/sc_version_string.cmake ${SC_BINARY_DIR}/sc_version_string.cmake @ONLY)
|
||||
add_custom_target(version_string ALL DEPENDS ver_string)
|
||||
# creates sc_version_string.h using cmake script
|
||||
add_custom_command(OUTPUT ver_string
|
||||
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SC_SOURCE_DIR} -DBINARY_DIR=${SC_BINARY_DIR} -P ${SC_BINARY_DIR}/sc_version_string.cmake
|
||||
)
|
||||
# sc_version_string.h is a generated file
|
||||
else(SC_GIT_VERSION)
|
||||
set(VER_HDR "
|
||||
#ifndef SC_VERSION_STRING
|
||||
#define SC_VERSION_STRING
|
||||
static char sc_version[512] = {\"${SC_VERSION}\"};
|
||||
#endif"
|
||||
)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h "${VER_HDR}")
|
||||
endif(SC_GIT_VERSION)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
|
||||
PROPERTIES GENERATED TRUE
|
||||
HEADER_FILE_ONLY TRUE )
|
||||
configure_file(${CMAKE_SOURCE_DIR}/include/sc_cf.h.in ${SC_BINARY_DIR}/${INCLUDE_DIR}/sc_cf.h.gen)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SC_BINARY_DIR}/${INCLUDE_DIR}/sc_cf.h.gen ${SC_BINARY_DIR}/${INCLUDE_DIR}/sc_cf.h)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
+18
-25
@@ -1,4 +1,4 @@
|
||||
# The Express parser uses the tools Perplex, RE2C and Lemon to generate code
|
||||
# The Express parser uses the tools RE2C and Lemon to generate code
|
||||
# from higher level inputs. Depending on available tools and options, the
|
||||
# SC build can either re-generate code as part of the build, or use cached
|
||||
# files that are ready for compilation.
|
||||
@@ -10,45 +10,38 @@
|
||||
# this option is set to ON and the necessary tools are not found, the
|
||||
# configure step will fail. If it is set to OFF, SC will not even try to use
|
||||
# the generators and will instead use the cached sources.
|
||||
if(NOT DEFINED SC_GENERATE_LEXER_PARSER)
|
||||
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
|
||||
set(_verbosity "QUIET")
|
||||
else(NOT DEFINED SC_GENERATE_LEXER_PARSER)
|
||||
string(TOUPPER "${SC_GENERATE_LEXER_PARSER}" SC_GENERATE_LEXER_PARSER)
|
||||
endif(NOT DEFINED SC_GENERATE_LEXER_PARSER)
|
||||
set_property(CACHE SC_GENERATE_LEXER_PARSER PROPERTY STRINGS AUTO ON OFF)
|
||||
if (NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
|
||||
|
||||
set(_valid_gen_states AUTO ON OFF)
|
||||
set(_verbosity "QUIET")
|
||||
|
||||
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE
|
||||
STRING "Use Perplex, RE2C and Lemon to generate C source code.")
|
||||
set_property(CACHE SC_GENERATE_LEXER_PARSER PROPERTY STRINGS ${_valid_gen_states})
|
||||
string(TOUPPER "${SC_GENERATE_LEXER_PARSER}" SC_GENERATE_LEXER_PARSER)
|
||||
|
||||
if(NOT "${SC_GENERATE_LEXER_PARSER}" IN_LIST _valid_gen_states)
|
||||
message(WARNING "Unknown value ${SC_GENERATE_LEXER_PARSER} supplied for SC_GENERATE_LEXER_PARSER - defaulting to AUTO")
|
||||
message(WARNING "Valid options are AUTO, ON and OFF")
|
||||
set(SC_GENERATE_LEXER_PARSER "AUTO" CACHE STRING "Use Perplex, RE2C and Lemon to generate C source code.")
|
||||
endif (NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "AUTO" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON" AND NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
|
||||
endif()
|
||||
|
||||
# If the generators have not been turned off, we need to check for them
|
||||
if(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
|
||||
# NOTE: lemon doesn't have a stable versioning system (it's always 1)
|
||||
find_package(LEMON ${_verbosity})
|
||||
find_package(RE2C ${_verbosity})
|
||||
find_package(PERPLEX ${_verbosity})
|
||||
if(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
|
||||
# Templates may be anywhere - make sure we have a stable path if a relative
|
||||
# path was specified at CMake time
|
||||
get_filename_component(lemon_template_fpath "${LEMON_TEMPLATE}" ABSOLUTE)
|
||||
if(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
|
||||
get_filename_component(LEMON_TEMPLATE "${CMAKE_BINARY_DIR}/${LEMON_TEMPLATE}" ABSOLUTE)
|
||||
endif(NOT "${lemon_template_fpath}" STREQUAL "${LEMON_TEMPLATE}")
|
||||
get_filename_component(perplex_template_fpath "${PERPLEX_TEMPLATE}" ABSOLUTE)
|
||||
if(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
|
||||
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
|
||||
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
|
||||
|
||||
if(LEMON_FOUND AND RE2C_FOUND)
|
||||
set(SC_GENERATE_LP_SOURCES 1)
|
||||
message(".. Found perplex, re2c, and lemon - can regenerate lexer/parser if necessary")
|
||||
else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
|
||||
message(".. Found re2c, and lemon - can regenerate lexer/parser if necessary")
|
||||
else()
|
||||
if("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
|
||||
message(FATAL_ERROR "\nSC_GENERATE_LEXER_PARSER set to ON, but one or more components of the Perplex/RE2C/Lemon toolchain were not found.\n")
|
||||
message(FATAL_ERROR "\nSC_GENERATE_LEXER_PARSER set to ON, but couldn't find lemon/re2c")
|
||||
else("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
|
||||
set(SC_GENERATE_LP_SOURCES 0)
|
||||
endif("${SC_GENERATE_LEXER_PARSER}" STREQUAL "ON")
|
||||
endif(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
|
||||
endif()
|
||||
else(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
|
||||
set(SC_GENERATE_LP_SOURCES 0)
|
||||
endif(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
|
||||
|
||||
@@ -46,7 +46,11 @@ macro(SC_ADDLIB _addlib_target)
|
||||
|
||||
if(${_arg_prefix}_SHARED)
|
||||
add_library(${_addlib_target} SHARED ${${_arg_prefix}_SOURCES})
|
||||
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_ABI_VERSION} SOVERSION ${SC_ABI_SOVERSION})
|
||||
if(OPENBSD)
|
||||
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_VERSION_MAJOR}.${SC_VERSION_MINOR})
|
||||
else(OPENBSD)
|
||||
set_target_properties(${_addlib_target} PROPERTIES VERSION ${SC_VERSION} SOVERSION ${SC_VERSION_MAJOR})
|
||||
endif(OPENBSD)
|
||||
if(APPLE)
|
||||
set_target_properties(${_addlib_target} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||
endif(APPLE)
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# Inherit the parent CMake setting
|
||||
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
|
||||
set(CURRENT_BINARY_DIR @CMAKE_CURRENT_BINARY_DIR@)
|
||||
|
||||
# Define a variety of convenience routines
|
||||
include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)
|
||||
|
||||
# The following steps are executed to sync generated sources:
|
||||
#
|
||||
# 1. Create a new verification_info.cmake file and populate
|
||||
# it with the MD5 sums for current files.
|
||||
#
|
||||
# 2. Overwrite the original cached verification_info.cmake
|
||||
# and generated files with the new ones. If LOCKED_SOURCE_DIR
|
||||
# is ON, this step will not be carried out - instead, an
|
||||
# informational message with manual updating instructions
|
||||
# will be printed.
|
||||
|
||||
set(new_info_file "${CURRENT_BINARY_DIR}/verification_info.cmake")
|
||||
|
||||
|
||||
file(WRITE ${new_info_file} "# Autogenerated verification information\n")
|
||||
|
||||
# Handle input files
|
||||
set(input_files "@MD5_FILELIST@")
|
||||
WRITE_MD5_SUMS("${input_files}" "${new_info_file}")
|
||||
|
||||
message("New verification file created: ${new_info_file}")
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,30 +0,0 @@
|
||||
# Inherit the parent CMake setting
|
||||
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
|
||||
set(CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
||||
|
||||
# Include the file the provides the baseline against which
|
||||
# current files will be compared
|
||||
|
||||
include("@BASELINE_INFORMATION_FILE@")
|
||||
|
||||
# Define a variety of convenience routines
|
||||
include("@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake")
|
||||
|
||||
# Individually verify all of the files in question.
|
||||
set(filelist "@MD5_FILELIST@")
|
||||
VERIFY_FILES("${filelist}" 1 srcs_pass)
|
||||
if(NOT srcs_pass)
|
||||
if(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
message(FATAL_ERROR "Sources have been modified and md5 sums have not been updated. This generally indicates either\n a) an input file has been modified but generated files have not been updated, or\n b) genenerated files have been edited directly.\nTo clear the error:\n a) Copy the new generated sources from the build directory to the generated/ sources directory, use the <target>_md5gen build target to create a new verifictation_info.cmake file, and copy verfication_info.cmake to generated/ as well.\n b) install Perplex/Re2C/LEMON and make the changes to the input file rather than the generated file.\nNote:\n If this is a debugging situation where multiple sequential tests must be conducted, temporarily set the variable DEBUGGING_GENERATED_SOURCES to ON during the CMake configure to disable this check.\nThis measure is necessary to ensure that compilations using either Perplex/Re2C/LEMON generation or the cached outputs of those tools produce consistent results.")
|
||||
else(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
message(WARNING "Note: Sources have been modified and md5 sums have not been updated - build failure condition temporarily overridden by DEBUGGING_GENERATED_SOURCES setting.")
|
||||
endif(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
endif(NOT srcs_pass)
|
||||
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,84 +0,0 @@
|
||||
# creates sc_version_string.h, which defines sc_version()
|
||||
# sc_version() returns a pretty commit description and a build timestamp.
|
||||
|
||||
# only update the file if the git commit has changed, because whenever the file is updated files including the header must rebuild
|
||||
# parallel rebuilds can result in race conditions and failures, particularly when running ctest in parallel
|
||||
|
||||
# http://stackoverflow.com/questions/3780667
|
||||
# http://www.cmake.org/pipermail/cmake/2009-February/027014.html
|
||||
|
||||
set(SC_IS_SUBBUILD "@SC_IS_SUBBUILD@")
|
||||
set(SC_ENABLE_TESTING "@SC_ENABLE_TESTING@")
|
||||
|
||||
set(SC_VERSION_HEADER "${BINARY_DIR}/include/sc_version_string.h")
|
||||
|
||||
#---------- find commit id ------------------
|
||||
#use git for a pretty commit id
|
||||
#uses 'git describe --tags', so tags are required in the repo
|
||||
#create a tag with 'git tag <name>' and 'git push --tags'
|
||||
#if git can't be found, uses contents of SC_VERSION.txt
|
||||
|
||||
set(VERS_FILE ${SOURCE_DIR}/SC_VERSION.txt)
|
||||
if(EXISTS ${SOURCE_DIR}/.git)
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND)
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} describe --tags WORKING_DIRECTORY ${SOURCE_DIR}
|
||||
RESULT_VARIABLE res_var OUTPUT_VARIABLE GIT_COMMIT_ID)
|
||||
if(NOT ${res_var} EQUAL 0)
|
||||
file(READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255)
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
message(WARNING "Git failed (probably no tags in repo). Build will contain revision info from ${VERS_FILE}.")
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
endif()
|
||||
else(GIT_FOUND)
|
||||
file(READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255)
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
message(WARNING "Git not found. Build will contain revision info from ${VERS_FILE}.")
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
endif(GIT_FOUND)
|
||||
else()
|
||||
file(READ ${VERS_FILE} GIT_COMMIT_ID LIMIT 255)
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
message(WARNING "Git failed ('.git' not found). Build will contain revision info from ${VERS_FILE}.")
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
endif()
|
||||
string(REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID})
|
||||
|
||||
#-------------- date and time ---------------
|
||||
|
||||
if(SC_ENABLE_TESTING)
|
||||
set (date_time_string "NA - disabled for testing")
|
||||
else()
|
||||
string(TIMESTAMP date_time_string UTC)
|
||||
endif()
|
||||
|
||||
set(header_string "/* sc_version_string.h - written by cmake. Changes will be lost! */\n"
|
||||
"#ifndef SC_VERSION_STRING\n"
|
||||
"#define SC_VERSION_STRING\n\n"
|
||||
"/*\n** The git commit id looks like \"test-1-g5e1fb47\", where test is the\n"
|
||||
"** name of the last tagged git revision, 1 is the number of commits since that tag,\n"
|
||||
"** 'g' is unknown, and 5e1fb47 is the first 7 chars of the git sha1 commit id.\n"
|
||||
"** timestamp is created from date/time commands on known platforms, and uses\n"
|
||||
"** preprocessor macros elsewhere.\n*/\n\n"
|
||||
"static char sc_version[512] = {\n"
|
||||
" \"git commit id: ${GIT_COMMIT_ID}, build timestamp ${date_time_string}\"\n"
|
||||
"}\;\n\n"
|
||||
"#endif\n"
|
||||
)
|
||||
|
||||
#don't update the file unless something changed
|
||||
string(RANDOM tmpsuffix)
|
||||
file(WRITE ${SC_VERSION_HEADER}.${tmpsuffix} ${header_string})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SC_VERSION_HEADER}.${tmpsuffix} ${SC_VERSION_HEADER})
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${SC_VERSION_HEADER}.${tmpsuffix})
|
||||
|
||||
if(NOT SC_IS_SUBBUILD)
|
||||
message("-- sc_version_string.h is up-to-date.")
|
||||
endif(NOT SC_IS_SUBBUILD)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
@@ -1,5 +1,5 @@
|
||||
project(SC_SUBPROJECT_SCHEMA_SCANNER)
|
||||
cmake_minimum_required(VERSION 3.6.3)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
if(NOT ("${CALLED_FROM}" STREQUAL "STEPCODE_CMAKELISTS" AND DEFINED SC_ROOT AND DEFINED SC_BUILDDIR))
|
||||
message(" ${CALLED_FROM} ${SC_ROOT} ${SC_BUILDDIR}")
|
||||
|
||||
@@ -71,9 +71,9 @@ message( STATUS "Schema scanner built. Running it...")
|
||||
|
||||
# not sure if it makes sense to install this or not...
|
||||
if(WIN32)
|
||||
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner.exe DESTINATION ${BIN_INSTALL_DIR})
|
||||
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner.exe DESTINATION ${BIN_DIR})
|
||||
else(WIN32)
|
||||
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner DESTINATION ${BIN_INSTALL_DIR})
|
||||
install(PROGRAMS ${SCANNER_OUT_DIR}/schema_scanner DESTINATION ${BIN_DIR})
|
||||
endif(WIN32)
|
||||
|
||||
# macro SCHEMA_CMLIST
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
# Inherit the parent CMake setting
|
||||
set(CURRENT_SOURCE_DIR @CMAKE_CURRENT_SOURCE_DIR@)
|
||||
set(CURRENT_BINARY_DIR @CMAKE_CURRENT_BINARY_DIR@)
|
||||
set(CACHED_FILES_DIR @CACHED_FILES_DIR@)
|
||||
set(LEMON_EXECUTABLE @LEMON_EXECUTABLE@)
|
||||
set(RE2C_EXECUTABLE @RE2C_EXECUTABLE@)
|
||||
set(PERPLEX_EXECUTABLE @PERPLEX_EXECUTABLE@)
|
||||
set(LOCKED_SOURCE_DIR @LOCKED_SOURCE_DIR@)
|
||||
set(DEBUGGING_GENERATED_SOURCES @DEBUGGING_GENERATED_SOURCES@)
|
||||
|
||||
if(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
# Define a variety of convenience routines
|
||||
include(@PROJECT_CMAKE_DIR@/Generated_Source_Utils.cmake)
|
||||
|
||||
# The following steps are executed to sync generated sources:
|
||||
#
|
||||
# 1. Create a new verification_info.cmake file and populate
|
||||
# it with the current versions of perplex, re2c and lemon.
|
||||
# Also add the MD5 sums for current template files.
|
||||
#
|
||||
# 2. For all files that need to be updated in the cache,
|
||||
# calculate new MD5 sums and add them to the new
|
||||
# verification_info.cmake - this is usually the input
|
||||
# files and the generated outputs.
|
||||
#
|
||||
# 3. Overwrite the original cached verification_info.cmake
|
||||
# and generated files with the new ones. If LOCKED_SOURCE_DIR
|
||||
# is ON, this step will not be carried out - instead, an
|
||||
# informational message with manual updating instructions
|
||||
# will be printed.
|
||||
|
||||
set(new_info_file "${CURRENT_BINARY_DIR}/verification_info.cmake.new")
|
||||
|
||||
|
||||
file(WRITE ${new_info_file} "# Autogenerated verification information\n")
|
||||
|
||||
# Handle generator version numbers
|
||||
GET_GENERATOR_EXEC_VERSIONS()
|
||||
file(APPEND ${new_info_file} "set(baseline_lemon_version \"${lemon_version}\")\n")
|
||||
file(APPEND ${new_info_file} "set(baseline_re2c_version \"${re2c_version}\")\n")
|
||||
file(APPEND ${new_info_file} "set(baseline_perplex_version \"${perplex_version}\")\n")
|
||||
|
||||
# Handle template files
|
||||
set(template_files "@TEMPLATE_FILELIST@")
|
||||
WRITE_MD5_SUMS("${template_files}" "${new_info_file}")
|
||||
|
||||
# Handle input files
|
||||
set(input_files "@INPUT_FILELIST@")
|
||||
WRITE_MD5_SUMS("${input_files}" "${new_info_file}")
|
||||
|
||||
# Handle generated files
|
||||
set(output_files "@BUILD_OUTPUT_FILELIST@")
|
||||
WRITE_MD5_SUMS("${output_files}" "${new_info_file}")
|
||||
|
||||
# Copy files into their final locations
|
||||
if(NOT LOCKED_SOURCE_DIR)
|
||||
configure_file(${new_info_file} "${CACHED_FILES_DIR}/verification_info.cmake" COPYONLY)
|
||||
foreach(outf ${output_files})
|
||||
get_filename_component(filecorename ${outf} NAME)
|
||||
message("copying ${outf} to ${CACHED_FILES_DIR}/${filecorename}")
|
||||
configure_file(${outf} "${CACHED_FILES_DIR}/${filecorename}" COPYONLY)
|
||||
endforeach(outf ${output_files})
|
||||
else(NOT LOCKED_SOURCE_DIR)
|
||||
message("Source directory writing is locked - LOCKED_SOURCE_DIR is set.")
|
||||
message("To update the generated files, manually copy the following to ${CACHED_FILES_DIR}:")
|
||||
message(" ${new_info_file} (rename to verification_info.cmake)")
|
||||
foreach(outf ${output_files})
|
||||
message(" ${outf}")
|
||||
endforeach(outf ${output_files})
|
||||
endif(NOT LOCKED_SOURCE_DIR)
|
||||
|
||||
else(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
|
||||
message("\nNote: DEBUGGING_GENERATED_SOURCES is enabled - generated outputs will contain configuration-specific debugging information, so syncing cached output files is not possible. To restore normal behavior, disable DEBUGGING_GENERATED_SOURCES.\n")
|
||||
|
||||
endif(NOT DEBUGGING_GENERATED_SOURCES)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
# mode: cmake
|
||||
# indent-tabs-mode: t
|
||||
# End:
|
||||
# ex: shiftwidth=2 tabstop=8
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
# .exp file inside, which it uses. otherwise, ${path} is assumed to
|
||||
# be an express file.
|
||||
|
||||
if(NOT ${SC_BUILD_EXPRESS_ONLY} AND NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
|
||||
if(NOT "${SC_BUILD_EXPRESS_ONLY}" AND NOT "${SC_BUILD_SCHEMAS}" STREQUAL "")
|
||||
include(${SC_CMAKE_DIR}/schema_scanner/schemaScanner.cmake)
|
||||
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
|
||||
get_filename_component(name ${src} NAME_WE)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# for the use of this file.
|
||||
#
|
||||
project(AP203Minimum)
|
||||
cmake_minimum_required(VERSION 3.6.3)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
# Set STEPCODE_ROOT_DIR to point to the root of the STEPcode source tree.
|
||||
if(NOT DEFINED STEPCODE_ROOT_DIR)
|
||||
@@ -14,14 +14,14 @@ if(NOT DEFINED STEPCODE_ROOT_DIR)
|
||||
endif(NOT DEFINED STEPCODE_ROOT_DIR)
|
||||
|
||||
# STEPCODE_ROOT_DIR is relative or absolute path?
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
|
||||
if(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/src/express/express.c")
|
||||
set(STEPCODE_ROOT_DIR "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}")
|
||||
message("** STEPCODE_ROOT_DIR is a relative path; converted to absolute path: ${STEPCODE_ROOT_DIR}.")
|
||||
else()
|
||||
if(NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
|
||||
if(NOT EXISTS "${STEPCODE_ROOT_DIR}/src/express/express.c")
|
||||
message(FATAL_ERROR "**** Cannot locate STEPCODE_ROOT_DIR - try an absolute path.")
|
||||
endif(NOT EXISTS "${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
|
||||
endif(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/SC_VERSION.txt")
|
||||
endif(NOT EXISTS "${STEPCODE_ROOT_DIR}/src/express/express.c")
|
||||
endif(EXISTS "${CMAKE_BINARY_DIR}/${STEPCODE_ROOT_DIR}/src/express/express.c")
|
||||
|
||||
|
||||
# Use STEPcode as library, but build from this build process.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# for the use of this file.
|
||||
#
|
||||
project(AP203Minimum)
|
||||
cmake_minimum_required(VERSION 3.6.3)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
INCLUDE( ExternalProject )
|
||||
|
||||
|
||||
@@ -22,8 +22,3 @@ ENDIF()
|
||||
|
||||
SET( STEPCODE_BINARY_DIR ${BINARY_DIR} )
|
||||
|
||||
# SC CMake does not honor -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
||||
# Consequently, force Debug so it installs in ../sc-install directory
|
||||
# instead of /usr/local/lib.
|
||||
#
|
||||
# SC's own programs fail to build with -DSC_BUILD_SHARED_LIBS=OFF
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef SCL_CF_H
|
||||
#define SCL_CF_H
|
||||
|
||||
/**** Define statements for CMake ****/
|
||||
#cmakedefine SC_VERSION "@SC_VERSION@"
|
||||
#cmakedefine HAVE_NDIR_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
#cmakedefine HAVE_SYSENT_H 1
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
#cmakedefine HAVE_DIRENT_H 1
|
||||
#cmakedefine HAVE_STDBOOL_H 1
|
||||
#cmakedefine HAVE_PROCESS_H 1
|
||||
#cmakedefine HAVE_IO_H 1
|
||||
|
||||
#cmakedefine SC_TRACE_FPRINTF 1
|
||||
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
|
||||
|
||||
#cmakedefine HAVE_ABS 1
|
||||
#cmakedefine HAVE_MEMCPY 1
|
||||
#cmakedefine HAVE_MEMMOVE 1
|
||||
#cmakedefine HAVE_GETOPT 1
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
|
||||
#cmakedefine HAVE_SSIZE_T 1
|
||||
|
||||
#cmakedefine HAVE_STD_THREAD 1
|
||||
#cmakedefine HAVE_STD_CHRONO 1
|
||||
#cmakedefine HAVE_NULLPTR 1
|
||||
|
||||
#endif /* SCL_CF_H */
|
||||
@@ -22,22 +22,21 @@ set(express_HDRS
|
||||
express/variable.h
|
||||
)
|
||||
install(FILES ${express_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/express)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/express)
|
||||
|
||||
set(exppp_HDRS
|
||||
exppp/exppp.h
|
||||
)
|
||||
install(FILES ${exppp_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/exppp)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/exppp)
|
||||
|
||||
install(FILES ordered_attrs.h
|
||||
sc_export.h
|
||||
sc_stdbool.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode)
|
||||
|
||||
install(FILES ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h
|
||||
${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode)
|
||||
install(FILES ${SC_BINARY_DIR}/${INCLUDE_DIR}/sc_cf.h
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -225,7 +225,7 @@ extern SC_EXPRESS_EXPORT void ERRORset_all_warnings( bool );
|
||||
extern SC_EXPRESS_EXPORT void ERRORsafe( jmp_buf env );
|
||||
extern SC_EXPRESS_EXPORT void ERRORunsafe( void );
|
||||
|
||||
extern char * ERRORget_warnings_help(const char* prefix, const char *eol);
|
||||
extern bool ERRORis_enabled(enum ErrorCode errnum);
|
||||
extern SC_EXPRESS_EXPORT char * ERRORget_warnings_help(const char* prefix, const char *eol);
|
||||
extern SC_EXPRESS_EXPORT bool ERRORis_enabled(enum ErrorCode errnum);
|
||||
|
||||
#endif /* ERROR_H */
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef __FACTORY_H_
|
||||
#define __FACTORY_H_
|
||||
|
||||
void FACTORYinitialize();
|
||||
#include "sc_export.h"
|
||||
|
||||
SC_EXPRESS_EXPORT void FACTORYinitialize();
|
||||
|
||||
#endif /* __FACTORY_H_ */
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef __MEMORY_H
|
||||
#define __MEMORY_H
|
||||
|
||||
void MEMORYinitialize();
|
||||
#include "sc_export.h"
|
||||
|
||||
SC_EXPRESS_EXPORT void MEMORYinitialize();
|
||||
|
||||
#endif // __MEMORY_H
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef SCL_CF_H
|
||||
#define SCL_CF_H
|
||||
|
||||
/**** Define statements for CMake ****/
|
||||
#cmakedefine SC_VERSION "@SC_VERSION@"
|
||||
#cmakedefine HAVE_NDIR_H 1
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
#cmakedefine HAVE_SYS_PARAM_H 1
|
||||
#cmakedefine HAVE_SYSENT_H 1
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
#cmakedefine HAVE_DIRENT_H 1
|
||||
#cmakedefine HAVE_STDBOOL_H 1
|
||||
#cmakedefine HAVE_PROCESS_H 1
|
||||
#cmakedefine HAVE_IO_H 1
|
||||
|
||||
#cmakedefine SC_TRACE_FPRINTF 1
|
||||
#cmakedefine SC_MEMMGR_ENABLE_CHECKS 1
|
||||
|
||||
#cmakedefine HAVE_ABS 1
|
||||
#cmakedefine HAVE_MEMCPY 1
|
||||
#cmakedefine HAVE_MEMMOVE 1
|
||||
#cmakedefine HAVE_GETOPT 1
|
||||
#cmakedefine HAVE_VSNPRINTF 1
|
||||
|
||||
#cmakedefine HAVE_SSIZE_T 1
|
||||
|
||||
#cmakedefine HAVE_STD_THREAD 1
|
||||
#cmakedefine HAVE_STD_CHRONO 1
|
||||
#cmakedefine HAVE_NULLPTR 1
|
||||
|
||||
#endif /* SCL_CF_H */
|
||||
@@ -26,6 +26,5 @@
|
||||
|
||||
#cmakedefine HAVE_STD_THREAD 1
|
||||
#cmakedefine HAVE_STD_CHRONO 1
|
||||
#cmakedefine HAVE_NULLPTR 1
|
||||
|
||||
#endif /* SCL_CF_H */
|
||||
|
||||
@@ -1,330 +0,0 @@
|
||||
//summarize MSVC errors from an appveyor log
|
||||
// compile with 'go build summarize-appveyor-log.go'
|
||||
// takes 0 or 1 args; with 0, gets log from latest
|
||||
// build. with 1, uses that file as raw json-like log
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"os"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
headerKey = "Authorization"
|
||||
headerVal = "Bearer %s"
|
||||
projUrl = "https://ci.appveyor.com/api/projects/mpictor/stepcode"
|
||||
//"https://ci.appveyor.com/api/buildjobs/2rjxdv1rnb8jcg8y/log"
|
||||
logUrl = "https://ci.appveyor.com/api/buildjobs/%s/log"
|
||||
consoleUrl = "https://ci.appveyor.com/api/buildjobs/%s/console"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var rawlog io.ReadCloser
|
||||
var build string
|
||||
var err error
|
||||
if len(os.Args) == 2 {
|
||||
rawlog, build, err = processArgv()
|
||||
} else {
|
||||
rawlog, build, err = getLog()
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
return
|
||||
}
|
||||
defer rawlog.Close()
|
||||
log := decodeConsole(rawlog)
|
||||
warns, errs := countMessages(log)
|
||||
fi, err := os.Create(fmt.Sprintf("appveyor-%s.smy", build))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
|
||||
return
|
||||
}
|
||||
printMessages("error", errs, fi)
|
||||
printMessages("warning", warns, fi)
|
||||
|
||||
fmt.Printf("done\n")
|
||||
|
||||
}
|
||||
|
||||
/* categorizes warnings and errors based upon the MSVC message number (i.e. C4244)
|
||||
* the regex will match lines like
|
||||
c:\projects\stepcode\src\base\sc_benchmark.h(45): warning C4251: 'benchmark::descr' : class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'benchmark' [C:\projects\STEPcode\build\src\base\base.vcxproj]
|
||||
[00:03:48] C:\projects\STEPcode\src\base\sc_benchmark.cc(61): warning C4244: '=' : conversion from 'SIZE_T' to 'long', possible loss of data [C:\projects\STEPcode\build\src\base\base.vcxproj]*
|
||||
*/
|
||||
func countMessages(log []string) (warns, errs map[string][]string) {
|
||||
warns = make(map[string][]string)
|
||||
errs = make(map[string][]string)
|
||||
fname := " *(.*)" // $1
|
||||
fline := `(?:\((\d+)\)| ): ` // $2 - either line number in parenthesis or a space, followed by a colon
|
||||
msgNr := `([A-Z]+\d+): ` // $3 - C4251, LNK2005, etc
|
||||
msgTxt := `([^\[]*) ` // $4
|
||||
tail := `\[[^\[\]]*\]`
|
||||
warnRe := regexp.MustCompile(fname + fline + `warning ` + msgNr + msgTxt + tail)
|
||||
errRe := regexp.MustCompile(fname + fline + `(?:fatal )?error ` + msgNr + msgTxt + tail)
|
||||
for _, line := range log {
|
||||
if warnRe.MatchString(line) {
|
||||
key := warnRe.ReplaceAllString(line, "$3")
|
||||
path := strings.ToLower(warnRe.ReplaceAllString(line, "$1:$2"))
|
||||
arr := warns[key]
|
||||
if arr == nil {
|
||||
arr = make([]string, 5)
|
||||
//detailed text as first string in array
|
||||
text := warnRe.ReplaceAllString(line, "$4")
|
||||
arr[0] = fmt.Sprintf("%s", text)
|
||||
}
|
||||
//eliminate duplicates
|
||||
match := false
|
||||
for _, l := range arr {
|
||||
if l == path {
|
||||
match = true
|
||||
}
|
||||
}
|
||||
if !match {
|
||||
warns[key] = append(arr, path)
|
||||
}
|
||||
} else if errRe.MatchString(line) {
|
||||
key := errRe.ReplaceAllString(line, "$3")
|
||||
path := strings.ToLower(errRe.ReplaceAllString(line, "$1:$2"))
|
||||
arr := errs[key]
|
||||
if arr == nil {
|
||||
arr = make([]string, 5)
|
||||
//detailed text as first string in array
|
||||
text := errRe.ReplaceAllString(line, "$4")
|
||||
arr[0] = fmt.Sprintf("%s", text)
|
||||
}
|
||||
//eliminate duplicates
|
||||
match := false
|
||||
for _, l := range arr {
|
||||
if l == path {
|
||||
match = true
|
||||
}
|
||||
}
|
||||
if !match {
|
||||
errs[key] = append(arr, path)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func printMessages(typ string, m map[string][]string, w io.Writer) {
|
||||
//sort keys
|
||||
keys := make([]string, 0, len(m))
|
||||
for key := range m {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
sort.Strings(keys)
|
||||
for _, k := range keys {
|
||||
for i, l := range m[k] {
|
||||
//first string is an example, not a location
|
||||
if i == 0 {
|
||||
fmt.Fprintf(w, "%s %s (i.e. \"%s\")\n", typ, k, l)
|
||||
} else if len(l) > 1 { //not sure where blank lines are coming from...
|
||||
fmt.Fprintf(w, " >> %s\n", l)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//structs from http://json2struct.mervine.net/
|
||||
|
||||
//{"values":[{"i":0,"t":"Specify a project or solution file. The directory does not contain a project or solution file.\r\n","dt":"00:00:04","bg":12,"fg":15}]}
|
||||
type AppVeyorConsoleLines struct {
|
||||
Values []struct {
|
||||
I int `json:"i"`
|
||||
Text string `json:"t"`
|
||||
DateTime string `json:"dt"`
|
||||
BgColor int `json:"bg"`
|
||||
FgColor int `json:"fg"`
|
||||
}
|
||||
}
|
||||
type AppVeyorBuild struct {
|
||||
Build struct {
|
||||
/*BuildNumber int `json:"buildNumber"`*/
|
||||
Version string `json:"version"`
|
||||
Jobs []struct {
|
||||
JobID string `json:"jobId"`
|
||||
} `json:"jobs"`
|
||||
} `json:"build"`
|
||||
}
|
||||
|
||||
func splitAppend(log *[]string, blob string) {
|
||||
//blob = strings.Replace(blob,"\r\n", "\n",-1)
|
||||
blob = strings.Replace(blob, "\\", "/", -1)
|
||||
r := strings.NewReader(blob)
|
||||
unwrapScanner := bufio.NewScanner(r)
|
||||
for unwrapScanner.Scan() {
|
||||
txt := unwrapScanner.Text()
|
||||
//fmt.Printf("%s\n", txt)
|
||||
*log = append(*log, txt)
|
||||
}
|
||||
}
|
||||
|
||||
//calculate length of string without escape chars
|
||||
// func escapeLen(s string)(l int) {
|
||||
// //s = strings.Replace(s,"\\\\", "/",-1)
|
||||
// s = strings.Replace(s,"\\\"", "",-1)
|
||||
// s = strings.Replace(s,"\r\n", "RN",-1)
|
||||
// return len(s)
|
||||
// }
|
||||
|
||||
|
||||
//decode the almost-JSON console data from appveyor
|
||||
func decodeConsole(r io.Reader) (log []string) {
|
||||
wrapper := Wrap(r)
|
||||
dec := json.NewDecoder(wrapper)
|
||||
var consoleLines AppVeyorConsoleLines
|
||||
var err error
|
||||
var txtBlob string
|
||||
err = dec.Decode(&consoleLines)
|
||||
if err == io.EOF {
|
||||
err = nil
|
||||
}
|
||||
if err == nil {
|
||||
for _, l := range consoleLines.Values {
|
||||
txtBlob += l.Text
|
||||
//el := escapeLen(l.Text)
|
||||
//something inserts newlines at 229 chars (+\n\r == 231) (found in CMake output)
|
||||
lenTwoThreeOne := len(l.Text) == 231
|
||||
if lenTwoThreeOne {
|
||||
txtBlob = strings.TrimSuffix(txtBlob, "\r\n")
|
||||
}
|
||||
//something else starts new log lines at 1024 chars without inserting newlines (found in CTest error output)
|
||||
if len(l.Text) != 1024 && !lenTwoThreeOne {
|
||||
//fmt.Printf("sa for l %d, el %d\n", len(l.Text),el)
|
||||
splitAppend(&log, txtBlob)
|
||||
txtBlob = ""
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fmt.Printf("decode err %s\n", err)
|
||||
}
|
||||
if len(txtBlob) > 0 {
|
||||
splitAppend(&log, txtBlob)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func processArgv() (log io.ReadCloser, build string, err error) {
|
||||
fname := os.Args[1]
|
||||
if len(fname) < 14 {
|
||||
err = fmt.Errorf("Name arg '%s' too short. Run as '%s appveyor-NNN.log'", fname, os.Args[0])
|
||||
return
|
||||
}
|
||||
buildRe := regexp.MustCompile(`appveyor-(.+).log`)
|
||||
build = buildRe.ReplaceAllString(fname, "$1")
|
||||
if len(build) == 0 {
|
||||
err = fmt.Errorf("No build id in %s", fname)
|
||||
return
|
||||
}
|
||||
log, err = os.Open(fname)
|
||||
return
|
||||
}
|
||||
|
||||
func getLog() (log io.ReadCloser, build string, err error) {
|
||||
client := &http.Client{}
|
||||
req, err := http.NewRequest("GET", projUrl, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
apikey := os.Getenv("APPVEYOR_API_KEY")
|
||||
//api key isn't necessary for read-only queries on public projects
|
||||
if len(apikey) > 0 {
|
||||
req.Header.Add(headerKey, fmt.Sprintf(headerVal, apikey))
|
||||
} //else {
|
||||
// fmt.Printf("Env var APPVEYOR_API_KEY is not set.")
|
||||
//}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
build, job := decodeProjInfo(resp.Body)
|
||||
fmt.Printf("build #%s, jobId %s\n", build, job)
|
||||
resp, err = http.Get(fmt.Sprintf(consoleUrl, job))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
logName := fmt.Sprintf("appveyor-%s.log", build)
|
||||
fi, err := os.Create(logName)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, err = io.Copy(fi, resp.Body)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
log, err = os.Open(logName)
|
||||
if err != nil {
|
||||
log = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func decodeProjInfo(r io.Reader) (vers string, job string) {
|
||||
dec := json.NewDecoder(r)
|
||||
var av AppVeyorBuild
|
||||
err := dec.Decode(&av)
|
||||
if err != io.EOF && err != nil {
|
||||
fmt.Printf("err %s\n", err)
|
||||
return
|
||||
}
|
||||
if len(av.Build.Jobs) != 1 {
|
||||
return
|
||||
}
|
||||
vers = av.Build.Version
|
||||
job = av.Build.Jobs[0].JobID
|
||||
return
|
||||
}
|
||||
|
||||
//wrap a reader, modifying content to make the json decoder happy
|
||||
//only tested with data from appveyor console
|
||||
type jsonWrapper struct {
|
||||
source io.Reader
|
||||
begin bool
|
||||
end bool
|
||||
}
|
||||
|
||||
func Wrap(r io.Reader) *jsonWrapper {
|
||||
return &jsonWrapper{
|
||||
source: r,
|
||||
begin: true,
|
||||
}
|
||||
}
|
||||
|
||||
// func nonNeg(n int) (int) {
|
||||
// if n < 0 {
|
||||
// return 0
|
||||
// }
|
||||
// return n
|
||||
// }
|
||||
|
||||
func (w *jsonWrapper) Read(p []byte) (n int, err error) {
|
||||
if w.end {
|
||||
return 0, io.EOF
|
||||
}
|
||||
if w.begin {
|
||||
w.begin = false
|
||||
n = copy(p, []byte(`{"values":[`))
|
||||
}
|
||||
m, err := w.source.Read(p[n:])
|
||||
n += m
|
||||
if err == io.EOF {
|
||||
w.end = true
|
||||
if n < len(p) {
|
||||
n = copy(p, []byte(`{"dummy":"data"}]}`))
|
||||
} else {
|
||||
err = fmt.Errorf("No room to terminate JSON struct with '}'\n")
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// kate: indent-width 8; space-indent off; replace-tabs off; replace-tabs-save off; replace-trailing-space-save on; remove-trailing-space on; tab-intent on; tab-width 8; show-tabs off;
|
||||
@@ -15,7 +15,6 @@ set(SC_BASE_HDRS
|
||||
sc_getopt.h
|
||||
sc_trace_fprintf.h
|
||||
sc_mkdir.h
|
||||
sc_nullptr.h
|
||||
path2str.h
|
||||
judy/src/judy.h
|
||||
judy/src/judyLArray.h
|
||||
@@ -33,7 +32,7 @@ if($CACHE{SC_MEMMGR_ENABLE_CHECKS})
|
||||
add_definitions(-DSC_MEMMGR_ENABLE_CHECKS)
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(base SHARED SOURCES ${SC_BASE_SOURCES})
|
||||
if(WIN32)
|
||||
target_link_libraries(base psapi)
|
||||
@@ -41,7 +40,7 @@ if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
if(BUILD_STATIC_LIBS)
|
||||
SC_ADDLIB(base-static STATIC SOURCES ${SC_BASE_SOURCES})
|
||||
if(WIN32)
|
||||
target_link_libraries(base-static psapi)
|
||||
@@ -62,7 +61,7 @@ if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src")
|
||||
endif(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/judy/src")
|
||||
|
||||
install(FILES ${SC_BASE_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/base)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/base)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.6.3)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
project( JudyTemplates )
|
||||
|
||||
if( NOT DEFINED CMAKE_BUILD_TYPE )
|
||||
|
||||
@@ -1080,7 +1080,7 @@ JudySlot * judy_prv( Judy * judy ) {
|
||||
// returning previous entry.
|
||||
|
||||
JudySlot * judy_del( Judy * judy ) {
|
||||
int slot, off, size, type, high;
|
||||
int slot, off, size, type;
|
||||
JudySlot * table, *inner;
|
||||
JudySlot next, *node;
|
||||
int keysize, cnt;
|
||||
@@ -1133,7 +1133,6 @@ JudySlot * judy_del( Judy * judy ) {
|
||||
table = ( JudySlot * )( next & JUDY_mask );
|
||||
inner = ( JudySlot * )( table[slot >> 4] & JUDY_mask );
|
||||
inner[slot & 0x0F] = 0;
|
||||
high = slot & 0xF0;
|
||||
|
||||
for( cnt = 16; cnt--; )
|
||||
if( inner[cnt] ) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
|
||||
#define _XOPEN_SOURCE /* for S_IFDIR */
|
||||
#include "sc_mkdir.h"
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef NULLPTR_H
|
||||
#define NULLPTR_H
|
||||
|
||||
#include <sc_cf.h>
|
||||
|
||||
#ifdef HAVE_NULLPTR
|
||||
#include <cstddef>
|
||||
#else
|
||||
# define nullptr_t void*
|
||||
# define nullptr NULL
|
||||
#endif //HAVE_NULLPTR
|
||||
|
||||
#endif //NULLPTR_H
|
||||
@@ -36,19 +36,19 @@ include_directories(
|
||||
|
||||
set(_libdeps steputils base)
|
||||
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(stepdai SHARED SOURCES ${LIBSTEPDAI_SRCS} LINK_LIBRARIES ${_libdeps})
|
||||
if(WIN32)
|
||||
target_compile_definitions(stepdai PRIVATE SC_DAI_DLL_EXPORTS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
if(BUILD_STATIC_LIBS)
|
||||
SC_ADDLIB(stepdai-static STATIC SOURCES ${LIBSTEPDAI_SRCS} LINK_LIBRARIES $<JOIN:${_libdeps},-static >-static)
|
||||
endif()
|
||||
|
||||
install(FILES ${SC_CLDAI_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cldai)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/cldai)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -56,7 +56,7 @@ void SDAI_Entity_extent::owned_by_( SDAI_Model_contents__list_var& mclv ) {
|
||||
}
|
||||
|
||||
SDAI_Model_contents__list_var SDAI_Entity_extent ::owned_by_() const {
|
||||
return ( const SDAI_Model_contents__list_var ) &_owned_by;
|
||||
return ( SDAI_Model_contents__list_var ) &_owned_by;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -56,7 +56,7 @@ class SC_DAI_EXPORT SDAI_Entity_extent : public SDAI_Session_instance {
|
||||
return &_instances;
|
||||
}
|
||||
SDAI_DAObject__set_var instances_() const {
|
||||
return ( const SDAI_DAObject__set_var )&_instances;
|
||||
return ( SDAI_DAObject__set_var )&_instances;
|
||||
}
|
||||
|
||||
// need to implement Model_contents__list
|
||||
|
||||
@@ -313,6 +313,11 @@ SDAI_BOOLEAN & SDAI_BOOLEAN::operator= ( const SDAI_LOGICAL & t ) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
SDAI_BOOLEAN & SDAI_BOOLEAN::operator= ( const SDAI_BOOLEAN & t ) {
|
||||
v = t;
|
||||
return *this;
|
||||
}
|
||||
|
||||
SDAI_BOOLEAN & SDAI_BOOLEAN::operator= ( const Boolean t ) {
|
||||
v = t;
|
||||
return *this;
|
||||
|
||||
@@ -138,6 +138,7 @@ class SC_DAI_EXPORT SDAI_BOOLEAN :
|
||||
|
||||
operator ::Boolean() const;
|
||||
SDAI_BOOLEAN & operator=( const SDAI_LOGICAL & t );
|
||||
SDAI_BOOLEAN & operator=( const SDAI_BOOLEAN & t );
|
||||
|
||||
SDAI_BOOLEAN & operator=( const ::Boolean t );
|
||||
SDAI_LOGICAL operator==( const SDAI_LOGICAL & t ) const;
|
||||
|
||||
@@ -27,7 +27,7 @@ SDAI_Model_contents::instances_() {
|
||||
|
||||
SDAI_Model_contents_instances_ptr
|
||||
SDAI_Model_contents::instances_() const {
|
||||
return ( const SDAI_Model_contents_instances_ptr ) &_instances;
|
||||
return ( SDAI_Model_contents_instances_ptr ) &_instances;
|
||||
}
|
||||
|
||||
SDAI_Entity_extent__set_var
|
||||
@@ -37,7 +37,7 @@ SDAI_Model_contents::folders_() {
|
||||
|
||||
SDAI_Entity_extent__set_var
|
||||
SDAI_Model_contents::folders_() const {
|
||||
return ( const SDAI_Entity_extent__set_var )&_folders;
|
||||
return ( SDAI_Entity_extent__set_var )&_folders;
|
||||
}
|
||||
|
||||
SDAI_Entity_extent__set_var
|
||||
@@ -47,7 +47,7 @@ SDAI_Model_contents::populated_folders_() {
|
||||
|
||||
SDAI_Entity_extent__set_var
|
||||
SDAI_Model_contents::populated_folders_() const {
|
||||
return ( const SDAI_Entity_extent__set_var )&_populated_folders;
|
||||
return ( SDAI_Entity_extent__set_var )&_populated_folders;
|
||||
}
|
||||
|
||||
SDAI_PID_DA_ptr SDAI_Model_contents::get_object_pid( const SDAI_DAObject_ptr & d ) const {
|
||||
|
||||
@@ -40,7 +40,7 @@ class SC_DAI_EXPORT SDAI_Model_contents_instances : public SDAI_DAObject {
|
||||
return &_instances;
|
||||
}
|
||||
SDAI_DAObject__set_var contents_() const {
|
||||
return ( const SDAI_DAObject__set_var ) &_instances;
|
||||
return ( SDAI_DAObject__set_var ) &_instances;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -41,6 +41,11 @@ SDAI_String & SDAI_String::operator= ( const char * s ) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
SDAI_String & SDAI_String::operator= ( const SDAI_String & s ) {
|
||||
content = s.content;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool SDAI_String::operator== ( const char * s ) const {
|
||||
return ( content == s );
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <sc_export.h>
|
||||
#include <string>
|
||||
#include <limits>
|
||||
|
||||
|
||||
@@ -36,6 +37,7 @@ class SC_DAI_EXPORT SDAI_String {
|
||||
|
||||
// operators
|
||||
SDAI_String & operator= ( const char * s );
|
||||
SDAI_String & operator= ( const SDAI_String & s );
|
||||
bool operator== ( const char * s ) const;
|
||||
|
||||
void clear( void );
|
||||
|
||||
@@ -27,19 +27,19 @@ include_directories(
|
||||
${SC_SOURCE_DIR}/src/clutils
|
||||
)
|
||||
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(stepeditor SHARED SOURCES ${LIBSTEPEDITOR_SRCS} LINK_LIBRARIES stepcore stepdai steputils base)
|
||||
if(WIN32)
|
||||
target_compile_definitions(stepeditor PRIVATE SC_EDITOR_DLL_EXPORTS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
if(BUILD_STATIC_LIBS)
|
||||
SC_ADDLIB(stepeditor-static STATIC SOURCES ${LIBSTEPEDITOR_SRCS} LINK_LIBRARIES stepcore-static stepdai-static steputils-static base-static)
|
||||
endif()
|
||||
|
||||
install(FILES ${SC_CLEDITOR_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cleditor)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/cleditor)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -32,22 +32,23 @@ include_directories(
|
||||
|
||||
set(_libdeps stepcore stepdai steputils base stepeditor)
|
||||
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(steplazyfile SHARED SOURCES ${clLazyFile_SRCS} LINK_LIBRARIES ${_libdeps})
|
||||
if(WIN32)
|
||||
target_compile_definitions(steplazyfile PRIVATE SC_LAZYFILE_DLL_EXPORTS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
SC_ADDLIB(steplazyfile-static STATIC SOURCES ${clLazyFile_SRCS} LINK_LIBRARIES $<JOIN:${_libdeps},-static >-static)
|
||||
if(BUILD_STATIC_LIBS)
|
||||
set(_libdeps stepcore-static stepdai-static steputils-static base-static stepeditor-static)
|
||||
SC_ADDLIB(steplazyfile-static STATIC SOURCES ${clLazyFile_SRCS} LINK_LIBRARIES ${_libdeps})
|
||||
endif()
|
||||
|
||||
SC_ADDEXEC(lazy_test SOURCES lazy_test.cc LINK_LIBRARIES steplazyfile stepeditor NO_INSTALL)
|
||||
target_compile_definitions(lazy_test PRIVATE NO_REGISTRY)
|
||||
|
||||
install(FILES ${SC_CLLAZYFILE_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/cllazyfile)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/cllazyfile)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -115,9 +115,9 @@ class SC_LAZYFILE_EXPORT lazyRefs {
|
||||
if( !ai ) {
|
||||
ias.i = rinst;
|
||||
_inst->setInvAttr( ia, ias );
|
||||
} else if( ai->GetFileId() != (int)inst ) {
|
||||
std::cerr << "ERROR: two instances (" << rinst << ", #" << rinst->GetFileId() << "=" << rinst->getEDesc()->Name();
|
||||
std::cerr << " and " << ai << ", #" << ai->GetFileId() <<"=" << ai->getEDesc()->Name() << ") refer to inst ";
|
||||
} else if( ai->GetFileId() != ( int )inst ) {
|
||||
std::cerr << "ERROR: two instances (" << rinst << ", #" << rinst->GetFileId() << "=" << rinst->eDesc->Name();
|
||||
std::cerr << " and " << ai << ", #" << ai->GetFileId() << "=" << ai->eDesc->Name() << ") refer to inst ";
|
||||
std::cerr << _inst->GetFileId() << ", but its inverse attribute is not an aggregation type!" << std::endl;
|
||||
// TODO _error->GreaterSeverity( SEVERITY_INPUT_ERROR );
|
||||
}
|
||||
@@ -184,7 +184,7 @@ class SC_LAZYFILE_EXPORT lazyRefs {
|
||||
}
|
||||
++iai;
|
||||
}
|
||||
std::cerr << "Error! inverse attr " << ia->Name() << " (" << ia << ") not found in iAMap for entity " << inst->getEDesc()->Name() << std::endl;
|
||||
std::cerr << "Error! inverse attr " << ia->Name() << " (" << ia << ") not found in iAMap for entity " << inst->eDesc->Name() << std::endl;
|
||||
abort();
|
||||
iAstruct nil = {nullptr};
|
||||
return nil;
|
||||
@@ -279,7 +279,7 @@ class SC_LAZYFILE_EXPORT lazyRefs {
|
||||
|
||||
|
||||
// 1. find inverse attrs with recursion
|
||||
getInverseAttrs( ai->getEDesc(), _iaList );
|
||||
getInverseAttrs( ai->eDesc, _iaList );
|
||||
|
||||
//2. find reverse refs, map id to type (stop if there are no inverse attrs or no refs)
|
||||
if( _iaList.size() == 0 || !mapRefsToTypes() ) {
|
||||
|
||||
@@ -111,14 +111,14 @@ void dumpComplexInst( STEPcomplex * c ) {
|
||||
STEPcomplex * complex = c->head;
|
||||
while( complex ) {
|
||||
if( complex->IsComplex() ) {
|
||||
std::cout << "Complex component " << complex->getEDesc()->Name() << " at depth " << depth << " with attr list size ";
|
||||
std::cout << "Complex component " << complex->eDesc->Name() << " at depth " << depth << " with attr list size ";
|
||||
std::cout << complex->_attr_data_list.size() << std::endl;
|
||||
// dumpComplexInst( complex, depth + 1 );
|
||||
} else {
|
||||
//probably won't ever get here...
|
||||
SDAI_Application_instance * ai = dynamic_cast< SDAI_Application_instance * >( complex );
|
||||
if( ai ) {
|
||||
std::cout << "non-complex component at depth " << depth << ", " << ai->getEDesc()->Name() << std::endl;
|
||||
std::cout << "non-complex component at depth " << depth << ", " << ai->eDesc->Name() << std::endl;
|
||||
} else {
|
||||
std::cout << "unknown component at depth " << depth << ": " << complex << std::endl;
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ SDAI_Application_instance * sectionReader::getRealInstance( const Registry * reg
|
||||
if( !comment.empty() ) {
|
||||
inst->AddP21Comment( comment );
|
||||
}
|
||||
assert( inst->getEDesc() );
|
||||
assert( inst->eDesc );
|
||||
_file.seekg( begin );
|
||||
findNormalString( "(" );
|
||||
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||
|
||||
@@ -133,19 +133,19 @@ include_directories(
|
||||
|
||||
set(_libdeps steputils stepdai base)
|
||||
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(stepcore SHARED SOURCES ${LIBSTEPCORE_SRCS} LINK_LIBRARIES ${_libdeps})
|
||||
if(WIN32)
|
||||
target_compile_definitions(stepcore PRIVATE SC_CORE_DLL_EXPORTS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
if(BUILD_STATIC_LIBS)
|
||||
SC_ADDLIB(stepcore-static STATIC SOURCES ${LIBSTEPCORE_SRCS} LINK_LIBRARIES $<JOIN:${_libdeps},-static>-static)
|
||||
endif()
|
||||
|
||||
install(FILES ${SC_CLSTEPCORE_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/clstepcore)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/clstepcore)
|
||||
|
||||
if(SC_ENABLE_TESTING)
|
||||
add_subdirectory(test)
|
||||
|
||||
@@ -260,7 +260,7 @@ SDAI_Application_instance * Registry::ObjCreate( const char * nm, const char * s
|
||||
se->Error().severity( SEVERITY_WARNING );
|
||||
se->Error().UserMsg( "ENTITY requires external mapping" );
|
||||
}
|
||||
se->setEDesc( entd );
|
||||
se->eDesc = entd;
|
||||
return se;
|
||||
} else {
|
||||
return ENTITY_NULL;
|
||||
|
||||
@@ -382,6 +382,100 @@ Severity STEPattribute::STEPread( istream & in, InstMgrBase * instances, int add
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************//**
|
||||
** \fn asStr
|
||||
** \param currSch - used for select type writes. See commenting in SDAI_Select::STEPwrite().
|
||||
** \returns the value of the attribute
|
||||
** Status: complete 3/91
|
||||
*********************************************************************/
|
||||
const char * STEPattribute::asStr( std::string & str, const char * currSch ) const {
|
||||
ostringstream ss;
|
||||
|
||||
str.clear();
|
||||
|
||||
// The attribute has been derived by a subtype's attribute
|
||||
if( IsDerived() ) {
|
||||
str = "*";
|
||||
return const_cast<char *>( str.c_str() );
|
||||
}
|
||||
|
||||
// The attribute has been redefined by the attribute pointed
|
||||
// to by _redefAttr so write the redefined value.
|
||||
if( _redefAttr ) {
|
||||
return _redefAttr->asStr( str, currSch );
|
||||
}
|
||||
|
||||
if( is_null() ) {
|
||||
str = "";
|
||||
return const_cast<char *>( str.c_str() );
|
||||
}
|
||||
|
||||
switch( NonRefType() ) {
|
||||
case INTEGER_TYPE:
|
||||
ss << *( ptr.i );
|
||||
str += ss.str();
|
||||
break;
|
||||
|
||||
case NUMBER_TYPE:
|
||||
case REAL_TYPE:
|
||||
|
||||
ss.precision( ( int ) Real_Num_Precision );
|
||||
ss << *( ptr.r );
|
||||
str += ss.str();
|
||||
break;
|
||||
|
||||
case ENTITY_TYPE:
|
||||
// print instance id only if not empty pointer
|
||||
// and has value assigned
|
||||
if( ( *( ptr.c ) == S_ENTITY_NULL ) || ( *( ptr.c ) == 0 ) ) {
|
||||
break;
|
||||
} else {
|
||||
( *( ptr.c ) )->STEPwrite_reference( str );
|
||||
}
|
||||
break;
|
||||
|
||||
case BINARY_TYPE:
|
||||
if( !( ( ptr.b )->empty() ) ) {
|
||||
( ptr.b ) -> STEPwrite( str );
|
||||
}
|
||||
break;
|
||||
|
||||
case STRING_TYPE:
|
||||
if( !( ( ptr.S )->empty() ) ) {
|
||||
return ( ptr.S ) -> asStr( str );
|
||||
}
|
||||
break;
|
||||
|
||||
case AGGREGATE_TYPE:
|
||||
case ARRAY_TYPE: // DAS
|
||||
case BAG_TYPE: // DAS
|
||||
case SET_TYPE: // DAS
|
||||
case LIST_TYPE: // DAS
|
||||
return ptr.a->asStr( str ) ;
|
||||
|
||||
case ENUM_TYPE:
|
||||
case BOOLEAN_TYPE:
|
||||
case LOGICAL_TYPE:
|
||||
return ptr.e -> asStr( str );
|
||||
|
||||
case SELECT_TYPE:
|
||||
ptr.sh -> STEPwrite( str, currSch );
|
||||
return const_cast<char *>( str.c_str() );
|
||||
|
||||
case REFERENCE_TYPE:
|
||||
case GENERIC_TYPE:
|
||||
cerr << "Internal error: " << __FILE__ << __LINE__
|
||||
<< "\n" << _POC_ "\n";
|
||||
return 0;
|
||||
|
||||
case UNKNOWN_TYPE:
|
||||
default:
|
||||
return ( ptr.u -> asStr( str ) );
|
||||
}
|
||||
return const_cast<char *>( str.c_str() );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************//**
|
||||
** \fn asStr
|
||||
** \param currSch - used for select type writes. See commenting in SDAI_Select::STEPwrite().
|
||||
@@ -1353,6 +1447,7 @@ STEPattribute::~STEPattribute() {
|
||||
delete ( SDAI_BOOLEAN * ) ptr.e;
|
||||
ptr.e = 0;
|
||||
}
|
||||
break;
|
||||
case LOGICAL_TYPE:
|
||||
if( ptr.e ) {
|
||||
delete ( SDAI_LOGICAL * ) ptr.e;
|
||||
|
||||
@@ -75,21 +75,15 @@ extern SC_CORE_EXPORT void PushPastAggr1Dim( istream & in, std::string & s, Erro
|
||||
class SC_CORE_EXPORT STEPattribute {
|
||||
friend ostream & operator<< ( ostream &, STEPattribute & );
|
||||
friend class SDAI_Application_instance;
|
||||
protected:
|
||||
bool _derive;
|
||||
bool _mustDeletePtr; ///if a member uses new to create an object in ptr
|
||||
ErrorDescriptor _error;
|
||||
STEPattribute * _redefAttr;
|
||||
const AttrDescriptor * aDesc;
|
||||
int refCount;
|
||||
|
||||
public:
|
||||
/** \union ptr
|
||||
** You know which of these to use based on the return value of
|
||||
** NonRefType() - see below. BASE_TYPE is defined in baseType.h
|
||||
** This variable points to an appropriate member variable in the entity
|
||||
** class in the generated schema class library (the entity class is
|
||||
** inherited from SDAI_Application_instance)
|
||||
*/
|
||||
** You know which of these to use based on the return value of
|
||||
** NonRefType() - see below. BASE_TYPE is defined in baseType.h
|
||||
** This variable points to an appropriate member variable in the entity
|
||||
** class in the generated schema class library (the entity class is
|
||||
** inherited from SDAI_Application_instance)
|
||||
*/
|
||||
union attrUnion {
|
||||
SDAI_String * S; // STRING_TYPE
|
||||
SDAI_Integer * i; // INTEGER_TYPE (Integer is a long int)
|
||||
@@ -103,6 +97,18 @@ class SC_CORE_EXPORT STEPattribute {
|
||||
void * p;
|
||||
} ptr;
|
||||
|
||||
|
||||
protected:
|
||||
bool _derive;
|
||||
bool _mustDeletePtr; ///if a member uses new to create an object in ptr
|
||||
ErrorDescriptor _error;
|
||||
STEPattribute * _redefAttr;
|
||||
public:
|
||||
const AttrDescriptor * aDesc;
|
||||
|
||||
protected:
|
||||
int refCount;
|
||||
|
||||
char SkipBadAttr( istream & in, char * StopChars );
|
||||
void AddErrorInfo();
|
||||
void STEPwriteError( ostream& out, unsigned int line, const char* desc );
|
||||
@@ -137,6 +143,7 @@ class SC_CORE_EXPORT STEPattribute {
|
||||
|
||||
/// return the attr value as a string
|
||||
string asStr( const char * currSch = 0 ) const;
|
||||
const char * asStr( std::string &, const char * = 0 ) const;
|
||||
|
||||
/// put the attr value in ostream
|
||||
void STEPwrite( ostream & out = cout, const char * currSch = 0 );
|
||||
@@ -167,11 +174,6 @@ class SC_CORE_EXPORT STEPattribute {
|
||||
SCLundefined * Undefined();
|
||||
///@}
|
||||
|
||||
/// allows direct access to the union containing attr data (dangerous!)
|
||||
attrUnion * Raw() {
|
||||
return & ptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* These functions allow setting the attribute value.
|
||||
* Attr type is verified using an assertion.
|
||||
|
||||
@@ -173,26 +173,27 @@ class SC_CORE_EXPORT EntList {
|
||||
// but all we need.
|
||||
EntList * firstNot( JoinType );
|
||||
EntList * nextNot( JoinType j ) {
|
||||
return next->firstNot( j );
|
||||
return ( next ) ? next->firstNot( j ) : NULL;
|
||||
}
|
||||
EntList * firstWanted( MatchType );
|
||||
EntList * nextWanted( MatchType mat ) {
|
||||
return next->firstWanted( mat );
|
||||
return ( next ) ? next->firstWanted( mat ) : NULL;
|
||||
}
|
||||
EntList * lastNot( JoinType );
|
||||
EntList * prevNot( JoinType j ) {
|
||||
return prev->lastNot( j );
|
||||
return ( prev ) ? prev->lastNot( j ) : NULL;
|
||||
}
|
||||
EntList * lastWanted( MatchType );
|
||||
EntList * prevWanted( MatchType mat ) {
|
||||
return prev->lastWanted( mat );
|
||||
return ( prev ) ? prev->lastWanted( mat ) : NULL;
|
||||
}
|
||||
|
||||
JoinType join;
|
||||
int multiple() {
|
||||
return ( join != SIMPLE );
|
||||
}
|
||||
EntList * next, *prev;
|
||||
EntList * next = NULL;
|
||||
EntList * prev = NULL;
|
||||
|
||||
protected:
|
||||
MatchType viable;
|
||||
|
||||
@@ -14,7 +14,6 @@ public:
|
||||
#pragma warning( disable: 4251 )
|
||||
#endif
|
||||
Express_id _name;
|
||||
std::string _rule_text; // non-SDAI
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
@@ -22,6 +21,7 @@ public:
|
||||
Entity__set_var _entities; // not implemented
|
||||
Where_rule__list_var _where_rules;
|
||||
Schema_ptr _parent_schema;
|
||||
std::string _rule_text; // non-SDAI
|
||||
|
||||
Global_rule();
|
||||
Global_rule( const char * n, Schema_ptr parent_sch, const std::string & rt );
|
||||
|
||||
@@ -13,19 +13,25 @@ public:
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4251 )
|
||||
#endif
|
||||
Express_id _current_schema_id; // schema containing the USE/REF stmt
|
||||
|
||||
// non-SDAI, not useful for SDAI use of Interface_spec (it would need to
|
||||
// be a list).
|
||||
// schema that defined the USE/REFd objects
|
||||
Express_id _foreign_schema_id;
|
||||
Express_id _current_schema_id; // schema containing the USE/REF stmt
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
// set of objects from USE/REFERENCE stmt(s)
|
||||
Explicit_item_id__set_var _explicit_items;
|
||||
Implicit_item_id__set_var _implicit_items; //not yet initialized for schema
|
||||
|
||||
// set of objects from USE/REFERENCE stmt(s)
|
||||
Explicit_item_id__set_var _explicit_items;
|
||||
Implicit_item_id__set_var _implicit_items; //not yet initialized for schema
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4251 )
|
||||
#endif
|
||||
// non-SDAI, not useful for SDAI use of Interface_spec (it would need to
|
||||
// be a list).
|
||||
// schema that defined the USE/REFd objects
|
||||
Express_id _foreign_schema_id;
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
// non-SDAI, not useful for SDAI use of Interface_spec (it would need to
|
||||
// be a list of ints).
|
||||
|
||||
@@ -25,15 +25,13 @@ class DisplayNode;
|
||||
|
||||
#include <editordefines.h>
|
||||
|
||||
#include <sc_nullptr.h>
|
||||
|
||||
class InstMgr;
|
||||
|
||||
class SC_CORE_EXPORT MgrNodeBase : public GenericNode {
|
||||
public:
|
||||
virtual inline SDAI_Application_instance * GetSTEPentity() {
|
||||
abort();
|
||||
return nullptr;
|
||||
return NULL;
|
||||
};
|
||||
virtual ~MgrNodeBase() {};
|
||||
};
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include "sdaiApplication_instance.h"
|
||||
#include "superInvAttrIter.h"
|
||||
|
||||
#include <sc_nullptr.h>
|
||||
|
||||
SDAI_Application_instance NilSTEPentity;
|
||||
|
||||
bool isNilSTEPentity( const SDAI_Application_instance * ai ) {
|
||||
@@ -172,10 +170,6 @@ void SDAI_Application_instance::AppendMultInstance( SDAI_Application_instance *
|
||||
}
|
||||
}
|
||||
|
||||
const EntityDescriptor* SDAI_Application_instance::getEDesc() const {
|
||||
return eDesc;
|
||||
}
|
||||
|
||||
// BUG implement this -- FIXME function is never used
|
||||
SDAI_Application_instance * SDAI_Application_instance::GetMiEntity( char * entName ) {
|
||||
std::string s1, s2;
|
||||
@@ -679,6 +673,7 @@ SDAI_Application_instance * ReadEntityRef( istream & in, ErrorDescriptor * err,
|
||||
err->AppendToDetailMsg( "Use of @ instead of # to identify entity.\n" );
|
||||
err->GreaterSeverity( SEVERITY_WARNING );
|
||||
// no break statement here on purpose
|
||||
[[gnu::fallthrough]];
|
||||
case '#': {
|
||||
int id = -1;
|
||||
in >> id;
|
||||
@@ -790,9 +785,9 @@ Severity EntityValidLevel( SDAI_Application_instance * se,
|
||||
// DAVE: Can an entity be used in an Express TYPE so that this
|
||||
// EntityDescriptor would have type REFERENCE_TYPE -- it looks like NO
|
||||
|
||||
else if( se->getEDesc() ) {
|
||||
else if( se->eDesc ) {
|
||||
// is se a descendant of ed?
|
||||
if( se->getEDesc()->IsA( ed ) ) {
|
||||
if( se->eDesc->IsA( ed ) ) {
|
||||
return SEVERITY_NULL;
|
||||
} else {
|
||||
if( se->IsComplex() ) {
|
||||
@@ -883,9 +878,12 @@ Severity EntityValidLevel( const char * attrValue, // string contain entity ref
|
||||
|
||||
if( ( found1 > 0 ) || ( found2 > 0 ) ) {
|
||||
if( ( found1 == 2 ) || ( found2 == 2 ) ) {
|
||||
sprintf( messageBuf,
|
||||
" Attribute's Entity Reference %s is %s data \'%s\'.\n",
|
||||
attrValue, "followed by invalid", tmp );
|
||||
int ocnt = snprintf( messageBuf, BUFSIZ,
|
||||
" Attribute's Entity Reference %s is %s data \'%s\'.\n",
|
||||
attrValue, "followed by invalid", tmp );
|
||||
if( ocnt < BUFSIZ ) {
|
||||
fprintf( stderr, "Warning - truncation of Attribute's Entry Reference msg\n" );
|
||||
}
|
||||
err->AppendToUserMsg( messageBuf );
|
||||
err->AppendToDetailMsg( messageBuf );
|
||||
err->GreaterSeverity( SEVERITY_WARNING );
|
||||
@@ -956,7 +954,7 @@ const SDAI_Application_instance::iAMap_t::value_type SDAI_Application_instance::
|
||||
}
|
||||
iAstruct z;
|
||||
memset( &z, 0, sizeof z );
|
||||
iAMap_t::value_type nil( (Inverse_attribute *) nullptr, z );
|
||||
iAMap_t::value_type nil( ( Inverse_attribute * ) NULL, z );
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
|
||||
|
||||
public:
|
||||
typedef std::map< const Inverse_attribute * const, iAstruct> iAMap_t;
|
||||
protected:
|
||||
const EntityDescriptor * eDesc;
|
||||
protected:
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4251 )
|
||||
@@ -89,10 +89,6 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
|
||||
/// initialize inverse attribute list
|
||||
void InitIAttrs();
|
||||
|
||||
void setEDesc( const EntityDescriptor * const ed ) {
|
||||
eDesc = ed;
|
||||
}
|
||||
const EntityDescriptor * getEDesc() const;
|
||||
void StepFileId( int fid ) {
|
||||
STEPfile_id = fid;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
#c++ tests for clstepcore
|
||||
|
||||
include_directories(
|
||||
|
||||
@@ -25,7 +25,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
SC_ADDLIB(steputils SHARED SOURCES ${LIBSTEPUTILS_SRCS} LINK_LIBRARIES base)
|
||||
if(WIN32)
|
||||
target_compile_definitions(steputils PRIVATE SC_UTILS_DLL_EXPORTS)
|
||||
@@ -33,7 +33,7 @@ if($CACHE{SC_BUILD_SHARED_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
if(BUILD_STATIC_LIBS)
|
||||
SC_ADDLIB(steputils-static STATIC SOURCES ${LIBSTEPUTILS_SRCS} LINK_LIBRARIES base-static)
|
||||
if(WIN32)
|
||||
target_link_libraries(steputils-static shlwapi)
|
||||
@@ -41,7 +41,7 @@ if($CACHE{SC_BUILD_STATIC_LIBS})
|
||||
endif()
|
||||
|
||||
install(FILES ${SC_CLUTILS_HDRS}
|
||||
DESTINATION ${INCLUDE_INSTALL_DIR}/stepcode/clutils)
|
||||
DESTINATION ${INCLUDE_DIR}/stepcode/clutils)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -61,10 +61,10 @@ class SC_UTILS_EXPORT DirObj {
|
||||
const char * File( int index );
|
||||
// check for file in the currently loaded directory
|
||||
bool FileExists( const char * file ) {
|
||||
return Index( file ) ? 1 : 0;
|
||||
return Index( file ) != -1;
|
||||
}
|
||||
bool FileExists( const std::string & file ) {
|
||||
return Index( file.c_str() ) ? true : false;
|
||||
return Index( file.c_str() ) != -1;
|
||||
}
|
||||
int Count();
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void SC_HASHinsert( Hash_TableP t, char * s, void * data ) {
|
||||
e.symbol = 0;
|
||||
e2 = SC_HASHsearch( t, &e, HASH_INSERT );
|
||||
if( e2 ) {
|
||||
fprintf( stderr, "%s: Redeclaration of %s\n", __FUNCTION__, s );
|
||||
fprintf( stderr, "%s: Redeclaration of %s\n", __func__, s );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,10 +39,6 @@ include_directories(
|
||||
|
||||
SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp express base)
|
||||
|
||||
if(NOT SC_IS_SUBBUILD AND SC_GIT_VERSION)
|
||||
add_dependencies(exp2cxx version_string)
|
||||
endif(NOT SC_IS_SUBBUILD AND SC_GIT_VERSION)
|
||||
|
||||
if(SC_ENABLE_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif(SC_ENABLE_TESTING)
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "classes.h"
|
||||
|
||||
#include <sc_trace_fprintf.h>
|
||||
#include "sc_version_string.h"
|
||||
#include "class_strings.h"
|
||||
|
||||
/** \file classes_misc.c
|
||||
@@ -44,7 +43,7 @@ FILE * FILEcreate( const char * filename ) {
|
||||
fprintf( file, "#ifndef %s\n", fn );
|
||||
fprintf( file, "#define %s\n\n", fn );
|
||||
|
||||
fprintf( file, "// This file was generated by exp2cxx,\n// %s.\n", sc_version );
|
||||
fprintf( file, "// This file was generated by exp2cxx,\n// %s.\n", SC_VERSION );
|
||||
fprintf( file, "// You probably don't want to edit it since your modifications\n" );
|
||||
fprintf( file, "// will be lost if exp2cxx is used to regenerate it.\n\n" );
|
||||
return ( file );
|
||||
|
||||
@@ -120,7 +120,7 @@ char * CheckEnumSymbol( char * s ) {
|
||||
} else {
|
||||
strcpy( b, s );
|
||||
strcat( b, "_" );
|
||||
fprintf( stderr, "Warning in %s: the enumerated value %s is already being used and has been changed to %s\n", __FUNCTION__, s, b );
|
||||
fprintf( stderr, "Warning in %s: the enumerated value %s is already being used and has been changed to %s\n", __func__, s, b );
|
||||
return ( b );
|
||||
}
|
||||
}
|
||||
@@ -182,12 +182,12 @@ void TYPEenum_inc_print( const Type type, FILE * inc ) {
|
||||
|
||||
/* constructors */
|
||||
strncpy( tdnm, TYPEtd_name( type ), BUFSIZ );
|
||||
tdnm[BUFSIZ-1] = '\0';
|
||||
fprintf( inc, " public:\n %s (const char * n =0, Enum"
|
||||
"TypeDescriptor *et =%s);\n", n, tdnm );
|
||||
tdnm[BUFSIZ - 1] = '\0';
|
||||
fprintf( inc, " public:\n %s (const char * n =0, EnumTypeDescriptor *et =%s);\n", n, tdnm );
|
||||
fprintf( inc, " %s (%s e, EnumTypeDescriptor *et =%s)\n"
|
||||
" : type(et) { set_value (e); }\n",
|
||||
n, EnumName( TYPEget_name( type ) ), tdnm );
|
||||
fprintf( inc, " %s (const %s &e) { set_value(e); }\n", n, TYPEget_ctype( type ) );
|
||||
|
||||
/* destructor */
|
||||
fprintf( inc, " ~%s () { }\n", n );
|
||||
@@ -1285,7 +1285,7 @@ char * TYPEget_express_type( const Type t ) {
|
||||
|
||||
/* default returns undefined */
|
||||
|
||||
fprintf( stderr, "Warning in %s: type %s is undefined\n", __FUNCTION__, TYPEget_name( t ) );
|
||||
fprintf( stderr, "Warning in %s: type %s is undefined\n", __func__, TYPEget_name( t ) );
|
||||
return ( "SCLundefined" );
|
||||
|
||||
}
|
||||
|
||||
@@ -385,6 +385,7 @@ void INITFileFinish( FILE * initfile, Schema schema ) {
|
||||
** Status:
|
||||
******************************************************************/
|
||||
void SCHEMAprint( Schema schema, FILES * files, void * complexCol, int suffix ) {
|
||||
int ocnt = 0;
|
||||
char schnm[MAX_LEN], sufnm[MAX_LEN], fnm[MAX_LEN], *np;
|
||||
/* sufnm = schema name + suffix */
|
||||
FILE * libfile,
|
||||
@@ -402,11 +403,20 @@ void SCHEMAprint( Schema schema, FILES * files, void * complexCol, int suffix )
|
||||
/* 1. header file */
|
||||
sprintf( schnm, "%s%s", SCHEMA_FILE_PREFIX, StrToUpper( SCHEMAget_name( schema ) ) ); //TODO change file names to CamelCase?
|
||||
if( suffix == 0 ) {
|
||||
sprintf( sufnm, "%s", schnm );
|
||||
ocnt = snprintf( sufnm, MAX_LEN, "%s", schnm );
|
||||
if( ocnt > MAX_LEN ) {
|
||||
std::cerr << "Warning - " << __FILE__ << " line " << __LINE__ << " - sufnm not large enough to hold schnm\n";
|
||||
}
|
||||
} else {
|
||||
sprintf( sufnm, "%s_%d", schnm, suffix );
|
||||
ocnt = snprintf( sufnm, MAX_LEN, "%s_%d", schnm, suffix );
|
||||
if( ocnt > MAX_LEN ) {
|
||||
std::cerr << "Warning - " << __FILE__ << " line " << __LINE__ << " - sufnm not large enough to hold string\n";
|
||||
}
|
||||
}
|
||||
ocnt = snprintf( fnm, MAX_LEN, "%s.h", sufnm );
|
||||
if( ocnt > MAX_LEN ) {
|
||||
std::cerr << "Warning - " << __FILE__ << " line " << __LINE__ << " - sufnm not large enough to hold string\n";
|
||||
}
|
||||
sprintf( fnm, "%s.h", sufnm );
|
||||
|
||||
if( !( incfile = ( files -> inc ) = FILEcreate( fnm ) ) ) {
|
||||
return;
|
||||
@@ -447,7 +457,11 @@ void SCHEMAprint( Schema schema, FILES * files, void * complexCol, int suffix )
|
||||
fprintf( libfile, "\n#include \"%s.h\"\n", schnm );
|
||||
|
||||
// 3. header for namespace to contain all formerly-global variables
|
||||
sprintf( fnm, "%sNames.h", schnm );
|
||||
ocnt = snprintf( fnm, MAX_LEN, "%sNames.h", schnm );
|
||||
if( ocnt > MAX_LEN ) {
|
||||
std::cerr << "Warning - " << __FILE__ << " line " << __LINE__ << " - fnm not large enough to hold schnm\n";
|
||||
}
|
||||
|
||||
if( !( files->names = FILEcreate( fnm ) ) ) {
|
||||
return;
|
||||
}
|
||||
@@ -462,7 +476,11 @@ void SCHEMAprint( Schema schema, FILES * files, void * complexCol, int suffix )
|
||||
|
||||
if( suffix <= 1 ) {
|
||||
/* I.e., if this is our first pass with schema */
|
||||
sprintf( fnm, "%s.init.cc", schnm );
|
||||
ocnt = snprintf( fnm, MAX_LEN, "%s.init.cc", schnm );
|
||||
if( ocnt > MAX_LEN ) {
|
||||
std::cerr << "Warning - " << __FILE__ << " line " << __LINE__ << " - fnm not large enough to hold string\n";
|
||||
}
|
||||
|
||||
/* Note - We use schnm (without the "_x" suffix sufnm has) since we
|
||||
** only generate a single init.cc file. */
|
||||
if( !( initfile = ( files -> init ) = FILEcreate( fnm ) ) ) {
|
||||
@@ -525,7 +543,11 @@ void SCHEMAprint( Schema schema, FILES * files, void * complexCol, int suffix )
|
||||
fprintf( files->classes, "\n#include \"%sNames.h\"\n", schnm );
|
||||
} else {
|
||||
/* Just reopen the .init.cc (in append mode): */
|
||||
sprintf( fnm, "%s.init.cc", schnm );
|
||||
ocnt = snprintf( fnm, MAX_LEN, "%s.init.cc", schnm );
|
||||
if( ocnt > MAX_LEN ) {
|
||||
std::cerr << "Warning - " << __FILE__ << " line " << __LINE__ << " - sufnm not large enough to hold string\n";
|
||||
}
|
||||
|
||||
initfile = files->init = fopen( fnm, "a" );
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ extern int multiple_inheritance;
|
||||
((t)->u.type->body->type == integer_) || \
|
||||
((t)->u.type->body->type == number_) )
|
||||
#define PRINT_BUG_REPORT \
|
||||
fprintf( f, " std::cerr << __FILE__ << \":\" << __LINE__ << \": ERROR" \
|
||||
fprintf( f, "std::cerr << __FILE__ << \":\" << __LINE__ << \": ERROR" \
|
||||
" in schema library: \\n\" \n << _POC_ << \"\\n\\n\";\n");
|
||||
|
||||
#define PRINT_SELECTBUG_WARNING(f) \
|
||||
@@ -1493,7 +1493,7 @@ void TYPEselect_lib_part21( const Type type, FILE * f ) {
|
||||
" _%s = ReadEntityRef(in, &_error, \",)\", instances, addFileId);\n", dm );
|
||||
fprintf( f,
|
||||
" if( _%s && ( _%s != S_ENTITY_NULL) &&\n "
|
||||
" ( CurrentUnderlyingType()->CanBe( _%s->getEDesc() ) ) ) {\n"
|
||||
" ( CurrentUnderlyingType()->CanBe( _%s->eDesc ) ) ) {\n"
|
||||
" return severity();\n", dm, dm, dm );
|
||||
fprintf( f,
|
||||
" } else {\n "
|
||||
@@ -1680,7 +1680,7 @@ void SELlib_print_protected( const Type type, FILE * f ) {
|
||||
if( TYPEis_select( t ) ) {
|
||||
fprintf( f,
|
||||
" // %s\n" /* item name */
|
||||
" if( %s->CanBe( se->getEDesc() ) ) {\n"
|
||||
" if( %s->CanBe( se->eDesc ) ) {\n"
|
||||
" _%s.AssignEntity (se);\n" /* underlying data member */
|
||||
" return SetUnderlyingType (%s);\n" /* td */
|
||||
" }\n",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required( VERSION 3.6.3 )
|
||||
cmake_minimum_required( VERSION 3.12 )
|
||||
|
||||
# executable is ${EXE}, input file is ${INFILE}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required( VERSION 3.6.3 )
|
||||
cmake_minimum_required( VERSION 3.12 )
|
||||
|
||||
# executable is ${EXE}, input file is ${INFILE}
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ if(SC_PYTHON_GENERATOR)
|
||||
)
|
||||
SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express base)
|
||||
|
||||
if(NOT SC_IS_SUBBUILD AND SC_GIT_VERSION)
|
||||
add_dependencies(exp2python version_string)
|
||||
endif(NOT SC_IS_SUBBUILD AND SC_GIT_VERSION)
|
||||
endif(SC_PYTHON_GENERATOR)
|
||||
|
||||
# Local Variables:
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'gcc_incomplete_type'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype maths_number
|
||||
class maths_number(NUMBER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# SELECT TYPE atom_based_value
|
||||
atom_based_value = SELECT(
|
||||
'maths_number',
|
||||
'atom_based_tuple',
|
||||
scope = schema_scope)
|
||||
atom_based_tuple = LIST(0,None,'atom_based_value', scope = schema_scope)
|
||||
@@ -1,13 +0,0 @@
|
||||
__doc__= ''' This script runs exp2python over each EXPRESS schema in the test/unitary_schemas folder'''
|
||||
|
||||
unitary_schemas_path = '../../../../test/unitary_schemas'
|
||||
exp2python_path = '../../../../cmake-build/bin/exp2python'
|
||||
|
||||
import subprocess
|
||||
import glob
|
||||
import os
|
||||
|
||||
unitary_schemas = glob.glob(os.path.join(unitary_schemas_path,'*.exp'))
|
||||
|
||||
for unitary_schema in unitary_schemas:
|
||||
subprocess.call([exp2python_path,unitary_schema])
|
||||
@@ -1,140 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'index_attribute'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
common_datum_list = LIST(1,None,'datum_reference_element', scope = schema_scope)
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# SELECT TYPE datum_or_common_datum
|
||||
datum_or_common_datum = SELECT(
|
||||
'common_datum_list',
|
||||
'datum',
|
||||
scope = schema_scope)
|
||||
|
||||
####################
|
||||
# ENTITY shape_aspect #
|
||||
####################
|
||||
class shape_aspect(BaseEntityClass):
|
||||
'''Entity shape_aspect definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param of_shape
|
||||
:type of_shape:product_definition_shape
|
||||
'''
|
||||
def __init__( self , name,of_shape, ):
|
||||
self.name = name
|
||||
self.of_shape = of_shape
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def of_shape():
|
||||
def fget( self ):
|
||||
return self._of_shape
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument of_shape is mandatory and can not be set to None')
|
||||
if not check_type(value,product_definition_shape):
|
||||
self._of_shape = product_definition_shape(value)
|
||||
else:
|
||||
self._of_shape = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (SIZEOF(USEDIN(self,'INDEX_ATTRIBUTE.' + 'ID_ATTRIBUTE.IDENTIFIED_ITEM')) <= 1)
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY general_datum_reference #
|
||||
####################
|
||||
class general_datum_reference(shape_aspect):
|
||||
'''Entity general_datum_reference definition.
|
||||
|
||||
:param base
|
||||
:type base:datum_or_common_datum
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__of_shape , base, ):
|
||||
shape_aspect.__init__(self , inherited0__name , inherited1__of_shape , )
|
||||
self.base = base
|
||||
|
||||
@apply
|
||||
def base():
|
||||
def fget( self ):
|
||||
return self._base
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument base is mandatory and can not be set to None')
|
||||
if not check_type(value,datum_or_common_datum):
|
||||
self._base = datum_or_common_datum(value)
|
||||
else:
|
||||
self._base = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (( not ('INDEX_ATTRIBUTE.COMMON_DATUM_LIST' == TYPEOF(self.base))) or (self.self.shape_aspect.self.of_shape == self.base[1].self.shape_aspect.self.of_shape))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY product_definition_shape #
|
||||
####################
|
||||
class product_definition_shape(BaseEntityClass):
|
||||
'''Entity product_definition_shape definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
|
||||
####################
|
||||
# ENTITY datum_reference_element #
|
||||
####################
|
||||
class datum_reference_element(general_datum_reference):
|
||||
'''Entity datum_reference_element definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__of_shape , inherited2__base , ):
|
||||
general_datum_reference.__init__(self , inherited0__name , inherited1__of_shape , inherited2__base , )
|
||||
|
||||
####################
|
||||
# ENTITY datum #
|
||||
####################
|
||||
class datum(shape_aspect):
|
||||
'''Entity datum definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__of_shape , ):
|
||||
shape_aspect.__init__(self , inherited0__name , inherited1__of_shape , )
|
||||
@@ -1,353 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'multiple_rep'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype text
|
||||
class text(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype representation_context
|
||||
class representation_context(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype identifier
|
||||
class identifier(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype shape_definition
|
||||
class shape_definition(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype transformation
|
||||
class transformation(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype representation_item
|
||||
class representation_item(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype characterized_product_definition
|
||||
class characterized_product_definition(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# SELECT TYPE characterized_definition
|
||||
characterized_definition = SELECT(
|
||||
'characterized_object',
|
||||
'characterized_product_definition',
|
||||
'shape_definition',
|
||||
scope = schema_scope)
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype characterized_object
|
||||
class characterized_object(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY representation_relationship #
|
||||
####################
|
||||
class representation_relationship(BaseEntityClass):
|
||||
'''Entity representation_relationship definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param rep_1
|
||||
:type rep_1:representation
|
||||
|
||||
:param rep_2
|
||||
:type rep_2:representation
|
||||
'''
|
||||
def __init__( self , name,rep_1,rep_2, ):
|
||||
self.name = name
|
||||
self.rep_1 = rep_1
|
||||
self.rep_2 = rep_2
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def rep_1():
|
||||
def fget( self ):
|
||||
return self._rep_1
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument rep_1 is mandatory and can not be set to None')
|
||||
if not check_type(value,representation):
|
||||
self._rep_1 = representation(value)
|
||||
else:
|
||||
self._rep_1 = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def rep_2():
|
||||
def fget( self ):
|
||||
return self._rep_2
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument rep_2 is mandatory and can not be set to None')
|
||||
if not check_type(value,representation):
|
||||
self._rep_2 = representation(value)
|
||||
else:
|
||||
self._rep_2 = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY shape_representation_relationship #
|
||||
####################
|
||||
class shape_representation_relationship(representation_relationship):
|
||||
'''Entity shape_representation_relationship definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , ):
|
||||
representation_relationship.__init__(self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , )
|
||||
def wr1(self):
|
||||
eval_wr1_wr = ('MULTIPLE_REP.SHAPE_REPRESENTATION' == (TYPEOF(self.self.representation_relationship.self.rep_1) + TYPEOF(self.self.representation_relationship.self.rep_2)))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY representation #
|
||||
####################
|
||||
class representation(BaseEntityClass):
|
||||
'''Entity representation definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param items
|
||||
:type items:SET(1,None,'STRING', scope = schema_scope)
|
||||
|
||||
:param context_of_items
|
||||
:type context_of_items:representation_context
|
||||
'''
|
||||
def __init__( self , name,items,context_of_items, ):
|
||||
self.name = name
|
||||
self.items = items
|
||||
self.context_of_items = context_of_items
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def items():
|
||||
def fget( self ):
|
||||
return self._items
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument items is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,None,'STRING', scope = schema_scope)):
|
||||
self._items = SET(value)
|
||||
else:
|
||||
self._items = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def context_of_items():
|
||||
def fget( self ):
|
||||
return self._context_of_items
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument context_of_items is mandatory and can not be set to None')
|
||||
if not check_type(value,representation_context):
|
||||
self._context_of_items = representation_context(value)
|
||||
else:
|
||||
self._context_of_items = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'ID_ATTRIBUTE.IDENTIFIED_ITEM')) <= 1)
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
def wr2(self):
|
||||
eval_wr2_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1)
|
||||
if not eval_wr2_wr:
|
||||
raise AssertionError('Rule wr2 violated')
|
||||
else:
|
||||
return eval_wr2_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY property_definition #
|
||||
####################
|
||||
class property_definition(BaseEntityClass):
|
||||
'''Entity property_definition definition.
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param definition
|
||||
:type definition:characterized_definition
|
||||
'''
|
||||
def __init__( self , name,definition, ):
|
||||
self.name = name
|
||||
self.definition = definition
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def definition():
|
||||
def fget( self ):
|
||||
return self._definition
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument definition is mandatory and can not be set to None')
|
||||
if not check_type(value,characterized_definition):
|
||||
self._definition = characterized_definition(value)
|
||||
else:
|
||||
self._definition = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'ID_ATTRIBUTE.IDENTIFIED_ITEM')) <= 1)
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY context_dependent_shape_representation #
|
||||
####################
|
||||
class context_dependent_shape_representation(BaseEntityClass):
|
||||
'''Entity context_dependent_shape_representation definition.
|
||||
|
||||
:param representation_relation
|
||||
:type representation_relation:shape_representation_relationship
|
||||
'''
|
||||
def __init__( self , representation_relation, ):
|
||||
self.representation_relation = representation_relation
|
||||
|
||||
@apply
|
||||
def representation_relation():
|
||||
def fget( self ):
|
||||
return self._representation_relation
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument representation_relation is mandatory and can not be set to None')
|
||||
if not check_type(value,shape_representation_relationship):
|
||||
self._representation_relation = shape_representation_relationship(value)
|
||||
else:
|
||||
self._representation_relation = value
|
||||
return property(**locals())
|
||||
def wr2(self):
|
||||
eval_wr2_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'DESCRIPTION_ATTRIBUTE.DESCRIBED_ITEM')) <= 1)
|
||||
if not eval_wr2_wr:
|
||||
raise AssertionError('Rule wr2 violated')
|
||||
else:
|
||||
return eval_wr2_wr
|
||||
|
||||
def wr3(self):
|
||||
eval_wr3_wr = (SIZEOF(USEDIN(self,'MULTIPLE_REP.' + 'NAME_ATTRIBUTE.NAMED_ITEM')) <= 1)
|
||||
if not eval_wr3_wr:
|
||||
raise AssertionError('Rule wr3 violated')
|
||||
else:
|
||||
return eval_wr3_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY definitional_representation_relationship #
|
||||
####################
|
||||
class definitional_representation_relationship(representation_relationship):
|
||||
'''Entity definitional_representation_relationship definition.
|
||||
'''
|
||||
def __init__( self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , ):
|
||||
representation_relationship.__init__(self , inherited0__name , inherited1__rep_1 , inherited2__rep_2 , )
|
||||
|
||||
####################
|
||||
# ENTITY component_2d_location #
|
||||
####################
|
||||
class component_2d_location(context_dependent_shape_representation,shape_representation_relationship,definitional_representation_relationship):
|
||||
'''Entity component_2d_location definition.
|
||||
|
||||
:param context_dependent_shape_representation_representation_relation
|
||||
:type context_dependent_shape_representation_representation_relation:component_2d_location
|
||||
'''
|
||||
def __init__( self , inherited0__representation_relation , inherited1__name , inherited2__rep_1 , inherited3__rep_2 , inherited4__name , inherited5__rep_1 , inherited6__rep_2 , ):
|
||||
context_dependent_shape_representation.__init__(self , inherited0__representation_relation , )
|
||||
shape_representation_relationship.__init__(self , inherited1__name , inherited2__rep_1 , inherited3__rep_2 , )
|
||||
definitional_representation_relationship.__init__(self , inherited4__name , inherited5__rep_1 , inherited6__rep_2 , )
|
||||
|
||||
@apply
|
||||
def context_dependent_shape_representation_representation_relation():
|
||||
def fget( self ):
|
||||
attribute_eval = self
|
||||
return attribute_eval
|
||||
def fset( self, value ):
|
||||
# DERIVED argument
|
||||
raise AssertionError('Argument context_dependent_shape_representation_representation_relation is DERIVED. It is computed and can not be set to any value')
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (self.self.representation_relationship.self.name == 'component 2d location')
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_array'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY point #
|
||||
####################
|
||||
class point(BaseEntityClass):
|
||||
'''Entity point definition.
|
||||
|
||||
:param coords
|
||||
:type coords:ARRAY(1,3,'REAL', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , coords, ):
|
||||
self.coords = coords
|
||||
|
||||
@apply
|
||||
def coords():
|
||||
def fget( self ):
|
||||
return self._coords
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument coords is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,'REAL', scope = schema_scope)):
|
||||
self._coords = ARRAY(value)
|
||||
else:
|
||||
self._coords = value
|
||||
return property(**locals())
|
||||
@@ -1,43 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_array_of_array_of_simple_types'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY transformation #
|
||||
####################
|
||||
class transformation(BaseEntityClass):
|
||||
'''Entity transformation definition.
|
||||
|
||||
:param rotation
|
||||
:type rotation:ARRAY(1,3,ARRAY(1,3,'REAL', scope = schema_scope))
|
||||
'''
|
||||
def __init__( self , rotation, ):
|
||||
self.rotation = rotation
|
||||
|
||||
@apply
|
||||
def rotation():
|
||||
def fget( self ):
|
||||
return self._rotation
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument rotation is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,ARRAY(1,3,'REAL', scope = schema_scope))):
|
||||
self._rotation = ARRAY(value)
|
||||
else:
|
||||
self._rotation = value
|
||||
return property(**locals())
|
||||
@@ -1,79 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_array_of_simple_types'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY point #
|
||||
####################
|
||||
class point(BaseEntityClass):
|
||||
'''Entity point definition.
|
||||
|
||||
:param arr_real
|
||||
:type arr_real:ARRAY(1,3,'REAL', scope = schema_scope)
|
||||
|
||||
:param arr_string
|
||||
:type arr_string:ARRAY(1,3,'STRING', scope = schema_scope)
|
||||
|
||||
:param arr_integer
|
||||
:type arr_integer:ARRAY(1,None,'INTEGER', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , arr_real,arr_string,arr_integer, ):
|
||||
self.arr_real = arr_real
|
||||
self.arr_string = arr_string
|
||||
self.arr_integer = arr_integer
|
||||
|
||||
@apply
|
||||
def arr_real():
|
||||
def fget( self ):
|
||||
return self._arr_real
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument arr_real is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,'REAL', scope = schema_scope)):
|
||||
self._arr_real = ARRAY(value)
|
||||
else:
|
||||
self._arr_real = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def arr_string():
|
||||
def fget( self ):
|
||||
return self._arr_string
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument arr_string is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,3,'STRING', scope = schema_scope)):
|
||||
self._arr_string = ARRAY(value)
|
||||
else:
|
||||
self._arr_string = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def arr_integer():
|
||||
def fget( self ):
|
||||
return self._arr_integer
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument arr_integer is mandatory and can not be set to None')
|
||||
if not check_type(value,ARRAY(1,None,'INTEGER', scope = schema_scope)):
|
||||
self._arr_integer = ARRAY(value)
|
||||
else:
|
||||
self._arr_integer = value
|
||||
return property(**locals())
|
||||
@@ -1,123 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_derived_attribute'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY vector #
|
||||
####################
|
||||
class vector(BaseEntityClass):
|
||||
'''Entity vector definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
|
||||
####################
|
||||
# ENTITY circle #
|
||||
####################
|
||||
class circle(BaseEntityClass):
|
||||
'''Entity circle definition.
|
||||
|
||||
:param centre
|
||||
:type centre:point
|
||||
|
||||
:param radius
|
||||
:type radius:REAL
|
||||
|
||||
:param axis
|
||||
:type axis:vector
|
||||
|
||||
:param area
|
||||
:type area:REAL
|
||||
|
||||
:param perimeter
|
||||
:type perimeter:REAL
|
||||
'''
|
||||
def __init__( self , centre,radius,axis, ):
|
||||
self.centre = centre
|
||||
self.radius = radius
|
||||
self.axis = axis
|
||||
|
||||
@apply
|
||||
def centre():
|
||||
def fget( self ):
|
||||
return self._centre
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument centre is mandatory and can not be set to None')
|
||||
if not check_type(value,point):
|
||||
self._centre = point(value)
|
||||
else:
|
||||
self._centre = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def radius():
|
||||
def fget( self ):
|
||||
return self._radius
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument radius is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._radius = REAL(value)
|
||||
else:
|
||||
self._radius = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def axis():
|
||||
def fget( self ):
|
||||
return self._axis
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument axis is mandatory and can not be set to None')
|
||||
if not check_type(value,vector):
|
||||
self._axis = vector(value)
|
||||
else:
|
||||
self._axis = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def area():
|
||||
def fget( self ):
|
||||
attribute_eval = ( PI * (self.radius ** 2))
|
||||
return attribute_eval
|
||||
def fset( self, value ):
|
||||
# DERIVED argument
|
||||
raise AssertionError('Argument area is DERIVED. It is computed and can not be set to any value')
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def perimeter():
|
||||
def fget( self ):
|
||||
attribute_eval = ((2 * PI ) * self.radius)
|
||||
return attribute_eval
|
||||
def fset( self, value ):
|
||||
# DERIVED argument
|
||||
raise AssertionError('Argument perimeter is DERIVED. It is computed and can not be set to any value')
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY point #
|
||||
####################
|
||||
class point(BaseEntityClass):
|
||||
'''Entity point definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
@@ -1,322 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_entity_where_rule'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY unit_vector #
|
||||
####################
|
||||
class unit_vector(BaseEntityClass):
|
||||
'''Entity unit_vector definition.
|
||||
|
||||
:param a
|
||||
:type a:REAL
|
||||
|
||||
:param b
|
||||
:type b:REAL
|
||||
|
||||
:param c
|
||||
:type c:REAL
|
||||
'''
|
||||
def __init__( self , a,b,c, ):
|
||||
self.a = a
|
||||
self.b = b
|
||||
self.c = c
|
||||
|
||||
@apply
|
||||
def a():
|
||||
def fget( self ):
|
||||
return self._a
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument a is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._a = REAL(value)
|
||||
else:
|
||||
self._a = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def b():
|
||||
def fget( self ):
|
||||
return self._b
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument b is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._b = REAL(value)
|
||||
else:
|
||||
self._b = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def c():
|
||||
def fget( self ):
|
||||
return self._c
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument c is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._c = REAL(value)
|
||||
else:
|
||||
self._c = value
|
||||
return property(**locals())
|
||||
def length_1(self):
|
||||
eval_length_1_wr = ((((self.a ** 2) + (self.b ** 2)) + (self.c ** 2)) == 1)
|
||||
if not eval_length_1_wr:
|
||||
raise AssertionError('Rule length_1 violated')
|
||||
else:
|
||||
return eval_length_1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY address #
|
||||
####################
|
||||
class address(BaseEntityClass):
|
||||
'''Entity address definition.
|
||||
|
||||
:param internal_location
|
||||
:type internal_location:label
|
||||
|
||||
:param street_number
|
||||
:type street_number:label
|
||||
|
||||
:param street
|
||||
:type street:label
|
||||
|
||||
:param postal_box
|
||||
:type postal_box:label
|
||||
|
||||
:param town
|
||||
:type town:label
|
||||
|
||||
:param region
|
||||
:type region:label
|
||||
|
||||
:param postal_code
|
||||
:type postal_code:label
|
||||
|
||||
:param country
|
||||
:type country:label
|
||||
|
||||
:param facsimile_number
|
||||
:type facsimile_number:label
|
||||
|
||||
:param telephone_number
|
||||
:type telephone_number:label
|
||||
|
||||
:param electronic_mail_address
|
||||
:type electronic_mail_address:label
|
||||
|
||||
:param telex_number
|
||||
:type telex_number:label
|
||||
'''
|
||||
def __init__( self , internal_location,street_number,street,postal_box,town,region,postal_code,country,facsimile_number,telephone_number,electronic_mail_address,telex_number, ):
|
||||
self.internal_location = internal_location
|
||||
self.street_number = street_number
|
||||
self.street = street
|
||||
self.postal_box = postal_box
|
||||
self.town = town
|
||||
self.region = region
|
||||
self.postal_code = postal_code
|
||||
self.country = country
|
||||
self.facsimile_number = facsimile_number
|
||||
self.telephone_number = telephone_number
|
||||
self.electronic_mail_address = electronic_mail_address
|
||||
self.telex_number = telex_number
|
||||
|
||||
@apply
|
||||
def internal_location():
|
||||
def fget( self ):
|
||||
return self._internal_location
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._internal_location = label(value)
|
||||
else:
|
||||
self._internal_location = value
|
||||
else:
|
||||
self._internal_location = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street_number():
|
||||
def fget( self ):
|
||||
return self._street_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street_number = label(value)
|
||||
else:
|
||||
self._street_number = value
|
||||
else:
|
||||
self._street_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street():
|
||||
def fget( self ):
|
||||
return self._street
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street = label(value)
|
||||
else:
|
||||
self._street = value
|
||||
else:
|
||||
self._street = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_box():
|
||||
def fget( self ):
|
||||
return self._postal_box
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_box = label(value)
|
||||
else:
|
||||
self._postal_box = value
|
||||
else:
|
||||
self._postal_box = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def town():
|
||||
def fget( self ):
|
||||
return self._town
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._town = label(value)
|
||||
else:
|
||||
self._town = value
|
||||
else:
|
||||
self._town = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def region():
|
||||
def fget( self ):
|
||||
return self._region
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._region = label(value)
|
||||
else:
|
||||
self._region = value
|
||||
else:
|
||||
self._region = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_code():
|
||||
def fget( self ):
|
||||
return self._postal_code
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_code = label(value)
|
||||
else:
|
||||
self._postal_code = value
|
||||
else:
|
||||
self._postal_code = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def country():
|
||||
def fget( self ):
|
||||
return self._country
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._country = label(value)
|
||||
else:
|
||||
self._country = value
|
||||
else:
|
||||
self._country = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def facsimile_number():
|
||||
def fget( self ):
|
||||
return self._facsimile_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._facsimile_number = label(value)
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telephone_number():
|
||||
def fget( self ):
|
||||
return self._telephone_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telephone_number = label(value)
|
||||
else:
|
||||
self._telephone_number = value
|
||||
else:
|
||||
self._telephone_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def electronic_mail_address():
|
||||
def fget( self ):
|
||||
return self._electronic_mail_address
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._electronic_mail_address = label(value)
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telex_number():
|
||||
def fget( self ):
|
||||
return self._telex_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telex_number = label(value)
|
||||
else:
|
||||
self._telex_number = value
|
||||
else:
|
||||
self._telex_number = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (((((((((((EXISTS(self.internal_location) or EXISTS(self.street_number)) or EXISTS(self.street)) or EXISTS(self.postal_box)) or EXISTS(self.town)) or EXISTS(self.region)) or EXISTS(self.postal_code)) or EXISTS(self.country)) or EXISTS(self.facsimile_number)) or EXISTS(self.telephone_number)) or EXISTS(self.electronic_mail_address)) or EXISTS(self.telex_number))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_enum_entity_name'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
# ENUMERATION TYPE simple_datum_reference_modifier
|
||||
simple_datum_reference_modifier = ENUMERATION(
|
||||
'line',
|
||||
'translation',
|
||||
scope = schema_scope)
|
||||
|
||||
####################
|
||||
# ENTITY line #
|
||||
####################
|
||||
class line(BaseEntityClass):
|
||||
'''Entity line definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
@@ -1,29 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_enums_same_name'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
# ENUMERATION TYPE hair_color
|
||||
hair_color = ENUMERATION(
|
||||
'bald',
|
||||
'red',
|
||||
scope = schema_scope)
|
||||
|
||||
# ENUMERATION TYPE favorite_color
|
||||
favorite_color = ENUMERATION(
|
||||
'clear',
|
||||
'red',
|
||||
scope = schema_scope)
|
||||
@@ -1,80 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_function'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY dummy #
|
||||
####################
|
||||
class dummy(BaseEntityClass):
|
||||
'''Entity dummy definition.
|
||||
'''
|
||||
# This class does not define any attribute.
|
||||
pass
|
||||
|
||||
####################
|
||||
# FUNCTION add #
|
||||
####################
|
||||
def add(r1,r2,):
|
||||
'''
|
||||
:param r1
|
||||
:type r1:REAL
|
||||
:param r2
|
||||
:type r2:REAL
|
||||
'''
|
||||
result = r1 + r2
|
||||
return result
|
||||
|
||||
####################
|
||||
# FUNCTION pow_n #
|
||||
####################
|
||||
def pow_n(r1,n,):
|
||||
'''
|
||||
:param r1
|
||||
:type r1:REAL
|
||||
:param n
|
||||
:type n:INTEGER
|
||||
'''
|
||||
if (n == 0):
|
||||
return 1
|
||||
else:
|
||||
result = r1
|
||||
for i in range(1,n,1):
|
||||
result = result * r1
|
||||
return result
|
||||
|
||||
####################
|
||||
# FUNCTION case_1 #
|
||||
####################
|
||||
def case_1(a,):
|
||||
'''
|
||||
:param a
|
||||
:type a:INTEGER
|
||||
'''
|
||||
case_selector = a
|
||||
if case_selector == 1:
|
||||
x = SIN(a)
|
||||
elif case_selector == 2:
|
||||
x = EXP(a)
|
||||
elif case_selector == 3:
|
||||
x = SQRT(a)
|
||||
elif case_selector == 4:
|
||||
x = LOG(a)
|
||||
elif case_selector == 5:
|
||||
x = LOG(a)
|
||||
else:
|
||||
x = 0
|
||||
return x
|
||||
@@ -1,582 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_multiple_inheritance'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# SELECT TYPE classification_item
|
||||
classification_item = SELECT(
|
||||
'person_and_organization_address',
|
||||
'address',
|
||||
scope = schema_scope)
|
||||
# Defined datatype text
|
||||
class text(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype identifier
|
||||
class identifier(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY address #
|
||||
####################
|
||||
class address(BaseEntityClass):
|
||||
'''Entity address definition.
|
||||
|
||||
:param internal_location
|
||||
:type internal_location:label
|
||||
|
||||
:param street_number
|
||||
:type street_number:label
|
||||
|
||||
:param street
|
||||
:type street:label
|
||||
|
||||
:param postal_box
|
||||
:type postal_box:label
|
||||
|
||||
:param town
|
||||
:type town:label
|
||||
|
||||
:param region
|
||||
:type region:label
|
||||
|
||||
:param postal_code
|
||||
:type postal_code:label
|
||||
|
||||
:param country
|
||||
:type country:label
|
||||
|
||||
:param facsimile_number
|
||||
:type facsimile_number:label
|
||||
|
||||
:param telephone_number
|
||||
:type telephone_number:label
|
||||
|
||||
:param electronic_mail_address
|
||||
:type electronic_mail_address:label
|
||||
|
||||
:param telex_number
|
||||
:type telex_number:label
|
||||
'''
|
||||
def __init__( self , internal_location,street_number,street,postal_box,town,region,postal_code,country,facsimile_number,telephone_number,electronic_mail_address,telex_number, ):
|
||||
self.internal_location = internal_location
|
||||
self.street_number = street_number
|
||||
self.street = street
|
||||
self.postal_box = postal_box
|
||||
self.town = town
|
||||
self.region = region
|
||||
self.postal_code = postal_code
|
||||
self.country = country
|
||||
self.facsimile_number = facsimile_number
|
||||
self.telephone_number = telephone_number
|
||||
self.electronic_mail_address = electronic_mail_address
|
||||
self.telex_number = telex_number
|
||||
|
||||
@apply
|
||||
def internal_location():
|
||||
def fget( self ):
|
||||
return self._internal_location
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._internal_location = label(value)
|
||||
else:
|
||||
self._internal_location = value
|
||||
else:
|
||||
self._internal_location = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street_number():
|
||||
def fget( self ):
|
||||
return self._street_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street_number = label(value)
|
||||
else:
|
||||
self._street_number = value
|
||||
else:
|
||||
self._street_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def street():
|
||||
def fget( self ):
|
||||
return self._street
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._street = label(value)
|
||||
else:
|
||||
self._street = value
|
||||
else:
|
||||
self._street = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_box():
|
||||
def fget( self ):
|
||||
return self._postal_box
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_box = label(value)
|
||||
else:
|
||||
self._postal_box = value
|
||||
else:
|
||||
self._postal_box = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def town():
|
||||
def fget( self ):
|
||||
return self._town
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._town = label(value)
|
||||
else:
|
||||
self._town = value
|
||||
else:
|
||||
self._town = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def region():
|
||||
def fget( self ):
|
||||
return self._region
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._region = label(value)
|
||||
else:
|
||||
self._region = value
|
||||
else:
|
||||
self._region = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def postal_code():
|
||||
def fget( self ):
|
||||
return self._postal_code
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._postal_code = label(value)
|
||||
else:
|
||||
self._postal_code = value
|
||||
else:
|
||||
self._postal_code = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def country():
|
||||
def fget( self ):
|
||||
return self._country
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._country = label(value)
|
||||
else:
|
||||
self._country = value
|
||||
else:
|
||||
self._country = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def facsimile_number():
|
||||
def fget( self ):
|
||||
return self._facsimile_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._facsimile_number = label(value)
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
else:
|
||||
self._facsimile_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telephone_number():
|
||||
def fget( self ):
|
||||
return self._telephone_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telephone_number = label(value)
|
||||
else:
|
||||
self._telephone_number = value
|
||||
else:
|
||||
self._telephone_number = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def electronic_mail_address():
|
||||
def fget( self ):
|
||||
return self._electronic_mail_address
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._electronic_mail_address = label(value)
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
else:
|
||||
self._electronic_mail_address = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def telex_number():
|
||||
def fget( self ):
|
||||
return self._telex_number
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._telex_number = label(value)
|
||||
else:
|
||||
self._telex_number = value
|
||||
else:
|
||||
self._telex_number = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY personal_address #
|
||||
####################
|
||||
class personal_address(address):
|
||||
'''Entity personal_address definition.
|
||||
|
||||
:param people
|
||||
:type people:SET(1,None,'person', scope = schema_scope)
|
||||
|
||||
:param description
|
||||
:type description:text
|
||||
'''
|
||||
def __init__( self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , people,description, ):
|
||||
address.__init__(self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , )
|
||||
self.people = people
|
||||
self.description = description
|
||||
|
||||
@apply
|
||||
def people():
|
||||
def fget( self ):
|
||||
return self._people
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument people is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,None,'person', scope = schema_scope)):
|
||||
self._people = SET(value)
|
||||
else:
|
||||
self._people = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def description():
|
||||
def fget( self ):
|
||||
return self._description
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,text):
|
||||
self._description = text(value)
|
||||
else:
|
||||
self._description = value
|
||||
else:
|
||||
self._description = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY organizational_address #
|
||||
####################
|
||||
class organizational_address(address):
|
||||
'''Entity organizational_address definition.
|
||||
|
||||
:param organizations
|
||||
:type organizations:SET(1,None,'organization', scope = schema_scope)
|
||||
|
||||
:param description
|
||||
:type description:text
|
||||
'''
|
||||
def __init__( self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , organizations,description, ):
|
||||
address.__init__(self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , )
|
||||
self.organizations = organizations
|
||||
self.description = description
|
||||
|
||||
@apply
|
||||
def organizations():
|
||||
def fget( self ):
|
||||
return self._organizations
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument organizations is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,None,'organization', scope = schema_scope)):
|
||||
self._organizations = SET(value)
|
||||
else:
|
||||
self._organizations = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def description():
|
||||
def fget( self ):
|
||||
return self._description
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,text):
|
||||
self._description = text(value)
|
||||
else:
|
||||
self._description = value
|
||||
else:
|
||||
self._description = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY person #
|
||||
####################
|
||||
class person(BaseEntityClass):
|
||||
'''Entity person definition.
|
||||
|
||||
:param id
|
||||
:type id:identifier
|
||||
|
||||
:param last_name
|
||||
:type last_name:label
|
||||
|
||||
:param first_name
|
||||
:type first_name:label
|
||||
|
||||
:param middle_names
|
||||
:type middle_names:LIST(1,None,'STRING', scope = schema_scope)
|
||||
|
||||
:param prefix_titles
|
||||
:type prefix_titles:LIST(1,None,'STRING', scope = schema_scope)
|
||||
|
||||
:param suffix_titles
|
||||
:type suffix_titles:LIST(1,None,'STRING', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , id,last_name,first_name,middle_names,prefix_titles,suffix_titles, ):
|
||||
self.id = id
|
||||
self.last_name = last_name
|
||||
self.first_name = first_name
|
||||
self.middle_names = middle_names
|
||||
self.prefix_titles = prefix_titles
|
||||
self.suffix_titles = suffix_titles
|
||||
|
||||
@apply
|
||||
def id():
|
||||
def fget( self ):
|
||||
return self._id
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument id is mandatory and can not be set to None')
|
||||
if not check_type(value,identifier):
|
||||
self._id = identifier(value)
|
||||
else:
|
||||
self._id = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def last_name():
|
||||
def fget( self ):
|
||||
return self._last_name
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._last_name = label(value)
|
||||
else:
|
||||
self._last_name = value
|
||||
else:
|
||||
self._last_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def first_name():
|
||||
def fget( self ):
|
||||
return self._first_name
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,label):
|
||||
self._first_name = label(value)
|
||||
else:
|
||||
self._first_name = value
|
||||
else:
|
||||
self._first_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def middle_names():
|
||||
def fget( self ):
|
||||
return self._middle_names
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,LIST(1,None,'STRING', scope = schema_scope)):
|
||||
self._middle_names = LIST(value)
|
||||
else:
|
||||
self._middle_names = value
|
||||
else:
|
||||
self._middle_names = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def prefix_titles():
|
||||
def fget( self ):
|
||||
return self._prefix_titles
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,LIST(1,None,'STRING', scope = schema_scope)):
|
||||
self._prefix_titles = LIST(value)
|
||||
else:
|
||||
self._prefix_titles = value
|
||||
else:
|
||||
self._prefix_titles = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def suffix_titles():
|
||||
def fget( self ):
|
||||
return self._suffix_titles
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,LIST(1,None,'STRING', scope = schema_scope)):
|
||||
self._suffix_titles = LIST(value)
|
||||
else:
|
||||
self._suffix_titles = value
|
||||
else:
|
||||
self._suffix_titles = value
|
||||
return property(**locals())
|
||||
def wr1(self):
|
||||
eval_wr1_wr = (EXISTS(self.last_name) or EXISTS(self.first_name))
|
||||
if not eval_wr1_wr:
|
||||
raise AssertionError('Rule wr1 violated')
|
||||
else:
|
||||
return eval_wr1_wr
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY organization #
|
||||
####################
|
||||
class organization(BaseEntityClass):
|
||||
'''Entity organization definition.
|
||||
|
||||
:param id
|
||||
:type id:identifier
|
||||
|
||||
:param name
|
||||
:type name:label
|
||||
|
||||
:param description
|
||||
:type description:text
|
||||
'''
|
||||
def __init__( self , id,name,description, ):
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.description = description
|
||||
|
||||
@apply
|
||||
def id():
|
||||
def fget( self ):
|
||||
return self._id
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,identifier):
|
||||
self._id = identifier(value)
|
||||
else:
|
||||
self._id = value
|
||||
else:
|
||||
self._id = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def name():
|
||||
def fget( self ):
|
||||
return self._name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._name = label(value)
|
||||
else:
|
||||
self._name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def description():
|
||||
def fget( self ):
|
||||
return self._description
|
||||
def fset( self, value ):
|
||||
if value != None: # OPTIONAL attribute
|
||||
if not check_type(value,text):
|
||||
self._description = text(value)
|
||||
else:
|
||||
self._description = value
|
||||
else:
|
||||
self._description = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY person_and_organization_address #
|
||||
####################
|
||||
class person_and_organization_address(organizational_address,personal_address):
|
||||
'''Entity person_and_organization_address definition.
|
||||
|
||||
:param organizational_address_organizations
|
||||
:type organizational_address_organizations:SET(1,1,'organization', scope = schema_scope)
|
||||
|
||||
:param personal_address_people
|
||||
:type personal_address_people:SET(1,1,'person', scope = schema_scope)
|
||||
'''
|
||||
def __init__( self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , inherited12__organizations , inherited13__description , inherited14__internal_location , inherited15__street_number , inherited16__street , inherited17__postal_box , inherited18__town , inherited19__region , inherited20__postal_code , inherited21__country , inherited22__facsimile_number , inherited23__telephone_number , inherited24__electronic_mail_address , inherited25__telex_number , inherited26__people , inherited27__description , organizational_address_organizations,personal_address_people, ):
|
||||
organizational_address.__init__(self , inherited0__internal_location , inherited1__street_number , inherited2__street , inherited3__postal_box , inherited4__town , inherited5__region , inherited6__postal_code , inherited7__country , inherited8__facsimile_number , inherited9__telephone_number , inherited10__electronic_mail_address , inherited11__telex_number , inherited12__organizations , inherited13__description , )
|
||||
personal_address.__init__(self , inherited14__internal_location , inherited15__street_number , inherited16__street , inherited17__postal_box , inherited18__town , inherited19__region , inherited20__postal_code , inherited21__country , inherited22__facsimile_number , inherited23__telephone_number , inherited24__electronic_mail_address , inherited25__telex_number , inherited26__people , inherited27__description , )
|
||||
self.organizational_address_organizations = organizational_address_organizations
|
||||
self.personal_address_people = personal_address_people
|
||||
|
||||
@apply
|
||||
def organizational_address_organizations():
|
||||
def fget( self ):
|
||||
return self._organizational_address_organizations
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument organizational_address_organizations is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,1,'organization', scope = schema_scope)):
|
||||
self._organizational_address_organizations = SET(value)
|
||||
else:
|
||||
self._organizational_address_organizations = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def personal_address_people():
|
||||
def fget( self ):
|
||||
return self._personal_address_people
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument personal_address_people is mandatory and can not be set to None')
|
||||
if not check_type(value,SET(1,1,'person', scope = schema_scope)):
|
||||
self._personal_address_people = SET(value)
|
||||
else:
|
||||
self._personal_address_people = value
|
||||
return property(**locals())
|
||||
@@ -1,94 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_named_type'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype measure
|
||||
class measure(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype type2
|
||||
class type2(INTEGER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype type3
|
||||
class type3(type2):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY line #
|
||||
####################
|
||||
class line(BaseEntityClass):
|
||||
'''Entity line definition.
|
||||
|
||||
:param line_length
|
||||
:type line_length:measure
|
||||
|
||||
:param other_param
|
||||
:type other_param:type3
|
||||
|
||||
:param and_another
|
||||
:type and_another:REAL
|
||||
'''
|
||||
def __init__( self , line_length,other_param,and_another, ):
|
||||
self.line_length = line_length
|
||||
self.other_param = other_param
|
||||
self.and_another = and_another
|
||||
|
||||
@apply
|
||||
def line_length():
|
||||
def fget( self ):
|
||||
return self._line_length
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument line_length is mandatory and can not be set to None')
|
||||
if not check_type(value,measure):
|
||||
self._line_length = measure(value)
|
||||
else:
|
||||
self._line_length = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def other_param():
|
||||
def fget( self ):
|
||||
return self._other_param
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument other_param is mandatory and can not be set to None')
|
||||
if not check_type(value,type3):
|
||||
self._other_param = type3(value)
|
||||
else:
|
||||
self._other_param = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def and_another():
|
||||
def fget( self ):
|
||||
return self._and_another
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument and_another is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._and_another = REAL(value)
|
||||
else:
|
||||
self._and_another = value
|
||||
return property(**locals())
|
||||
@@ -1,252 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_select_data_type'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# SELECT TYPE permanent_attachment
|
||||
permanent_attachment = SELECT(
|
||||
'glue',
|
||||
'weld',
|
||||
scope = schema_scope)
|
||||
# SELECT TYPE temporary_attachment
|
||||
temporary_attachment = SELECT(
|
||||
'nail',
|
||||
'screw',
|
||||
scope = schema_scope)
|
||||
# SELECT TYPE attachment_method
|
||||
attachment_method = SELECT(
|
||||
'permanent_attachment',
|
||||
'temporary_attachment',
|
||||
scope = schema_scope)
|
||||
|
||||
####################
|
||||
# ENTITY weld #
|
||||
####################
|
||||
class weld(BaseEntityClass):
|
||||
'''Entity weld definition.
|
||||
|
||||
:param composition
|
||||
:type composition:STRING
|
||||
'''
|
||||
def __init__( self , composition, ):
|
||||
self.composition = composition
|
||||
|
||||
@apply
|
||||
def composition():
|
||||
def fget( self ):
|
||||
return self._composition
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument composition is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._composition = STRING(value)
|
||||
else:
|
||||
self._composition = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY glue #
|
||||
####################
|
||||
class glue(BaseEntityClass):
|
||||
'''Entity glue definition.
|
||||
|
||||
:param composition
|
||||
:type composition:STRING
|
||||
|
||||
:param solvent
|
||||
:type solvent:STRING
|
||||
'''
|
||||
def __init__( self , composition,solvent, ):
|
||||
self.composition = composition
|
||||
self.solvent = solvent
|
||||
|
||||
@apply
|
||||
def composition():
|
||||
def fget( self ):
|
||||
return self._composition
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument composition is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._composition = STRING(value)
|
||||
else:
|
||||
self._composition = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def solvent():
|
||||
def fget( self ):
|
||||
return self._solvent
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument solvent is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._solvent = STRING(value)
|
||||
else:
|
||||
self._solvent = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY wall_mounting #
|
||||
####################
|
||||
class wall_mounting(BaseEntityClass):
|
||||
'''Entity wall_mounting definition.
|
||||
|
||||
:param mounting
|
||||
:type mounting:STRING
|
||||
|
||||
:param on
|
||||
:type on:STRING
|
||||
|
||||
:param using
|
||||
:type using:attachment_method
|
||||
'''
|
||||
def __init__( self , mounting,on,using, ):
|
||||
self.mounting = mounting
|
||||
self.on = on
|
||||
self.using = using
|
||||
|
||||
@apply
|
||||
def mounting():
|
||||
def fget( self ):
|
||||
return self._mounting
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument mounting is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._mounting = STRING(value)
|
||||
else:
|
||||
self._mounting = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def on():
|
||||
def fget( self ):
|
||||
return self._on
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument on is mandatory and can not be set to None')
|
||||
if not check_type(value,STRING):
|
||||
self._on = STRING(value)
|
||||
else:
|
||||
self._on = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def using():
|
||||
def fget( self ):
|
||||
return self._using
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument using is mandatory and can not be set to None')
|
||||
if not check_type(value,attachment_method):
|
||||
self._using = attachment_method(value)
|
||||
else:
|
||||
self._using = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY screw #
|
||||
####################
|
||||
class screw(BaseEntityClass):
|
||||
'''Entity screw definition.
|
||||
|
||||
:param body_length
|
||||
:type body_length:REAL
|
||||
|
||||
:param pitch
|
||||
:type pitch:REAL
|
||||
'''
|
||||
def __init__( self , body_length,pitch, ):
|
||||
self.body_length = body_length
|
||||
self.pitch = pitch
|
||||
|
||||
@apply
|
||||
def body_length():
|
||||
def fget( self ):
|
||||
return self._body_length
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument body_length is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._body_length = REAL(value)
|
||||
else:
|
||||
self._body_length = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def pitch():
|
||||
def fget( self ):
|
||||
return self._pitch
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument pitch is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._pitch = REAL(value)
|
||||
else:
|
||||
self._pitch = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY nail #
|
||||
####################
|
||||
class nail(BaseEntityClass):
|
||||
'''Entity nail definition.
|
||||
|
||||
:param body_length
|
||||
:type body_length:REAL
|
||||
|
||||
:param head_area
|
||||
:type head_area:REAL
|
||||
'''
|
||||
def __init__( self , body_length,head_area, ):
|
||||
self.body_length = body_length
|
||||
self.head_area = head_area
|
||||
|
||||
@apply
|
||||
def body_length():
|
||||
def fget( self ):
|
||||
return self._body_length
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument body_length is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._body_length = REAL(value)
|
||||
else:
|
||||
self._body_length = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def head_area():
|
||||
def fget( self ):
|
||||
return self._head_area
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument head_area is mandatory and can not be set to None')
|
||||
if not check_type(value,REAL):
|
||||
self._head_area = REAL(value)
|
||||
else:
|
||||
self._head_area = value
|
||||
return property(**locals())
|
||||
@@ -1,121 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_single_inheritance'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype length_measure
|
||||
class length_measure(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype point
|
||||
class point(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY shape #
|
||||
####################
|
||||
class shape(BaseEntityClass):
|
||||
'''Entity shape definition.
|
||||
|
||||
:param item_name
|
||||
:type item_name:label
|
||||
|
||||
:param number_of_sides
|
||||
:type number_of_sides:INTEGER
|
||||
'''
|
||||
def __init__( self , item_name,number_of_sides, ):
|
||||
self.item_name = item_name
|
||||
self.number_of_sides = number_of_sides
|
||||
|
||||
@apply
|
||||
def item_name():
|
||||
def fget( self ):
|
||||
return self._item_name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument item_name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._item_name = label(value)
|
||||
else:
|
||||
self._item_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def number_of_sides():
|
||||
def fget( self ):
|
||||
return self._number_of_sides
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument number_of_sides is mandatory and can not be set to None')
|
||||
if not check_type(value,INTEGER):
|
||||
self._number_of_sides = INTEGER(value)
|
||||
else:
|
||||
self._number_of_sides = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY rectangle #
|
||||
####################
|
||||
class rectangle(shape):
|
||||
'''Entity rectangle definition.
|
||||
|
||||
:param height
|
||||
:type height:length_measure
|
||||
|
||||
:param width
|
||||
:type width:length_measure
|
||||
'''
|
||||
def __init__( self , inherited0__item_name , inherited1__number_of_sides , height,width, ):
|
||||
shape.__init__(self , inherited0__item_name , inherited1__number_of_sides , )
|
||||
self.height = height
|
||||
self.width = width
|
||||
|
||||
@apply
|
||||
def height():
|
||||
def fget( self ):
|
||||
return self._height
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument height is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._height = length_measure(value)
|
||||
else:
|
||||
self._height = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def width():
|
||||
def fget( self ):
|
||||
return self._width
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument width is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._width = length_measure(value)
|
||||
else:
|
||||
self._width = value
|
||||
return property(**locals())
|
||||
@@ -1,130 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_single_inheritance_multi_level'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype length_measure
|
||||
class length_measure(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype label
|
||||
class label(STRING):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
# Defined datatype point
|
||||
class point(REAL):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
|
||||
|
||||
####################
|
||||
# ENTITY shape #
|
||||
####################
|
||||
class shape(BaseEntityClass):
|
||||
'''Entity shape definition.
|
||||
|
||||
:param item_name
|
||||
:type item_name:label
|
||||
|
||||
:param number_of_sides
|
||||
:type number_of_sides:INTEGER
|
||||
'''
|
||||
def __init__( self , item_name,number_of_sides, ):
|
||||
self.item_name = item_name
|
||||
self.number_of_sides = number_of_sides
|
||||
|
||||
@apply
|
||||
def item_name():
|
||||
def fget( self ):
|
||||
return self._item_name
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument item_name is mandatory and can not be set to None')
|
||||
if not check_type(value,label):
|
||||
self._item_name = label(value)
|
||||
else:
|
||||
self._item_name = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def number_of_sides():
|
||||
def fget( self ):
|
||||
return self._number_of_sides
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument number_of_sides is mandatory and can not be set to None')
|
||||
if not check_type(value,INTEGER):
|
||||
self._number_of_sides = INTEGER(value)
|
||||
else:
|
||||
self._number_of_sides = value
|
||||
return property(**locals())
|
||||
|
||||
####################
|
||||
# ENTITY subshape #
|
||||
####################
|
||||
class subshape(shape):
|
||||
'''Entity subshape definition.
|
||||
'''
|
||||
def __init__( self , inherited0__item_name , inherited1__number_of_sides , ):
|
||||
shape.__init__(self , inherited0__item_name , inherited1__number_of_sides , )
|
||||
|
||||
####################
|
||||
# ENTITY rectangle #
|
||||
####################
|
||||
class rectangle(subshape):
|
||||
'''Entity rectangle definition.
|
||||
|
||||
:param height
|
||||
:type height:length_measure
|
||||
|
||||
:param width
|
||||
:type width:length_measure
|
||||
'''
|
||||
def __init__( self , inherited0__item_name , inherited1__number_of_sides , height,width, ):
|
||||
subshape.__init__(self , inherited0__item_name , inherited1__number_of_sides , )
|
||||
self.height = height
|
||||
self.width = width
|
||||
|
||||
@apply
|
||||
def height():
|
||||
def fget( self ):
|
||||
return self._height
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument height is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._height = length_measure(value)
|
||||
else:
|
||||
self._height = value
|
||||
return property(**locals())
|
||||
|
||||
@apply
|
||||
def width():
|
||||
def fget( self ):
|
||||
return self._width
|
||||
def fset( self, value ):
|
||||
# Mandatory argument
|
||||
if value==None:
|
||||
raise AssertionError('Argument width is mandatory and can not be set to None')
|
||||
if not check_type(value,length_measure):
|
||||
self._width = length_measure(value)
|
||||
else:
|
||||
self._width = value
|
||||
return property(**locals())
|
||||
@@ -1,51 +0,0 @@
|
||||
# This file was generated by exp2python. You probably don't want to edit
|
||||
# it since your modifications will be lost if exp2python is used to
|
||||
# regenerate it.
|
||||
import sys
|
||||
|
||||
from SCL.SCLBase import *
|
||||
from SCL.SimpleDataTypes import *
|
||||
from SCL.ConstructedDataTypes import *
|
||||
from SCL.AggregationDataTypes import *
|
||||
from SCL.TypeChecker import check_type
|
||||
from SCL.Builtin import *
|
||||
from SCL.Rules import *
|
||||
|
||||
schema_name = 'test_where_rule'
|
||||
|
||||
schema_scope = sys.modules[__name__]
|
||||
|
||||
# Defined datatype month
|
||||
class month(INTEGER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
self.unnamed_wr_0()
|
||||
self.unnamed_wr_1()
|
||||
|
||||
def unnamed_wr_0(self):
|
||||
eval_unnamed_wr_0 = (self <= 12)
|
||||
if not eval_unnamed_wr_0:
|
||||
raise AssertionError('Rule unnamed_wr_0 violated')
|
||||
else:
|
||||
return eval_unnamed_wr_0
|
||||
|
||||
def unnamed_wr_1(self):
|
||||
eval_unnamed_wr_1 = (self >= 1)
|
||||
if not eval_unnamed_wr_1:
|
||||
raise AssertionError('Rule unnamed_wr_1 violated')
|
||||
else:
|
||||
return eval_unnamed_wr_1
|
||||
|
||||
# Defined datatype positive
|
||||
class positive(INTEGER):
|
||||
def __init__(self,*kargs):
|
||||
pass
|
||||
self.notnegative()
|
||||
|
||||
def notnegative(self):
|
||||
eval_notnegative_wr = (self > 0)
|
||||
if not eval_notnegative_wr:
|
||||
raise AssertionError('Rule notnegative violated')
|
||||
else:
|
||||
return eval_notnegative_wr
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2011, Thomas Paviot (tpaviot@gmail.com)
|
||||
# Copyright (c) 2014, Christopher HORLER (cshorler@googlemail.com)
|
||||
# Copyright (c) 2021, Devon Sparks (devonsparks.com)
|
||||
|
||||
# All rights reserved.
|
||||
|
||||
# This file is part StepClassLibrary (SCL).
|
||||
# This file is part of the StepClassLibrary (SCL).
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
@@ -29,15 +30,4 @@
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
setup(name='SCL',
|
||||
version='0.5',
|
||||
description='Python STEP Class Library',
|
||||
author='Thomas Paviot',
|
||||
author_email='tpaviot@gmail.com',
|
||||
url='https://github.com/mpictor/StepClassLibrary',
|
||||
packages=['SCL'],
|
||||
)
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,22 @@
|
||||
# SCL - A Python3 STEP Class Library
|
||||
|
||||
SCL is a Python3-based library for parsing and manipulating ISO 10303 Part 21 ("STEP") files.
|
||||
|
||||
# Use
|
||||
|
||||
To parse a ISO 10303 Part 21 file, use the `Parser` class of `SCL.Part21`. On a successful parse, the result will be a Part 21 parse tree and associated STEP instances.
|
||||
|
||||
See [test_parser](tests/test_parser.py) for use of the `SCL.Part21` parser with a sample STEP file.
|
||||
|
||||
|
||||
# Building
|
||||
|
||||
The SCL Python package can be built directly using [PyPA's build module](https://github.com/pypa/build). Run `python3 -m build` from this directory.
|
||||
|
||||
# Testing
|
||||
|
||||
SCL comes with a small test suite (additions welcome!) From this directory, `python3 -m unittest discover`.
|
||||
|
||||
# License
|
||||
|
||||
See [LICENSE](LICENSE)
|
||||
@@ -33,7 +33,7 @@ from SimpleDataTypes import *
|
||||
from TypeChecker import check_type
|
||||
import BaseType
|
||||
|
||||
class BaseAggregate(object):
|
||||
class BaseAggregate:
|
||||
""" A class that define common properties to ARRAY, LIST, SET and BAG.
|
||||
"""
|
||||
def __init__( self , bound1 , bound2 , base_type ):
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user