Compare commits
151 commits
mp/dbg-osx
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c69f31ac08 | ||
|
|
9012f5d438 | ||
|
|
e4eabb0108 | ||
|
|
99379a7d0b | ||
|
|
7f385521a5 | ||
|
|
0b6cd90dd9 | ||
|
|
4160f3fe8a | ||
|
|
02910b2d38 | ||
|
|
3fd71cf457 | ||
|
|
1ff41f76a4 | ||
|
|
a11c373fc7 | ||
|
|
6f1b5adc3f | ||
|
|
9df2f19fc6 | ||
|
|
0fbc3c0c84 | ||
|
|
a96336ab97 | ||
|
|
b24680d7e5 | ||
|
|
15afe96d67 | ||
|
|
a78ca01b54 | ||
|
|
8627627c5e | ||
|
|
9b091756b1 | ||
|
|
dfce2dcf07 | ||
|
|
5c7e63c75b | ||
|
|
0b456a833e | ||
|
|
a243b4d8c8 | ||
|
|
daec3e2640 | ||
|
|
06b13bb9af | ||
|
|
e38519a7f1 | ||
|
|
12def15dd2 | ||
|
|
a160cc9af6 | ||
|
|
1dfe76b3b4 | ||
|
|
c23ba65c41 | ||
|
|
274de2a91d | ||
|
|
1a757024c4 | ||
|
|
abae0a7c45 | ||
|
|
bfc11face5 | ||
|
|
677261d4fb | ||
|
|
4207a46f07 | ||
|
|
7316fe5070 | ||
|
|
4d32009592 | ||
|
|
0b6078b72b | ||
|
|
36e34862cc | ||
|
|
9dcb6aa640 | ||
|
|
bc5533bda8 | ||
|
|
4e88ad69eb | ||
|
|
b890c156f5 | ||
|
|
0ba7343004 | ||
|
|
f2247d222f | ||
|
|
5288026043 | ||
|
|
6e8cad223e | ||
|
|
018e7cfffc | ||
|
|
458b775f41 | ||
|
|
dc82923cf1 | ||
|
|
aa967b3316 | ||
|
|
17b41da525 | ||
|
|
135adc76c8 | ||
|
|
017faa942f | ||
|
|
46c37207da | ||
|
|
85f45f38e4 | ||
|
|
be378119f4 | ||
|
|
ecde882d5a | ||
|
|
3d90ffdf83 | ||
|
|
5dfca2ed78 | ||
|
|
fbf0272d3b | ||
|
|
c69f9ebab2 | ||
|
|
942fb89f68 | ||
|
|
893936b11f | ||
|
|
e4a8be26da | ||
|
|
c63b3cc9b8 | ||
|
|
2dace5da2e | ||
|
|
7568033499 | ||
|
|
65b6869b30 | ||
|
|
915e0de65f | ||
|
|
9c83ba32a9 | ||
|
|
13f36c11a8 | ||
|
|
6b26410d9d | ||
|
|
3e84677ac9 | ||
|
|
081cf35855 | ||
|
|
c1c3bc1077 | ||
|
|
6351ff38d9 | ||
|
|
a82f7497a6 | ||
|
|
2a3e2a9abf | ||
|
|
eaf9ffc3f3 | ||
|
|
b72f4d404a | ||
|
|
b31d8ef853 | ||
|
|
c865023114 | ||
|
|
25ca2a788d | ||
|
|
a80489dc96 | ||
|
|
35170b388e | ||
|
|
d2680940ad | ||
|
|
e24ac2acd3 | ||
|
|
903277f288 | ||
|
|
5b2782a34c | ||
|
|
97731f8611 | ||
|
|
272928d6e5 | ||
|
|
76944b3a90 | ||
|
|
8a270222c6 | ||
|
|
e8afb772f1 | ||
|
|
0eefd769e3 | ||
|
|
1c8225f79a | ||
|
|
2d8a7373fd | ||
|
|
2300021416 | ||
|
|
91a2dcacf3 | ||
|
|
618deae50e | ||
|
|
1aa78e7e48 | ||
|
|
4129d363b0 | ||
|
|
619c927ecb | ||
|
|
89684015ae | ||
|
|
8423811031 | ||
|
|
4f9ad1c75a | ||
|
|
0c34752882 | ||
|
|
0b3ab924f8 | ||
|
|
fae60fbe8c | ||
|
|
703654ae70 | ||
|
|
9fca25bed6 | ||
|
|
988d2614be | ||
|
|
1a8282d5dc | ||
|
|
235d38a80c | ||
|
|
cba6fec8d7 | ||
|
|
1d2e33e575 | ||
|
|
2829deb7cc | ||
|
|
c83f0792a1 | ||
|
|
482c7905f3 | ||
|
|
46b5e74596 | ||
|
|
ec0443a446 | ||
|
|
6708334b37 | ||
|
|
9025643a1b | ||
|
|
b996d835f5 | ||
|
|
48df74932a | ||
|
|
3b0f0b33ea | ||
|
|
167d1d7fab | ||
|
|
abb43fcb6f | ||
|
|
a2f2f41e66 | ||
|
|
e68afbad49 | ||
|
|
33ff7c57dc | ||
|
|
04a57d0f2a | ||
|
|
062b0e6ae3 | ||
|
|
5c6ffc7dca | ||
|
|
ea80885185 | ||
|
|
8964d2ed05 | ||
|
|
f25fb9d968 | ||
|
|
0336649b07 | ||
|
|
bdcd5166e1 | ||
|
|
dbbd0c63b6 | ||
|
|
cb771f628e | ||
|
|
2a17763354 | ||
|
|
7f19877b1a | ||
|
|
164355c640 | ||
|
|
2c7ed5c826 | ||
|
|
264db5d03c | ||
|
|
423d5e08f6 | ||
|
|
ba6d0a1c0c |
131 changed files with 3104 additions and 2661 deletions
169
.appveyor.yml
Normal file
169
.appveyor.yml
Normal file
|
|
@ -0,0 +1,169 @@
|
||||||
|
version: '{build}'
|
||||||
|
|
||||||
|
# for Appveyor CI (windows)
|
||||||
|
|
||||||
|
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"
|
||||||
|
cmake --build . --config Debug --target tst_inverse_attr3
|
||||||
|
|
||||||
|
#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 inverse_attr3 test 100x
|
||||||
|
- cmd: cd c:\projects\STEPcode\build
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 10
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 20
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 30
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 40
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 50
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 60
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 70
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 80
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 90
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: bin\tst_inverse_attr3 ..\test\p21\test_inverse_attr.p21
|
||||||
|
- cmd: echo 100
|
||||||
|
- cmd: echo done
|
||||||
|
|
||||||
|
# - cmd: grep -niB20 "Test Failed" Testing/Temporary/LastTest.log
|
||||||
|
|
||||||
|
# we could upload a compiled zip somewhere (see Appveyor artifact documentation)
|
||||||
13
.travis.yml
13
.travis.yml
|
|
@ -2,18 +2,7 @@ sudo: false
|
||||||
language: cpp
|
language: cpp
|
||||||
compiler:
|
compiler:
|
||||||
- clang
|
- clang
|
||||||
script: mkdir build && cd build && cmake .. -DSC_ENABLE_TESTING=ON && make -j3 && ctest -j2; if [ $? -ne 0 ]; then echo; echo; echo "-----------------------------"; grep -niB20 "Test Failed" Testing/Temporary/LastTest.log && false; fi
|
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:
|
os:
|
||||||
- linux
|
- linux
|
||||||
- osx
|
- osx
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- os: osx
|
|
||||||
|
|
|
||||||
|
|
@ -62,11 +62,11 @@ endif(COMMAND CMAKE_POLICY)
|
||||||
# CMake derives much of its functionality from modules, typically
|
# CMake derives much of its functionality from modules, typically
|
||||||
# stored in one directory - let CMake know where to find them.
|
# stored in one directory - let CMake know where to find them.
|
||||||
set(SC_CMAKE_DIR "${SC_SOURCE_DIR}/cmake")
|
set(SC_CMAKE_DIR "${SC_SOURCE_DIR}/cmake")
|
||||||
if(NOT IS_SUBBUILD)
|
if(NOT SC_IS_SUBBUILD)
|
||||||
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
|
set(CMAKE_MODULE_PATH "${SC_CMAKE_DIR};${CMAKE_MODULE_PATH}")
|
||||||
else(NOT IS_SUBBUILD)
|
else(NOT SC_IS_SUBBUILD)
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${SC_CMAKE_DIR}")
|
||||||
endif(NOT IS_SUBBUILD)
|
endif(NOT SC_IS_SUBBUILD)
|
||||||
|
|
||||||
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
|
# testing and compilation options, build output dirs, install dirs, uninstall, package creation, etc
|
||||||
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
|
include(${SC_CMAKE_DIR}/SC_Build_opts.cmake)
|
||||||
|
|
@ -95,10 +95,12 @@ if(NOT DEFINED SC_BUILD_SCHEMAS)
|
||||||
set(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built")
|
set(SC_BUILD_SCHEMAS "ALL" CACHE string "Semicolon-separated list of paths to EXPRESS schemas to be built")
|
||||||
endif(NOT DEFINED SC_BUILD_SCHEMAS)
|
endif(NOT DEFINED SC_BUILD_SCHEMAS)
|
||||||
|
|
||||||
list(APPEND CONFIG_END_MESSAGES
|
if(NOT SC_IS_SUBBUILD)
|
||||||
".. Don't worry about any messages above about missing headers or failed tests, as long as"
|
list(APPEND CONFIG_END_MESSAGES
|
||||||
" you see 'Configuring done' below. Headers and features vary by compiler."
|
".. Don't worry about any messages above about missing headers or failed tests, as long as"
|
||||||
".. Generating step can take a while if you are building several schemas.")
|
" you see 'Configuring done' below. Headers and features vary by compiler."
|
||||||
|
".. 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
|
# create config headers sc_cf.h and sc_version_string.h
|
||||||
include(${SC_CMAKE_DIR}/SC_Config_Headers.cmake)
|
include(${SC_CMAKE_DIR}/SC_Config_Headers.cmake)
|
||||||
|
|
@ -114,6 +116,9 @@ elseif(BORLAND)
|
||||||
add_definitions(-D__BORLAND__ -D__WIN32__)
|
add_definitions(-D__BORLAND__ -D__WIN32__)
|
||||||
else()
|
else()
|
||||||
add_definitions(-pedantic -W -Wall -Wundef -Wfloat-equal -Wshadow -Winline -Wno-long-long)
|
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()
|
endif()
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
|
@ -130,9 +135,7 @@ add_subdirectory(src/clstepcore)
|
||||||
add_subdirectory(src/cleditor)
|
add_subdirectory(src/cleditor)
|
||||||
add_subdirectory(src/cldai)
|
add_subdirectory(src/cldai)
|
||||||
add_subdirectory(src/clutils)
|
add_subdirectory(src/clutils)
|
||||||
if(NOT WIN32) # don't build cllazyfile on windows until export/import macros are in place
|
add_subdirectory(src/cllazyfile)
|
||||||
add_subdirectory(src/cllazyfile)
|
|
||||||
endif(NOT WIN32)
|
|
||||||
add_subdirectory(include)
|
add_subdirectory(include)
|
||||||
add_subdirectory(data)
|
add_subdirectory(data)
|
||||||
if(SC_ENABLE_TESTING)
|
if(SC_ENABLE_TESTING)
|
||||||
|
|
@ -147,7 +150,7 @@ add_dependencies(core stepdai check-express stepeditor exp2cxx)
|
||||||
# CONFIG_END_MESSAGES - list of messages to be printed after everything else is done.
|
# 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.
|
# THIS MUST BE LAST to ensure that they are visible to the user without scrolling.
|
||||||
foreach(_msg ${CONFIG_END_MESSAGES})
|
foreach(_msg ${CONFIG_END_MESSAGES})
|
||||||
message("${_msg}")
|
message(STATUS "${_msg}")
|
||||||
endforeach(_msg ${CONFIG_END_MESSAGES})
|
endforeach(_msg ${CONFIG_END_MESSAGES})
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
|
|
|
||||||
45
CONTRIBUTING.md
Normal file
45
CONTRIBUTING.md
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
# How to contribute
|
||||||
|
|
||||||
|
We love contributions!
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
* Create a github account if you haven't already, and fork the project
|
||||||
|
* Create a new branch, using a branch name that gives an idea of what the changes are about
|
||||||
|
* One topic per commit; a number of small commits are better than one big one
|
||||||
|
* Do not introduce whitespace changes! (**Windows users:** `git config --global core.autocrlf true`)
|
||||||
|
* 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.
|
||||||
|
* 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`.
|
||||||
|
|
||||||
|
## Coding Standards
|
||||||
|
|
||||||
|
SC's source has been reformatted with astyle. When making changes, try
|
||||||
|
to match the current formatting. The main points are:
|
||||||
|
|
||||||
|
- compact (java-style) brackets:
|
||||||
|
```C
|
||||||
|
if( a == 3 ) {
|
||||||
|
c = 5;
|
||||||
|
function( a, b );
|
||||||
|
} else {
|
||||||
|
somefunc();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
- indents are 4 spaces
|
||||||
|
- no tab characters
|
||||||
|
- line endings are LF (linux), not CRLF (windows)
|
||||||
|
- brackets around single-line conditionals
|
||||||
|
- spaces inside parentheses and around operators
|
||||||
|
- return type on the same line as the function name, unless that's
|
||||||
|
too long
|
||||||
|
- doxygen-style comments
|
||||||
|
(see http://www.stack.nl/~dimitri/doxygen/docblocks.html)
|
||||||
|
|
||||||
|
If in doubt about a large patch, run astyle with the config file
|
||||||
|
misc/astyle.cfg.
|
||||||
|
Download astyle from http://sourceforge.net/projects/astyle/files/astyle/
|
||||||
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
Travis-CI build status:
|
Travis-CI | AppVeyor CI
|
||||||
[](https://travis-ci.org/stepcode/stepcode)
|
:-------------:|:---------------:
|
||||||
|
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 -- stepcode.org, github.com/stepcode/stepcode
|
||||||
|
|
|
||||||
50
appveyor.yml
50
appveyor.yml
|
|
@ -1,50 +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
|
|
||||||
|
|
||||||
environment:
|
|
||||||
matrix:
|
|
||||||
- GENERATOR: "Visual Studio 11"
|
|
||||||
ARCH: 32
|
|
||||||
- GENERATOR: "Visual Studio 12"
|
|
||||||
ARCH: 32
|
|
||||||
- GENERATOR: "Visual Studio 12 Win64"
|
|
||||||
ARCH: 64
|
|
||||||
|
|
||||||
# build:
|
|
||||||
# parallel: true
|
|
||||||
# project: ALL_BUILD.vcxproj
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- ps: |
|
|
||||||
cd c:\projects\STEPcode
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake .. -DSC_ENABLE_TESTING=ON -G"$env:GENERATOR"
|
|
||||||
cmake --build . --config Debug
|
|
||||||
|
|
||||||
test_script:
|
|
||||||
- cmd: echo Running CTest...
|
|
||||||
- cmd: cd c:\projects\STEPcode\build
|
|
||||||
- cmd: ctest -j2 . -C Debug
|
|
||||||
|
|
||||||
# we could upload a compiled zip somewhere (see Appveyor artifact documentation)
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
# - Check if the given C source code compiles and runs.
|
|
||||||
# CHECK_C_SOURCE_RUNS(<code> <var>)
|
|
||||||
# <code> - source code to try to compile
|
|
||||||
# <var> - variable to store the result
|
|
||||||
# (1 for success, empty for failure)
|
|
||||||
# The following variables may be set before calling this macro to
|
|
||||||
# modify the way the check is run:
|
|
||||||
#
|
|
||||||
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
|
||||||
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
|
||||||
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
|
||||||
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2006-2009 Kitware, Inc.
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
# (To distributed this file outside of CMake, substitute the full
|
|
||||||
# License text for the above reference.)
|
|
||||||
|
|
||||||
macro(CHECK_C_FILE_RUNS SOURCE VAR)
|
|
||||||
if("${VAR}" MATCHES "^${VAR}$")
|
|
||||||
set(MACRO_CHECK_FUNCTION_DEFINITIONS
|
|
||||||
"-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
|
|
||||||
if(CMAKE_REQUIRED_LIBRARIES)
|
|
||||||
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
|
|
||||||
"-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
|
|
||||||
else(CMAKE_REQUIRED_LIBRARIES)
|
|
||||||
set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
|
|
||||||
endif(CMAKE_REQUIRED_LIBRARIES)
|
|
||||||
if(CMAKE_REQUIRED_INCLUDES)
|
|
||||||
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
|
|
||||||
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
|
|
||||||
else(CMAKE_REQUIRED_INCLUDES)
|
|
||||||
set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
|
|
||||||
endif(CMAKE_REQUIRED_INCLUDES)
|
|
||||||
|
|
||||||
message(STATUS "Performing Test ${VAR}")
|
|
||||||
try_run(${VAR}_EXITCODE ${VAR}_COMPILED
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
${SOURCE}
|
|
||||||
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${FILE_RUN_DEFINITIONS}
|
|
||||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
|
|
||||||
-DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
|
|
||||||
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
|
|
||||||
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
|
|
||||||
COMPILE_OUTPUT_VARIABLE OUTPUT)
|
|
||||||
# if it did not compile make the return value fail code of 1
|
|
||||||
if(NOT ${VAR}_COMPILED)
|
|
||||||
set(${VAR}_EXITCODE 1)
|
|
||||||
endif(NOT ${VAR}_COMPILED)
|
|
||||||
# if the return value was 0 then it worked
|
|
||||||
if("${${VAR}_EXITCODE}" EQUAL 0)
|
|
||||||
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
|
|
||||||
message(STATUS "Performing Test ${VAR} - Success")
|
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
|
||||||
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
|
|
||||||
"${OUTPUT}\n"
|
|
||||||
"Return value: ${${VAR}}\n"
|
|
||||||
"Source file was:\n${SOURCE}\n")
|
|
||||||
else("${${VAR}_EXITCODE}" EQUAL 0)
|
|
||||||
if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
|
|
||||||
set(${VAR} "${${VAR}_EXITCODE}")
|
|
||||||
else(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
|
|
||||||
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
|
|
||||||
endif(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN")
|
|
||||||
|
|
||||||
message(STATUS "Performing Test ${VAR} - Failed")
|
|
||||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
|
||||||
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
|
|
||||||
"${OUTPUT}\n"
|
|
||||||
"Return value: ${${VAR}_EXITCODE}\n"
|
|
||||||
"Source file was:\n${SOURCE}\n")
|
|
||||||
|
|
||||||
endif("${${VAR}_EXITCODE}" EQUAL 0)
|
|
||||||
endif("${VAR}" MATCHES "^${VAR}$")
|
|
||||||
endmacro(CHECK_C_FILE_RUNS)
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width: 8
|
|
||||||
# mode: cmake
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# End:
|
|
||||||
# ex: shiftwidth=2 tabstop=8
|
|
||||||
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010-2012 United States Government as represented by
|
# Copyright (c) 2010-2016 United States Government as represented by
|
||||||
# the U.S. Army Research Laboratory.
|
# the U.S. Army Research Laboratory.
|
||||||
# Copyright 2009 Kitware, Inc.
|
# Copyright 2009 Kitware, Inc.
|
||||||
# Copyright 2006 Tristan Carel
|
# Copyright 2006 Tristan Carel
|
||||||
|
|
@ -47,21 +47,158 @@
|
||||||
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
|
find_program(LEMON_EXECUTABLE lemon DOC "path to the lemon executable")
|
||||||
mark_as_advanced(LEMON_EXECUTABLE)
|
mark_as_advanced(LEMON_EXECUTABLE)
|
||||||
|
|
||||||
if(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
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 AND NOT LEMON_TEMPLATE)
|
||||||
|
# look for the template in bin dir
|
||||||
get_filename_component(lemon_path ${LEMON_EXECUTABLE} PATH)
|
get_filename_component(lemon_path ${LEMON_EXECUTABLE} PATH)
|
||||||
if(lemon_path)
|
if (lemon_path)
|
||||||
set(LEMON_TEMPLATE "")
|
if (EXISTS ${lemon_path}/lempar.c)
|
||||||
if(EXISTS ${lemon_path}/lempar.c)
|
set (LEMON_TEMPLATE "${lemon_path}/lempar.c")
|
||||||
set(LEMON_TEMPLATE "${lemon_path}/lempar.c")
|
endif (EXISTS ${lemon_path}/lempar.c)
|
||||||
endif(EXISTS ${lemon_path}/lempar.c)
|
if (EXISTS /usr/share/lemon/lempar.c)
|
||||||
if(EXISTS /usr/share/lemon/lempar.c)
|
set (LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
|
||||||
set(LEMON_TEMPLATE "/usr/share/lemon/lempar.c")
|
endif (EXISTS /usr/share/lemon/lempar.c)
|
||||||
endif(EXISTS /usr/share/lemon/lempar.c)
|
endif (lemon_path)
|
||||||
endif(lemon_path)
|
|
||||||
endif(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
endif(LEMON_EXECUTABLE AND NOT LEMON_TEMPLATE)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
mark_as_advanced(LEMON_TEMPLATE)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LEMON DEFAULT_MSG LEMON_EXECUTABLE LEMON_TEMPLATE)
|
||||||
mark_as_advanced(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)
|
||||||
|
|
||||||
#============================================================
|
#============================================================
|
||||||
# FindLEMON.cmake ends here
|
# FindLEMON.cmake ends here
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010-2012 United States Government as represented by
|
# Copyright (c) 2010-2016 United States Government as represented by
|
||||||
# the U.S. Army Research Laboratory.
|
# the U.S. Army Research Laboratory.
|
||||||
# Copyright 2009 Kitware, Inc.
|
# Copyright 2009 Kitware, Inc.
|
||||||
# Copyright 2006 Tristan Carel
|
# Copyright 2006 Tristan Carel
|
||||||
|
|
@ -68,6 +68,187 @@ include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PERPLEX DEFAULT_MSG PERPLEX_EXECUTABLE PERPLEX_TEMPLATE)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PERPLEX DEFAULT_MSG PERPLEX_EXECUTABLE PERPLEX_TEMPLATE)
|
||||||
mark_as_advanced(PERPLEX_TEMPLATE)
|
mark_as_advanced(PERPLEX_TEMPLATE)
|
||||||
|
|
||||||
|
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs and
|
||||||
|
# runs both perplex and re2c to generate C source code/headers, and
|
||||||
|
# ADD_PERPLEX_LEMON_DEPENDENCY which is used to set up dependencies between
|
||||||
|
# scanner and parser targets when necessary.
|
||||||
|
#
|
||||||
|
# #====================================================================
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# find_package(LEMON)
|
||||||
|
# find_package(RE2C)
|
||||||
|
# find_package(PERPLEX)
|
||||||
|
#
|
||||||
|
# LEMON_TARGET(MyParser parser.y "${CMAKE_CURRENT_BINARY_DIR}/parser.cpp")
|
||||||
|
# PERPLEX_TARGET(MyScanner scanner.re "${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp" "${CMAKE_CURRENT_BINARY_DIR}/scanner_header.hpp")
|
||||||
|
# ADD_PERPLEX_LEMON_DEPENDENCY(MyScanner MyParser)
|
||||||
|
#
|
||||||
|
# include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
# add_executable(Foo
|
||||||
|
# Foo.cc
|
||||||
|
# ${LEMON_MyParser_OUTPUTS}
|
||||||
|
# ${PERPLEX_MyScanner_OUTPUTS}
|
||||||
|
# )
|
||||||
|
# ====================================================================
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
#============================================================
|
||||||
|
# PERPLEX_TARGET (public macro)
|
||||||
|
#============================================================
|
||||||
|
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
if(NOT COMMAND PERPLEX_TARGET)
|
||||||
|
macro(PERPLEX_TARGET Name Input)
|
||||||
|
get_filename_component(IN_FILE_WE ${Input} NAME_WE)
|
||||||
|
set(PVAR_PREFIX ${Name}_${IN_FILE_WE})
|
||||||
|
|
||||||
|
if(${ARGC} GREATER 3)
|
||||||
|
CMAKE_PARSE_ARGUMENTS(${PVAR_PREFIX} "" "TEMPLATE;OUT_SRC_FILE;OUT_HDR_FILE;WORKING_DIR" "" ${ARGN})
|
||||||
|
endif(${ARGC} GREATER 3)
|
||||||
|
|
||||||
|
# Need a working directory
|
||||||
|
if("${${PVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||||
|
set(${PVAR_PREFIX}_WORKING_DIR "${CMAKE_CURRENT_BINARY_DIR}/${PVAR_PREFIX}")
|
||||||
|
endif("${${PVAR_PREFIX}_WORKING_DIR}" STREQUAL "")
|
||||||
|
file(MAKE_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR})
|
||||||
|
|
||||||
|
# Set up intermediate and final output names
|
||||||
|
|
||||||
|
# Output source file
|
||||||
|
if ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||||
|
set(${PVAR_PREFIX}_OUT_SRC_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.c)
|
||||||
|
else ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||||
|
get_filename_component(specified_out_dir ${${PVAR_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(${PVAR_PREFIX}_OUT_SRC_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${${PVAR_PREFIX}_OUT_SRC_FILE})
|
||||||
|
endif ("${${PVAR_PREFIX}_OUT_SRC_FILE}" STREQUAL "")
|
||||||
|
|
||||||
|
# Output header file
|
||||||
|
if ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||||
|
set(${PVAR_PREFIX}_OUT_HDR_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.h)
|
||||||
|
else ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||||
|
get_filename_component(specified_out_dir ${${PVAR_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(${PVAR_PREFIX}_OUT_HDR_FILE ${${PVAR_PREFIX}_WORKING_DIR}/${${PVAR_PREFIX}_OUT_HDR_FILE})
|
||||||
|
endif ("${${PVAR_PREFIX}_OUT_HDR_FILE}" STREQUAL "")
|
||||||
|
|
||||||
|
# input file
|
||||||
|
get_filename_component(in_full ${Input} ABSOLUTE)
|
||||||
|
if("${in_full}" STREQUAL "${Input}")
|
||||||
|
set(perplex_in_file ${Input})
|
||||||
|
else("${in_full}" STREQUAL "${Input}")
|
||||||
|
set(perplex_in_file "${CMAKE_CURRENT_SOURCE_DIR}/${Input}")
|
||||||
|
endif("${in_full}" STREQUAL "${Input}")
|
||||||
|
|
||||||
|
# Intermediate file
|
||||||
|
set(re2c_src "${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE_WE}.re")
|
||||||
|
|
||||||
|
# Make sure we have a template
|
||||||
|
if ("${${PVAR_PREFIX}_TEMPLATE}" STREQUAL "")
|
||||||
|
if(PERPLEX_TEMPLATE)
|
||||||
|
set(${PVAR_PREFIX}_TEMPLATE ${PERPLEX_TEMPLATE})
|
||||||
|
else(PERPLEX_TEMPLATE)
|
||||||
|
message(FATAL_ERROR "\nNo Perplex template file specified - please specify the file using the PERPLEX_TEMPLATE variable:\ncmake .. -DPERPLEX_TEMPLATE=/path/to/template_file.c\n")
|
||||||
|
endif(PERPLEX_TEMPLATE)
|
||||||
|
endif ("${${PVAR_PREFIX}_TEMPLATE}" STREQUAL "")
|
||||||
|
|
||||||
|
get_filename_component(IN_FILE ${Input} NAME)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${perplex_in_file} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
|
||||||
|
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${${PVAR_PREFIX}_OUT_HDR_FILE} -t ${${PVAR_PREFIX}_TEMPLATE} ${${PVAR_PREFIX}_WORKING_DIR}/${IN_FILE}
|
||||||
|
DEPENDS ${Input} ${${PVAR_PREFIX}_TEMPLATE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
|
||||||
|
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
|
||||||
|
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if(NOT DEBUGGING_GENERATED_SOURCES)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
|
||||||
|
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
|
||||||
|
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
|
||||||
|
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
|
||||||
|
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||||
|
)
|
||||||
|
else(NOT DEBUGGING_GENERATED_SOURCES)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${${PVAR_PREFIX}_OUT_SRC_FILE}
|
||||||
|
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${${PVAR_PREFIX}_OUT_SRC_FILE} ${re2c_src}
|
||||||
|
DEPENDS ${Input} ${re2c_src} ${${PVAR_PREFIX}_OUT_HDR_FILE} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
|
||||||
|
WORKING_DIRECTORY ${${PVAR_PREFIX}_WORKING_DIR}
|
||||||
|
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
||||||
|
)
|
||||||
|
endif(NOT DEBUGGING_GENERATED_SOURCES)
|
||||||
|
|
||||||
|
set(PERPLEX_${Name}_DEFINED TRUE)
|
||||||
|
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})
|
||||||
|
endmacro(PERPLEX_TARGET)
|
||||||
|
endif(NOT COMMAND PERPLEX_TARGET)
|
||||||
|
|
||||||
|
#============================================================
|
||||||
|
# ADD_PERPLEX_LEMON_DEPENDENCY (public macro)
|
||||||
|
#============================================================
|
||||||
|
if(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||||
|
macro(ADD_PERPLEX_LEMON_DEPENDENCY PERPLEXTarget LemonTarget)
|
||||||
|
|
||||||
|
if(NOT PERPLEX_${PERPLEXTarget}_SRC)
|
||||||
|
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT LEMON_${LemonTarget}_HDR)
|
||||||
|
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_SRC}
|
||||||
|
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_HDR})
|
||||||
|
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||||
|
endif(NOT COMMAND ADD_PERPLEX_LEMON_DEPENDENCY)
|
||||||
|
|
||||||
#============================================================
|
#============================================================
|
||||||
# FindPERPLEX.cmake ends here
|
# FindPERPLEX.cmake ends here
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,137 @@ mark_as_advanced(RE2C_EXECUTABLE)
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(RE2C DEFAULT_MSG RE2C_EXECUTABLE)
|
||||||
|
|
||||||
|
# Provide a macro to generate custom build rules:
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
#============================================================
|
||||||
|
#
|
||||||
|
# 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()
|
||||||
|
else()
|
||||||
|
message(SEND_ERROR ${RE2C_TARGET_usage})
|
||||||
|
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}")
|
||||||
|
|
||||||
|
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)
|
||||||
|
macro(ADD_RE2C_LEMON_DEPENDENCY RE2CTarget LemonTarget)
|
||||||
|
|
||||||
|
if(NOT RE2C_${RE2CTarget}_OUTPUTS)
|
||||||
|
message(SEND_ERROR "RE2C target `${RE2CTarget}' 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}_HDR})
|
||||||
|
endmacro(ADD_RE2C_LEMON_DEPENDENCY)
|
||||||
|
endif(NOT COMMAND ADD_RE2C_LEMON_DEPENDENCY)
|
||||||
|
#============================================================
|
||||||
|
|
||||||
|
# RE2C_Util.cmake ends here
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# tab-width: 8
|
# tab-width: 8
|
||||||
# mode: cmake
|
# mode: cmake
|
||||||
# indent-tabs-mode: t
|
# indent-tabs-mode: t
|
||||||
# End:
|
# End:
|
||||||
# ex: shiftwidth=2 tabstop=8
|
# ex: shiftwidth=2 tabstop=8
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ macro(VERIFY_FILES filelist warn resultvar)
|
||||||
MD5(${filefullname} ${filevar}_md5)
|
MD5(${filefullname} ${filevar}_md5)
|
||||||
if(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
|
if(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
|
||||||
if("${warn}" STREQUAL "1")
|
if("${warn}" STREQUAL "1")
|
||||||
message("\n${filename} differs from baseline: baseline md5 hash is ${baseline_${filevar}_md5} and current hash is ${${filevar}_md5}\n")
|
message("\n${filename} differs from baseline: baseline md5 hash is ${baseline_${filevar}_md5} and current hash is ${${filevar}_md5}\n")
|
||||||
endif("${warn}" STREQUAL "1")
|
endif("${warn}" STREQUAL "1")
|
||||||
set(${resultvar} 0)
|
set(${resultvar} 0)
|
||||||
endif(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
|
endif(NOT "${${filevar}_md5}" STREQUAL "${baseline_${filevar}_md5}")
|
||||||
|
|
@ -59,20 +59,6 @@ macro(WRITE_MD5_SUMS filelist outfile)
|
||||||
endforeach(fileitem ${filelist})
|
endforeach(fileitem ${filelist})
|
||||||
endmacro(WRITE_MD5_SUMS)
|
endmacro(WRITE_MD5_SUMS)
|
||||||
|
|
||||||
|
|
||||||
macro(GET_GENERATOR_EXEC_VERSIONS)
|
|
||||||
# Read lemon version
|
|
||||||
execute_process(COMMAND ${LEMON_EXECUTABLE} -x OUTPUT_VARIABLE lemon_version)
|
|
||||||
string(REPLACE "Lemon version " "" lemon_version "${lemon_version}")
|
|
||||||
string(STRIP "${lemon_version}" lemon_version)
|
|
||||||
# Read re2c version
|
|
||||||
execute_process(COMMAND ${RE2C_EXECUTABLE} -V OUTPUT_VARIABLE re2c_version)
|
|
||||||
string(STRIP "${re2c_version}" re2c_version)
|
|
||||||
# Read perplex version
|
|
||||||
execute_process(COMMAND ${PERPLEX_EXECUTABLE} -v OUTPUT_VARIABLE perplex_version)
|
|
||||||
string(STRIP "${perplex_version}" perplex_version)
|
|
||||||
endmacro(GET_GENERATOR_EXEC_VERSIONS)
|
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# tab-width: 8
|
# tab-width: 8
|
||||||
# mode: cmake
|
# mode: cmake
|
||||||
|
|
|
||||||
|
|
@ -1,146 +0,0 @@
|
||||||
# Defines 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})
|
|
||||||
# ====================================================================
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010-2012 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.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
#============================================================
|
|
||||||
# LEMON_TARGET (public macro)
|
|
||||||
#============================================================
|
|
||||||
#
|
|
||||||
macro(LEMON_TARGET Name LemonInput LemonSource LemonHeader)
|
|
||||||
if(NOT ${ARGC} EQUAL 4 AND NOT ${ARGC} EQUAL 5)
|
|
||||||
message(SEND_ERROR "Usage")
|
|
||||||
else()
|
|
||||||
get_filename_component(LemonInputFull ${LemonInput} ABSOLUTE)
|
|
||||||
get_filename_component(LemonSourceFull ${LemonSource} ABSOLUTE)
|
|
||||||
get_filename_component(LemonHeaderFull ${LemonHeader} ABSOLUTE)
|
|
||||||
|
|
||||||
if(NOT ${LemonInput} STREQUAL ${LemonInputFull})
|
|
||||||
set(LEMON_${Name}_INPUT "${CMAKE_CURRENT_BINARY_DIR}/${LemonInput}")
|
|
||||||
else(NOT ${LemonInput} STREQUAL ${LemonInputFull})
|
|
||||||
set(LEMON_${Name}_INPUT "${LemonInput}")
|
|
||||||
endif(NOT ${LemonInput} STREQUAL ${LemonInputFull})
|
|
||||||
|
|
||||||
if(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
|
|
||||||
set(LEMON_${Name}_OUTPUT_SOURCE "${CMAKE_CURRENT_BINARY_DIR}/${LemonSource}")
|
|
||||||
else(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
|
|
||||||
set(LEMON_${Name}_OUTPUT_SOURCE "${LemonSource}")
|
|
||||||
endif(NOT ${LemonSource} STREQUAL ${LemonSourceFull})
|
|
||||||
|
|
||||||
if(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
|
|
||||||
set(LEMON_${Name}_OUTPUT_HEADER "${CMAKE_CURRENT_BINARY_DIR}/${LemonHeader}")
|
|
||||||
else(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
|
|
||||||
set(LEMON_${Name}_OUTPUT_HEADER "${LemonHeader}")
|
|
||||||
endif(NOT ${LemonHeader} STREQUAL ${LemonHeaderFull})
|
|
||||||
|
|
||||||
set(LEMON_${Name}_EXTRA_ARGS "${ARGV4}")
|
|
||||||
|
|
||||||
# get input name minus path
|
|
||||||
get_filename_component(INPUT_NAME "${LemonInput}" NAME)
|
|
||||||
set(LEMON_BIN_INPUT ${CMAKE_CURRENT_BINARY_DIR}/${INPUT_NAME})
|
|
||||||
|
|
||||||
# names of lemon output files will be based on the name of the input file
|
|
||||||
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.c" LEMON_GEN_SOURCE "${INPUT_NAME}")
|
|
||||||
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.h" LEMON_GEN_HEADER "${INPUT_NAME}")
|
|
||||||
string(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1.out" LEMON_GEN_OUT "${INPUT_NAME}")
|
|
||||||
|
|
||||||
# copy input to bin directory and run lemon
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${LEMON_GEN_OUT} ${LEMON_GEN_SOURCE} ${LEMON_GEN_HEADER}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${LemonInput} ${LEMON_BIN_INPUT}
|
|
||||||
COMMAND ${LEMON_EXECUTABLE} ${INPUT_NAME} ${LEMON_${Name}_EXTRA_ARGS}
|
|
||||||
DEPENDS ${LemonInput} ${LEMON_TEMPLATE} ${LEMON_EXECUTABLE_TARGET}
|
|
||||||
COMMENT "[LEMON][${Name}] Building parser with ${LEMON_EXECUTABLE}"
|
|
||||||
)
|
|
||||||
|
|
||||||
# rename generated outputs
|
|
||||||
if(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${LemonSource}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_SOURCE} ${LemonSource}
|
|
||||||
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_SOURCE}
|
|
||||||
)
|
|
||||||
set(LEMON_${Name}_OUTPUTS ${LemonSource} ${LEMON_${Name}_OUTPUTS})
|
|
||||||
endif(NOT "${LemonSource}" STREQUAL "${LEMON_GEN_SOURCE}")
|
|
||||||
if(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${LemonHeader}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${LEMON_GEN_HEADER} ${LemonHeader}
|
|
||||||
DEPENDS ${LemonInput} ${LEMON_EXECUTABLE_TARGET} ${LEMON_GEN_HEADER}
|
|
||||||
)
|
|
||||||
set(LEMON_${Name}_OUTPUTS ${LemonHeader} ${LEMON_${Name}_OUTPUTS})
|
|
||||||
endif(NOT "${LemonHeader}" STREQUAL "${LEMON_GEN_HEADER}")
|
|
||||||
|
|
||||||
set(LEMON_${Name}_OUTPUTS ${LEMON_GEN_OUT} ${LemonSource} ${LemonHeader})
|
|
||||||
|
|
||||||
# make sure we clean up generated output and copied input
|
|
||||||
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS}")
|
|
||||||
else("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${LEMON_${Name}_OUTPUTS};${LEMON_BIN_INPUT}")
|
|
||||||
endif("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
|
||||||
|
|
||||||
# macro ran successfully
|
|
||||||
set(LEMON_${Name}_DEFINED TRUE)
|
|
||||||
endif(NOT ${ARGC} EQUAL 4 AND NOT ${ARGC} EQUAL 5)
|
|
||||||
endmacro(LEMON_TARGET)
|
|
||||||
#
|
|
||||||
#============================================================
|
|
||||||
# LEMON_Utils.cmake ends here
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width: 8
|
|
||||||
# mode: cmake
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# End:
|
|
||||||
# ex: shiftwidth=2 tabstop=8
|
|
||||||
|
|
@ -1,134 +0,0 @@
|
||||||
# Defines two macros - PERPLEX_TARGET, which takes perplex inputs and
|
|
||||||
# runs both perplex and re2c to generate C source code/headers, and
|
|
||||||
# ADD_PERPLEX_LEMON_DEPENDENCY which is used to set up dependencies between
|
|
||||||
# scanner and parser targets when necessary.
|
|
||||||
#
|
|
||||||
# #====================================================================
|
|
||||||
# Example:
|
|
||||||
#
|
|
||||||
# find_package(LEMON)
|
|
||||||
# find_package(RE2C)
|
|
||||||
# find_package(PERPLEX)
|
|
||||||
#
|
|
||||||
# LEMON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
|
|
||||||
# PERPLEX_TARGET(MyScanner scanner.re ${CMAKE_CURRENT_BINARY_DIR}/scanner.cpp ${CMAKE_CURRENT_BINARY_DIR}/scanner_header.hpp)
|
|
||||||
# ADD_PERPLEX_LEMON_DEPENDENCY(MyScanner MyParser)
|
|
||||||
#
|
|
||||||
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
# add_executable(Foo
|
|
||||||
# Foo.cc
|
|
||||||
# ${LEMON_MyParser_OUTPUTS}
|
|
||||||
# ${PERPLEX_MyScanner_OUTPUTS}
|
|
||||||
# )
|
|
||||||
# ====================================================================
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
# Originally based off of FindBISON.cmake from Kitware's CMake distribution
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010-2012 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.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
#============================================================
|
|
||||||
# PERPLEX_TARGET (public macro)
|
|
||||||
#============================================================
|
|
||||||
macro(PERPLEX_TARGET Name Input OutputSrc OutputHeader)
|
|
||||||
if(${ARGC} GREATER 4)
|
|
||||||
set(Template ${ARGV4})
|
|
||||||
else(${ARGC} GREATER 4)
|
|
||||||
if(PERPLEX_TEMPLATE)
|
|
||||||
set(Template ${PERPLEX_TEMPLATE})
|
|
||||||
else(PERPLEX_TEMPLATE)
|
|
||||||
message(FATAL_ERROR "\nNo Perplex template file specifed - please specify the file using the PERPLEX_TEMPLATE variable:\ncmake .. -DPERPLEX_TEMPLATE=/path/to/template_file.c\n")
|
|
||||||
endif(PERPLEX_TEMPLATE)
|
|
||||||
endif(${ARGC} GREATER 4)
|
|
||||||
|
|
||||||
get_filename_component(OutputName ${OutputSrc} NAME)
|
|
||||||
set(re2c_src "${CMAKE_CURRENT_BINARY_DIR}/${OutputName}.re")
|
|
||||||
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${re2c_src} ${OutputHeader}
|
|
||||||
COMMAND ${PERPLEX_EXECUTABLE} -c -o ${re2c_src} -i ${OutputHeader} -t ${Template} ${Input}
|
|
||||||
DEPENDS ${Input} ${Template} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
COMMENT "[PERPLEX][${Name}] Generating re2c input with ${PERPLEX_EXECUTABLE}"
|
|
||||||
)
|
|
||||||
if(NOT DEBUGGING_GENERATED_SOURCES)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${OutputSrc}
|
|
||||||
COMMAND ${RE2C_EXECUTABLE} --no-debug-info --no-generation-date -c -o ${OutputSrc} ${re2c_src}
|
|
||||||
DEPENDS ${Input} ${re2c_src} ${OutputHeader} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
|
||||||
)
|
|
||||||
else(NOT DEBUGGING_GENERATED_SOURCES)
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT ${OutputSrc}
|
|
||||||
COMMAND ${RE2C_EXECUTABLE} --no-generation-date -c -o ${OutputSrc} ${re2c_src}
|
|
||||||
DEPENDS ${Input} ${re2c_src} ${OutputHeader} ${PERPLEX_EXECUTABLE_TARGET} ${RE2C_EXECUTABLE_TARGET}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
COMMENT "[RE2C][${Name}] Building scanner with ${RE2C_EXECUTABLE}"
|
|
||||||
)
|
|
||||||
endif(NOT DEBUGGING_GENERATED_SOURCES)
|
|
||||||
set(PERPLEX_${Name}_DEFINED TRUE)
|
|
||||||
set(PERPLEX_${Name}_OUTPUTS ${OutputSrc})
|
|
||||||
set(PERPLEX_${Name}_INPUT ${Input})
|
|
||||||
endmacro(PERPLEX_TARGET)
|
|
||||||
|
|
||||||
#============================================================
|
|
||||||
# ADD_PERPLEX_LEMON_DEPENDENCY (public macro)
|
|
||||||
#============================================================
|
|
||||||
macro(ADD_PERPLEX_LEMON_DEPENDENCY PERPLEXTarget LemonTarget)
|
|
||||||
|
|
||||||
if(NOT PERPLEX_${PERPLEXTarget}_OUTPUTS)
|
|
||||||
message(SEND_ERROR "PERPLEX target `${PERPLEXTarget}' does not exists.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT LEMON_${LemonTarget}_OUTPUT_HEADER)
|
|
||||||
message(SEND_ERROR "Lemon target `${LemonTarget}' does not exists.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_source_files_properties(${PERPLEX_${PERPLEXTarget}_OUTPUTS}
|
|
||||||
PROPERTIES OBJECT_DEPENDS ${LEMON_${LemonTarget}_OUTPUT_HEADER})
|
|
||||||
endmacro(ADD_PERPLEX_LEMON_DEPENDENCY)
|
|
||||||
|
|
||||||
#============================================================
|
|
||||||
# PERPLEX_Utils.cmake ends here
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width: 8
|
|
||||||
# mode: cmake
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# End:
|
|
||||||
# ex: shiftwidth=2 tabstop=8
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
|
# 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
|
# testing and compilation options, build output dirs, install dirs, etc
|
||||||
# included by root CMakeLists
|
# included by root CMakeLists
|
||||||
|
|
||||||
|
|
@ -42,6 +51,12 @@ 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_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)
|
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)
|
option(SC_BUILD_EXPRESS_ONLY "Only build express parser." OFF)
|
||||||
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
|
mark_as_advanced(SC_BUILD_EXPRESS_ONLY)
|
||||||
|
|
||||||
|
|
@ -71,6 +86,13 @@ if(SC_ENABLE_TESTING)
|
||||||
ENABLE_TESTING()
|
ENABLE_TESTING()
|
||||||
endif(SC_ENABLE_TESTING)
|
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 following logic is what allows binaries to run successfully in
|
||||||
# the build directory AND install directory. Thanks to plplot for
|
# the build directory AND install directory. Thanks to plplot for
|
||||||
|
|
|
||||||
|
|
@ -44,25 +44,53 @@ CHECK_FUNCTION_EXISTS(getopt HAVE_GETOPT)
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
|
CHECK_TYPE_SIZE("ssize_t" SSIZE_T)
|
||||||
|
|
||||||
set( TEST_STD_THREAD "
|
if(SC_ENABLE_CXX11)
|
||||||
|
set( TEST_STD_THREAD "
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
void do_work() {
|
void do_work() {std::cout << \"thread\" << std::endl;}
|
||||||
std::cout << \"thread\" << std::endl;
|
int main() {std::thread t(do_work);t.join();}
|
||||||
}
|
" )
|
||||||
int main() {
|
cmake_push_check_state()
|
||||||
std::thread t(do_work);
|
|
||||||
t.join();
|
|
||||||
}
|
|
||||||
" )
|
|
||||||
cmake_push_check_state()
|
|
||||||
if( UNIX )
|
if( UNIX )
|
||||||
set( CMAKE_REQUIRED_FLAGS "-pthread -std=c++0x" )
|
set( CMAKE_REQUIRED_FLAGS "-pthread -std=c++11" )
|
||||||
else( UNIX )
|
else( UNIX )
|
||||||
# vars probably need set for MSVC11, embarcadero, etc
|
# vars probably need set for embarcadero, etc
|
||||||
endif( UNIX )
|
endif( UNIX )
|
||||||
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_THREAD}" HAVE_STD_THREAD ) #quotes are *required*!
|
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_THREAD}" HAVE_STD_THREAD ) #quotes are *required*!
|
||||||
cmake_pop_check_state()
|
cmake_pop_check_state()
|
||||||
|
|
||||||
|
set( TEST_STD_CHRONO "
|
||||||
|
#include <iostream>
|
||||||
|
#include <chrono>
|
||||||
|
int main() {
|
||||||
|
std::chrono::seconds sec(1);
|
||||||
|
std::cout << \"1s is \"<< std::chrono::duration_cast<std::chrono::milliseconds>(sec).count() << \" ms\" << std::endl;
|
||||||
|
}
|
||||||
|
" )
|
||||||
|
cmake_push_check_state()
|
||||||
|
if( UNIX )
|
||||||
|
set( CMAKE_REQUIRED_FLAGS "-std=c++11" )
|
||||||
|
else( UNIX )
|
||||||
|
# vars probably need set for embarcadero, etc
|
||||||
|
endif( UNIX )
|
||||||
|
CHECK_CXX_SOURCE_RUNS( "${TEST_STD_CHRONO}" HAVE_STD_CHRONO ) #quotes are *required*!
|
||||||
|
cmake_pop_check_state()
|
||||||
|
|
||||||
|
set( TEST_NULLPTR "
|
||||||
|
#include <cstddef>
|
||||||
|
std::nullptr_t f() {return nullptr;}
|
||||||
|
int main() {return !(f() == f());}
|
||||||
|
" )
|
||||||
|
cmake_push_check_state()
|
||||||
|
if( UNIX )
|
||||||
|
set( CMAKE_REQUIRED_FLAGS "-std=c++11" )
|
||||||
|
else( UNIX )
|
||||||
|
# vars probably need set for embarcadero, etc
|
||||||
|
endif( UNIX )
|
||||||
|
CHECK_CXX_SOURCE_RUNS( "${TEST_NULLPTR}" HAVE_NULLPTR ) #quotes are *required*!
|
||||||
|
cmake_pop_check_state()
|
||||||
|
endif(SC_ENABLE_CXX11)
|
||||||
|
|
||||||
# Now that all the tests are done, configure the sc_cf.h file:
|
# 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)
|
get_property(CONFIG_H_FILE_CONTENTS GLOBAL PROPERTY SC_CONFIG_H_CONTENTS)
|
||||||
|
|
@ -75,14 +103,23 @@ configure_file(${CONFIG_H_FILE} ${SC_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_cf.h)
|
||||||
# Using 'ver_string' instead of 'sc_version_string.h' is a trick to force the
|
# 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
|
# command to always execute when the custom target is built. It works because
|
||||||
# a file by that name never exists.
|
# a file by that name never exists.
|
||||||
configure_file(${SC_CMAKE_DIR}/sc_version_string.cmake ${SC_BINARY_DIR}/sc_version_string.cmake @ONLY)
|
if(SC_GIT_VERSION)
|
||||||
add_custom_target(version_string ALL DEPENDS ver_string )
|
configure_file(${SC_CMAKE_DIR}/sc_version_string.cmake ${SC_BINARY_DIR}/sc_version_string.cmake @ONLY)
|
||||||
# creates sc_version_string.h using cmake script
|
add_custom_target(version_string ALL DEPENDS ver_string)
|
||||||
add_custom_command(OUTPUT ver_string ${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
|
# creates sc_version_string.h using cmake script
|
||||||
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SC_SOURCE_DIR}
|
add_custom_command(OUTPUT ver_string
|
||||||
-DBINARY_DIR=${SC_BINARY_DIR}
|
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${SC_SOURCE_DIR} -DBINARY_DIR=${SC_BINARY_DIR} -P ${SC_BINARY_DIR}/sc_version_string.cmake
|
||||||
-P ${SC_BINARY_DIR}/sc_version_string.cmake)
|
)
|
||||||
# sc_version_string.h is a generated file
|
# 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
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${INCLUDE_INSTALL_DIR}/sc_version_string.h
|
||||||
PROPERTIES GENERATED TRUE
|
PROPERTIES GENERATED TRUE
|
||||||
HEADER_FILE_ONLY TRUE )
|
HEADER_FILE_ONLY TRUE )
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,6 @@ if(NOT "${SC_GENERATE_LEXER_PARSER}" STREQUAL "OFF")
|
||||||
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
|
get_filename_component(PERPLEX_TEMPLATE "${CMAKE_BINARY_DIR}/${PERPLEX_TEMPLATE}" ABSOLUTE)
|
||||||
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
|
endif(NOT "${perplex_template_fpath}" STREQUAL "${PERPLEX_TEMPLATE}")
|
||||||
|
|
||||||
if(NOT COMMAND LEMON_TARGET)
|
|
||||||
include(${SC_CMAKE_DIR}/LEMON_Util.cmake)
|
|
||||||
endif(NOT COMMAND LEMON_TARGET)
|
|
||||||
if(NOT COMMAND PERPLEX_TARGET)
|
|
||||||
include(${SC_CMAKE_DIR}/PERPLEX_Util.cmake)
|
|
||||||
endif(NOT COMMAND PERPLEX_TARGET)
|
|
||||||
set(SC_GENERATE_LP_SOURCES 1)
|
set(SC_GENERATE_LP_SOURCES 1)
|
||||||
message(".. Found perplex, re2c, and lemon - can regenerate lexer/parser if necessary")
|
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)
|
else(LEMON_EXECUTABLE AND LEMON_TEMPLATE AND PERPLEX_EXECUTABLE AND PERPLEX_TEMPLATE AND RE2C_EXECUTABLE)
|
||||||
|
|
|
||||||
|
|
@ -10,108 +10,86 @@ macro(DEFINE_DLL_EXPORTS libname)
|
||||||
string(TOUPPER ${LOWERCORE} UPPER_CORE)
|
string(TOUPPER ${LOWERCORE} UPPER_CORE)
|
||||||
set(export "SC_${UPPER_CORE}_DLL_EXPORTS")
|
set(export "SC_${UPPER_CORE}_DLL_EXPORTS")
|
||||||
endif()
|
endif()
|
||||||
get_target_property(defs ${libname} COMPILE_DEFINITIONS)
|
set_property(TARGET ${libname} APPEND PROPERTY COMPILE_DEFINITIONS "${export}")
|
||||||
if(defs) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
|
|
||||||
set(defs "${defs};${export}")
|
|
||||||
else(defs)
|
|
||||||
set(defs "${export}")
|
|
||||||
endif(defs)
|
|
||||||
set_target_properties(${libname} PROPERTIES COMPILE_DEFINITIONS "${defs}")
|
|
||||||
endif(MSVC OR BORLAND)
|
endif(MSVC OR BORLAND)
|
||||||
endmacro(DEFINE_DLL_EXPORTS libname)
|
endmacro(DEFINE_DLL_EXPORTS libname)
|
||||||
|
|
||||||
# set compile definitions for dll imports on windows
|
# set compile definitions for dll imports on windows
|
||||||
macro(DEFINE_DLL_IMPORTS tgt libs)
|
macro(DEFINE_DLL_IMPORTS tgt libs)
|
||||||
if(MSVC OR BORLAND)
|
if(MSVC OR BORLAND)
|
||||||
get_target_property(defs ${tgt} COMPILE_DEFINITIONS)
|
set(imports "")
|
||||||
if(NOT defs) #if no properties, ${defs} will be defs-NOTFOUND which CMake interprets as false
|
|
||||||
set(defs "")
|
|
||||||
endif(NOT defs)
|
|
||||||
foreach(lib ${libs})
|
foreach(lib ${libs})
|
||||||
string(REGEX REPLACE "lib" "" shortname "${lib}")
|
string(REGEX REPLACE "lib" "" shortname "${lib}")
|
||||||
string(REGEX REPLACE "step" "" LOWERCORE "${shortname}")
|
string(REGEX REPLACE "step" "" LOWERCORE "${shortname}")
|
||||||
string(TOUPPER ${LOWERCORE} UPPER_CORE)
|
string(TOUPPER ${LOWERCORE} UPPER_CORE)
|
||||||
list(APPEND defs "SC_${UPPER_CORE}_DLL_IMPORTS")
|
list(APPEND imports "SC_${UPPER_CORE}_DLL_IMPORTS")
|
||||||
endforeach(lib ${libs})
|
endforeach(lib ${libs})
|
||||||
if(DEFINED defs)
|
set_property(TARGET ${tgt} APPEND PROPERTY COMPILE_DEFINITIONS "${imports}")
|
||||||
if(defs)
|
|
||||||
set_target_properties(${tgt} PROPERTIES COMPILE_DEFINITIONS "${defs}")
|
|
||||||
endif(defs)
|
|
||||||
endif(DEFINED defs)
|
|
||||||
endif(MSVC OR BORLAND)
|
endif(MSVC OR BORLAND)
|
||||||
endmacro(DEFINE_DLL_IMPORTS tgt libs)
|
endmacro(DEFINE_DLL_IMPORTS tgt libs)
|
||||||
|
|
||||||
#EXCLUDE_OR_INSTALL(target destination ARGV3)
|
#SC_ADDEXEC(execname "source files" "linked libs" ["TESTABLE"] ["NO_INSTALL"])
|
||||||
# installs ${target} in ${destination} unless testing is enabled AND ${arg_3} == "TESTABLE",
|
|
||||||
# in which case the EXCLUDE_FROM_ALL property is set for testing.
|
|
||||||
# EXCLUDE_FROM_ALL cannot be set on targets that are to be installed,
|
|
||||||
# so either test the target or install it - but not both
|
|
||||||
macro(EXCLUDE_OR_INSTALL target dest arg_3)
|
|
||||||
if(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
|
|
||||||
INSTALL(TARGETS ${target} DESTINATION ${dest})
|
|
||||||
else(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
|
|
||||||
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON)
|
|
||||||
endif(NOT ((SC_ENABLE_TESTING) AND ("${arg_3}" STREQUAL "TESTABLE")))
|
|
||||||
endmacro(EXCLUDE_OR_INSTALL target dest arg_3)
|
|
||||||
|
|
||||||
#SC_ADDEXEC(execname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
|
|
||||||
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
|
|
||||||
# optional args can also be used by MSVC-specific code, but it looks like these two uses
|
|
||||||
# will not conflict because the MSVC args must contain "STRICT"
|
|
||||||
macro(SC_ADDEXEC execname srcslist libslist)
|
macro(SC_ADDEXEC execname srcslist libslist)
|
||||||
if(SC_BUILD_SHARED_LIBS)
|
|
||||||
add_executable(${execname} ${srcslist})
|
string(TOUPPER "${execname}" EXECNAME_UPPER)
|
||||||
target_link_libraries(${execname} ${libslist})
|
if(${ARGC} GREATER 3)
|
||||||
DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to
|
CMAKE_PARSE_ARGUMENTS(${EXECNAME_UPPER} "NO_INSTALL;TESTABLE" "" "" ${ARGN})
|
||||||
EXCLUDE_OR_INSTALL(${execname} "bin" "${ARGV3}")
|
endif(${ARGC} GREATER 3)
|
||||||
# Enable extra compiler flags if local executables and/or global options dictate
|
|
||||||
set(LOCAL_COMPILE_FLAGS "")
|
add_executable(${execname} ${srcslist})
|
||||||
foreach(extraarg ${ARGN})
|
target_link_libraries(${execname} ${libslist})
|
||||||
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
|
DEFINE_DLL_IMPORTS(${execname} "${libslist}") #add import definitions for all libs that the executable is linked to
|
||||||
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
|
if(NOT ${EXECNAME_UPPER}_NO_INSTALL AND NOT ${EXECNAME_UPPER}_TESTABLE)
|
||||||
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
|
install(TARGETS ${execname}
|
||||||
endforeach(extraarg ${ARGN})
|
RUNTIME DESTINATION ${BIN_DIR}
|
||||||
if(LOCAL_COMPILE_FLAGS)
|
LIBRARY DESTINATION ${LIB_DIR}
|
||||||
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
|
ARCHIVE DESTINATION ${LIB_DIR}
|
||||||
endif(LOCAL_COMPILE_FLAGS)
|
)
|
||||||
endif(SC_BUILD_SHARED_LIBS)
|
endif(NOT ${EXECNAME_UPPER}_NO_INSTALL AND NOT ${EXECNAME_UPPER}_TESTABLE)
|
||||||
if(SC_BUILD_STATIC_LIBS)
|
if(NOT SC_ENABLE_TESTING AND ${EXECNAME_UPPER}_TESTABLE)
|
||||||
if(NOT SC_BUILD_SHARED_LIBS)
|
set_target_properties( ${execname} PROPERTIES EXCLUDE_FROM_ALL ON )
|
||||||
set(staticexecname "${execname}")
|
endif(NOT SC_ENABLE_TESTING AND ${EXECNAME_UPPER}_TESTABLE)
|
||||||
else()
|
|
||||||
set(staticexecname "${execname}-static")
|
# Enable extra compiler flags if local executables and/or global options dictate
|
||||||
endif(NOT SC_BUILD_SHARED_LIBS)
|
set(LOCAL_COMPILE_FLAGS "")
|
||||||
add_executable(${staticexecname} ${srcslist})
|
foreach(extraarg ${ARGN})
|
||||||
target_link_libraries(${staticexecname} ${libslist})
|
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
|
||||||
EXCLUDE_OR_INSTALL(${staticexecname} "bin" "${ARGV3}")
|
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
|
||||||
# Enable extra compiler flags if local executables and/or global options dictate
|
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
|
||||||
set(LOCAL_COMPILE_FLAGS "")
|
endforeach(extraarg ${ARGN})
|
||||||
foreach(extraarg ${ARGN})
|
if(LOCAL_COMPILE_FLAGS)
|
||||||
if(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
|
set_target_properties(${execname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
|
||||||
set(LOCAL_COMPILE_FLAGS "${LOCAL_COMPILE_FLAGS} ${STRICT_FLAGS}")
|
endif(LOCAL_COMPILE_FLAGS)
|
||||||
endif(${extraarg} MATCHES "STRICT" AND SC-ENABLE_STRICT)
|
|
||||||
endforeach(extraarg ${ARGN})
|
|
||||||
if(LOCAL_COMPILE_FLAGS)
|
|
||||||
set_target_properties(${staticexecname} PROPERTIES COMPILE_FLAGS ${LOCAL_COMPILE_FLAGS})
|
|
||||||
endif(LOCAL_COMPILE_FLAGS)
|
|
||||||
endif(SC_BUILD_STATIC_LIBS)
|
|
||||||
endmacro(SC_ADDEXEC execname srcslist libslist)
|
endmacro(SC_ADDEXEC execname srcslist libslist)
|
||||||
|
|
||||||
#SC_ADDLIB(libname "source files" "linked libs" ["TESTABLE"] ["MSVC flag" ...])
|
#SC_ADDLIB(libname "source files" "linked libs" ["TESTABLE"] ["NO_INSTALL"] ["SO_SRCS ..."] ["STATIC_SRCS ..."])
|
||||||
# optional 4th argument of "TESTABLE", passed to EXCLUDE_OR_INSTALL macro
|
|
||||||
# optional args can also be used by MSVC-specific code, but it looks like these two uses
|
|
||||||
# will not conflict because the MSVC args must contain "STRICT"
|
|
||||||
macro(SC_ADDLIB libname srcslist libslist)
|
macro(SC_ADDLIB libname srcslist libslist)
|
||||||
|
|
||||||
|
string(TOUPPER "${libname}" LIBNAME_UPPER)
|
||||||
|
if(${ARGC} GREATER 3)
|
||||||
|
CMAKE_PARSE_ARGUMENTS(${LIBNAME_UPPER} "NO_INSTALL;TESTABLE" "" "SO_SRCS;STATIC_SRCS" ${ARGN})
|
||||||
|
endif(${ARGC} GREATER 3)
|
||||||
|
|
||||||
string(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
|
string(REGEX REPLACE "-framework;" "-framework " libslist "${libslist1}")
|
||||||
if(SC_BUILD_SHARED_LIBS)
|
if(SC_BUILD_SHARED_LIBS)
|
||||||
add_library(${libname} SHARED ${srcslist})
|
add_library(${libname} SHARED ${srcslist} ${${LIBNAME_UPPER}_SO_SRCS})
|
||||||
DEFINE_DLL_EXPORTS(${libname})
|
DEFINE_DLL_EXPORTS(${libname})
|
||||||
if(NOT "${libs}" MATCHES "NONE")
|
if(NOT "${libs}" MATCHES "NONE")
|
||||||
target_link_libraries(${libname} ${libslist})
|
target_link_libraries(${libname} ${libslist})
|
||||||
DEFINE_DLL_IMPORTS(${libname} "${libslist}")
|
DEFINE_DLL_IMPORTS(${libname} "${libslist}")
|
||||||
endif(NOT "${libs}" MATCHES "NONE")
|
endif(NOT "${libs}" MATCHES "NONE")
|
||||||
set_target_properties(${libname} PROPERTIES VERSION ${SC_ABI_VERSION} SOVERSION ${SC_ABI_SOVERSION})
|
set_target_properties(${libname} PROPERTIES VERSION ${SC_ABI_VERSION} SOVERSION ${SC_ABI_SOVERSION})
|
||||||
EXCLUDE_OR_INSTALL(${libname} "lib" "${ARGV3}")
|
if(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
|
||||||
|
install(TARGETS ${libname}
|
||||||
|
RUNTIME DESTINATION ${BIN_DIR}
|
||||||
|
LIBRARY DESTINATION ${LIB_DIR}
|
||||||
|
ARCHIVE DESTINATION ${LIB_DIR}
|
||||||
|
)
|
||||||
|
endif(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
|
||||||
|
if(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
|
||||||
|
set_target_properties( ${libname} PROPERTIES EXCLUDE_FROM_ALL ON )
|
||||||
|
endif(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
set_target_properties(${libname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
@ -122,7 +100,7 @@ macro(SC_ADDLIB libname srcslist libslist)
|
||||||
else()
|
else()
|
||||||
set(staticlibname "${libname}-static")
|
set(staticlibname "${libname}-static")
|
||||||
endif(NOT SC_BUILD_SHARED_LIBS)
|
endif(NOT SC_BUILD_SHARED_LIBS)
|
||||||
add_library(${staticlibname} STATIC ${srcslist})
|
add_library(${staticlibname} STATIC ${srcslist} ${${LIBNAME_UPPER}_STATIC_SRCS})
|
||||||
DEFINE_DLL_EXPORTS(${staticlibname})
|
DEFINE_DLL_EXPORTS(${staticlibname})
|
||||||
if(NOT ${libs} MATCHES "NONE")
|
if(NOT ${libs} MATCHES "NONE")
|
||||||
target_link_libraries(${staticlibname} "${libslist}")
|
target_link_libraries(${staticlibname} "${libslist}")
|
||||||
|
|
@ -137,7 +115,16 @@ macro(SC_ADDLIB libname srcslist libslist)
|
||||||
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
|
# http://www.cmake.org/Wiki/CMake_FAQ#How_do_I_make_my_shared_and_static_libraries_have_the_same_root_name.2C_but_different_suffixes.3F
|
||||||
set_target_properties(${staticlibname} PROPERTIES PREFIX "lib")
|
set_target_properties(${staticlibname} PROPERTIES PREFIX "lib")
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
EXCLUDE_OR_INSTALL(${staticlibname} "lib" "${ARGV3}")
|
if(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
|
||||||
|
install(TARGETS ${libname}-static
|
||||||
|
RUNTIME DESTINATION ${BIN_DIR}
|
||||||
|
LIBRARY DESTINATION ${LIB_DIR}
|
||||||
|
ARCHIVE DESTINATION ${LIB_DIR}
|
||||||
|
)
|
||||||
|
endif(NOT ${LIBNAME_UPPER}_NO_INSTALL AND NOT ${LIBNAME_UPPER}_TESTABLE)
|
||||||
|
if(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
|
||||||
|
set_target_properties( ${libname}-static PROPERTIES EXCLUDE_FROM_ALL ON )
|
||||||
|
endif(NOT SC_ENABLE_TESTING AND ${LIBNAME_UPPER}_TESTABLE)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set_target_properties(${staticlibname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
set_target_properties(${staticlibname} PROPERTIES LINK_FLAGS "-flat_namespace -undefined suppress")
|
||||||
endif(APPLE)
|
endif(APPLE)
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,22 @@
|
||||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||||
|
|
||||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
list(REVERSE files)
|
list(REVERSE files)
|
||||||
foreach (file ${files})
|
foreach (file ${files})
|
||||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}"
|
COMMAND ${CMAKE_COMMAND} -E remove "$ENV{DESTDIR}${file}"
|
||||||
OUTPUT_VARIABLE rm_out
|
OUTPUT_VARIABLE rm_out
|
||||||
RESULT_VARIABLE rm_retval
|
RESULT_VARIABLE rm_retval
|
||||||
)
|
)
|
||||||
if(NOT ${rm_retval} EQUAL 0)
|
if(NOT ${rm_retval} EQUAL 0)
|
||||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||||
endif (NOT ${rm_retval} EQUAL 0)
|
endif (NOT ${rm_retval} EQUAL 0)
|
||||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||||
endforeach(file)
|
endforeach(file)
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width: 8
|
|
||||||
# mode: cmake
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# End:
|
|
||||||
# ex: shiftwidth=2 tabstop=8
|
|
||||||
|
|
||||||
|
|
@ -1,102 +0,0 @@
|
||||||
# Inherit the parent CMake setting
|
|
||||||
set(CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
|
|
||||||
set(LEMON_EXECUTABLE "@LEMON_EXECUTABLE@")
|
|
||||||
set(RE2C_EXECUTABLE "@RE2C_EXECUTABLE@")
|
|
||||||
set(PERPLEX_EXECUTABLE "@PERPLEX_EXECUTABLE@")
|
|
||||||
set(SYNC_SCRIPT "@SYNC_SCRIPT@")
|
|
||||||
set(SYNC_TARGET_NAME "@SYNC_TARGET_NAME@")
|
|
||||||
set(DEBUGGING_GENERATED_SOURCES "@DEBUGGING_GENERATED_SOURCES@")
|
|
||||||
|
|
||||||
if(NOT DEBUGGING_GENERATED_SOURCES)
|
|
||||||
# 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")
|
|
||||||
|
|
||||||
# The following need to be checked:
|
|
||||||
#
|
|
||||||
# 1. baseline input MD5 hashes against the current input
|
|
||||||
# hashes. If the cached sources were generated using
|
|
||||||
# inputs other than the current inputs, note they are
|
|
||||||
# out of sync but don't stop. Templates used by perplex
|
|
||||||
# and lemon are part of this group.
|
|
||||||
#
|
|
||||||
# 2. baseline cached source MD5 hashes against current
|
|
||||||
# cached source MD5 hashes. Making sure no changes
|
|
||||||
# have been made to the generated sources. If the
|
|
||||||
# cached sources need to be updated (see #1, for example)
|
|
||||||
# their MD5 hashes need to be updated at the same time.
|
|
||||||
#
|
|
||||||
# 3. MD5 hashes of output generated by the tools against
|
|
||||||
# the MD5 hashes of the equalivent cached sources, if
|
|
||||||
# a) the tool versions are the same b) the input MD5
|
|
||||||
# hash comparisions were the same and c) the baseline
|
|
||||||
# test from #2 passed. This is done to detect platform
|
|
||||||
# differences in output sources, but is only valid if
|
|
||||||
# the input files are in their "pristine" state and the
|
|
||||||
# toolchain is equalivent to that used for the baseline.
|
|
||||||
|
|
||||||
# Individually verify all of the files in question.
|
|
||||||
set(input_files "@INPUT_FILELIST@")
|
|
||||||
VERIFY_FILES("${input_files}" 0 input_unchanged)
|
|
||||||
set(template_files "@TEMPLATE_FILELIST@")
|
|
||||||
VERIFY_FILES("${template_files}" 1 templates_unchanged)
|
|
||||||
set(cached_files "@CACHED_FILELIST@")
|
|
||||||
VERIFY_FILES("${cached_files}" 1 cached_unchanged)
|
|
||||||
if(cached_unchanged)
|
|
||||||
message( "Cached generated source code has not been modified.")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Cached generated sources do not match the MD5 hashes present in /home/mark/step/sc/src/express/generated/verification_info.cmake - if updating cached sources, remember that the build enforces the requirement that associated MD5 hashes in /home/mark/step/sc/src/express/generated/verification_info.cmake are current as well. Cached generated sources should not be directly edited.")
|
|
||||||
endif(cached_unchanged)
|
|
||||||
|
|
||||||
GET_GENERATOR_EXEC_VERSIONS()
|
|
||||||
|
|
||||||
if("${lemon_version}" VERSION_EQUAL "${baseline_lemon_version}" AND "${perplex_version}" VERSION_EQUAL "${baseline_perplex_version}" AND "${re2c_version}" VERSION_EQUAL "${baseline_re2c_version}")
|
|
||||||
set(tool_versions_equal 1)
|
|
||||||
else()
|
|
||||||
set(tool_versions_equal 0)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT input_unchanged)
|
|
||||||
if(templates_unchanged AND tool_versions_equal)
|
|
||||||
message("Input files changed - syncing cached outputs")
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -P ${SYNC_SCRIPT} OUTPUT_VARIABLE output)
|
|
||||||
else(templates_unchanged AND tool_versions_equal)
|
|
||||||
if(NOT templates_unchanged AND NOT tool_versions_equal)
|
|
||||||
message("Input files have been updated, but templates and current tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
|
|
||||||
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
|
|
||||||
else(NOT templates_unchanged AND NOT tool_versions_equal)
|
|
||||||
if(NOT templates_unchanged)
|
|
||||||
message("Input files have been updated, but templates do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
|
|
||||||
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
|
|
||||||
endif(NOT templates_unchanged)
|
|
||||||
if(NOT tool_versions_equal)
|
|
||||||
message("Input files have been updated, but tool versions do not match those previously used to generate cached sources. Automatic syncing will not proceed.")
|
|
||||||
message("To force syncing, use the build target ${SYNC_TARGET_NAME}")
|
|
||||||
endif(NOT tool_versions_equal)
|
|
||||||
endif(NOT templates_unchanged AND NOT tool_versions_equal)
|
|
||||||
endif(templates_unchanged AND tool_versions_equal)
|
|
||||||
else(NOT input_unchanged)
|
|
||||||
if(templates_unchanged AND cached_unchanged AND tool_versions_equal)
|
|
||||||
# Under these conditions, the uncached generated output should be equal to the cached files.
|
|
||||||
# Check if it is - a difference here may indicate a platform-specific behavior in one of the
|
|
||||||
# generators.
|
|
||||||
set(build_files "@BUILD_OUTPUT_FILELIST@")
|
|
||||||
VERIFY_FILES("${build_files}" 1 platform_unchanged)
|
|
||||||
if(NOT platform_unchanged)
|
|
||||||
message("Note: give these build inputs and tools, source files should be identical to generated files. Differences were still observed - possible indiciation of platform-specific generator behavior.")
|
|
||||||
endif(NOT platform_unchanged)
|
|
||||||
endif(templates_unchanged AND cached_unchanged AND tool_versions_equal)
|
|
||||||
endif(NOT input_unchanged)
|
|
||||||
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
|
|
||||||
35
cmake/md5_gen.cmake.in
Normal file
35
cmake/md5_gen.cmake.in
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# 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
|
||||||
30
cmake/md5_verify.cmake.in
Normal file
30
cmake/md5_verify.cmake.in
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# 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
|
||||||
|
|
@ -47,45 +47,24 @@ string(REPLACE "\n" "" GIT_COMMIT_ID ${GIT_COMMIT_ID})
|
||||||
#once cmake_minimum_required is >= 2.8.11, we can use TIMESTAMP:
|
#once cmake_minimum_required is >= 2.8.11, we can use TIMESTAMP:
|
||||||
#string(TIMESTAMP date_time_string)
|
#string(TIMESTAMP date_time_string)
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
execute_process(COMMAND date "+%d %b %Y %H:%M" OUTPUT_VARIABLE date_time_string OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
elseif(WIN32)
|
|
||||||
execute_process(COMMAND cmd /c date /t OUTPUT_VARIABLE currentDate OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
execute_process(COMMAND cmd /c time /t OUTPUT_VARIABLE currentTime OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
set (date_time_string "${currentDate} ${currentTime}")
|
|
||||||
else()
|
|
||||||
set(date_time_string "\" __DATE__ \" \" __TIME__ \" ")
|
|
||||||
if(NOT SC_IS_SUBBUILD)
|
|
||||||
message(STATUS "Unknown platform - using date from preprocessor")
|
|
||||||
endif(NOT SC_IS_SUBBUILD)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(header_string "/* sc_version_string.h - written by cmake. Changes will be lost! */\n"
|
set(header_string "/* sc_version_string.h - written by cmake. Changes will be lost! */\n"
|
||||||
"#ifndef SC_VERSION_STRING\n"
|
"#ifndef SC_VERSION_STRING\n"
|
||||||
"#define SC_VERSION_STRING\n\n"
|
"#define SC_VERSION_STRING\n\n"
|
||||||
"/*\n** The git commit id looks like \"test-1-g5e1fb47\", where test is the\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"
|
"** 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"
|
"** '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"
|
"*/\n\n"
|
||||||
"** preprocessor macros elsewhere.\n*/\n\n"
|
|
||||||
"static char sc_version[512] = {\n"
|
"static char sc_version[512] = {\n"
|
||||||
" \"git commit id: ${GIT_COMMIT_ID}, build timestamp ${date_time_string}\"\n"
|
" \"git commit id: ${GIT_COMMIT_ID}\"\n"
|
||||||
"}\;\n\n"
|
"}\;\n\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
#compare the new and old commit versions, don't update the file if only the timestamp differs
|
#don't update the file unless somethig changed
|
||||||
if(EXISTS ${SC_VERSION_HEADER})
|
string(RANDOM tmpsuffix)
|
||||||
file(READ ${SC_VERSION_HEADER} OLD_VER_STRING LIMIT 600) #file is ~586 bytes
|
file(WRITE ${SC_VERSION_HEADER}.${tmpsuffix} ${header_string})
|
||||||
string(FIND "${OLD_VER_STRING}" "git commit id: ${GIT_COMMIT_ID}" COMMIT_MATCH )
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SC_VERSION_HEADER}.${tmpsuffix} ${SC_VERSION_HEADER})
|
||||||
# ${COMMIT_MATCH} == -1 if no match
|
execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${SC_VERSION_HEADER}.${tmpsuffix})
|
||||||
else()
|
|
||||||
set(COMMIT_MATCH -1)
|
|
||||||
endif(EXISTS ${SC_VERSION_HEADER})
|
|
||||||
|
|
||||||
if(${COMMIT_MATCH} LESS 1 )
|
|
||||||
file(WRITE ${SC_VERSION_HEADER} ${header_string})
|
|
||||||
endif(${COMMIT_MATCH} LESS 1)
|
|
||||||
|
|
||||||
if(NOT SC_IS_SUBBUILD)
|
if(NOT SC_IS_SUBBUILD)
|
||||||
message("-- sc_version_string.h is up-to-date.")
|
message("-- sc_version_string.h is up-to-date.")
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,15 @@
|
||||||
# this makes compilation faster, but sometimes runs into compiler limitations
|
# this makes compilation faster, but sometimes runs into compiler limitations
|
||||||
if(NOT DEFINED SC_UNITY_BUILD)
|
if(NOT DEFINED SC_UNITY_BUILD)
|
||||||
if(BORLAND)
|
if(BORLAND)
|
||||||
message(".. Will not do unity build for this compiler.")
|
message( STATUS "Will not do unity build for this compiler. (SC_UNITY_BUILD=FALSE)")
|
||||||
set(SC_UNITY_BUILD FALSE)
|
set(SC_UNITY_BUILD FALSE)
|
||||||
else()
|
else()
|
||||||
message(".. Assuming compiler is capable of unity build.")
|
message( STATUS "Assuming compiler is capable of unity build. (SC_UNITY_BUILD=TRUE)")
|
||||||
set(SC_UNITY_BUILD TRUE)
|
set(SC_UNITY_BUILD TRUE)
|
||||||
endif(BORLAND)
|
endif(BORLAND)
|
||||||
message(".. Override by setting SC_UNITY_BUILD; TRUE will result in *huge* translation units, higher memory use in compilation, and faster build times.")
|
message( STATUS "Override by setting SC_UNITY_BUILD; TRUE will result in faster build times but *huge* translation units and higher memory use in compilation.")
|
||||||
else(NOT DEFINED SC_UNITY_BUILD)
|
else(NOT DEFINED SC_UNITY_BUILD)
|
||||||
message(".. Respecting user-defined SC_UNITY_BUILD value of ${SC_UNITY_BUILD}.")
|
message( STATUS "Respecting user-defined SC_UNITY_BUILD value of ${SC_UNITY_BUILD}.")
|
||||||
endif(NOT DEFINED SC_UNITY_BUILD)
|
endif(NOT DEFINED SC_UNITY_BUILD)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ set(CMAKE_C_COMPILER \"${CMAKE_C_COMPILER}\" CACHE STRING \"compiler\")
|
||||||
set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACHE STRING \"compiler\")
|
set(CMAKE_CXX_COMPILER \"${CMAKE_CXX_COMPILER}\" CACHE STRING \"compiler\")
|
||||||
")
|
")
|
||||||
|
|
||||||
message("-- Compiling schema scanner...")
|
message( STATUS "Compiling schema scanner...")
|
||||||
|
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SC_BINARY_DIR}/schemas)
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SC_BINARY_DIR}/schemas)
|
||||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SCANNER_BUILD_DIR})
|
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${SCANNER_BUILD_DIR})
|
||||||
|
|
@ -72,7 +72,7 @@ if(NOT ${_ss_build_stat} STREQUAL "0")
|
||||||
message(FATAL_ERROR "Scanner build status: ${_ss_build_stat}. stdout:\n${_ss_build_out}\nstderr:\n${_ss_build_err}")
|
message(FATAL_ERROR "Scanner build status: ${_ss_build_stat}. stdout:\n${_ss_build_out}\nstderr:\n${_ss_build_err}")
|
||||||
endif(NOT ${_ss_build_stat} STREQUAL "0")
|
endif(NOT ${_ss_build_stat} STREQUAL "0")
|
||||||
|
|
||||||
message("-- Schema scanner built. Running it...")
|
message( STATUS "Schema scanner built. Running it...")
|
||||||
|
|
||||||
# not sure if it makes sense to install this or not...
|
# not sure if it makes sense to install this or not...
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
|
||||||
|
|
@ -1,39 +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
|
|
||||||
if(NOT DEBUGGING_GENERATED_SOURCES)
|
|
||||||
|
|
||||||
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 "@CACHED_FILELIST@")
|
|
||||||
VERIFY_FILES("${filelist}" 1 srcs_pass)
|
|
||||||
if( srcs_pass)
|
|
||||||
message( "Generated source code has not been modified.")
|
|
||||||
else(srcs_pass)
|
|
||||||
message(FATAL_ERROR "Generated sources have been modified. These files should never be modified directly except when debugging faulty output from the generators - changes to lexer and parser logic should be made to the generator input files. If this is a debugging situation, set the variable DEBUGGING_GENERATED_SOURCES to ON during the CMake configure.")
|
|
||||||
endif(srcs_pass)
|
|
||||||
|
|
||||||
# If we got by that test, see if it looks like these
|
|
||||||
# sources came from the current input files. It's not
|
|
||||||
# a failure condition if they didn't, but warn about it.
|
|
||||||
set(filelist "@INPUT_FILELIST@")
|
|
||||||
VERIFY_FILES("${filelist}" 0 inputs_same)
|
|
||||||
if(NOT inputs_same)
|
|
||||||
message("Note: cached generated sources are not in sync with input files.")
|
|
||||||
endif(NOT inputs_same)
|
|
||||||
|
|
||||||
endif(NOT DEBUGGING_GENERATED_SOURCES)
|
|
||||||
|
|
||||||
# Local Variables:
|
|
||||||
# tab-width: 8
|
|
||||||
# mode: cmake
|
|
||||||
# indent-tabs-mode: t
|
|
||||||
# End:
|
|
||||||
# ex: shiftwidth=2 tabstop=8
|
|
||||||
162
doc/Doxyfile
162
doc/Doxyfile
|
|
@ -1,4 +1,4 @@
|
||||||
# Doxyfile 1.7.4
|
# Doxyfile 1.7.6.1
|
||||||
|
|
||||||
# This file describes the settings to be used by the documentation system
|
# This file describes the settings to be used by the documentation system
|
||||||
# doxygen (www.doxygen.org) for a project
|
# doxygen (www.doxygen.org) for a project
|
||||||
|
|
@ -22,22 +22,23 @@
|
||||||
|
|
||||||
DOXYFILE_ENCODING = UTF-8
|
DOXYFILE_ENCODING = UTF-8
|
||||||
|
|
||||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
# The PROJECT_NAME tag is a single word (or sequence of words) that should
|
||||||
# by quotes) that should identify the project.
|
# identify the project. Note that if you do not use Doxywizard you need
|
||||||
|
# to put quotes around the project name if it contains spaces.
|
||||||
|
|
||||||
PROJECT_NAME = scl
|
PROJECT_NAME = SC
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 3.2
|
PROJECT_NUMBER = 0.8
|
||||||
|
|
||||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||||
# for a project that appears at the top of each page and should give viewer
|
# for a project that appears at the top of each page and should give viewer
|
||||||
# a quick idea about the purpose of the project. Keep the description short.
|
# a quick idea about the purpose of the project. Keep the description short.
|
||||||
|
|
||||||
PROJECT_BRIEF = "STEPcode"
|
PROJECT_BRIEF = STEPcode
|
||||||
|
|
||||||
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
# With the PROJECT_LOGO tag one can specify an logo or icon that is
|
||||||
# included in the documentation. The maximum height of the logo should not
|
# included in the documentation. The maximum height of the logo should not
|
||||||
|
|
@ -51,7 +52,7 @@ PROJECT_LOGO =
|
||||||
# If a relative path is entered, it will be relative to the location
|
# If a relative path is entered, it will be relative to the location
|
||||||
# where doxygen was started. If left blank the current directory will be used.
|
# where doxygen was started. If left blank the current directory will be used.
|
||||||
|
|
||||||
OUTPUT_DIRECTORY = .
|
OUTPUT_DIRECTORY = /mnt/raid/mark/sc-doxygen
|
||||||
|
|
||||||
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
|
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
|
||||||
# 4096 sub-directories (in 2 levels) under the output directory of each output
|
# 4096 sub-directories (in 2 levels) under the output directory of each output
|
||||||
|
|
@ -204,6 +205,13 @@ TAB_SIZE = 8
|
||||||
|
|
||||||
ALIASES =
|
ALIASES =
|
||||||
|
|
||||||
|
# This tag can be used to specify a number of word-keyword mappings (TCL only).
|
||||||
|
# A mapping has the form "name=value". For example adding
|
||||||
|
# "class=itcl::class" will allow you to use the command class in the
|
||||||
|
# itcl::class meaning.
|
||||||
|
|
||||||
|
TCL_SUBST =
|
||||||
|
|
||||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
||||||
# sources only. Doxygen will then generate output that is more tailored for C.
|
# sources only. Doxygen will then generate output that is more tailored for C.
|
||||||
# For instance, some of the names that are used will be different. The list
|
# For instance, some of the names that are used will be different. The list
|
||||||
|
|
@ -293,6 +301,15 @@ SUBGROUPING = YES
|
||||||
|
|
||||||
INLINE_GROUPED_CLASSES = NO
|
INLINE_GROUPED_CLASSES = NO
|
||||||
|
|
||||||
|
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
|
||||||
|
# unions with only public data fields will be shown inline in the documentation
|
||||||
|
# of the scope in which they are defined (i.e. file, namespace, or group
|
||||||
|
# documentation), provided this scope is documented. If set to NO (the default),
|
||||||
|
# structs, classes, and unions are shown on a separate page (for HTML and Man
|
||||||
|
# pages) or section (for LaTeX and RTF).
|
||||||
|
|
||||||
|
INLINE_SIMPLE_STRUCTS = NO
|
||||||
|
|
||||||
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
|
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
|
||||||
# is documented as struct, union, or enum with the name of the typedef. So
|
# is documented as struct, union, or enum with the name of the typedef. So
|
||||||
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
|
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
|
||||||
|
|
@ -315,10 +332,21 @@ TYPEDEF_HIDES_STRUCT = NO
|
||||||
# a logarithmic scale so increasing the size by one will roughly double the
|
# a logarithmic scale so increasing the size by one will roughly double the
|
||||||
# memory usage. The cache size is given by this formula:
|
# memory usage. The cache size is given by this formula:
|
||||||
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||||
# corresponding to a cache size of 2^16 = 65536 symbols
|
# corresponding to a cache size of 2^16 = 65536 symbols.
|
||||||
|
|
||||||
SYMBOL_CACHE_SIZE = 0
|
SYMBOL_CACHE_SIZE = 0
|
||||||
|
|
||||||
|
# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
|
||||||
|
# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
|
||||||
|
# their name and scope. Since this can be an expensive process and often the
|
||||||
|
# same symbol appear multiple times in the code, doxygen keeps a cache of
|
||||||
|
# pre-resolved symbols. If the cache is too small doxygen will become slower.
|
||||||
|
# If the cache is too large, memory is wasted. The cache size is given by this
|
||||||
|
# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
|
||||||
|
# corresponding to a cache size of 2^16 = 65536 symbols.
|
||||||
|
|
||||||
|
LOOKUP_CACHE_SIZE = 0
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Build related configuration options
|
# Build related configuration options
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
@ -338,7 +366,7 @@ EXTRACT_PRIVATE = NO
|
||||||
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
# If the EXTRACT_STATIC tag is set to YES all static members of a file
|
||||||
# will be included in the documentation.
|
# will be included in the documentation.
|
||||||
|
|
||||||
EXTRACT_STATIC = NO
|
EXTRACT_STATIC = YES
|
||||||
|
|
||||||
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
|
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
|
||||||
# defined locally in source files will be included in the documentation.
|
# defined locally in source files will be included in the documentation.
|
||||||
|
|
@ -559,6 +587,16 @@ FILE_VERSION_FILTER =
|
||||||
|
|
||||||
LAYOUT_FILE =
|
LAYOUT_FILE =
|
||||||
|
|
||||||
|
# The CITE_BIB_FILES tag can be used to specify one or more bib files
|
||||||
|
# containing the references data. This must be a list of .bib files. The
|
||||||
|
# .bib extension is automatically appended if omitted. Using this command
|
||||||
|
# requires the bibtex tool to be installed. See also
|
||||||
|
# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
|
||||||
|
# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
|
||||||
|
# feature you need bibtex and perl available in the search path.
|
||||||
|
|
||||||
|
CITE_BIB_FILES =
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to warning and progress messages
|
# configuration options related to warning and progress messages
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
@ -621,7 +659,8 @@ WARN_LOGFILE =
|
||||||
|
|
||||||
INPUT = src \
|
INPUT = src \
|
||||||
include \
|
include \
|
||||||
build/src/express
|
build/src/express \
|
||||||
|
build/include
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||||
|
|
@ -677,13 +716,16 @@ FILE_PATTERNS = *.c \
|
||||||
|
|
||||||
RECURSIVE = YES
|
RECURSIVE = YES
|
||||||
|
|
||||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
# The EXCLUDE tag can be used to specify files and/or directories that should be
|
||||||
# excluded from the INPUT source files. This way you can easily exclude a
|
# excluded from the INPUT source files. This way you can easily exclude a
|
||||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||||
|
# Note that relative paths are relative to the directory from which doxygen is
|
||||||
|
# run.
|
||||||
|
|
||||||
EXCLUDE =
|
EXCLUDE = .git \
|
||||||
|
cmake/
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||||
# from the input.
|
# from the input.
|
||||||
|
|
||||||
|
|
@ -773,7 +815,7 @@ FILTER_SOURCE_PATTERNS =
|
||||||
# Note: To get rid of all source code in the generated output, make sure also
|
# Note: To get rid of all source code in the generated output, make sure also
|
||||||
# VERBATIM_HEADERS is set to NO.
|
# VERBATIM_HEADERS is set to NO.
|
||||||
|
|
||||||
SOURCE_BROWSER = NO
|
SOURCE_BROWSER = YES
|
||||||
|
|
||||||
# Setting the INLINE_SOURCES tag to YES will include the body
|
# Setting the INLINE_SOURCES tag to YES will include the body
|
||||||
# of functions and classes directly in the documentation.
|
# of functions and classes directly in the documentation.
|
||||||
|
|
@ -865,13 +907,13 @@ HTML_FILE_EXTENSION = .html
|
||||||
|
|
||||||
# The HTML_HEADER tag can be used to specify a personal HTML header for
|
# The HTML_HEADER tag can be used to specify a personal HTML header for
|
||||||
# each generated HTML page. If it is left blank doxygen will generate a
|
# each generated HTML page. If it is left blank doxygen will generate a
|
||||||
# standard header. Note that when using a custom header you are responsible
|
# standard header. Note that when using a custom header you are responsible
|
||||||
# for the proper inclusion of any scripts and style sheets that doxygen
|
# for the proper inclusion of any scripts and style sheets that doxygen
|
||||||
# needs, which is dependent on the configuration options used.
|
# needs, which is dependent on the configuration options used.
|
||||||
# It is adviced to generate a default header using "doxygen -w html
|
# It is advised to generate a default header using "doxygen -w html
|
||||||
# header.html footer.html stylesheet.css YourConfigFile" and then modify
|
# header.html footer.html stylesheet.css YourConfigFile" and then modify
|
||||||
# that header. Note that the header is subject to change so you typically
|
# that header. Note that the header is subject to change so you typically
|
||||||
# have to redo this when upgrading to a newer version of doxygen or when
|
# have to redo this when upgrading to a newer version of doxygen or when
|
||||||
# changing the value of configuration settings such as GENERATE_TREEVIEW!
|
# changing the value of configuration settings such as GENERATE_TREEVIEW!
|
||||||
|
|
||||||
HTML_HEADER =
|
HTML_HEADER =
|
||||||
|
|
@ -887,7 +929,7 @@ HTML_FOOTER =
|
||||||
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
# fine-tune the look of the HTML output. If the tag is left blank doxygen
|
||||||
# will generate a default style sheet. Note that doxygen will try to copy
|
# will generate a default style sheet. Note that doxygen will try to copy
|
||||||
# the style sheet file to the HTML output directory, so don't put your own
|
# the style sheet file to the HTML output directory, so don't put your own
|
||||||
# stylesheet in the HTML output directory as well, or it will be erased!
|
# style sheet in the HTML output directory as well, or it will be erased!
|
||||||
|
|
||||||
HTML_STYLESHEET =
|
HTML_STYLESHEET =
|
||||||
|
|
||||||
|
|
@ -901,7 +943,7 @@ HTML_STYLESHEET =
|
||||||
HTML_EXTRA_FILES =
|
HTML_EXTRA_FILES =
|
||||||
|
|
||||||
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
|
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
|
||||||
# Doxygen will adjust the colors in the stylesheet and background images
|
# Doxygen will adjust the colors in the style sheet and background images
|
||||||
# according to this color. Hue is specified as an angle on a colorwheel,
|
# according to this color. Hue is specified as an angle on a colorwheel,
|
||||||
# see http://en.wikipedia.org/wiki/Hue for more information.
|
# see http://en.wikipedia.org/wiki/Hue for more information.
|
||||||
# For instance the value 0 represents red, 60 is yellow, 120 is green,
|
# For instance the value 0 represents red, 60 is yellow, 120 is green,
|
||||||
|
|
@ -1096,29 +1138,33 @@ GENERATE_ECLIPSEHELP = NO
|
||||||
|
|
||||||
ECLIPSE_DOC_ID = org.doxygen.Project
|
ECLIPSE_DOC_ID = org.doxygen.Project
|
||||||
|
|
||||||
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
|
# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
|
||||||
# top of each HTML page. The value NO (the default) enables the index and
|
# at top of each HTML page. The value NO (the default) enables the index and
|
||||||
# the value YES disables it.
|
# the value YES disables it. Since the tabs have the same information as the
|
||||||
|
# navigation tree you can set this option to NO if you already set
|
||||||
|
# GENERATE_TREEVIEW to YES.
|
||||||
|
|
||||||
DISABLE_INDEX = NO
|
DISABLE_INDEX = NO
|
||||||
|
|
||||||
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
|
|
||||||
# (range [0,1..20]) that doxygen will group on one line in the generated HTML
|
|
||||||
# documentation. Note that a value of 0 will completely suppress the enum
|
|
||||||
# values from appearing in the overview section.
|
|
||||||
|
|
||||||
ENUM_VALUES_PER_LINE = 4
|
|
||||||
|
|
||||||
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
|
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
|
||||||
# structure should be generated to display hierarchical information.
|
# structure should be generated to display hierarchical information.
|
||||||
# If the tag value is set to YES, a side panel will be generated
|
# If the tag value is set to YES, a side panel will be generated
|
||||||
# containing a tree-like index structure (just like the one that
|
# containing a tree-like index structure (just like the one that
|
||||||
# is generated for HTML Help). For this to work a browser that supports
|
# is generated for HTML Help). For this to work a browser that supports
|
||||||
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
|
# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
|
||||||
# Windows users are probably better off using the HTML help feature.
|
# Windows users are probably better off using the HTML help feature.
|
||||||
|
# Since the tree basically has the same information as the tab index you
|
||||||
|
# could consider to set DISABLE_INDEX to NO when enabling this option.
|
||||||
|
|
||||||
GENERATE_TREEVIEW = YES
|
GENERATE_TREEVIEW = YES
|
||||||
|
|
||||||
|
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
|
||||||
|
# (range [0,1..20]) that doxygen will group on one line in the generated HTML
|
||||||
|
# documentation. Note that a value of 0 will completely suppress the enum
|
||||||
|
# values from appearing in the overview section.
|
||||||
|
|
||||||
|
ENUM_VALUES_PER_LINE = 4
|
||||||
|
|
||||||
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
|
# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
|
||||||
# and Class Hierarchy pages using a tree view instead of an ordered list.
|
# and Class Hierarchy pages using a tree view instead of an ordered list.
|
||||||
|
|
||||||
|
|
@ -1171,6 +1217,11 @@ USE_MATHJAX = NO
|
||||||
|
|
||||||
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
||||||
|
|
||||||
|
# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
|
||||||
|
# names that should be enabled during MathJax rendering.
|
||||||
|
|
||||||
|
MATHJAX_EXTENSIONS =
|
||||||
|
|
||||||
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
|
# When the SEARCHENGINE tag is enabled doxygen will generate a search box
|
||||||
# for the HTML output. The underlying search engine uses javascript
|
# for the HTML output. The underlying search engine uses javascript
|
||||||
# and DHTML and should work on any modern browser. Note that when using
|
# and DHTML and should work on any modern browser. Note that when using
|
||||||
|
|
@ -1179,7 +1230,7 @@ MATHJAX_RELPATH = http://www.mathjax.org/mathjax
|
||||||
# typically be disabled. For large projects the javascript based search engine
|
# typically be disabled. For large projects the javascript based search engine
|
||||||
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
|
||||||
|
|
||||||
SEARCHENGINE = NO
|
SEARCHENGINE = YES
|
||||||
|
|
||||||
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
|
||||||
# implemented using a PHP enabled web server instead of at the web client
|
# implemented using a PHP enabled web server instead of at the web client
|
||||||
|
|
@ -1284,6 +1335,12 @@ LATEX_HIDE_INDICES = NO
|
||||||
|
|
||||||
LATEX_SOURCE_CODE = NO
|
LATEX_SOURCE_CODE = NO
|
||||||
|
|
||||||
|
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
|
||||||
|
# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
|
||||||
|
# http://en.wikipedia.org/wiki/BibTeX for more info.
|
||||||
|
|
||||||
|
LATEX_BIB_STYLE = plain
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# configuration options related to the RTF output
|
# configuration options related to the RTF output
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
@ -1315,7 +1372,7 @@ COMPACT_RTF = NO
|
||||||
|
|
||||||
RTF_HYPERLINKS = NO
|
RTF_HYPERLINKS = NO
|
||||||
|
|
||||||
# Load stylesheet definitions from file. Syntax is similar to doxygen's
|
# Load style sheet definitions from file. Syntax is similar to doxygen's
|
||||||
# config file, i.e. a series of assignments. You only have to provide
|
# config file, i.e. a series of assignments. You only have to provide
|
||||||
# replacements, missing definitions are set to their default value.
|
# replacements, missing definitions are set to their default value.
|
||||||
|
|
||||||
|
|
@ -1585,32 +1642,30 @@ HAVE_DOT = YES
|
||||||
|
|
||||||
DOT_NUM_THREADS = 0
|
DOT_NUM_THREADS = 0
|
||||||
|
|
||||||
# By default doxygen will write a font called Helvetica to the output
|
# By default doxygen will use the Helvetica font for all dot files that
|
||||||
# directory and reference it in all dot files that doxygen generates.
|
# doxygen generates. When you want a differently looking font you can specify
|
||||||
# When you want a differently looking font you can specify the font name
|
# the font name using DOT_FONTNAME. You need to make sure dot is able to find
|
||||||
# using DOT_FONTNAME. You need to make sure dot is able to find the font,
|
# the font, which can be done by putting it in a standard location or by setting
|
||||||
# which can be done by putting it in a standard location or by setting the
|
# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
|
||||||
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
|
# directory containing the font.
|
||||||
# containing the font.
|
|
||||||
|
|
||||||
DOT_FONTNAME = FreeSans
|
DOT_FONTNAME = Roboto
|
||||||
|
|
||||||
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
|
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
|
||||||
# The default size is 10pt.
|
# The default size is 10pt.
|
||||||
|
|
||||||
DOT_FONTSIZE = 10
|
DOT_FONTSIZE = 10
|
||||||
|
|
||||||
# By default doxygen will tell dot to use the output directory to look for the
|
# By default doxygen will tell dot to use the Helvetica font.
|
||||||
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
|
# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
|
||||||
# different font using DOT_FONTNAME you can set the path where dot
|
# set the path where dot can find it.
|
||||||
# can find it using this tag.
|
|
||||||
|
|
||||||
DOT_FONTPATH =
|
DOT_FONTPATH =
|
||||||
|
|
||||||
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
|
||||||
# will generate a graph for each documented class showing the direct and
|
# will generate a graph for each documented class showing the direct and
|
||||||
# indirect inheritance relations. Setting this tag to YES will force the
|
# indirect inheritance relations. Setting this tag to YES will force the
|
||||||
# the CLASS_DIAGRAMS tag to NO.
|
# CLASS_DIAGRAMS tag to NO.
|
||||||
|
|
||||||
CLASS_GRAPH = YES
|
CLASS_GRAPH = YES
|
||||||
|
|
||||||
|
|
@ -1681,10 +1736,21 @@ DIRECTORY_GRAPH = YES
|
||||||
|
|
||||||
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
|
||||||
# generated by dot. Possible values are svg, png, jpg, or gif.
|
# generated by dot. Possible values are svg, png, jpg, or gif.
|
||||||
# If left blank png will be used.
|
# If left blank png will be used. If you choose svg you need to set
|
||||||
|
# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
|
||||||
|
# visible in IE 9+ (other browsers do not have this requirement).
|
||||||
|
|
||||||
DOT_IMAGE_FORMAT = png
|
DOT_IMAGE_FORMAT = png
|
||||||
|
|
||||||
|
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
|
||||||
|
# enable generation of interactive SVG images that allow zooming and panning.
|
||||||
|
# Note that this requires a modern browser other than Internet Explorer.
|
||||||
|
# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
|
||||||
|
# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
|
||||||
|
# visible. Older versions of IE do not have SVG support.
|
||||||
|
|
||||||
|
INTERACTIVE_SVG = NO
|
||||||
|
|
||||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
||||||
# found. If left blank, it is assumed the dot tool can be found in the path.
|
# found. If left blank, it is assumed the dot tool can be found in the path.
|
||||||
|
|
||||||
|
|
@ -1735,7 +1801,7 @@ DOT_TRANSPARENT = NO
|
||||||
# makes dot run faster, but since only newer versions of dot (>1.8.10)
|
# makes dot run faster, but since only newer versions of dot (>1.8.10)
|
||||||
# support this, this feature is disabled by default.
|
# support this, this feature is disabled by default.
|
||||||
|
|
||||||
DOT_MULTI_TARGETS = NO
|
DOT_MULTI_TARGETS = YES
|
||||||
|
|
||||||
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
|
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
|
||||||
# generate a legend page explaining the meaning of the various boxes and
|
# generate a legend page explaining the meaning of the various boxes and
|
||||||
|
|
|
||||||
80
example/ap203min/ExternalProjectBuild/CMakeLists.txt
Normal file
80
example/ap203min/ExternalProjectBuild/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
#
|
||||||
|
# CMakeLists.txt for AP203 Minimum
|
||||||
|
#
|
||||||
|
# This file is released to the public domain. Any part of this file may be
|
||||||
|
# freely copied in part or in full for any purpose. No acknowledgment is required
|
||||||
|
# for the use of this file.
|
||||||
|
#
|
||||||
|
project(AP203Minimum)
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
INCLUDE( ExternalProject )
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${AP203Minimum_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
|
INCLUDE( External_STEPCode )
|
||||||
|
|
||||||
|
#####
|
||||||
|
# Variables ideally set by FindSTEPCode.cmake
|
||||||
|
|
||||||
|
IF(NOT WIN32)
|
||||||
|
set( STEPCODE_LIBRARIES
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libbase.a
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libstepcore.a
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.a
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libstepdai.a
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libsteputils.a
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libsdai_ap203.a
|
||||||
|
)
|
||||||
|
ELSE()
|
||||||
|
set( STEPCODE_LIBRARIES
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libbase.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libstepcore.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libstepeditor.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libstepdai.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libsteputils.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libsdai_ap203.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libexpress.lib
|
||||||
|
${STEPCODE_INSTALL_DIR}/lib/libexppp.lib
|
||||||
|
shlwapi.lib
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
MESSAGE( STATUS "STEPCODE_INSTALL_DIR: " ${STEPCODE_INSTALL_DIR} )
|
||||||
|
|
||||||
|
set( STEPCODE_INCLUDE_DIR
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/stepcode
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/stepcode/base
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/stepcode/clstepcore
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/stepcode/cldai
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/stepcode/clutils
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/stepcode/cleditor
|
||||||
|
${STEPCODE_INSTALL_DIR}/include/schemas/sdai_ap203
|
||||||
|
)
|
||||||
|
|
||||||
|
# End of variables ideally set by FindSTEPCode.cmake
|
||||||
|
######
|
||||||
|
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${STEPCODE_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SRCS ../ap203min.cpp)
|
||||||
|
|
||||||
|
set(HDRS )
|
||||||
|
|
||||||
|
add_executable( ${PROJECT_NAME} ${SRCS} ${HDRS})
|
||||||
|
|
||||||
|
add_dependencies( ${PROJECT_NAME} STEPCODE )
|
||||||
|
|
||||||
|
target_link_libraries( ${PROJECT_NAME}
|
||||||
|
${STEPCODE_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# tab-width: 8
|
||||||
|
# mode: cmake
|
||||||
|
# indent-tabs-mode: t
|
||||||
|
# End:
|
||||||
|
# ex: shiftwidth=2 tabstop=8
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
ExternalProject_Add( STEPCODE
|
||||||
|
URL ${CMAKE_CURRENT_SOURCE_DIR}/../../..
|
||||||
|
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||||
|
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
|
||||||
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
||||||
|
-DSC_BUILD_TYPE=Debug
|
||||||
|
-DSC_BUILD_SCHEMAS=ap203/ap203.exp
|
||||||
|
-DSC_BUILD_STATIC_LIBS=ON
|
||||||
|
-DSC_PYTHON_GENERATOR=OFF
|
||||||
|
-DSC_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
||||||
|
)
|
||||||
|
ExternalProject_Get_Property( STEPCODE SOURCE_DIR )
|
||||||
|
ExternalProject_Get_Property( STEPCODE BINARY_DIR )
|
||||||
|
ExternalProject_Get_Property( STEPCODE INSTALL_DIR )
|
||||||
|
|
||||||
|
IF( NOT WIN32 )
|
||||||
|
SET( STEPCODE_INSTALL_DIR ${SOURCE_DIR}/../sc-install )
|
||||||
|
ELSE()
|
||||||
|
SET( STEPCODE_INSTALL_DIR ${INSTALL_DIR} )
|
||||||
|
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
|
||||||
|
|
@ -24,5 +24,7 @@
|
||||||
#cmakedefine HAVE_SSIZE_T 1
|
#cmakedefine HAVE_SSIZE_T 1
|
||||||
|
|
||||||
#cmakedefine HAVE_STD_THREAD 1
|
#cmakedefine HAVE_STD_THREAD 1
|
||||||
|
#cmakedefine HAVE_STD_CHRONO 1
|
||||||
|
#cmakedefine HAVE_NULLPTR 1
|
||||||
|
|
||||||
#endif /* SCL_CF_H */
|
#endif /* SCL_CF_H */
|
||||||
|
|
|
||||||
330
misc/summarize-appveyor-log.go
Normal file
330
misc/summarize-appveyor-log.go
Normal file
|
|
@ -0,0 +1,330 @@
|
||||||
|
//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;
|
||||||
|
|
@ -5,6 +5,8 @@ set(SC_BASE_SOURCES
|
||||||
sc_getopt.cc
|
sc_getopt.cc
|
||||||
sc_benchmark.cc
|
sc_benchmark.cc
|
||||||
sc_mkdir.c
|
sc_mkdir.c
|
||||||
|
path2str.c
|
||||||
|
judy/src/judy.c
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SC_BASE_HDRS
|
set(SC_BASE_HDRS
|
||||||
|
|
@ -12,10 +14,21 @@ set(SC_BASE_HDRS
|
||||||
sc_memmgr.h
|
sc_memmgr.h
|
||||||
sc_getopt.h
|
sc_getopt.h
|
||||||
sc_trace_fprintf.h
|
sc_trace_fprintf.h
|
||||||
sc_stdbool.h
|
|
||||||
sc_mkdir.h
|
sc_mkdir.h
|
||||||
|
sc_nullptr.h
|
||||||
|
path2str.h
|
||||||
|
judy/src/judy.h
|
||||||
|
judy/src/judyLArray.h
|
||||||
|
judy/src/judyL2Array.h
|
||||||
|
judy/src/judySArray.h
|
||||||
|
judy/src/judyS2Array.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/judy/src
|
||||||
|
)
|
||||||
|
|
||||||
if(MINGW OR MSVC OR BORLAND)
|
if(MINGW OR MSVC OR BORLAND)
|
||||||
add_definitions(-DSC_BASE_DLL_EXPORTS)
|
add_definitions(-DSC_BASE_DLL_EXPORTS)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,11 @@
|
||||||
|
|
||||||
#include "judy.h"
|
#include "judy.h"
|
||||||
|
|
||||||
#if defined(STANDALONE) || defined(ASKITIS)
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if defined(STANDALONE) || defined(ASKITIS)
|
||||||
|
|
||||||
extern unsigned int MaxMem;
|
extern unsigned int MaxMem;
|
||||||
|
|
||||||
// void judy_abort (char *msg) __attribute__ ((noreturn)); // Tell static analyser that this function will not return
|
// void judy_abort (char *msg) __attribute__ ((noreturn)); // Tell static analyser that this function will not return
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,7 @@ class judyL2Array {
|
||||||
kv.value = *_lastSlot;
|
kv.value = *_lastSlot;
|
||||||
_success = true;
|
_success = true;
|
||||||
} else {
|
} else {
|
||||||
kv.value = ( JudyValue ) 0;
|
kv.value = NULL;
|
||||||
_success = false;
|
_success = false;
|
||||||
}
|
}
|
||||||
kv.key = _buff[0];
|
kv.key = _buff[0];
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ class judyS2Array {
|
||||||
kv.value = *_lastSlot;
|
kv.value = *_lastSlot;
|
||||||
_success = true;
|
_success = true;
|
||||||
} else {
|
} else {
|
||||||
kv.value = ( JudyValue ) 0;
|
kv.value = NULL;
|
||||||
_success = false;
|
_success = false;
|
||||||
}
|
}
|
||||||
kv.key = _buff;
|
kv.key = _buff;
|
||||||
|
|
|
||||||
29
src/base/path2str.c
Normal file
29
src/base/path2str.c
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
|
||||||
|
#include "path2str.h"
|
||||||
|
#include "sc_memmgr.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* for windows, rewrite backslashes in paths
|
||||||
|
* that will be written to generated code
|
||||||
|
*/
|
||||||
|
const char * path2str_fn( const char * fileMacro ) {
|
||||||
|
static char * result = 0;
|
||||||
|
static size_t rlen = 0;
|
||||||
|
char * p;
|
||||||
|
if( rlen < strlen( fileMacro ) ) {
|
||||||
|
if( result ) {
|
||||||
|
sc_free( result );
|
||||||
|
}
|
||||||
|
rlen = strlen( fileMacro );
|
||||||
|
result = ( char * )sc_malloc( rlen * sizeof( char ) + 1 );
|
||||||
|
}
|
||||||
|
strcpy( result, fileMacro );
|
||||||
|
p = result;
|
||||||
|
while( *p ) {
|
||||||
|
if( *p == '\\' ) {
|
||||||
|
*p = '/';
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
20
src/base/path2str.h
Normal file
20
src/base/path2str.h
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef PATH2STR_H
|
||||||
|
#define PATH2STR_H
|
||||||
|
|
||||||
|
#include <sc_export.h>
|
||||||
|
|
||||||
|
/** windows only: rewrite backslashes in paths as forward slashes
|
||||||
|
* call as path2str(__FILE__) to take advantage of macro
|
||||||
|
*
|
||||||
|
* silence "unknown escape sequence" warning when contents of __FILE__
|
||||||
|
* are fprintf'd into string in generated code
|
||||||
|
*/
|
||||||
|
SC_BASE_EXPORT const char * path2str_fn( const char * fileMacro );
|
||||||
|
|
||||||
|
#if defined( _WIN32 ) || defined ( __WIN32__ )
|
||||||
|
# define path2str(path) path2str_fn(path)
|
||||||
|
#else
|
||||||
|
# define path2str(path) path
|
||||||
|
#endif /* defined( _WIN32 ) || defined ( __WIN32__ ) */
|
||||||
|
|
||||||
|
#endif /* PATH2STR_H */
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "sc_memmgr.h"
|
#include "sc_memmgr.h"
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ sc_memmgr::~sc_memmgr( void ) {
|
||||||
// Check if total allocated equals total deallocated
|
// Check if total allocated equals total deallocated
|
||||||
if( _allocated_total != _deallocated_total ) {
|
if( _allocated_total != _deallocated_total ) {
|
||||||
// todo: generate warning for possible memory leaks, enable full memory leak checking
|
// todo: generate warning for possible memory leaks, enable full memory leak checking
|
||||||
printf( "sc_memmgr warning: Possible memory leaks detected (%d of %d bytes)\n", _allocated_total - _deallocated_total, _allocated_total );
|
fprintf( stderr, "sc_memmgr warning: Possible memory leaks detected (%d of %d bytes)\n", _allocated_total - _deallocated_total, _allocated_total );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compact leaks into an error list to prevent same leak being reported multiple times.
|
// Compact leaks into an error list to prevent same leak being reported multiple times.
|
||||||
|
|
@ -193,7 +193,7 @@ sc_memmgr::~sc_memmgr( void ) {
|
||||||
ierror != errors.end();
|
ierror != errors.end();
|
||||||
ierror ++ ) {
|
ierror ++ ) {
|
||||||
// todo: generate error for memory leak
|
// todo: generate error for memory leak
|
||||||
printf( "sc_memmgr warning: Possible memory leak in %s line %d\n", ierror->getsrcfile().c_str(), ierror->getsrcline() );
|
fprintf( stderr, "sc_memmgr warning: Possible memory leak in %s line %d\n", ierror->getsrcfile().c_str(), ierror->getsrcline() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear remaining records
|
// Clear remaining records
|
||||||
|
|
@ -211,7 +211,7 @@ void * sc_memmgr::allocate( size_t size, const char * file, const int line ) {
|
||||||
addr = malloc( size );
|
addr = malloc( size );
|
||||||
if( addr == NULL ) {
|
if( addr == NULL ) {
|
||||||
// todo: error allocation failed
|
// todo: error allocation failed
|
||||||
printf( "sc_memmgr error: Memory allocation failed in %s line %d\n", file, line );
|
fprintf( stderr, "sc_memmgr error: Memory allocation failed in %s line %d\n", file, line );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some stl implementations (for example debian gcc) use the new operator to construct
|
// Some stl implementations (for example debian gcc) use the new operator to construct
|
||||||
|
|
@ -246,7 +246,7 @@ void * sc_memmgr::reallocate( void * addr, size_t size, const char * file, const
|
||||||
record = _records.find( sc_memmgr_record( addr ) );
|
record = _records.find( sc_memmgr_record( addr ) );
|
||||||
if( record == _records.end() ) {
|
if( record == _records.end() ) {
|
||||||
// todo: error reallocating memory not allocated?
|
// todo: error reallocating memory not allocated?
|
||||||
printf( "sc_memmgr warning: Reallocation of not allocated memory at %s line %d\n", file, line );
|
fprintf( stderr, "sc_memmgr warning: Reallocation of not allocated memory at %s line %d\n", file, line );
|
||||||
} else {
|
} else {
|
||||||
// Update stats
|
// Update stats
|
||||||
_allocated -= record->getsize();
|
_allocated -= record->getsize();
|
||||||
|
|
@ -264,7 +264,7 @@ void * sc_memmgr::reallocate( void * addr, size_t size, const char * file, const
|
||||||
addr = realloc( addr, size );
|
addr = realloc( addr, size );
|
||||||
if( addr == NULL ) {
|
if( addr == NULL ) {
|
||||||
// todo: error reallocation failed
|
// todo: error reallocation failed
|
||||||
printf( "sc_memmgr error: Reallocation failed at %s line %d\n", file, line );
|
fprintf( stderr, "sc_memmgr error: Reallocation failed at %s line %d\n", file, line );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SC_MEMMGR_ENABLE_CHECKS
|
#ifdef SC_MEMMGR_ENABLE_CHECKS
|
||||||
|
|
@ -296,7 +296,7 @@ void sc_memmgr::deallocate( void * addr, const char * file, const int line ) {
|
||||||
record = _records.find( sc_memmgr_record( addr ) );
|
record = _records.find( sc_memmgr_record( addr ) );
|
||||||
if( record == _records.end() ) {
|
if( record == _records.end() ) {
|
||||||
// todo: error free called for not allocated memory?
|
// todo: error free called for not allocated memory?
|
||||||
printf( "sc_memmgr warning: Deallocate of not allocated memory at %s line %d\n", file, line );
|
fprintf( stderr, "sc_memmgr warning: Deallocate of not allocated memory at %s line %d\n", file, line );
|
||||||
} else {
|
} else {
|
||||||
// Update stats
|
// Update stats
|
||||||
_allocated -= record->getsize();
|
_allocated -= record->getsize();
|
||||||
|
|
|
||||||
13
src/base/sc_nullptr.h
Normal file
13
src/base/sc_nullptr.h
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
#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
|
||||||
|
|
@ -9,17 +9,17 @@
|
||||||
*
|
*
|
||||||
* This header must be included *after* all other headers, otherwise the compiler will
|
* This header must be included *after* all other headers, otherwise the compiler will
|
||||||
* report errors in system headers.
|
* report errors in system headers.
|
||||||
* \sa trace_fprintf
|
* \sa trace_fprintf()
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "sc_export.h"
|
#include "sc_export.h"
|
||||||
|
|
||||||
/** used to find where generated c++ originates from in exp2cxx
|
|
||||||
* To enable, configure with 'cmake .. -DSC_TRACE_FPRINTF=ON'
|
|
||||||
*/
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
/** Used to find where generated c++ originates from in exp2cxx.
|
||||||
|
* To enable, configure with 'cmake .. -DSC_TRACE_FPRINTF=ON'
|
||||||
|
*/
|
||||||
SC_BASE_EXPORT void trace_fprintf( char const * sourcefile, int line, FILE * file, const char * format, ... );
|
SC_BASE_EXPORT void trace_fprintf( char const * sourcefile, int line, FILE * file, const char * format, ... );
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "sc_memmgr.h"
|
#include "sc_memmgr.h"
|
||||||
|
|
||||||
|
#include "sdaiApplication_instance.h"
|
||||||
|
|
||||||
// to help ObjectCenter
|
// to help ObjectCenter
|
||||||
#ifndef HAVE_MEMMOVE
|
#ifndef HAVE_MEMMOVE
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,11 @@
|
||||||
|
|
||||||
typedef char * SDAI_DAObjectID;
|
typedef char * SDAI_DAObjectID;
|
||||||
|
|
||||||
// interface PID (ISO/DIS 10303-23:1996(E) 5.3.10.1)
|
|
||||||
// Also, CORBA POS specification, Section 5.4
|
|
||||||
//
|
//
|
||||||
// The PID class maintains the persistent object identifier for every
|
// The PID class maintains the persistent object identifier for every
|
||||||
// persistent object, objects of class DAObject, and objects of any class
|
// persistent object, objects of class DAObject, and objects of any class
|
||||||
// derived directly or indirectly from DAObject.
|
// derived directly or indirectly from DAObject.
|
||||||
//
|
//
|
||||||
// POS: The PID identifies one or more locations within a Datastore that
|
|
||||||
// represent the persistent data of an object and generates a string
|
|
||||||
// identifier for that data. An object must have a PID in order to store
|
|
||||||
// its data persistently.
|
|
||||||
//
|
//
|
||||||
/*
|
/*
|
||||||
The EXPRESS ENTITY application_instance from the SDAI_data_type_schema from
|
The EXPRESS ENTITY application_instance from the SDAI_data_type_schema from
|
||||||
|
|
@ -29,7 +23,7 @@ typedef char * SDAI_DAObjectID;
|
||||||
The class DAObject is supported by the classes PID, PID_SDAI and the type
|
The class DAObject is supported by the classes PID, PID_SDAI and the type
|
||||||
SDAI_DAObjectID as follows:
|
SDAI_DAObjectID as follows:
|
||||||
*/
|
*/
|
||||||
|
/// interface PID (ISO/DIS 10303-23:1996(E) 5.3.10.1)
|
||||||
class SC_DAI_EXPORT SDAI_PID : public SDAI_sdaiObject {
|
class SC_DAI_EXPORT SDAI_PID : public SDAI_sdaiObject {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -67,8 +61,6 @@ typedef SDAI_PID * SDAI_PID_ptr;
|
||||||
typedef SDAI_PID_ptr SDAI_PID_var;
|
typedef SDAI_PID_ptr SDAI_PID_var;
|
||||||
|
|
||||||
|
|
||||||
// interface PID_DA (ISO/DIS 10303-23:1996(E) 5.3.10.3)
|
|
||||||
// Also, CORBA POS specification, Direct Access Protocol, Section 5.10.1
|
|
||||||
//
|
//
|
||||||
// The Direct Access Protocol supports direct access to persistent data
|
// The Direct Access Protocol supports direct access to persistent data
|
||||||
// through typed attributes organized in data objects that are defined
|
// through typed attributes organized in data objects that are defined
|
||||||
|
|
@ -88,7 +80,7 @@ typedef SDAI_PID_ptr SDAI_PID_var;
|
||||||
// may be accessed through this extension to the CosPersistencePID
|
// may be accessed through this extension to the CosPersistencePID
|
||||||
// interface.
|
// interface.
|
||||||
//
|
//
|
||||||
|
/// interface PID_DA (ISO/DIS 10303-23:1996(E) 5.3.10.3)
|
||||||
class SC_DAI_EXPORT SDAI_PID_DA: public SDAI_PID {
|
class SC_DAI_EXPORT SDAI_PID_DA: public SDAI_PID {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -120,11 +112,11 @@ class SC_DAI_EXPORT SDAI_PID_DA: public SDAI_PID {
|
||||||
typedef SDAI_PID_DA * SDAI_PID_DA_ptr;
|
typedef SDAI_PID_DA * SDAI_PID_DA_ptr;
|
||||||
typedef SDAI_PID_DA_ptr SDAI_PID_DA_var;
|
typedef SDAI_PID_DA_ptr SDAI_PID_DA_var;
|
||||||
|
|
||||||
// interface PID_SDAI (ISO/DIS 10303-23:1996(E) 5.3.10.2)
|
|
||||||
//
|
//
|
||||||
// The PID_SDAI class maintains the persistent object identifier for
|
// The PID_SDAI class maintains the persistent object identifier for
|
||||||
// a Model_contents object.
|
// a Model_contents object.
|
||||||
//
|
//
|
||||||
|
/// interface PID_SDAI (ISO/DIS 10303-23:1996(E) 5.3.10.2)
|
||||||
class SC_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
|
class SC_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
|
||||||
public:
|
public:
|
||||||
SDAI_String _modelid;
|
SDAI_String _modelid;
|
||||||
|
|
@ -150,8 +142,6 @@ class SC_DAI_EXPORT SDAI_PID_SDAI : public SDAI_PID {
|
||||||
typedef SDAI_PID_SDAI * SDAI_PID_SDAI_ptr;
|
typedef SDAI_PID_SDAI * SDAI_PID_SDAI_ptr;
|
||||||
typedef SDAI_PID_SDAI_ptr SDAI_PID_SDAI_var;
|
typedef SDAI_PID_SDAI_ptr SDAI_PID_SDAI_var;
|
||||||
|
|
||||||
// interface DAObject (ISO/DIS 10303-23:1996(E) 5.3.10.5)
|
|
||||||
// Also, CORBA POS Section 5.10.2, Direct Access Protocol.
|
|
||||||
//
|
//
|
||||||
// From POS: The DAObject interface provides operations that many data
|
// From POS: The DAObject interface provides operations that many data
|
||||||
// object clients need. A Datastore implementation may provide support
|
// object clients need. A Datastore implementation may provide support
|
||||||
|
|
@ -166,6 +156,7 @@ class SDAI_DAObject;
|
||||||
typedef SDAI_DAObject * SDAI_DAObject_ptr;
|
typedef SDAI_DAObject * SDAI_DAObject_ptr;
|
||||||
typedef SDAI_DAObject_ptr SDAI_DAObject_var;
|
typedef SDAI_DAObject_ptr SDAI_DAObject_var;
|
||||||
|
|
||||||
|
/// interface DAObject (ISO/DIS 10303-23:1996(E) 5.3.10.5)
|
||||||
class SC_DAI_EXPORT SDAI_DAObject : public SDAI_sdaiObject {
|
class SC_DAI_EXPORT SDAI_DAObject : public SDAI_sdaiObject {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -262,7 +253,7 @@ class SC_DAI_EXPORT SDAI_DAObject : public SDAI_sdaiObject {
|
||||||
void dado_free() { }
|
void dado_free() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/**
|
||||||
5.3.10.1 DAObject_SDAI
|
5.3.10.1 DAObject_SDAI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,6 +357,7 @@ int SDAI_Enum::put( const char * n ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// return 0 if unset otherwise return 1
|
/// return 0 if unset otherwise return 1
|
||||||
|
/// WARNING it appears that exists() will return true after a call to nullify(). is this intended?
|
||||||
int SDAI_Enum::exists() const {
|
int SDAI_Enum::exists() const {
|
||||||
return !( v > no_elements() );
|
return !( v > no_elements() );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
* and is not subject to copyright.
|
* and is not subject to copyright.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <sc_export.h>
|
#include <sc_export.h>
|
||||||
|
|
||||||
class SC_DAI_EXPORT SDAI_Enum {
|
class SC_DAI_EXPORT SDAI_Enum {
|
||||||
|
|
@ -27,7 +28,7 @@ class SC_DAI_EXPORT SDAI_Enum {
|
||||||
public:
|
public:
|
||||||
virtual ~SDAI_Enum() {};
|
virtual ~SDAI_Enum() {};
|
||||||
|
|
||||||
void PrintContents( ostream & out = cout ) const {
|
void PrintContents( ostream & out = std::cout ) const {
|
||||||
DebugDisplay( out );
|
DebugDisplay( out );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -51,7 +52,7 @@ class SC_DAI_EXPORT SDAI_Enum {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * asStr( std::string & s ) const;
|
const char * asStr( std::string & s ) const;
|
||||||
void STEPwrite( ostream & out = cout ) const;
|
void STEPwrite( ostream & out = std::cout ) const;
|
||||||
const char * STEPwrite( std::string & s ) const;
|
const char * STEPwrite( std::string & s ) const;
|
||||||
|
|
||||||
Severity StrToVal( const char * s, ErrorDescriptor * err, int optional = 1 );
|
Severity StrToVal( const char * s, ErrorDescriptor * err, int optional = 1 );
|
||||||
|
|
@ -60,8 +61,8 @@ class SC_DAI_EXPORT SDAI_Enum {
|
||||||
|
|
||||||
virtual int put( int val );
|
virtual int put( int val );
|
||||||
virtual int put( const char * n );
|
virtual int put( const char * n );
|
||||||
int is_null() const {
|
bool is_null() const {
|
||||||
return !( exists() );
|
return ( exists() == 0 );
|
||||||
}
|
}
|
||||||
void set_null() {
|
void set_null() {
|
||||||
nullify();
|
nullify();
|
||||||
|
|
@ -69,9 +70,11 @@ class SC_DAI_EXPORT SDAI_Enum {
|
||||||
SDAI_Enum & operator= ( const int );
|
SDAI_Enum & operator= ( const int );
|
||||||
SDAI_Enum & operator= ( const SDAI_Enum & );
|
SDAI_Enum & operator= ( const SDAI_Enum & );
|
||||||
|
|
||||||
|
/// WARNING it appears that exists() will return true after a call to nullify(). is this intended?
|
||||||
|
///FIXME need to rewrite this function, but strange implementation...
|
||||||
virtual int exists() const;
|
virtual int exists() const;
|
||||||
virtual void nullify();
|
virtual void nullify();
|
||||||
void DebugDisplay( ostream & out = cout ) const;
|
void DebugDisplay( ostream & out = std::cout ) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Severity ReadEnum( istream & in, ErrorDescriptor * err,
|
virtual Severity ReadEnum( istream & in, ErrorDescriptor * err,
|
||||||
|
|
|
||||||
|
|
@ -1307,7 +1307,7 @@ SDAI_Application_instance * STEPfile::ReadInstance( istream & in, ostream & out,
|
||||||
case SEVERITY_BUG:
|
case SEVERITY_BUG:
|
||||||
|
|
||||||
case SEVERITY_INCOMPLETE:
|
case SEVERITY_INCOMPLETE:
|
||||||
if( ( _fileType == VERSION_CURRENT ) ) {
|
if( _fileType == VERSION_CURRENT ) {
|
||||||
cerr << "ERROR in EXCHANGE FILE: incomplete instance #"
|
cerr << "ERROR in EXCHANGE FILE: incomplete instance #"
|
||||||
<< obj -> STEPfile_id << ".\n";
|
<< obj -> STEPfile_id << ".\n";
|
||||||
if( _fileType != WORKING_SESSION ) {
|
if( _fileType != WORKING_SESSION ) {
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@ set( clLazyFile_SRCS
|
||||||
p21HeaderSectionReader.cc
|
p21HeaderSectionReader.cc
|
||||||
sectionReader.cc
|
sectionReader.cc
|
||||||
lazyP21DataSectionReader.cc
|
lazyP21DataSectionReader.cc
|
||||||
../base/judy/src/judy.c
|
|
||||||
../base/judy/src/judyLArray.h
|
|
||||||
../base/judy/src/judySArray.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set( SC_CLLAZYFILE_HDRS
|
set( SC_CLLAZYFILE_HDRS
|
||||||
|
|
@ -33,11 +30,11 @@ include_directories(
|
||||||
${SC_SOURCE_DIR}/src/base/judy/src
|
${SC_SOURCE_DIR}/src/base/judy/src
|
||||||
)
|
)
|
||||||
|
|
||||||
SC_ADDLIB(steplazyfile "${clLazyFile_SRCS};${clLazyFile_HDRS}" "stepcore;stepdai;steputils;base")
|
SC_ADDLIB(steplazyfile "${clLazyFile_SRCS};${clLazyFile_HDRS}" "stepcore;stepdai;steputils;base;stepeditor")
|
||||||
SC_ADDEXEC(lazy_test "lazy_test.cc" "steplazyfile;stepeditor" )
|
SC_ADDEXEC(lazy_test "lazy_test.cc" "steplazyfile;stepeditor" NO_INSTALL)
|
||||||
set_target_properties(lazy_test PROPERTIES COMPILE_FLAGS "-DNO_REGISTRY" )
|
set_property(TARGET lazy_test APPEND PROPERTY COMPILE_DEFINITIONS "NO_REGISTRY")
|
||||||
if(TARGET lazy_test-static)
|
if(TARGET lazy_test-static)
|
||||||
set_target_properties(lazy_test-static PROPERTIES COMPILE_FLAGS "-DNO_REGISTRY" )
|
set_property(TARGET lazy_test-static APPEND PROPERTY COMPILE_DEFINITIONS "NO_REGISTRY")
|
||||||
endif(TARGET lazy_test-static)
|
endif(TARGET lazy_test-static)
|
||||||
|
|
||||||
install(FILES ${SC_CLLAZYFILE_HDRS}
|
install(FILES ${SC_CLLAZYFILE_HDRS}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#ifndef INSTMGRHELPER_H
|
#ifndef INSTMGRHELPER_H
|
||||||
#define INSTMGRHELPER_H
|
#define INSTMGRHELPER_H
|
||||||
|
|
||||||
|
#include <sc_export.h>
|
||||||
|
|
||||||
|
#include <mgrnode.h>
|
||||||
#include <lazyInstMgr.h>
|
#include <lazyInstMgr.h>
|
||||||
#include <instmgr.h>
|
#include <instmgr.h>
|
||||||
|
|
||||||
|
|
@ -14,7 +17,7 @@
|
||||||
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr. It is returned
|
* This class is used when creating SDAI_Application_instance's and using a lazyInstMgr. It is returned
|
||||||
* by instMgrAdapter. SDAI_Application_instance only uses the GetSTEPentity function.
|
* by instMgrAdapter. SDAI_Application_instance only uses the GetSTEPentity function.
|
||||||
*/
|
*/
|
||||||
class mgrNodeHelper: public MgrNodeBase {
|
class SC_LAZYFILE_EXPORT mgrNodeHelper: public MgrNodeBase {
|
||||||
protected:
|
protected:
|
||||||
lazyInstMgr * _lim;
|
lazyInstMgr * _lim;
|
||||||
instanceID _id;
|
instanceID _id;
|
||||||
|
|
@ -40,7 +43,7 @@ class mgrNodeHelper: public MgrNodeBase {
|
||||||
* when an instance is looked up, this uses lazyInstMgr to load it, and then returns a pointer to it.
|
* when an instance is looked up, this uses lazyInstMgr to load it, and then returns a pointer to it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class instMgrAdapter: public InstMgrBase {
|
class SC_LAZYFILE_EXPORT instMgrAdapter: public InstMgrBase {
|
||||||
protected:
|
protected:
|
||||||
mgrNodeHelper _mn;
|
mgrNodeHelper _mn;
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
* \sa lazyP21DataSectionReader
|
* \sa lazyP21DataSectionReader
|
||||||
* \sa lazyP28DataSectionReader
|
* \sa lazyP28DataSectionReader
|
||||||
*/
|
*/
|
||||||
class lazyDataSectionReader: public sectionReader {
|
class SC_LAZYFILE_EXPORT lazyDataSectionReader: public sectionReader {
|
||||||
protected:
|
protected:
|
||||||
bool _error, _completelyLoaded;
|
bool _error, _completelyLoaded;
|
||||||
std::string _sectionIdentifier;
|
std::string _sectionIdentifier;
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ instancesLoaded_t * lazyFileReader::getHeaderInstances() {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazyFileReader::lazyFileReader( std::string fname, lazyInstMgr * i, fileID fid ): _fileName( fname ), _parent( i ), _fileID( fid ) {
|
lazyFileReader::lazyFileReader( std::string fname, lazyInstMgr * i, fileID fid ): _fileName( fname ), _parent( i ), _fileID( fid ) {
|
||||||
_file.open( _fileName.c_str() );
|
_file.open( _fileName.c_str(), std::ios::binary );
|
||||||
_file.imbue( std::locale::classic() );
|
_file.imbue( std::locale::classic() );
|
||||||
_file.unsetf( std::ios_base::skipws );
|
_file.unsetf( std::ios_base::skipws );
|
||||||
assert( _file.is_open() && _file.good() );
|
assert( _file.is_open() && _file.good() );
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
#include "instMgrHelper.h"
|
#include "instMgrHelper.h"
|
||||||
#include "lazyRefs.h"
|
#include "lazyRefs.h"
|
||||||
|
|
||||||
|
#include "sdaiApplication_instance.h"
|
||||||
|
|
||||||
lazyInstMgr::lazyInstMgr() {
|
lazyInstMgr::lazyInstMgr() {
|
||||||
_headerRegistry = new Registry( HeaderSchemaInit );
|
_headerRegistry = new Registry( HeaderSchemaInit );
|
||||||
_instanceTypes = new instanceTypes_t( 255 ); //NOTE arbitrary max of 255 chars for a type name
|
_instanceTypes = new instanceTypes_t( 255 ); //NOTE arbitrary max of 255 chars for a type name
|
||||||
|
|
@ -137,7 +139,7 @@ SDAI_Application_instance * lazyInstMgr::loadInstance( instanceID id, bool reSee
|
||||||
std::cerr << "Instance #" << id << " exists in multiple sections. This is not yet supported." << std::endl;
|
std::cerr << "Instance #" << id << " exists in multiple sections. This is not yet supported." << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( ( inst ) && ( inst != & NilSTEPentity ) ) {
|
if( !isNilSTEPentity( inst ) ) {
|
||||||
_instancesLoaded.insert( id, inst );
|
_instancesLoaded.insert( id, inst );
|
||||||
_loadedInstanceCount++;
|
_loadedInstanceCount++;
|
||||||
lazyRefs lr( this, inst );
|
lazyRefs lr( this, inst );
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include "Registry.h"
|
#include "Registry.h"
|
||||||
#include "sc_memmgr.h"
|
#include "sc_memmgr.h"
|
||||||
|
#include "sc_export.h"
|
||||||
|
|
||||||
#include "judyLArray.h"
|
#include "judyLArray.h"
|
||||||
#include "judySArray.h"
|
#include "judySArray.h"
|
||||||
|
|
@ -20,7 +21,7 @@
|
||||||
class Registry;
|
class Registry;
|
||||||
class instMgrAdapter;
|
class instMgrAdapter;
|
||||||
|
|
||||||
class lazyInstMgr {
|
class SC_LAZYFILE_EXPORT lazyInstMgr {
|
||||||
protected:
|
protected:
|
||||||
/** multimap from instance number to instances that it refers to
|
/** multimap from instance number to instances that it refers to
|
||||||
* \sa instanceRefs_pair
|
* \sa instanceRefs_pair
|
||||||
|
|
@ -72,8 +73,8 @@ class lazyInstMgr {
|
||||||
void openFile( std::string fname );
|
void openFile( std::string fname );
|
||||||
|
|
||||||
void addLazyInstance( namedLazyInstance inst );
|
void addLazyInstance( namedLazyInstance inst );
|
||||||
instMgrAdapter * getAdapter() {
|
InstMgrBase * getAdapter() {
|
||||||
return _ima;
|
return ( InstMgrBase * ) _ima;
|
||||||
}
|
}
|
||||||
|
|
||||||
instanceRefs_t * getFwdRefs() {
|
instanceRefs_t * getFwdRefs() {
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,19 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "sc_export.h"
|
||||||
#include "lazyTypes.h"
|
#include "lazyTypes.h"
|
||||||
#include "lazyInstMgr.h"
|
#include "lazyInstMgr.h"
|
||||||
#include "ExpDict.h"
|
#include "ExpDict.h"
|
||||||
#include "sdaiApplication_instance.h"
|
|
||||||
#include "SubSuperIterators.h"
|
#include "SubSuperIterators.h"
|
||||||
#include <STEPattribute.h>
|
#include <STEPattribute.h>
|
||||||
#include <STEPaggregate.h>
|
#include <STEPaggregate.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define strcasecmp _strcmpi
|
||||||
|
#endif // _WIN32
|
||||||
|
|
||||||
|
class SDAI_Application_instance;
|
||||||
/*
|
/*
|
||||||
* given inverted attr ia:
|
* given inverted attr ia:
|
||||||
* attr method value
|
* attr method value
|
||||||
|
|
@ -48,7 +53,7 @@
|
||||||
//TODO what about complex instances? scanning each on disk could be a bitch; should the compositional types be scanned during lazy loading?
|
//TODO what about complex instances? scanning each on disk could be a bitch; should the compositional types be scanned during lazy loading?
|
||||||
|
|
||||||
//TODO/FIXME in generated code, store ia data in map and eliminate data members that are currently used. modify accessors to use map.
|
//TODO/FIXME in generated code, store ia data in map and eliminate data members that are currently used. modify accessors to use map.
|
||||||
class lazyRefs {
|
class SC_LAZYFILE_EXPORT lazyRefs {
|
||||||
public:
|
public:
|
||||||
typedef std::set< instanceID > referentInstances_t;
|
typedef std::set< instanceID > referentInstances_t;
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -103,7 +108,7 @@ class lazyRefs {
|
||||||
if( !ai ) {
|
if( !ai ) {
|
||||||
ias.i = rinst;
|
ias.i = rinst;
|
||||||
_inst->setInvAttr( ia, ias );
|
_inst->setInvAttr( ia, ias );
|
||||||
} else if( ai->GetFileId() != inst ) {
|
} else if( ai->GetFileId() != (int)inst ) {
|
||||||
std::cerr << "ERROR: two instances (" << rinst << ", #" << rinst->GetFileId() << "=" << rinst->getEDesc()->Name();
|
std::cerr << "ERROR: two instances (" << rinst << ", #" << rinst->GetFileId() << "=" << rinst->getEDesc()->Name();
|
||||||
std::cerr << " and " << ai << ", #" << ai->GetFileId() <<"=" << ai->getEDesc()->Name() << ") refer to inst ";
|
std::cerr << " and " << ai << ", #" << ai->GetFileId() <<"=" << ai->getEDesc()->Name() << ") refer to inst ";
|
||||||
std::cerr << _inst->GetFileId() << ", but its inverse attribute is not an aggregation type!" << std::endl;
|
std::cerr << _inst->GetFileId() << ", but its inverse attribute is not an aggregation type!" << std::endl;
|
||||||
|
|
@ -126,7 +131,7 @@ class lazyRefs {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if( sa.getADesc()->IsAggrType() ) {
|
if( sa.getADesc()->IsAggrType() ) {
|
||||||
//aggregate - search for current inst id
|
//aggregate - search for current inst id
|
||||||
EntityAggregate * aggr = dynamic_cast< EntityAggregate * >( sa.Aggregate());
|
EntityAggregate * aggr = dynamic_cast< EntityAggregate * >( sa.Aggregate() );
|
||||||
assert( aggr );
|
assert( aggr );
|
||||||
EntityNode * en = ( EntityNode * ) aggr->GetHead();
|
EntityNode * en = ( EntityNode * ) aggr->GetHead();
|
||||||
while( en ) {
|
while( en ) {
|
||||||
|
|
@ -174,7 +179,7 @@ class lazyRefs {
|
||||||
}
|
}
|
||||||
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->getEDesc()->Name() << std::endl;
|
||||||
abort();
|
abort();
|
||||||
iAstruct nil;
|
iAstruct nil = {nullptr};
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
#include "lazyFileReader.h"
|
#include "lazyFileReader.h"
|
||||||
#include "lazyInstMgr.h"
|
#include "lazyInstMgr.h"
|
||||||
#include "lazyTypes.h"
|
#include "lazyTypes.h"
|
||||||
#include "instMgrHelper.h"
|
|
||||||
|
|
||||||
#include "current_function.hpp"
|
#include "current_function.hpp"
|
||||||
|
|
||||||
|
|
@ -48,7 +47,7 @@ std::streampos sectionReader::findNormalString( const std::string & str, bool se
|
||||||
}
|
}
|
||||||
if( c == '\'' ) {
|
if( c == '\'' ) {
|
||||||
//push past string
|
//push past string
|
||||||
_file.unget();
|
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||||
GetLiteralStr( _file, _lazyFile->getInstMgr()->getErrorDesc() );
|
GetLiteralStr( _file, _lazyFile->getInstMgr()->getErrorDesc() );
|
||||||
}
|
}
|
||||||
if( ( c == '/' ) && ( _file.peek() == '*' ) ) {
|
if( ( c == '/' ) && ( _file.peek() == '*' ) ) {
|
||||||
|
|
@ -130,7 +129,7 @@ std::streampos sectionReader::seekInstanceEnd( instanceRefs ** refs ) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '\'':
|
case '\'':
|
||||||
_file.unget();
|
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||||
GetLiteralStr( _file, _lazyFile->getInstMgr()->getErrorDesc() );
|
GetLiteralStr( _file, _lazyFile->getInstMgr()->getErrorDesc() );
|
||||||
break;
|
break;
|
||||||
case '=':
|
case '=':
|
||||||
|
|
@ -156,7 +155,7 @@ std::streampos sectionReader::seekInstanceEnd( instanceRefs ** refs ) {
|
||||||
if( _file.get() == ';' ) {
|
if( _file.get() == ';' ) {
|
||||||
return _file.tellg();
|
return _file.tellg();
|
||||||
} else {
|
} else {
|
||||||
_file.unget();
|
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
@ -187,7 +186,7 @@ instanceID sectionReader::readInstanceNumber() {
|
||||||
if( ( c == '/' ) && ( _file.peek() == '*' ) ) {
|
if( ( c == '/' ) && ( _file.peek() == '*' ) ) {
|
||||||
findNormalString( "*/" );
|
findNormalString( "*/" );
|
||||||
} else {
|
} else {
|
||||||
_file.unget();
|
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||||
}
|
}
|
||||||
skipWS();
|
skipWS();
|
||||||
c = _file.get();
|
c = _file.get();
|
||||||
|
|
@ -200,7 +199,7 @@ instanceID sectionReader::readInstanceNumber() {
|
||||||
assert( std::numeric_limits<instanceID>::max() <= std::numeric_limits<unsigned long long int>::max() );
|
assert( std::numeric_limits<instanceID>::max() <= std::numeric_limits<unsigned long long int>::max() );
|
||||||
|
|
||||||
size_t instanceIDLength = std::numeric_limits<instanceID>::digits10 + 1;
|
size_t instanceIDLength = std::numeric_limits<instanceID>::digits10 + 1;
|
||||||
char * buffer = new char( instanceIDLength + 1 ); // +1 for the terminating character
|
char * buffer = new char[ instanceIDLength + 1 ]; // +1 for the terminating character
|
||||||
|
|
||||||
std::stringstream errorMsg;
|
std::stringstream errorMsg;
|
||||||
|
|
||||||
|
|
@ -211,7 +210,7 @@ instanceID sectionReader::readInstanceNumber() {
|
||||||
digits++;
|
digits++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_file.unget();
|
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,7 +221,7 @@ instanceID sectionReader::readInstanceNumber() {
|
||||||
_error->UserMsg( "A very large instance ID encountered" );
|
_error->UserMsg( "A very large instance ID encountered" );
|
||||||
_error->DetailMsg( errorMsg.str() );
|
_error->DetailMsg( errorMsg.str() );
|
||||||
|
|
||||||
delete buffer;
|
delete [] buffer;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -243,7 +242,7 @@ instanceID sectionReader::readInstanceNumber() {
|
||||||
|
|
||||||
assert( id > 0 );
|
assert( id > 0 );
|
||||||
}
|
}
|
||||||
delete buffer;
|
delete [] buffer;
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,15 +302,14 @@ SDAI_Application_instance * sectionReader::getRealInstance( const Registry * reg
|
||||||
inst = reg->ObjCreate( tName, sName );
|
inst = reg->ObjCreate( tName, sName );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if( !isNilSTEPentity( inst ) ) {
|
||||||
if( inst != & NilSTEPentity ) {
|
|
||||||
if( !comment.empty() ) {
|
if( !comment.empty() ) {
|
||||||
inst->AddP21Comment( comment );
|
inst->AddP21Comment( comment );
|
||||||
}
|
}
|
||||||
assert( inst->getEDesc() );
|
assert( inst->getEDesc() );
|
||||||
_file.seekg( begin );
|
_file.seekg( begin );
|
||||||
findNormalString( "(" );
|
findNormalString( "(" );
|
||||||
_file.unget();
|
_file.seekg( _file.tellg() - std::streampos(1) );
|
||||||
sev = inst->STEPread( instance, 0, _lazyFile->getInstMgr()->getAdapter(), _file, sName, true, false );
|
sev = inst->STEPread( instance, 0, _lazyFile->getInstMgr()->getAdapter(), _file, sName, true, false );
|
||||||
//TODO do something with 'sev'
|
//TODO do something with 'sev'
|
||||||
inst->InitIAttrs();
|
inst->InitIAttrs();
|
||||||
|
|
@ -319,7 +317,7 @@ SDAI_Application_instance * sectionReader::getRealInstance( const Registry * reg
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
STEPcomplex * sectionReader::CreateSubSuperInstance( const Registry * reg, instanceID fileid, Severity & sev ) {
|
STEPcomplex * sectionReader::CreateSubSuperInstance( const Registry * reg, instanceID fileid, Severity & ) {
|
||||||
std::string buf;
|
std::string buf;
|
||||||
ErrorDescriptor err;
|
ErrorDescriptor err;
|
||||||
std::vector<std::string *> typeNames;
|
std::vector<std::string *> typeNames;
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,15 @@
|
||||||
#include <Registry.h>
|
#include <Registry.h>
|
||||||
#include "sc_memmgr.h"
|
#include "sc_memmgr.h"
|
||||||
|
|
||||||
const TypeDescriptor * t_sdaiINTEGER = NULL;
|
/* these may be shared between multiple Registry instances, so don't create/destroy in Registry ctor/dtor
|
||||||
const TypeDescriptor * t_sdaiREAL = NULL;
|
* Name, FundamentalType, Originating Schema, Description */
|
||||||
const TypeDescriptor * t_sdaiNUMBER = NULL;
|
const TypeDescriptor * const t_sdaiINTEGER = new TypeDescriptor( "INTEGER", sdaiINTEGER, 0, "INTEGER" );
|
||||||
const TypeDescriptor * t_sdaiSTRING = NULL;
|
const TypeDescriptor * const t_sdaiREAL = new TypeDescriptor( "REAL", sdaiREAL, 0, "Real" );
|
||||||
const TypeDescriptor * t_sdaiBINARY = NULL;
|
const TypeDescriptor * const t_sdaiNUMBER = new TypeDescriptor( "NUMBER", sdaiNUMBER, 0, "Number" );
|
||||||
const TypeDescriptor * t_sdaiBOOLEAN = NULL;
|
const TypeDescriptor * const t_sdaiSTRING = new TypeDescriptor( "STRING", sdaiSTRING, 0, "String" );
|
||||||
const TypeDescriptor * t_sdaiLOGICAL = NULL;
|
const TypeDescriptor * const t_sdaiBINARY = new TypeDescriptor( "BINARY", sdaiBINARY, 0, "Binary" );
|
||||||
|
const TypeDescriptor * const t_sdaiBOOLEAN = new TypeDescriptor( "BOOLEAN", sdaiBOOLEAN, 0, "Boolean" );
|
||||||
|
const TypeDescriptor * const t_sdaiLOGICAL = new TypeDescriptor( "LOGICAL", sdaiLOGICAL, 0, "Logical" );
|
||||||
|
|
||||||
static int uniqueNames( const char *, const SchRename * );
|
static int uniqueNames( const char *, const SchRename * );
|
||||||
|
|
||||||
|
|
@ -30,43 +32,6 @@ Registry::Registry( CF_init initFunct )
|
||||||
active_schemas = SC_HASHcreate( 10 );
|
active_schemas = SC_HASHcreate( 10 );
|
||||||
active_types = SC_HASHcreate( 100 );
|
active_types = SC_HASHcreate( 100 );
|
||||||
|
|
||||||
if( !t_sdaiINTEGER ) {
|
|
||||||
t_sdaiINTEGER = new TypeDescriptor( "INTEGER", // Name
|
|
||||||
sdaiINTEGER, // FundamentalType
|
|
||||||
0, // Originating Schema
|
|
||||||
"INTEGER" ); // Description;
|
|
||||||
}
|
|
||||||
if( !t_sdaiREAL ) {
|
|
||||||
t_sdaiREAL = new TypeDescriptor( "REAL", sdaiREAL,
|
|
||||||
0, // Originating Schema
|
|
||||||
"Real" );
|
|
||||||
}
|
|
||||||
if( !t_sdaiSTRING ) {
|
|
||||||
t_sdaiSTRING = new TypeDescriptor( "STRING", sdaiSTRING,
|
|
||||||
0, // Originating Schema
|
|
||||||
"String" );
|
|
||||||
}
|
|
||||||
if( !t_sdaiBINARY ) {
|
|
||||||
t_sdaiBINARY = new TypeDescriptor( "BINARY", sdaiBINARY,
|
|
||||||
0, // Originating Schema
|
|
||||||
"Binary" );
|
|
||||||
}
|
|
||||||
if( !t_sdaiBOOLEAN ) {
|
|
||||||
t_sdaiBOOLEAN = new TypeDescriptor( "BOOLEAN", sdaiBOOLEAN,
|
|
||||||
0, // Originating Schema
|
|
||||||
"Boolean" );
|
|
||||||
}
|
|
||||||
if( !t_sdaiLOGICAL ) {
|
|
||||||
t_sdaiLOGICAL = new TypeDescriptor( "LOGICAL", sdaiLOGICAL,
|
|
||||||
0, // Originating Schema
|
|
||||||
"Logical" );
|
|
||||||
}
|
|
||||||
if( !t_sdaiNUMBER ) {
|
|
||||||
t_sdaiNUMBER = new TypeDescriptor( "NUMBER", sdaiNUMBER,
|
|
||||||
0, // Originating Schema
|
|
||||||
"Number" );
|
|
||||||
}
|
|
||||||
|
|
||||||
initFunct( *this );
|
initFunct( *this );
|
||||||
SC_HASHlistinit( active_types, &cur_type );
|
SC_HASHlistinit( active_types, &cur_type );
|
||||||
SC_HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur's
|
SC_HASHlistinit( primordialSwamp, &cur_entity ); // initialize cur's
|
||||||
|
|
@ -80,35 +45,6 @@ Registry::~Registry() {
|
||||||
SC_HASHdestroy( active_schemas );
|
SC_HASHdestroy( active_schemas );
|
||||||
SC_HASHdestroy( active_types );
|
SC_HASHdestroy( active_types );
|
||||||
delete col;
|
delete col;
|
||||||
|
|
||||||
if( t_sdaiINTEGER ) {
|
|
||||||
delete t_sdaiINTEGER;
|
|
||||||
t_sdaiINTEGER = NULL;
|
|
||||||
}
|
|
||||||
if( t_sdaiREAL ) {
|
|
||||||
delete t_sdaiREAL;
|
|
||||||
t_sdaiREAL = NULL;
|
|
||||||
}
|
|
||||||
if( t_sdaiSTRING ) {
|
|
||||||
delete t_sdaiSTRING;
|
|
||||||
t_sdaiSTRING = NULL;
|
|
||||||
}
|
|
||||||
if( t_sdaiBINARY ) {
|
|
||||||
delete t_sdaiBINARY;
|
|
||||||
t_sdaiBINARY = NULL;
|
|
||||||
}
|
|
||||||
if( t_sdaiBOOLEAN ) {
|
|
||||||
delete t_sdaiBOOLEAN;
|
|
||||||
t_sdaiBOOLEAN = NULL;
|
|
||||||
}
|
|
||||||
if( t_sdaiLOGICAL ) {
|
|
||||||
delete t_sdaiLOGICAL;
|
|
||||||
t_sdaiLOGICAL = NULL;
|
|
||||||
}
|
|
||||||
if( t_sdaiNUMBER ) {
|
|
||||||
delete t_sdaiNUMBER;
|
|
||||||
t_sdaiNUMBER = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Registry::DeleteContents() {
|
void Registry::DeleteContents() {
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@
|
||||||
|
|
||||||
|
|
||||||
// defined and created in Registry.cc
|
// defined and created in Registry.cc
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiINTEGER;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiINTEGER;
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiREAL;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiREAL;
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiNUMBER;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiNUMBER;
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiSTRING;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiSTRING;
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiBINARY;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiBINARY;
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiBOOLEAN;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiBOOLEAN;
|
||||||
extern SC_CORE_EXPORT const TypeDescriptor * t_sdaiLOGICAL;
|
extern SC_CORE_EXPORT const TypeDescriptor * const t_sdaiLOGICAL;
|
||||||
|
|
||||||
typedef struct Hash_Table * HashTable;
|
typedef struct Hash_Table * HashTable;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,9 +83,10 @@ Severity EntityAggregate::ReadValue( istream & in, ErrorDescriptor * err,
|
||||||
item->StrToVal( in, &errdesc, elem_type, insts, addFileId );
|
item->StrToVal( in, &errdesc, elem_type, insts, addFileId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elem_type->AttrTypeName( buf );
|
||||||
// read up to the next delimiter and set errors if garbage is
|
// read up to the next delimiter and set errors if garbage is
|
||||||
// found before specified delims (i.e. comma and quote)
|
// found before specified delims (i.e. comma and quote)
|
||||||
CheckRemainingInput( in, &errdesc, elem_type->AttrTypeName( buf ), ",)" );
|
CheckRemainingInput( in, &errdesc, buf, ",)" );
|
||||||
|
|
||||||
if( errdesc.severity() < SEVERITY_INCOMPLETE ) {
|
if( errdesc.severity() < SEVERITY_INCOMPLETE ) {
|
||||||
sprintf( errmsg, " index: %d\n", value_cnt );
|
sprintf( errmsg, " index: %d\n", value_cnt );
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,10 @@ Severity SelectAggregate::ReadValue( istream & in, ErrorDescriptor * err,
|
||||||
item->StrToVal( in, &errdesc, elem_type, insts, addFileId, currSch );
|
item->StrToVal( in, &errdesc, elem_type, insts, addFileId, currSch );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elem_type->AttrTypeName( buf );
|
||||||
// read up to the next delimiter and set errors if garbage is
|
// read up to the next delimiter and set errors if garbage is
|
||||||
// found before specified delims (i.e. comma and quote)
|
// found before specified delims (i.e. comma and quote)
|
||||||
CheckRemainingInput( in, &errdesc, elem_type->AttrTypeName( buf ), ",)" );
|
CheckRemainingInput( in, &errdesc, buf, ",)" );
|
||||||
|
|
||||||
if( errdesc.severity() < SEVERITY_INCOMPLETE ) {
|
if( errdesc.severity() < SEVERITY_INCOMPLETE ) {
|
||||||
sprintf( errmsg, " index: %d\n", value_cnt );
|
sprintf( errmsg, " index: %d\n", value_cnt );
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@
|
||||||
#include <ExpDict.h>
|
#include <ExpDict.h>
|
||||||
#include "sc_memmgr.h"
|
#include "sc_memmgr.h"
|
||||||
|
|
||||||
const int Real_Num_Precision = REAL_NUM_PRECISION; // from STEPattribute.h
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file STEPaggregate.cc Functions for manipulating aggregate attributes
|
* \file STEPaggregate.cc Functions for manipulating aggregate attributes
|
||||||
|
|
@ -37,7 +35,7 @@ STEPaggregate NilSTEPaggregate;
|
||||||
|
|
||||||
|
|
||||||
STEPaggregate::STEPaggregate() {
|
STEPaggregate::STEPaggregate() {
|
||||||
_null = 1;
|
_null = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
STEPaggregate::~STEPaggregate() {
|
STEPaggregate::~STEPaggregate() {
|
||||||
|
|
@ -72,7 +70,8 @@ Severity STEPaggregate::AggrValidLevel( const char * value, ErrorDescriptor * er
|
||||||
istringstream in( ( char * )value ); // sz defaults to length of s
|
istringstream in( ( char * )value ); // sz defaults to length of s
|
||||||
|
|
||||||
ReadValue( in, err, elem_type, insts, addFileId, 0, 0 );
|
ReadValue( in, err, elem_type, insts, addFileId, 0, 0 );
|
||||||
CheckRemainingInput( in, err, elem_type->AttrTypeName( buf ), tokenList );
|
elem_type->AttrTypeName( buf );
|
||||||
|
CheckRemainingInput( in, err, buf, tokenList );
|
||||||
if( optional && ( err->severity() == SEVERITY_INCOMPLETE ) ) {
|
if( optional && ( err->severity() == SEVERITY_INCOMPLETE ) ) {
|
||||||
err->severity( SEVERITY_NULL );
|
err->severity( SEVERITY_NULL );
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +89,8 @@ Severity STEPaggregate::AggrValidLevel( istream & in, ErrorDescriptor * err,
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadValue( in, err, elem_type, insts, addFileId, 0, 1 );
|
ReadValue( in, err, elem_type, insts, addFileId, 0, 1 );
|
||||||
CheckRemainingInput( in, err, elem_type->AttrTypeName( buf ), tokenList );
|
elem_type->AttrTypeName( buf );
|
||||||
|
CheckRemainingInput( in, err, buf, tokenList );
|
||||||
if( optional && ( err->severity() == SEVERITY_INCOMPLETE ) ) {
|
if( optional && ( err->severity() == SEVERITY_INCOMPLETE ) ) {
|
||||||
err->severity( SEVERITY_NULL );
|
err->severity( SEVERITY_NULL );
|
||||||
}
|
}
|
||||||
|
|
@ -121,7 +121,7 @@ Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
|
||||||
c = in.peek(); // does not advance input
|
c = in.peek(); // does not advance input
|
||||||
|
|
||||||
if( in.eof() || c == '$' ) {
|
if( in.eof() || c == '$' ) {
|
||||||
_null = 1;
|
_null = true;
|
||||||
err->GreaterSeverity( SEVERITY_INCOMPLETE );
|
err->GreaterSeverity( SEVERITY_INCOMPLETE );
|
||||||
return SEVERITY_INCOMPLETE;
|
return SEVERITY_INCOMPLETE;
|
||||||
}
|
}
|
||||||
|
|
@ -171,7 +171,8 @@ Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
|
||||||
|
|
||||||
// read up to the next delimiter and set errors if garbage is
|
// read up to the next delimiter and set errors if garbage is
|
||||||
// found before specified delims (i.e. comma and quote)
|
// found before specified delims (i.e. comma and quote)
|
||||||
CheckRemainingInput( in, &errdesc, elem_type->AttrTypeName( buf ), ",)" );
|
elem_type->AttrTypeName( buf );
|
||||||
|
CheckRemainingInput( in, &errdesc, buf, ",)" );
|
||||||
|
|
||||||
if( errdesc.severity() < SEVERITY_INCOMPLETE ) {
|
if( errdesc.severity() < SEVERITY_INCOMPLETE ) {
|
||||||
sprintf( errmsg, " index: %d\n", value_cnt );
|
sprintf( errmsg, " index: %d\n", value_cnt );
|
||||||
|
|
@ -195,7 +196,7 @@ Severity STEPaggregate::ReadValue( istream & in, ErrorDescriptor * err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( c == ')' ) {
|
if( c == ')' ) {
|
||||||
_null = 0;
|
_null = false;
|
||||||
} else { // expectation for end paren delim has not been met
|
} else { // expectation for end paren delim has not been met
|
||||||
err->GreaterSeverity( SEVERITY_INPUT_ERROR );
|
err->GreaterSeverity( SEVERITY_INPUT_ERROR );
|
||||||
err->AppendToUserMsg( "Missing close paren for aggregate value" );
|
err->AppendToUserMsg( "Missing close paren for aggregate value" );
|
||||||
|
|
@ -264,12 +265,12 @@ SingleLinkNode * STEPaggregate::NewNode() {
|
||||||
|
|
||||||
void STEPaggregate::AddNode( SingleLinkNode * n ) {
|
void STEPaggregate::AddNode( SingleLinkNode * n ) {
|
||||||
SingleLinkList::AppendNode( n );
|
SingleLinkList::AppendNode( n );
|
||||||
_null = 0;
|
_null = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STEPaggregate::Empty() {
|
void STEPaggregate::Empty() {
|
||||||
SingleLinkList::Empty();
|
SingleLinkList::Empty();
|
||||||
_null = 1;
|
_null = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ typedef STEPaggregate_ptr STEPaggregate_var;
|
||||||
|
|
||||||
class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
|
class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
|
||||||
protected:
|
protected:
|
||||||
int _null;
|
bool _null;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
@ -47,7 +47,7 @@ class SC_CORE_EXPORT STEPaggregate : public SingleLinkList {
|
||||||
const char * currSch = 0 );
|
const char * currSch = 0 );
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int is_null() {
|
bool is_null() {
|
||||||
return _null;
|
return _null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <read_func.h>
|
#include <read_func.h>
|
||||||
|
|
@ -815,10 +814,8 @@ bool STEPattribute::is_null() const {
|
||||||
|
|
||||||
case REFERENCE_TYPE:
|
case REFERENCE_TYPE:
|
||||||
case GENERIC_TYPE:
|
case GENERIC_TYPE:
|
||||||
cerr << "Internal error: " << __FILE__ << ": " << __LINE__
|
//should be an error, but this is a const function - no way to report.
|
||||||
<< "\n" << _POC_ "\n";
|
return true;
|
||||||
return SEVERITY_BUG;
|
|
||||||
|
|
||||||
case UNKNOWN_TYPE:
|
case UNKNOWN_TYPE:
|
||||||
default:
|
default:
|
||||||
return ( ptr.u -> is_null() );
|
return ( ptr.u -> is_null() );
|
||||||
|
|
@ -1377,7 +1374,7 @@ const char * STEPattribute::TypeName() const {
|
||||||
if( _redefAttr ) {
|
if( _redefAttr ) {
|
||||||
return _redefAttr->TypeName();
|
return _redefAttr->TypeName();
|
||||||
}
|
}
|
||||||
return aDesc->TypeName();
|
return aDesc->TypeName().c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
BASE_TYPE STEPattribute::Type() const {
|
BASE_TYPE STEPattribute::Type() const {
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@
|
||||||
*/
|
*/
|
||||||
#define REAL_NUM_PRECISION 15
|
#define REAL_NUM_PRECISION 15
|
||||||
|
|
||||||
typedef double real;
|
|
||||||
|
|
||||||
class InstMgrBase;
|
class InstMgrBase;
|
||||||
class SDAI_Application_instance;
|
class SDAI_Application_instance;
|
||||||
class STEPaggregate;
|
class STEPaggregate;
|
||||||
|
|
@ -198,8 +196,8 @@ class SC_CORE_EXPORT STEPattribute {
|
||||||
|
|
||||||
////////////// Return info on attr
|
////////////// Return info on attr
|
||||||
|
|
||||||
bool Nullable() const; // may this attribute be null?
|
bool Nullable() const; ///< may this attribute be null?
|
||||||
bool is_null() const; // is this attribute null?
|
bool is_null() const; ///< is this attribute null?
|
||||||
bool IsDerived() const {
|
bool IsDerived() const {
|
||||||
return _derive;
|
return _derive;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h> // to get the BUFSIZ #define
|
#include <stdio.h> // to get the BUFSIZ #define
|
||||||
#include <STEPundefined.h>
|
|
||||||
#include <STEPattribute.h>
|
#include <STEPattribute.h>
|
||||||
|
#include <STEPundefined.h>
|
||||||
#include "sc_memmgr.h"
|
#include "sc_memmgr.h"
|
||||||
|
|
||||||
/** \class SCLundefined
|
/** \class SCLundefined
|
||||||
|
|
@ -149,7 +149,7 @@ int SCLundefined::set_null() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SCLundefined::is_null() {
|
bool SCLundefined::is_null() {
|
||||||
return ( val.empty() );
|
return ( val.empty() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class SC_CORE_EXPORT SCLundefined {
|
||||||
virtual void STEPwrite( ostream & out = cout );
|
virtual void STEPwrite( ostream & out = cout );
|
||||||
|
|
||||||
int set_null();
|
int set_null();
|
||||||
int is_null();
|
bool is_null();
|
||||||
SCLundefined & operator= ( const SCLundefined & );
|
SCLundefined & operator= ( const SCLundefined & );
|
||||||
SCLundefined & operator= ( const char * str );
|
SCLundefined & operator= ( const char * str );
|
||||||
SCLundefined();
|
SCLundefined();
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ class recursiveEntDescripIterator {
|
||||||
recursiveEntDescripIterator( const EntityDescriptor * t = 0 ): startEntity( t ), position( 0 ) {
|
recursiveEntDescripIterator( const EntityDescriptor * t = 0 ): startEntity( t ), position( 0 ) {
|
||||||
//NOTE due to pure virtual functions, derived class constructor *must* call reset(t)
|
//NOTE due to pure virtual functions, derived class constructor *must* call reset(t)
|
||||||
}
|
}
|
||||||
recursiveEntDescripIterator( ): startEntity( 0 ), position( 0 ) {
|
|
||||||
}
|
|
||||||
~recursiveEntDescripIterator( ) {
|
~recursiveEntDescripIterator( ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ const char * AttrDescriptor::AttrExprDefStr( std::string & s ) const {
|
||||||
s.append( "OPTIONAL " );
|
s.append( "OPTIONAL " );
|
||||||
}
|
}
|
||||||
if( DomainType() ) {
|
if( DomainType() ) {
|
||||||
s.append( DomainType()->AttrTypeName( buf ) );
|
DomainType()->AttrTypeName( buf );
|
||||||
|
s.append( buf );
|
||||||
}
|
}
|
||||||
return const_cast<char *>( s.c_str() );
|
return const_cast<char *>( s.c_str() );
|
||||||
}
|
}
|
||||||
|
|
@ -104,14 +105,13 @@ AttrDescriptor::Type() const {
|
||||||
* right side of attr def
|
* right side of attr def
|
||||||
* NOTE this returns a \'const char * \' instead of an std::string
|
* NOTE this returns a \'const char * \' instead of an std::string
|
||||||
*/
|
*/
|
||||||
const char * AttrDescriptor::TypeName() const {
|
const std::string AttrDescriptor::TypeName() const {
|
||||||
std::string buf;
|
std::string buf;
|
||||||
|
|
||||||
if( _domainType ) {
|
if( _domainType ) {
|
||||||
return _domainType->AttrTypeName( buf );
|
_domainType->AttrTypeName( buf );
|
||||||
} else {
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// an expanded right side of attr def
|
/// an expanded right side of attr def
|
||||||
|
|
|
||||||
|
|
@ -99,11 +99,13 @@ class SC_CORE_EXPORT AttrDescriptor {
|
||||||
PrimitiveType AggrElemType() const;
|
PrimitiveType AggrElemType() const;
|
||||||
const TypeDescriptor * AggrElemTypeDescriptor() const;
|
const TypeDescriptor * AggrElemTypeDescriptor() const;
|
||||||
|
|
||||||
// The type of the attributes TypeDescriptor
|
/// The type of the attributes TypeDescriptor
|
||||||
PrimitiveType Type() const;
|
PrimitiveType Type() const;
|
||||||
const char * TypeName() const; // right side of attr def
|
|
||||||
|
|
||||||
// an expanded right side of attr def
|
/// right side of attr def
|
||||||
|
const std::string TypeName() const;
|
||||||
|
|
||||||
|
/// an expanded right side of attr def
|
||||||
const char * ExpandedTypeName( std::string & s ) const;
|
const char * ExpandedTypeName( std::string & s ) const;
|
||||||
|
|
||||||
int RefersToType() const {
|
int RefersToType() const {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ const char * Derived_attribute::AttrExprDefStr( std::string & s ) const {
|
||||||
s.append( Name() );
|
s.append( Name() );
|
||||||
s.append( " : " );
|
s.append( " : " );
|
||||||
if( DomainType() ) {
|
if( DomainType() ) {
|
||||||
s.append( DomainType()->AttrTypeName( buf ) );
|
DomainType()->AttrTypeName( buf );
|
||||||
|
s.append( buf );
|
||||||
}
|
}
|
||||||
if( _initializer ) { // this is supposed to exist for a derived attribute.
|
if( _initializer ) { // this is supposed to exist for a derived attribute.
|
||||||
s.append( " \n\t\t:= " );
|
s.append( " \n\t\t:= " );
|
||||||
|
|
|
||||||
|
|
@ -308,11 +308,11 @@ InstMgr::EntityKeywordCount( const char * name ) {
|
||||||
MgrNode * node;
|
MgrNode * node;
|
||||||
SDAI_Application_instance * se;
|
SDAI_Application_instance * se;
|
||||||
int n = InstanceCount();
|
int n = InstanceCount();
|
||||||
|
const char *pretty_name = PrettyTmpName( name );
|
||||||
for( int j = 0; j < n; ++j ) {
|
for( int j = 0; j < n; ++j ) {
|
||||||
node = GetMgrNode( j );
|
node = GetMgrNode( j );
|
||||||
se = node->GetApplication_instance();
|
se = node->GetApplication_instance();
|
||||||
if( !strcmp( se->EntityName(),
|
if( !strcmp( se->EntityName(), pretty_name ) ) {
|
||||||
PrettyTmpName( name ) ) ) {
|
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -357,13 +357,13 @@ SDAI_Application_instance *
|
||||||
InstMgr::GetApplication_instance( const char * entityKeyword, int starting_index ) {
|
InstMgr::GetApplication_instance( const char * entityKeyword, int starting_index ) {
|
||||||
MgrNode * node;
|
MgrNode * node;
|
||||||
SDAI_Application_instance * se;
|
SDAI_Application_instance * se;
|
||||||
|
const char *pretty_name = PrettyTmpName( entityKeyword );
|
||||||
|
|
||||||
int count = InstanceCount();
|
int count = InstanceCount();
|
||||||
for( int j = starting_index; j < count; ++j ) {
|
for( int j = starting_index; j < count; ++j ) {
|
||||||
node = GetMgrNode( j );
|
node = GetMgrNode( j );
|
||||||
se = node->GetApplication_instance();
|
se = node->GetApplication_instance();
|
||||||
if( !strcmp( se->EntityName(),
|
if( !strcmp( se->EntityName(), pretty_name ) ) {
|
||||||
PrettyTmpName( entityKeyword ) ) ) {
|
|
||||||
return se;
|
return se;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -374,13 +374,13 @@ SDAI_Application_instance *
|
||||||
InstMgr::GetSTEPentity( const char * entityKeyword, int starting_index ) {
|
InstMgr::GetSTEPentity( const char * entityKeyword, int starting_index ) {
|
||||||
MgrNode * node;
|
MgrNode * node;
|
||||||
SDAI_Application_instance * se;
|
SDAI_Application_instance * se;
|
||||||
|
const char *pretty_name = PrettyTmpName( entityKeyword );
|
||||||
|
|
||||||
int count = InstanceCount();
|
int count = InstanceCount();
|
||||||
for( int j = starting_index; j < count; ++j ) {
|
for( int j = starting_index; j < count; ++j ) {
|
||||||
node = GetMgrNode( j );
|
node = GetMgrNode( j );
|
||||||
se = node->GetApplication_instance();
|
se = node->GetApplication_instance();
|
||||||
if( !strcmp( se->EntityName(),
|
if( !strcmp( se->EntityName(), pretty_name ) ) {
|
||||||
PrettyTmpName( entityKeyword ) ) ) {
|
|
||||||
return se;
|
return se;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ const char * Inverse_attribute::AttrExprDefStr( std::string & s ) const {
|
||||||
s.append( "OPTIONAL " );
|
s.append( "OPTIONAL " );
|
||||||
}
|
}
|
||||||
if( DomainType() ) {
|
if( DomainType() ) {
|
||||||
s.append( DomainType()->AttrTypeName( buf ) );
|
DomainType()->AttrTypeName( buf );
|
||||||
|
s.append( buf );
|
||||||
}
|
}
|
||||||
s.append( " FOR " );
|
s.append( " FOR " );
|
||||||
s.append( _inverted_attr_id );
|
s.append( _inverted_attr_id );
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,21 @@
|
||||||
class GenericNode;
|
class GenericNode;
|
||||||
class DisplayNode;
|
class DisplayNode;
|
||||||
#include <sdai.h>
|
#include <sdai.h>
|
||||||
//class SDAI_Application_instance;
|
|
||||||
|
|
||||||
#include <gennode.h>
|
#include <gennode.h>
|
||||||
#include <gennodelist.h>
|
#include <gennodelist.h>
|
||||||
//#include <gennode.inline.h>
|
|
||||||
|
|
||||||
#include <editordefines.h>
|
#include <editordefines.h>
|
||||||
|
|
||||||
|
#include <sc_nullptr.h>
|
||||||
|
|
||||||
class InstMgr;
|
class InstMgr;
|
||||||
|
|
||||||
class SC_CORE_EXPORT MgrNodeBase : public GenericNode {
|
class SC_CORE_EXPORT MgrNodeBase : public GenericNode {
|
||||||
public:
|
public:
|
||||||
virtual inline SDAI_Application_instance * GetSTEPentity() {
|
virtual inline SDAI_Application_instance * GetSTEPentity() {
|
||||||
abort();
|
abort();
|
||||||
|
return nullptr;
|
||||||
};
|
};
|
||||||
virtual ~MgrNodeBase() {};
|
virtual ~MgrNodeBase() {};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -213,6 +213,8 @@ typedef SDAI_Model_contents_ptr SDAI_Model_contents_var;
|
||||||
|
|
||||||
// ENTITY
|
// ENTITY
|
||||||
extern SC_CORE_EXPORT SDAI_Application_instance NilSTEPentity;
|
extern SC_CORE_EXPORT SDAI_Application_instance NilSTEPentity;
|
||||||
|
//FIXME why 3 of these? remove 2?
|
||||||
|
//in libexpress, ENTITY_NULL is also used but refers to something different
|
||||||
#define ENTITY_NULL &NilSTEPentity
|
#define ENTITY_NULL &NilSTEPentity
|
||||||
#define NULL_ENTITY &NilSTEPentity
|
#define NULL_ENTITY &NilSTEPentity
|
||||||
#define S_ENTITY_NULL &NilSTEPentity
|
#define S_ENTITY_NULL &NilSTEPentity
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,17 @@
|
||||||
#include "sdaiApplication_instance.h"
|
#include "sdaiApplication_instance.h"
|
||||||
#include "superInvAttrIter.h"
|
#include "superInvAttrIter.h"
|
||||||
|
|
||||||
|
#include <sc_nullptr.h>
|
||||||
|
|
||||||
SDAI_Application_instance NilSTEPentity;
|
SDAI_Application_instance NilSTEPentity;
|
||||||
|
|
||||||
|
bool isNilSTEPentity( const SDAI_Application_instance * ai ) {
|
||||||
|
if( ai && ai == &NilSTEPentity ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************//**
|
/**************************************************************//**
|
||||||
** \file sdaiApplication_instance.cc Functions for manipulating entities
|
** \file sdaiApplication_instance.cc Functions for manipulating entities
|
||||||
**
|
**
|
||||||
|
|
@ -163,8 +172,11 @@ void SDAI_Application_instance::AppendMultInstance( SDAI_Application_instance *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BUG implement this -- FIXME function is never used
|
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 ) {
|
SDAI_Application_instance * SDAI_Application_instance::GetMiEntity( char * entName ) {
|
||||||
std::string s1, s2;
|
std::string s1, s2;
|
||||||
|
|
||||||
|
|
@ -944,7 +956,7 @@ const SDAI_Application_instance::iAMap_t::value_type SDAI_Application_instance::
|
||||||
}
|
}
|
||||||
iAstruct z;
|
iAstruct z;
|
||||||
memset( &z, 0, sizeof z );
|
memset( &z, 0, sizeof z );
|
||||||
iAMap_t::value_type nil( NULL, z );
|
iAMap_t::value_type nil( (Inverse_attribute *) nullptr, z );
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef STEPENTITY_H
|
#ifndef STEPENTITY_H
|
||||||
#define STEPENTITY_H 1
|
#define STEPENTITY_H
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NIST STEP Core Class Library
|
* NIST STEP Core Class Library
|
||||||
|
|
@ -12,15 +12,15 @@
|
||||||
* and is not subject to copyright.
|
* and is not subject to copyright.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sc_export.h>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
//class STEPinvAttrList;
|
#include <sc_export.h>
|
||||||
|
#include <sdaiDaObject.h>
|
||||||
|
|
||||||
class EntityAggregate;
|
class EntityAggregate;
|
||||||
class Inverse_attribute;
|
class Inverse_attribute;
|
||||||
typedef struct {
|
typedef struct {
|
||||||
// bool aggregate;
|
|
||||||
union {
|
union {
|
||||||
EntityAggregate * a;
|
EntityAggregate * a;
|
||||||
SDAI_Application_instance * i;
|
SDAI_Application_instance * i;
|
||||||
|
|
@ -43,7 +43,13 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
|
||||||
|
|
||||||
public: //TODO make these private?
|
public: //TODO make these private?
|
||||||
STEPattributeList attributes;
|
STEPattributeList attributes;
|
||||||
int STEPfile_id; //TODO are neg values ever used (signalling)? if not, make unsigned?
|
|
||||||
|
/* see mgrnode.cc where -1 is returned when there is no sdai
|
||||||
|
* instance. might be possible to treat 0 for this purpose
|
||||||
|
* instead of negative so the ID's can become unsigned.
|
||||||
|
*/
|
||||||
|
int STEPfile_id;
|
||||||
|
|
||||||
ErrorDescriptor _error;
|
ErrorDescriptor _error;
|
||||||
std::string p21Comment;
|
std::string p21Comment;
|
||||||
|
|
||||||
|
|
@ -72,9 +78,7 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
|
||||||
void setEDesc( const EntityDescriptor * const ed ) {
|
void setEDesc( const EntityDescriptor * const ed ) {
|
||||||
eDesc = ed;
|
eDesc = ed;
|
||||||
}
|
}
|
||||||
const EntityDescriptor * getEDesc() const {
|
const EntityDescriptor * getEDesc() const;
|
||||||
return eDesc;
|
|
||||||
}
|
|
||||||
void StepFileId( int fid ) {
|
void StepFileId( int fid ) {
|
||||||
STEPfile_id = fid;
|
STEPfile_id = fid;
|
||||||
}
|
}
|
||||||
|
|
@ -190,5 +194,6 @@ class SC_CORE_EXPORT SDAI_Application_instance : public SDAI_DAObject_SDAI {
|
||||||
// current style of CORBA handles for Part 23 - NOTE - used for more than CORBA
|
// current style of CORBA handles for Part 23 - NOTE - used for more than CORBA
|
||||||
typedef SDAI_Application_instance * SDAI_Application_instance_ptr;
|
typedef SDAI_Application_instance * SDAI_Application_instance_ptr;
|
||||||
typedef SDAI_Application_instance_ptr SDAI_Application_instance_var;
|
typedef SDAI_Application_instance_ptr SDAI_Application_instance_var;
|
||||||
|
SC_CORE_EXPORT bool isNilSTEPentity( const SDAI_Application_instance * ai );
|
||||||
|
|
||||||
#endif
|
#endif //STEPENTITY_H
|
||||||
|
|
|
||||||
|
|
@ -592,11 +592,11 @@ const char * SDAI_Select::STEPwrite( std::string & s, const char * currSch ) co
|
||||||
return const_cast<char *>( s.c_str() );
|
return const_cast<char *>( s.c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDAI_Select::set_null() {
|
bool SDAI_Select::set_null() {
|
||||||
nullify();
|
nullify();
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDAI_Select::is_null() {
|
bool SDAI_Select::is_null() {
|
||||||
return ( !exists() );
|
return ( !exists() );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,9 @@ class SC_CORE_EXPORT SDAI_Select {
|
||||||
//linux has a regression if the pure virtual operator= is commented out
|
//linux has a regression if the pure virtual operator= is commented out
|
||||||
virtual SDAI_Select & operator =( const SDAI_Select & other );
|
virtual SDAI_Select & operator =( const SDAI_Select & other );
|
||||||
|
|
||||||
int set_null();
|
//FIXME set_null always returns true. why not void?!
|
||||||
int is_null();
|
bool set_null();
|
||||||
|
bool is_null();
|
||||||
|
|
||||||
}; /** end class **/
|
}; /** end class **/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ endfunction(add_stepcore_test name libs)
|
||||||
add_stepcore_test("SupertypesIterator" "stepcore;steputils;stepeditor;stepdai;base") #all these libs are necessary?
|
add_stepcore_test("SupertypesIterator" "stepcore;steputils;stepeditor;stepdai;base") #all these libs are necessary?
|
||||||
add_stepcore_test("operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai;base")
|
add_stepcore_test("operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai;base")
|
||||||
add_stepcore_test("operators_SDAI_Select" "stepcore;steputils;stepeditor;stepdai;base")
|
add_stepcore_test("operators_SDAI_Select" "stepcore;steputils;stepeditor;stepdai;base")
|
||||||
|
add_stepcore_test("null_attr" "stepcore;steputils;stepeditor;stepdai;base")
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
# tab-width: 8
|
# tab-width: 8
|
||||||
|
|
|
||||||
24
src/clstepcore/test/test_null_attr.cc
Normal file
24
src/clstepcore/test/test_null_attr.cc
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#include <ExpDict.h>
|
||||||
|
#include <STEPattribute.h>
|
||||||
|
#include <sdaiString.h>
|
||||||
|
|
||||||
|
AttrDescriptor *ad = 0;
|
||||||
|
EntityDescriptor *ed = 0;
|
||||||
|
TypeDescriptor *td;
|
||||||
|
Schema *sch = 0;
|
||||||
|
|
||||||
|
int main () {
|
||||||
|
SDAI_String _description;
|
||||||
|
sch = new Schema( "Ifc2x3" );
|
||||||
|
td = new TypeDescriptor( "Ifctext", sdaiSTRING, sch, "STRING" );
|
||||||
|
ed = new EntityDescriptor( "Ifcroot", sch, LTrue, LFalse );
|
||||||
|
ad = new AttrDescriptor( "description", td, LTrue, LFalse, AttrType_Explicit, *ed );
|
||||||
|
ed->AddExplicitAttr( ad );
|
||||||
|
STEPattribute *a = new STEPattribute(*ad, &_description);
|
||||||
|
a -> set_null();
|
||||||
|
delete a;
|
||||||
|
//delete ad; //this is deleted in EntityDescriptor dtor
|
||||||
|
delete ed;
|
||||||
|
delete td;
|
||||||
|
delete sch;
|
||||||
|
}
|
||||||
|
|
@ -122,10 +122,13 @@ void TypeDescriptor::addAltName( const char * schnm, const char * newnm ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * TypeDescriptor::AttrTypeName( std::string & buf, const char * schnm ) const {
|
void TypeDescriptor::AttrTypeName( std::string & buf, const char * schnm ) const {
|
||||||
std::string sstr;
|
const char * sn = Name( schnm );
|
||||||
buf = Name( schnm ) ? StrToLower( Name( schnm ), sstr ) : _description;
|
if( sn ) {
|
||||||
return const_cast<char *>( buf.c_str() );
|
StrToLower( sn , buf );
|
||||||
|
} else {
|
||||||
|
buf = _description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * TypeDescriptor::GenerateExpress( std::string & buf ) const {
|
const char * TypeDescriptor::GenerateExpress( std::string & buf ) const {
|
||||||
|
|
|
||||||
|
|
@ -97,43 +97,43 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// the name of the type (see above)
|
/// the name of the type (see above)
|
||||||
//
|
///
|
||||||
// NOTE - memory is not allocated for this, or for _description
|
/// NOTE - memory is not allocated for this, or for _description
|
||||||
// below. It is assumed that at creation, _name will be made
|
/// below. It is assumed that at creation, _name will be made
|
||||||
// to point to a static location in memory. The exp2cxx
|
/// to point to a static location in memory. The exp2cxx
|
||||||
// generated code, for example, places a literal string in its
|
/// generated code, for example, places a literal string in its
|
||||||
// TypeDesc constructor calls. This creates a location in me-
|
/// TypeDesc constructor calls. This creates a location in me-
|
||||||
// mory static throughout the lifetime of the calling program.
|
/// mory static throughout the lifetime of the calling program.
|
||||||
const char * _name ;
|
const char * _name ;
|
||||||
|
|
||||||
// an alternate name of type - such as one given by a different
|
/// an alternate name of type - such as one given by a different
|
||||||
// schema which USEs/ REFERENCEs this. (A complete list of
|
/// schema which USEs/ REFERENCEs this. (A complete list of
|
||||||
// alternate names is stored in altNames below. _altname pro-
|
/// alternate names is stored in altNames below. _altname pro-
|
||||||
// vides storage space for the currently used one.)
|
/// vides storage space for the currently used one.)
|
||||||
char _altname[BUFSIZ];
|
char _altname[BUFSIZ];
|
||||||
|
|
||||||
// contains list of renamings of type - used by other schemas
|
/// contains list of renamings of type - used by other schemas
|
||||||
// which USE/ REFERENCE this
|
/// which USE/ REFERENCE this
|
||||||
const SchRename * altNames;
|
const SchRename * altNames;
|
||||||
|
|
||||||
// the type of the type (see above).
|
/// the type of the type (see above).
|
||||||
// it is an enum see file clstepcore/baseType.h
|
/// it is an enum see file clstepcore/baseType.h
|
||||||
PrimitiveType _fundamentalType;
|
PrimitiveType _fundamentalType;
|
||||||
|
|
||||||
const Schema * _originatingSchema;
|
const Schema * _originatingSchema;
|
||||||
|
|
||||||
// further describes the type (see above)
|
/// further describes the type (see above)
|
||||||
// most often (or always) points at a subtype.
|
/// most often (or always) points at a subtype.
|
||||||
const TypeDescriptor * _referentType;
|
const TypeDescriptor * _referentType;
|
||||||
|
|
||||||
// Express file description (see above)
|
/// Express file description (see above)
|
||||||
// e.g. the right side of an Express TYPE stmt
|
/// e.g. the right side of an Express TYPE stmt
|
||||||
// (See note above by _name regarding memory allocation.)
|
/// (See note above by _name regarding memory allocation.)
|
||||||
const char * _description;
|
const char * _description;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// a Where_rule may contain only a comment
|
/// a Where_rule may contain only a comment
|
||||||
Where_rule__list_var _where_rules; // initially a null pointer
|
Where_rule__list_var _where_rules; // initially a null pointer
|
||||||
|
|
||||||
Where_rule__list_var & where_rules_() {
|
Where_rule__list_var & where_rules_() {
|
||||||
|
|
@ -145,8 +145,8 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Functions used to check the current name of the type (may
|
/// Functions used to check the current name of the type (may
|
||||||
// != _name if altNames has diff name for current schema).
|
/// != _name if altNames has diff name for current schema).
|
||||||
bool PossName( const char * ) const;
|
bool PossName( const char * ) const;
|
||||||
bool OurName( const char * ) const;
|
bool OurName( const char * ) const;
|
||||||
bool AltName( const char * ) const;
|
bool AltName( const char * ) const;
|
||||||
|
|
@ -161,34 +161,34 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
|
|
||||||
virtual const char * GenerateExpress( std::string & buf ) const;
|
virtual const char * GenerateExpress( std::string & buf ) const;
|
||||||
|
|
||||||
// The name of this type. If schnm != NULL, the name we're
|
/// The name of this type. If schnm != NULL, the name we're
|
||||||
// referred to by schema schnm (may be diff name in our alt-
|
/// referred to by schema schnm (may be diff name in our alt-
|
||||||
// names list (based on schnm's USE/REF list)).
|
/// names list (based on schnm's USE/REF list)).
|
||||||
const char * Name( const char * schnm = NULL ) const;
|
const char * Name( const char * schnm = NULL ) const;
|
||||||
|
|
||||||
// The name that would be found on the right side of an
|
/// The name that would be found on the right side of an
|
||||||
// attribute definition. In the case of a type defined like
|
/// attribute definition. In the case of a type defined like
|
||||||
// TYPE name = STRING END_TYPE;
|
/// TYPE name = STRING END_TYPE;
|
||||||
// with attribute definition employee_name : name;
|
/// with attribute definition employee_name : name;
|
||||||
// it would be the _name member variable. If it was a type
|
/// it would be the _name member variable. If it was a type
|
||||||
// defined in an attribute it will be the _description
|
/// defined in an attribute it will be the _description
|
||||||
// member variable since _name will be null. e.g. attr. def.
|
/// member variable since _name will be null. e.g. attr. def.
|
||||||
// project_names : ARRAY [1..10] name;
|
/// project_names : ARRAY [1..10] name;
|
||||||
const char * AttrTypeName( std::string & buf, const char * schnm = NULL ) const;
|
void AttrTypeName( std::string & buf, const char * schnm = NULL ) const;
|
||||||
|
|
||||||
// Linked link of alternate names for the type:
|
/// Linked link of alternate names for the type:
|
||||||
const SchRename * AltNameList() const {
|
const SchRename * AltNameList() const {
|
||||||
return altNames;
|
return altNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a fully expanded description of the type.
|
/// This is a fully expanded description of the type.
|
||||||
// This returns a string like the _description member variable
|
/// This returns a string like the _description member variable
|
||||||
// except it is more thorough of a description where possible
|
/// except it is more thorough of a description where possible
|
||||||
// e.g. if the description contains a TYPE name it will also
|
/// e.g. if the description contains a TYPE name it will also
|
||||||
// be explained.
|
/// be explained.
|
||||||
const char * TypeString( std::string & s ) const;
|
const char * TypeString( std::string & s ) const;
|
||||||
|
|
||||||
// This TypeDescriptor's type
|
/// This TypeDescriptor's type
|
||||||
PrimitiveType Type() const {
|
PrimitiveType Type() const {
|
||||||
return _fundamentalType;
|
return _fundamentalType;
|
||||||
}
|
}
|
||||||
|
|
@ -196,27 +196,27 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
_fundamentalType = type;
|
_fundamentalType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the underlying Express base type of this type. It will
|
/// This is the underlying Express base type of this type. It will
|
||||||
// be the type of the last TypeDescriptor following the
|
/// be the type of the last TypeDescriptor following the
|
||||||
// _referentType member variable pointers. e.g.
|
/// _referentType member variable pointers. e.g.
|
||||||
// TYPE count = INTEGER;
|
/// TYPE count = INTEGER;
|
||||||
// TYPE ref_count = count;
|
/// TYPE ref_count = count;
|
||||||
// TYPE count_set = SET OF ref_count;
|
/// TYPE count_set = SET OF ref_count;
|
||||||
// each of the above will generate a TypeDescriptor and for
|
/// each of the above will generate a TypeDescriptor and for
|
||||||
// each one, PrimitiveType BaseType() will return INTEGER_TYPE.
|
/// each one, PrimitiveType BaseType() will return INTEGER_TYPE.
|
||||||
// TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
|
/// TypeDescriptor *BaseTypeDescriptor() returns the TypeDescriptor
|
||||||
// for Integer.
|
/// for Integer.
|
||||||
PrimitiveType BaseType() const;
|
PrimitiveType BaseType() const;
|
||||||
const TypeDescriptor * BaseTypeDescriptor() const;
|
const TypeDescriptor * BaseTypeDescriptor() const;
|
||||||
const char * BaseTypeName() const;
|
const char * BaseTypeName() const;
|
||||||
|
|
||||||
// the first PrimitiveType that is not REFERENCE_TYPE (the first
|
/// the first PrimitiveType that is not REFERENCE_TYPE (the first
|
||||||
// TypeDescriptor *_referentType that does not have REFERENCE_TYPE
|
/// TypeDescriptor *_referentType that does not have REFERENCE_TYPE
|
||||||
// for it's fundamentalType variable). This would return the same
|
/// for it's fundamentalType variable). This would return the same
|
||||||
// as BaseType() for fundamental types. An aggregate type
|
/// as BaseType() for fundamental types. An aggregate type
|
||||||
// would return AGGREGATE_TYPE then you could find out the type of
|
/// would return AGGREGATE_TYPE then you could find out the type of
|
||||||
// an element by calling AggrElemType(). Select types
|
/// an element by calling AggrElemType(). Select types
|
||||||
// would work the same?
|
/// would work the same?
|
||||||
|
|
||||||
PrimitiveType NonRefType() const;
|
PrimitiveType NonRefType() const;
|
||||||
const TypeDescriptor * NonRefTypeDescriptor() const;
|
const TypeDescriptor * NonRefTypeDescriptor() const;
|
||||||
|
|
@ -232,7 +232,7 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
_fundamentalType = ftype;
|
_fundamentalType = ftype;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The TypeDescriptor for the type this type is based on
|
/// The TypeDescriptor for the type this type is based on
|
||||||
const TypeDescriptor * ReferentType() const {
|
const TypeDescriptor * ReferentType() const {
|
||||||
return _referentType;
|
return _referentType;
|
||||||
}
|
}
|
||||||
|
|
@ -255,9 +255,9 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A description of this type's type. Basically you
|
/// A description of this type's type. Basically you
|
||||||
// get the right side of a TYPE statement minus END_TYPE.
|
/// get the right side of a TYPE statement minus END_TYPE.
|
||||||
// For base type TypeDescriptors it is the same as _name.
|
/// For base type TypeDescriptors it is the same as _name.
|
||||||
const char * Description() const {
|
const char * Description() const {
|
||||||
return _description;
|
return _description;
|
||||||
}
|
}
|
||||||
|
|
@ -280,9 +280,8 @@ class SC_CORE_EXPORT TypeDescriptor {
|
||||||
return ( CurrName( n, schNm ) ? this : 0 );
|
return ( CurrName( n, schNm ) ? this : 0 );
|
||||||
}
|
}
|
||||||
bool CurrName( const char *, const char * = 0 ) const;
|
bool CurrName( const char *, const char * = 0 ) const;
|
||||||
|
/// Adds an additional name, newnm, to be use when schema schnm is USE/REFERENCE'ing us (added to altNames).
|
||||||
void addAltName( const char * schnm, const char * newnm );
|
void addAltName( const char * schnm, const char * newnm );
|
||||||
// Adds an additional name, newnm, to be use when schema schnm
|
|
||||||
// is USE/REFERENCE'ing us (added to altNames).
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //TYPEDESCRIPTOR_H
|
#endif //TYPEDESCRIPTOR_H
|
||||||
|
|
|
||||||
|
|
@ -318,3 +318,7 @@ Severity CheckRemainingInput( istream & in, ErrorDescriptor * err,
|
||||||
}
|
}
|
||||||
return err->severity();
|
return err->severity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Severity CheckRemainingInput( std::istream & in, ErrorDescriptor * err, const std::string typeName, const char * tokenList ) {
|
||||||
|
return CheckRemainingInput( in, err, typeName.c_str(), tokenList );
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,9 @@ SC_UTILS_EXPORT char * EntityClassName( char * oldname );
|
||||||
SC_UTILS_EXPORT bool StrEndsWith( const std::string & s, const char * suffix );
|
SC_UTILS_EXPORT bool StrEndsWith( const std::string & s, const char * suffix );
|
||||||
SC_UTILS_EXPORT std::string GetLiteralStr( istream & in, ErrorDescriptor * err );
|
SC_UTILS_EXPORT std::string GetLiteralStr( istream & in, ErrorDescriptor * err );
|
||||||
|
|
||||||
extern SC_UTILS_EXPORT Severity CheckRemainingInput
|
extern SC_UTILS_EXPORT Severity CheckRemainingInput( std::istream & in, ErrorDescriptor * err,
|
||||||
( istream & in, ErrorDescriptor * err,
|
|
||||||
const char * typeName, // used in error message
|
const char * typeName, // used in error message
|
||||||
const char * tokenList ); // e.g. ",)"
|
const char * tokenList ); // e.g. ",)"
|
||||||
|
extern SC_UTILS_EXPORT Severity CheckRemainingInput( std::istream & in, ErrorDescriptor * err, const std::string typeName, const char * tokenList );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ void ErrorDescriptor::PrependToUserMsg( const char * msg ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToUserMsg( const char c ) {
|
void ErrorDescriptor::AppendToUserMsg( const char c ) {
|
||||||
_userMsg.append( &c );
|
_userMsg.push_back( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToUserMsg( const char * msg ) {
|
void ErrorDescriptor::AppendToUserMsg( const char * msg ) {
|
||||||
|
|
@ -147,7 +147,7 @@ void ErrorDescriptor::PrependToDetailMsg( const char * msg ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToDetailMsg( const char c ) {
|
void ErrorDescriptor::AppendToDetailMsg( const char c ) {
|
||||||
_detailMsg.append( &c );
|
_detailMsg.push_back( c );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorDescriptor::AppendToDetailMsg( const char * msg ) {
|
void ErrorDescriptor::AppendToDetailMsg( const char * msg ) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
/* "$Id: sc_hash.cc,v 3.0.1.2 1997/11/05 22:33:50 sauderd DP3.1 $"; */
|
/** \file sc_hash.cc
|
||||||
|
|
||||||
/*
|
|
||||||
* Dynamic hashing, after CACM April 1988 pp 446-457, by Per-Ake Larson.
|
* Dynamic hashing, after CACM April 1988 pp 446-457, by Per-Ake Larson.
|
||||||
* Coded into C, with minor code improvements, and with hsearch(3) interface,
|
* Coded into C, with minor code improvements, and with hsearch(3) interface,
|
||||||
* by ejp@ausmelb.oz, Jul 26, 1988: 13:16;
|
* by ejp@ausmelb.oz, Jul 26, 1988: 13:16;
|
||||||
|
|
@ -13,48 +11,31 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sc_memmgr.h>
|
#include <sc_memmgr.h>
|
||||||
|
|
||||||
/*************/
|
|
||||||
/* constants */
|
/* constants */
|
||||||
/*************/
|
|
||||||
|
|
||||||
#define HASH_NULL (Hash_TableP)NULL
|
#define HASH_NULL (Hash_TableP)NULL
|
||||||
|
|
||||||
#define SEGMENT_SIZE 256
|
#define SEGMENT_SIZE 256
|
||||||
#define SEGMENT_SIZE_SHIFT 8 /* log2(SEGMENT_SIZE) */
|
#define SEGMENT_SIZE_SHIFT 8 /* log2(SEGMENT_SIZE) */
|
||||||
#define PRIME1 37
|
#define PRIME1 37
|
||||||
#define PRIME2 1048583
|
#define PRIME2 1048583
|
||||||
#define MAX_LOAD_FACTOR 5
|
#define MAX_LOAD_FACTOR 5
|
||||||
|
|
||||||
/************/
|
|
||||||
/* typedefs */
|
|
||||||
/************/
|
|
||||||
|
|
||||||
typedef unsigned long Address;
|
|
||||||
|
|
||||||
/******************************/
|
|
||||||
/* macro function definitions */
|
/* macro function definitions */
|
||||||
/******************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
** Fast arithmetic, relying on powers of 2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MUL(x,y) ((x) << (y##_SHIFT))
|
|
||||||
#define DIV(x,y) ((x) >> (y##_SHIFT))
|
|
||||||
#define MOD(x,y) ((x) & ((y)-1))
|
|
||||||
|
|
||||||
#define SC_HASH_Table_new() new Hash_Table
|
#define SC_HASH_Table_new() new Hash_Table
|
||||||
#define SC_HASH_Table_destroy(x) delete x
|
#define SC_HASH_Table_destroy(x) delete x
|
||||||
#define SC_HASH_Element_new() new Element
|
#define SC_HASH_Element_new() new Element
|
||||||
#define SC_HASH_Element_destroy(x) delete x
|
#define SC_HASH_Element_destroy(x) delete x
|
||||||
|
|
||||||
|
/* Macros for fast arithmetic, relying on powers of 2 */
|
||||||
|
#define MUL(x,y) ((x) << (y##_SHIFT))
|
||||||
|
#define DIV(x,y) ((x) >> (y##_SHIFT))
|
||||||
|
#define MOD(x,y) ((x) & ((y)-1))
|
||||||
|
|
||||||
|
/* typedefs */
|
||||||
|
typedef unsigned long Address;
|
||||||
typedef struct Element * ElementP;
|
typedef struct Element * ElementP;
|
||||||
typedef struct Hash_Table * Hash_TableP;
|
typedef struct Hash_Table * Hash_TableP;
|
||||||
|
|
||||||
/*
|
/* Internal routines */
|
||||||
** Internal routines
|
|
||||||
*/
|
|
||||||
|
|
||||||
Address SC_HASHhash( char *, Hash_TableP );
|
Address SC_HASHhash( char *, Hash_TableP );
|
||||||
static void SC_HASHexpand_table( Hash_TableP );
|
static void SC_HASHexpand_table( Hash_TableP );
|
||||||
|
|
||||||
|
|
@ -62,8 +43,8 @@ static void SC_HASHexpand_table( Hash_TableP );
|
||||||
static long HashAccesses, HashCollisions;
|
static long HashAccesses, HashCollisions;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
void *
|
/// find entry in given hash table
|
||||||
SC_HASHfind( Hash_TableP t, char * s ) {
|
void * SC_HASHfind( Hash_TableP t, char * s ) {
|
||||||
struct Element e;
|
struct Element e;
|
||||||
struct Element * ep;
|
struct Element * ep;
|
||||||
|
|
||||||
|
|
@ -73,8 +54,8 @@ SC_HASHfind( Hash_TableP t, char * s ) {
|
||||||
return( ep ? ep->data : 0 );
|
return( ep ? ep->data : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/// insert entry into given hash table
|
||||||
SC_HASHinsert( Hash_TableP t, char * s, void * data ) {
|
void SC_HASHinsert( Hash_TableP t, char * s, void * data ) {
|
||||||
struct Element e, *e2;
|
struct Element e, *e2;
|
||||||
|
|
||||||
e.key = s;
|
e.key = s;
|
||||||
|
|
@ -82,12 +63,12 @@ SC_HASHinsert( Hash_TableP t, char * s, void * data ) {
|
||||||
e.symbol = 0;
|
e.symbol = 0;
|
||||||
e2 = SC_HASHsearch( t, &e, HASH_INSERT );
|
e2 = SC_HASHsearch( t, &e, HASH_INSERT );
|
||||||
if( e2 ) {
|
if( e2 ) {
|
||||||
printf( "Redeclaration of %s\n", s );
|
fprintf( stderr, "%s: Redeclaration of %s\n", __FUNCTION__, s );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Hash_TableP
|
/// create a hash table
|
||||||
SC_HASHcreate( unsigned count ) {
|
Hash_TableP SC_HASHcreate( unsigned count ) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
Hash_TableP table;
|
Hash_TableP table;
|
||||||
|
|
||||||
|
|
@ -138,10 +119,9 @@ SC_HASHcreate( unsigned count ) {
|
||||||
return( table );
|
return( table );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* initialize pointer to beginning of hash table so we can step through it */
|
/** initialize pointer to beginning of hash table so we can
|
||||||
/* on repeated calls to HASHlist - DEL */
|
* step through it on repeated calls to HASHlist - DEL */
|
||||||
void
|
void SC_HASHlistinit( Hash_TableP table, HashEntry * he ) {
|
||||||
SC_HASHlistinit( Hash_TableP table, HashEntry * he ) {
|
|
||||||
he->i = he->j = 0;
|
he->i = he->j = 0;
|
||||||
he->p = 0;
|
he->p = 0;
|
||||||
he->table = table;
|
he->table = table;
|
||||||
|
|
@ -149,8 +129,7 @@ SC_HASHlistinit( Hash_TableP table, HashEntry * he ) {
|
||||||
he->e = 0;
|
he->e = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void SC_HASHlistinit_by_type( Hash_TableP table, HashEntry * he, char type ) {
|
||||||
SC_HASHlistinit_by_type( Hash_TableP table, HashEntry * he, char type ) {
|
|
||||||
he->i = he->j = 0;
|
he->i = he->j = 0;
|
||||||
he->p = 0;
|
he->p = 0;
|
||||||
he->table = table;
|
he->table = table;
|
||||||
|
|
@ -158,9 +137,8 @@ SC_HASHlistinit_by_type( Hash_TableP table, HashEntry * he, char type ) {
|
||||||
he->e = 0;
|
he->e = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* provide a way to step through the hash */
|
/** provide a way to step through the hash */
|
||||||
struct Element *
|
struct Element * SC_HASHlist( HashEntry * he ) {
|
||||||
SC_HASHlist( HashEntry * he ) {
|
|
||||||
int i2 = he->i;
|
int i2 = he->i;
|
||||||
int j2 = he->j;
|
int j2 = he->j;
|
||||||
struct Element ** s;
|
struct Element ** s;
|
||||||
|
|
@ -202,8 +180,8 @@ SC_HASHlist( HashEntry * he ) {
|
||||||
return( he->e );
|
return( he->e );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/// destroy all elements in given table, then the table itself
|
||||||
SC_HASHdestroy( Hash_TableP table ) {
|
void SC_HASHdestroy( Hash_TableP table ) {
|
||||||
struct Element ** s;
|
struct Element ** s;
|
||||||
struct Element * p, *q;
|
struct Element * p, *q;
|
||||||
|
|
||||||
|
|
@ -226,16 +204,13 @@ SC_HASHdestroy( Hash_TableP table ) {
|
||||||
}
|
}
|
||||||
SC_HASH_Table_destroy( table );
|
SC_HASH_Table_destroy( table );
|
||||||
# if defined(HASH_STATISTICS) && defined(DEBUG)
|
# if defined(HASH_STATISTICS) && defined(DEBUG)
|
||||||
fprintf( stderr,
|
fprintf( stderr, "[hdestroy] Accesses %ld Collisions %ld\n", HashAccesses, HashCollisions );
|
||||||
"[hdestroy] Accesses %ld Collisions %ld\n",
|
|
||||||
HashAccesses,
|
|
||||||
HashCollisions );
|
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Element *
|
/// search table for 'item', perform 'action' (find/insert/delete)
|
||||||
SC_HASHsearch( Hash_TableP table, const struct Element * item, Action action ) {
|
struct Element * SC_HASHsearch( Hash_TableP table, const struct Element * item, Action action ) {
|
||||||
Address h;
|
Address h;
|
||||||
struct Element ** CurrentSegment;
|
struct Element ** CurrentSegment;
|
||||||
int SegmentIndex;
|
int SegmentIndex;
|
||||||
|
|
@ -317,10 +292,9 @@ SC_HASHsearch( Hash_TableP table, const struct Element * item, Action action ) {
|
||||||
** Internal routines
|
** Internal routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Address
|
Address SC_HASHhash( char * Key, Hash_TableP table ) {
|
||||||
SC_HASHhash( char * Key, Hash_TableP table ) {
|
|
||||||
Address h, address;
|
Address h, address;
|
||||||
register unsigned char * k = ( unsigned char * )Key;
|
unsigned char * k = ( unsigned char * )Key;
|
||||||
|
|
||||||
h = 0;
|
h = 0;
|
||||||
/*
|
/*
|
||||||
|
|
@ -337,9 +311,7 @@ SC_HASHhash( char * Key, Hash_TableP table ) {
|
||||||
return( address );
|
return( address );
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static void SC_HASHexpand_table( Hash_TableP table ) {
|
||||||
void
|
|
||||||
SC_HASHexpand_table( Hash_TableP table ) {
|
|
||||||
struct Element ** OldSegment, **NewSegment;
|
struct Element ** OldSegment, **NewSegment;
|
||||||
struct Element * Current, **Previous, **LastOfNew;
|
struct Element * Current, **Previous, **LastOfNew;
|
||||||
|
|
||||||
|
|
@ -407,7 +379,7 @@ SC_HASHexpand_table( Hash_TableP table ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* following code is for testing hash package */
|
/* for testing sc_hash */
|
||||||
#ifdef HASHTEST
|
#ifdef HASHTEST
|
||||||
struct Element e1, e2, e3, *e;
|
struct Element e1, e2, e3, *e;
|
||||||
struct Hash_Table * t;
|
struct Hash_Table * t;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,9 @@ include_directories(
|
||||||
|
|
||||||
SC_ADDEXEC(exp2cxx "${exp2cxx_SOURCES}" "libexppp;express;base")
|
SC_ADDEXEC(exp2cxx "${exp2cxx_SOURCES}" "libexppp;express;base")
|
||||||
|
|
||||||
add_dependencies(exp2cxx version_string)
|
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)
|
if(SC_ENABLE_TESTING)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,7 @@ void DataMemberPrintAttr( Entity entity, Variable a, FILE * file ) {
|
||||||
ctype = TYPEget_ctype( VARget_type( a ) );
|
ctype = TYPEget_ctype( VARget_type( a ) );
|
||||||
generate_attribute_name( a, attrnm );
|
generate_attribute_name( a, attrnm );
|
||||||
if( !strcmp( ctype, "SCLundefined" ) ) {
|
if( !strcmp( ctype, "SCLundefined" ) ) {
|
||||||
printf( "WARNING: in entity %s, ", ENTITYget_name( entity ) );
|
fprintf( stderr, "Warning: in entity %s, the type for attribute %s is not fully implemented\n", ENTITYget_name( entity ), attrnm );
|
||||||
printf( " the type for attribute %s is not fully implemented\n", attrnm );
|
|
||||||
}
|
}
|
||||||
if( TYPEis_entity( VARget_type( a ) ) ) {
|
if( TYPEis_entity( VARget_type( a ) ) ) {
|
||||||
fprintf( file, " SDAI_Application_instance_ptr _%s;", attrnm );
|
fprintf( file, " SDAI_Application_instance_ptr _%s;", attrnm );
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ FILE * FILEcreate( const char * filename ) {
|
||||||
const char * fn;
|
const char * fn;
|
||||||
|
|
||||||
if( ( file = fopen( filename, "w" ) ) == NULL ) {
|
if( ( file = fopen( filename, "w" ) ) == NULL ) {
|
||||||
printf( "**Error in SCHEMAprint: unable to create file %s ** \n", filename );
|
fprintf( stderr, "**Error in SCHEMAprint: unable to create file %s ** \n", filename );
|
||||||
return ( NULL );
|
return ( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -262,7 +262,7 @@ const char * GetTypeDescriptorName( Type t ) {
|
||||||
case generic_:
|
case generic_:
|
||||||
return "TypeDescriptor";
|
return "TypeDescriptor";
|
||||||
default:
|
default:
|
||||||
printf( "Error in %s, line %d: type %d not handled by switch statement.", __FILE__, __LINE__, TYPEget_body( t )->type );
|
fprintf( stderr, "Error at %s:%d - type %d not handled by switch statement.", __FILE__, __LINE__, TYPEget_body( t )->type );
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
|
@ -318,9 +318,7 @@ Entity ENTITYput_superclass( Entity entity ) {
|
||||||
ignore = e;
|
ignore = e;
|
||||||
}
|
}
|
||||||
if( ignore ) {
|
if( ignore ) {
|
||||||
printf( "WARNING: multiple inheritance not implemented.\n" );
|
fprintf( stderr, "WARNING: multiple inheritance not implemented. In ENTITY %s, SUPERTYPE %s ignored.\n", ENTITYget_name( entity ), ENTITYget_name( e ) );
|
||||||
printf( "\tin ENTITY %s\n\tSUPERTYPE %s IGNORED.\n\n",
|
|
||||||
ENTITYget_name( entity ), ENTITYget_name( e ) );
|
|
||||||
}
|
}
|
||||||
LISTod;
|
LISTod;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ N350 ( August 31, 1993 ) of ISO 10303 TC184/SC4/WG7.
|
||||||
/* #define NEWDICT */
|
/* #define NEWDICT */
|
||||||
|
|
||||||
#include <sc_memmgr.h>
|
#include <sc_memmgr.h>
|
||||||
|
#include <path2str.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sc_mkdir.h>
|
#include <sc_mkdir.h>
|
||||||
|
|
@ -42,6 +43,10 @@ int isMultiDimAggregateType( const Type t );
|
||||||
void Type_Description( const Type, char * );
|
void Type_Description( const Type, char * );
|
||||||
void TypeBody_Description( TypeBody body, char * buf );
|
void TypeBody_Description( TypeBody body, char * buf );
|
||||||
|
|
||||||
|
/** write representation of expression to end of buf
|
||||||
|
*
|
||||||
|
* TODO: add buflen arg and check for overflow
|
||||||
|
*/
|
||||||
void strcat_expr( Expression e, char * buf ) {
|
void strcat_expr( Expression e, char * buf ) {
|
||||||
if( e == LITERAL_INFINITY ) {
|
if( e == LITERAL_INFINITY ) {
|
||||||
strcat( buf, "?" );
|
strcat( buf, "?" );
|
||||||
|
|
@ -64,7 +69,10 @@ void strcat_expr( Expression e, char * buf ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** print t's bounds to end of buf */
|
/** print t's bounds to end of buf
|
||||||
|
*
|
||||||
|
* TODO: add buflen arg and check for overflow
|
||||||
|
*/
|
||||||
void strcat_bounds( TypeBody b, char * buf ) {
|
void strcat_bounds( TypeBody b, char * buf ) {
|
||||||
if( !b->upper ) {
|
if( !b->upper ) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -93,7 +101,6 @@ void strcat_bounds( TypeBody b, char * buf ) {
|
||||||
** Change Date: 5/22/91 CD
|
** Change Date: 5/22/91 CD
|
||||||
******************************************************************/
|
******************************************************************/
|
||||||
const char * EnumCElementName( Type type, Expression expr ) {
|
const char * EnumCElementName( Type type, Expression expr ) {
|
||||||
|
|
||||||
static char buf [BUFSIZ];
|
static char buf [BUFSIZ];
|
||||||
sprintf( buf, "%s__",
|
sprintf( buf, "%s__",
|
||||||
EnumName( TYPEget_name( type ) ) );
|
EnumName( TYPEget_name( type ) ) );
|
||||||
|
|
@ -103,7 +110,6 @@ const char * EnumCElementName( Type type, Expression expr ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char * CheckEnumSymbol( char * s ) {
|
char * CheckEnumSymbol( char * s ) {
|
||||||
|
|
||||||
static char b [BUFSIZ];
|
static char b [BUFSIZ];
|
||||||
if( strcmp( s, "sdaiTRUE" )
|
if( strcmp( s, "sdaiTRUE" )
|
||||||
&& strcmp( s, "sdaiFALSE" )
|
&& strcmp( s, "sdaiFALSE" )
|
||||||
|
|
@ -114,8 +120,7 @@ char * CheckEnumSymbol( char * s ) {
|
||||||
} else {
|
} else {
|
||||||
strcpy( b, s );
|
strcpy( b, s );
|
||||||
strcat( b, "_" );
|
strcat( b, "_" );
|
||||||
printf( "** warning: the enumerated value %s is already being used ", s );
|
fprintf( stderr, "Warning in %s: the enumerated value %s is already being used and has been changed to %s\n", __FUNCTION__, s, b );
|
||||||
printf( " and has been changed to %s **\n", b );
|
|
||||||
return ( b );
|
return ( b );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -362,6 +367,9 @@ void TYPEPrint( const Type type, FILES *files, Schema schema ) {
|
||||||
* Prints a bunch of lines for enumeration creation functions (i.e., "cre-
|
* Prints a bunch of lines for enumeration creation functions (i.e., "cre-
|
||||||
* ate_SdaiEnum1()"). Since this is done both for an enum and for "copies"
|
* ate_SdaiEnum1()"). Since this is done both for an enum and for "copies"
|
||||||
* of it (when "TYPE enum2 = enum1"), I placed this code in a separate fn.
|
* of it (when "TYPE enum2 = enum1"), I placed this code in a separate fn.
|
||||||
|
*
|
||||||
|
* NOTE - "Print ObjectStore Access Hook function" comment seen at one of
|
||||||
|
* the calls seems to imply it's ObjectStore specific...
|
||||||
*/
|
*/
|
||||||
static void printEnumCreateHdr( FILE * inc, const Type type ) {
|
static void printEnumCreateHdr( FILE * inc, const Type type ) {
|
||||||
const char * nm = TYPEget_ctype( type );
|
const char * nm = TYPEget_ctype( type );
|
||||||
|
|
@ -1279,7 +1287,7 @@ char * TYPEget_express_type( const Type t ) {
|
||||||
|
|
||||||
/* default returns undefined */
|
/* default returns undefined */
|
||||||
|
|
||||||
printf( "WARNING2: type %s is undefined\n", TYPEget_name( t ) );
|
fprintf( stderr, "Warning in %s: type %s is undefined\n", __FUNCTION__, TYPEget_name( t ) );
|
||||||
return ( "SCLundefined" );
|
return ( "SCLundefined" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1305,7 +1313,7 @@ void AGGRprint_bound( FILE * header, FILE * impl, const char * var_name, const c
|
||||||
fprintf( header, " break;\n" );
|
fprintf( header, " break;\n" );
|
||||||
fprintf( header, " }\n" );
|
fprintf( header, " }\n" );
|
||||||
fprintf( header, " }\n" );
|
fprintf( header, " }\n" );
|
||||||
fprintf( header, " assert( a->NonRefType() == INTEGER_TYPE && \"Error in schema or in exp2cxx at %s:%d %s\" );\n", __FILE__,
|
fprintf( header, " assert( a->NonRefType() == INTEGER_TYPE && \"Error in schema or in exp2cxx at %s:%d %s\" );\n", path2str( __FILE__ ),
|
||||||
__LINE__, "(incorrect assumption of integer type?) Please report error to STEPcode: scl-dev at groups.google.com." );
|
__LINE__, "(incorrect assumption of integer type?) Please report error to STEPcode: scl-dev at groups.google.com." );
|
||||||
fprintf( header, " return *( a->Integer() );\n" ); /* always an integer? if not, would need to translate somehow due to return type... */
|
fprintf( header, " return *( a->Integer() );\n" ); /* always an integer? if not, would need to translate somehow due to return type... */
|
||||||
fprintf( header, "}\n" );
|
fprintf( header, "}\n" );
|
||||||
|
|
@ -1325,8 +1333,7 @@ void AGGRprint_bound( FILE * header, FILE * impl, const char * var_name, const c
|
||||||
*/
|
*/
|
||||||
void AGGRprint_init( FILE * header, FILE * impl, const Type t, const char * var_name, const char * aggr_name ) {
|
void AGGRprint_init( FILE * header, FILE * impl, const Type t, const char * var_name, const char * aggr_name ) {
|
||||||
if( !header ) {
|
if( !header ) {
|
||||||
fprintf( stderr, "ERROR at %s:%d! 'header' is null for aggregate %s.",
|
fprintf( stderr, "ERROR at %s:%d! 'header' is null for aggregate %s.", __FILE__, __LINE__, t->symbol.name );
|
||||||
__FILE__, __LINE__, t->symbol.name );
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
if( !TYPEget_head( t ) ) {
|
if( !TYPEget_head( t ) ) {
|
||||||
|
|
|
||||||
|
|
@ -83,10 +83,9 @@
|
||||||
extern void print_fedex_version( void );
|
extern void print_fedex_version( void );
|
||||||
|
|
||||||
static void exp2cxx_usage( void ) {
|
static void exp2cxx_usage( void ) {
|
||||||
fprintf( stderr, "usage: %s [-s|-S] [-a|-A] [-c|-C] [-L] [-v] [-d # | -d 9 -l nnn -u nnn] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name );
|
fprintf( stderr, "usage: %s [-s|-S] [-a|-A] [-L] [-v] [-d # | -d 9 -l nnn -u nnn] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name );
|
||||||
fprintf( stderr, "where\t-s or -S uses only single inheritance in the generated C++ classes\n" );
|
fprintf( stderr, "where\t-s or -S uses only single inheritance in the generated C++ classes\n" );
|
||||||
fprintf( stderr, "\t-a or -A generates the early bound access functions for entity classes the old way (without an underscore)\n" );
|
fprintf( stderr, "\t-a or -A generates the early bound access functions for entity classes the old way (without an underscore)\n" );
|
||||||
fprintf( stderr, "\t-c or -C generates C++ classes for use with CORBA (Orbix)\n" );
|
|
||||||
fprintf( stderr, "\t-L prints logging code in the generated C++ classes\n" );
|
fprintf( stderr, "\t-L prints logging code in the generated C++ classes\n" );
|
||||||
fprintf( stderr, "\t-v produces the version description below\n" );
|
fprintf( stderr, "\t-v produces the version description below\n" );
|
||||||
fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" );
|
fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" );
|
||||||
|
|
@ -132,7 +131,7 @@ void EXPRESSinit_init( void ) {
|
||||||
EXPRESSsucceed = success;
|
EXPRESSsucceed = success;
|
||||||
EXPRESSgetopt = Handle_FedPlus_Args;
|
EXPRESSgetopt = Handle_FedPlus_Args;
|
||||||
/* so the function getopt (see man 3 getopt) will not report an error */
|
/* so the function getopt (see man 3 getopt) will not report an error */
|
||||||
strcat( EXPRESSgetopt_options, "sSlLcCaA" );
|
strcat( EXPRESSgetopt_options, "sSlLaA" );
|
||||||
ERRORusage_function = exp2cxx_usage;
|
ERRORusage_function = exp2cxx_usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -733,8 +733,17 @@ void TYPEselect_lib_print_part_one( const Type type, FILE * f,
|
||||||
if( isAggregateType( t ) && t->u.type->body->base ) {
|
if( isAggregateType( t ) && t->u.type->body->base ) {
|
||||||
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
||||||
}
|
}
|
||||||
}
|
} LISTod
|
||||||
LISTod;
|
/* above misses some attr's that are initialized in part 1 ctor below.
|
||||||
|
* hopefully this won't add duplicates...
|
||||||
|
*/
|
||||||
|
LISTdo( SEL_TYPEget_items( type ), t, Type ) {
|
||||||
|
if( ( TYPEis_entity( t ) ) || ( !utype_member( dups, t, 1 ) ) ) {
|
||||||
|
if( isAggregateType( t ) && ( t->u.type->body->base ) ) {
|
||||||
|
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} LISTod
|
||||||
fprintf( f, " nullify();\n" );
|
fprintf( f, " nullify();\n" );
|
||||||
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
||||||
fprintf( f, "// *logStream << \"DAVE ERR exiting %s constructor.\" << std::endl;\n", n );
|
fprintf( f, "// *logStream << \"DAVE ERR exiting %s constructor.\" << std::endl;\n", n );
|
||||||
|
|
@ -743,101 +752,95 @@ void TYPEselect_lib_print_part_one( const Type type, FILE * f,
|
||||||
|
|
||||||
/* constructors with underlying types */
|
/* constructors with underlying types */
|
||||||
fprintf( f, "\n // part 1\n" );
|
fprintf( f, "\n // part 1\n" );
|
||||||
LISTdo( SEL_TYPEget_items( type ), t, Type )
|
LISTdo( SEL_TYPEget_items( type ), t, Type ) {
|
||||||
if( ( TYPEis_entity( t ) )
|
if( ( TYPEis_entity( t ) ) || ( !utype_member( dups, t, 1 ) ) ) {
|
||||||
|| ( !utype_member( dups, t, 1 ) ) ) {
|
/* if there is not more than one underlying type that maps to the same
|
||||||
/* if there is not more than one underlying type that maps to the same
|
* base type print out the constructor using the type from the TYPE
|
||||||
* base type print out the constructor using the type from the TYPE
|
* statement as the underlying type. Also skip enums/sels which are
|
||||||
* statement as the underlying type. Also skip enums/sels which are
|
* renames of other items. That would create redundant constructors
|
||||||
* renames of other items. That would create redundant constructors
|
* since renames are typedef'ed to the original type.
|
||||||
* since renames are typedef'ed to the original type.
|
*/
|
||||||
*/
|
|
||||||
fprintf( f, "%s::%s( const %s& o,\n", n, n, AccessType( t ) );
|
|
||||||
for( j = 0; j < size; j++ ) {
|
|
||||||
fprintf( f, " " );
|
|
||||||
}
|
|
||||||
/* Did this for the heck of it, and to show how easy it would have
|
|
||||||
been to make it all pretty - DAR. ;-) */
|
|
||||||
fprintf( f, "const SelectTypeDescriptor *typedescript )\n" );
|
|
||||||
|
|
||||||
fprintf( f, " : " BASE_SELECT " (typedescript, %s)",
|
|
||||||
TYPEtd_name( t ) );
|
|
||||||
initSelItems( type, f );
|
|
||||||
fprintf( f, "\n{\n" );
|
|
||||||
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
|
||||||
fprintf( f,
|
|
||||||
" *logStream << \"DAVE ERR entering %s constructor.\""
|
|
||||||
" << std::endl;\n", n );
|
|
||||||
fprintf( f, " }\n#endif\n" );
|
|
||||||
|
|
||||||
if( isAggregateType( t ) ) {
|
|
||||||
if( t->u.type->body->base ) {
|
|
||||||
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
|
||||||
}
|
|
||||||
fprintf( f, " _%s%sShallowCopy (*o);\n", SEL_ITEMget_dmname( t ),
|
|
||||||
( ( t->u.type->body->base ) ? "->" : "." ) );
|
|
||||||
} else {
|
|
||||||
fprintf( f, " _%s = o;\n", SEL_ITEMget_dmname( t ) );
|
|
||||||
}
|
|
||||||
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
|
||||||
fprintf( f,
|
|
||||||
"// *logStream << \"DAVE ERR exiting %s constructor.\""
|
|
||||||
" << std::endl;\n", n );
|
|
||||||
fprintf( f, " }\n#endif\n" );
|
|
||||||
|
|
||||||
fprintf( f, "}\n\n" );
|
|
||||||
}
|
|
||||||
LISTod;
|
|
||||||
LISTdo( dups, t, Type )
|
|
||||||
/* if there is more than one underlying type that maps to the
|
|
||||||
* same base type, print a constructor using the base type.
|
|
||||||
*/
|
|
||||||
if( ! TYPEis_entity( t ) ) { /* entities were done already */
|
|
||||||
if( isAggregateType( t ) ) {
|
|
||||||
fprintf( f, "%s::%s( const %s& o,\n", n, n, AccessType( t ) );
|
fprintf( f, "%s::%s( const %s& o,\n", n, n, AccessType( t ) );
|
||||||
for( j = 0; j < size; j++ ) {
|
for( j = 0; j < size; j++ ) {
|
||||||
fprintf( f, " " );
|
fprintf( f, " " );
|
||||||
}
|
}
|
||||||
|
/* Did this for the heck of it, and to show how easy it would have
|
||||||
|
been to make it all pretty - DAR. ;-) */
|
||||||
fprintf( f, "const SelectTypeDescriptor *typedescript )\n" );
|
fprintf( f, "const SelectTypeDescriptor *typedescript )\n" );
|
||||||
fprintf( f, " : " BASE_SELECT " ( typedescript, %s )",
|
|
||||||
TYPEtd_name( t ) );
|
fprintf( f, " : " BASE_SELECT " (typedescript, %s)", TYPEtd_name( t ) );
|
||||||
initSelItems( type, f );
|
initSelItems( type, f );
|
||||||
fprintf( f, "\n{\n" );
|
fprintf( f, "\n{\n" );
|
||||||
|
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream ) { " );
|
||||||
|
fprintf( f, "*logStream << \"DAVE ERR entering %s constructor.\" << std::endl; }\n", n );
|
||||||
|
fprintf( f, "#endif\n" );
|
||||||
|
|
||||||
|
if( isAggregateType( t ) ) {
|
||||||
|
if( t->u.type->body->base ) {
|
||||||
|
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
||||||
|
}
|
||||||
|
fprintf( f, " _%s%sShallowCopy (*o);\n", SEL_ITEMget_dmname( t ),
|
||||||
|
( ( t->u.type->body->base ) ? "->" : "." ) );
|
||||||
|
} else {
|
||||||
|
fprintf( f, " _%s = o;\n", SEL_ITEMget_dmname( t ) );
|
||||||
|
}
|
||||||
|
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream ) { " );
|
||||||
|
fprintf( f, "*logStream << \"DAVE ERR exiting %s constructor.\" << std::endl; }\n", n );
|
||||||
|
fprintf( f, "#endif\n" );
|
||||||
|
|
||||||
|
fprintf( f, "}\n\n" );
|
||||||
|
}
|
||||||
|
} LISTod
|
||||||
|
LISTdo( dups, t, Type ) {
|
||||||
|
/* if there is more than one underlying type that maps to the
|
||||||
|
* same base type, print a constructor using the base type.
|
||||||
|
*/
|
||||||
|
if( ! TYPEis_entity( t ) ) { /* entities were done already */
|
||||||
|
if( isAggregateType( t ) ) {
|
||||||
|
fprintf( f, "%s::%s( const %s& o,\n", n, n, AccessType( t ) );
|
||||||
|
for( j = 0; j < size; j++ ) {
|
||||||
|
fprintf( f, " " );
|
||||||
|
}
|
||||||
|
fprintf( f, "const SelectTypeDescriptor *typedescript )\n" );
|
||||||
|
fprintf( f, " : " BASE_SELECT " ( typedescript, %s )",
|
||||||
|
TYPEtd_name( t ) );
|
||||||
|
initSelItems( type, f );
|
||||||
|
fprintf( f, "\n{\n" );
|
||||||
|
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
||||||
|
fprintf( f,
|
||||||
|
" *logStream << \"DAVE ERR entering %s constructor.\""
|
||||||
|
" << std::endl;\n", n );
|
||||||
|
fprintf( f, " }\n#endif\n" );
|
||||||
|
if( t->u.type->body->base ) {
|
||||||
|
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
||||||
|
}
|
||||||
|
fprintf( f, " _%s%sShallowCopy (*o);\n", SEL_ITEMget_dmname( t ), ( ( t->u.type->body->base ) ? "->" : "." ) );
|
||||||
|
} else {
|
||||||
|
fprintf( f, "%s::%s( const %s& o,\n", n, n, TYPEget_utype( t ) );
|
||||||
|
for( j = 0; j < size; j++ ) {
|
||||||
|
fprintf( f, " " );
|
||||||
|
}
|
||||||
|
fprintf( f, "const SelectTypeDescriptor *typedescript )\n" );
|
||||||
|
fprintf( f, " : " BASE_SELECT " ( typedescript, %s )",
|
||||||
|
TYPEtd_name( t ) );
|
||||||
|
initSelItems( type, f );
|
||||||
|
fprintf( f, "\n{\n" );
|
||||||
|
fprintf( f, " _%s = o;\n", SEL_ITEMget_dmname( t ) );
|
||||||
|
}
|
||||||
|
fprintf( f,
|
||||||
|
"// NOTE: Underlying type defaults to %s instead of NULL\n",
|
||||||
|
TYPEtd_name( t ) );
|
||||||
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
||||||
fprintf( f,
|
fprintf( f,
|
||||||
" *logStream << \"DAVE ERR entering %s constructor.\""
|
"// *logStream << \"DAVE ERR exiting %s constructor.\""
|
||||||
" << std::endl;\n", n );
|
" << std::endl;\n", n );
|
||||||
fprintf( f, " }\n#endif\n" );
|
fprintf( f, " }\n#endif\n" );
|
||||||
if( t->u.type->body->base ) {
|
fprintf( f, "}\n\n" );
|
||||||
fprintf( f, " _%s = new %s;\n", SEL_ITEMget_dmname( t ), TYPEget_utype( t ) );
|
|
||||||
}
|
|
||||||
fprintf( f, " _%s%sShallowCopy (*o);\n", SEL_ITEMget_dmname( t ), ( ( t->u.type->body->base ) ? "->" : "." ) );
|
|
||||||
} else {
|
|
||||||
fprintf( f, "%s::%s( const %s& o,\n", n, n, TYPEget_utype( t ) );
|
|
||||||
for( j = 0; j < size; j++ ) {
|
|
||||||
fprintf( f, " " );
|
|
||||||
}
|
|
||||||
fprintf( f, "const SelectTypeDescriptor *typedescript )\n" );
|
|
||||||
fprintf( f, " : " BASE_SELECT " ( typedescript, %s )",
|
|
||||||
TYPEtd_name( t ) );
|
|
||||||
initSelItems( type, f );
|
|
||||||
fprintf( f, "\n{\n" );
|
|
||||||
fprintf( f, " _%s = o;\n", SEL_ITEMget_dmname( t ) );
|
|
||||||
}
|
}
|
||||||
fprintf( f,
|
} LISTod
|
||||||
"// NOTE: Underlying type defaults to %s instead of NULL\n",
|
|
||||||
TYPEtd_name( t ) );
|
|
||||||
fprintf( f, "#ifdef SC_LOGGING\n if( *logStream )\n {\n" );
|
|
||||||
fprintf( f,
|
|
||||||
"// *logStream << \"DAVE ERR exiting %s constructor.\""
|
|
||||||
" << std::endl;\n", n );
|
|
||||||
fprintf( f, " }\n#endif\n" );
|
|
||||||
fprintf( f, "}\n\n" );
|
|
||||||
}
|
|
||||||
LISTod;
|
|
||||||
|
|
||||||
/* dtor */
|
/* dtor */
|
||||||
fprintf( f, "%s::~%s()\n{\n", n, n );
|
fprintf( f, "%s::~%s() {\n", n, n );
|
||||||
/* delete objects that data members point to */
|
/* delete objects that data members point to */
|
||||||
LISTdo( dups, t, Type ) {
|
LISTdo( dups, t, Type ) {
|
||||||
if( isAggregateType( t ) && t->u.type->body->base ) {
|
if( isAggregateType( t ) && t->u.type->body->base ) {
|
||||||
|
|
@ -847,6 +850,16 @@ void TYPEselect_lib_print_part_one( const Type type, FILE * f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LISTod;
|
LISTod;
|
||||||
|
LISTdo( SEL_TYPEget_items( type ), t, Type ) {
|
||||||
|
if( ( TYPEis_entity( t ) ) || ( !utype_member( dups, t, 1 ) ) ) {
|
||||||
|
if( isAggregateType( t ) && ( t->u.type->body->base ) ) {
|
||||||
|
fprintf( f, " if( _%s ) {\n", SEL_ITEMget_dmname( t ) );
|
||||||
|
fprintf( f, " delete _%s;\n", SEL_ITEMget_dmname( t ) );
|
||||||
|
fprintf( f, " _%s = 0;\n }\n", SEL_ITEMget_dmname( t ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} LISTod
|
||||||
|
|
||||||
fprintf( f, "}\n\n" );
|
fprintf( f, "}\n\n" );
|
||||||
|
|
||||||
fprintf( f, "%s_agg::%s_agg( SelectTypeDescriptor *s)\n"
|
fprintf( f, "%s_agg::%s_agg( SelectTypeDescriptor *s)\n"
|
||||||
|
|
@ -1033,8 +1046,7 @@ void TYPEselect_lib_part_three_getter( const Type type, const char * classnm, co
|
||||||
* a select class -- access functions for the data members of underlying entity
|
* a select class -- access functions for the data members of underlying entity
|
||||||
* types.
|
* types.
|
||||||
*/
|
*/
|
||||||
void TYPEselect_lib_print_part_three( const Type type, FILE * f,
|
void TYPEselect_lib_print_part_three( const Type type, FILE * f, char * classnm ) {
|
||||||
char * classnm ) {
|
|
||||||
#define ENTITYget_type(e) ((e)->u.entity->type)
|
#define ENTITYget_type(e) ((e)->u.entity->type)
|
||||||
|
|
||||||
char uent[BUFSIZ], /* name of underlying entity type */
|
char uent[BUFSIZ], /* name of underlying entity type */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ if(SC_PYTHON_GENERATOR)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${SC_SOURCE_DIR}/include
|
${SC_SOURCE_DIR}/include
|
||||||
${SC_SOURCE_DIR}/include/exppp
|
|
||||||
${SC_SOURCE_DIR}/include/express
|
${SC_SOURCE_DIR}/include/express
|
||||||
${SC_SOURCE_DIR}/src/base
|
${SC_SOURCE_DIR}/src/base
|
||||||
)
|
)
|
||||||
|
|
@ -30,9 +29,11 @@ if(SC_PYTHON_GENERATOR)
|
||||||
../exp2cxx/write.cc
|
../exp2cxx/write.cc
|
||||||
../exp2cxx/print.cc
|
../exp2cxx/print.cc
|
||||||
)
|
)
|
||||||
SC_ADDEXEC(exp2python "${exp2python_SOURCES}" "libexppp;express;base")
|
SC_ADDEXEC(exp2python "${exp2python_SOURCES}" "express;base")
|
||||||
|
|
||||||
add_dependencies(exp2python version_string)
|
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)
|
endif(SC_PYTHON_GENERATOR)
|
||||||
|
|
||||||
# Local Variables:
|
# Local Variables:
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class ARRAY(BaseType.Type, BaseType.Aggregate):
|
||||||
"""
|
"""
|
||||||
EXPRESS definition:
|
EXPRESS definition:
|
||||||
==================
|
==================
|
||||||
An array data type has as its domain indexed, fixed-size collections of like elements. The lower
|
An array data type has as its domain indexed, fixed-size collections of like elements. The lower
|
||||||
and upper bounds, which are integer-valued expressions, define the range of index values, and
|
and upper bounds, which are integer-valued expressions, define the range of index values, and
|
||||||
thus the size of each array collection.
|
thus the size of each array collection.
|
||||||
An array data type definition may optionally specify
|
An array data type definition may optionally specify
|
||||||
|
|
@ -93,21 +93,21 @@ class ARRAY(BaseType.Type, BaseType.Aggregate):
|
||||||
NOTE 1 { The bounds may be positive, negative or zero, but may not be indeterminate (?) (see
|
NOTE 1 { The bounds may be positive, negative or zero, but may not be indeterminate (?) (see
|
||||||
14.2).
|
14.2).
|
||||||
Rules and restrictions:
|
Rules and restrictions:
|
||||||
a) Both expressions in the bound specication, bound_1 and bound_2, shall evaluate to
|
a) Both expressions in the bound specification, bound_1 and bound_2, shall evaluate to
|
||||||
integer values. Neither shall evaluate to the indeterminate (?) value.
|
integer values. Neither shall evaluate to the indeterminate (?) value.
|
||||||
b) bound_1 gives the lower bound of the array. This shall be the lowest index which is
|
b) bound_1 gives the lower bound of the array. This shall be the lowest index which is
|
||||||
valid for an array value of this data type.
|
valid for an array value of this data type.
|
||||||
c) bound_2 gives the upper bound of the array. This shall be the highest index which is
|
c) bound_2 gives the upper bound of the array. This shall be the highest index which is
|
||||||
valid for an array value of this data type.
|
valid for an array value of this data type.
|
||||||
d) bound_1 shall be less than or equal to bound_2.
|
d) bound_1 shall be less than or equal to bound_2.
|
||||||
e) If the optional keyword is specied, an array value of this data type may have the
|
e) If the optional keyword is specified, an array value of this data type may have the
|
||||||
indeterminate (?) value at one or more index positions.
|
indeterminate (?) value at one or more index positions.
|
||||||
f) If the optional keyword is not specied, an array value of this data type shall not
|
f) If the optional keyword is not specified, an array value of this data type shall not
|
||||||
contain an indeterminate (?) value at any index position.
|
contain an indeterminate (?) value at any index position.
|
||||||
g) If the unique keyword is specied, each element in an array value of this data type
|
g) If the unique keyword is specified, each element in an array value of this data type
|
||||||
shall be dierent from (i.e., not instance equal to) every other element in the same array
|
shall be different from (i.e., not instance equal to) every other element in the same array
|
||||||
value.
|
value.
|
||||||
NOTE 2 : Both optional and unique may be specied in the same array data type definition.
|
NOTE 2 : Both optional and unique may be specified in the same array data type definition.
|
||||||
This does not preclude multiple indeterminate (?) values from occurring in a single array value.
|
This does not preclude multiple indeterminate (?) values from occurring in a single array value.
|
||||||
This is because comparisons between indeterminate (?) values result in unknown so the uniqueness
|
This is because comparisons between indeterminate (?) values result in unknown so the uniqueness
|
||||||
constraint is not violated.
|
constraint is not violated.
|
||||||
|
|
@ -115,7 +115,7 @@ class ARRAY(BaseType.Type, BaseType.Aggregate):
|
||||||
sectors : ARRAY [ 1 : 10 ] OF -- first dimension
|
sectors : ARRAY [ 1 : 10 ] OF -- first dimension
|
||||||
ARRAY [ 11 : 14 ] OF -- second dimension
|
ARRAY [ 11 : 14 ] OF -- second dimension
|
||||||
UNIQUE something;
|
UNIQUE something;
|
||||||
The first array has 10 elements of data type ARRAY[11:14] OF UNIQUE something. There is
|
The first array has 10 elements of data type ARRAY[11:14] OF UNIQUE something. There is
|
||||||
a total of 40 elements of data type something in the attribute named sectors. Within each
|
a total of 40 elements of data type something in the attribute named sectors. Within each
|
||||||
ARRAY[11:14], no duplicates may occur; however, the same something instance may occur in two
|
ARRAY[11:14], no duplicates may occur; however, the same something instance may occur in two
|
||||||
different ARRAY[11:14] values within a single value for the attribute named sectors.
|
different ARRAY[11:14] values within a single value for the attribute named sectors.
|
||||||
|
|
@ -223,10 +223,10 @@ class LIST(BaseType.Type, BaseType.Aggregate):
|
||||||
If this value is indeterminate (?) the number of elements in a list value of this data type is
|
If this value is indeterminate (?) the number of elements in a list value of this data type is
|
||||||
not bounded from above.
|
not bounded from above.
|
||||||
c) If the bound_spec is omitted, the limits are [0:?].
|
c) If the bound_spec is omitted, the limits are [0:?].
|
||||||
d) If the unique keyword is specied, each element in a list value of this data type shall
|
d) If the unique keyword is specified, each element in a list value of this data type shall
|
||||||
be dierent from (i.e., not instance equal to) every other element in the same list value.
|
be different from (i.e., not instance equal to) every other element in the same list value.
|
||||||
EXAMPLE 28 { This example denes a list of arrays. The list can contain zero to ten arrays. Each
|
EXAMPLE 28 { This example defines a list of arrays. The list can contain zero to ten arrays. Each
|
||||||
array of ten integers shall be dierent from all other arrays in a particular list.
|
array of ten integers shall be different from all other arrays in a particular list.
|
||||||
complex_list : LIST[0:10] OF UNIQUE ARRAY[1:10] OF INTEGER;
|
complex_list : LIST[0:10] OF UNIQUE ARRAY[1:10] OF INTEGER;
|
||||||
|
|
||||||
Python definition:
|
Python definition:
|
||||||
|
|
@ -374,7 +374,7 @@ class BAG(BaseType.Type, BaseType.Aggregate):
|
||||||
==================
|
==================
|
||||||
A bag data type has as its domain unordered collections of like elements. The optional lower
|
A bag data type has as its domain unordered collections of like elements. The optional lower
|
||||||
and upper bounds, which are integer-valued expressions, define the minimum and maximum
|
and upper bounds, which are integer-valued expressions, define the minimum and maximum
|
||||||
number of elements that can be held in the collection dened by a bag data type.
|
number of elements that can be held in the collection defined by a bag data type.
|
||||||
|
|
||||||
Syntax:
|
Syntax:
|
||||||
170 bag_type = BAG [ bound_spec ] OF base_type .
|
170 bag_type = BAG [ bound_spec ] OF base_type .
|
||||||
|
|
@ -490,8 +490,8 @@ class SET(BaseType.Type, BaseType.Aggregate):
|
||||||
==================
|
==================
|
||||||
A set data type has as its domain unordered collections of like elements. The set data type is
|
A set data type has as its domain unordered collections of like elements. The set data type is
|
||||||
a specialization of the bag data type. The optional lower and upper bounds, which are integer-
|
a specialization of the bag data type. The optional lower and upper bounds, which are integer-
|
||||||
valued expressions, dene the minimum and maximum number of elements that can be held in
|
valued expressions, define the minimum and maximum number of elements that can be held in
|
||||||
the collection dened by a set data type. The collection dened by set data type shall not
|
the collection defined by a set data type. The collection defined by set data type shall not
|
||||||
contain two or more elements which are instance equal.
|
contain two or more elements which are instance equal.
|
||||||
Syntax:
|
Syntax:
|
||||||
285 set_type = SET [ bound_spec ] OF base_type .
|
285 set_type = SET [ bound_spec ] OF base_type .
|
||||||
|
|
@ -509,14 +509,14 @@ class SET(BaseType.Type, BaseType.Aggregate):
|
||||||
If this value is indeterminate (?) the number of elements in a set value of this data type is
|
If this value is indeterminate (?) the number of elements in a set value of this data type is
|
||||||
not be bounded from above.
|
not be bounded from above.
|
||||||
c) If the bound_spec is omitted, the limits are [0:?].
|
c) If the bound_spec is omitted, the limits are [0:?].
|
||||||
d) Each element in an occurrence of a set data type shall be dierent from (i.e., not
|
d) Each element in an occurrence of a set data type shall be different from (i.e., not
|
||||||
instance equal to) every other element in the same set value.
|
instance equal to) every other element in the same set value.
|
||||||
EXAMPLE 30 { This example denes an attribute as a set of points (a named data type assumed
|
EXAMPLE 30 { This example defines an attribute as a set of points (a named data type assumed
|
||||||
to have been declared elsewhere).
|
to have been declared elsewhere).
|
||||||
a_set_of_points : SET OF point;
|
a_set_of_points : SET OF point;
|
||||||
The attribute named a_set_of_points can contain zero or more points. Each point instance (in
|
The attribute named a_set_of_points can contain zero or more points. Each point instance (in
|
||||||
the set value) is required to be dierent from every other point in the set.
|
the set value) is required to be different from every other point in the set.
|
||||||
If the value is required to have no more than 15 points, the specication can provide an upper bound,
|
If the value is required to have no more than 15 points, the specification can provide an upper bound,
|
||||||
as in:
|
as in:
|
||||||
a_set_of_points : SET [0:15] OF point;
|
a_set_of_points : SET [0:15] OF point;
|
||||||
The value of the attribute named a_set_of_points now may contain no more than 15 points.
|
The value of the attribute named a_set_of_points now may contain no more than 15 points.
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ CONST_E = REAL(math.pi)
|
||||||
#14.2 Indeterminate
|
#14.2 Indeterminate
|
||||||
#The indeterminate symbol (?) stands for an ambiguous value. It is compatible with all data
|
#The indeterminate symbol (?) stands for an ambiguous value. It is compatible with all data
|
||||||
#types.
|
#types.
|
||||||
#NOTE - The most common use of indeterminate (?) is as the upper bound specication of a bag,
|
#NOTE - The most common use of indeterminate (?) is as the upper bound specification of a bag,
|
||||||
#list or set. This usage represents the notion that the size of the aggregate value dened by the
|
#list or set. This usage represents the notion that the size of the aggregate value defined by the
|
||||||
#aggregation data type is unbounded.
|
#aggregation data type is unbounded.
|
||||||
# python note: indeterminate value is mapped to None in aggregate bounds
|
# python note: indeterminate value is mapped to None in aggregate bounds
|
||||||
|
|
||||||
|
|
@ -65,7 +65,7 @@ FALSE = False
|
||||||
# EXPRESS definition:
|
# EXPRESS definition:
|
||||||
# ===================
|
# ===================
|
||||||
#14.4 Pi
|
#14.4 Pi
|
||||||
#PI is a REAL constant representing the mathematical value , the ratio of a circle's circumference
|
#PI is a REAL constant representing the mathematical value π, the ratio of a circle's circumference
|
||||||
#to its diameter.
|
#to its diameter.
|
||||||
PI = REAL(math.pi)
|
PI = REAL(math.pi)
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ PI = REAL(math.pi)
|
||||||
#14.5 Self
|
#14.5 Self
|
||||||
#SELF refers to the current entity instance or type value. self may appear within an entity
|
#SELF refers to the current entity instance or type value. self may appear within an entity
|
||||||
#declaration, a type declaration or an entity constructor.
|
#declaration, a type declaration or an entity constructor.
|
||||||
#NOTE - sSELF is not a constant, but behaves as one in every context in which it can appear.
|
#NOTE - SELF is not a constant, but behaves as one in every context in which it can appear.
|
||||||
# python note: SELF is not mapped to any constant, but is mapper to self
|
# python note: SELF is not mapped to any constant, but is mapper to self
|
||||||
|
|
||||||
# EXPRESS definition:
|
# EXPRESS definition:
|
||||||
|
|
@ -87,7 +87,7 @@ TRUE = True
|
||||||
# EXPRESS definition:
|
# EXPRESS definition:
|
||||||
# ===================
|
# ===================
|
||||||
#14.7 Unknown
|
#14.7 Unknown
|
||||||
#unknown is a logical constant representing that there is insucient information available to
|
#unknown is a logical constant representing that there is insufficient information available to
|
||||||
#be able to evaluate a logical condition. It is compatible with the logical data type, but not
|
#be able to evaluate a logical condition. It is compatible with the logical data type, but not
|
||||||
#with the boolean data type.
|
#with the boolean data type.
|
||||||
# @TODO: define UNKNOWN in python
|
# @TODO: define UNKNOWN in python
|
||||||
|
|
@ -122,7 +122,7 @@ def ABS(V):
|
||||||
#FUNCTION ACOS ( V:NUMBER ) : REAL;
|
#FUNCTION ACOS ( V:NUMBER ) : REAL;
|
||||||
#The acos function returns the angle given a cosine value.
|
#The acos function returns the angle given a cosine value.
|
||||||
#Parameters : V is a number which is the cosine of an angle.
|
#Parameters : V is a number which is the cosine of an angle.
|
||||||
#Result : The angle in radians (0 result ) whose cosine is V.
|
#Result : The angle in radians (0 <= result <= pi) whose cosine is V.
|
||||||
#Conditions : -1.0=<V<=1.0
|
#Conditions : -1.0=<V<=1.0
|
||||||
#EXAMPLE 126 { ACOS ( 0.3 ) --> 1.266103...
|
#EXAMPLE 126 { ACOS ( 0.3 ) --> 1.266103...
|
||||||
# Python definition:
|
# Python definition:
|
||||||
|
|
@ -149,7 +149,7 @@ def ASIN(V):
|
||||||
#a) V1 is a number.
|
#a) V1 is a number.
|
||||||
#b) V2 is a number.
|
#b) V2 is a number.
|
||||||
#Result : The angle in radians (-pi/2<=result<=pi/2) whose tangent is V. If V2 is zero, the result
|
#Result : The angle in radians (-pi/2<=result<=pi/2) whose tangent is V. If V2 is zero, the result
|
||||||
#is pi/2 or -pi/2 depending on the sign of V1.
|
#is pi/2 or -pi/2 depending on the sign of V1.
|
||||||
#Conditions : Both V1 and V2 shall not be zero.
|
#Conditions : Both V1 and V2 shall not be zero.
|
||||||
#EXAMPLE 128 { ATAN ( -5.5, 3.0 ) --> -1.071449...
|
#EXAMPLE 128 { ATAN ( -5.5, 3.0 ) --> -1.071449...
|
||||||
def ATAN(V1,V2):
|
def ATAN(V1,V2):
|
||||||
|
|
@ -197,7 +197,7 @@ def BLENGTH(V):
|
||||||
#FUNCTION SIN ( V:NUMBER ) : REAL;
|
#FUNCTION SIN ( V:NUMBER ) : REAL;
|
||||||
#The sin function returns the sine of an angle.
|
#The sin function returns the sine of an angle.
|
||||||
#Parameters : V is a number representing an angle expressed in radians.
|
#Parameters : V is a number representing an angle expressed in radians.
|
||||||
#Result : The sine of V (-1.0 result 1.0).
|
#Result : The sine of V (-1.0 <= result <= 1.0).
|
||||||
#EXAMPLE 144 { SIN ( PI ) --> 0.0
|
#EXAMPLE 144 { SIN ( PI ) --> 0.0
|
||||||
#
|
#
|
||||||
def COS(V):
|
def COS(V):
|
||||||
|
|
@ -487,14 +487,14 @@ def ODD(V):
|
||||||
# ===================
|
# ===================
|
||||||
#15.20 RolesOf - general function
|
#15.20 RolesOf - general function
|
||||||
#FUNCTION ROLESOF ( V:GENERIC ) : SET OF STRING;
|
#FUNCTION ROLESOF ( V:GENERIC ) : SET OF STRING;
|
||||||
#The rolesof function returns a set of strings containing the fully qualied names of the roles
|
#The rolesof function returns a set of strings containing the fully qualified names of the roles
|
||||||
#played by the specied entity instance. A fully qualied name is dened to be the name of the
|
#played by the specified entity instance. A fully qualified name is defined to be the name of the
|
||||||
#attribute qualied by the name of the schema and entity in which this attribute is declared (i.e.
|
#attribute qualified by the name of the schema and entity in which this attribute is declared (i.e.
|
||||||
#'SCHEMA.ENTITY.ATTRIBUTE').
|
#'SCHEMA.ENTITY.ATTRIBUTE').
|
||||||
#Parameters : V is any instance of an entity data type.
|
#Parameters : V is any instance of an entity data type.
|
||||||
#Result : A set of string values (in upper case) containing the fully qualied names of the
|
#Result : A set of string values (in upper case) containing the fully qualified names of the
|
||||||
#attributes of the entity instances which use the instance V.
|
#attributes of the entity instances which use the instance V.
|
||||||
#When a named data type is use'd or reference'd, the schema and the name in that schema,
|
#When a named data type is used or referenced, the schema and the name in that schema,
|
||||||
#if renamed, are also returned. Since use statements may be chained, all the chained schema
|
#if renamed, are also returned. Since use statements may be chained, all the chained schema
|
||||||
#names and the name in each schema are returned.
|
#names and the name in each schema are returned.
|
||||||
#EXAMPLE 143 { This example shows that a point might be used as the centre of a circle. The
|
#EXAMPLE 143 { This example shows that a point might be used as the centre of a circle. The
|
||||||
|
|
@ -567,7 +567,7 @@ def SIZEOF(V):
|
||||||
#The sqrt function returns the non-negative square root of a number.
|
#The sqrt function returns the non-negative square root of a number.
|
||||||
#Parameters : V is any non-negative number.
|
#Parameters : V is any non-negative number.
|
||||||
#Result : The non-negative square root of V.
|
#Result : The non-negative square root of V.
|
||||||
#Conditions : V 0:0
|
#Conditions : V >= 0:0
|
||||||
#EXAMPLE 146 - SQRT ( 121 ) --> 11.0
|
#EXAMPLE 146 - SQRT ( 121 ) --> 11.0
|
||||||
def SQRT(V):
|
def SQRT(V):
|
||||||
if not isinstance(V,NUMBER):
|
if not isinstance(V,NUMBER):
|
||||||
|
|
@ -602,16 +602,16 @@ def TAN(V):
|
||||||
#The typeof function returns a set of strings that contains the names of all the data types
|
#The typeof function returns a set of strings that contains the names of all the data types
|
||||||
#of which the parameter is a member. Except for the simple data types (binary, boolean,
|
#of which the parameter is a member. Except for the simple data types (binary, boolean,
|
||||||
#integer, logical, number, real, and string) and the aggregation data types (array, bag,
|
#integer, logical, number, real, and string) and the aggregation data types (array, bag,
|
||||||
#list, set) these names are qualied by the name of the schema which contains the denition of
|
#list, set) these names are qualified by the name of the schema which contains the definition of
|
||||||
#the type.
|
#the type.
|
||||||
#NOTE 1 { The primary purpose of this function is to check whether a given value (variable, at-
|
#NOTE 1 { The primary purpose of this function is to check whether a given value (variable, at-
|
||||||
#tribute value) can be used for a certain purpose, e.g. to ensure assignment compatibility between
|
#tribute value) can be used for a certain purpose, e.g. to ensure assignment compatibility between
|
||||||
#two values. It may also be used if dierent subtypes or specializations of a given type have to be
|
#two values. It may also be used if different subtypes or specializations of a given type have to be
|
||||||
#treated dierently in some context.
|
#treated differently in some context.
|
||||||
#Parameters : V is a value of any type.
|
#Parameters : V is a value of any type.
|
||||||
#Result : The contents of the returned set of string values are the names (in upper case) of all
|
#Result : The contents of the returned set of string values are the names (in upper case) of all
|
||||||
#types the value V is a member of. Such names are qualied by the name of the schema which
|
#types the value V is a member of. Such names are qualified by the name of the schema which
|
||||||
#contains the denition of the type ('SCHEMA.TYPE') if it is neither a simple data type nor an
|
#contains the definition of the type ('SCHEMA.TYPE') if it is neither a simple data type nor an
|
||||||
#aggregation data type. It may be derived by the following algorithm (which is given here for
|
#aggregation data type. It may be derived by the following algorithm (which is given here for
|
||||||
#specification purposes rather than to prescribe any particular type of implementation)
|
#specification purposes rather than to prescribe any particular type of implementation)
|
||||||
def TYPEOF(V):
|
def TYPEOF(V):
|
||||||
|
|
@ -636,8 +636,8 @@ def TYPEOF(V):
|
||||||
# ===================
|
# ===================
|
||||||
#15.26 UsedIn - general function
|
#15.26 UsedIn - general function
|
||||||
#FUNCTION USEDIN ( T:GENERIC; R:STRING) : BAG OF GENERIC;
|
#FUNCTION USEDIN ( T:GENERIC; R:STRING) : BAG OF GENERIC;
|
||||||
#The usedin function returns each entity instance that uses a specied entity instance in a
|
#The usedin function returns each entity instance that uses a specified entity instance in a
|
||||||
#specied role.
|
#specified role.
|
||||||
def USEDIN(T,R):
|
def USEDIN(T,R):
|
||||||
raise NotImplemented("USEDIN function not yet implemented.")
|
raise NotImplemented("USEDIN function not yet implemented.")
|
||||||
|
|
||||||
|
|
@ -654,8 +654,8 @@ def USEDIN(T,R):
|
||||||
#VALUE ( 'abc' ) --> ? null
|
#VALUE ( 'abc' ) --> ? null
|
||||||
def VALUE(V):
|
def VALUE(V):
|
||||||
if not isinstance(V,STRING):
|
if not isinstance(V,STRING):
|
||||||
raise TypeError("VALULE function takes a NUMBER parameter")
|
raise TypeError("VALUE function takes a NUMBER parameter")
|
||||||
# first try to instanciate an INTEGER from the string:
|
# first try to instantiate an INTEGER from the string:
|
||||||
try:
|
try:
|
||||||
return INTEGER(V)
|
return INTEGER(V)
|
||||||
except:
|
except:
|
||||||
|
|
@ -691,7 +691,7 @@ def VALUE(V):
|
||||||
def VALUE_IN(C,V):
|
def VALUE_IN(C,V):
|
||||||
if not isinstance(C,Aggregate):
|
if not isinstance(C,Aggregate):
|
||||||
raise TypeError("VALUE_IN method takes an aggregate as first parameter")
|
raise TypeError("VALUE_IN method takes an aggregate as first parameter")
|
||||||
raise NotImplemented("VALUE_IN function not et implemented")
|
raise NotImplemented("VALUE_IN function not yet implemented")
|
||||||
|
|
||||||
# EXPRESS definition:
|
# EXPRESS definition:
|
||||||
# ===================
|
# ===================
|
||||||
|
|
@ -705,8 +705,8 @@ def VALUE_IN(C,V):
|
||||||
#b) If any any two elements of V are value equal, false is returned.
|
#b) If any any two elements of V are value equal, false is returned.
|
||||||
#c) If any element of V is indeterminate (?), unknown is returned.
|
#c) If any element of V is indeterminate (?), unknown is returned.
|
||||||
#d) Otherwise true is returned.
|
#d) Otherwise true is returned.
|
||||||
#EXAMPLE 153 { The following test ensures tht each point is a set is at a dierent position, (by
|
#EXAMPLE 153 { The following test ensures that each point is placed at a different position, (by
|
||||||
#denition they are distinct, i.e., instance unique).
|
#definition they are distinct, i.e., instance unique).
|
||||||
#IF VALUE_UNIQUE(points) THEN ...
|
#IF VALUE_UNIQUE(points) THEN ...
|
||||||
def VALUE_UNIQUE(V):
|
def VALUE_UNIQUE(V):
|
||||||
if not isinstance(V,Aggregate):
|
if not isinstance(V,Aggregate):
|
||||||
|
|
|
||||||
|
|
@ -30,19 +30,10 @@
|
||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
from enum import Enum
|
||||||
import BaseType
|
import BaseType
|
||||||
|
|
||||||
class EnumerationId(object):
|
class ENUMERATION(Enum):
|
||||||
"""
|
|
||||||
EXPRESS definition:
|
|
||||||
===================
|
|
||||||
An enumeration data type has as its domain an ordered set of names. The names represent
|
|
||||||
values of the enumeration data type. These names are designated by enumeration_ids and are
|
|
||||||
referred to as enumeration items.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
class ENUMERATION(object):
|
|
||||||
"""
|
"""
|
||||||
EXPRESS definition:
|
EXPRESS definition:
|
||||||
===================
|
===================
|
||||||
|
|
@ -57,51 +48,17 @@ class ENUMERATION(object):
|
||||||
(ahead,
|
(ahead,
|
||||||
behind);
|
behind);
|
||||||
END_TYPE; -- ahead_or_behind
|
END_TYPE; -- ahead_or_behind
|
||||||
|
|
||||||
is implemented in python with the line:
|
|
||||||
>>> ahead_of_behind = ENUMERATION('ahead','behind', the_current_scope)
|
|
||||||
>>> ahead_or_behind.ahead
|
|
||||||
>>> ahead_of_behind.behind
|
|
||||||
|
|
||||||
And, if and only if ahead and/or behind are not in scope (e.g. they are not entity names,
|
|
||||||
and/or many enums define the same enumeration identifier):
|
|
||||||
>>> ahead
|
|
||||||
>>> behind
|
|
||||||
"""
|
|
||||||
def __init__(self,*kargs,**args):
|
|
||||||
# first defining the scope
|
|
||||||
if args.has_key('scope'):
|
|
||||||
self._scope = args['scope']
|
|
||||||
else:
|
|
||||||
self._scope = None
|
|
||||||
# store passed enum identifiers
|
|
||||||
self._enum_id_names = list(kargs)
|
|
||||||
self._enum_ids = []
|
|
||||||
# we create enums id from names, and create attributes
|
|
||||||
# for instance, from the identifier name 'ahead',
|
|
||||||
# we create an attribute ahead with which is a new
|
|
||||||
# instance of EnumerationId
|
|
||||||
for enum_id_name in self._enum_id_names:
|
|
||||||
setattr(self,enum_id_name,EnumerationId())
|
|
||||||
# we store this new attributes to the enum_ids list, which
|
|
||||||
# will be accessed by the type checker with the get_enum_ids method
|
|
||||||
self._enum_ids.append(self.__getattribute__(enum_id_name))
|
|
||||||
#
|
|
||||||
# Then we check if the enums names can be added to the current scope:
|
|
||||||
# if the name is already in the scope, then another enums id or select
|
|
||||||
# has the same name -> we do nothing, enums will be called
|
|
||||||
# with ahead_of_behind.ahead or ahead_or_behind.behind.
|
|
||||||
# otherwise, they can be called as only ahead or behind
|
|
||||||
# Note: since ENUMERATIONS are defined *before* entities, if an entity
|
|
||||||
# has the same name as an enum id, it will replace it in the current scope.
|
|
||||||
#
|
|
||||||
for enum_id_name in self._enum_id_names:
|
|
||||||
if not vars(self._scope).has_key(enum_id_name):
|
|
||||||
vars(self._scope)[enum_id_name] = self.__getattribute__(enum_id_name)
|
|
||||||
|
|
||||||
def get_enum_ids(self):
|
Scoping and visibility of ENUMERATIONS is similar in EXPRESS and Python
|
||||||
return self._enum_ids
|
|
||||||
|
Enum implemented as per Standard Library / PEP 435
|
||||||
|
>>> ahead_or_behind = ENUMERATION('ahead_or_behind', 'ahead behind')
|
||||||
|
>>> race_position = ahead_or_behind.ahead
|
||||||
|
>>> if race_position == ahead_or_behind.ahead:
|
||||||
|
... # do stuff!
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
class SELECT(object):
|
class SELECT(object):
|
||||||
""" A select data type has as its domain the union of the domains of the named data types in
|
""" A select data type has as its domain the union of the domains of the named data types in
|
||||||
its select list. The select data type is a generalization of each of the named data types in its
|
its select list. The select data type is a generalization of each of the named data types in its
|
||||||
|
|
|
||||||
|
|
@ -34,34 +34,52 @@
|
||||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import ply.lex as lex
|
import ply.lex as lex
|
||||||
import ply.yacc as yacc
|
import ply.yacc as yacc
|
||||||
|
from ply.lex import LexError
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# ensure Python 2.6 compatibility
|
||||||
|
if not hasattr(logging, 'NullHandler'):
|
||||||
|
class NullHandler(logging.Handler):
|
||||||
|
def handle(self, record):
|
||||||
|
pass
|
||||||
|
def emit(self, record):
|
||||||
|
pass
|
||||||
|
def createLock(self):
|
||||||
|
self.lock = None
|
||||||
|
|
||||||
|
setattr(logging, 'NullHandler', NullHandler)
|
||||||
|
|
||||||
logger.addHandler(logging.NullHandler())
|
logger.addHandler(logging.NullHandler())
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Common Code for Lexer / Parser
|
# Common Code for Lexer / Parser
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
class Base:
|
base_tokens = ['INTEGER', 'REAL', 'USER_DEFINED_KEYWORD', 'STANDARD_KEYWORD', 'STRING', 'BINARY',
|
||||||
tokens = ('INTEGER', 'REAL', 'USER_DEFINED_KEYWORD', 'STANDARD_KEYWORD', 'STRING', 'BINARY',
|
'ENTITY_INSTANCE_NAME', 'ENUMERATION', 'PART21_END', 'PART21_START', 'HEADER_SEC',
|
||||||
'ENTITY_INSTANCE_NAME', 'ENUMERATION', 'PART21_END', 'PART21_START', 'HEADER_SEC',
|
'ENDSEC', 'DATA']
|
||||||
'ENDSEC', 'DATA_SEC')
|
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Lexer
|
# Lexer
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
class Lexer(Base):
|
class Lexer(object):
|
||||||
def __init__(self, debug=0, optimize=0, compatibility_mode=False, header_limit=1024):
|
tokens = list(base_tokens)
|
||||||
self.lexer = lex.lex(module=self, debug=debug, debuglog=logger, optimize=optimize,
|
states = (('slurp', 'exclusive'),)
|
||||||
errorlog=logger)
|
|
||||||
self.entity_keywords = []
|
def __init__(self, debug=0, optimize=0, compatibility_mode=False, header_limit=4096):
|
||||||
|
self.base_tokens = list(base_tokens)
|
||||||
|
self.schema_dict = {}
|
||||||
|
self.active_schema = {}
|
||||||
|
self.input_length = 0
|
||||||
self.compatibility_mode = compatibility_mode
|
self.compatibility_mode = compatibility_mode
|
||||||
self.header_limit = header_limit
|
self.header_limit = header_limit
|
||||||
|
self.lexer = lex.lex(module=self, debug=debug, debuglog=logger, optimize=optimize,
|
||||||
states = (('compatibility', 'inclusive'),)
|
errorlog=logger)
|
||||||
|
self.reset()
|
||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
if name == 'lineno':
|
if name == 'lineno':
|
||||||
|
|
@ -72,80 +90,118 @@ class Lexer(Base):
|
||||||
raise AttributeError
|
raise AttributeError
|
||||||
|
|
||||||
def input(self, s):
|
def input(self, s):
|
||||||
startidx = s.find('ISO-10303-21;', 0, self.header_limit)
|
self.lexer.input(s)
|
||||||
if startidx == -1:
|
self.input_length += len(s)
|
||||||
sys.exit('Aborting... ISO-10303-21; header not found')
|
|
||||||
self.lexer.input(s[startidx:])
|
|
||||||
self.lexer.lineno += s[0:startidx].count('\n')
|
|
||||||
|
|
||||||
if self.compatibility_mode:
|
def reset(self):
|
||||||
self.lexer.begin('compatibility')
|
self.lexer.lineno = 1
|
||||||
else:
|
self.lexer.begin('slurp')
|
||||||
self.lexer.begin('INITIAL')
|
|
||||||
|
|
||||||
def token(self):
|
def token(self):
|
||||||
try:
|
try:
|
||||||
return next(self.lexer)
|
return next(self.lexer)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def register_entities(self, entities):
|
def activate_schema(self, schema_name):
|
||||||
self.entity_keywords.extend(entities)
|
if schema_name in self.schema_dict:
|
||||||
|
self.active_schema = self.schema_dict[schema_name]
|
||||||
|
else:
|
||||||
|
raise ValueError('schema not registered')
|
||||||
|
|
||||||
|
def register_schema(self, schema_name, entities):
|
||||||
|
if schema_name in self.schema_dict:
|
||||||
|
raise ValueError('schema already registered')
|
||||||
|
|
||||||
|
for k in entities:
|
||||||
|
if k in self.base_tokens: raise ValueError('schema cannot override base_tokens')
|
||||||
|
|
||||||
|
if isinstance(entities, list):
|
||||||
|
entities = dict((k, k) for k in entities)
|
||||||
|
|
||||||
|
self.schema_dict[schema_name] = entities
|
||||||
|
|
||||||
|
def t_slurp_PART21_START(self, t):
|
||||||
|
r'ISO-10303-21;'
|
||||||
|
t.lexer.begin('INITIAL')
|
||||||
|
return t
|
||||||
|
|
||||||
|
def t_slurp_error(self, t):
|
||||||
|
offset = t.value.find('\nISO-10303-21;', 0, self.header_limit)
|
||||||
|
if offset == -1 and self.header_limit < len(t.value): # not found within header_limit
|
||||||
|
raise LexError("Scanning error. try increasing lexer header_limit parameter",
|
||||||
|
"{0}...".format(t.value[0:20]))
|
||||||
|
elif offset == -1: # not found before EOF
|
||||||
|
t.lexer.lexpos = self.input_length
|
||||||
|
else: # found ISO-10303-21;
|
||||||
|
offset += 1 # also skip the \n
|
||||||
|
t.lexer.lineno += t.value[0:offset].count('\n')
|
||||||
|
t.lexer.skip(offset)
|
||||||
|
|
||||||
# Comment (ignored)
|
# Comment (ignored)
|
||||||
def t_ANY_COMMENT(self, t):
|
def t_COMMENT(self, t):
|
||||||
r'/\*(.|\n)*?\*/'
|
r'/\*(.|\n)*?\*/'
|
||||||
t.lexer.lineno += t.value.count('\n')
|
t.lexer.lineno += t.value.count('\n')
|
||||||
|
|
||||||
def t_ANY_PART21_START(self, t):
|
def t_PART21_END(self, t):
|
||||||
r'ISO-10303-21;'
|
|
||||||
return t
|
|
||||||
|
|
||||||
def t_ANY_PART21_END(self, t):
|
|
||||||
r'END-ISO-10303-21;'
|
r'END-ISO-10303-21;'
|
||||||
|
t.lexer.begin('slurp')
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def t_ANY_HEADER_SEC(self, t):
|
def t_HEADER_SEC(self, t):
|
||||||
r'HEADER;'
|
r'HEADER;'
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def t_ANY_ENDSEC(self, t):
|
def t_ENDSEC(self, t):
|
||||||
r'ENDSEC;'
|
r'ENDSEC;'
|
||||||
return t
|
return t
|
||||||
|
|
||||||
# Keywords
|
# Keywords
|
||||||
def t_compatibility_STANDARD_KEYWORD(self, t):
|
def t_STANDARD_KEYWORD(self, t):
|
||||||
r'(?:!|)[A-Z_][0-9A-Za-z_]*'
|
r'(?:!|)[A-Za-z_][0-9A-Za-z_]*'
|
||||||
t.value = t.value.upper()
|
if self.compatibility_mode:
|
||||||
if t.value == 'DATA':
|
t.value = t.value.upper()
|
||||||
t.type = 'DATA_SEC'
|
elif not t.value.isupper():
|
||||||
|
raise LexError('Scanning error. Mixed/lower case keyword detected, please use compatibility_mode=True', t.value)
|
||||||
|
|
||||||
|
if t.value in self.base_tokens:
|
||||||
|
t.type = t.value
|
||||||
|
elif t.value in self.active_schema:
|
||||||
|
t.type = self.active_schema[t.value]
|
||||||
elif t.value.startswith('!'):
|
elif t.value.startswith('!'):
|
||||||
t.type = 'USER_DEFINED_KEYWORD'
|
t.type = 'USER_DEFINED_KEYWORD'
|
||||||
elif t.value in self.entity_keywords:
|
|
||||||
t.type = t.value
|
|
||||||
return t
|
return t
|
||||||
|
|
||||||
def t_ANY_STANDARD_KEYWORD(self, t):
|
def t_newline(self, t):
|
||||||
r'(?:!|)[A-Z_][0-9A-Z_]*'
|
|
||||||
if t.value == 'DATA':
|
|
||||||
t.type = 'DATA_SEC'
|
|
||||||
elif t.value.startswith('!'):
|
|
||||||
t.type = 'USER_DEFINED_KEYWORD'
|
|
||||||
elif t.value in self.entity_keywords:
|
|
||||||
t.type = t.value
|
|
||||||
return t
|
|
||||||
|
|
||||||
def t_ANY_newline(self, t):
|
|
||||||
r'\n+'
|
r'\n+'
|
||||||
t.lexer.lineno += len(t.value)
|
t.lexer.lineno += len(t.value)
|
||||||
|
|
||||||
# Simple Data Types
|
# Simple Data Types
|
||||||
t_ANY_REAL = r'[+-]*[0-9][0-9]*\.[0-9]*(?:E[+-]*[0-9][0-9]*)?'
|
def t_REAL(self, t):
|
||||||
t_ANY_INTEGER = r'[+-]*[0-9][0-9]*'
|
r'[+-]*[0-9][0-9]*\.[0-9]*(?:E[+-]*[0-9][0-9]*)?'
|
||||||
t_ANY_STRING = r"'(?:[][!\"*$%&.#+,\-()?/:;<=>@{}|^`~0-9a-zA-Z_\\ ]|'')*'"
|
t.value = float(t.value)
|
||||||
t_ANY_BINARY = r'"[0-3][0-9A-F]*"'
|
return t
|
||||||
t_ANY_ENTITY_INSTANCE_NAME = r'\#[0-9]+'
|
|
||||||
t_ANY_ENUMERATION = r'\.[A-Z_][A-Z0-9_]*\.'
|
def t_INTEGER(self, t):
|
||||||
|
r'[+-]*[0-9][0-9]*'
|
||||||
|
t.value = int(t.value)
|
||||||
|
return t
|
||||||
|
|
||||||
|
def t_STRING(self, t):
|
||||||
|
r"'(?:[][!\"*$%&.#+,\-()?/:;<=>@{}|^`~0-9a-zA-Z_\\ ]|'')*'"
|
||||||
|
t.value = t.value[1:-1]
|
||||||
|
return t
|
||||||
|
|
||||||
|
def t_BINARY(self, t):
|
||||||
|
r'"[0-3][0-9A-F]*"'
|
||||||
|
try:
|
||||||
|
t.value = int(t.value[2:-1], base=16)
|
||||||
|
except ValueError:
|
||||||
|
t.value = None
|
||||||
|
return t
|
||||||
|
|
||||||
|
t_ENTITY_INSTANCE_NAME = r'\#[0-9]+'
|
||||||
|
t_ENUMERATION = r'\.[A-Z_][A-Z0-9_]*\.'
|
||||||
|
|
||||||
# Punctuation
|
# Punctuation
|
||||||
literals = '()=;,*$'
|
literals = '()=;,*$'
|
||||||
|
|
@ -171,7 +227,7 @@ class P21Header:
|
||||||
class HeaderEntity:
|
class HeaderEntity:
|
||||||
def __init__(self, type_name, *params):
|
def __init__(self, type_name, *params):
|
||||||
self.type_name = type_name
|
self.type_name = type_name
|
||||||
self.params = list(*params) if params else []
|
self.params = list(params) if params else []
|
||||||
|
|
||||||
class Section:
|
class Section:
|
||||||
def __init__(self, entities):
|
def __init__(self, entities):
|
||||||
|
|
@ -181,43 +237,64 @@ class SimpleEntity:
|
||||||
def __init__(self, ref, type_name, *params):
|
def __init__(self, ref, type_name, *params):
|
||||||
self.ref = ref
|
self.ref = ref
|
||||||
self.type_name = type_name
|
self.type_name = type_name
|
||||||
self.params = list(*params) if params else []
|
self.params = list(params) if params else []
|
||||||
|
|
||||||
class ComplexEntity:
|
class ComplexEntity:
|
||||||
def __init__(self, ref, *params):
|
def __init__(self, ref, *params):
|
||||||
self.ref = ref
|
self.ref = ref
|
||||||
self.params = list(*params) if params else []
|
self.params = list(params) if params else []
|
||||||
|
|
||||||
class TypedParameter:
|
class TypedParameter:
|
||||||
def __init__(self, type_name, *params):
|
def __init__(self, type_name, *params):
|
||||||
self.type_name = type_name
|
self.type_name = type_name
|
||||||
self.params = list(*params) if params else None
|
self.params = list(params) if params else None
|
||||||
|
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
# Parser
|
# Parser
|
||||||
####################################################################################################
|
####################################################################################################
|
||||||
class Parser(Base):
|
class Parser(object):
|
||||||
|
tokens = list(base_tokens)
|
||||||
|
start = 'exchange_file'
|
||||||
|
|
||||||
def __init__(self, lexer=None, debug=0):
|
def __init__(self, lexer=None, debug=0):
|
||||||
|
self.lexer = lexer if lexer else Lexer()
|
||||||
|
|
||||||
|
try: self.tokens = lexer.tokens
|
||||||
|
except AttributeError: pass
|
||||||
|
|
||||||
self.parser = yacc.yacc(module=self, debug=debug, debuglog=logger, errorlog=logger)
|
self.parser = yacc.yacc(module=self, debug=debug, debuglog=logger, errorlog=logger)
|
||||||
|
self.reset()
|
||||||
if lexer is None:
|
|
||||||
lexer = Lexer()
|
|
||||||
self.lexer = lexer
|
|
||||||
|
|
||||||
def parse(self, p21_data, **kwargs):
|
def parse(self, p21_data, **kwargs):
|
||||||
|
#TODO: will probably need to change this function if the lexer is ever to support t_eof
|
||||||
|
self.lexer.reset()
|
||||||
self.lexer.input(p21_data)
|
self.lexer.input(p21_data)
|
||||||
self.refs = {}
|
|
||||||
if 'debug' in kwargs:
|
if 'debug' in kwargs:
|
||||||
result = self.parser.parse(lexer=self.lexer, debug=logger,
|
result = self.parser.parse(lexer=self.lexer, debug=logger,
|
||||||
**{ k: kwargs[k] for k in kwargs if k != 'debug'})
|
** dict((k, v) for k, v in kwargs.iteritems() if k != 'debug'))
|
||||||
else:
|
else:
|
||||||
result = self.parser.parse(lexer=self.lexer, **kwargs)
|
result = self.parser.parse(lexer=self.lexer, **kwargs)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self.refs = {}
|
||||||
|
self.is_in_exchange_structure = False
|
||||||
|
|
||||||
def p_exchange_file(self, p):
|
def p_exchange_file(self, p):
|
||||||
"""exchange_file : PART21_START header_section data_section_list PART21_END"""
|
"""exchange_file : check_p21_start_token header_section data_section_list check_p21_end_token"""
|
||||||
p[0] = P21File(p[2], p[3])
|
p[0] = P21File(p[2], p[3])
|
||||||
|
|
||||||
|
def p_check_start_token(self, p):
|
||||||
|
"""check_p21_start_token : PART21_START"""
|
||||||
|
self.is_in_exchange_structure = True
|
||||||
|
p[0] = p[1]
|
||||||
|
|
||||||
|
def p_check_end_token(self, p):
|
||||||
|
"""check_p21_end_token : PART21_END"""
|
||||||
|
self.is_in_exchange_structure = False
|
||||||
|
p[0] = p[1]
|
||||||
|
|
||||||
# TODO: Specialise the first 3 header entities
|
# TODO: Specialise the first 3 header entities
|
||||||
def p_header_section(self, p):
|
def p_header_section(self, p):
|
||||||
"""header_section : HEADER_SEC header_entity header_entity header_entity ENDSEC"""
|
"""header_section : HEADER_SEC header_entity header_entity header_entity ENDSEC"""
|
||||||
|
|
@ -235,8 +312,8 @@ class Parser(Base):
|
||||||
def p_check_entity_instance_name(self, p):
|
def p_check_entity_instance_name(self, p):
|
||||||
"""check_entity_instance_name : ENTITY_INSTANCE_NAME"""
|
"""check_entity_instance_name : ENTITY_INSTANCE_NAME"""
|
||||||
if p[1] in self.refs:
|
if p[1] in self.refs:
|
||||||
logger.error('Line %i, duplicate entity instance name: %s', p.lineno(1), p[1])
|
logger.error('Line: {0}, SyntaxError - Duplicate Entity Instance Name: {1}'.format(p.lineno(1), p[1]))
|
||||||
sys.exit('Aborting...')
|
raise SyntaxError
|
||||||
else:
|
else:
|
||||||
self.refs[p[1]] = None
|
self.refs[p[1]] = None
|
||||||
p[0] = p[1]
|
p[0] = p[1]
|
||||||
|
|
@ -245,6 +322,11 @@ class Parser(Base):
|
||||||
"""simple_entity_instance : check_entity_instance_name '=' simple_record ';'"""
|
"""simple_entity_instance : check_entity_instance_name '=' simple_record ';'"""
|
||||||
p[0] = SimpleEntity(p[1], *p[3])
|
p[0] = SimpleEntity(p[1], *p[3])
|
||||||
|
|
||||||
|
def p_entity_instance_error(self, p):
|
||||||
|
"""simple_entity_instance : error '=' simple_record ';'
|
||||||
|
complex_entity_instance : error '=' subsuper_record ';'"""
|
||||||
|
pass
|
||||||
|
|
||||||
def p_complex_entity_instance(self, p):
|
def p_complex_entity_instance(self, p):
|
||||||
"""complex_entity_instance : check_entity_instance_name '=' subsuper_record ';'"""
|
"""complex_entity_instance : check_entity_instance_name '=' subsuper_record ';'"""
|
||||||
p[0] = ComplexEntity(p[1], p[3])
|
p[0] = ComplexEntity(p[1], p[3])
|
||||||
|
|
@ -302,12 +384,12 @@ class Parser(Base):
|
||||||
p[0] = []
|
p[0] = []
|
||||||
|
|
||||||
def p_data_start(self, p):
|
def p_data_start(self, p):
|
||||||
"""data_start : DATA_SEC '(' parameter_list ')' ';'"""
|
"""data_start : DATA '(' parameter_list ')' ';'"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def p_data_start_empty(self, p):
|
def p_data_start_empty(self, p):
|
||||||
"""data_start : DATA_SEC '(' ')' ';'
|
"""data_start : DATA '(' ')' ';'
|
||||||
| DATA_SEC ';'"""
|
| DATA ';'"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def p_data_section(self, p):
|
def p_data_section(self, p):
|
||||||
|
|
@ -316,10 +398,13 @@ class Parser(Base):
|
||||||
|
|
||||||
def p_entity_instance_list(self, p):
|
def p_entity_instance_list(self, p):
|
||||||
"""entity_instance_list : entity_instance_list entity_instance
|
"""entity_instance_list : entity_instance_list entity_instance
|
||||||
| empty"""
|
| entity_instance"""
|
||||||
try: p[0] = p[1] + [p[2],]
|
try: p[0] = p[1] + [p[2],]
|
||||||
except IndexError: pass # p[2] doesn't exist, p[1] is None
|
except IndexError: p[0] = [p[1],]
|
||||||
except TypeError: p[0] = [p[2],] # p[1] is None, p[2] is valid
|
|
||||||
|
def p_entity_instance_list_empty(self, p):
|
||||||
|
"""entity_instance_list : empty"""
|
||||||
|
p[0] = []
|
||||||
|
|
||||||
def p_entity_instance(self, p):
|
def p_entity_instance(self, p):
|
||||||
"""entity_instance : simple_entity_instance
|
"""entity_instance : simple_entity_instance
|
||||||
|
|
@ -346,34 +431,60 @@ class Parser(Base):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_debug():
|
def test_debug():
|
||||||
|
import os.path
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
s = open('io1-tu-203.stp', 'r').read()
|
|
||||||
parser = Parser()
|
parser = Parser()
|
||||||
|
parser.reset()
|
||||||
try:
|
|
||||||
r = parser.parse(s, debug=1)
|
logger.info("***** parser debug *****")
|
||||||
except SystemExit:
|
p = os.path.expanduser('~/projects/src/stepcode/data/ap214e3/s1-c5-214/s1-c5-214.stp')
|
||||||
pass
|
with open(p, 'rU') as f:
|
||||||
|
s = f.read()
|
||||||
return (parser, r)
|
try:
|
||||||
|
parser.parse(s, debug=1)
|
||||||
|
except SystemExit:
|
||||||
|
pass
|
||||||
|
|
||||||
|
logger.info("***** finished *****")
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
|
import os, os.path, itertools, codecs
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
logger.setLevel(logging.ERROR)
|
logger.setLevel(logging.INFO)
|
||||||
|
|
||||||
s = open('io1-tu-203.stp', 'r').read()
|
|
||||||
parser = Parser()
|
parser = Parser()
|
||||||
|
compat_list = []
|
||||||
|
|
||||||
try:
|
def parse_check(p):
|
||||||
r = parser.parse(s)
|
logger.info("processing {0}".format(p))
|
||||||
except SystemExit:
|
parser.reset()
|
||||||
pass
|
with open(p, 'rU') as f:
|
||||||
|
iso_wrapper = codecs.EncodedFile(f, 'iso-8859-1')
|
||||||
|
s = iso_wrapper.read()
|
||||||
|
parser.parse(s)
|
||||||
|
|
||||||
return (parser, r)
|
logger.info("***** standard test *****")
|
||||||
|
for d, _, files in os.walk(os.path.expanduser('~/projects/src/stepcode')):
|
||||||
|
for f in itertools.ifilter(lambda x: x.endswith('.stp'), files):
|
||||||
|
p = os.path.join(d, f)
|
||||||
|
try:
|
||||||
|
parse_check(p)
|
||||||
|
except LexError:
|
||||||
|
logger.exception('Lexer issue, adding {0} to compatibility test list'.format(os.path.basename(p)))
|
||||||
|
compat_list.append(p)
|
||||||
|
|
||||||
|
lexer = Lexer(compatibility_mode=True)
|
||||||
|
parser = Parser(lexer=lexer)
|
||||||
|
|
||||||
|
logger.info("***** compatibility test *****")
|
||||||
|
for p in compat_list:
|
||||||
|
parse_check(p)
|
||||||
|
|
||||||
|
logger.info("***** finished *****")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
test()
|
test()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class NUMBER:
|
||||||
EXPRESS definition:
|
EXPRESS definition:
|
||||||
===================
|
===================
|
||||||
The number data type has as its domain all numeric values in the language. The number data
|
The number data type has as its domain all numeric values in the language. The number data
|
||||||
type shall be used when a more specic numeric representation is not important.
|
type shall be used when a more specific numeric representation is not important.
|
||||||
Syntax:
|
Syntax:
|
||||||
248 number_type = NUMBER .
|
248 number_type = NUMBER .
|
||||||
EXAMPLE 15 - Since we may not know the context of size we do not know how to correctly
|
EXAMPLE 15 - Since we may not know the context of size we do not know how to correctly
|
||||||
|
|
@ -56,7 +56,7 @@ class REAL(float,NUMBER):
|
||||||
"""
|
"""
|
||||||
EXPRESS definition:
|
EXPRESS definition:
|
||||||
===================
|
===================
|
||||||
The real data type has as its domain all rational, irrational and scientfic real numbers. It is
|
The real data type has as its domain all rational, irrational and scientific real numbers. It is
|
||||||
a specialization of the number data type.
|
a specialization of the number data type.
|
||||||
Syntax:
|
Syntax:
|
||||||
265 real_type = REAL [ '(' precision_spec ')' ] .
|
265 real_type = REAL [ '(' precision_spec ')' ] .
|
||||||
|
|
@ -110,23 +110,23 @@ class INTEGER(int,NUMBER):
|
||||||
class STRING(str):
|
class STRING(str):
|
||||||
"""
|
"""
|
||||||
The string data type has as its domain sequences of characters. The characters which are
|
The string data type has as its domain sequences of characters. The characters which are
|
||||||
permitted to form part of a string value are dened in ISO 10646.
|
permitted to form part of a string value are defined in ISO 10646.
|
||||||
Syntax:
|
Syntax:
|
||||||
293 string_type = STRING [ width_spec ] .
|
293 string_type = STRING [ width_spec ] .
|
||||||
318 width_spec = '(' width ')' [ FIXED ] .
|
318 width_spec = '(' width ')' [ FIXED ] .
|
||||||
317 width = numeric_expression .
|
317 width = numeric_expression .
|
||||||
A string data type may be dened as either xed or varying width (number of characters). If
|
A string data type may be defined as either fixed or varying width (number of characters). If
|
||||||
it is not specfically defined as fixed width (by using the fixed reserved word in the dfinition)
|
it is not specfically defined as fixed width (by using the fixed reserved word in the dfinition)
|
||||||
the string has varying width.
|
the string has varying width.
|
||||||
|
|
||||||
The domain of a xed width string data type is the set of all character sequences of exactly
|
The domain of a fixed width string data type is the set of all character sequences of exactly
|
||||||
the width specied in the type denition.
|
the width specified in the type definition.
|
||||||
The domain of a varying width string data type is the set of all character sequences of width
|
The domain of a varying width string data type is the set of all character sequences of width
|
||||||
less than or equal to the maximum width specied in the type denition.
|
less than or equal to the maximum width specified in the type definition.
|
||||||
If no width is specied, the domain is the set of all character sequences, with no constraint on
|
If no width is specified, the domain is the set of all character sequences, with no constraint on
|
||||||
the width of these sequences.
|
the width of these sequences.
|
||||||
Substrings and individual characters may be addressed using subscripts as described in 12.5.
|
Substrings and individual characters may be addressed using subscripts as described in 12.5.
|
||||||
The case (upper or lower) of letters within a string is signicant.
|
The case (upper or lower) of letters within a string is significant.
|
||||||
|
|
||||||
Python mapping: INTEGER is mapped the 'str' type. An additional width_spec parameter can be passed
|
Python mapping: INTEGER is mapped the 'str' type. An additional width_spec parameter can be passed
|
||||||
to handle the FIXED length constraint
|
to handle the FIXED length constraint
|
||||||
|
|
@ -166,10 +166,10 @@ class BINARY(str):
|
||||||
A binary data type may be defined as either fixed or varying width (number of bits). If it is
|
A binary data type may be defined as either fixed or varying width (number of bits). If it is
|
||||||
not specifically defined as fixed width (by using the fixed reserved word in the definition) the
|
not specifically defined as fixed width (by using the fixed reserved word in the definition) the
|
||||||
binary data type has varying width.
|
binary data type has varying width.
|
||||||
The domain of a fixed width binary data type is the set of all bit sequences of exactly the width
|
The domain of a fixed width binary data type is the set of all bit sequences of exactly the width
|
||||||
specied in the type definition.
|
specified in the type definition.
|
||||||
The domain of a varying width binary data type is the set of all bit sequences of width less
|
The domain of a varying width binary data type is the set of all bit sequences of width less
|
||||||
than or equal to the maximum width specied in the type denition. If no width is specified,
|
than or equal to the maximum width specified in the type definition. If no width is specified,
|
||||||
the domain is the set of all bit sequences, with no constraint on the width of these sequences.
|
the domain is the set of all bit sequences, with no constraint on the width of these sequences.
|
||||||
Subbinaries and individual bits may be addressed using subscripts as described in 12.3.
|
Subbinaries and individual bits may be addressed using subscripts as described in 12.3.
|
||||||
|
|
||||||
|
|
@ -180,7 +180,7 @@ class BINARY(str):
|
||||||
return str.__new__(self, value)
|
return str.__new__(self, value)
|
||||||
|
|
||||||
def __init__(self, value, width=-1, fixed=False):
|
def __init__(self, value, width=-1, fixed=False):
|
||||||
""" By default, lenght is set to None"""
|
""" By default, length is set to None"""
|
||||||
self._specified_width = width
|
self._specified_width = width
|
||||||
self._fixed = fixed
|
self._fixed = fixed
|
||||||
# Check implicit width
|
# Check implicit width
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ N350 ( August 31, 1993 ) of ISO 10303 TC184/SC4/WG7.
|
||||||
|
|
||||||
|
|
||||||
#include "express.h"
|
#include "express.h"
|
||||||
#include "exppp.h"
|
|
||||||
#include "dict.h"
|
#include "dict.h"
|
||||||
|
|
||||||
#define MAX_LEN 240
|
#define MAX_LEN 240
|
||||||
|
|
@ -104,9 +103,9 @@ FILE * FILEcreate( const char * );
|
||||||
void FILEclose( FILE * );
|
void FILEclose( FILE * );
|
||||||
const char * ClassName( const char * );
|
const char * ClassName( const char * );
|
||||||
const char * ENTITYget_classname( Entity );
|
const char * ENTITYget_classname( Entity );
|
||||||
void FUNCPrint( Function, FILES *, Schema );
|
void FUNCPrint( Function function, FILES* files );
|
||||||
void RULEPrint( Rule, FILES *, Schema );
|
void RULEPrint( Rule rule, FILES* files );
|
||||||
void ENTITYPrint( Entity, FILES *, Schema );
|
void ENTITYPrint( Entity, FILES * );
|
||||||
const char * StrToConstant( const char * );
|
const char * StrToConstant( const char * );
|
||||||
void TYPEselect_print( Type, FILES *, Schema );
|
void TYPEselect_print( Type, FILES *, Schema );
|
||||||
void ENTITYprint_new( Entity, FILES *, Schema, int );
|
void ENTITYprint_new( Entity, FILES *, Schema, int );
|
||||||
|
|
@ -130,7 +129,7 @@ const char * TYPEget_ctype( const Type t );
|
||||||
void print_file( Express );
|
void print_file( Express );
|
||||||
void resolution_success( void );
|
void resolution_success( void );
|
||||||
void SCHEMAprint( Schema schema, FILES* files, int suffix );
|
void SCHEMAprint( Schema schema, FILES* files, int suffix );
|
||||||
Type TYPEget_ancestor( Type );
|
Type TYPEget_ancestor( Type t );
|
||||||
const char * FundamentalType( const Type t, int report_reftypes );
|
const char * FundamentalType( const Type t, int report_reftypes );
|
||||||
|
|
||||||
/*Variable*/
|
/*Variable*/
|
||||||
|
|
@ -146,7 +145,5 @@ void print_schemas_separate( Express, FILES * );
|
||||||
void getMCPrint( Express, FILE *, FILE * );
|
void getMCPrint( Express, FILE *, FILE * );
|
||||||
int sameSchema( Scope, Scope );
|
int sameSchema( Scope, Scope );
|
||||||
|
|
||||||
void USEREFout( Schema schema, Dictionary refdict, Linked_List reflist, char * type, FILE * file );
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ N350 ( August 31, 1993 ) of ISO 10303 TC184/SC4/WG7.
|
||||||
*******************************************************************/
|
*******************************************************************/
|
||||||
|
|
||||||
extern int multiple_inheritance;
|
extern int multiple_inheritance;
|
||||||
/*extern int corba_binding; */
|
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
** The following functions will be used ***
|
** The following functions will be used ***
|
||||||
|
|
@ -60,7 +59,7 @@ CheckWord( const char * word ) {
|
||||||
high = nwords - 1;
|
high = nwords - 1;
|
||||||
|
|
||||||
/* word is obviously not in list, if it is longer than any of the words in the list */
|
/* word is obviously not in list, if it is longer than any of the words in the list */
|
||||||
if( strlen( word ) > 12 ) {
|
if( strlen( word ) > 18 ) {
|
||||||
return ( word );
|
return ( word );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,10 +70,8 @@ CheckWord( const char * word ) {
|
||||||
} else if( cond > 0 ) {
|
} else if( cond > 0 ) {
|
||||||
low = i + 1;
|
low = i + 1;
|
||||||
} else { /* word is a reserved word, capitalize it */
|
} else { /* word is a reserved word, capitalize it */
|
||||||
printf( "** warning: reserved word %s ", word );
|
fprintf( stderr, "Warning: reserved word %s capitalized\n", word );
|
||||||
*( word + 0 ) = toupper( *( word + 0 ) );
|
*word = toupper( *word );
|
||||||
printf( "is changed to %s **\n", word );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -128,8 +125,7 @@ StrToLower( const char * word ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char * StrToUpper( const char * word ) {
|
||||||
StrToUpper( const char * word ) {
|
|
||||||
static char newword [MAX_LEN];
|
static char newword [MAX_LEN];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char ToUpper( char c );
|
char ToUpper( char c );
|
||||||
|
|
@ -143,8 +139,7 @@ StrToUpper( const char * word ) {
|
||||||
return ( newword );
|
return ( newword );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char * StrToConstant( const char * word ) {
|
||||||
StrToConstant( const char * word ) {
|
|
||||||
static char newword [MAX_LEN];
|
static char newword [MAX_LEN];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
|
@ -161,28 +156,15 @@ StrToConstant( const char * word ) {
|
||||||
return ( newword );
|
return ( newword );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/** creates a file for python */
|
||||||
** Procedure: FILEcreate
|
FILE * FILEcreate( const char * filename ) {
|
||||||
** Description: creates a file for c++ with header definitions
|
|
||||||
** Parameters: filename
|
|
||||||
** Returns: FILE* pointer to file created or NULL
|
|
||||||
** Side Effects: creates a file with name filename
|
|
||||||
** Status: complete
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
FILE *
|
|
||||||
FILEcreate( const char * filename ) {
|
|
||||||
FILE * file;
|
FILE * file;
|
||||||
//const char * fn;
|
|
||||||
|
|
||||||
if( ( file = fopen( filename, "w" ) ) == NULL ) {
|
if( ( file = fopen( filename, "w" ) ) == NULL ) {
|
||||||
printf( "**Error in SCHEMAprint: unable to create file %s ** \n", filename );
|
fprintf( stderr, "Error in SCHEMAprint: unable to create file %s\n", filename );
|
||||||
return ( NULL );
|
return ( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
//fprintf( file, "#ifndef %s\n", fn = StrToConstant( filename ) );
|
|
||||||
//fprintf( file, "#define %s\n", fn );
|
|
||||||
|
|
||||||
fprintf( file, "# This file was generated by exp2python. You probably don't want to edit\n" );
|
fprintf( file, "# This file was generated by exp2python. You probably don't want to edit\n" );
|
||||||
fprintf( file, "# it since your modifications will be lost if exp2python is used to\n" );
|
fprintf( file, "# it since your modifications will be lost if exp2python is used to\n" );
|
||||||
fprintf( file, "# regenerate it.\n" );
|
fprintf( file, "# regenerate it.\n" );
|
||||||
|
|
@ -190,69 +172,32 @@ FILEcreate( const char * filename ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/** closes a file opened with FILEcreate */
|
||||||
** Procedure: FILEclose
|
void FILEclose( FILE * file ) {
|
||||||
** Description: closes a file opened with FILEcreate
|
|
||||||
** Parameters: FILE* file -- pointer to file to close
|
|
||||||
** Returns:
|
|
||||||
** Side Effects:
|
|
||||||
** Status: complete
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
void
|
|
||||||
FILEclose( FILE * file ) {
|
|
||||||
fclose( file );
|
fclose( file );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************
|
/** indicates whether the attribute is an aggregate */
|
||||||
** Procedure: isAggregate
|
int isAggregate( Variable a ) {
|
||||||
** Parameters: Attribute a
|
|
||||||
** Returns: int indicates whether the attribute is an aggregate
|
|
||||||
** Description: indicates whether the attribute is an aggregate
|
|
||||||
** Side Effects: none
|
|
||||||
** Status: complete 1/15/91
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
int
|
|
||||||
isAggregate( Variable a ) {
|
|
||||||
return( TYPEinherits_from( VARget_type( a ), aggregate_ ) );
|
return( TYPEinherits_from( VARget_type( a ), aggregate_ ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
/** indicates whether the type is an aggregate type */
|
||||||
isAggregateType( const Type t ) {
|
int isAggregateType( const Type t ) {
|
||||||
return( TYPEinherits_from( t, aggregate_ ) );
|
return( TYPEinherits_from( t, aggregate_ ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** returns temporary copy of name suitable for use as a class name
|
||||||
|
*
|
||||||
/******************************************************************
|
* each call erases the name created by a previous call to this function
|
||||||
** Procedure: TypeName
|
*/
|
||||||
** Parameters: Type t
|
const char * ClassName( const char * oldname ) {
|
||||||
** Returns: name of type as defined in SDAI C++ binding 4-Nov-1993
|
|
||||||
** Status: 4-Nov-1993
|
|
||||||
******************************************************************/
|
|
||||||
const char *
|
|
||||||
TypeName( Type t ) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************
|
|
||||||
** Procedure: ClassName
|
|
||||||
** Parameters: const char * oldname
|
|
||||||
** Returns: temporary copy of name suitable for use as a class name
|
|
||||||
** Side Effects: erases the name created by a previous call to this function
|
|
||||||
** Status: complete
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
const char *
|
|
||||||
ClassName( const char * oldname ) {
|
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
static char newname [BUFSIZ];
|
static char newname [BUFSIZ];
|
||||||
if( !oldname ) {
|
if( !oldname ) {
|
||||||
return ( "" );
|
return ( "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
strcpy( newname, ENTITYCLASS_PREFIX ) ;
|
strcpy( newname, ENTITYCLASS_PREFIX ) ;
|
||||||
j = strlen( ENTITYCLASS_PREFIX ) ;
|
j = strlen( ENTITYCLASS_PREFIX ) ;
|
||||||
newname [j] = ToUpper( oldname [i] );
|
newname [j] = ToUpper( oldname [i] );
|
||||||
|
|
@ -260,9 +205,6 @@ ClassName( const char * oldname ) {
|
||||||
++j;
|
++j;
|
||||||
while( oldname [i] != '\0' ) {
|
while( oldname [i] != '\0' ) {
|
||||||
newname [j] = ToLower( oldname [i] );
|
newname [j] = ToLower( oldname [i] );
|
||||||
/* if (oldname [i] == '_') */
|
|
||||||
/* character is '_' */
|
|
||||||
/* newname [++j] = ToUpper (oldname [++i]);*/
|
|
||||||
++i;
|
++i;
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
@ -270,38 +212,14 @@ ClassName( const char * oldname ) {
|
||||||
return ( newname );
|
return ( newname );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
/** returns the name of the c++ class representing the entity */
|
||||||
ENTITYget_CORBAname( Entity ent ) {
|
const char * ENTITYget_classname( Entity ent ) {
|
||||||
static char newname [BUFSIZ];
|
|
||||||
strcpy( newname, ENTITYget_name( ent ) );
|
|
||||||
newname[0] = ToUpper( newname [0] );
|
|
||||||
return newname;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************************
|
|
||||||
** Procedure: ENTITYget_classname
|
|
||||||
** Parameters: Entity ent
|
|
||||||
** Returns: the name of the c++ class representing the entity
|
|
||||||
** Status: complete
|
|
||||||
******************************************************************/
|
|
||||||
|
|
||||||
const char *
|
|
||||||
ENTITYget_classname( Entity ent ) {
|
|
||||||
const char * oldname = ENTITYget_name( ent );
|
const char * oldname = ENTITYget_name( ent );
|
||||||
return ( ClassName( oldname ) );
|
return ( ClassName( oldname ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/** returns a new capitalized name, in internal static buffer */
|
||||||
** Procedure: PrettyTmpName (char * oldname)
|
const char * PrettyTmpName( const char * oldname ) {
|
||||||
** Procedure: PrettyNewName (char * oldname)
|
|
||||||
** Parameters: oldname
|
|
||||||
** Returns: a new capitalized name
|
|
||||||
** Description: creates a new name with first character's in caps
|
|
||||||
** Side Effects: PrettyNewName allocates memory for the new name
|
|
||||||
** Status: OK 7-Oct-1992 kcm
|
|
||||||
******************************************************************/
|
|
||||||
const char *
|
|
||||||
PrettyTmpName( const char * oldname ) {
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
static char newname [BUFSIZ];
|
static char newname [BUFSIZ];
|
||||||
newname [0] = '\0';
|
newname [0] = '\0';
|
||||||
|
|
@ -321,9 +239,8 @@ PrettyTmpName( const char * oldname ) {
|
||||||
return newname;
|
return newname;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function is out of date DAS */
|
/** This function is out of date DAS */
|
||||||
const char *
|
const char * EnumName( const char * oldname ) {
|
||||||
EnumName( const char * oldname ) {
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
static char newname [MAX_LEN];
|
static char newname [MAX_LEN];
|
||||||
if( !oldname ) {
|
if( !oldname ) {
|
||||||
|
|
@ -339,8 +256,7 @@ EnumName( const char * oldname ) {
|
||||||
return ( newname );
|
return ( newname );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char * SelectName( const char * oldname ) {
|
||||||
SelectName( const char * oldname ) {
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
static char newname [MAX_LEN];
|
static char newname [MAX_LEN];
|
||||||
if( !oldname ) {
|
if( !oldname ) {
|
||||||
|
|
@ -357,8 +273,7 @@ SelectName( const char * oldname ) {
|
||||||
return ( newname );
|
return ( newname );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char * FirstToUpper( const char * word ) {
|
||||||
FirstToUpper( const char * word ) {
|
|
||||||
static char newword [MAX_LEN];
|
static char newword [MAX_LEN];
|
||||||
|
|
||||||
strncpy( newword, word, MAX_LEN );
|
strncpy( newword, word, MAX_LEN );
|
||||||
|
|
@ -366,11 +281,11 @@ FirstToUpper( const char * word ) {
|
||||||
return ( newword );
|
return ( newword );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return fundamental type but as the string which corresponds to */
|
/** return fundamental type but as the string which corresponds to
|
||||||
/* the appropriate type descriptor */
|
* the appropriate type descriptor
|
||||||
/* if report_reftypes is true, report REFERENCE_TYPE when appropriate */
|
* if report_reftypes is true, report REFERENCE_TYPE when appropriate
|
||||||
const char *
|
*/
|
||||||
FundamentalType( const Type t, int report_reftypes ) {
|
const char * FundamentalType( const Type t, int report_reftypes ) {
|
||||||
if( report_reftypes && TYPEget_head( t ) ) {
|
if( report_reftypes && TYPEget_head( t ) ) {
|
||||||
return( "REFERENCE_TYPE" );
|
return( "REFERENCE_TYPE" );
|
||||||
}
|
}
|
||||||
|
|
@ -412,18 +327,16 @@ FundamentalType( const Type t, int report_reftypes ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this actually gets you the name of the variable that will be generated to
|
/** this actually gets you the name of the variable that will be generated to
|
||||||
be a TypeDescriptor or subtype of TypeDescriptor to represent Type t in
|
* be a TypeDescriptor or subtype of TypeDescriptor to represent Type t in
|
||||||
the dictionary. */
|
* the dictionary.
|
||||||
|
*/
|
||||||
const char *
|
const char * TypeDescriptorName( Type t ) {
|
||||||
TypeDescriptorName( Type t ) {
|
|
||||||
static char b [BUFSIZ];
|
static char b [BUFSIZ];
|
||||||
Schema parent = t->superscope;
|
Schema parent = t->superscope;
|
||||||
/* NOTE - I corrected a prev bug here in which the *current* schema was
|
/* NOTE - I corrected a prev bug here in which the *current* schema was
|
||||||
** passed to this function. Now we take "parent" - the schema in which
|
** passed to this function. Now we take "parent" - the schema in which
|
||||||
** Type t was defined - which was actually used to create t's name. DAR */
|
** Type t was defined - which was actually used to create t's name. DAR */
|
||||||
|
|
||||||
if( !parent ) {
|
if( !parent ) {
|
||||||
parent = TYPEget_body( t )->entity->superscope;
|
parent = TYPEget_body( t )->entity->superscope;
|
||||||
/* This works in certain cases that don't work otherwise (basically a
|
/* This works in certain cases that don't work otherwise (basically a
|
||||||
|
|
@ -437,11 +350,10 @@ TypeDescriptorName( Type t ) {
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this gets you the name of the type of TypeDescriptor (or subtype) that a
|
/** this gets you the name of the type of TypeDescriptor (or subtype) that a
|
||||||
variable generated to represent Type t would be an instance of. */
|
* variable generated to represent Type t would be an instance of.
|
||||||
|
*/
|
||||||
const char *
|
const char * GetTypeDescriptorName( Type t ) {
|
||||||
GetTypeDescriptorName( Type t ) {
|
|
||||||
switch( TYPEget_body( t )->type ) {
|
switch( TYPEget_body( t )->type ) {
|
||||||
case aggregate_:
|
case aggregate_:
|
||||||
return "AggrTypeDescriptor";
|
return "AggrTypeDescriptor";
|
||||||
|
|
@ -477,13 +389,12 @@ GetTypeDescriptorName( Type t ) {
|
||||||
case generic_:
|
case generic_:
|
||||||
return "TypeDescriptor";
|
return "TypeDescriptor";
|
||||||
default:
|
default:
|
||||||
printf( "Error in %s, line %d: type %d not handled by switch statement.", __FILE__, __LINE__, TYPEget_body( t )->type );
|
fprintf( stderr, "Error in %s, line %d: type %d not handled by switch statement.", __FILE__, __LINE__, TYPEget_body( t )->type );
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int ENTITYhas_explicit_attributes( Entity e ) {
|
||||||
ENTITYhas_explicit_attributes( Entity e ) {
|
|
||||||
Linked_List l = ENTITYget_attributes( e );
|
Linked_List l = ENTITYget_attributes( e );
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
LISTdo( l, a, Variable )
|
LISTdo( l, a, Variable )
|
||||||
|
|
@ -495,8 +406,7 @@ ENTITYhas_explicit_attributes( Entity e ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity
|
Entity ENTITYput_superclass( Entity entity ) {
|
||||||
ENTITYput_superclass( Entity entity ) {
|
|
||||||
#define ENTITYget_type(e) ((e)->u.entity->type)
|
#define ENTITYget_type(e) ((e)->u.entity->type)
|
||||||
|
|
||||||
Linked_List l = ENTITYget_supertypes( entity );
|
Linked_List l = ENTITYget_supertypes( entity );
|
||||||
|
|
@ -518,28 +428,27 @@ ENTITYput_superclass( Entity entity ) {
|
||||||
/* find the first parent that has attributes (in the parent or any of its
|
/* find the first parent that has attributes (in the parent or any of its
|
||||||
ancestors). Make super point at that parent and print warnings for
|
ancestors). Make super point at that parent and print warnings for
|
||||||
all the rest of the parents. DAS */
|
all the rest of the parents. DAS */
|
||||||
LISTdo( l, e, Entity )
|
LISTdo( l, e, Entity ) {
|
||||||
/* if there's no super class yet,
|
/* if there's no super class yet,
|
||||||
or if the entity super class [the variable] super is pointing at
|
or if the entity super class [the variable] super is pointing at
|
||||||
doesn't have any attributes: make super point at the current parent.
|
doesn't have any attributes: make super point at the current parent.
|
||||||
As soon as the parent pointed to by super has attributes, stop
|
As soon as the parent pointed to by super has attributes, stop
|
||||||
assigning super and print ignore messages for the remaining parents.
|
assigning super and print ignore messages for the remaining parents.
|
||||||
*/
|
*/
|
||||||
if( ( ! super ) || ( ! ENTITYhas_explicit_attributes( super ) ) ) {
|
if( ( ! super ) || ( ! ENTITYhas_explicit_attributes( super ) ) ) {
|
||||||
ignore = super;
|
ignore = super;
|
||||||
super = e;
|
super = e;
|
||||||
++ super_cnt;
|
++ super_cnt;
|
||||||
} else {
|
} else {
|
||||||
ignore = e;
|
ignore = e;
|
||||||
}
|
}
|
||||||
if( ignore ) {
|
if( ignore ) {
|
||||||
printf( "WARNING: multiple inheritance not implemented.\n" );
|
printf( "WARNING: multiple inheritance not implemented.\n" );
|
||||||
printf( "\tin ENTITY %s\n\tSUPERTYPE %s IGNORED.\n\n",
|
printf( "\tin ENTITY %s\n\tSUPERTYPE %s IGNORED.\n\n",
|
||||||
ENTITYget_name( entity ), ENTITYget_name( e ) );
|
ENTITYget_name( entity ), ENTITYget_name( e ) );
|
||||||
}
|
}
|
||||||
LISTod;
|
} LISTod
|
||||||
}
|
}
|
||||||
|
|
||||||
tag = ( EntityTag ) malloc( sizeof( struct EntityTag_ ) );
|
tag = ( EntityTag ) malloc( sizeof( struct EntityTag_ ) );
|
||||||
tag -> superclass = super;
|
tag -> superclass = super;
|
||||||
TYPEput_clientData( ENTITYget_type( entity ), tag );
|
TYPEput_clientData( ENTITYget_type( entity ), tag );
|
||||||
|
|
@ -548,8 +457,7 @@ ENTITYput_superclass( Entity entity ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity
|
Entity ENTITYget_superclass( Entity entity ) {
|
||||||
ENTITYget_superclass( Entity entity ) {
|
|
||||||
EntityTag tag;
|
EntityTag tag;
|
||||||
tag = TYPEget_clientData( ENTITYget_type( entity ) );
|
tag = TYPEget_clientData( ENTITYget_type( entity ) );
|
||||||
return ( tag ? tag -> superclass : 0 );
|
return ( tag ? tag -> superclass : 0 );
|
||||||
|
|
@ -597,15 +505,14 @@ void ENTITYget_first_attribs( Entity entity, Linked_List result ) {
|
||||||
** // tell it to be * for reading and writing
|
** // tell it to be * for reading and writing
|
||||||
**/
|
**/
|
||||||
|
|
||||||
Variable
|
Variable VARis_type_shifter( Variable a ) {
|
||||||
VARis_type_shifter( Variable a ) {
|
|
||||||
char * temp;
|
char * temp;
|
||||||
|
|
||||||
if( VARis_derived( a ) || VARget_inverse( a ) ) {
|
if( VARis_derived( a ) || VARget_inverse( a ) ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = EXPRto_string( VARget_name( a ) );
|
temp = strdup( VARget_name( a )->symbol.name );
|
||||||
if( ! strncmp( StrToLower( temp ), "self\\", 5 ) ) {
|
if( ! strncmp( StrToLower( temp ), "self\\", 5 ) ) {
|
||||||
/* a is a type shifter */
|
/* a is a type shifter */
|
||||||
free( temp );
|
free( temp );
|
||||||
|
|
@ -615,8 +522,7 @@ VARis_type_shifter( Variable a ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variable
|
Variable VARis_overrider( Entity e, Variable a ) {
|
||||||
VARis_overrider( Entity e, Variable a ) {
|
|
||||||
|
|
||||||
Variable other;
|
Variable other;
|
||||||
char * tmp;
|
char * tmp;
|
||||||
|
|
@ -632,13 +538,11 @@ VARis_overrider( Entity e, Variable a ) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Type
|
/**
|
||||||
TYPEget_ancestor( Type t )
|
|
||||||
/*
|
|
||||||
* For a renamed type, returns the original (ancestor) type from which t
|
* For a renamed type, returns the original (ancestor) type from which t
|
||||||
* descends. Return NULL if t is top level.
|
* descends. Return NULL if t is top level.
|
||||||
*/
|
*/
|
||||||
{
|
Type TYPEget_ancestor( Type t ) {
|
||||||
Type i = t;
|
Type i = t;
|
||||||
|
|
||||||
if( !TYPEget_head( i ) ) {
|
if( !TYPEget_head( i ) ) {
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#include "complexSupport.h"
|
#include "complexSupport.h"
|
||||||
|
|
||||||
extern int corba_binding;
|
|
||||||
|
|
||||||
void use_ref( Schema, Express, FILES * );
|
void use_ref( Schema, Express, FILES * );
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
|
@ -106,7 +104,8 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
|
||||||
if( t->search_id == CANPROCESS ) {
|
if( t->search_id == CANPROCESS ) {
|
||||||
// Only selects haven't been processed yet and may still be set to
|
// Only selects haven't been processed yet and may still be set to
|
||||||
// CANPROCESS.
|
// CANPROCESS.
|
||||||
TYPEselect_print( t, files, schema );
|
//FIXME this function is not implemented!
|
||||||
|
// TYPEselect_print( t, files, schema );
|
||||||
t->search_id = PROCESSED;
|
t->search_id = PROCESSED;
|
||||||
}
|
}
|
||||||
SCOPEod;
|
SCOPEod;
|
||||||
|
|
@ -114,7 +113,7 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
|
||||||
// process each entity. This must be done *before* typedefs are defined
|
// process each entity. This must be done *before* typedefs are defined
|
||||||
LISTdo( list, e, Entity );
|
LISTdo( list, e, Entity );
|
||||||
if( e->search_id == CANPROCESS ) {
|
if( e->search_id == CANPROCESS ) {
|
||||||
ENTITYPrint( e, files, schema );
|
ENTITYPrint( e, files );
|
||||||
e->search_id = PROCESSED;
|
e->search_id = PROCESSED;
|
||||||
}
|
}
|
||||||
LISTod;
|
LISTod;
|
||||||
|
|
@ -122,13 +121,13 @@ void SCOPEPrint( Scope scope, FILES * files, Schema schema ) {
|
||||||
|
|
||||||
// process each function. This must be done *before* typedefs are defined
|
// process each function. This must be done *before* typedefs are defined
|
||||||
LISTdo( function_list, f, Function );
|
LISTdo( function_list, f, Function );
|
||||||
FUNCPrint( f, files, schema );
|
FUNCPrint( f, files );
|
||||||
LISTod;
|
LISTod;
|
||||||
LISTfree( function_list );
|
LISTfree( function_list );
|
||||||
|
|
||||||
// process each rule. This must be done *before* typedefs are defined
|
// process each rule. This must be done *before* typedefs are defined
|
||||||
LISTdo( rule_list, r, Rule );
|
LISTdo( rule_list, r, Rule );
|
||||||
RULEPrint( r, files, schema );
|
RULEPrint( r, files );
|
||||||
LISTod;
|
LISTod;
|
||||||
LISTfree( rule_list );
|
LISTfree( rule_list );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,75 +1,9 @@
|
||||||
|
|
||||||
/************************************************************************
|
/* Driver for exp2python (generation of python from EXPRESS) */
|
||||||
** Driver for Fed-X Express parser.
|
|
||||||
************************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This software was developed by U.S. Government employees as part of
|
* This software was developed by U.S. Government employees as part of
|
||||||
* their official duties and is not subject to copyright.
|
* their official duties and is not subject to copyright.
|
||||||
*
|
|
||||||
* $Log: fedex_main.c,v $
|
|
||||||
* Revision 3.0.1.3 1997/11/05 23:12:18 sauderd
|
|
||||||
* Adding a new state DP3.1 and associated revision
|
|
||||||
*
|
|
||||||
* Revision 3.0.1.2 1997/09/26 15:59:10 sauderd
|
|
||||||
* Finished implementing the -a option (changed from -e) to generate the early
|
|
||||||
* bound access functions the old way. Implemented the change to generate them
|
|
||||||
* the new correct way by default.
|
|
||||||
*
|
|
||||||
* Revision 3.0.1.1 1997/09/18 21:18:41 sauderd
|
|
||||||
* Added a -e or -E option to generate attribute get and put functions the old
|
|
||||||
* way (without an underscore). It sets the variable old_accessors. This doesn't
|
|
||||||
* currently do anything. It needs to be implemented to generate attr funcs
|
|
||||||
* correctly.
|
|
||||||
*
|
|
||||||
* Revision 3.0.1.0 1997/04/16 19:29:03 dar
|
|
||||||
* Setting the first branch
|
|
||||||
*
|
|
||||||
* Revision 3.0 1997/04/16 19:29:02 dar
|
|
||||||
* STEP Class Library Pre Release 3.0
|
|
||||||
*
|
|
||||||
* Revision 2.1.0.5 1997/03/11 15:33:59 sauderd
|
|
||||||
* Changed code so that if exp2python is passed the -c or -C option it would
|
|
||||||
* generate implementation objects for Orbix (CORBA). Look for code that is
|
|
||||||
* inside stmts such as if(corba_binding)
|
|
||||||
*
|
|
||||||
* Revision 2.1.0.4 1996/09/25 22:56:55 sauderd
|
|
||||||
* Added a command line argument for logging SCL use. The option added is -l or
|
|
||||||
* -L. It also says the option in the usage stmt when you run exp2python without
|
|
||||||
* an argument. Added the options to the EXPRESSgetopt_options string.
|
|
||||||
*
|
|
||||||
* Revision 2.1.0.3 1996/06/18 18:14:17 sauderd
|
|
||||||
* Changed the line that gets printed when you run exp2python with no
|
|
||||||
* arguments to include the option for single inheritance.
|
|
||||||
*
|
|
||||||
* Revision 2.1.0.2 1995/05/19 22:40:03 sauderd
|
|
||||||
* Added a command line argument -s or -S for generating code based on the old
|
|
||||||
* method as opposed to the new method of multiple inheritance.
|
|
||||||
*
|
|
||||||
* Revision 2.1.0.1 1995/05/16 19:52:18 lubell
|
|
||||||
* setting state to dp21
|
|
||||||
*
|
|
||||||
* Revision 2.1.0.0 1995/05/12 18:53:48 lubell
|
|
||||||
* setting branch
|
|
||||||
*
|
|
||||||
* Revision 2.1 1995/05/12 18:53:47 lubell
|
|
||||||
* changing version to 2.1
|
|
||||||
*
|
|
||||||
* Revision 1.7 1995/03/16 20:58:50 sauderd
|
|
||||||
* ? changes.
|
|
||||||
*
|
|
||||||
* Revision 1.6 1992/09/29 15:46:55 libes
|
|
||||||
* added messages for KC
|
|
||||||
*
|
|
||||||
* Revision 1.5 1992/08/27 23:28:52 libes
|
|
||||||
* moved Descriptor "new"s to precede assignments
|
|
||||||
* punted SELECT type
|
|
||||||
*
|
|
||||||
* Revision 1.4 1992/08/19 18:49:59 libes
|
|
||||||
* registry support
|
|
||||||
*
|
|
||||||
* Revision 1.3 1992/06/05 19:55:28 libes
|
|
||||||
* Added * to typedefs. Replaced warning kludges with ERRORoption.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
@ -81,14 +15,8 @@ extern void print_fedex_version( void );
|
||||||
|
|
||||||
static void exp2python_usage( void ) {
|
static void exp2python_usage( void ) {
|
||||||
fprintf( stderr, "usage: %s [-v] [-d # | -d 9 -l nnn -u nnn] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name );
|
fprintf( stderr, "usage: %s [-v] [-d # | -d 9 -l nnn -u nnn] [-n] [-p <object_type>] {-w|-i <warning>} express_file\n", EXPRESSprogram_name );
|
||||||
//fprintf( stderr, "where\t-s or -S uses only single inheritance in the generated C++ classes\n" );
|
|
||||||
//fprintf( stderr, "\t-a or -A generates the early bound access functions for entity classes the old way (without an underscore)\n" );
|
|
||||||
//fprintf( stderr, "\t-c or -C generates C++ classes for use with CORBA (Orbix)\n" );
|
|
||||||
//fprintf( stderr, "\t-L prints logging code in the generated C++ classes\n" );
|
|
||||||
fprintf( stderr, "\t-v produces the version description below\n" );
|
fprintf( stderr, "\t-v produces the version description below\n" );
|
||||||
fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" );
|
fprintf( stderr, "\t-d turns on debugging (\"-d 0\" describes this further\n" );
|
||||||
//fprintf( stderr, "\t-p turns on printing when processing certain objects (see below)\n" );
|
|
||||||
//fprintf( stderr, "\t-n do not pause for internal errors (useful with delta script)\n" );
|
|
||||||
fprintf( stderr, "\t-w warning enable\n" );
|
fprintf( stderr, "\t-w warning enable\n" );
|
||||||
fprintf( stderr, "\t-i warning ignore\n" );
|
fprintf( stderr, "\t-i warning ignore\n" );
|
||||||
fprintf( stderr, "and <warning> is one of:\n" );
|
fprintf( stderr, "and <warning> is one of:\n" );
|
||||||
|
|
@ -117,6 +45,7 @@ void resolution_success( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int success( Express model ) {
|
int success( Express model ) {
|
||||||
|
(void) model; /* unused */
|
||||||
printf( "Done.\n" );
|
printf( "Done.\n" );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ static void markDescs( Entity );
|
||||||
static int checkItem( Type, Scope, Schema, int *, int );
|
static int checkItem( Type, Scope, Schema, int *, int );
|
||||||
static int ENUMcanBeProcessed( Type, Schema );
|
static int ENUMcanBeProcessed( Type, Schema );
|
||||||
static int inSchema( Scope, Scope );
|
static int inSchema( Scope, Scope );
|
||||||
static void addRenameTypedefs( Schema, FILE * );
|
/* static void addRenameTypedefs( Schema, FILE * ); */
|
||||||
static void addAggrTypedefs( Schema schema );
|
static void addAggrTypedefs( Schema schema );
|
||||||
static void addUseRefNames( Schema, FILE * );
|
static void addUseRefNames( Schema, FILE * );
|
||||||
|
|
||||||
|
|
@ -70,8 +70,8 @@ void print_schemas_separate( Express express, FILES * files )
|
||||||
|
|
||||||
/* First set all marks we'll be using to UNPROCESSED/NOTKNOWN: */
|
/* First set all marks we'll be using to UNPROCESSED/NOTKNOWN: */
|
||||||
initializeMarks( express );
|
initializeMarks( express );
|
||||||
//FIXME SdaiAll.cc:12:24: warning: unused variable ‘is’ [-Wunused-variable] (also for ui & ri)
|
/* FIXME SdaiAll.cc:12:24: warning: unused variable ‘is’ [-Wunused-variable] (also for ui & ri) */
|
||||||
//fprintf( files->create, " Interface_spec_ptr is;\n Used_item_ptr ui;\n Referenced_item_ptr ri;\n Uniqueness_rule_ptr ur;\n Where_rule_ptr wr;\n Global_rule_ptr gr;\n" );
|
/* fprintf( files->create, " Interface_spec_ptr is;\n Used_item_ptr ui;\n Referenced_item_ptr ri;\n Uniqueness_rule_ptr ur;\n Where_rule_ptr wr;\n Global_rule_ptr gr;\n" ); */
|
||||||
while( !complete ) {
|
while( !complete ) {
|
||||||
complete = TRUE;
|
complete = TRUE;
|
||||||
DICTdo_type_init( express->symbol_table, &de, OBJ_SCHEMA );
|
DICTdo_type_init( express->symbol_table, &de, OBJ_SCHEMA );
|
||||||
|
|
@ -116,9 +116,7 @@ void print_schemas_separate( Express express, FILES * files )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************
|
/*
|
||||||
*******************/
|
|
||||||
|
|
||||||
DICTdo_type_init( express->symbol_table, &de, OBJ_SCHEMA );
|
DICTdo_type_init( express->symbol_table, &de, OBJ_SCHEMA );
|
||||||
while( ( schema = ( Scope )DICTdo( &de ) ) != 0 ) {
|
while( ( schema = ( Scope )DICTdo( &de ) ) != 0 ) {
|
||||||
//fprintf( files->create,
|
//fprintf( files->create,
|
||||||
|
|
@ -129,8 +127,7 @@ void print_schemas_separate( Express express, FILES * files )
|
||||||
// "\t//////////////// REFERENCE statements\n" );
|
// "\t//////////////// REFERENCE statements\n" );
|
||||||
//USEREFout( schema, schema->u.schema->refdict, schema->u.schema->ref_schemas, "REFERENCE", files->create );
|
//USEREFout( schema, schema->u.schema->refdict, schema->u.schema->ref_schemas, "REFERENCE", files->create );
|
||||||
}
|
}
|
||||||
/*****************
|
*/
|
||||||
*****************/
|
|
||||||
/* Before closing, we have three more situations to deal with (i.e., three
|
/* Before closing, we have three more situations to deal with (i.e., three
|
||||||
// types of declarations etc. which could only be printed at the end).
|
// types of declarations etc. which could only be printed at the end).
|
||||||
// Each is explained in the header section of its respective function. */
|
// Each is explained in the header section of its respective function. */
|
||||||
|
|
@ -144,26 +141,25 @@ void print_schemas_separate( Express express, FILES * files )
|
||||||
// of addAggrTypedefs.) */
|
// of addAggrTypedefs.) */
|
||||||
DICTdo_type_init( express->symbol_table, &de, OBJ_SCHEMA );
|
DICTdo_type_init( express->symbol_table, &de, OBJ_SCHEMA );
|
||||||
while( ( schema = ( Scope )DICTdo( &de ) ) != 0 ) {
|
while( ( schema = ( Scope )DICTdo( &de ) ) != 0 ) {
|
||||||
//addAggrTypedefs( schema, files->classes );
|
/* addAggrTypedefs( schema, files->classes ); */
|
||||||
addAggrTypedefs( schema );
|
addAggrTypedefs( schema );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On our way out, print the necessary statements to add support for
|
/* On our way out, print the necessary statements to add support for
|
||||||
// complex entities. (The 1st line below is a part of SchemaInit(),
|
// complex entities. (The 1st line below is a part of SchemaInit(),
|
||||||
// which hasn't been closed yet. (That's done on 2nd line below.)) */
|
// which hasn't been closed yet. (That's done on 2nd line below.)) * /
|
||||||
//fprintf( files->initall, "\t reg.SetCompCollect( gencomplex() );\n" );
|
//fprintf( files->initall, "\t reg.SetCompCollect( gencomplex() );\n" );
|
||||||
//fprintf( files->initall, "}\n\n" );
|
//fprintf( files->initall, "}\n\n" );
|
||||||
//fprintf( files->incall, "\n#include <complexSupport.h>\n" );
|
//fprintf( files->incall, "\n#include <complexSupport.h>\n" );
|
||||||
//fprintf( files->incall, "ComplexCollect *gencomplex();\n" );
|
//fprintf( files->incall, "ComplexCollect *gencomplex();\n" ); */
|
||||||
|
|
||||||
/* Function GetModelContents() is printed at the end of the schema.xx
|
/* Function GetModelContents() is printed at the end of the schema.xx
|
||||||
// files. This is done in a separate loop through the schemas, in function
|
// files. This is done in a separate loop through the schemas, in function
|
||||||
// below. */
|
// below. * /
|
||||||
//getMCPrint( express, files->incall, files->initall );
|
//getMCPrint( express, files->incall, files->initall ); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void initializeMarks( Express express )
|
/**
|
||||||
/*
|
|
||||||
* Set all schema->search_id's to UNPROCESSED, meaning we haven't processed
|
* Set all schema->search_id's to UNPROCESSED, meaning we haven't processed
|
||||||
* all the ents and types in it yet. Also, put an int=0 in each schema's
|
* all the ents and types in it yet. Also, put an int=0 in each schema's
|
||||||
* clientData field. We'll use it to record what # file we're generating
|
* clientData field. We'll use it to record what # file we're generating
|
||||||
|
|
@ -172,7 +168,7 @@ static void initializeMarks( Express express )
|
||||||
* an attribute/item which comes from another schema. All other types can
|
* an attribute/item which comes from another schema. All other types can
|
||||||
* be processed the first time, but that will be caught in checkTypes().)
|
* be processed the first time, but that will be caught in checkTypes().)
|
||||||
*/
|
*/
|
||||||
{
|
static void initializeMarks( Express express ) {
|
||||||
DictionaryEntry de_sch, de_ent, de_type;
|
DictionaryEntry de_sch, de_ent, de_type;
|
||||||
Schema schema;
|
Schema schema;
|
||||||
|
|
||||||
|
|
@ -190,8 +186,7 @@ static void initializeMarks( Express express )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unsetObjs( Schema schema )
|
/**
|
||||||
/*
|
|
||||||
* Resets all the ents & types of schema which had been set to CANTPROCRSS
|
* Resets all the ents & types of schema which had been set to CANTPROCRSS
|
||||||
* to NOTKNOWN. This function is called every time print_schemas_separate
|
* to NOTKNOWN. This function is called every time print_schemas_separate
|
||||||
* iterates through the schemas, printing to file what can be printed. At
|
* iterates through the schemas, printing to file what can be printed. At
|
||||||
|
|
@ -200,7 +195,7 @@ static void unsetObjs( Schema schema )
|
||||||
* types which have already been marked PROCESSED will not have to be
|
* types which have already been marked PROCESSED will not have to be
|
||||||
* revisited, and are not changed.
|
* revisited, and are not changed.
|
||||||
*/
|
*/
|
||||||
{
|
static void unsetObjs( Schema schema ) {
|
||||||
DictionaryEntry de;
|
DictionaryEntry de;
|
||||||
|
|
||||||
SCOPEdo_types( schema, t, de )
|
SCOPEdo_types( schema, t, de )
|
||||||
|
|
@ -215,8 +210,7 @@ static void unsetObjs( Schema schema )
|
||||||
SCOPEod
|
SCOPEod
|
||||||
}
|
}
|
||||||
|
|
||||||
static int checkTypes( Schema schema )
|
/**
|
||||||
/*
|
|
||||||
* Goes through the types contained in this schema checking for ones which
|
* Goes through the types contained in this schema checking for ones which
|
||||||
* can't be processed. This may be the case if: (1) We have a select type
|
* can't be processed. This may be the case if: (1) We have a select type
|
||||||
* which has enumeration or select items which have not yet been defined
|
* which has enumeration or select items which have not yet been defined
|
||||||
|
|
@ -228,7 +222,7 @@ static int checkTypes( Schema schema )
|
||||||
* CANTPROCESS. If some types in schema *can* be processed now, we return
|
* CANTPROCESS. If some types in schema *can* be processed now, we return
|
||||||
* TRUE. (See relevant header comments of checkEnts() below.)
|
* TRUE. (See relevant header comments of checkEnts() below.)
|
||||||
*/
|
*/
|
||||||
{
|
static int checkTypes( Schema schema ) {
|
||||||
DictionaryEntry de;
|
DictionaryEntry de;
|
||||||
int retval = FALSE, unknowncnt;
|
int retval = FALSE, unknowncnt;
|
||||||
Type i;
|
Type i;
|
||||||
|
|
@ -259,43 +253,43 @@ static int checkTypes( Schema schema )
|
||||||
schema->search_id = UNPROCESSED;
|
schema->search_id = UNPROCESSED;
|
||||||
}
|
}
|
||||||
} else if( TYPEis_select( type ) ) {
|
} else if( TYPEis_select( type ) ) {
|
||||||
LISTdo( SEL_TYPEget_items( type ), i, Type )
|
LISTdo( SEL_TYPEget_items( type ), ii, Type ) {
|
||||||
if( !TYPEis_entity( i ) ) {
|
if( !TYPEis_entity( ii ) ) {
|
||||||
if( checkItem( i, type, schema, &unknowncnt, 0 ) ) {
|
if( checkItem( ii, type, schema, &unknowncnt, 0 ) ) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
/* checkItem does most of the work of determining if
|
||||||
|
// an item of a select will make the select type un-
|
||||||
|
// processable. It checks for conditions which would
|
||||||
|
// make this true and sets values in type, schema, and
|
||||||
|
// unknowncnt accordingly. (See checkItem's commenting
|
||||||
|
// below.) It also return TRUE if ii has made type un-
|
||||||
|
// processable. If so, we break - there's no point
|
||||||
|
// checking the other items of type any more. */
|
||||||
|
} else {
|
||||||
|
/* Check if our select has an entity item which itself
|
||||||
|
// has unprocessed selects or enums. */
|
||||||
|
ent = ENT_TYPEget_entity( ii );
|
||||||
|
if( ent->search_id == PROCESSED ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* If entity has been processed already, things must be
|
||||||
|
// okay. (Note - but if it hasn't been processed yet we
|
||||||
|
// may still be able to process type. This is because
|
||||||
|
// a sel type will only contain a pointer to an entity-
|
||||||
|
// item (and we can create a pointer to a not-yet-pro-
|
||||||
|
// cessed object), while it will contain actual objects
|
||||||
|
// for the enum and select attributes of ent.) */
|
||||||
|
attribs = ENTITYget_all_attributes( ent );
|
||||||
|
LISTdo_n( attribs, attr, Variable, b ) {
|
||||||
|
if( checkItem( attr->type, type, schema,
|
||||||
|
&unknowncnt, 1 ) ) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} LISTod
|
||||||
|
LISTfree( attribs );
|
||||||
}
|
}
|
||||||
/* checkItem does most of the work of determining if
|
} LISTod
|
||||||
// an item of a select will make the select type un-
|
|
||||||
// processable. It checks for conditions which would
|
|
||||||
// make this true and sets values in type, schema, and
|
|
||||||
// unknowncnt accordingly. (See checkItem's commenting
|
|
||||||
// below.) It also return TRUE if i has made type un-
|
|
||||||
// processable. If so, we break - there's no point
|
|
||||||
// checking the other items of type any more. */
|
|
||||||
} else {
|
|
||||||
/* Check if our select has an entity item which itself
|
|
||||||
// has unprocessed selects or enums. */
|
|
||||||
ent = ENT_TYPEget_entity( i );
|
|
||||||
if( ent->search_id == PROCESSED ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
/* If entity has been processed already, things must be
|
|
||||||
// okay. (Note - but if it hasn't been processed yet we
|
|
||||||
// may still be able to process type. This is because
|
|
||||||
// a sel type will only contain a pointer to an entity-
|
|
||||||
// item (and we can create a pointer to a not-yet-pro-
|
|
||||||
// cessed object), while it will contain actual objects
|
|
||||||
// for the enum and select attributes of ent.) */
|
|
||||||
attribs = ENTITYget_all_attributes( ent );
|
|
||||||
LISTdo( attribs, attr, Variable )
|
|
||||||
if( checkItem( attr->type, type, schema,
|
|
||||||
&unknowncnt, 1 ) ) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
LISTod
|
|
||||||
LISTfree( attribs );
|
|
||||||
}
|
|
||||||
LISTod
|
|
||||||
/* One more condition - if we're a select which is a rename of
|
/* One more condition - if we're a select which is a rename of
|
||||||
// another select - we must also make sure the original select
|
// another select - we must also make sure the original select
|
||||||
// is in this schema or has been processed. Since a rename-
|
// is in this schema or has been processed. Since a rename-
|
||||||
|
|
@ -599,7 +593,7 @@ static void addAggrTypedefs( Schema schema )
|
||||||
// 2D aggr's and higher only need type GenericAggr defined
|
// 2D aggr's and higher only need type GenericAggr defined
|
||||||
// which is built-in. */
|
// which is built-in. */
|
||||||
printf( "in addAggrTypedefs. %s is enum or select.\n", TYPEget_name( t ) );
|
printf( "in addAggrTypedefs. %s is enum or select.\n", TYPEget_name( t ) );
|
||||||
//strncpy( nm, ClassName( TYPEget_name( t ) ), BUFSIZ );
|
/* strncpy( nm, ClassName( TYPEget_name( t ) ), BUFSIZ );
|
||||||
//printf("%s;%s",nm,TYPEget_ctype( t ));
|
//printf("%s;%s",nm,TYPEget_ctype( t ));
|
||||||
//if( firsttime ) {
|
//if( firsttime ) {
|
||||||
// fprintf( classes, "The first TIME\n" );
|
// fprintf( classes, "The first TIME\n" );
|
||||||
|
|
@ -610,7 +604,7 @@ static void addAggrTypedefs( Schema schema )
|
||||||
//fprintf( classes, "typedef %s\t%s;\n",
|
//fprintf( classes, "typedef %s\t%s;\n",
|
||||||
// TYPEget_ctype( t ), nm );
|
// TYPEget_ctype( t ), nm );
|
||||||
//fprintf( classes, "typedef %s *\t%sH;\n", nm, nm );
|
//fprintf( classes, "typedef %s *\t%sH;\n", nm, nm );
|
||||||
//fprintf( classes, "typedef %s *\t%s_ptr;\n", nm, nm );
|
//fprintf( classes, "typedef %s *\t%s_ptr;\n", nm, nm ); */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SCOPEod
|
SCOPEod
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue